/* Buchklar – Buchhaltung Dashboard (Demo). Eigenständiges Design: ruhiges
 * Petrol/Smaragd statt sevdesk-Lila, helle Flächen, viel Weißraum. */

:root {
  --brand: #0e8a76;
  --brand-dark: #0b6c5c;
  --brand-soft: #e3f3ef;
  --bg: #f6f7f6;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e5e4de;
  --r: 14px;
  --shadow: 0 2px 10px rgba(11, 11, 11, .06);
  /* Kategorial-Palette (validiert, Slot 1+2): Einnahmen / Ausgaben */
  --series-income: #2a78d6;
  --series-expense: #eb6834;
  --good: #0ca30c;
  --warn: #fab219;
  --crit: #d03b3b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }

.demo-ribbon { background: var(--ink); color: #fff; text-align: center; font-size: 12px; font-weight: 600; padding: 6px 10px; }
.icon { display: inline-block; vertical-align: middle; flex: none; }
.hidden { display: none !important; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 30px); }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 22px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  border: none; background: none; color: var(--ink-2);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: left;
}
.side-item:hover { background: var(--bg); }
.side-item.active { background: var(--brand-soft); color: var(--brand-dark); }

.side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); margin-top: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.side-foot-name { font-size: 12.5px; font-weight: 700; }
.side-foot-sub { font-size: 11px; color: var(--muted); }

/* ---------- Topbar / Content ---------- */
.content { padding: 26px 32px 50px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.topbar-title { font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
.topbar-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.konto-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px 9px 14px; box-shadow: var(--shadow); color: var(--brand-dark);
}
.konto-pill small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.konto-pill strong { font-size: 16px; }

/* ---------- Karten & Kacheln ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.card-head-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.tile-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile-v { font-size: 23px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.tile-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tile-sub.good { color: var(--good); font-weight: 700; }
.tile-sub.crit { color: var(--crit); font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ---------- Chart ---------- */
.chart-legend { display: flex; gap: 18px; margin-bottom: 14px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-baseline { stroke: var(--line); stroke-width: 1px; }
.chart-band-hit { fill: transparent; cursor: pointer; }
.bar-income { fill: var(--series-income); transition: filter .1s ease; }
.bar-expense { fill: var(--series-expense); transition: filter .1s ease; }
.chart-band:hover .bar-income, .chart-band:focus .bar-income { filter: brightness(1.12); }
.chart-band:hover .bar-expense, .chart-band:focus .bar-expense { filter: brightness(1.12); }
.chart-band:focus { outline: none; }
.chart-band:focus-visible .chart-band-hit { stroke: var(--brand); stroke-width: 2px; fill: none; }
.chart-axis-label { font-size: 10px; fill: var(--muted); font-family: inherit; }

.chart-tooltip {
  position: fixed; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: #fff; padding: 7px 12px; border-radius: 9px;
  font-size: 12px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 1px;
  pointer-events: none; z-index: 60; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.chart-tooltip.hidden { display: none; }
.ctt-value { font-weight: 800; font-size: 13px; }
.ctt-label { color: rgba(255,255,255,.75); font-size: 11px; }

/* ---------- Listen & Tabellen ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg); margin: 0 -8px; padding: 11px 8px; border-radius: 8px; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; flex: none; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; font-size: 13.5px; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.list-amount { font-weight: 800; font-size: 14px; white-space: nowrap; }
.list-amount.expense { color: var(--series-expense); }
.list-amount.income { color: var(--series-income); }
.list-empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip.good { background: #e5f7e5; color: #096b09; }
.chip.warn { background: #fef3da; color: #8a5e04; }
.chip.crit { background: #fbe4e4; color: #9c1f1f; }
.chip.plain { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:hover { background: var(--bg); }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Buttons / Modal ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: none; border-radius: 10px; font-family: inherit; font-size: 13.5px; font-weight: 700; padding: 10px 16px; cursor: pointer; }
.btn-plain { background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.btn-go { background: var(--brand); color: #fff; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(11,11,11,.45); display: grid; place-items: center; padding: 16px; }
.modal-backdrop.hidden { display: none; }
.modal { background: var(--card); border-radius: 16px; padding: 22px; width: min(420px, 100%); box-shadow: 0 16px 50px rgba(0,0,0,.2); }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.beleg-detail div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.beleg-detail div:last-child { border-bottom: none; }
.beleg-detail span:first-child { color: var(--muted); }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
}
