/* driveLN – app.driveln.ch. Farben wie in der App (ui/theme/Theme.kt). */
:root {
  --bg: #0A0F1E; --navy: #16204A; --surface: #131B33; --surface2: #1B2547; --line: #26315a;
  --cyan: #22D3EE; --blue: #3B82F6; --amber: #FFB020; --green: #34D399; --red: #F87171;
  --text: #E8F1FF; --muted: #A9B6D3; --onCyan: #00222A;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body { font-family: var(--font); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, var(--navy) 0, var(--bg) 420px) no-repeat; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- Bedienelemente ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px;
  padding: 11px 20px; font-weight: 800; background: var(--cyan); color: var(--onCyan); text-decoration: none;
  box-shadow: 0 4px 18px color-mix(in srgb, var(--cyan) 25%, transparent); transition: transform .1s, filter .1s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.secondary { background: var(--surface2); color: var(--text); box-shadow: none; }
.btn.danger { background: color-mix(in srgb, var(--red) 22%, var(--surface2)); color: var(--red); box-shadow: none; }
.btn.small { padding: 6px 12px; border-radius: 10px; font-size: 14px; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn.big { padding: 15px 28px; font-size: 18px; border-radius: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 10px 13px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--cyan); flex: none; }
.pw { position: relative; display: block; }
.pw input { padding-right: 44px; }
.pw .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 17px; padding: 6px; opacity: .7; }
.error { color: var(--red); font-weight: 700; font-size: 14px; min-height: 1em; }
.notice { border-radius: 14px; padding: 12px 16px; font-size: 14px; }
.notice.ok { background: color-mix(in srgb, var(--green) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); }
.notice.warn { background: color-mix(in srgb, var(--amber) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); }
.notice.info { background: color-mix(in srgb, var(--cyan) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cyan) 30%, transparent); }
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: color-mix(in srgb, var(--green) 18%, var(--surface)); color: var(--green); }
.tag.warn { background: color-mix(in srgb, var(--amber) 18%, var(--surface)); color: var(--amber); }
.tag.bad { background: color-mix(in srgb, var(--red) 18%, var(--surface)); color: var(--red); }
.tag.cy { background: color-mix(in srgb, var(--cyan) 18%, var(--surface)); color: var(--cyan); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Anmelde-Seiten ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column;
  background: radial-gradient(700px 500px at 20% 10%, #1f2f6b 0, transparent 60%), linear-gradient(160deg, #16204A, #070b17); }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--cyan) 30%, transparent), transparent 70%); }
.auth-logo { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 24px; color: var(--text); text-decoration: none; }
.auth-logo img { width: 46px; height: 46px; border-radius: 12px; }
.auth-pitch { margin: auto 0; max-width: 460px; position: relative; z-index: 1; }
.auth-pitch h2 { font-size: 2.4rem; line-height: 1.1; margin: 0 0 14px; font-weight: 900; letter-spacing: -.5px; }
.auth-pitch h2 em { font-style: normal; color: var(--cyan); }
.auth-pitch p { color: var(--muted); font-size: 1.1rem; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 16px; }
.auth-points li { display: flex; gap: 14px; color: var(--muted); }
.auth-points .ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--cyan) 12%, var(--surface2)); }
.auth-points b { display: block; color: var(--text); }
.auth-foot { color: var(--muted); font-size: 13px; position: relative; z-index: 1; }
.auth-foot a { color: var(--muted); }
.auth-form-side { display: grid; place-items: center; padding: 40px 22px; }
.auth-box { width: 100%; max-width: 410px; display: grid; gap: 16px; }
.auth-box h1 { margin: 0; font-size: 1.9rem; font-weight: 900; }
.auth-box .lead { margin: -8px 0 4px; color: var(--muted); }
.auth-box .alt { text-align: center; color: var(--muted); font-size: 15px; }
.auth-box .forgot { align-self: flex-end; font-size: 13px; font-weight: 600; margin-top: 2px; }
.auth-logo.mobile { display: none; }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo.mobile { display: flex; margin-bottom: 8px; }
}

/* ---------- Kopfleiste ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 19px; color: var(--text); text-decoration: none; }
.topbar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---------- Seitennavigation mit aufklappbaren Blöcken ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; max-width: 1440px; margin: 0 auto; }
.layout .page { width: 100%; margin: 0; align-content: start; }
.sidenav { position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto; padding: 30px 6px 30px 16px; display: flex; flex-direction: column; gap: 14px; }
.navgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px; }
.navgroup > summary { list-style: none; cursor: pointer; font-weight: 900; font-size: 15px; padding: 9px 10px; border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between; user-select: none; }
.navgroup > summary::-webkit-details-marker { display: none; }
.navgroup > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.navgroup:not([open]) > summary::after { transform: rotate(-90deg); }
.navgroup > summary:hover { background: var(--surface2); }
.navgroup a { display: block; padding: 8px 12px 8px 16px; border-radius: 12px; color: var(--muted); font-weight: 700; font-size: 15px; text-decoration: none; }
.navgroup a:hover { background: var(--surface2); color: var(--text); }
.navgroup a.active { background: var(--cyan); color: var(--onCyan); }
.nav-toggle { font-size: 20px; }
.topbar .nav-toggle { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 10px; padding: 12px 14px; }
  .topbar .nav-toggle { display: inline-flex; }
  .topbar .user { display: none; }
  .sidenav { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; z-index: 40; padding: 18px 14px;
    background: var(--bg); border-right: 1px solid var(--line); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease-out, visibility .2s; }
  body.nav-open .sidenav { transform: none; visibility: visible; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(3,6,14,.65); }
}

/* ---------- Inhalt ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 30px 22px 80px; display: grid; gap: 22px; }
.page.wide { max-width: 1300px; }
.page h1 { margin: 6px 0 0; font-size: 2rem; font-weight: 900; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.card > h2 { margin: 0 0 14px; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.card > h2 .ic { font-size: 1.3rem; }
.pane { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); max-width: 820px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 22px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--muted); }
.steps b { color: var(--text); }

/* Download-Kachel */
.dl { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.dl img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 30px color-mix(in srgb, var(--cyan) 22%, transparent); }
.dl .ver { font-size: 1.4rem; font-weight: 900; }
.notes { white-space: pre-line; color: var(--muted); font-size: 14px; margin: 14px 0 0; padding: 12px 16px; background: var(--bg); border-radius: 14px; }

/* Lizenz-Karten */
.lic { border: 1px solid var(--line); background: var(--bg); border-radius: 18px; padding: 16px 18px; display: grid; gap: 10px; }
.lic + .lic { margin-top: 12px; }
.lic .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.25rem; font-weight: 800; letter-spacing: 1.5px; color: var(--cyan); }
.lic .meta { color: var(--muted); font-size: 14px; }

/* Geräte */
#devices { display: grid; gap: 22px; }
.device { display: grid; gap: 14px; }
.device h2 { margin: 0; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.device .notice { margin: 0; }
.device .facts code { white-space: nowrap; }
@media (max-width: 560px) { .device .facts code { font-size: 13px; } }
details > summary { cursor: pointer; }
.device > details > summary, .lic > details > summary { color: var(--muted); font-size: 14px; font-weight: 700; }
.history { display: grid; gap: 6px; margin-top: 10px; }
.history > div { display: flex; gap: 4px 14px; flex-wrap: wrap; }

/* Preise */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan { border: 2px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; background: var(--bg); }
.plan.sel { border-color: var(--cyan); }
.plan b { display: block; }
.plan .p { font-size: 1.4rem; font-weight: 900; margin: 4px 0; }
@media (max-width: 560px) { .plans { grid-template-columns: 1fr; } }

/* Tabellen (Admin) */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); vertical-align: middle; }
.tbl tr:hover td { background: color-mix(in srgb, var(--surface2) 50%, transparent); }
.tbl .acts { white-space: nowrap; text-align: right; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.stat .n { font-size: 2rem; font-weight: 900; }
.stat .l { color: var(--muted); font-size: 14px; }

/* Dialog */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 22px; padding: 24px; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(3,6,14,.75); }
dialog h3 { margin: 0 0 14px; }
dialog form { display: grid; gap: 14px; }

/* Meldungen */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--surface2); border: 1px solid var(--line); padding: 12px 20px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-color: var(--red); color: var(--red); }

/* Hilfe: Fragen/Antworten */
.faq { margin: 0; display: grid; gap: 4px; }
.faq dt { font-weight: 800; margin-top: 10px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 0; color: var(--muted); }
.faq b { color: var(--text); }

/* Lizenz-QR-Code (zum Abfotografieren mit driveLN) */
.lic-body { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lic-body > .grow { flex: 1 1 240px; display: grid; gap: 10px; min-width: 0; }
.lic-qr { background: #fff; border-radius: 12px; padding: 8px; width: 116px; height: 116px; flex: none; }
.lic-qr svg { display: block; width: 100%; height: 100%; }
