/* Flipdesk — clean & minimal, zwei Themes (dunkel = Standard, hell umschaltbar) */
:root {
    /* gemeinsame Tokens */
    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.18);

    /* ── DUNKEL (Standard) ── matt, ohne Glow ── */
    --bg: #131316;
    --bg-2: #1a1a1e;
    --card: #1c1c21;
    --card-solid: #1c1c21;
    --ink: #ececee;          /* weiches Off-White (nicht grell) */
    --muted: #9b9ba2;
    --faint: #6c6c74;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --green: #4cc98c;
    --red: #ef6f63;
    --amber: #d6a435;

    --btn-bg: #ececee;
    --btn-ink: #18181b;
    --btn-bg-hover: #d6d6d8;
    --chart-line: #ececee;
    --chart-area: rgba(236, 236, 238, 0.08);
    --chart-zero: rgba(255, 255, 255, 0.10);
    --topbar-bg: rgba(19, 19, 22, 0.82);
    --input-bg: rgba(255, 255, 255, 0.04);
    --hover: rgba(255, 255, 255, 0.05);
    --row-hover: rgba(255, 255, 255, 0.025);
    --pill-open-bg: rgba(255, 255, 255, 0.08);
    --focus-ring: rgba(255, 255, 255, 0.14);
}

/* ── HELL (umschaltbar) ── */
:root[data-theme="light"] {
    --bg: #f5f5f3;
    --bg-2: #ffffff;
    --card: #ffffff;
    --card-solid: #ffffff;
    --ink: #1a1a1a;
    --muted: #6e6e73;
    --faint: #a1a1a8;
    --line: rgba(0, 0, 0, 0.09);
    --line-strong: rgba(0, 0, 0, 0.15);
    --green: #1f7a4d;
    --red: #c0392b;
    --amber: #9a6b00;

    --btn-bg: #1a1a1a;
    --btn-ink: #ffffff;
    --btn-bg-hover: #333333;
    --chart-line: #1a1a1a;
    --chart-area: rgba(26, 26, 26, 0.08);
    --chart-zero: rgba(0, 0, 0, 0.10);
    --topbar-bg: rgba(255, 255, 255, 0.85);
    --input-bg: #ffffff;
    --hover: rgba(0, 0, 0, 0.05);
    --row-hover: rgba(0, 0, 0, 0.02);
    --pill-open-bg: rgba(0, 0, 0, 0.06);
    --focus-ring: rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 26px;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand {
    font-family: "Space Grotesk", -apple-system, sans-serif;
    font-weight: 700;
    font-size: 23px;
    letter-spacing: -0.6px;
    color: var(--ink);
}
.brand:hover { text-decoration: none; opacity: 0.75; }
.topbar nav { display: flex; gap: 2px; align-items: center; }
.topbar nav a {
    padding: 8px 14px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 500;
    font-size: 14.5px;
    transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.btn-nav { background: var(--btn-bg) !important; color: var(--btn-ink) !important; }
.btn-nav:hover { background: var(--btn-bg-hover) !important; }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.username { color: var(--muted); font-size: 14px; }
.logout { color: var(--faint); font-size: 14px; }
.logout:hover { color: var(--ink); }

/* Theme-Umschalter */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--line); border-radius: 9px;
    background: transparent; color: var(--muted);
    cursor: pointer; padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); border-color: var(--line-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
.theme-toggle .sun { display: inline-flex; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: inline-flex; }

/* ── Layout ───────────────────────────────────────────── */
.container { max-width: 940px; margin: 0 auto; padding: 40px 26px 80px; }
h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -0.4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 16px; letter-spacing: -0.2px; font-weight: 600; }
.subtitle { color: var(--muted); margin: 0 0 30px; font-size: 15px; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; }
.toolbar h1 { margin-bottom: 0; }

/* ── Karten ───────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
}

/* ── Hero-Chart-Karte ─────────────────────────────────── */
.hero-card { position: relative; overflow: hidden; padding: 26px 28px 18px; margin-bottom: 18px; }
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; }
.hero-label { color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 8px; }
.hero-value { font-size: 38px; font-weight: 700; letter-spacing: -1px; line-height: 1; color: var(--ink); }
.hero-value.green { color: var(--green); }
.hero-value.red { color: var(--red); }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--muted); font-size: 12.5px; font-weight: 500;
}
.badge { display: inline-block; margin-left: 12px; padding: 4px 9px; border-radius: 7px;
    font-size: 13px; font-weight: 600; vertical-align: middle; }
.badge.green { background: rgba(76, 201, 140, 0.13); color: var(--green); }
.badge.red { background: rgba(239, 111, 99, 0.13); color: var(--red); }

.chart-wrap { position: relative; margin-top: 18px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-area { fill: var(--chart-area); }
.chart-line { fill: none; stroke: var(--chart-line); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--card); stroke: var(--chart-line); stroke-width: 2; }
.chart-zero { stroke: var(--chart-zero); stroke-dasharray: 4 5; }
.chart-labels { display: flex; justify-content: space-between; padding: 8px 4px 0; }
.chart-labels span { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-empty { text-align: center; color: var(--faint); font-size: 14px; padding: 28px 0 10px; }

/* ── Stat-Kacheln ─────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: border-color 0.15s;
}
.stat:hover { border-color: var(--line-strong); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.stat .value { font-size: 24px; font-weight: 650; letter-spacing: -0.4px; }
.value.green { color: var(--green); }
.value.red { color: var(--red); }

/* ── Zwei-Spalten unten ──────────────────────────────── */
.cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.mini-row { display: flex; gap: 16px; }
.mini { flex: 1; }
.mini .value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.mini .label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: none; }
.activity .a-name { font-weight: 500; font-size: 14.5px; }
.activity .a-sub { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.activity .a-right { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Formulare ────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 7px; color: var(--ink); }
.field input, .field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--input-bg);
    color: var(--ink);
}
.field input::placeholder { color: var(--faint); }
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.field select option { background: var(--card-solid); color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn {
    display: inline-block;
    background: var(--btn-bg);
    color: var(--btn-ink);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 550;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { padding: 7px 13px; font-size: 13px; }

/* ── Tabelle ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); }
th, td { text-align: left; padding: 14px 18px; font-size: 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--row-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.open { background: var(--pill-open-bg); color: var(--muted); }
.pill.sold { background: rgba(76, 201, 140, 0.13); color: var(--green); }
.gewinn-pos { color: var(--green); font-weight: 600; }
.gewinn-neg { color: var(--red); font-weight: 600; }

/* ── Auth-Seiten ──────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 390px; }
.auth-card .logo { text-align: center; font-size: 34px; margin-bottom: 8px; }
.auth-card .brand-logo {
    text-align: center;
    font-family: "Space Grotesk", -apple-system, sans-serif;
    font-weight: 700;
    font-size: 42px;
    letter-spacing: -1.4px;
    margin-bottom: 6px;
    color: var(--ink);
}
.auth-card h1 { text-align: center; }
.auth-card .subtitle { text-align: center; margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth-foot a { text-decoration: underline; }

.alert { background: rgba(239, 111, 99, 0.10); color: var(--red);
    border: 1px solid rgba(239, 111, 99, 0.28);
    padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; }
.empty { text-align: center; color: var(--muted); padding: 64px 20px; }
.empty p { margin: 0 0 18px; font-size: 15px; }

@media (max-width: 720px) {
    .stat-grid, .cols, .row2, .mini-row { grid-template-columns: 1fr; }
    .cols, .mini-row { display: grid; }
    .hero-value { font-size: 32px; }
    .topbar { gap: 12px; padding: 0 14px; }
    .username { display: none; }
}
