/* ============================================================
   Terminell Design-System (eigene Identität)
   Light/Dark, AAA-Kontrast (Reg 103), Glas-Akzente (Reg 6a),
   warme Off-White-Basis, Petrol + Amber, kein KI-Standard-Look.
   ============================================================ */

:root {
  /* Light (Standard) */
  --bg:        #F4F2ED;   /* warmes Off-White, nie Pure-White */
  --bg-2:      #ECE8E0;
  --surface:   #FCFBF9;   /* Karten */
  --surface-2: #F7F4EF;
  --ink:       #1A1815;   /* Text, ~15:1 auf --bg (AAA) */
  --muted:     #4C473F;   /* Sekundärtext, AAA (8.2:1) auf --bg */
  --faint:     #574F44;   /* Hinweise/Mono-Labels, AAA (7.2:1) auf --bg */
  --line:      rgba(26,24,21,.12);
  --line-2:    rgba(26,24,21,.07);

  --primary:   #0A5244;   /* Petrol, als Text AAA auf --bg */
  --primary-ink:#FFFFFF;  /* Text auf Primär-Fill */
  --primary-soft: rgba(11,90,76,.12);
  --warm:      #A8481A;   /* Terrakotta/Amber für Füllungen/Borders */
  --warm-soft: rgba(168,72,26,.12);
  --warm-strong: #87380F; /* Terrakotta als kleiner Text, AAA (7.2:1) */

  --anchor:    #123A31;   /* dunkle Anker-Karte (Blickfang) */
  --anchor-ink:#F3F0EA;
  --anchor-ink-mut: #AEC3BC;

  --ok:#1C5636; --warn:#8A5A00; --bad:#9A2B2B;

  --radius:   18px;
  --radius-sm:12px;
  --radius-pill:999px;
  --shadow-1: 0 1px 2px rgba(26,24,21,.05), 0 2px 8px rgba(26,24,21,.05);
  --shadow-2: 0 4px 14px rgba(26,24,21,.08), 0 12px 40px rgba(26,24,21,.08);
  --shadow-anchor: 0 18px 50px rgba(18,58,49,.28);

  --glass-border: rgba(11,90,76,.35);

  --ff: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --maxw: 1280px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:        #16130F;   /* warmes Near-Black */
  --bg-2:      #1C1812;
  --surface:   #211C16;
  --surface-2: #272118;
  --ink:       #F2EEE7;
  --muted:     #BCB3A5;   /* AAA auf --bg */
  --faint:     #AAA091;
  --line:      rgba(242,238,231,.12);
  --line-2:    rgba(242,238,231,.07);

  --primary:   #52C6AE;   /* helles Petrol/Mint auf dunkel (AAA) */
  --primary-ink:#0A2019;
  --primary-soft: rgba(82,198,174,.16);
  --warm:      #E9A869;
  --warm-soft: rgba(233,168,105,.16);
  --warm-strong: #E9A869; /* auf dunkel bereits AAA (9:1) */

  --anchor:    #0E322A;
  --anchor-ink:#EAF3EF;
  --anchor-ink-mut:#9FBBB2;

  --ok:#5FD39A; --warn:#E9B55C; --bad:#F0837F;

  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 2px 10px rgba(0,0,0,.28);
  --shadow-2: 0 6px 20px rgba(0,0,0,.4), 0 16px 48px rgba(0,0,0,.4);
  --shadow-anchor: 0 18px 50px rgba(0,0,0,.5);
  --glass-border: rgba(82,198,174,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
body.theme-anim, body.theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Typografie ---------- */
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.08; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.22rem; letter-spacing: -.01em; }
p  { margin: 0 0 1em; color: var(--muted); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--muted); }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--warm-strong);
}
.ink { color: var(--ink); }
.muted { color: var(--muted); }

/* ---------- Buttons: Pill + Glas (Reg 6a) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 650; font-size: .98rem;
  padding: .72em 1.3em; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer;
  min-height: 46px; line-height: 1; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { text-decoration: none; box-shadow: var(--shadow-2); }
.btn-glass {
  background: linear-gradient(135deg, var(--primary-soft), rgba(168,72,26,.10));
  border: 1px solid var(--glass-border);
  color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-glass:hover { text-decoration: none; background: linear-gradient(135deg, var(--primary-soft), var(--warm-soft)); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { text-decoration: none; border-color: var(--primary); }
.btn-warm { background: var(--warm); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: .9em 1.7em; font-size: 1.05rem; min-height: 54px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Icons (Default-Größe, sonst rendern sie riesig) ---------- */
.ico { width: 24px; height: 24px; flex: none; }
.btn .ico { width: 20px; height: 20px; }
.ico-xl { width: 40px; height: 40px; }
.feat-ico {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--glass-border);
}
.feat-ico .ico { width: 26px; height: 26px; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-1);
}
.card-pad-lg { padding: 32px; }
.card-anchor {
  background: var(--anchor); color: var(--anchor-ink);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-anchor);
  border: 1px solid rgba(255,255,255,.06);
}
.card-anchor h1,.card-anchor h2,.card-anchor h3 { color: var(--anchor-ink); }
.card-anchor p { color: var(--anchor-ink-mut); }

/* ---------- Chips / Badges / Mono-Label ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .35em .75em; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.mono-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.badge { display:inline-flex; align-items:center; gap:.35em; padding:.25em .6em; border-radius:8px; font-size:.75rem; font-weight:700; }
.badge-ok  { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge-warn{ background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge-bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* ---------- Formulare ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; color: var(--ink); }
.input, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .8em 1em; min-height: 48px;
}
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: .82rem; color: var(--faint); margin-top: 6px; }

/* ---------- Flash / Alert ---------- */
.alert { border-radius: var(--radius-sm); padding: .9em 1.1em; margin-bottom: 18px; font-size: .95rem; border:1px solid var(--line); background: var(--surface-2); }
.alert-ok  { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ink); }
.alert-bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--ink); }

/* ---------- Layout-Utility ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display:flex; gap:12px; align-items:center; justify-content:space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.hide { display: none !important; }

/* ============================================================
   App-Shell (angemeldet): adaptiv nach Breite
   >=768px  Tablet/Desktop = Verwaltungs-Dashboard mit Seiten-Rail
   <768px   Handy          = Mitarbeiter-App mit Bottom-Tabbar
   ============================================================ */
.appbody { background: var(--bg); min-height: 100dvh; }
.shell { display: grid; min-height: 100dvh; grid-template-columns: 260px 1fr; }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; position: sticky; top: 0; height: 100dvh;
}
.rail-brand { display:flex; align-items:center; gap:10px; padding: 8px 10px 18px; }
.rail-brand .logo { width: 34px; height: 34px; }
.rail-brand b { font-size: 1.15rem; letter-spacing: -.02em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: .96rem; cursor: pointer; border:1px solid transparent;
}
.nav-item .ico { width: 22px; height: 22px; flex: none; color: currentColor; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration:none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); border-color: var(--glass-border); }
.rail-spacer { flex: 1; }
.main { padding: clamp(18px, 3vw, 36px); min-width: 0; }
.topbar { display:flex; align-items:center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.topbar h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0; }

.tabbar { display: none; }

@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .tab {
    display:flex; flex-direction: column; align-items:center; gap:3px;
    color: var(--faint); font-size: .68rem; font-weight: 650; padding: 6px 4px; border-radius: 12px; cursor:pointer;
  }
  .tab .ico { width: 24px; height: 24px; }
  .tab.active { color: var(--primary); }
  .topbar h1 { font-size: 1.4rem; }
}

/* ---------- Theme-Toggle ---------- */
.theme-toggle {
  display:inline-flex; align-items:center; justify-content:center; width:46px; height:46px;
  border-radius: var(--radius-pill); border:1px solid var(--line); background: var(--surface); color: var(--ink); cursor:pointer;
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle .ico { width: 22px; height: 22px; }

/* ---------- Kalender-Grundraster (Phase 2 nutzt es) ---------- */
.cal { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-col { border-left: 1px solid var(--line-2); min-height: 200px; }
.cal-slot { height: 48px; border-top: 1px solid var(--line-2); }
.appt { border-radius: 8px; padding: 4px 8px; font-size: .82rem; color:#fff; box-shadow: var(--shadow-1); }

/* ---------- Marketing/Hero ---------- */
.hero { padding: clamp(48px, 10vh, 120px) 0 clamp(40px, 8vh, 90px); }
.hero h1 { max-width: 16ch; }
.hero .lead { max-width: 46ch; }
.price-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.price { background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.price.featured { background: var(--anchor); color: var(--anchor-ink); box-shadow: var(--shadow-anchor); }
.price.featured p, .price.featured li { color: var(--anchor-ink-mut); }
.price .amount { font-size: 2.6rem; font-weight: 850; letter-spacing: -.03em; }
.price ul { list-style: none; padding: 0; margin: 14px 0 0; }
.price li { padding: 7px 0; border-top: 1px solid var(--line-2); font-size: .93rem; }
.feat-grid { display:grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.trust { display:flex; gap: 10px 22px; flex-wrap: wrap; align-items:center; }

@media (max-width: 860px) {
  .price-grid, .feat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
}

/* ---------- Auth-Box ---------- */
.auth-wrap { min-height: 100dvh; display:grid; place-items:center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-head { text-align:center; margin-bottom: 22px; }
.auth-head .logo { width: 48px; height: 48px; margin: 0 auto 12px; }
.divider { height:1px; background: var(--line); margin: 22px 0; }
.center { text-align:center; }
.small { font-size: .88rem; }

/* ---------- Phase 1: Onboarding / Team / Leistungen ---------- */
.qrbox { background:#fff; border:1px solid rgba(0,0,0,.1); border-radius:var(--radius); padding:18px; display:grid; place-items:center; max-width:320px; margin:14px 0; }
.qrbox svg { width:100%; height:auto; max-width:284px; }
.pin-input { letter-spacing:.5em; text-align:center; font-size:1.4rem; font-weight:700; }
.emp-dot { width:14px; height:14px; border-radius:50%; flex:none; display:inline-block; border:1px solid rgba(0,0,0,.15); }
.emp-card { display:flex; gap:14px; align-items:flex-start; }
.emp-av { width:44px; height:44px; border-radius:13px; flex:none; display:grid; place-items:center; color:#fff; font-weight:800; font-size:1.05rem; }
.list-row { display:flex; align-items:center; gap:12px; padding:14px 0; border-top:1px solid var(--line-2); }
.list-row:first-child { border-top:0; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; align-items:end; }
input[type=color] { width:48px; height:48px; padding:3px; border-radius:12px; cursor:pointer; }
.linkbox { font-family:var(--mono); font-size:.8rem; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; padding:10px 12px; word-break:break-all; color:var(--muted); }

/* ---------- Phase 2: Modal (X + ESC schließen, kein Click-Outside, Reg 46) ---------- */
.modal-bg { position:fixed; inset:0; z-index:10000; background:rgba(10,8,6,.55); display:grid; place-items:center; padding:16px; backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px); }
.modal { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); width:100%; max-width:470px; max-height:92vh; overflow:auto; box-shadow:var(--shadow-2); }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 20px; border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--surface); z-index:2; }
.modal-head h3 { margin:0; }
.modal-x { width:38px; height:38px; border-radius:50%; border:1px solid var(--line); background:var(--surface-2); color:var(--ink); cursor:pointer; display:grid; place-items:center; flex:none; }
.modal-x:hover { border-color:var(--bad); color:var(--bad); }
.modal-x .ico { width:20px; height:20px; }
.modal-body { padding:20px; }
.modal-foot { padding:16px 20px; border-top:1px solid var(--line); display:flex; gap:10px; justify-content:space-between; align-items:center; position:sticky; bottom:0; background:var(--surface); }

/* ---------- Kalender ---------- */
.cal-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.seg { display:inline-flex; background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius-pill); padding:3px; }
.seg button { border:0; background:transparent; color:var(--muted); font:inherit; font-weight:650; padding:.42em .95em; border-radius:var(--radius-pill); cursor:pointer; }
.seg button.on { background:var(--primary); color:var(--primary-ink); }
.cal-nav { display:inline-flex; gap:4px; align-items:center; }
.icon-btn { width:44px; height:44px; border-radius:12px; border:1px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; display:grid; place-items:center; }
.icon-btn:hover { border-color:var(--primary); }
.cal-date { font-weight:750; font-size:1.02rem; min-width:150px; text-align:center; }

.cal-wrap { border:1px solid var(--line); border-radius:var(--radius); overflow:auto; background:var(--surface); max-height:74vh; }
.cal-head { display:grid; position:sticky; top:0; z-index:6; background:var(--surface); border-bottom:1px solid var(--line); }
.cal-head .ch { padding:9px 6px; text-align:center; font-weight:700; font-size:.86rem; border-left:1px solid var(--line-2); display:flex; flex-direction:column; align-items:center; gap:3px; }
.cal-head .ch:first-child { border-left:0; }
.cal-head .ch .dot { width:10px; height:10px; border-radius:50%; }
.cal-head .ch.today { color:var(--primary); }
.cal-head .ch a { color:inherit; }
.cal-body { display:grid; position:relative; }
.cal-axis .hr { height:60px; position:relative; }
.cal-axis .hr span { position:absolute; top:-8px; right:6px; font-size:.7rem; color:var(--faint); background:var(--surface); padding:0 2px; font-variant-numeric:tabular-nums; }
.cal-col { position:relative; border-left:1px solid var(--line-2); }
.cal-col .slot { height:60px; border-top:1px solid var(--line-2); }
.cal-col .slot:first-child { border-top:0; }
.cal-col.highlight { background:var(--primary-soft); }
.appt-blk { position:absolute; left:3px; right:3px; border-radius:8px; padding:3px 7px; color:#fff; font-size:.75rem; line-height:1.2; overflow:hidden; cursor:grab; box-shadow:var(--shadow-1); border:1px solid rgba(255,255,255,.2); touch-action:none; user-select:none; }
.appt-blk.dragging { opacity:.9; cursor:grabbing; z-index:30; box-shadow:var(--shadow-2); }
.appt-blk b { font-weight:750; display:block; }
.appt-blk .t { opacity:.92; font-variant-numeric:tabular-nums; }
.appt-blk .st { position:absolute; top:4px; right:5px; width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.9); }
.cal-nowline { position:absolute; left:0; right:0; height:2px; background:var(--warm); z-index:4; pointer-events:none; }
.cal-nowline::before { content:''; position:absolute; left:-4px; top:-3px; width:8px; height:8px; border-radius:50%; background:var(--warm); }

@media (max-width:767px){ .cal-wrap{ max-height:68vh; } .cal-date{ min-width:110px; font-size:.95rem; } }
