/* Hausinvestitionen – Stylesheet
   Grundidee: ein Hausbuch. Ruhige Steingrau-Flächen, ein tiefes Tannengrün,
   Beträge in einer Buchschrift mit doppelter Summenlinie wie im Kassenbuch. */

:root {
  color-scheme: light;
  --bg: #edf0ee;
  --surface: #ffffff;
  --surface-2: #f5f7f6;
  --ink: #17201e;
  --ink-2: #44504d;
  --muted: #66726f;
  --line: #d6ddda;
  --line-strong: #b9c4c0;
  --accent: #1e5b50;
  --accent-hover: #174a41;
  --accent-ink: #ffffff;
  --accent-soft: #e1ece9;
  --bar: #2e7a6c;
  --bar-dim: #a9cbc3;
  --bar-hover: #1e5b50;
  --grid: #e6ebe9;
  --ok: #24693a;      --ok-bg: #e2f0e5;
  --warn: #8a5100;    --warn-bg: #fbeed6;
  --err: #a12a2a;     --err-bg: #f8e1df;
  --info: #1e5b50;    --info-bg: #e1ece9;
  --shadow: 0 1px 2px rgba(23, 32, 30, .06);
  --radius: 10px;
  --radius-s: 6px;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --late: #b3261e; --late-bg: #fbe3e0;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-book: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1513;
    --surface: #171f1d;
    --surface-2: #1d2724;
    --ink: #e6ecea;
    --ink-2: #bcc7c3;
    --muted: #93a09c;
    --line: #2b3633;
    --line-strong: #3b4844;
    --accent: #5fb3a2;
    --accent-hover: #78c4b4;
    --accent-ink: #0d1a17;
    --accent-soft: #1d3430;
    --bar: #4fa897;
    --bar-dim: #2b4f48;
    --bar-hover: #7fcdbc;
    --grid: #232d2a;
    --ok: #7fc98f;      --ok-bg: #16291b;
    --warn: #e9b764;    --warn-bg: #33280f;
    --err: #f0897f;     --err-bg: #3a1b19;
    --info: #8fd0c2;    --info-bg: #1a2f2b;
    --shadow: none;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --late: #ff9d92; --late-bg: #3f1b18;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1513; --surface: #171f1d; --surface-2: #1d2724; --ink: #e6ecea; --ink-2: #bcc7c3; --muted: #93a09c;
  --line: #2b3633; --line-strong: #3b4844; --accent: #5fb3a2; --accent-hover: #78c4b4; --accent-ink: #0d1a17;
  --accent-soft: #1d3430; --bar: #4fa897; --bar-dim: #2b4f48; --bar-hover: #7fcdbc; --grid: #232d2a;
  --ok: #7fc98f; --ok-bg: #16291b; --warn: #e9b764; --warn-bg: #33280f; --err: #f0897f; --err-bg: #3a1b19;
  --info: #8fd0c2; --info-bg: #1a2f2b; --shadow: none;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --late: #ff9d92; --late-bg: #3f1b18;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-book); font-weight: 600; line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.005em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; margin-top: 1.4em; }
p { margin: 0 0 .9em; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.pad { padding: .25rem 0; }
.inline { display: inline; margin: 0; }
.ic { width: 18px; height: 18px; flex: none; }
.ic-xs { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: .6rem 1.25rem; display: flex; align-items: center; gap: 1.25rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-family: var(--font-book); font-weight: 600; font-size: 1.08rem; white-space: nowrap; }
.brand-ic { width: 26px; height: 26px; color: var(--accent); }
.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a { display: flex; align-items: center; gap: .45rem; padding: .45rem .75rem; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.mainnav a:hover { background: var(--surface-2); color: var(--ink); }
.mainnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: .4rem; }

/* ---------- Seite ---------- */
.page { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-block; font-size: .88rem; margin-bottom: .35rem; text-decoration: none; }
.back::before { content: "‹ "; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 500; line-height: 1.2; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: .55rem .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-icon { padding: .45rem; }
.btn-small { padding: .3rem .65rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.danger, .danger { color: var(--err); }
.btn.danger:hover { background: var(--err-bg); color: var(--err); }
.push { margin-left: auto; }

/* ---------- Hinweise ---------- */
.notice { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .9rem; border-radius: var(--radius-s); margin-bottom: 1rem; font-size: .93rem; flex-wrap: wrap; }
.notice > span { flex: 1; min-width: 12rem; }
.notice .ic { margin-top: 2px; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-error { background: var(--err-bg); color: var(--err); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice-info { background: var(--info-bg); color: var(--info); align-items: center; }
.notice[hidden] { display: none; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.1rem; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; }
.link { font-size: .88rem; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Hero / Summen ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2rem; align-items: center; padding: .5rem 0 1.4rem; }
.hero-label { color: var(--ink-2); margin: 0 0 .2rem; font-size: 1rem; }
.hero-num {
  font-family: var(--font-book); font-weight: 600; font-size: clamp(2.4rem, 6vw, 3.9rem); line-height: 1.05;
  margin: 0; letter-spacing: -.02em; display: inline-block;
  /* doppelte Summenlinie wie im Kassenbuch */
  border-bottom: 4px double var(--ink); padding-bottom: .12em;
}
.hero-sub { color: var(--muted); margin: .6rem 0 0; }
.hero-stats { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line-strong); }
.hero-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.hero-stats dt { color: var(--ink-2); font-size: .93rem; }
.hero-stats dd { margin: 0; font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.hint { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: .35rem; border-radius: 50%; border: 1px solid var(--line-strong); font-size: .7rem; color: var(--muted); cursor: help; vertical-align: 1px; }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; text-decoration: none; }
.status-open { color: var(--warn); }
.status-ok { color: var(--ok); }
a.status:hover { text-decoration: underline; color: var(--warn); }
.tag { display: inline-block; font-size: .72rem; padding: .05rem .4rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; }

/* ---------- Filterleiste ---------- */
.filterbar { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.filter-label { color: var(--muted); font-size: .9rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); text-decoration: none; font-size: .9rem; background: var(--surface); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Dashboard-Raster ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.span-2 { grid-column: span 2; }

/* ---------- Diagramme ---------- */
.chart { position: relative; width: 100%; min-height: 240px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font: 12px var(--font); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { fill: var(--bar); transition: fill .12s; }
.chart .bar.dim { fill: var(--bar-dim); }
.chart .col:hover .bar, .chart .col:focus .bar { fill: var(--bar-hover); }
.chart .col { cursor: pointer; outline: none; }
.chart .hit { fill: transparent; }
.chart .col.active text { fill: var(--ink); font-weight: 600; }
.chart .line { fill: none; stroke: var(--bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--bar); opacity: .1; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart .dot { fill: var(--bar); stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--surface);
  padding: .45rem .65rem; border-radius: var(--radius-s); font-size: .83rem; line-height: 1.4; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s;
}
.chart-tip.show { opacity: 1; }
.chart-tip strong { display: block; font-size: .92rem; }
.chart-empty { color: var(--muted); padding: 2rem 0; text-align: center; }
.table-view { margin-top: .6rem; font-size: .88rem; }
.table-view summary { cursor: pointer; color: var(--muted); }

/* Horizontale Balken (HTML) */
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li > a, .hbars li > span {
  display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding: .32rem .35rem; margin: 0 -.35rem; border-radius: var(--radius-s); color: var(--ink); text-decoration: none;
}
.hbars li > a:hover { background: var(--surface-2); }
.hbars li > a:hover .hb-bar { background: var(--bar-hover); }
.hb-label { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 14px; display: block; }
.hb-bar { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbars .is-other .hb-bar { background: var(--bar-dim); }
.hbars .is-other .hb-label { color: var(--muted); font-style: italic; }
.hb-val { font-size: .9rem; font-weight: 600; text-align: right; white-space: nowrap; }
.hb-val small { display: inline-block; min-width: 2.8rem; margin-left: .4rem; color: var(--muted); font-weight: 400; }

/* Kurzlisten */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; }
.mini-list li > a, .mini-list.plain li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; color: var(--ink); text-decoration: none; align-items: center; }
.mini-list li > a:hover strong { color: var(--accent); text-decoration: underline; }
.ml-main { display: flex; flex-direction: column; min-width: 0; }
.ml-main .muted { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.ml-side .num { font-weight: 600; }

/* Leerzustand */
.empty { text-align: center; max-width: 34rem; margin: 3rem auto; }
.empty-ic { width: 64px; height: 64px; color: var(--accent); margin-bottom: .5rem; }
.empty p { color: var(--ink-2); }
.small-empty { margin: 2rem auto; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span:first-child { font-size: .88rem; font-weight: 500; color: var(--ink-2); }
.field small { color: var(--muted); font-size: .8rem; }
.field small.err, .err { color: var(--err); font-size: .82rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: .55rem .7rem; min-height: 2.5rem;
}
textarea { resize: vertical; min-height: 4.2rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--err); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type="file"] { padding: .4rem; }
.input-unit { display: flex; align-items: stretch; }
.input-unit input { border-radius: var(--radius-s) 0 0 var(--radius-s); text-align: right; }
.input-unit > span { display: flex; align-items: center; padding: 0 .7rem; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--surface-2); color: var(--muted); }
.input-ic { position: relative; display: block; }
.input-ic .ic { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-ic input { padding-left: 2.2rem; }
.grid2, .grid3 { display: grid; gap: .9rem 1rem; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid3 .span-2 { grid-column: span 2; }
.grid3 .span-3 { grid-column: 1 / -1; }
.form { display: flex; flex-direction: column; gap: .9rem; }
.form h2 { margin: .4rem 0 0; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.narrow { max-width: 40rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { margin-top: .3rem; }
.entry-form .panel h2 { margin-bottom: 1rem; }
.form-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; position: sticky; bottom: 0; z-index: 10;
  background: var(--bg); padding: .8rem 0; border-top: 1px solid var(--line-strong); margin-top: -.2rem;
  box-shadow: 0 -8px 16px -12px rgba(0,0,0,.25);
}

/* Dateien / Belege */
.files { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.files li { display: flex; align-items: center; gap: .9rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius-s); }
.file-thumb { width: 56px; height: 56px; flex: none; border-radius: 4px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; text-decoration: none; border: 1px solid var(--line); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-type { font-size: .72rem; font-weight: 700; color: var(--err); }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; gap: .1rem; }
.dropzone {
  position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface-2); flex-wrap: wrap;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-ic { width: 28px; height: 28px; color: var(--accent); }
.dz-text { display: flex; flex-direction: column; flex: 1; min-width: 12rem; }
.dz-list { width: 100%; font-size: .88rem; color: var(--ink); }
.dz-list:empty { display: none; }
.dz-list span { display: inline-flex; align-items: center; gap: .3rem; margin: .2rem .8rem 0 0; }

/* ---------- Einträge-Tabelle ---------- */
.filters { display: grid; grid-template-columns: minmax(12rem, 2fr) repeat(5, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; padding: 1rem; }
.filter-actions { display: flex; gap: .4rem; }
.sumbar { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: .2rem .2rem .8rem; color: var(--ink-2); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 600; font-size: .84rem; color: var(--ink-2); padding: .7rem .9rem; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th.num { text-align: right; }
.tbl .c { text-align: center; }
.tbl.entries tbody tr { cursor: pointer; }
.tbl.entries tbody tr:hover { background: var(--surface-2); }
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--accent); text-decoration: underline; }
.tbl .desc { max-width: 22rem; color: var(--ink-2); }
.tbl.compact td, .tbl.compact th { padding: .35rem .5rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }

/* ---------- Einstellungen ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line-strong); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.list-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.list-edit li { display: flex; gap: .5rem; align-items: center; }
.list-edit .sort { width: 4rem; flex: none; text-align: right; }
.add-row { display: flex; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.checks li { display: flex; gap: .55rem; align-items: flex-start; }
.checks li .ic { margin-top: 2px; }
.checks small { display: block; color: var(--muted); }
.checks .ok .ic { color: var(--ok); }
.checks .bad { color: var(--err); }
.checks .warn .ic { color: var(--warn); }

/* ---------- Login & Installation ---------- */
.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 1rem; padding: 2rem; }
.login-head { text-align: center; }
.login-head h1 { font-size: 1.5rem; margin: .4rem 0 0; }
.setup-ic { width: 44px; height: 44px; color: var(--accent); }
.setup-main { max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; width: 100%; }
.setup-head { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; }
.setup-head h1 { margin: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.seg-opt { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: .75rem .85rem; cursor: pointer; }
.seg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg-opt:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.seg-opt input { margin-top: .3rem; }
.seg-opt > span { display: flex; flex-direction: column; font-weight: 500; }
.seg-opt small { font-weight: 400; color: var(--muted); font-size: .82rem; }
[data-show-when][hidden] { display: none; }

/* ---------- Unternavigation ---------- */
.subnav { border-top: 1px solid var(--line); background: var(--surface); }
.subnav-in { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; }
.subnav a { padding: .55rem .8rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .93rem; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.btn.is-active { background: var(--accent-soft); color: var(--accent); }
.page-sub { margin: .35rem 0 0; max-width: 60rem; }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.stat-l { color: var(--ink-2); font-size: .86rem; }
.stat-v { font-family: var(--font-book); font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.stat-v small { display: block; font-family: var(--font); font-size: .78rem; font-weight: 400; color: var(--muted); margin-top: .15rem; }
.stat.is-bad .stat-v { color: var(--late); }
.stat.is-good .stat-v { color: var(--ok); }
.bad { color: var(--late); }
.good { color: var(--ok); }
.warn { color: var(--warn); }
.big-num { font-family: var(--font-book); font-size: 1.8rem; font-weight: 600; margin: 0; }
.prewrap { white-space: pre-wrap; }

/* Badges */
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); vertical-align: 1px; white-space: nowrap; font-family: var(--font); }
.st-angebot, .fs-geplant, .fs-beantragt, .ts-offen { background: var(--info-bg); color: var(--info); border-color: transparent; }
.st-beauftragt, .ts-arbeit, .fs-bewilligt { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.st-abgeschlossen, .ts-erledigt, .fs-ausgezahlt, .fs-abgeschlossen, .b-good { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.st-abgelehnt, .fs-abgelehnt { color: var(--muted); text-decoration: line-through; }
.b-bad { background: var(--late-bg); color: var(--late); border-color: transparent; }
.b-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.status-late { color: var(--late); font-weight: 600; }

/* Fortschrittsbalken */
.progress, .budget-bar { position: relative; display: flex; height: 14px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: visible; margin: .3rem 0 .4rem; }
.progress > span, .budget-bar > span:not(.bb-mark) { display: block; height: 100%; }
.pg-paid, .bb-inv, .mb-inv { background: var(--bar); }
.pg-inv, .bb-pen, .mb-pen { background: var(--bar-dim); }
.pg-over { background: var(--late); }
.progress > span:first-child, .budget-bar > span:first-child { border-radius: 3px 0 0 3px; }
.bb-mark, .mb-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.legend { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; margin: 0 0 1rem; }
.lg { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.lg-paid { background: var(--bar); } .lg-inv { background: var(--bar-dim); } .lg-rest { background: var(--surface-2); border: 1px solid var(--line-strong); }
.lg-mark { width: 2px; height: 12px; background: var(--ink); }
.mini-bar { position: relative; display: flex; height: 10px; min-width: 6rem; background: var(--surface-2); border-radius: 3px; }
.mini-bar > span:not(.mb-mark) { height: 100%; }
.tbl.budget td { vertical-align: middle; }
.tbl.budget .bcol { width: 22%; }
.small-input input { max-width: 8rem; padding: .35rem .5rem; min-height: 2.1rem; }
.small-input > span { padding: 0 .5rem; }
.tbl tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
.tbl tr.is-current td { background: var(--accent-soft); }
.tbl tr.is-muted td { color: var(--muted); }
.table-wrap.flat { border: 0; box-shadow: none; border-radius: 0; overflow-x: auto; }
.table-wrap.flat .tbl th { background: transparent; }

/* Schlüssel-Wert-Listen */
.kv { margin: 0 0 .8rem; display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; }
.kv-total { font-weight: 600; border-bottom: 0 !important; border-top: 2px solid var(--ink); }
.panel-warn { border-color: var(--warn); }
.panel-bad { border-color: var(--late); }
.panel-bad h2 { color: var(--late); }

/* Ablauf */
.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.timeline li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0 .45rem 1.5rem; position: relative; border-left: 2px solid var(--line); margin-left: .45rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .75rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li.done::before { background: var(--accent); border-color: var(--accent); }

/* Formular-Zeilen */
.event-form, .reading-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .6rem; }
.event-form .field, .reading-form .field { min-width: 9rem; }
.event-form .grow, .reading-form .grow { flex: 1; }
.form-sub { margin: .6rem 0 0; }
.grp-select { width: auto; max-width: 13rem; flex: none; }
.mini-form { display: grid; gap: .5rem; padding: .7rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-s); margin-top: .4rem; min-width: 15rem; text-align: left; position: absolute; right: 0; z-index: 6; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.done-form { position: relative; display: inline-block; }
.done-form > summary { list-style: none; cursor: pointer; }
.done-form > summary::-webkit-details-marker { display: none; }
.btn-done { color: var(--ok); border-color: var(--ok); }
.btn-done:hover { background: var(--ok-bg); color: var(--ok); }
.status-btns { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .6rem; }
.rating-input { display: flex; gap: .15rem; align-items: center; }
.rating-input label { cursor: pointer; }
.rating-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating-input label span { font-size: 1.5rem; color: var(--line-strong); line-height: 1; }
.rating-input label:has(input:checked) span, .rating-input:has(label:nth-child(2) input:checked) label:nth-child(-n+1) span,
.rating-input:has(label:nth-child(3) input:checked) label:nth-child(-n+2) span, .rating-input:has(label:nth-child(4) input:checked) label:nth-child(-n+3) span,
.rating-input:has(label:nth-child(5) input:checked) label:nth-child(-n+4) span { color: #e2a400; }
.rating-input .rating-none span { font-size: .85rem; color: var(--muted); margin-left: .5rem; }
.rating-input label:has(input:focus-visible) { outline: 2px solid var(--accent); border-radius: 4px; }
.stars { color: #e2a400; letter-spacing: 1px; font-size: .95rem; }
.stars .off { color: var(--line-strong); }

/* Galerie */
.gallery { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.gallery li { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.g-img { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); }
.g-img img { width: 100%; height: 100%; object-fit: cover; }
.g-meta { display: flex; align-items: center; justify-content: space-between; gap: .3rem; padding: .2rem .2rem .2rem .55rem; background: var(--surface); min-width: 0; }
.g-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; min-width: 0; }
.kcol h2 { font-size: 1.02rem; margin: 0 0 .7rem; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem .75rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.tcard.is-high { border-left: 3px solid var(--late); }
.tcard-link { display: flex; flex-direction: column; gap: .35rem; color: var(--ink); text-decoration: none; }
.tcard-link:hover strong { color: var(--accent); text-decoration: underline; }
.tcard-img { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: .25rem .7rem; font-size: .82rem; color: var(--muted); align-items: center; }
.tcard-meta span { display: inline-flex; align-items: center; gap: .2rem; }
.kcol-erledigt .tcard strong { color: var(--muted); text-decoration: line-through; }
.filterbar .room-filter select { width: auto; min-height: 2.1rem; padding: .3rem .6rem; }

/* Hausakte */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.doc-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.doc-card:hover { border-color: var(--accent); }
.doc-card:hover strong { color: var(--accent); }
.doc-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-ic { width: 40px; height: 40px; color: var(--muted); }
.doc-count { position: absolute; right: .5rem; bottom: .5rem; background: var(--ink); color: var(--surface); font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; }
.doc-body { display: flex; flex-direction: column; padding: .6rem .75rem .75rem; gap: .1rem; }

/* Zähler, Kontakte */
.meter-grid, .contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 1.1rem; }
.meter-card h2 a { color: var(--ink); text-decoration: none; }
.meter-card h2 a:hover { color: var(--accent); text-decoration: underline; }
.contact-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.contact-card { display: flex; flex-direction: column; gap: .35rem; }
.contact-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0; }

/* Kredite */
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .45rem; vertical-align: 0; }
.s1 { background: var(--s1); } .s2 { background: var(--s2); } .s3 { background: var(--s3); } .s4 { background: var(--s4); }
.s5 { background: var(--s5); } .s6 { background: var(--s6); } .s7 { background: var(--s7); } .s8 { background: var(--s8); }
.chart .mline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .now-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .now-label { fill: var(--ink-2); }
.chart-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .85rem; color: var(--ink-2); margin-top: .3rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }

/* Termine */
.date-list { list-style: none; margin: 0; padding: 0; }
.date-list li { border-top: 1px solid var(--line); }
.date-list li:first-child { border-top: 0; }
.date-list a { display: grid; grid-template-columns: 8.5rem 1.6rem minmax(0, 1fr); gap: .8rem; align-items: center; padding: .65rem 0; color: var(--ink); text-decoration: none; }
.date-list a:hover strong { color: var(--accent); text-decoration: underline; }
.dl-date { display: flex; flex-direction: column; }
.dl-ic { color: var(--muted); }
.dl-main { display: flex; flex-direction: column; min-width: 0; }

/* Dashboard-Ergänzungen */
.top-grid { margin-bottom: .2rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pot-line { margin: .5rem 0 0; }
.budget-line { margin: 0 0 .3rem; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.hot-list { list-style: none; margin: .6rem 0 0; padding: 0; font-size: .9rem; }
.hot-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.mini-stats { list-style: none; margin: .9rem 0 0; padding: .8rem 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1rem; font-size: .9rem; }
.mini-stats a { color: var(--ink-2); text-decoration: none; }
.mini-stats a:hover { color: var(--accent); }
.mini-stats strong { color: var(--ink); font-size: 1.05rem; margin-right: .2rem; }
.scope-sum { color: var(--ink-2); margin: -.3rem 0 1rem; }
.filter-sep { width: 1px; height: 1.4rem; background: var(--line-strong); }
.filter-tags { margin: -.4rem 0 .8rem; }
.hero-stats dt a { color: inherit; text-decoration: none; }
.hero-stats dt a:hover { color: var(--accent); text-decoration: underline; }
.start-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1.5rem; text-align: left; }
.start-card { display: flex; flex-direction: column; gap: .25rem; padding: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.start-card:hover { border-color: var(--accent); }
.start-card .ic { width: 22px; height: 22px; color: var(--accent); }

.table-wrap + p, .table-wrap + .muted { margin-top: .7rem; }

/* ---------- Haushaltsplan & Kredite ---------- */
.share-bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.share-bar > span { display: block; height: 100%; min-width: 2px; }
.share-bar .s1, .share-legend .s1 { background: var(--s1); } .share-bar .s2, .share-legend .s2 { background: var(--s2); }
.share-bar .s3, .share-legend .s3 { background: var(--s3); } .share-bar .s4, .share-legend .s4 { background: var(--s4); }
.share-free { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--line) 4px, var(--line) 6px); border: 1px solid var(--line-strong); }
.share-legend { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .45rem 1.6rem; font-size: .9rem; }
.share-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: .5rem; align-items: center; }
.share-legend i { width: 12px; height: 12px; border-radius: 2px; display: block; }
.hh-sec .panel-head h2 { margin: 0; }
.hh-sum { font-family: var(--font-book); font-size: 1.15rem; font-weight: 600; }
.hh-add { margin: .6rem 0 0; font-size: .9rem; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.hh-add a { text-decoration: none; }
.tbl.hh td { vertical-align: top; }
.tbl.hh td:first-child { width: 30%; }
.hh-total .kv { max-width: 34rem; margin-left: auto; }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.cmp-col { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .8rem 1rem .2rem; }
.cmp-col h3 { margin: 0 0 .4rem; font-size: .98rem; }
.cmp-plan { border-color: var(--accent); background: var(--accent-soft); }
.cmp-gain { border-style: dashed; }
.pot { margin-top: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); }
.pot-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .3rem; }
.seg-small .seg-opt { padding: .45rem .7rem; }
.hh-panel .kv > div { padding: .35rem 0; }

/* ---------- Firmen ---------- */
.dupe-list { list-style: none; margin: 0; padding: 0; }
.dupe-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; padding: .55rem 0; border-top: 1px solid var(--line); }
.dupe-list li:first-child { border-top: 0; }
.dupe-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.merge-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; max-width: 40rem; }
.merge-form .grow { flex: 1; min-width: 14rem; }
.cleanup-row { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; margin-top: .6rem; flex-wrap: wrap; }
.firm-filters { grid-template-columns: minmax(12rem, 2fr) minmax(0, 1fr) auto; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) {
  .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-grid > .panel:first-child { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .grow { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 1.2rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 .span-2 { grid-column: 1 / -1; }
  .field-spacer { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar-in { flex-wrap: wrap; gap: .5rem; padding: .55rem 1rem; }
  .brand { flex: 1; }
  /* Hauptnavigation als Leiste am unteren Bildschirmrand */
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--line-strong); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); }
  .mainnav a { flex-direction: column; gap: .1rem; padding: .35rem .1rem; font-size: .72rem; border-radius: var(--radius-s); text-align: center; }
  .mainnav a .ic { width: 20px; height: 20px; }
  body { padding-bottom: 64px; }
  .form-bar { bottom: 62px; }
  .topbar-actions .btn-primary span { display: none; }
  .topbar-actions .btn-primary { padding: .5rem; }
  .page { padding: 1rem 1rem 3rem; }
  h1 { font-size: 1.5rem; }
  .panel { padding: 1rem; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }
  .grid2, .grid3, .seg { grid-template-columns: 1fr; }
  .grid3 .span-2, .grid3 .span-3 { grid-column: auto; }
  .subnav-in { padding: 0 .6rem; }
  .stat-v { font-size: 1.15rem; }
  .mini-stats { grid-template-columns: 1fr; }
  .start-grid { grid-template-columns: 1fr; }
  .date-list a { grid-template-columns: 6.8rem minmax(0, 1fr); }
  .dl-ic { display: none; }
  .meter-grid, .contact-grid { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .tbl.hh thead { display: none; }
  .tbl.hh, .tbl.hh tbody { display: block; }
  .tbl.hh tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .tbl.hh td { border: 0; padding: 0; width: auto !important; }
  .tbl.hh td[data-l="Position"] { grid-column: 1; }
  .tbl.hh td[data-l="Plan / Monat"] { grid-column: 2; grid-row: 1; }
  .tbl.hh td[data-l="Hinweis"] { grid-column: 1 / -1; }
  .tbl.hh td[data-l="Pro Jahr"] { display: none; }
  .tbl.hh td.c { grid-column: 2; grid-row: 2; }
  .mini-form { position: static; box-shadow: none; }
  .list-edit li { flex-wrap: wrap; }
  .list-edit li > input[name^="names"] { flex: 1; min-width: 10rem; }
  .tbl.budget thead { display: none; }
  .tbl.budget, .tbl.budget tbody, .tbl.budget tfoot { display: block; }
  .tbl.budget tr { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .tbl.budget td { border: 0; padding: 0; text-align: left; }
  .tbl.budget td[data-l]::before { content: attr(data-l); display: block; font-size: .75rem; color: var(--muted); }
  .tbl.budget td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .tbl.budget .bcol { grid-column: 1 / -1; width: auto; }
  .tbl.budget tfoot tr { background: var(--surface-2); padding: .7rem; }
  .tbl.budget tfoot td:first-child { grid-column: 1 / -1; }
  /* weitere Tabellen als Karten */
  .tbl.orders thead, .tbl.loans thead, .tbl.devices thead, .tbl.maint thead, .tbl.firms thead { display: none; }
  .tbl.orders, .tbl.orders tbody, .tbl.loans, .tbl.loans tbody, .tbl.devices, .tbl.devices tbody, .tbl.maint, .tbl.maint tbody, .tbl.firms, .tbl.firms tbody { display: block; }
  .tbl.firms tr { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .8rem; padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
  .tbl.firms td { border: 0; padding: 0; text-align: left; }
  .tbl.firms td:first-child { grid-column: 1 / -1; }
  .firm-filters { grid-template-columns: 1fr; }
  .tbl.orders tr, .tbl.loans tr, .tbl.devices tr, .tbl.maint tr { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .8rem; padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
  .tbl.orders td, .tbl.loans td, .tbl.devices td, .tbl.maint td { border: 0; padding: 0; text-align: left; }
  .tbl.orders td:first-child, .tbl.loans td:first-child, .tbl.devices td:first-child, .tbl.maint td:first-child { grid-column: 1 / -1; }
  .tbl.orders td[data-l]:not(:first-child)::before, .tbl.loans td[data-l]:not(:first-child)::before,
  .tbl.devices td[data-l]:not(:first-child)::before, .tbl.maint td[data-l]:not(:first-child)::before { content: attr(data-l); display: block; font-size: .75rem; color: var(--muted); }
  .tbl.maint td.c { grid-column: 1 / -1; text-align: left; }
  .hbars li > a, .hbars li > span { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; row-gap: .25rem; }
  .hb-label { grid-area: l; } .hb-val { grid-area: v; } .hb-track { grid-area: t; height: 10px; }

  /* Tabelle als Karten */
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .tbl.entries thead { display: none; }
  .tbl.entries, .tbl.entries tbody { display: block; }
  .tbl.entries tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; margin-bottom: .6rem; }
  .tbl.entries td { padding: 0; border: 0; }
  .tbl.entries td[data-l="Firma"] { grid-column: 1; grid-row: 1; }
  .tbl.entries td[data-l="Betrag"] { grid-column: 2; grid-row: 1; }
  .tbl.entries td[data-l="Beschreibung"] { grid-column: 1 / -1; font-size: .88rem; max-width: none; }
  .tbl.entries td[data-l="Datum"] { grid-column: 1; font-size: .85rem; color: var(--muted); }
  .tbl.entries td[data-l="Zahlung"] { grid-column: 2; font-size: .85rem; text-align: right; }
  .tbl.entries td[data-l="Kategorie"], .tbl.entries td[data-l="Belege"] { display: none; }
  .form-bar .push { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .topbar, .form-bar, .filters, .filterbar, .page-head-actions, .notice, .foot, .table-view { display: none !important; }
  body { background: #fff; }
  .panel, .table-wrap { box-shadow: none; break-inside: avoid; }
}
