/* i-Connect Regie – Design */
:root {
  --brand: #7ac943;
  --brand-600: #5fa82d;
  --brand-700: #4a8a20;
  --brand-soft: #eef8e6;
  --ink: #0f1113;
  --ink-2: #1b1e22;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --line: #e4e6ea;
  --text: #16181b;
  --muted: #6b717a;
  --danger: #d93a3a;
  --warn: #f5b400;
  --t-regie: #8dc63f;
  --t-service: #29a8e0;
  --t-wartung: #f5b400;
  --t-stoerung: #d63384;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f11;
    --surface: #16191d;
    --surface-2: #1d2126;
    --line: #2a2f35;
    --text: #eceef1;
    --muted: #9aa1ab;
    --brand-soft: #1c2a14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Boot */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 24px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.sidebar { display: none; }
.col { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  min-height: 56px;
}
.topbar .logo svg { height: 30px; width: auto; display: block; }
.topbar .spacer { flex: 1; }
.topbar .back { color: #fff; background: rgba(255,255,255,.08); border: 0; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.topbar-title { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; border: 0; cursor: pointer; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.sync-pill.off .dot { background: var(--warn); }
.sync-pill.pending .dot { background: var(--t-service); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

main.content { padding: 18px 16px calc(var(--nav-h) + 28px + var(--safe-b)); max-width: 1100px; width: 100%; margin: 0 auto; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.bottomnav a { display: grid; justify-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 0; }
.bottomnav a.active { color: var(--text); }
.bottomnav a.active svg { color: var(--brand-600); }
.bottomnav .fab { width: 56px; height: 56px; margin: -26px auto 0; border-radius: 18px; background: var(--brand); color: var(--ink); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(122, 201, 67, .45); }
.bottomnav .fab svg { width: 28px; height: 28px; stroke-width: 2.5; }

@media (min-width: 960px) {
  .shell { grid-template-columns: 250px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh;
    background: var(--ink); color: #c9ced6; padding: 22px 14px;
  }
  .sidebar .logo { padding: 4px 10px 22px; }
  .sidebar .logo svg { height: 36px; width: auto; }
  .sidebar a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; font-weight: 550; }
  .sidebar a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
  .sidebar a.nav.active { background: rgba(122, 201, 67, .14); color: #fff; }
  .sidebar a.nav.active svg { color: var(--brand); }
  .sidebar .new { margin: 0 0 14px; justify-content: center; }
  .sidebar .grow { flex: 1; }
  .sidebar .user { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
  .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--ink); display: grid; place-items: center; font-weight: 750; flex: none; }
  .topbar .logo { display: none; }
  .bottomnav { display: none; }
  main.content { padding: 28px 32px 60px; }
}

/* Buttons & Inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { border-color: #cfd3d9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--ink); }
.btn.primary:hover { background: #86d451; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 36px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input, input.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(122, 201, 67, .18); }
.input[readonly], .input:disabled { background: var(--surface-2); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .g2.stack, .g3.stack { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand-600); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-700); }
.card-h .ic svg { width: 18px; height: 18px; }
.card-h h2 { flex: 1; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; }

/* Hero / Dashboard */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 24px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #26301d 0%, var(--ink) 55%);
}
.hero h1 { font-size: 24px; }
.hero p { color: #b8bfc8; margin: 6px 0 18px; }
.hero .skyline { position: absolute; right: -10px; bottom: -6px; width: 300px; opacity: .14; pointer-events: none; }
.hero .dots { display: flex; gap: 6px; margin-bottom: 14px; }
.hero .dots i { width: 10px; height: 10px; border-radius: 50%; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-decoration: none; display: block; }
.stat b { display: block; font-size: 26px; font-weight: 780; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .bar { height: 4px; width: 32px; border-radius: 4px; margin-bottom: 12px; }

.type-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .type-tiles { grid-template-columns: repeat(4, 1fr); } }
.type-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.06); color: #fff; text-decoration: none; font-weight: 650; border: 1px solid rgba(255,255,255,.08); }
.type-tile:hover { background: rgba(255,255,255,.1); }
.type-tile .b { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }

/* Listen */
.list { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); cursor: pointer;
}
.item:hover { border-color: #cfd3d9; }
.item .badge-type { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.item .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: right; display: grid; gap: 6px; justify-items: end; }
.item > div { min-width: 0; }
.meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 14px; height: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-entwurf { background: #fff5d6; color: #8a6500; }
.st-abgeschlossen { background: #e3f4fb; color: #0f6f99; }
.st-abgerechnet { background: var(--brand-soft); color: var(--brand-700); }
.st-offline { background: #efe7ff; color: #5b3cc4; }
@media (prefers-color-scheme: dark) {
  .st-entwurf { background: #3a2f0d; color: #ffd76a; }
  .st-abgeschlossen { background: #0f2c3a; color: #7fd3f5; }
  .st-abgerechnet { color: #a6e07c; }
  .st-offline { background: #2a2145; color: #c3b2ff; }
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 13px; font-weight: 650; color: var(--text); cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { background: var(--brand); border-color: var(--brand); color: var(--ink); } }
.chip.add { border-style: dashed; color: var(--muted); }
.chip.add:hover { color: var(--text); border-color: var(--brand); }

.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 42px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--line); margin-bottom: 8px; }

/* Typauswahl */
.types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .types { grid-template-columns: repeat(4, 1fr); } }
.type-opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; font-weight: 650; background: var(--surface); }
.type-opt input { position: absolute; opacity: 0; }
.type-opt .b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.type-opt .b svg { width: 17px; height: 17px; }
.type-opt:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.type-opt:has(input:disabled) { cursor: default; }

/* Zeiten / Material Tabellenzeilen */
.lines { display: grid; gap: 10px; }
.line { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.line-top { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr 90px 80px; gap: 8px; align-items: end; }
.time-grid .hours { height: 46px; display: grid; place-items: center; font-weight: 780; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.mat-grid { display: grid; grid-template-columns: 1fr 90px 110px auto; gap: 8px; align-items: center; }
.mat-grid.has-price { grid-template-columns: 1fr 80px 100px 100px auto; }
@media (max-width: 560px) {
  .time-grid { grid-template-columns: 1fr 1fr; }
  .mat-grid, .mat-grid.has-price { grid-template-columns: 1fr 1fr auto; }
  .mat-grid.has-price { grid-template-columns: 1fr 1fr 1fr auto; }
  .mat-grid .name { grid-column: 1 / -1; }
}

/* Kalender */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-nav h2 { flex: 1; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .wd { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; }
.cal .d { min-height: 54px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 5px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; text-align: left; font: inherit; color: inherit; min-width: 0; }
.cal .d:hover { border-color: var(--brand); }
.cal .d.out { visibility: hidden; }
.cal .d.today .n { background: var(--brand); color: var(--ink); }
.cal .d.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
@media (prefers-color-scheme: dark) { .cal .d.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; } }
.cal .d.we { background: var(--surface-2); }
.cal .n { font-size: 12px; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--t-service); }
.cal .dots i.done { background: var(--brand); }
.cal .ev { display: none; font-size: 11px; line-height: 1.25; padding: 2px 5px; border-radius: 5px; background: #e3f4fb; color: #0f6f99; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.done { background: var(--brand-soft); color: var(--brand-700); text-decoration: line-through; }
@media (min-width: 760px) { .cal .d { min-height: 92px; } .cal .ev { display: block; } .cal .dots { display: none; } }
.appt { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.appt .time { font-weight: 780; font-size: 15px; }
.appt .time span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.appt .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.appt.done { opacity: .7; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 38px; padding: 0 12px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { background: var(--brand); color: var(--ink); } }
.lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; display: block; }
.now-btn { font-size: 11px; font-weight: 700; color: var(--brand-700); background: none; border: 0; cursor: pointer; padding: 0 0 0 6px; }
.total { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); font-weight: 700; margin-top: 10px; }
.total b { font-size: 18px; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; }
.photo input { border: 0; border-top: 1px solid var(--line); padding: 8px 10px; font: inherit; font-size: 13px; background: var(--surface); color: var(--text); min-width: 0; }
.photo input:focus { outline: none; background: var(--brand-soft); }
.photo .del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; display: grid; place-items: center; cursor: pointer; }
.photo .del svg { width: 16px; height: 16px; }
.photo .tag { position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; border-radius: 999px; }
.photo-add { aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); font-weight: 650; font-size: 13px; cursor: pointer; background: var(--surface); }
.photo-add:hover { border-color: var(--brand); color: var(--brand-700); }
.photo-add svg { width: 30px; height: 30px; }

/* Unterschrift */
.sig-wrap { position: relative; border: 2px dashed var(--line); border-radius: 14px; background: #fff; overflow: hidden; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 200px; cursor: crosshair; }
.sig-wrap .hint { position: absolute; inset: auto 0 14px; text-align: center; color: #b4b9c0; font-size: 13px; pointer-events: none; }
.sig-wrap::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid #d5d8dc; pointer-events: none; }
.sig-img { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; max-height: 200px; display: block; }

/* Sticky Aktionen im Formular */
.actionbar {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 20;
  display: flex; gap: 8px; padding: 10px; margin-top: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.actionbar .btn { flex: 1; }
.actionbar .btn.icon { flex: none; }
@media (min-width: 960px) { .actionbar { bottom: 16px; } .actionbar .btn { flex: none; } .actionbar .spacer { flex: 1; } }

.locked { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #e3f4fb; color: #0f6f99; font-weight: 600; margin-bottom: 14px; }
@media (prefers-color-scheme: dark) { .locked { background: #0f2c3a; color: #7fd3f5; } }

/* Modal & Toast */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 14, .55); display: grid; align-items: end; justify-items: center; animation: fade .15s; }
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 22px; padding-bottom: calc(22px + var(--safe-b)); animation: up .2s ease-out; }
@media (min-width: 640px) { .modal { border-radius: 22px; } }
.modal h2 { margin-bottom: 16px; font-size: 20px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-height: 88vh; border-radius: 8px; }
.lightbox p { color: #fff; text-align: center; }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 84px); z-index: 200; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 90px; } }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: 10px; align-items: center; animation: up .2s; }
.toast.err { background: var(--danger); }
.toast.ok svg { color: var(--brand); }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--ink); }
@media (min-width: 900px) { .auth { grid-template-columns: 1.1fr 1fr; } }
.auth-art { display: none; position: relative; overflow: hidden; padding: 48px; color: #fff; }
@media (min-width: 900px) { .auth-art { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-art h1 { font-size: 40px; max-width: 460px; }
.auth-art h1 em { font-style: normal; color: var(--brand); }
.auth-art p { color: #a9b0ba; max-width: 420px; }
.auth-art .skyline { position: absolute; left: 0; right: 0; bottom: 0; opacity: .12; width: 100%; }
.auth-art .logo svg { height: 44px; width: auto; }
.auth-form { display: grid; place-items: center; padding: 24px; background: var(--bg); }
@media (max-width: 899px) { .auth-form { background: var(--ink); align-content: center; gap: 24px; } .auth-form .mlogo svg { height: 40px; } }
@media (min-width: 900px) { .auth-form .mlogo { display: none; } .auth-form { border-radius: 28px 0 0 28px; } }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 28px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.auth-card h2 { font-size: 22px; }
.err-box { background: #fde8e8; color: #a31d1d; border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 14px; }

/* Einstellungen */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--brand); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.logo-prev { height: 70px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }

/* ------------------------------------------------------------------ */
/* Druckansicht (A4)                                                   */
/* ------------------------------------------------------------------ */
.print-wrap { background: #e9ebee; min-height: 100vh; padding: 20px 10px 40px; }
.print-tools { max-width: 210mm; margin: 0 auto 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.sheet { background: #fff; color: #111; width: 100%; max-width: 210mm; margin: 0 auto; padding: 16mm 15mm; box-shadow: 0 4px 30px rgba(0,0,0,.12); font-size: 10.5pt; line-height: 1.4; }
.sheet .ph { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 3px solid var(--brand); padding-bottom: 12px; }
.sheet .ph img { max-height: 60px; max-width: 220px; }
.sheet .ph .co { text-align: right; font-size: 9pt; color: #444; }
.sheet .ph .co b { font-size: 11pt; color: #111; }
.sheet .title { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 12px; }
.sheet .title h1 { font-size: 18pt; }
.sheet .title .no { font-size: 12pt; font-weight: 700; }
.sheet .boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sheet .box { border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; }
.sheet .box .k { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #777; }
.sheet h3 { font-size: 10pt; text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; color: #333; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.sheet th { background: #f2f3f5; text-align: left; padding: 5px 7px; font-size: 8pt; text-transform: uppercase; letter-spacing: .04em; }
.sheet td { padding: 5px 7px; border-bottom: 1px solid #e5e5e5; }
.sheet td.n, .sheet th.n { text-align: right; white-space: nowrap; }
.sheet tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid #111; }
.sheet .desc { white-space: pre-wrap; border: 1px solid #ddd; border-radius: 6px; padding: 8px 10px; min-height: 40px; }
.sheet .pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet .pgrid figure { margin: 0; break-inside: avoid; }
.sheet .pgrid img { width: 100%; height: 62mm; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; }
.sheet .pgrid figcaption { font-size: 8.5pt; color: #555; margin-top: 2px; }
.sheet .signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; break-inside: avoid; }
.sheet .sign { border-top: 1px solid #111; padding-top: 4px; font-size: 8.5pt; color: #444; min-height: 30px; }
.sheet .sign img { height: 70px; display: block; margin-bottom: -4px; }
.sheet .foot { margin-top: 18px; font-size: 8pt; color: #666; border-top: 1px solid #ddd; padding-top: 6px; }
.sheet table.bil { width: 60%; margin-left: auto; }
.sheet table.bil tfoot td { font-size: 11pt; background: #eef8e6; }
.sheet .flag { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #fff5d6; font-weight: 700; font-size: 9pt; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .print-wrap { padding: 0; background: #fff; }
  .print-tools, #toasts { display: none !important; }
  .sheet { box-shadow: none; max-width: none; padding: 12mm 13mm; }
  .sheet .pgrid figure { page-break-inside: avoid; }
}

.install-card { border-color: var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--surface) 60%); margin-bottom: 14px; }

/* Echtes Firmenlogo */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.brand span { font-weight: 800; font-size: 19px; letter-spacing: .04em; white-space: nowrap; }
.brand b:first-child { color: #fff; }
.brand b:last-child { color: var(--brand); }
.sidebar .brand img { width: 44px; height: 44px; }
.sidebar .brand span { font-size: 21px; }
.auth-art .brand img { width: 64px; height: 64px; }
.auth-art .brand span { font-size: 30px; }
.auth-form .mlogo .brand img { width: 56px; height: 56px; }
.auth-form .mlogo .brand span { font-size: 26px; }
.auth-form .mlogo { text-align: center; }
.auth-cover { width: calc(100% + 56px); margin: -28px -28px 4px; border-radius: 22px 22px 0 0; display: block; background: #fff; }
img.skyline { height: auto; }
.hero img.skyline { width: 340px; opacity: .13; }
.auth-art img.skyline { opacity: .16; }
.boot img { border-radius: 22px; }

/* Kostenvoranschläge & Rechnungen */
.st-red { background: #fde8e8; color: #a31d1d; }
.st-gray { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .st-red { background: #3a1414; color: #ff9b9b; } }
.doc-grid { display: grid; grid-template-columns: 130px 1fr 72px 90px 96px 96px auto; gap: 8px; align-items: center; }
.doc-grid.is-text { grid-template-columns: 130px 1fr auto; }
.doc-grid .sum { text-align: right; font-weight: 700; white-space: nowrap; }
.line-text { background: var(--brand-soft); }
@media (max-width: 760px) {
  .doc-grid { grid-template-columns: 1fr 1fr 1fr; }
  .doc-grid .name { grid-column: 1 / -1; order: -1; }
  .doc-grid .kind { grid-column: 1 / 3; }
  .doc-grid .sum { grid-column: 2 / 4; }
  .doc-grid.is-text { grid-template-columns: 1fr auto; }
  .doc-grid.is-text .kind { grid-column: auto; }
}
.item .r b { font-size: 15px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { display: grid; justify-items: start; gap: 12px; padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; font-weight: 700; }
.tile .b { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.locked a { color: inherit; font-weight: 700; }
