/* SHS Notdienst – one stylesheet, light and dark. */
@font-face { font-family: Inter; src: url(/fonts/inter.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --line: #e3e7ef;
  --text: #121826;
  --muted: #5d6779;
  --faint: #8b94a6;
  --brand: #d92d20;
  --brand-2: #b42318;
  --brand-soft: #fdecea;
  --ok: #079455;
  --ok-soft: #e3f8ee;
  --warn: #b54708;
  --warn-soft: #fef4e6;
  --info: #1d5bd8;
  --info-soft: #e8f0fe;
  --side: #0f1729;
  --side-2: #19233a;
  --side-text: #c9d2e3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --panel: #121a2c; --panel-2: #172036; --line: #243049; --text: #e8edf7; --muted: #9aa6bd; --faint: #6f7b93;
    --brand: #f04438; --brand-2: #f97066; --brand-soft: #3a1717; --ok: #32d583; --ok-soft: #0f2e22; --warn: #fdb022; --warn-soft: #33260f;
    --info: #6aa1ff; --info-soft: #14254a; --side: #080d19; --side-2: #121a2c; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --panel: #121a2c; --panel-2: #172036; --line: #243049; --text: #e8edf7; --muted: #9aa6bd; --faint: #6f7b93;
  --brand: #f04438; --brand-2: #f97066; --brand-soft: #3a1717; --ok: #32d583; --ok-soft: #0f2e22; --warn: #fdb022; --warn-soft: #33260f;
  --info: #6aa1ff; --info-soft: #14254a; --side: #080d19; --side-2: #121a2c; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* icons */
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 30px; height: 30px; }

/* shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.brand span { font-size: 12px; color: #8d99b3; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .sep { margin: 14px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #66728c; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-top: 1px solid #1f2a42; }
.side-foot .me { display: flex; align-items: center; gap: 10px; color: #fff; }
.side-foot .me small { display: block; color: #8d99b3; }
.side-foot .row { display: flex; gap: 6px; }
.side-foot button { background: var(--side-2); color: var(--side-text); border: 0; }
.side-foot button:hover { color: #fff; }
.main { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.main > * + * { margin-top: 18px; }
.main > .page-head + * { margin-top: 0; }
.main > .alert { margin-bottom: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .title { display: flex; align-items: center; gap: 12px; }
.page-head .title .badge-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.tabbar { display: none; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .i { color: var(--brand); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 18px; }

/* hero */
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #b42318, #e0402f 55%, #f0643a); color: #fff; border: 0; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero .label { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.hero .who { display: flex; align-items: center; gap: 18px; margin: 14px 0 10px; }
.hero .who .avatar { width: 64px; height: 64px; font-size: 24px; border: 3px solid rgba(255,255,255,.5); }
.hero .name { font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.hero .num { font-size: 18px; opacity: .92; font-variant-numeric: tabular-nums; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; opacity: .9; position: relative; z-index: 1; }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero .actions { margin-top: 16px; display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero .btn { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.hero .btn:hover { background: rgba(255,255,255,.26); }
.hero .btn.solid { background: #fff; color: var(--brand-2); border-color: #fff; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.6); } 70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }

/* stat tiles */
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: 13px; }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-bad { background: var(--brand-soft); color: var(--brand); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill .i { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* avatars */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; background: #64748b; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* buttons + forms */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-weight: 550; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
.btn.primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--brand-2); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover, button.ghost:hover { background: var(--panel-2); }
.btn.danger, button.danger { color: var(--brand); }
.btn.sm, button.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon, button.icon { padding: 7px; }
.btn.block { width: 100%; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand); }
input[type="color"] { padding: 2px; height: 40px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--text); font-size: 14.5px; cursor: pointer; }
.input-ico { position: relative; }
.input-ico .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-ico input { padding-left: 36px; }

/* alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.alert .i { margin-top: 1px; }
.alert.error { background: var(--brand-soft); color: var(--brand); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* tables + lists */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--faint); font-size: 12.5px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--faint); display: block; margin: 0 auto 10px; }

/* person picker (switch page) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); cursor: pointer; text-align: left; justify-content: flex-start; white-space: normal; }
.person:hover { border-color: var(--faint); background: var(--panel); }
.person.current { border-color: var(--brand); background: var(--brand-soft); }
.person .n { font-weight: 650; }
.person .num { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.person .tag { margin-left: auto; color: var(--brand); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head .month { font-size: 18px; font-weight: 700; min-width: 170px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal .dow { background: var(--panel-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 8px; text-align: center; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: var(--panel-2); }
.cal .day.other { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.cal .day.other .d { color: var(--faint); }
.cal .day.today .d { background: var(--brand); color: #fff; }
.cal .day.weekend { background: color-mix(in srgb, var(--panel-2) 40%, transparent); }
.cal .d { font-size: 12.5px; font-weight: 650; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal .gap { font-size: 11px; color: var(--warn); display: flex; align-items: center; gap: 3px; }
.chip { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 6px; border-radius: 6px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; justify-content: flex-start; font-weight: 600; }
.chip:hover { filter: brightness(1.08); }
.chip .t { opacity: .85; font-weight: 500; }
.chip.now { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; }

/* bar chart */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 120px; margin-top: 6px; }
.bars .b { background: color-mix(in srgb, var(--brand) 75%, transparent); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.bars .b.today { background: var(--brand); }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); background: var(--text); color: var(--panel); font-size: 12px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.bar-labels { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; font-size: 11px; color: var(--faint); text-align: center; margin-top: 4px; }

/* dialog */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(540px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10, 15, 30, .55); backdrop-filter: blur(2px); }
dialog .dlg-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { flex: 1; display: flex; align-items: center; gap: 9px; }
dialog .dlg-head h2 .i { color: var(--brand); }
dialog .dlg-body { padding: 20px; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
dialog .dlg-foot .left { margin-right: auto; }

/* toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--panel); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: slide .2s ease-out; max-width: 420px; }
.toast.error { background: var(--brand); color: #fff; }
.toast.ok .i { color: var(--ok); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--info) 18%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 32px; }
.auth-card .logo { width: 56px; height: 56px; display: block; margin-bottom: 18px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12.5px; margin: 18px 0; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-btn { padding: 12px; font-size: 15px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.secret { display: flex; gap: 8px; align-items: center; background: var(--panel-2); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }
.secret code { flex: 1; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 13px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: 14px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel); }
.seg button.on { background: var(--brand); color: #fff; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px 96px; }
  .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 20; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 6px; border-radius: 8px; flex: 1; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a:hover { text-decoration: none; }
  .cal .day { min-height: 74px; padding: 3px; }
  .chip .t, .chip .nm { display: none; }
  .chip { justify-content: center; padding: 3px; min-height: 8px; }
  .hero .name { font-size: 22px; }
  h1 { font-size: 20px; }
}

/* OAuth consent page */
.consent-card { max-width: 480px; }
.consent-card p { margin: 0 0 14px; }
.consent-check { margin: 4px 0 16px; align-items: flex-start; }
.consent-check input { margin-top: 4px; flex: none; }
.consent-actions { display: flex; gap: 10px; margin-top: 18px; }
.consent-actions .btn { flex: 1; }
