:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6eb;
  --text: #171a21;
  --muted: #687082;
  --accent: #c8102e;
  --accent-soft: #fbe7ea;
  --side: #14161c;
  --side-text: #c9ccd4;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --warn: #b26a00;
  --warn-soft: #fdf1dc;
  --info: #2459c9;
  --info-soft: #e5edfc;
  --grey-soft: #eceef2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,20,30,.06), 0 4px 16px rgba(16,20,30,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #1e222a;
    --line: #2b303a;
    --text: #e9ebf0;
    --muted: #9198a8;
    --accent: #ff4d63;
    --accent-soft: #3a1820;
    --side: #0b0c10;
    --ok: #4cc27f;
    --ok-soft: #15301f;
    --warn: #f0a63a;
    --warn-soft: #33270f;
    --info: #78a2ff;
    --info-soft: #182540;
    --grey-soft: #262a33;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #1e222a;
    --line: #2b303a;
    --text: #e9ebf0;
    --muted: #9198a8;
    --accent: #ff4d63;
    --accent-soft: #3a1820;
    --side: #0b0c10;
    --ok: #4cc27f;
    --ok-soft: #15301f;
    --warn: #f0a63a;
    --warn-soft: #33270f;
    --info: #78a2ff;
    --info-soft: #182540;
    --grey-soft: #262a33;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 20px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 10px 22px; }
.brand strong { color: #fff; display: block; font-size: 17px; letter-spacing: .3px; }
.brand span { font-size: 12px; color: #8b90a0; text-transform: uppercase; letter-spacing: 1.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 9px;
  color: var(--side-text); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active .ic { color: var(--accent); }
.ic { width: 20px; text-align: center; font-size: 16px; opacity: .95; }
.legal { font-size: 12px; padding: 0 12px 6px; color: #6b7080; }
.legal a { color: #8b90a0; text-decoration: none; }
.legal a:hover { color: #fff; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; display: block; }
.sync { display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 10px 12px; color: #8b90a0; cursor: pointer; border-radius: 9px; }
.sync:hover { background: rgba(255,255,255,.05); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7080; flex-shrink: 0; }
.dot.ok { background: #3ec474; }
.dot.busy { background: #f0a63a; animation: pulse 1s infinite; }
.dot.err { background: #ff4d63; }
@keyframes pulse { 50% { opacity: .35; } }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 32px 6px; flex-wrap: wrap;
}
.topbar h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { padding: 16px 32px 48px; max-width: 1280px; width: 100%; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 500;
  text-decoration: none; color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; font-size: 16px; }
.icon-btn:hover { background: var(--grey-soft); color: var(--text); }

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.two { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 0 8px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -.3px; }
.kpi .sub { color: var(--muted); font-size: 12.5px; }

/* Lists */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 11px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-2); }
.row .date {
  width: 52px; flex-shrink: 0; text-align: center; border-radius: 9px;
  background: var(--grey-soft); padding: 5px 0; line-height: 1.1;
}
.row .date b { display: block; font-size: 18px; }
.row .date small { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.row .main-col { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; flex-shrink: 0; font-size: 13.5px; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 650; border-bottom: none; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--muted); }
.badge.anfrage { background: var(--info-soft); color: var(--info); }
.badge.angebot { background: var(--warn-soft); color: var(--warn); }
.badge.bestaetigt { background: var(--ok-soft); color: var(--ok); }
.badge.durchgefuehrt { background: var(--grey-soft); color: var(--text); }
.badge.abgerechnet { background: var(--grey-soft); color: var(--muted); }
.badge.abgesagt { background: var(--accent-soft); color: var(--accent); text-decoration: line-through; }
.badge.outlook { background: var(--info-soft); color: var(--info); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }

/* Filters */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input[type=search] { flex: 1; min-width: 180px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Forms */
.form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 9px 11px; width: 100%; min-width: 0; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

/* Detail page */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head h2 { margin: 0 0 4px; font-size: 21px; }
.detail-head .meta { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.check-item { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.check-item:last-child { border-bottom: none; }
.check-item span { flex: 1; }
.check-item.done span { color: var(--muted); text-decoration: line-through; }
.progress { height: 6px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); }

.log-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.log-item:last-child { border-bottom: none; }
.log-item .meta { color: var(--muted); font-size: 12.5px; }

.inline-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.inline-add > * { flex: 1; min-width: 120px; }
.inline-add > .btn { flex: 0 0 auto; }

.sum-line { display: flex; justify-content: space-between; padding: 6px 0; }
.sum-line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 16px; }

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { margin: 0 8px; font-size: 18px; min-width: 160px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; }
.cal .day { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day:nth-child(7n) { border-right: none; }
.cal .day.other { background: var(--surface-2); }
.cal .day.other .n { color: var(--muted); opacity: .6; }
.cal .day.today .n { background: var(--accent); color: #fff; border-radius: 99px; }
.cal .n { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; }
.ev { font-size: 12px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-left: 3px solid; }
.ev.booking { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.ev.booking.anfrage, .ev.booking.angebot { background: var(--warn-soft); border-color: var(--warn); }
.ev.outlook { background: var(--info-soft); border-color: var(--info); color: var(--text); }
button.ev { display: block; width: 100%; text-align: left; font: inherit; font-size: 12px; border-top: 0; border-right: 0; border-bottom: 0; }
button.ev.outlook:hover { filter: brightness(0.97); outline: 1px dashed var(--info); }
.ev.conflict { outline: 2px solid var(--accent); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text); font-size: 14px; margin-bottom: 14px; }
.notice.warn { background: var(--warn-soft); }
.notice.err { background: var(--accent-soft); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,12,18,.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 17px; }
.modal .body { padding: 18px 20px; }
.modal footer { display: flex; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal footer .r { display: flex; gap: 8px; margin-left: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.25); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hstack { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

.tabbar { display: none; }

/* Mobile */
@media (max-width: 900px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.two { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { padding: 16px 16px 4px; }
  .topbar h1 { font-size: 21px; }
  .view { padding: 10px 16px 96px; }
  .card { padding: 14px 14px; }
  .form { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .kpi .value { font-size: 22px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .tabbar a .ic { font-size: 18px; }
  .tabbar a.active { color: var(--accent); }
  .cal .day { min-height: 64px; padding: 3px; }
  .cal .dow { padding: 6px 2px; font-size: 11px; }
  .ev { font-size: 10.5px; padding: 1px 3px; }
  .ev .t { display: none; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { border-radius: 0; max-width: none; min-height: 100%; }
  .hide-sm { display: none; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.responsive td { display: flex; justify-content: space-between; border: none; padding: 3px 4px; }
  table.responsive td::before { content: attr(data-l); color: var(--muted); font-size: 13px; margin-right: 12px; }
  table.responsive tfoot tr { border: none; }
}

/* ===== v3: Usability ===== */
.nav-new { display: flex; gap: 12px; align-items: center; width: 100%; margin: 0 0 10px; padding: 10px 12px; border-radius: 9px; border: none; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; text-align: left; }
.nav-new:hover { filter: brightness(1.08); }
.nav-new span:nth-child(2) { flex: 1; }
.nav-new kbd { background: rgba(255,255,255,.2); border: none; color: #fff; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #6b7080; padding: 14px 12px 4px; }
.nav-sep:empty { padding: 6px 0; }
kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); }
.btn.icon-only { width: 38px; padding: 8px 0; font-size: 17px; }
.prewrap { white-space: pre-wrap; }
.ok-text { color: var(--ok); font-weight: 500; }
.warn-text { color: var(--warn); font-weight: 500; }
.form-heading { font-weight: 600; margin-top: 6px; }
.num-in { text-align: right; }
.card.link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card.link:hover { border-color: var(--accent); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grey-soft); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.due-pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.qa { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.avail { font-size: 13.5px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); min-height: 20px; }
.toast { display: flex; gap: 12px; align-items: center; }
.toast[hidden] { display: none; }
.toast-btn { background: none; border: none; color: var(--accent-soft); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
@media (prefers-color-scheme: dark) { .toast-btn { color: var(--accent); } }

/* Segment-Schalter */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); flex-shrink: 0; }
.seg > * { border: none; background: none; padding: 7px 14px; cursor: pointer; font-weight: 500; color: var(--muted); text-decoration: none; font-size: 14px; }
.seg > .active { background: var(--text); color: var(--surface); }

/* Detail-Kopf & Menü */
.detail-head h2 { margin: 6px 0 4px; }
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; min-width: 220px; display: flex; flex-direction: column; }
.menu-pop button { text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-pop button:hover:not(:disabled) { background: var(--surface-2); }
.menu-pop button:disabled { color: var(--muted); cursor: default; font-weight: 600; }
.menu-pop button.danger { color: var(--accent); }
.menu-pop hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 6px 10px 2px; }

/* Pipeline */
.board { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 140px; display: flex; flex-direction: column; gap: 8px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 2px 4px; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); cursor: grab; }
.kcard:hover { border-color: var(--accent); }
.kcard.dragging { opacity: .45; }
.kcard.due { border-left: 3px solid var(--warn); }
.kt { font-weight: 600; font-size: 14px; }
.km { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kb { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; font-weight: 600; }

/* Preis & Zahlung */
.addon-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.pay-row { display: grid; grid-template-columns: 22px minmax(0,1fr) 140px 30px; gap: 6px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-row input[type=date] { grid-column: 3; grid-row: 1; }
.pay-row input.num-in { grid-column: 2 / 3; grid-row: 2; max-width: 140px; }
.pay-row .icon-btn { grid-column: 4; grid-row: 1; }
.pay-row.paid input:not([type=checkbox]) { color: var(--muted); text-decoration: line-through; }
.pay-row.overdue input[type=date] { border-color: var(--warn); color: var(--warn); }
.tl-row { display: grid; grid-template-columns: 120px minmax(0,1fr) 30px; gap: 8px; align-items: center; padding: 4px 0; }
.log-form { background: var(--surface-2); border-radius: 10px; padding: 4px 12px 12px; }
details.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
details.tpl summary { cursor: pointer; font-weight: 600; }
details.tpl[open] summary { margin-bottom: 12px; }
details.tpl .btn { margin-top: 10px; }

/* Einstellungen */
.settings { display: grid; grid-template-columns: 180px minmax(0, 860px); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 7px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.settings-nav a:hover { background: var(--surface); color: var(--text); }
.settings .card { scroll-margin-top: 16px; }

/* Auswertung */
.bars { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 6px; height: 220px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.bar { flex: 1; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar i { filter: brightness(1.15); }
.bar-val { font-size: 11px; color: var(--muted); text-align: center; height: 16px; }
.bar-lbl { font-size: 11.5px; color: var(--muted); text-align: center; padding-top: 6px; border-top: 1px solid var(--line); }
.hbar { position: relative; display: flex; align-items: center; gap: 8px; min-width: 140px; }
.hbar i { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.hbar span { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Kalender: Feiertage */
.cal .day { cursor: pointer; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.hol .n { color: var(--accent); }
.hol-name { font-size: 10.5px; color: var(--accent); line-height: 1.1; }

/* Jahresplan */
.yp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.yp-title { font-size: 18px; }
.yp-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; align-items: center; }
.yp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg-b { background: var(--accent); } .lg-o { background: var(--warn); } .lg-ol { background: var(--info); } .lg-we { background: var(--grey-soft); border: 1px solid var(--line); }
.yp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.yp { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; font-size: 11.5px; }
.yp th { text-align: left; padding: 6px 6px; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text); background: var(--surface-2); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.yp th small { float: right; color: var(--muted); font-weight: 600; }
.yp td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0 4px; height: 22px; vertical-align: middle; overflow: hidden; white-space: nowrap; cursor: pointer; }
.yp td:hover { background: var(--surface-2); }
.yp td.x { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--grey-soft) 4px 5px); cursor: default; }
.yp td.we { background: var(--grey-soft); }
.yp td.hol { background: var(--accent-soft); }
.yp td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.yp td.conflict { box-shadow: inset 3px 0 0 var(--warn); }
.yp .dn { display: inline-block; width: 30px; font-weight: 600; font-variant-numeric: tabular-nums; vertical-align: middle; }
.yp .dn i { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 3px; font-size: 10px; }
.yp .ents { display: inline-flex; gap: 2px; max-width: calc(100% - 32px); overflow: hidden; vertical-align: middle; }
.yp .e { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 4px; border-radius: 3px; font-size: 10.5px; font-weight: 600; text-decoration: none; color: #fff; background: var(--accent); }
.yp .e.anfrage, .yp .e.angebot { background: var(--warn); }
.yp .e.durchgefuehrt, .yp .e.abgerechnet { background: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.yp .e.outlook { background: var(--info-soft); color: var(--info); font-weight: 500; }
.yp .ol { display: contents; }
.yp .hn { font-size: 10px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }

/* Dokumente (A4) */
.paper-wrap { overflow-x: auto; padding: 4px 0 24px; }
.paper { width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; color: #1b1d22; box-shadow: 0 4px 30px rgba(0,0,0,.12); padding: 18mm 18mm 16mm; font-size: 10.5pt; line-height: 1.45; position: relative; }
.paper .muted { color: #6b7180; }
.lh { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--doc-accent, #c8102e); padding-bottom: 10px; margin-bottom: 18px; }
.lh-brand b { font-size: 16pt; letter-spacing: .3px; }
.lh-addr { text-align: right; font-size: 9pt; color: #555; }
.sender-line { font-size: 7.5pt; color: #777; text-decoration: underline; margin-bottom: 4px; }
.doc-top { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.recipient { min-height: 28mm; font-size: 10.5pt; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 9.5pt; margin: 0; align-content: start; }
.doc-meta dt { color: #666; } .doc-meta dd { margin: 0; text-align: right; font-weight: 600; }
.doc-meta.wide { grid-template-columns: 110px 1fr; margin-bottom: 14px; } .doc-meta.wide dd { text-align: left; font-weight: 500; }
.doc-title { font-size: 15pt; margin: 0 0 12px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 10pt; }
.doc-table th { text-transform: none; letter-spacing: 0; font-size: 9pt; color: #555; border-bottom: 1.5px solid #333; padding: 6px 6px; }
.doc-table td { border-bottom: 1px solid #ddd; padding: 7px 6px; }
.doc-table .muted { font-size: 9pt; }
.doc-sums { margin-left: auto; width: 62%; font-size: 10pt; margin-bottom: 14px; }
.doc-sums > div { display: flex; justify-content: space-between; padding: 3px 6px; }
.doc-sums .t { font-weight: 700; border-top: 1.5px solid #333; margin-top: 4px; padding-top: 6px; }
.doc-foot { position: absolute; left: 18mm; right: 18mm; bottom: 10mm; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; font-size: 7.5pt; color: #666; border-top: 1px solid #ccc; padding-top: 6px; }
.paper h3 { font-size: 10pt; text-transform: uppercase; letter-spacing: .6px; color: #555; margin: 14px 0 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* FAB (Handy) */
.fab { display: none; }

@media (max-width: 1100px) { .settings { grid-template-columns: 1fr; } .settings-nav { display: none; } }
@media (max-width: 720px) {
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 28px; box-shadow: 0 6px 20px rgba(200,16,46,.4); z-index: 41; cursor: pointer; }
  body[data-view="dokument"] .fab, body[data-view="einstellungen"] .fab, body[data-view="vertrag"] .fab { display: none; }
  .topbar-actions .btn.primary[data-action="quickInquiry"] { display: none; }
  .board { grid-template-columns: repeat(5, 78vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .tl-row { grid-template-columns: 96px 1fr 30px; }
  .detail-head > .hstack { width: 100%; }
  .detail-head > .hstack .btn.primary { flex: 1; }
  .paper { transform-origin: top left; }
  .bars { height: 160px; gap: 3px; }
  .bar-val { font-size: 9px; }
  .two-col { grid-template-columns: 1fr; }
}

/* ===== Druck ===== */
@media print {
  html, body { background: #fff !important; }
  .sidebar, .topbar, .tabbar, .fab, .toast, .modal-backdrop, .no-print, .cal-head { display: none !important; }
  .main, .view { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .app { display: block; min-height: 0; }
  /* Dokumente */
  .paper-wrap { padding: 0; overflow: visible; }
  .paper { box-shadow: none; width: auto; min-height: 0; padding: 0; margin: 0; height: 268mm; }
  .doc-foot { left: 0; right: 0; bottom: 0; }
  /* Jahresplan auf eine A4-Seite quer */
  body.printing-landscape .view > *:not(.print-area) { display: none !important; }
  .year-print { color: #111; }
  .yp-head { margin-bottom: 2mm; }
  .yp-title { font-size: 12pt; }
  .yp-legend { font-size: 7pt; gap: 8px; }
  .yp-scroll { overflow: visible; border: 0.3mm solid #999; border-radius: 0; }
  .yp { min-width: 0; font-size: 6.2pt; }
  .yp th { font-size: 7pt; padding: 0.8mm 1mm; background: #eee !important; border-color: #999; }
  .yp td { height: 5.55mm; padding: 0 0.8mm; border-color: #bbb; }
  .yp .dn { width: 6.2mm; } .yp .dn i { font-size: 5pt; margin-left: 0.5mm; }
  .yp .ents { max-width: calc(100% - 6.4mm); }
  .yp .e { font-size: 5.6pt; padding: 0 0.6mm; border-radius: 0.6mm; }
  .yp td.we { background: #eee !important; } .yp td.hol { background: #fbe3e7 !important; } .yp td.today { outline: none; }
  .yp .e, .yp td, .yp th, .yp-legend i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper, .lh, .doc-table { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Verträge ===== */
.tpl-card { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.tpl-card:hover { border-color: var(--accent); }
.tpl-card span { color: var(--muted); font-size: 13px; }
.ct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ct-layout { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 20px; align-items: start; }
.ct-questions { display: flex; flex-direction: column; gap: 14px; }
.ct-step h2 { justify-content: flex-start; }
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; }
.cq { padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.cq:last-child { border-bottom: none; }
.cq-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.cq-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.cq-preview { font-size: 12.5px; color: var(--muted); }
.cq-preview ul { margin: 4px 0 0; padding-left: 18px; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap > * { flex: 1 1 auto; }
.seg button:disabled { cursor: default; opacity: .7; }
.ct-preview-wrap { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; border-radius: 12px; background: var(--grey-soft); padding: 10px; }
.ct-preview-bar { padding: 0 4px 8px; }
.paper.contract { width: 100%; max-width: 210mm; min-height: 0; padding: 14mm 15mm; font-size: 9.6pt; line-height: 1.5; }
.ct-title { font-size: 17pt; margin: 6px 0 2px; }
.ct-no { color: #666; font-size: 9pt; margin: 0 0 10px; }
.ct-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 6px 0 14px; padding: 10px 12px; background: #f6f6f8; border-radius: 6px; }
.ct-role { font-size: 8pt; text-transform: uppercase; letter-spacing: 1px; color: #777; margin-bottom: 3px; }
.ct-sec h3 { font-size: 10.5pt; text-transform: none; letter-spacing: 0; color: #1b1d22; margin: 14px 0 4px; }
.ct-sec p { margin: 0 0 4px; }
.ct-ol { margin: 0; padding-left: 20px; }
.ct-ol li { margin-bottom: 4px; }
.ct-ul { margin: 4px 0; padding-left: 18px; }
.ct-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 9pt; }
.ct-table td { padding: 3px 6px; border-bottom: 1px solid #e5e5e5; }
.ct-table tr.t td { font-weight: 700; }
.ct-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 34px; font-size: 8.5pt; color: #555; }
.ct-line { border-bottom: 1px solid #333; height: 28px; margin-bottom: 3px; }
.ct-small { font-size: 7.5pt; color: #888; margin-top: 16px; }
@media (max-width: 1100px) { .ct-layout { grid-template-columns: 1fr; } .ct-preview-wrap { position: static; max-height: none; } }
@media (max-width: 720px) { .paper.contract { padding: 8mm 6mm; font-size: 9pt; } .ct-parties, .ct-sign { grid-template-columns: 1fr; } }
@media print {
  body[data-view="vertrag"] .ct-layout { display: block; }
  body[data-view="vertrag"] .ct-preview-wrap { position: static; max-height: none; overflow: visible; background: none; padding: 0; }
  .paper.contract { height: auto !important; padding: 0; max-width: none; font-size: 9.5pt; }
  .ct-sec { break-inside: avoid; }
  .ct-sign { break-inside: avoid; }
  .ct-parties { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== v5: Icons, Dashboard, Branchen ===== */
svg.i { display: block; flex-shrink: 0; }
.ic { display: inline-grid; place-items: center; width: 22px; height: 22px; }
.nav a .ic, .nav-new .ic { color: inherit; }
.card h2 svg.i { display: inline-block; vertical-align: -3px; margin-right: 6px; color: var(--accent); }
.btn svg.i { display: inline-block; }
.btn.big { padding: 11px 18px; font-size: 15px; }

/* Begrüßung */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 22px 24px; border-radius: 16px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--side) 0%, color-mix(in srgb, var(--accent) 20%, var(--side)) 100%); color: #eef0f4; }
.hero a { color: color-mix(in srgb, var(--accent) 45%, #fff); }
.hero-date { font-size: 13px; color: #a5aab6; text-transform: capitalize; }
.hero-title { font-size: 26px; margin: 2px 0 4px; letter-spacing: -.3px; }
.hero-sub { color: #c9ccd4; font-size: 14.5px; max-width: 620px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-search { display: flex; align-items: center; gap: 10px; min-width: 300px; padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); color: #c9ccd4; cursor: pointer; font-size: 14px; text-align: left; }
.hero-search:hover { background: rgba(255,255,255,.12); }
.hero-search span { flex: 1; }
.hero-search kbd { background: rgba(255,255,255,.12); border: none; color: #c9ccd4; }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: transform .12s, border-color .12s, box-shadow .12s; min-height: 132px; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(16,20,30,.08); }
.tile:active { transform: translateY(0); }
.tile-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.tile-title { font-weight: 600; font-size: 14px; }
.tile-big { font-size: 22px; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-info { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-badge { position: absolute; top: 12px; right: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--grey-soft); color: var(--text); }
.tile-badge.warn { background: var(--warn-soft); color: var(--warn); }
.tile-badge.info { background: var(--info-soft); color: var(--info); }
.tile-badge.danger { background: var(--accent); color: #fff; }

/* Listen-Icons */
.row-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--grey-soft); color: var(--muted); }
.row-ic.warn { background: var(--warn-soft); color: var(--warn); }
.row-ic.danger { background: var(--accent-soft); color: var(--accent); }
.row-go { color: var(--muted); }
.row:hover .row-go { color: var(--accent); }
.empty svg.i { display: inline-block; color: var(--ok); }
.doc-line { cursor: default; }
.doc-line .main-col { text-decoration: none; color: inherit; cursor: pointer; }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; margin-top: 3px; }
.st-ok { background: var(--ok-soft); color: var(--ok); } .st-warn { background: var(--warn-soft); color: var(--warn); }
.st-info { background: var(--info-soft); color: var(--info); } .st-danger { background: var(--accent-soft); color: var(--accent); } .st-muted { background: var(--grey-soft); color: var(--muted); }

/* Branchen-Auswahl */
.welcome { margin-bottom: 18px; border: 2px solid var(--accent); }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.prof-grid.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.prof { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font-weight: 500; font-size: 13.5px; color: var(--text); }
.prof svg.i { color: var(--muted); }
.prof:hover { border-color: var(--accent); }
.prof.on { border-color: var(--accent); background: var(--accent-soft); }
.prof.on svg.i { color: var(--accent); }

@media (max-width: 720px) {
  .hero { padding: 18px 16px; }
  .hero-title { font-size: 22px; }
  .hero-search { min-width: 0; flex: 1 1 100%; }
  .hero-search kbd { display: none; }
  .hero-actions { width: 100%; }
  .hero-actions .btn.primary { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 118px; padding: 13px; }
  .tile-big { font-size: 18px; }
  .tile-ic { width: 36px; height: 36px; margin-bottom: 6px; }
  .prof-grid, .prof-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-line { flex-wrap: wrap; }
  .tabbar a .ic { width: 24px; height: 24px; }
}
@media print { .hero, .tiles { display: none !important; } }
.h2l { display: inline-flex; align-items: center; gap: 2px; }

/* ===== v6: Login & Speicherort ===== */
body.gated .app, body.gated .tabbar, body.gated .fab { display: none !important; }
#gate { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(200,16,46,.18), transparent 60%), var(--bg); }
.gate-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(16,20,30,.12); padding: 28px; }
.gate-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.gate-brand b { display: block; font-size: 20px; }
.gate-brand span { color: var(--muted); font-size: 13px; }
.gate-card h1 { font-size: 22px; margin: 0 0 8px; }
.gate-tabs { width: 100%; margin-bottom: 16px; }
.gate-tabs button { flex: 1; }
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate-form .btn.big { width: 100%; }
.gate-form a.small { text-align: center; }
.gate-check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.gate-foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--muted); }
.gate-foot a { color: var(--muted); }
.st-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.st-opt { display: flex; gap: 14px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; }
.st-opt:hover:not(.off) { border-color: var(--accent); }
.st-opt.off { opacity: .55; }
.st-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.st-body p { margin: 4px 0 10px; color: var(--muted); font-size: 13.5px; }
.userbox { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; font-size: 12.5px; color: #a5aab6; }
.userbox:empty { display: none; }
.ub-mail { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox .icon-btn { color: #a5aab6; }
.userbox .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
@media (max-width: 720px) { .gate-card { padding: 20px 16px; border-radius: 14px; } #gate { padding-top: 16px; } }

/* Neue Anfrage: Foto, unsichere Felder, Adressvorschläge */
.scan-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; margin-bottom: 14px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2, transparent); }
.scan-box .btn { display: inline-flex; align-items: center; gap: 6px; }
.f.unsure input, .f.unsure select, .f.unsure textarea { background: var(--warn-soft, #fff6d6); border-color: var(--warn, #c98a00); }
.addr-pop { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 2px; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 300px; overflow: auto; }
.addr-pop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; cursor: pointer; }
.addr-pop button:hover { background: var(--info-soft); }
.addr-src { font-size: 11px; color: var(--muted); padding: 4px 10px; text-align: right; }

/* Dichte: kompakt */
[data-density="compact"] body { font-size: 14px; }
[data-density="compact"] .card { padding: 12px 14px; }
[data-density="compact"] .grid { gap: 10px; }
[data-density="compact"] .row { padding: 7px 4px; gap: 10px; }
[data-density="compact"] .btn { padding: 6px 11px; }
[data-density="compact"] .btn.small { padding: 4px 8px; }
[data-density="compact"] .view { padding: 10px 24px 36px; }
[data-density="compact"] .tile { min-height: 104px; padding: 12px; }
[data-density="compact"] .topbar h1 { font-size: 20px; }

/* Startseite: Varianten */
.hero.slim { padding: 12px 18px; }
.hero.slim .hero-title { font-size: 18px; margin: 2px 0; }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tiles.compact .tile { min-height: 0; padding: 10px 12px; }
.tiles.compact .tile-ic, .tiles.compact .tile-info { display: none; }
.tiles.compact .tile-big { font-size: 18px; }

/* Einstellungen: Darstellung */
.f.seg-f { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); background: var(--c); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tile-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; margin: 8px 0; }
.tile-edit-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); }
.tile-edit-row.off label { color: var(--muted); }
.tile-edit-row label { display: flex; gap: 8px; align-items: center; color: var(--text); font-weight: 400; }
.doc-layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.doc-layout { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.doc-layout.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dl-prev { display: flex; flex-direction: column; gap: 4px; height: 64px; padding: 8px; border-radius: 6px; background: #fff; border: 1px solid #e3e6eb; }
.dl-prev i { display: block; height: 5px; border-radius: 2px; background: #d9dce2; }
.dl-prev i:first-child { height: 9px; width: 55%; background: var(--accent); }
.dl-modern i:first-child { width: 100%; height: 16px; }
.dl-elegant { align-items: center; } .dl-elegant i:first-child { width: 40%; background: #333; }
.dl-minimal i:first-child { width: 35%; background: #888; }
.logo-prev { max-height: 40px; max-width: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 3px; background: #fff; }

/* Dokument-Layouts */
.lh-brand { display: flex; align-items: center; gap: 12px; }
.lh-logo { max-height: 18mm; max-width: 55mm; object-fit: contain; }
.paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.paper.doc-modern .lh { background: var(--doc-accent); color: #fff; border: 0; margin: -18mm -18mm 18px; padding: 10mm 18mm 8mm; }
.paper.doc-modern .lh-addr { color: rgba(255,255,255,.9); }
.paper.doc-modern.contract .lh { margin: -14mm -15mm 16px; padding: 9mm 15mm 7mm; }
.paper.doc-modern .doc-title { color: var(--doc-accent); }
.paper.doc-modern .doc-table th { background: color-mix(in srgb, var(--doc-accent) 10%, #fff); border-bottom: 0; }
.paper.doc-elegant { font-family: Georgia, "Times New Roman", serif; }
.paper.doc-elegant .lh { flex-direction: column; align-items: center; text-align: center; border-bottom: 1px solid #b9b2a6; padding-bottom: 12px; }
.paper.doc-elegant .lh-brand { flex-direction: column; }
.paper.doc-elegant .lh-brand b { font-weight: 400; font-size: 20pt; letter-spacing: 2px; text-transform: uppercase; }
.paper.doc-elegant .lh-addr { text-align: center; }
.paper.doc-elegant .lh-addr br { display: none; }
.paper.doc-elegant .lh-addr { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 10px; }
.paper.doc-elegant .lh-addr span + br + span::before { content: '·'; margin-right: 10px; }
.paper.doc-elegant .doc-title, .paper.doc-elegant .ct-title { font-weight: 400; letter-spacing: 1px; text-align: center; }
.paper.doc-elegant .doc-table th { border-bottom: 1px solid #b9b2a6; font-weight: 400; font-style: italic; }
.paper.doc-minimal .lh { border-bottom: 0; padding-bottom: 0; margin-bottom: 26px; }
.paper.doc-minimal .lh-brand b { font-weight: 500; }
.paper.doc-minimal .doc-table th { border-bottom: 1px solid #ccc; color: #888; }
.paper.doc-minimal .doc-table td { border-bottom-color: #f0f0f0; }
.paper.doc-minimal .doc-sums .t { border-top-width: 1px; }
.paper.doc-minimal .doc-foot { border-top: 0; }

@media print { .paper { zoom: 1 !important; } }

/* Einrichtung aus Datei */
.setup-form .form-heading { margin-top: 14px; }
.setup-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 400; }
.setup-row input { flex-shrink: 0; }
.setup-table td { vertical-align: top; }
.setup-table input[name^="ofn_"] { width: 100%; min-width: 160px; }
.setup-table .num-in { width: 100px; }

/* Spracheingabe / Text einfügen */
.dictate-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.dictate-box textarea { width: 100%; resize: vertical; }
.btn.rec { background: var(--accent); border-color: var(--accent); color: #fff; animation: recpulse 1.4s ease-in-out infinite; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }

/* App installieren */
.install-card { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.install-card img { border-radius: 10px; flex-shrink: 0; }
.install-card .main-col { flex: 1; min-width: 0; }
@media (max-width: 720px) { .install-card { flex-wrap: wrap; } .install-card .hstack { width: 100%; justify-content: space-between; } }
.install-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.install-steps li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.install-steps .step-no { flex-shrink: 0; margin-top: 1px; }
.ios-share { display: inline-flex; vertical-align: middle; color: var(--info); }

/* Kalender-Import */
.ics-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
#icsForm:not(.show-past) .setup-row.past { display: none; }
.setup-row.past { opacity: .6; }
