/* ==========================================================================
   Kronos Designsystem — eine Quelle für alle Seiten.
   Drei-Zustands-Theming: heller Default (:root), Systemdunkel (@media),
   und explizite Wahl (:root[data-theme=...]). Umschalter siehe theme.js.
   ========================================================================== */

:root{
  --ground:#eef1e9; --surface:#ffffff; --surface-2:#f7f9f3;
  --ink:#18231b; --muted:#5c6b5f; --line:#dce3d7; --line-strong:#c3cdba;
  --accent:#2f7d4f; --accent-ink:#ffffff; --accent-soft:#e5f0e8;
  --map:#3a5f8a; --map-ink:#ffffff;                 /* Sekundär: Kartenaktionen */
  --warn:#8a5e00; --warn-bg:#f7efd8; --err:#a12727; --err-bg:#f8e6e6; --ok:#2f7d4f;
  --shadow:0 1px 2px rgba(24,35,27,.05), 0 8px 24px -12px rgba(24,35,27,.18);
  --shadow-lift:0 2px 6px rgba(24,35,27,.08), 0 18px 40px -18px rgba(24,35,27,.28);
  /* Höhenrampe — datengetrieben, in beiden Themes identisch */
  --h0:#1a261e; --h1:#1f5c3c; --h2:#5f9c56; --h3:#b0c860; --h4:#f0e896;
  --ramp:linear-gradient(90deg,var(--h0),var(--h1) 32%,var(--h2) 60%,var(--h3) 82%,var(--h4));
  --code-bg:#f2f4ee;
  --deco1:.07; --deco2:.05; --deco-hero:.5;         /* Deckkraft Kronen-Deko */
  --font-display:"Fraunces",Georgia,"Times New Roman",serif;
  --font-body:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --font-mono:"IBM Plex Mono",ui-monospace,"SFMono-Regular",Menlo,monospace;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --ground:#0e140f; --surface:#16201a; --surface-2:#1b271f;
    --ink:#e8f0e9; --muted:#9db3a4; --line:#26332a; --line-strong:#33463a;
    --accent:#6cc088; --accent-ink:#0b120d; --accent-soft:#1a2b21;
    --map:#7ea7d8; --map-ink:#0b120d;
    --warn:#e6b800; --warn-bg:#2c2610; --err:#ff8585; --err-bg:#2c1414; --ok:#6cc088;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
    --shadow-lift:0 2px 8px rgba(0,0,0,.5), 0 22px 48px -20px rgba(0,0,0,.8);
    --code-bg:#0f1712; --deco1:.13; --deco2:.10; --deco-hero:.62;
  }
}
:root[data-theme="dark"]{
  --ground:#0e140f; --surface:#16201a; --surface-2:#1b271f;
  --ink:#e8f0e9; --muted:#9db3a4; --line:#26332a; --line-strong:#33463a;
  --accent:#6cc088; --accent-ink:#0b120d; --accent-soft:#1a2b21;
  --map:#7ea7d8; --map-ink:#0b120d;
  --warn:#e6b800; --warn-bg:#2c2610; --err:#ff8585; --err-bg:#2c1414; --ok:#6cc088;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  --shadow-lift:0 2px 8px rgba(0,0,0,.5), 0 22px 48px -20px rgba(0,0,0,.8);
  --code-bg:#0f1712; --deco1:.13; --deco2:.10; --deco-hero:.62;
}

/* ============ BASE ============ */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{animation-duration:.01ms!important;transition-duration:.01ms!important}}
body{
  margin:0; color:var(--ink);
  background:
    radial-gradient(1100px 720px at 90% -12%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    radial-gradient(820px 620px at -8% 8%, color-mix(in srgb, var(--h2) 10%, transparent), transparent 58%),
    var(--ground);
  background-attachment:fixed;
  font-family:var(--font-body); font-size:16px; line-height:1.6; -webkit-font-smoothing:antialiased;
}
h1,h2,h3{font-family:var(--font-display); font-weight:600; line-height:1.14; text-wrap:balance; margin:0}
a{color:var(--accent)}
code,.mono{font-family:var(--font-mono)}
.muted{color:var(--muted)}
.hidden{display:none!important}
.eyebrow{font-family:var(--font-mono); font-size:12px; letter-spacing:.16em; text-transform:uppercase;
  color:var(--accent); font-weight:500}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:4px}

/* ============ KRONEN-HINTERGRUND (via theme.js injiziert) ============ */
.bg-canopy{position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none}
.bg-canopy .cc{position:absolute; height:auto}
.bg-canopy .cc1{right:-14vw; bottom:-16vw; width:min(64vw,820px); opacity:var(--deco1);
  animation:breathe 16s ease-in-out infinite}
.bg-canopy .cc2{left:-12vw; top:12vh; width:min(38vw,440px); opacity:var(--deco2);
  animation:breathe 22s ease-in-out infinite reverse}
@keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.045)}}
@media (prefers-reduced-motion:reduce){.bg-canopy .cc{animation:none}}
.crown-deco{position:absolute; top:50%; right:-6vw; transform:translateY(-50%);
  width:clamp(240px,40vw,520px); height:auto; z-index:0; pointer-events:none; opacity:var(--deco-hero)}
@media(max-width:760px){.crown-deco{right:-26vw; opacity:.2; width:min(70vw,340px)}}

/* ============ HEADER / TOPBAR ============ */
header.app{position:sticky; top:0; z-index:30; backdrop-filter:blur(10px);
  background:color-mix(in srgb, var(--ground) 82%, transparent); border-bottom:1px solid var(--line)}
header.app .row{max-width:900px; margin:0 auto; padding:12px 16px; display:flex; align-items:center; gap:12px}
.brand{display:flex; align-items:center; gap:11px}
.brand .mark{width:30px; height:30px; flex:none}
.brand .name{font-family:var(--font-display); font-weight:600; font-size:21px; letter-spacing:.2px; line-height:1}
.brand .name small{display:block; font-family:var(--font-mono); font-size:10px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--muted); margin-top:3px; font-weight:400}
.spacer{margin-left:auto}
#whoami{font-family:var(--font-mono); font-size:12.5px; color:var(--muted)}

/* Umschalt-/Aktionsknöpfe im Header */
.pill{display:inline-flex; align-items:center; gap:7px; background:var(--surface); color:var(--ink);
  border:1px solid var(--line); border-radius:999px; padding:7px 13px; font:inherit; font-size:13px;
  cursor:pointer; box-shadow:var(--shadow); transition:border-color .15s, transform .12s}
.pill:hover{border-color:var(--accent)} .pill:active{transform:translateY(1px)}

/* ============ LAYOUT ============ */
main{max-width:900px; margin:0 auto; padding:24px 16px 72px}
.step{background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:22px 24px;
  margin-bottom:18px; box-shadow:var(--shadow)}
.step > h2{font-size:18px; display:flex; align-items:center; gap:10px; margin:0 0 4px}
.step .num{display:inline-flex; width:26px; height:26px; border-radius:50%; background:var(--accent-soft);
  color:var(--accent); font-family:var(--font-mono); font-size:13px; align-items:center; justify-content:center;
  font-weight:600; flex:none}
.hint{color:var(--muted); font-size:13.5px; margin:2px 0 16px}

/* ============ TILES ============ */
.tiles{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media(max-width:560px){.tiles{grid-template-columns:1fr}}
.tile{border:1.5px solid var(--line); border-radius:12px; padding:16px; background:var(--surface);
  cursor:pointer; text-align:left; font:inherit; color:inherit;
  transition:border-color .15s, transform .15s, box-shadow .15s}
.tile:hover{border-color:var(--line-strong); transform:translateY(-2px); box-shadow:var(--shadow)}
.tile.active{border-color:var(--accent); background:var(--accent-soft)}
.tile.disabled{opacity:.5; cursor:not-allowed; transform:none; box-shadow:none}
.tile .t{font-weight:600}
.tile .d{font-size:13px; color:var(--muted); margin-top:4px}

/* ============ FORMFELDER ============ */
label.field{display:block; margin:14px 0; font-size:14px}
label.field > span{display:block; margin-bottom:5px; font-weight:600}
input[type=file], input[type=text], input[type=email], input[type=password], input[type=number], select{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:9px; background:var(--surface);
  color:var(--ink); font:inherit; font-size:14px; transition:border-color .15s, box-shadow .15s}
input:focus, select:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft)}
.params{display:flex; flex-wrap:wrap; gap:16px; margin-top:10px}
.params label{font-size:13px; color:var(--muted)}
.params input{width:100px}
details summary{cursor:pointer; font-size:13px; color:var(--muted)}

/* ============ BUTTONS ============ */
button.go, a.dl{font:inherit; font-weight:600; border:1px solid transparent; border-radius:10px;
  padding:12px 22px; cursor:pointer; background:var(--accent); color:var(--accent-ink);
  text-decoration:none; display:inline-block; box-shadow:var(--shadow);
  transition:transform .12s, box-shadow .15s, background .15s}
button.go:hover, a.dl:hover{box-shadow:var(--shadow-lift)}
button.go:active, a.dl:active{transform:translateY(1px)}
button.go:disabled{background:var(--line-strong); color:var(--surface); cursor:not-allowed; box-shadow:none}
.btn-map{background:var(--map)!important; color:var(--map-ink)!important}
button.link{background:none; border:none; color:var(--accent); cursor:pointer; font:inherit; padding:6px 0}

/* ============ FORTSCHRITT + PHASEN-STEPPER ============ */
.bar{height:9px; background:var(--accent-soft); border-radius:6px; overflow:hidden; margin:12px 0}
.bar > i{display:block; height:100%; width:0; background:var(--ramp); border-radius:6px; transition:width .3s}
.status-line{font-size:14px; color:var(--muted); font-family:var(--font-mono)}
.stepper{display:flex; align-items:flex-start; margin:8px 0 6px}
.pstep{flex:1; text-align:center; position:relative; padding-top:26px}
.pstep::before{content:""; position:absolute; top:8px; left:0; right:0; height:2px; background:var(--line)}
.pstep:first-child::before{left:50%}
.pstep:last-child::before{right:50%}
.pstep .node{position:absolute; top:0; left:50%; transform:translateX(-50%); width:18px; height:18px;
  border-radius:50%; background:var(--surface); border:2px solid var(--line-strong); transition:.2s}
.pstep.done::before{background:var(--accent)}
.pstep.done .node{background:var(--accent); border-color:var(--accent)}
.pstep.active .node{border-color:var(--accent); box-shadow:0 0 0 4px var(--accent-soft);
  animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{0%,100%{box-shadow:0 0 0 4px var(--accent-soft)}50%{box-shadow:0 0 0 8px transparent}}
@media (prefers-reduced-motion:reduce){.pstep.active .node{animation:none}}
.pstep .plabel{font-size:11.5px; color:var(--muted)}
.pstep.active .plabel, .pstep.done .plabel{color:var(--ink); font-weight:500}
/* Schmale Schirme: sechs Beschriftungen nebeneinander werden sonst zu Schnipseln.
   Dann trägt nur noch der aktive Schritt seinen Namen — die Statuszeile darunter
   sagt ohnehin, was gerade läuft. */
@media(max-width:560px){
  .stepper{margin-bottom:2px}
  .pstep{padding-top:22px}
  .pstep .plabel{font-size:10.5px; opacity:0; transition:opacity .2s}
  .pstep.active .plabel{opacity:1; white-space:nowrap}
}
.phase-why{background:var(--surface-2); border:1px dashed var(--line-strong); border-radius:10px;
  padding:11px 14px; font-size:13.5px; color:var(--muted); margin-top:12px}
.phase-why b{color:var(--ink)}

/* ============ KENNZAHLEN + HÖHENSTREIFEN ============ */
.result-grid, .metrics{display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px; margin:14px 0}
.metric{background:var(--surface-2); border:1px solid var(--line); border-radius:12px; padding:14px 16px}
.metric .v{font-family:var(--font-display); font-size:28px; font-weight:600; color:var(--accent);
  font-variant-numeric:tabular-nums; line-height:1}
.metric .k{font-family:var(--font-mono); font-size:11px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--muted); margin-top:8px}
.height-range{background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin:12px 0}
.height-range .rt{font-family:var(--font-mono); font-size:11px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--muted); margin-bottom:10px}

/* ============ HINWEISE / NOTICES ============ */
.notice{border-radius:10px; padding:11px 14px; font-size:13.5px; margin:8px 0; background:var(--surface-2)}
.notice.warn{background:var(--warn-bg); color:var(--warn)}
.notice.err{background:var(--err-bg); color:var(--err)}

/* ============ JOB-LISTE ============ */
/* Breite Tabellen scrollen in ihrem eigenen Kasten, statt die Seite zu sprengen
   oder sich auf dem Telefon zu unleserlichen Spalten zu quetschen. */
.scroll-x{overflow-x:auto; -webkit-overflow-scrolling:touch}
.scroll-x > table.jobs{min-width:480px}
table.jobs{width:100%; border-collapse:collapse; font-size:14px;
  font-variant-numeric:tabular-nums}
table.jobs th, table.jobs td{text-align:left; padding:7px 8px; border-bottom:1px solid var(--line)}
.job-card{border:1px solid var(--line); border-radius:12px; margin-bottom:10px; overflow:hidden; background:var(--surface)}
.job-head{display:flex; justify-content:space-between; align-items:center; padding:12px 14px; cursor:pointer;
  transition:background .15s}
.job-head:hover{background:var(--accent-soft)}
.job-detail{padding:6px 14px 16px; border-top:1px solid var(--line)}

/* ============ TOASTS (via theme.js injiziert) ============ */
#toasts{position:fixed; top:16px; right:16px; z-index:60; display:flex; flex-direction:column; gap:10px;
  max-width:min(92vw,360px)}
.toast{display:flex; align-items:flex-start; gap:10px; background:var(--surface); border:1px solid var(--line);
  border-left:3px solid var(--ok); border-radius:11px; padding:11px 15px; box-shadow:var(--shadow-lift);
  font-size:14px; animation:toastin .28s ease both}
.toast.warn{border-left-color:var(--warn)} .toast.err{border-left-color:var(--err)}
.toast .ic{flex:none; font-weight:700; color:var(--ok)} .toast.warn .ic{color:var(--warn)} .toast.err .ic{color:var(--err)}
.toast.out{animation:toastout .3s ease forwards}
@keyframes toastin{from{opacity:0; transform:translateX(16px)}to{opacity:1; transform:none}}
@keyframes toastout{to{opacity:0; transform:translateX(16px)}}
@media (prefers-reduced-motion:reduce){.toast{animation:none}}

/* ============ AUTH-KARTEN (login / setpassword) ============ */
body.auth{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px}
.auth .card{position:relative; z-index:1; background:var(--surface); border:1px solid var(--line);
  border-radius:18px; padding:32px; width:min(94vw,400px); box-shadow:var(--shadow-lift)}
.auth .card .brand{margin-bottom:6px}
.auth .card .sub{color:var(--muted); font-size:13.5px; margin:0 0 20px}
.auth .card label{display:block; font-size:13px; font-weight:600; margin:14px 0 5px}
.auth .card button[type=submit]{width:100%; margin-top:18px}
.auth .theme-fab{position:fixed; top:16px; right:16px; z-index:2}
