/* Life Archive – Konsole des Betreibers. Dieselbe Welt wie die App:
   der Teich bei Nacht (#0f1114), Sechsecke als Zeichen, geschnittene Ecken
   statt Rundungen, Spline Sans und Martian Mono (eigene Kopien, nichts von
   außen). Eine Akzentfarbe (das Kalender-Blau der App) für das, was man tun
   kann; Gold nur für Premium; Rot nur für Gefahr. */

@font-face {
  font-family: "Spline Sans";
  src: url("/fonts/SplineSans.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/MartianMono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #0f1114;
  --bg-deep: #090b0d;
  --surface: #171a1f;
  --surface-2: #1c1f26;
  --surface-3: #2b303c;
  --line: #2f3542;
  --text: #e8e9ec;
  --muted: #a6abb6;
  --faint: #7d8390;
  --accent: #98e2f5;
  --accent-ink: #0f1114;
  --premium: #f6d68a;
  --good: #82f5cb;
  --warn: #f9c784;
  --danger: #ff9a9a;
  --focus: #98e2f5;
  --cut: 12px;
  --cut-s: 7px;
  --font: "Spline Sans", "Segoe UI", -apple-system, sans-serif;
  --mono: "Martian Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f3f5; --bg-deep: #e8e9ec; --surface: #ffffff; --surface-2: #ececef; --surface-3: #dfe0e5;
    --line: #cfd1d8; --text: #15171b; --muted: #4d525c; --faint: #6b707b;
    --accent: #16738c; --accent-ink: #ffffff; --premium: #8a6610; --good: #0f7a57; --warn: #93580a;
    --danger: #b3261e; --focus: #16738c;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.55 var(--font); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.noscript { padding: 24px; }
.mono { font-family: var(--mono); font-size: .86em; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.cut { clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.cut-s { clip-path: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s)); }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }

/* ---------- Zeichen ---------- */
.hex { width: 30px; height: 34px; flex: none; }
.hex polygon { fill: var(--accent); }
.hex path { stroke: var(--accent-ink); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.dot { width: 9px; height: 9px; display: inline-block; flex: none; background: currentColor;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }

/* ---------- Tor (Anmelden, Einrichten) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg); }
.gate-card { width: min(100%, 420px); background: var(--surface); padding: 28px 26px; display: grid; gap: 18px; }
.gate-head { display: flex; gap: 12px; align-items: center; }
.gate-head small { display: block; color: var(--muted); font-size: 12px; }
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 3px; background: var(--surface-3); }
.steps span.on { background: var(--accent); }

/* ---------- Felder ---------- */
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  background: var(--bg); border: 1px solid var(--line); padding: 9px 11px; width: 100%; min-width: 0; font-size: 14px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.meter { height: 4px; background: var(--surface-3); }
.meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.meter i[data-ok] { background: var(--good); }
.hint { font-size: 12.5px; color: var(--muted); }
.error { color: var(--danger); font-size: 13.5px; min-height: 1.3em; }
.ok { color: var(--good); }

/* ---------- Knöpfe ---------- */
.btn { border: 0; cursor: pointer; padding: 9px 16px; font-weight: 600; font-size: 14px; background: var(--surface-3);
  color: var(--text); clip-path: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s)); }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.wide { width: 100%; padding: 11px 16px; }
@media (prefers-reduced-motion: no-preference) { .btn { transition: filter .15s; } }

/* ---------- Hülle ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); padding: 18px 12px; display: grid; gap: 2px; align-content: start; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; }
.brand b { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; color: var(--muted);
  text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current=page] { background: var(--surface-3); color: var(--text); font-weight: 600; }
.nav .count { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.side-foot { margin-top: 18px; padding: 12px 10px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
.main { padding: 26px 32px 60px; display: grid; gap: 22px; align-content: start; max-width: 1180px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.page-head p { color: var(--muted); max-width: 70ch; margin-top: 6px; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; grid-auto-flow: row; padding: 12px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .side-foot { display: flex; flex-wrap: wrap; border: 0; padding: 6px 0 0; margin: 0; }
  .main { padding: 20px 16px 48px; }
}

/* ---------- Flächen ---------- */
.card { background: var(--surface); padding: 18px 20px; display: grid; gap: 12px; min-width: 0; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile .l { font-size: 12.5px; color: var(--muted); }
.tile.premium .n { color: var(--premium); }
.needs { display: grid; gap: 2px; background: var(--line); }
.need { background: var(--surface); padding: 12px 16px; display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.lvl { display: inline-flex; gap: 7px; align-items: center; font-weight: 650; font-size: 12.5px; }
.lvl.note { color: var(--accent); } .lvl.warning { color: var(--warn); } .lvl.critical { color: var(--danger); }
@media (max-width: 640px) { .need { grid-template-columns: 1fr; gap: 4px; } }
.tag { display: inline-flex; gap: 6px; align-items: center; padding: 2px 8px; font-size: 12px; font-weight: 600; background: var(--surface-3); white-space: nowrap; }
.tag.premium { color: var(--premium); } .tag.good { color: var(--good); } .tag.warn { color: var(--warn); }
.tag.danger { color: var(--danger); } .tag.accent { color: var(--accent); } .tag.faint { color: var(--faint); }
.seg { display: inline-flex; background: var(--surface); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface-3); color: var(--text); font-weight: 600; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.key { font-family: var(--mono); font-size: 13px; white-space: nowrap; letter-spacing: .03em; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.bar { height: 6px; background: var(--surface-3); min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i[data-hot] { background: var(--warn); }

/* ---------- Schlüssel-Baukasten ---------- */
.builder { background: var(--surface); padding: 16px; display: grid; gap: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.grp { display: grid; gap: 10px; grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1.25fr) 36px; align-items: end;
  background: var(--surface-2); padding: 12px; }
.grp label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; min-width: 0; }
.grp .pair { display: flex; gap: 6px; min-width: 0; }
.x { width: 36px; height: 36px; border: 0; background: var(--surface-3); color: var(--muted); cursor: pointer; font-size: 18px; }
@media (max-width: 860px) { .grp { grid-template-columns: 1fr 1fr; } .grp .wide { grid-column: 1 / -1; } }
.confirm-note { color: var(--warn); font-size: 13px; display: inline-flex; gap: 8px; align-items: center; }
.once { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }

/* ---------- Fenster ---------- */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg-deep) 72%, transparent); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { width: min(100%, 440px); background: var(--surface); padding: 22px; display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.toast { position: fixed; inset-block-end: 18px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--surface-3);
  padding: 10px 16px; font-size: 14px; z-index: 60; max-width: calc(100% - 32px); }
.key-touch { display: grid; place-items: center; gap: 10px; padding: 12px 0; text-align: center; }
.key-touch svg { width: 64px; height: 64px; }
.key-touch .ring { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .35; }
@media (prefers-reduced-motion: no-preference) {
  .key-touch .ring { animation: pulse 1.6s ease-in-out infinite; transform-origin: center; }
  @keyframes pulse { 0%, 100% { opacity: .2; transform: scale(.92); } 50% { opacity: .7; transform: scale(1); } }
}
.code { font-family: var(--mono); font-size: 12.5px; background: var(--bg); padding: 10px 12px; overflow-x: auto; white-space: pre; }

/* ---------- Rückmeldungen ---------- */
.seg .count { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-inline-start: 6px; }
.fb-seg { flex-wrap: wrap; }
.fb { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.fb-list { display: grid; gap: 2px; background: var(--line); align-content: start;
  max-height: calc(100vh - 210px); overflow-y: auto; position: sticky; top: 16px; }
.fb-list .empty { background: var(--surface); }
.fb-item { all: unset; box-sizing: border-box; display: grid; gap: 5px; padding: 11px 14px; background: var(--surface); cursor: pointer;
  border-inline-start: 3px solid transparent; }
.fb-item:hover { background: var(--surface-2); }
.fb-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.fb-item[aria-current=true] { background: var(--surface-3); border-inline-start-color: var(--accent); }
.fb-item.is-new .fb-line { font-weight: 600; color: var(--text); }
.fb-item-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-day { margin-inline-start: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.fb-star { color: var(--premium); font-size: 13px; }
.fb-line { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fb-detail { display: grid; gap: 10px; min-width: 0; }
.fb-back { display: none; justify-self: start; }
.fb-none { min-height: 200px; display: grid; place-items: center; }
.fb-card { gap: 18px; }
.fb-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; }
.fb-title { gap: 2px; }
.fb-title h2:focus { outline: none; }
.btn.is-on { color: var(--premium); }
.fb-thread { display: grid; gap: 10px; }
.fb-msg { display: grid; gap: 4px; padding: 12px 14px; background: var(--bg); max-width: 92%; }
.fb-msg.us { justify-self: end; background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.fb-who { font-size: 11.5px; letter-spacing: .04em; color: var(--faint); font-weight: 600; }
.fb-text { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { background: var(--bg); border: 1px solid var(--line); padding: 9px 11px; width: 100%; resize: vertical; font-size: 14px; line-height: 1.5; }
.fb-facts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); padding-top: 14px; border-top: 1px solid var(--line); }
.fb-facts .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fb-pair { flex-wrap: nowrap; gap: 6px; }
.fb-pair input { flex: 1; }
.fb-see { display: flex; gap: 8px; align-items: center; min-height: 38px; }
.fb-notes { padding-top: 14px; border-top: 1px solid var(--line); gap: 8px; }
.fb-note-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.fb-note-list li { background: var(--surface-2); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .fb { grid-template-columns: 1fr; }
  .fb-list { position: static; max-height: none; }
  .fb[data-open="1"] .fb-list { display: none; }
  .fb:not([data-open="1"]) .fb-detail { display: none; }
  .fb-back { display: inline-flex; }
}

/* ---------- Tage der Nutzung (E1) ---------- */
.act { display: grid; grid-template-columns: repeat(28, 5px); gap: 2px; }
.act i { height: 14px; background: var(--surface-3); }
.act i.on { background: var(--accent); }
@media (forced-colors: active) { .act i.on { background: CanvasText; } }
.fb-detail .row select { width: auto; }
.fb-actions { justify-content: flex-end; }
