/* Inter is served from here instead of Google Fonts, so no visitor IP goes to Google (fonts/Inter-LICENSE.txt). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght.woff2") format("woff2-variations"), url("fonts/inter-latin-wght.woff2") format("woff2");
}

:root {
  --bg: #F5F6F7;
  --surface: #FFFFFF;
  --surface-2: #F9FAFA;
  --field: #FFFFFF;
  --ink: #111827;
  --ink-soft: #4B5563;
  --ink-faint: #8A919C;
  --line: #E5E7EB;
  --line-strong: #D1D5DB;
  --accent: #0E7C86;
  --accent-strong: #0A6169;
  --accent-soft: #E6F4F5;
  --on-accent: #FFFFFF;
  --good: #15803D; --good-soft: #E8F6EC;
  --warn: #B45309; --warn-soft: #FEF4E6;
  --bad: #B91C1C; --bad-soft: #FDECEC;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .06);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, .14);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1215;
    --surface: #171B1F;
    --surface-2: #1C2126;
    --field: #12161A;
    --ink: #ECEEF0;
    --ink-soft: #AAB1BA;
    --ink-faint: #737B85;
    --line: #262C32;
    --line-strong: #353C44;
    --accent: #3CB4BE;
    --accent-strong: #62C7CF;
    --accent-soft: #142B2E;
    --on-accent: #06181A;
    --good: #4ADE80; --good-soft: #13261A;
    --warn: #FBBF24; --warn-soft: #2A2112;
    --bad: #F87171; --bad-soft: #2C1717;
    --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px; line-height: 1.5; font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num, .stat .v, .ledger td { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.num { text-align: right; white-space: nowrap; }
.eyebrow { font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-faint); }
.muted { color: var(--ink-faint); }
.small { font-size: .82rem; }
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 700; line-height: 1.15; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand::before {
  content: ""; width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Crect width='26' height='26' rx='7'/%3E%3C/svg%3E");
}
.brand .eyebrow { display: none; }
.brand-title { font-weight: 650; font-size: .98rem; letter-spacing: -.01em; }
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a {
  text-decoration: none; font-weight: 500; color: var(--ink-soft);
  padding: 6px 12px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px;
}
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.topnav .btn { margin-left: 8px; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--warn); color: #fff; font-size: .72rem; font-weight: 700;
}

/* ---- Layout ---- */
.page { max-width: 1440px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .eyebrow { display: block; margin-bottom: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: .86rem; font-weight: 500; text-decoration: none; color: var(--ink-soft); }
.back:hover { color: var(--accent); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- Buttons ---- */
.btn {
  font: inherit; font-weight: 600; font-size: .88rem; line-height: 1;
  border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: var(--on-accent);
  white-space: nowrap; text-decoration: none; display: inline-block;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-small { padding: 7px 11px; font-size: .8rem; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; }
.btn[aria-disabled=true]:hover { background: transparent; }

/* ---- KPI cards ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .k { display: block; font-size: .8rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 6px; }
.stat .v { display: block; font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat .sub { display: block; font-size: .8rem; color: var(--ink-faint); margin-top: 4px; }

/* ---- Progress ---- */
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress.full > span { background: var(--good); }
.progress.over > span { background: var(--bad); }
.progress-label { display: flex; justify-content: space-between; font-size: .76rem; color: var(--ink-faint); margin-top: 5px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .76rem; font-weight: 600; color: var(--ink-faint); background: var(--surface-2); }
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; transition: background .12s; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table a.rowlink { font-weight: 600; text-decoration: none; color: var(--ink); }
.table td.progress-cell { min-width: 140px; }

/* ---- Gewerk cards (columns as on the customer's sketch) ---- */
/* K8: key figures in two rows (contract with the client, Fremdleistungen); "Verbleibend" spans both rows */
.kpis { display: grid; grid-template-columns: 8.5rem repeat(3, minmax(0, 1fr)) minmax(180px, 1fr); gap: 12px; margin-bottom: 24px; align-items: stretch; }
.kpi-label { align-self: center; font-size: .72rem; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; line-height: 1.35; }
.kpis .stat { padding: 12px 14px; min-width: 0; }
.kpis .stat .v { font-size: 1.2rem; }
.kpis .kpi-verbleibend { grid-column: 5; grid-row: 1 / span 2; display: flex; flex-direction: column; justify-content: center;
  border-color: var(--accent); background: var(--accent-soft); }
.kpis .kpi-verbleibend .v { font-size: 1.55rem; }

/* The Hauptauftrag card stands out from the Gewerk cards */
.gewerk.hauptauftrag { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.gewerk.hauptauftrag h3 { color: var(--accent-strong); }
.gewerk.hauptauftrag .ledger thead td,
.gewerk.hauptauftrag .ledger tr.auftrag_aktuell td { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.gewerk.hauptauftrag .ledger tbody tr,
.gewerk.hauptauftrag .gewerk-section,
.gewerk.hauptauftrag .gewerk-actions { border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.gewerk.hauptauftrag .ledger tr.total { border-top-color: var(--ink); }
.gewerk.hauptauftrag .ledger tr.link:hover td { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.gewerke { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.gewerk { display: flex; flex-direction: column; overflow: hidden; }
.gewerk-head { padding: 16px 18px 14px; }
.gewerk-head .lieferant { font-size: .84rem; color: var(--ink-soft); margin-top: 2px; }
.gewerk-head .progress { margin-top: 12px; }
.ledger { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ledger td { padding: 7px 18px; vertical-align: baseline; }
.ledger td + td { padding-left: 4px; }
.ledger td:first-child { width: 100%; }
.ledger thead td { font-size: .7rem; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; padding-bottom: 4px; border-top: 1px solid var(--line); background: var(--surface-2); }
.ledger .date { display: block; font-size: .74rem; color: var(--ink-faint); }
.ledger tbody tr { border-top: 1px solid var(--line); }
.ledger tbody tr:first-child { border-top: none; }
.ledger tr.auftrag td { font-weight: 650; }
.ledger tr.nachtrag td:first-child, .ledger tr.skonto td:first-child { padding-left: 32px; position: relative; }
.ledger tr.nachtrag td:first-child::before, .ledger tr.skonto td:first-child::before {
  content: ""; position: absolute; left: 20px; top: 0; bottom: 50%; width: 7px;
  border-left: 1.5px solid var(--line-strong); border-bottom: 1.5px solid var(--line-strong); border-bottom-left-radius: 4px;
}
.ledger tr.nachtrag .betrag { color: var(--accent-strong); }
.ledger tr.auftrag_aktuell td { font-weight: 650; background: var(--surface-2); }
.ledger tr.skonto td { font-size: .82rem; color: var(--ink-soft); }
.ledger tr.link { cursor: pointer; transition: background .12s; }
.ledger tr.link:hover td { background: var(--accent-soft); }
.ledger tr.link a { color: inherit; text-decoration: none; }
.ledger .offen-col { color: var(--ink-faint); font-size: .8rem; }
.ledger tr.total { border-top: 1.5px solid var(--ink); }
.ledger tr.total td { padding-top: 12px; padding-bottom: 14px; font-weight: 700; font-size: 1rem; }
.neg { color: var(--bad); }
.zero { color: var(--good); }
.gewerk-section { border-top: 1px solid var(--line); padding: 12px 18px 14px; }
.gewerk-section .eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--warn); }
.gewerk-section .eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: var(--warn); }
.pending { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pending a {
  display: flex; justify-content: space-between; gap: 8px; text-decoration: none;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: .84rem; color: var(--ink);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  transition: border-color .12s;
}
.pending a:hover { border-color: var(--warn); }
.pending a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending a span:last-child { color: var(--ink-soft); flex: none; }
.gewerk-actions { padding: 10px 18px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gewerk-actions .spacer { flex: 1; }
.head-actions { display: flex; gap: 8px; }
.add-card {
  border: 1.5px dashed var(--line-strong); background: transparent; border-radius: var(--radius); min-height: 180px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-soft);
  font: inherit; font-weight: 600; transition: all .15s;
}
.add-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- Document view ---- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
.preview { width: 100%; height: min(82vh, 1050px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.doc-layout > .panel { position: sticky; top: 76px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .88rem; margin: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.meta dt { color: var(--ink-faint); }
.meta dd { margin: 0; font-weight: 500; }
.form { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.herkunft { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.herkunft-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.herkunft .meta { border-bottom: none; padding-bottom: 0; font-size: .8rem; }
.ki { border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--radius-sm); background: var(--accent-soft); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ki-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ki-head .eyebrow { color: var(--accent-strong); }
.ki p { margin: 0; }
.ki p.warn { color: var(--ink); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius-sm); padding: 8px 10px; }
.ki-hinweise { margin: 0; padding-left: 18px; font-size: .8rem; display: flex; flex-direction: column; gap: 4px; }
.ki-hinweise li::marker { color: var(--warn); }
.field input.ki-wert { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--field)); }
.segmented.ki-wert { border-color: var(--accent); }
.btn[aria-busy=true] { cursor: progress; opacity: .7; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; flex: none;
  font-size: .8rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.tag small { font-weight: 500; font-size: .7rem; opacity: .8; }
.tag-bauvorhaben { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-strong); }
.tag-gewerk { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); color: var(--good); }
.tag-ausgang { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.field label, .field .label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--ink); font: inherit; transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.field input[aria-disabled=true], .field select[aria-disabled=true] { background: var(--surface-2); color: var(--ink-soft); cursor: not-allowed; border-style: dashed; }
.field input[aria-disabled=true]:focus { border-color: var(--line-strong); box-shadow: none; }
.segmented[aria-disabled=true] { opacity: .6; cursor: not-allowed; }
.segmented[aria-disabled=true] label { cursor: not-allowed; pointer-events: none; }
.field input.money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.field .hint { font-size: .78rem; color: var(--ink-faint); margin-top: 6px; }
.field .hint.warn { color: var(--ink); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius-sm); padding: 8px 10px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.segmented label {
  position: relative; flex: 1; text-align: center; padding: 7px 8px; cursor: pointer; font-size: .85rem; font-weight: 500;
  border-radius: 7px; margin: 0; color: var(--ink-soft); transition: all .12s;
}
/* Must override the generic `.field input` sizing, otherwise the hidden radios overflow the dialog. */
.field .segmented input, .segmented input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  opacity: 0; pointer-events: none;
}
.segmented label:hover { color: var(--ink); }
.segmented label:has(input:checked) { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; padding-top: 4px; }
.error { color: var(--bad); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .86rem; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.status.ok { background: var(--good-soft); color: var(--good); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.bad { background: var(--bad-soft); color: var(--bad); }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-soft); }
.empty p { margin: 0 auto 14px; max-width: 46ch; }

.toast {
  position: fixed; left: 20px; bottom: 20px; z-index: 20; max-width: min(420px, calc(100vw - 110px));
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg);
}
.toast.bad { background: var(--bad); color: #fff; }

dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(500px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(15, 18, 21, .45); backdrop-filter: blur(2px); }
.dialog-form { display: flex; flex-direction: column; gap: 16px; padding: 24px; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-label { grid-column: 1 / -1; }
  .kpis .kpi-verbleibend { grid-column: 1 / -1; grid-row: auto; order: 1; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-layout > .panel { position: static; }
  .preview { height: 70vh; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .brand-title { font-size: .9rem; }
  .topnav .btn { margin-left: 0; }
}

/* ---- Floating buttons ---- */
.fab-stack { position: fixed; right: 20px; bottom: 20px; z-index: 15; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 12px; }
.fab {
  width: 48px; height: 48px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1.2rem; font-weight: 700;
  box-shadow: var(--shadow-lg); cursor: pointer; transition: transform .15s, border-color .15s, color .15s;
}
.fab:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.fab[hidden] { display: none; }
.fab.fab-news { width: auto; padding: 0 16px; font-size: .9rem; border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

/* ---- Tour ---- */
.tour-backdrop { position: fixed; inset: 0; z-index: 40; }
.tour-shade { position: absolute; inset: 0; background: rgba(15, 18, 21, .55); }
.tour-spot {
  position: fixed; z-index: 41; pointer-events: none; border-radius: 6px;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent);
}
.tour-spot.pulse-once { animation: tour-spot-pulse .4s ease-out; }
@keyframes tour-spot-pulse { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent); } }
.tour-cursor {
  position: fixed; left: 0; top: 0; z-index: 43; pointer-events: none; color: var(--ink);
  transition: transform .7s cubic-bezier(.4, 0, .2, 1); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35));
}
.tour-cursor svg { display: block; transition: transform .12s; }
.tour-cursor.clicking svg { transform: scale(.82); }
.tour-ripple { position: absolute; left: 4px; top: 2px; width: 0; height: 0; border-radius: 99px; pointer-events: none; }
.tour-cursor.clicking .tour-ripple { animation: tour-ripple .45s ease-out forwards; }
@keyframes tour-ripple {
  from { width: 0; height: 0; margin: 0; background: color-mix(in srgb, var(--accent) 55%, transparent); }
  to { width: 56px; height: 56px; margin: -28px 0 0 -28px; background: transparent; }
}
.tour-pressed { background: var(--accent-soft) !important; }
.tour-bubble.tour-hidden { opacity: 0; pointer-events: none; }
.tour-bubble {
  position: fixed; z-index: 42; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 16px 18px; outline: none;
  transition: left .25s, top .25s, opacity .2s;
}
.tour-bubble.wide { width: min(1200px, calc(100vw - 32px)); }
.tour-bubble h2 { font-size: 1.05rem; margin: 2px 0 8px; }
.tour-body p { margin: 0 0 8px; color: var(--ink-soft); }
.tour-body p:last-child { margin-bottom: 0; }
.tour-body .tag { vertical-align: 1px; }
.tour-progress { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; font-weight: 600; color: var(--ink-faint); }
.tour-close { border: none; background: none; color: var(--ink-faint); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.tour-close:hover { color: var(--ink); background: var(--surface-2); }
.tour-figure { margin: 0 0 12px; }
.tour-figure img { display: block; width: 100%; max-height: calc(100vh - 280px); object-fit: contain; object-position: top; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.tour-figure figcaption[hidden] { display: none; }
.tour-figure figcaption { display: flex; align-items: center; justify-content: center; height: 160px; border-radius: 8px; border: 1.5px dashed var(--line-strong); color: var(--ink-faint); font-size: .85rem; background: var(--surface-2); }
.tour-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.tour-spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-bubble, .fab, .tour-shade, .tour-cursor { transition: none; }
}

/* Round-3 additions: corrections (K6), Restforderung check (K1), sections on the "Nicht zugeordnet" page (K5) */
.korrigiert { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; font-size: .68rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); cursor: help; vertical-align: 1px; }
.warn-text { color: var(--warn); cursor: help; }
.section-title { font-size: 1rem; font-weight: 650; margin: 28px 0 12px; }
.table tr.muted td { color: var(--ink-faint); }

/* ---- Login ---- */
.user-box { display: inline-flex; gap: 4px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.user-box[hidden] { display: none; }
.topnav .user-box .btn { margin-left: 0; }
body.logged-out .topnav, body.logged-out .fab-stack { display: none; }
.login { display: grid; place-items: center; min-height: 60vh; }
.login form { width: min(100%, 380px); }
.login h1 { margin-top: 4px; }
.konto-zeile { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.konto-zeile .hint { font-size: .78rem; color: var(--ink-faint); margin-top: 4px; max-width: 42ch; }
.zwei-faktor-schritte { margin: 0; padding-left: 1.2em; }
.qr { display: grid; place-items: center; }
/* Fixed light background and size: the code must stay scannable in dark mode. */
.qr svg { width: 200px; height: 200px; background: #fff; padding: 6px; border-radius: var(--radius-sm); }
