/* Karl-Politik – Layout & Theme (Hell/Dunkel via CSS-Variablen) */

/* Palette an Karl-Zeit angelehnt (Marine-Blau + Akzentblau, weiche Verläufe). */
:root {
  --bg: #eef2f7;
  --bg-grad-1: #dbe6f3;
  --bg-grad-2: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #dde3ec;
  --text: #1f2a37;
  --muted: #6b7685;
  --primary: #1f3b5c;
  --primary-2: #2a5483;
  --primary-ink: #ffffff;
  --accent: #2f80ed;
  --ok: #16a34a;
  --warn: #e3a008;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(31, 59, 92, .10);
}

html[data-theme="dark"] {
  --bg: #0f141b;
  --bg-grad-1: #131b26;
  --bg-grad-2: #0c1118;
  --surface: #161d27;
  --surface-2: #1c2531;
  --border: #2a3645;
  --text: #e6ebf2;
  --muted: #93a1b3;
  --primary: #4f86c6;
  --primary-2: #3f6fa8;
  --primary-ink: #ffffff;
  --accent: #5aa2ff;
  --ok: #34d399;
  --warn: #f0b95b;
  --err: #f87171;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0f141b; --bg-grad-1: #131b26; --bg-grad-2: #0c1118;
    --surface: #161d27; --surface-2: #1c2531; --border: #2a3645;
    --text: #e6ebf2; --muted: #93a1b3; --primary: #4f86c6; --primary-2: #3f6fa8;
    --primary-ink: #ffffff; --accent: #5aa2ff;
    --ok: #34d399; --warn: #f0b95b; --err: #f87171;
    --shadow: 0 8px 28px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); }

/* ---------- App-Shell ---------- */
html { overflow-x: hidden; }
body.app { display: flex; min-height: 100vh; align-items: stretch; max-width: 100%; }

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; padding: 6px 8px 4px; }
.brand-logo { font-size: 1.4rem; }
.brand-tenant { font-size: .82rem; color: var(--muted); padding: 0 8px 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: .95rem;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--primary); color: var(--primary-ink); }
.nav-ico { width: 1.3em; text-align: center; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 16px 12px 6px; }

.side-ver { font-size: .8rem; color: var(--muted); padding: 10px 8px 2px; }
.ver-up { color: var(--accent); font-weight: 600; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.tb-title { font-weight: 600; font-size: 1.1rem; }
.tb-right { display: flex; align-items: center; gap: 14px; }
.tb-user { color: var(--text); text-decoration: none; }
.tb-user small { color: var(--muted); }
.tb-logout { color: var(--muted); text-decoration: none; font-size: .9rem; }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 1rem; }

.main { padding: 24px; flex: 1; }
.app-footer { padding: 14px 24px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); }

/* ---------- Bausteine ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
  overflow-x: auto;
}
.card h2 { margin-top: 0; font-size: 1.05rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.tile .tile-num { font-size: 2rem; font-weight: 700; }
.tile .tile-lbl { color: var(--muted); font-size: .9rem; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-ink); font-size: .95rem; cursor: pointer; text-decoration: none;
}
.btn { transition: background .15s ease, border-color .15s ease, transform .05s ease; }
.btn:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }

label { display: block; margin: 12px 0 4px; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=time], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); color: var(--text); font-size: .95rem; font-family: inherit;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: rgba(34,160,107,.15); color: var(--ok); }
.badge-warn { background: rgba(227,160,8,.15); color: var(--warn); }
.badge-err { background: rgba(214,69,69,.15); color: var(--err); }
.meta { color: var(--muted); font-size: .85rem; }
.bar { background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; margin-top: 3px; }
.bar-fill { background: var(--primary); height: 100%; border-radius: 999px; }
h3 { font-size: .98rem; }
.notice { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; }
.notice-ok { background: rgba(34,160,107,.12); color: var(--ok); }
.notice-err { background: rgba(214,69,69,.12); color: var(--err); }
.notice-warn { background: rgba(227,160,8,.12); color: var(--warn); }
.notice-info { background: rgba(59,110,240,.10); color: var(--primary); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Auth-Seiten (Login/Setup/Update) ---------- */
body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 30px; }
.auth-card.wide { max-width: 640px; }
.auth-logo { font-size: 2.2rem; text-align: center; }
.auth-card h1 { text-align: center; font-size: 1.3rem; margin: 6px 0 18px; }
.auth-foot { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 18px; }

/* ---------- Öffentliches Archiv / Infoseite (ohne Login) ---------- */
body.public { max-width: 920px; margin: 0 auto; padding: 24px; }
.public-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.public-head .brand { padding: 0; }

.hero { text-align: center; padding: 24px 10px 6px; }
.hero h1 { font-size: 1.9rem; margin: 8px 0; }
.hero .lead { font-size: 1.12rem; color: var(--muted); max-width: 660px; margin: 0 auto; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 20px 0; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-weight: 700; margin-bottom: 8px; }
.step h3 { margin: 4px 0 6px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; border-bottom: 1px solid var(--border); }
.faq p { color: var(--muted); padding: 6px 0 4px; }
.levels { list-style: none; padding: 0; margin: 0; }
.levels li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.levels .lvl-ico { display: inline-block; width: 1.6em; }

/* Musterbild (Ausweis-Beispiel mit Finger über einer Stelle) */
figure.muster-fig { margin: 12px 0; }
.muster { max-width: 360px; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); display: block; }
figure.muster-fig figcaption { color: var(--muted); font-size: .82rem; margin-top: 6px; }

/* ---------- Marketing-Landing (volle Bildschirmbreite) ---------- */
body.landing { max-width: none; margin: 0; padding: 0; }
.lp-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 28px; max-width: 1200px; margin: 0 auto; }
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.brand-mark { font-size: 22px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary); color: #fff; }
.lp-nav-actions { display: flex; align-items: center; gap: 8px; }

.lp-hero { background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2) 65%); padding: 70px 24px 78px; text-align: center; border-bottom: 1px solid var(--border); }
.lp-eyebrow { display: inline-block; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 5px 12px; border-radius: 999px; }
.lp-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; margin: 16px auto 12px; max-width: 18ch; }
.lp-hero .lead { font-size: clamp(1.05rem, 2vw, 1.32rem); color: var(--muted); max-width: 720px; margin: 0 auto; }

.lp-section { padding: 60px 24px; }
.lp-section.alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-wrap { max-width: 1120px; margin: 0 auto; }
.lp-wrap.narrow { max-width: 840px; }
.lp-section h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); text-align: center; margin: 0 0 8px; }
.lp-section .sub { text-align: center; color: var(--muted); max-width: 660px; margin: 0 auto 36px; }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(31, 59, 92, .16); }
.lp-section.alt .feature { background: var(--surface-2); }
.feature .fico { font-size: 1.9rem; line-height: 1; }
.step { transition: transform .15s ease; }
.step:hover { transform: translateY(-3px); }
.feature h3 { margin: 12px 0 6px; font-size: 1.1rem; }
.feature p { color: var(--muted); margin: 0; }

.lp-foot { text-align: center; padding: 30px 24px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }
.lp-foot a { color: var(--muted); }

@media (max-width: 820px) {
  .lp-hero { padding: 52px 18px 58px; }
  .lp-section { padding: 44px 18px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  body.app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-sep, .side-ver { display: none; }
  .field-grid { grid-template-columns: 1fr; }
}
