/* Cointracker – Stil B (Transaktionen) + C (Flow/Steuer) */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --line: #e3e6ec;
    --line-soft: #f1f3f6;
    --ink: #1c2230;
    --muted: #586174;
    --faint: #8a93a3;
    --accent: #1d4ed8;
    --accent-ink: #ffffff;
    --ok-bg: #ecfdf5; --ok-line: #a7f3d0; --ok-ink: #065f46;
    --warn-bg: #fff7ed; --warn-line: #fed7aa; --warn-ink: #9a3412;
    --err-bg: #fef2f2; --err-line: #fecaca; --err-ink: #991b1b;
    --radius: 12px;
    --font: Inter, system-ui, sans-serif;
    --font-display: "Space Grotesk", Inter, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
a { color: var(--accent); }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); margin: 6px 0 0; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 28px; min-height: 60px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; }
.mainnav a { text-decoration: none; color: var(--muted); padding: 18px 10px; border-bottom: 2px solid transparent; }
.mainnav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.mainnav a.disabled { color: #b4bac6; pointer-events: none; }
.logout { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.logout .muted { margin: 0; }
.container.login { max-width: 380px; padding-top: 12vh; }
.container.login .brand { text-align: center; }
.container.login .card { display: flex; flex-direction: column; gap: 16px; }
.container.login h1 { font-size: 22px; }

.container { max-width: 1320px; margin: 0 auto; padding: 28px 24px; display: flex; flex-direction: column; gap: 20px; }
.container.narrow { max-width: 900px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; justify-content: space-between; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
select, input[type="search"], input[type="text"], input[type="password"] { height: 40px; min-width: 140px; border: 1px solid #d5dae2; border-radius: 8px; background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); padding: 0 10px; }

.btn { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #d5dae2; background: var(--surface); color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.daylist { display: flex; flex-direction: column; gap: 16px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.day-head { padding: 10px 16px; background: #fafbfc; border-bottom: 1px solid #eef0f4; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tx { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.tx:first-of-type { border-top: 0; }
.tx-time { width: 44px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tx-main { flex: 1 1 260px; min-width: 0; }
.tx-text { font-weight: 500; overflow-wrap: anywhere; }
.tx-hint { color: var(--faint); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.tx-eur { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 100px; text-align: right; }
.more { display: flex; justify-content: center; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); }

.chip { min-width: 110px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-align: center; background: #eef0f4; color: var(--muted); }
.chip-trade { background: #e0e7ff; color: #3730a3; }
.chip-deposit { background: #dcfce7; color: #166534; }
.chip-withdrawal { background: #fee2e2; color: #991b1b; }
.chip-mining_commercial, .chip-mining { background: #f3e8ff; color: #6b21a8; }
.chip-interest_income, .chip-staking, .chip-income { background: #fef9c3; color: #854d0e; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line-soft); }
.table th { color: var(--muted); font-size: 12px; font-weight: 600; border-top: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.alert { border-radius: var(--radius); padding: 14px 18px; border: 1px solid; }
.alert ul { margin: 8px 0; padding-left: 18px; }
.alert p { margin: 6px 0 0; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }

@media (max-width: 640px) {
    .container { padding: 20px 16px; }
    .topbar-inner { padding: 0 16px; gap: 12px; }
    .mainnav a { padding: 12px 8px; }
    .tx-eur { min-width: 0; }
}

/* Transfers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.stat-num { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--ink); }
.stat-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.stat-warn .stat-num { color: var(--warn-ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.cards { display: flex; flex-direction: column; gap: 12px; }
.cards h2 { margin: 12px 0 0; }
.pair { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.pair-side { flex: 1 1 200px; min-width: 0; }
.pair-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pair-amount { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-top: 2px; }
.pair-arrow { text-align: center; font-size: 20px; color: var(--faint); min-width: 60px; }
.pair-arrow .muted { font-size: 12px; margin: 0; }
.pair-meta { flex: 1 1 240px; display: flex; flex-direction: column; gap: 4px; }
.pair-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.hash { font-family: ui-monospace, monospace; font-size: 12px; color: var(--faint); margin-top: 2px; }
.open-head { display: flex; justify-content: space-between; gap: 12px; }
.cand { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.cand .muted { margin: 0; flex: 1 1 260px; }
.transfer-badge { color: #075985; font-size: 12px; }

/* Klassifizierung */
.group-suggest { border-color: #c7d2fe; }
.group-head { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.group-main { flex: 1 1 520px; min-width: 0; }
.group-main h2 { margin: 4px 0 0; font-size: 18px; }
.group-main p { margin: 6px 0 0; }
.group-action { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.group-action label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.group-action label.check { flex-direction: row; align-items: center; font-size: 13px; }
details summary { cursor: pointer; color: var(--accent); margin-top: 12px; }
.group-txs { max-height: 420px; overflow: auto; margin-top: 8px; }
.corrected { font-size: 11px; color: #6b21a8; font-weight: 600; margin-left: 6px; }

/* Stil C: Steuer & Ketten */
.c-style .display, .display-h2 { font-family: var(--font-display); letter-spacing: -0.02em; }
.c-style h1.display { font-size: 34px; font-weight: 600; }
.display-h2 { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.seg { display: flex; background: #e6e2d8; border-radius: 999px; padding: 4px; }
.seg a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: #4a4a42; white-space: nowrap; }
.seg a[aria-current="page"] { background: #1a1a17; color: #f3f1ec; font-weight: 600; }
.btn-accent { background: #0f766e; border-color: #0f766e; color: #fff; font-weight: 600; border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tiles-small { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tile { background: var(--surface); border: 1px solid #e2ded3; border-radius: 16px; padding: 18px 20px; }
.tile-dark { background: #1a1a17; color: #f3f1ec; border-color: #1a1a17; }
.tile-warn { background: #fffbeb; border-color: #fcd34d; color: #78350f; }
.tile-warn a { color: #78350f; font-weight: 600; }
.tile-label { font-size: 13px; opacity: .8; }
.tile-num { font-family: var(--font-display); font-size: 36px; font-weight: 600; margin-top: 6px; }
.tile-num-s { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-top: 6px; }
.tile-sub { font-size: 13px; opacity: .8; margin-top: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) 130px; gap: 14px; align-items: center; margin-top: 10px; }
.bar-track { position: relative; height: 22px; background: #f3f1ec; border-radius: 6px; overflow: hidden; }
.bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.bar-pos { background: #0f766e; }
.bar-neg { background: #c2410c; }
.bar-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #b8b4a8; }
.bar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pos { color: #0f766e; }
.neg { color: #b91c1c; }
.reference-ok { border-color: var(--ok-line); background: var(--ok-bg); }
.reference-bad { border-color: var(--warn-line); background: var(--warn-bg); }
details.card summary { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; color: var(--ink); margin: 0; }
details.card[open] summary { margin-bottom: 12px; }
details.card table { font-size: 13px; }
.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lines th, .lines td { padding: 5px 8px; border-top: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.lines th { color: var(--muted); font-size: 12px; }
.lines .num { text-align: right; }
.empty-pool td { color: #b45309; }
details.card { overflow-x: auto; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr; } }

/* Ketten-Flow */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.pick { display: grid; grid-template-columns: 100px 1fr auto; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.pick:hover { background: #f3f1ec; }
.flow { overflow-x: auto; }
.flow-grid { display: grid; gap: 10px 12px; min-width: 900px; align-items: start; }
.flow-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.flow-lane { font-weight: 600; padding-top: 12px; border-top: 1px dashed #e2ded3; }
.flow-cell { border-top: 1px dashed #e2ded3; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 30px; }
.node { border: 1px solid #e2ded3; border-radius: 12px; padding: 10px 12px; background: #faf9f6; }
.node-kind { font-size: 12px; color: var(--muted); }
.node-amt { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-top: 3px; overflow-wrap: anywhere; }
.node-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.node-link { font-size: 12px; display: inline-block; margin-top: 4px; }
.node-open { border: 2px dashed #d97706; background: #fffbeb; }
.node-open .node-kind { color: #92400e; font-weight: 600; }
.node-payout { background: #1a1a17; border-color: #1a1a17; color: #f3f1ec; }
.node-payout .node-kind, .node-payout .node-sub { color: #c9c5b8; }
.node-payout .node-link { color: #99f6e4; }
.node-mining { border-color: #d8b4fe; background: #faf5ff; }
.node-fee { background: #f0fdfa; border-color: #99d5cf; }
.tx-chain { font-size: 12px; margin-left: 8px; }
.outliers { margin-top: 10px; padding: 10px 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; color: var(--warn-ink); display: flex; flex-direction: column; gap: 4px; }
.outliers .muted { margin: 0; }
input[type="text"], input[type="password"], input[type="date"] { height: 40px; border: 1px solid #d5dae2; border-radius: 8px; padding: 0 10px; font: inherit; }
.progress { height: 6px; background: rgba(0,0,0,.08); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress div { height: 100%; background: currentColor; }
