/* Familienvermögen – Schwarz & Gold */
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #0C0C0E;
  --frame: #141416;
  --card: #1B1B1E;
  --card-2: #222226;
  --chip: #26262A;
  --line: #2A2A2F;
  --text: #F2F0EC;
  --text-2: #C9C7CD;
  --muted: #A3A1A8;
  --faint: #8E8C94;
  --accent: #D4B06A;
  --accent-ink: #141416;
  --ok-bg: #26332D;
  --ok: #A8E0C6;
  --warn: #F0B48A;
  --danger: #F08A8A;
  --radius: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #E6C98E; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.accent { color: var(--accent); }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grundgerüst ---------- */
.shell {
  max-width: 1440px; margin: 24px auto; padding: 24px;
  display: flex; gap: 24px;
  background: var(--frame); border: 1px solid #222226; border-radius: 28px;
  min-height: calc(100vh - 48px);
}
.side { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--accent); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; letter-spacing: .04em;
}
.brand-sub { font-size: 9px; letter-spacing: .18em; color: var(--muted); font-weight: 600; }
.brand-lg .brand-mark { width: 56px; height: 56px; font-size: 18px; border-radius: 18px; }
.nav { display: flex; flex-direction: column; gap: 12px; }
.nav a {
  width: 52px; height: 52px; border-radius: 50%; color: var(--muted);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav span {
  position: absolute; left: 62px; white-space: nowrap; background: var(--card-2); color: var(--text);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.nav a:hover span, .nav a:focus-visible span { opacity: 1; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 4px 0; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: 24px;
  background: var(--card); color: var(--text-2); font-size: 12px;
}
.pill:hover { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: #8FD1B5; }
.dot.warn { background: var(--warn); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#view { display: flex; flex-direction: column; gap: 24px; outline: none; }

/* ---------- Karten ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 24px 26px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-accent { background: var(--accent); color: var(--accent-ink); }
.card-accent .muted, .card-accent .faint { color: rgba(20, 20, 22, .8); }
.card-outline { background: transparent; border: 1.5px solid var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; }
.kpi-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 500; color: var(--muted); }
.card-accent .kpi-label { color: var(--accent-ink); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.card-accent .kpi-sub { color: var(--accent-ink); font-weight: 600; }
.spark { width: 64px; height: 22px; }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.stretch { align-items: stretch; }

/* Diagramm */
.tabs { display: flex; gap: 4px; }
.tab {
  min-height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font: inherit; cursor: pointer;
}
.tab[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.chart { display: flex; gap: 12px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--faint); text-align: right; min-width: 56px; padding: 2px 0 26px; }
.chart-plot { flex: 1; min-width: 0; }
.chart-plot svg { display: block; width: 100%; height: 250px; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); padding-top: 8px; }
.empty-chart {
  height: 250px; border: 1px dashed var(--line); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 24px;
}

/* Ring */
.donut { position: relative; width: 190px; height: 190px; align-self: center; margin: 4px auto 18px; }
.donut svg { width: 190px; height: 190px; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center strong { font-size: 20px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.legend li { display: flex; justify-content: space-between; gap: 12px; }
.legend span { display: flex; align-items: center; gap: 10px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--chip); }
.list li:last-child { border-bottom: 0; }
.chip {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--chip); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.chip-neutral { color: var(--text); font-size: 11px; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grow .faint { line-height: 1.4; }
.right { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.strong { font-weight: 600; }

/* Stammdaten: Bezeichnung links, Wert rechts, lange Werte umbrechen */
.facts li { justify-content: space-between; align-items: flex-start; }
.facts .k { flex: none; color: var(--muted); }
.facts .v { flex: 1; min-width: 0; text-align: right; overflow-wrap: anywhere; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 12px; min-height: 32px; padding: 0 14px; border-radius: 9px; border: 0;
  background: var(--chip); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}

/* Immobilien-Zeilen */
.prow {
  background: var(--card); border-radius: 20px; padding: 16px 20px; width: 100%; border: 0; color: inherit; font: inherit; text-align: left;
  display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(110px, 1fr)) auto; gap: 12px 16px; align-items: center;
}
button.prow { cursor: pointer; }
button.prow:hover, a.prow:hover { background: #202024; }
a.prow { color: inherit; }
.prow-name { display: flex; align-items: center; gap: 14px; min-width: 0; }
.prow-cell { display: flex; flex-direction: column; }
.prow-cell small { font-size: 11px; color: var(--faint); }
.tag { padding: 7px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--text-2); justify-self: end; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-accent { background: var(--accent); color: var(--accent-ink); }
.progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid var(--chip); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #202024; }
th.num, td.num { text-align: right; }

/* Buttons & Formulare */
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: #2A2A2F; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { background: #E0BE7C; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: #4A2A2A; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #121214;
  color: var(--text); font: inherit; font-size: 14px;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field .hint { font-size: 11px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; padding: 0; }

/* Dialog */
.dialog {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 24px;
  background: var(--frame); color: var(--text); padding: 28px;
}
.dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dialog-actions {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 22px -28px -28px; padding: 16px 28px 24px;
  position: sticky; bottom: -28px; background: var(--frame); border-top: 1px solid var(--line);
}

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: min(400px, 100%); background: var(--frame); border: 1px solid #222226; border-radius: 28px; padding: 36px 32px;
  display: flex; flex-direction: column; gap: 20px;
}
.login-card .brand { align-items: flex-start; }
.login-card .muted { margin: 0; }

/* Hinweise / Leerzustand */
.notice { display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; }
.notice-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); padding: 12px 18px; border-radius: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10;
}
.toast.show { opacity: 1; }
.toast.err { border-color: #5A2E2E; color: #FFD2D2; }
.source { display: inline-block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.gain-neg { color: var(--warn); }
.challenge-img { max-width: 220px; border-radius: 12px; background: #fff; padding: 8px; }

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  .shell { margin: 0; padding: 16px 14px 96px; border: 0; border-radius: 0; min-height: 100vh; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; width: auto; flex-direction: row; justify-content: center;
          background: var(--frame); border-top: 1px solid #222226; padding: 8px 6px 14px; }
  .side .brand { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav a { width: auto; height: 52px; border-radius: 14px; flex-direction: column; gap: 2px; padding: 0 6px; flex: 1; }
  .nav a[aria-current="page"] { background: none; color: var(--accent); }
  .nav span { position: static; opacity: 1; background: none; padding: 0; font-size: 10px; color: inherit; }
  h1 { font-size: 22px; }
  .pill { height: 44px; padding: 0 14px; }
  #sync-text { display: none; }
  .card { padding: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi:first-child { grid-column: 1 / -1; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 19px; }
  .kpi:first-child .kpi-value { font-size: 32px; }
  .prow { grid-template-columns: 1fr auto; }
  .prow .prow-cell.opt { display: none; }
  .prow .tag { grid-column: 1 / -1; justify-self: start; }
  .chart-plot svg, .empty-chart { height: 180px; }
  .dialog { padding: 20px; }
  .dialog-actions { margin: 18px -20px -20px; padding: 14px 20px 18px; bottom: -20px; }
}
