:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-2:      #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --good:           #006300;

  --series-1: #2a78d6; /* blue   — Netcup VPS */
  --series-2: #eb6834; /* orange — domain */
  --series-3: #1baf7a; /* aqua   — Nabu Casa */
  --series-4: #eda100; /* yellow — Anthropic */
  --series-5: #e87ba4; /* magenta — Gemini */
  --series-6: #008300; /* green  — Tailscale */
  --series-7: #4a3aa7; /* violet — Coolify */
  --series-8: #e34948; /* red    — spare */
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --surface-2: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255,255,255,0.10);
    --good: #0ca30c;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --surface-2: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255,255,255,0.10);
  --good: #0ca30c;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#login-screen, #app { display: none; }
body.authed #app { display: block; }
body.unauthed #login-screen { display: flex; }

#login-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 320px;
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin: 0 0 20px; }
.login-card input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); font-size: 14px; margin-bottom: 12px;
}
.login-card button, .btn {
  padding: 10px 16px; border-radius: 8px; border: none; background: var(--series-1);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-card button:hover, .btn:hover { opacity: 0.9; }
.login-error { color: var(--series-8); font-size: 13px; margin-bottom: 12px; min-height: 16px; }

header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 24px 32px; border-bottom: 1px solid var(--border);
}
header h1 { font-size: 18px; margin: 0; }
header .sub { color: var(--text-muted); font-size: 13px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}

main { max-width: 900px; margin: 0 auto; padding: 32px; display: grid; gap: 32px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 24px;
}
.card h2 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 0 0 16px; text-transform: uppercase; letter-spacing: 0.02em; }

.hero-label { color: var(--text-secondary); font-size: 13px; margin: 0 0 4px; }
.hero-value { font-size: 48px; font-weight: 600; margin: 0; }
.hero-note { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

.bar-row { display: grid; grid-template-columns: 200px 1fr 90px; align-items: center; gap: 12px; padding: 6px 0; }
.bar-row .name { font-size: 13px; color: var(--text-primary); }
.bar-track { position: relative; height: 24px; }
.bar-fill { position: absolute; left: 0; top: 0; height: 24px; border-radius: 0 4px 4px 0; }
.bar-row .amount { font-size: 13px; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.bar-row.no-data .amount { color: var(--text-muted); font-style: italic; }

.free-list { display: flex; flex-wrap: wrap; gap: 8px; }
.free-chip {
  font-size: 12px; color: var(--text-secondary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--border); }
td { padding: 8px 6px; border-bottom: 1px solid var(--grid); vertical-align: top; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
input.edit-amount { width: 80px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); font-variant-numeric: tabular-nums; }
select.edit-currency { padding: 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); }
.save-hint { font-size: 11px; color: var(--good); opacity: 0; transition: opacity 0.3s; }
.save-hint.show { opacity: 1; }

.status-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--grid); }
.status-row:last-child { border-bottom: none; }
.status-row .label { color: var(--text-secondary); }
.status-ok { color: var(--good); }
.status-warn { color: var(--series-2); }

.tooltip {
  position: fixed; pointer-events: none; background: var(--text-primary); color: var(--surface-1);
  font-size: 12px; padding: 6px 10px; border-radius: 6px; opacity: 0; transition: opacity 0.1s;
  z-index: 100; white-space: nowrap;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-value { font-weight: 700; }
.tooltip .tt-label { color: var(--text-muted); }

.manual-entry-form { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.manual-entry-form input, .manual-entry-form select {
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); font-size: 13px;
}
.form-msg { font-size: 12px; color: var(--good); }
