/* Formwerk – Website
   Farben und Schrift wie in der App. Nur dunkel, weil Logo und App dunkel sind.
   Radien: Eingaben und Knöpfe 10px, Flächen und Bilder 16px. */

@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  --bg: #0d0e12;
  --bg-2: #111318;
  --panel: #16181e;
  --panel-2: #1b1e25;
  --line: #262a32;
  --line-2: #343a44;
  --text: #f4f1ea;
  --muted: #a8a399;
  --accent: #ff7a1a;
  --accent-hi: #ff8d3a;
  --accent-ink: #1a0d03;
  --accent-soft: rgb(255 122 26 / 0.12);
  --ok: #3ccf8e;
  --err: #ff7b72;
  --r-sm: 10px;
  --r-lg: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1200px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 16px/1.6 "Inter", system-ui, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hi); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.icon { width: 1.15em; height: 1.15em; flex: none; }
.icon.big { width: 44px; height: 44px; color: var(--accent); }
.icon.big.ok { color: var(--ok); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.wrap.narrow { max-width: 880px; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 30; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: 12px; }

/* ---------- Kopfzeile ---------- */
.nav { position: sticky; top: 0; z-index: 20; background: rgb(13 14 18 / 0.82); backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid rgb(38 42 50 / 0.7); }
.nav-in { max-width: var(--wrap); margin: 0 auto; height: 68px; padding: 0 32px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 19px; letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }
.brand b { color: var(--accent); font-weight: 600; }
.nav-links { display: flex; gap: 28px; }
.nav-links a, .link { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; transition: color 0.2s; }
.nav-links a:hover, .link:hover { color: var(--text); }
.nav-cta { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.nav-email { color: var(--muted); font-size: 14px; }
.back { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  font: 600 15px/1 "Inter", system-ui, sans-serif; letter-spacing: -0.005em;
  height: 46px; padding: 0 20px; border-radius: var(--r-sm); cursor: pointer; text-decoration: none;
  border: 1px solid transparent; transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); color: var(--accent-ink); }
.btn.primary .icon { transition: transform 0.25s var(--ease); }
.btn.primary:hover .icon { transform: translateX(3px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { border-color: #4a505b; background: var(--panel); color: var(--text); }
.btn.danger { background: transparent; color: var(--err); border-color: rgb(255 123 114 / 0.45); }
.btn.danger:hover { background: rgb(255 123 114 / 0.1); border-color: var(--err); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Startseite: Hero ---------- */
.hero {
  /* Text bündig mit dem Seitenraster, Bild läuft bis an den rechten Rand */
  padding: 88px 0 96px max(32px, calc((100vw - var(--wrap)) / 2 + 32px));
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center;
  overflow: hidden;
}
.hero-copy { max-width: 520px; width: 100%; }
.hero h1 { font-size: clamp(2.6rem, 4.6vw, 4.1rem); letter-spacing: -0.04em; line-height: 1.02; }
.lead { margin-top: 22px; color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 46ch; }
.hero .actions { margin-top: 36px; }
.hero-shot {
  margin: 0; border-radius: var(--r-lg) 0 0 var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); border-right: 0;
  box-shadow: 0 40px 120px -20px rgb(0 0 0 / 0.7), 0 0 0 1px rgb(255 122 26 / 0.04);
}
.hero-shot img { width: 100%; }

/* ---------- Vorlagen ---------- */
.templates { padding: 96px 0; border-top: 1px solid var(--line); background: var(--bg-2); }
.templates h2, .flow h2 { font-size: clamp(1.9rem, 3vw, 2.6rem); letter-spacing: -0.03em; max-width: 18ch; }
.bento { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 420px; border-radius: var(--r-lg); overflow: hidden; background: #15171c; border: 1px solid var(--line);
}
.tile.wide { grid-column: span 2; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; transition: transform 0.9s var(--ease); }
.tile:hover img { transform: scale(1.035); }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgb(13 14 18 / 0.85) 74%, rgb(13 14 18 / 0.96) 100%); pointer-events: none; }
.tile-text { position: relative; z-index: 1; padding: 28px; max-width: 460px; }
.tile h3 { font-size: 22px; }
.tile p { margin-top: 6px; color: var(--muted); font-size: 15px; line-height: 1.55; }

/* ---------- Ablauf ---------- */
.flow { padding: 112px 0; }
.flow-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.flow h2 { position: sticky; top: 120px; }
.flow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 44px; }
.flow-list li { display: grid; grid-template-columns: 52px 1fr; gap: 20px; align-items: start; }
.flow-list .icon { width: 52px; height: 52px; padding: 13px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }
.flow-list h3 { font-size: 21px; margin-top: 2px; }
.flow-list p { margin-top: 8px; color: var(--muted); max-width: 52ch; }

/* ---------- Download ---------- */
.download { padding: 0 0 112px; }
.download-in {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start;
  padding: 48px 56px; border-radius: var(--r-lg); border: 1px solid rgb(255 122 26 / 0.22);
  background: radial-gradient(120% 160% at 0% 0%, rgb(255 122 26 / 0.14), transparent 55%), var(--panel);
}
.download h2 { font-size: clamp(1.8rem, 2.8vw, 2.4rem); letter-spacing: -0.03em; }
.dl-meta { margin-top: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-req { margin-top: 4px; color: var(--muted); font-size: 14px; }
.dl-main .btn { margin-top: 26px; }
.btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.dl-hint { display: flex; gap: 10px; margin-top: 26px; font-size: 13.5px; color: var(--muted); max-width: 52ch; }
.dl-hint .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--ok); }
.dl-notes h3 { font-size: 15px; color: var(--muted); font-weight: 600; }
.dl-notes ul { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.dl-notes li { position: relative; padding-left: 22px; line-height: 1.55; }
.dl-notes li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }

/* ---------- Konto ---------- */
.sync { padding: 0 0 112px; }
.sync-in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; align-items: center; }
.sync-shot { margin: 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 90px -20px rgb(0 0 0 / 0.65); }
.sync-shot img { width: 100%; }
.sync h2 { font-size: clamp(1.8rem, 2.8vw, 2.4rem); letter-spacing: -0.03em; }
.sync p { margin-top: 14px; color: var(--muted); max-width: 46ch; }
.sync .btn { margin-top: 28px; }

/* ---------- Fußzeile ---------- */
.foot { border-top: 1px solid var(--line); background: var(--bg-2); }
.foot-in { max-width: var(--wrap); margin: 0 auto; padding: 40px 32px; display: grid; grid-template-columns: 1fr auto; gap: 20px 40px; align-items: start; }
.foot-brand p { margin-top: 10px; color: var(--muted); font-size: 14px; }
.foot-links { display: flex; gap: 24px; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.foot-links a:hover { color: var(--text); }
.foot-copy { grid-column: 1 / -1; color: #8a857c; font-size: 13px; }

/* ---------- Anmelde-Seiten ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100dvh - 69px); }
.auth-form { width: 100%; max-width: 440px; justify-self: center; align-self: center; padding: 56px 32px; }
.auth-form h1 { font-size: clamp(1.9rem, 3vw, 2.4rem); letter-spacing: -0.03em; }
.sub { margin-top: 10px; color: var(--muted); font-size: 15px; }
.auth-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 40px; font-size: 12.5px; }
.auth-legal a { color: var(--muted); }
.auth-legal a:hover { color: var(--text); }
.auth-art { margin: 0; position: relative; overflow: hidden; border-left: 1px solid var(--line); background: #15171c; }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(13 14 18 / 0.5), transparent 30%); }
.state .btn { margin-top: 28px; }
.state .icon.big { margin-bottom: 20px; }
.done { margin-top: 8px; }
.done .icon.big { margin-bottom: 18px; }
.done h2 { font-size: 26px; }
.done p { margin-top: 12px; color: var(--muted); }
.done strong { color: var(--text); font-weight: 600; }
.hint { font-size: 14px; }
.foot-note { margin-top: 28px; }
.spinner { display: block; width: 28px; height: 28px; margin-bottom: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 18px; margin-top: 32px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; }
.input { position: relative; }
.input input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm);
  font: 400 15px "Inter", system-ui, sans-serif; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-2); transition: border-color 0.2s, box-shadow 0.2s;
}
.has-toggle input { padding-right: 48px; }
.input input:hover { border-color: #4a505b; }
.input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(255 122 26 / 0.22); }
.input input[aria-invalid="true"] { border-color: var(--err); }
.input .pw-toggle {
  position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer;
}
.input .pw-toggle:hover { color: var(--text); background: var(--panel-2); }
.input .pw-toggle .off, .input .pw-toggle[aria-pressed="true"] .icon:not(.off) { display: none; }
.input .pw-toggle[aria-pressed="true"] .off { display: block; }
.help { color: var(--muted); font-size: 13px; }
.help.err { color: var(--err); }
.aside { text-align: right; font-size: 14px; margin-top: -6px; }
.status { min-height: 1.4em; font-size: 14px; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.row .status { min-height: 0; }

/* ---------- Konto ---------- */
.account { padding: 64px 0 96px; }
.acc-head h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); letter-spacing: -0.03em; }
.acc-block { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--line); }
.acc-block:first-of-type { border-top: 0; padding-top: 0; }
.acc-block h2 { font-size: 20px; }
.acc-block.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; }
.acc-block.split .form { margin-top: 0; }
.acc-block.danger h2 { color: var(--err); }
.projects { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; }
.projects li {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 16px;
  padding: 12px 12px 12px 14px; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.2s;
}
.projects li:hover { border-color: var(--line-2); }
.projects .p-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.projects .p-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects .p-meta { color: var(--muted); font-size: 13px; }
.projects li.skeleton { height: 66px; background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.projects li.empty { display: block; padding: 36px 24px; text-align: center; background: transparent; border-style: dashed; }
.projects li.empty .icon { width: 32px; height: 32px; color: var(--muted); margin: 0 auto 12px; }
.projects li.empty p { color: var(--muted); max-width: 42ch; margin: 0 auto; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.icon-btn:hover { background: var(--panel-2); border-color: #4a505b; }
.devices { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.devices li { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.devices .d-icon { grid-row: span 2; display: grid; color: var(--muted); }
.devices .icon { color: var(--muted); width: 22px; height: 22px; }
.devices .d-meta { color: var(--muted); font-size: 13px; grid-column: 2; }
.devices .d-out { grid-row: 1 / span 2; grid-column: 3; }
.tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }

/* ---------- Einfache Seiten (404, Rechtliches) ---------- */
.plain { padding: 96px 0 112px; }
.plain h1 { font-size: clamp(2.2rem, 4vw, 3rem); letter-spacing: -0.035em; }
.plain .actions { margin-top: 32px; }
.prose h2 { font-size: 20px; margin-top: 40px; }
.prose p { margin-top: 12px; color: #cfcac1; max-width: 68ch; }
.prose ul { margin: 12px 0 0; padding-left: 20px; color: #cfcac1; max-width: 68ch; display: grid; gap: 6px; }
.prose a { color: var(--accent-hi); }
.legal-hint { font-size: 12.5px; line-height: 1.5; }
.legal-hint a { color: var(--accent-hi); }
.notice { margin-top: 24px !important; padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid rgb(255 122 26 / 0.4); background: var(--accent-soft); color: var(--text) !important; }

/* ---------- Bewegung ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise 0.9s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.08s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.16s; }
  .hero-shot { animation: slide 1.1s var(--ease) 0.12s both; }
  .js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
  .auth-form > *, .acc-head { animation: rise 0.7s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes slide { from { opacity: 0; transform: translateX(48px); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner, .projects li.skeleton { animation-duration: 3s; }
  .tile img, .btn { transition: none; }
}

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1023px) {
  .hero { grid-template-columns: 1fr; padding: 64px 0 72px; gap: 48px; }
  .hero-copy { justify-self: start; padding: 0 32px; max-width: 640px; }
  .hero-shot { margin-left: 32px; }
  .flow-in { grid-template-columns: 1fr; gap: 40px; }
  .flow h2 { position: static; }
  .download-in, .sync-in { grid-template-columns: 1fr; gap: 36px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 767px) {
  .wrap, .nav-in, .foot-in { padding-left: 16px; padding-right: 16px; }
  .nav-in { gap: 16px; height: 60px; }
  .nav-links { display: none; }
  .nav-cta { gap: 14px; }
  .nav-email { display: none; }
  .hero { padding-top: 48px; }
  .hero-copy { padding: 0 16px; }
  .hero-shot { margin-left: 16px; }
  .hero h1 { font-size: 2.4rem; }
  .lead { font-size: 17px; }
  .templates, .flow { padding: 72px 0; }
  .bento { grid-template-columns: 1fr; }
  .tile.wide { grid-column: auto; }
  /* Bild oben, Text darunter, nichts überdeckt das Modell */
  .tile { min-height: 0; }
  .tile img { position: static; aspect-ratio: 4 / 3; height: auto; }
  .tile::after { display: none; }
  .tile-text { padding: 20px 20px 24px; border-top: 1px solid var(--line); }
  .sync, .download { padding-bottom: 72px; }
  .download-in { padding: 32px 24px; }
  .foot-in { grid-template-columns: 1fr; }
  .auth { min-height: calc(100dvh - 61px); }
  .auth-form { padding: 40px 16px; }
  .account { padding-top: 40px; }
  .acc-block.split { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 380px) { .nav-cta .link { display: none; } }

/* ---------- Hinweis-Banner (aus der Verwaltung) ---------- */
.notice-bar { padding: 10px 16px; text-align: center; font-size: 14px; font-weight: 500; color: var(--accent-ink); background: var(--accent); }

/* ---------- Verwaltung ---------- */
.nav-tag { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); }
body[data-page="admin"] main { display: flex; flex-direction: column; }
.gate { flex: 1; display: grid; place-items: center; padding: 56px 16px; }
.gate-box { width: 100%; max-width: 420px; }
.gate-box.wide { max-width: 560px; }
.gate-box h1 { font-size: clamp(1.8rem, 3vw, 2.3rem); letter-spacing: -0.03em; }
.gate-box .icon.big { margin-bottom: 18px; }
.gate-box > .btn, .gate-box .actions { margin-top: 26px; }
.setup-steps { margin: 28px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 22px; }
.setup-steps li { counter-increment: s; display: grid; gap: 8px; padding-left: 40px; position: relative; color: var(--muted); font-size: 14px; }
.setup-steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--accent); background: var(--accent-soft); }
.setup-steps b { color: var(--text); font-size: 15px; }
.qr { margin: 6px 0; width: 200px; padding: 10px; background: #fff; border-radius: var(--r-sm); }
.qr img { width: 100%; height: auto; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; padding: 2px 6px; border-radius: 6px; background: var(--panel-2); color: var(--text); word-break: break-all; }
.inline-code { grid-template-columns: 1fr auto; margin-top: 6px; }
.inline-code input {
  height: 46px; padding: 0 14px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line-2); color: var(--text);
  font: 600 20px/1 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: 0.2em;
}
.inline-code input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(255 122 26 / 0.22); }
.codes { margin: 24px 0 0; padding: 18px; list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--line); }
.codes li { font: 600 16px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: 0.06em; }

.panel { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1320px; width: 100%; margin: 0 auto; }
.tabs { display: grid; align-content: start; gap: 2px; padding: 28px 16px; border-right: 1px solid var(--line); position: sticky; top: 69px; height: calc(100dvh - 69px); }
.tabs button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: 500 14px "Inter", system-ui, sans-serif; cursor: pointer; text-align: left; transition: background-color 0.15s, color 0.15s; }
.tabs button:hover { background: var(--panel); color: var(--text); }
.tabs button.on { background: var(--accent-soft); color: var(--text); }
.tabs button.on .icon { color: var(--accent); }
.tab { padding: 32px 40px 64px; min-width: 0; }
.tab h1 { font-size: 26px; letter-spacing: -0.02em; }
.tab > .sub { max-width: 70ch; }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card { border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); padding: 20px 22px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.kpis { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi b { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.ov-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.chart-card { grid-column: 1 / -1; }
.chart { margin-top: 18px; }
.chart svg { width: 100%; height: auto; max-height: 240px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { fill: var(--accent-hi); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: "Inter", system-ui, sans-serif; }
.bars { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13.5px; }
.bars li b { font-variant-numeric: tabular-nums; }
.bars li i { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--accent); min-width: 4px; }
.bars li.empty, .log li.empty, td.empty, .devices li.empty { color: var(--muted); display: block; }
.facts { margin: 14px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.toolbar { margin: 20px 0 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar select, .search input, .set input {
  height: 40px; padding: 0 12px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font: 14px "Inter", system-ui, sans-serif;
}
.toolbar select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 18px, calc(100% - 14px) 18px; background-size: 5px 5px; background-repeat: no-repeat;
}
.toolbar select:hover { border-color: var(--muted); }
.toolbar option { background: var(--panel-2); color: var(--text); }
.toolbar select:focus, .search input:focus, .set input:focus { outline: none; border-color: var(--accent); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search .icon { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search input { width: 100%; padding-left: 38px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr[tabindex] { cursor: pointer; transition: background-color 0.15s; }
.tbl tbody tr[tabindex]:hover, .tbl tbody tr[tabindex]:focus-visible { background: var(--panel); outline: none; }
.tbl td b { font-weight: 500; }
.tbl td small { display: block; color: var(--muted); font-size: 12.5px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .acts { text-align: right; white-space: nowrap; }
.tbl .acts > * + * { margin-left: 6px; }
.tbl .notes { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.tbl .notes summary { cursor: pointer; }
.tbl .notes ul { margin: 6px 0 0; padding-left: 18px; }
.badge { display: inline-block; margin: 0 6px 4px 0; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.ok { color: var(--ok); background: rgb(60 207 142 / 0.12); }
.badge.warn { color: #f5b14c; background: rgb(245 177 76 / 0.12); }
.badge.err { color: var(--err); background: rgb(255 123 114 / 0.12); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }
.tbl td b + .badge { margin-left: 8px; }

.set-list { margin-top: 24px; display: grid; gap: 12px; max-width: 860px; }
.set { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: center; }
.set form { grid-column: 1 / -1; gap: 10px; margin: 0; }
.set .row .status { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 42px; height: 24px; border-radius: 12px; background: var(--line-2); position: relative; transition: background-color 0.2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.log { list-style: none; margin: 20px 0 0; padding: 0; max-width: 900px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.log li { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13.5px; }
.log li:first-child { border-top: 0; }
.log time, .log .who { color: var(--muted); font-size: 12.5px; }
.log b { font-weight: 500; }
.log span { margin-left: 8px; color: var(--muted); }
.log div small { display: block; color: var(--muted); }

dialog.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(520px, 100vw); padding: 24px 28px 32px; border: 0; border-left: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); overflow-y: auto;
}
dialog.drawer.small { margin: auto; height: auto; width: min(420px, 92vw); border: 1px solid var(--line-2); border-radius: var(--r-lg); }
dialog.drawer.small p { margin-top: 10px; color: var(--muted); font-size: 14px; }
dialog.drawer.small .actions { justify-content: flex-end; margin-top: 22px; }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.drawer-head h2 { font-size: 18px; word-break: break-all; }
.drawer h3 { margin-top: 26px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.drawer .devices { margin-top: 10px; }
.drawer .devices li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer .devices li div { display: grid; }
.drawer .devices small { color: var(--muted); font-size: 12.5px; }
.ud-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
#ud-status { margin-top: 12px; }
.drawer details.danger { margin-top: 26px; }
.drawer details.danger form { margin-top: 12px; gap: 10px; }
.drawer details.danger input { height: 40px; padding: 0 12px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font: 14px "Inter", system-ui, sans-serif; }
@media (prefers-reduced-motion: no-preference) { dialog.drawer:not(.small)[open] { animation: drawer-in 0.3s var(--ease); } }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }

@media (max-width: 900px) {
  .panel { grid-template-columns: 1fr; }
  .tabs { position: static; height: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .tabs button { flex: none; }
  .tab { padding: 24px 16px 48px; }
  .ov-grid { grid-template-columns: 1fr; }
  .set { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr; gap: 4px; }
  .codes { grid-template-columns: 1fr; }
}
