/* NordCargo Spedition: Design wie die Website (dunkel, rote Akzente, runde Pill-Buttons). */
:root {
  --bg: #080b12; --bg2: #0d111b; --panel: #111722; --panel2: #151c28;
  --text: #f5f6f8; --muted: #8f98aa; --line: #242d3c;
  --red: #e2534d; --red2: #b92f34; --red-soft: rgba(226, 83, 77, .12);
  --green: #5dc17a; --green-soft: rgba(93, 193, 122, .12);
  --amber: #e6b04b; --amber-soft: rgba(230, 176, 75, .12);
  --radius: 24px; --shadow: 0 30px 80px rgba(0, 0, 0, .36);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.05em; line-height: 1.05; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.04em; }
h3 { font-size: 16px; font-weight: 700; letter-spacing: -.03em; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Anmeldung und Einrichtung */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.gate-brand { padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; background: radial-gradient(90% 80% at 0% 0%, var(--red-soft), transparent 60%), var(--bg2); border-right: 1px solid var(--line); }
.gate-brand h1 { font-size: clamp(34px, 5vw, 60px); max-width: 12ch; }
.gate-brand p { color: var(--muted); max-width: 44ch; }
.gate-form { padding: 56px; display: flex; align-items: center; justify-content: center; }
.gate-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; flex: none; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.gate-brand .brand-logo { width: 64px; height: 64px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font-size: 22px; font-weight: 700; letter-spacing: -.04em; }
.brand small { font-size: 10px; font-weight: 800; letter-spacing: .28em; color: var(--red); margin-top: 3px; }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.in { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; width: 100%; font-size: 15px; }
.in:focus { border-color: #3b4860; }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.seg { display: flex; gap: 6px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 9px 12px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--red); color: #fff; }
.err { color: #f4a8a5; background: var(--red-soft); border: 1px solid rgba(226, 83, 77, .3); border-radius: 14px; padding: 10px 14px; font-size: 13px; }

/* Buttons */
.btn { border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .04); border-radius: 999px; padding: 12px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .2s, border-color .2s, background .2s; }
.btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 12px 36px rgba(226, 83, 77, .22); }
.btn.small { padding: 7px 14px; font-size: 12px; }
.btn.text { border-color: transparent; background: none; color: var(--muted); padding-inline: 10px; }
.btn.text:hover:not(:disabled) { color: var(--red); transform: none; border-color: transparent; }
.btn.warn-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }

/* Rahmen: Kopf, Seitenleiste, Inhalt */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: rgba(8, 11, 18, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-r { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.kassenstand { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.kassenstand span { font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.kassenstand b { font-size: 17px; letter-spacing: -.03em; color: var(--green); font-variant-numeric: tabular-nums; }
.userchip { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.userchip b { font-size: 14px; }
.userchip span { font-size: 11px; color: var(--muted); }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; width: min(1360px, 100%); margin-inline: auto; }
.side { position: sticky; top: 61px; align-self: start; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--muted); border: 1px solid transparent; }
.side a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.side a[aria-current="page"] { color: #fff; background: var(--red-soft); border-color: rgba(226, 83, 77, .35); }
.side a.off { opacity: .5; pointer-events: none; }
.side .soon { font-size: 10px; font-weight: 800; letter-spacing: .08em; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 10px 8px; width: calc(100% - 16px); }
.main { padding: 28px 24px 80px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 62ch; }

/* Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.glow { background: radial-gradient(120% 120% at 100% 0%, var(--red-soft), transparent 55%), var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { background: linear-gradient(145deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile b { font-size: 28px; font-weight: 700; letter-spacing: -.05em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile span { font-size: 12px; color: var(--muted); }
.tile.big b { color: var(--green); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--amber-soft); border: 1px solid rgba(230, 176, 75, .3); border-radius: 18px; padding: 14px 18px; color: #f2d79b; }
.empty { border: 1px dashed var(--line); border-radius: 18px; padding: 28px; color: var(--muted); text-align: center; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 800; letter-spacing: .04em; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); border-color: rgba(226, 83, 77, .32); }
.pill.ok { background: var(--green-soft); color: var(--green); border-color: rgba(93, 193, 122, .32); }
.pill.warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(230, 176, 75, .32); }
.plate { display: inline-flex; align-items: stretch; border: 1.5px solid #101010; border-radius: 5px; background: #fff; color: #101010; font: 600 13px var(--mono); overflow: hidden; vertical-align: middle; }
.plate::before { content: "D"; background: #0b3d91; color: #fff; font-size: 9px; font-weight: 700; padding: 2px 4px; display: flex; align-items: flex-end; }
.plate span { padding: 3px 8px; letter-spacing: .06em; white-space: nowrap; }
.plate.large { font-size: 22px; border-width: 2px; border-radius: 7px; }
.plate.large::before { font-size: 12px; padding: 3px 6px; }
.plate.large span { padding: 4px 12px; }
.meter-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.meter { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.meter.warn i { background: var(--amber); }
.meter.over i { background: var(--red); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.fact > span { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.fact b { font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Telemetrie: Live-Anzeige, Statuskästen, Anleitung */
.live { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); color: var(--muted); text-decoration: none; white-space: nowrap; max-width: 100%; }
.live > span { overflow: hidden; text-overflow: ellipsis; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
a.live:hover { border-color: rgba(255, 255, 255, .3); }
.live.ok { color: var(--green); background: var(--green-soft); border-color: rgba(93, 193, 122, .32); }
.live.ok i { background: var(--green); box-shadow: 0 0 0 4px rgba(93, 193, 122, .18); }
.live.idle { color: var(--text); }
.live.idle i { background: var(--amber); }
.live.red { color: var(--red); background: var(--red-soft); border-color: rgba(226, 83, 77, .32); }
.live.red i { background: var(--red); box-shadow: 0 0 0 4px rgba(226, 83, 77, .18); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.statusbox { border-left: 3px solid var(--line); background: rgba(255, 255, 255, .04); border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.statusbox.ok { border-color: var(--green); background: var(--green-soft); }
.statusbox.warn { border-color: var(--amber); background: var(--amber-soft); }
.statusbox.red { border-color: var(--red); background: var(--red-soft); }
details.guide { display: block; }
details.guide summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide[open] summary { margin-bottom: 12px; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--red-soft); border: 1px solid rgba(226, 83, 77, .35); color: var(--red); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps span { color: var(--muted); font-size: 14px; }
.steps a { color: var(--red); overflow-wrap: anywhere; }
pre.diag { margin: 0; max-height: 50vh; overflow: auto; background: #0a0e16; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }

/* Tabellen */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.pos { color: var(--green); }
.neg { color: #f4a8a5; }
.code { font-family: var(--mono); font-weight: 600; letter-spacing: .06em; font-size: 15px; }
.in.inline { width: 96px; padding: 8px 10px; border-radius: 12px; }
select.in.inline { width: auto; min-width: 190px; }

/* Dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid #34405a; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(3px); }
.dlg-form { display: flex; flex-direction: column; gap: 16px; padding: 26px; }
.dlg-body { display: flex; flex-direction: column; gap: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.sum { background: rgba(255, 255, 255, .04); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.sum div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sum div span:first-child { color: var(--muted); }
.sum .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }
.opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.opt small { display: block; color: var(--muted); font-size: 12px; }
.opt input { accent-color: var(--red); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--panel2); border: 1px solid #34405a; border-radius: 999px; padding: 11px 22px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--red); color: #f4a8a5; }

@media (max-width: 980px) {
  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate-brand { padding: 32px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .gate-form { padding: 32px 24px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; flex-direction: row; overflow-x: auto; padding: 12px 16px 0; gap: 8px; }
  .side a { white-space: nowrap; border-color: var(--line); }
  .side hr { display: none; }
  .main { padding: 20px 16px 80px; }
  .top { padding: 10px 16px; }
}
@media (max-width: 560px) {
  .meter-row { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .userchip { display: none; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Etappe 4: Touren, Cashflow, Rechte, Finanzen */
a.kassenstand { text-decoration: none; color: inherit; }
a.kassenstand:hover b { text-decoration: underline; }
.field.inl { flex-direction: row; align-items: center; gap: 8px; }
.field.inl > span { white-space: nowrap; }
.field.inl .in { width: auto; min-width: 150px; padding: 8px 36px 8px 12px; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.filterbar .seg { flex: none; max-width: 100%; overflow-x: auto; }
.filterbar .seg button { flex: none; white-space: nowrap; padding: 9px 16px; }
.nowrap { white-space: nowrap; }
.card-head .seg { padding: 3px; }
.card-head .seg button { padding: 6px 12px; font-size: 12px; }
.grid2.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.tourkarte .facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cf { display: flex; flex-direction: column; gap: 9px; }
.cf-row { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 112px; gap: 12px; align-items: center; font-size: 14px; }
.cf-row > span:first-child { color: var(--muted); }
.cf-row > span:last-child { text-align: right; white-space: nowrap; }
.cf-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.cf-bar i { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.cf-bar i.plus { background: var(--green); }
.cf-bar i.minus { background: var(--red); }
.cf-row.total { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 700; }
.cf-row.total > span:first-child { color: var(--text); }
.chart { width: 100%; height: auto; display: block; }
.chart-l { stroke: var(--line); stroke-width: 1; }
.chart-t { fill: var(--muted); font-size: 14px; font-family: var(--font); }
.bar-pos { fill: var(--green); }
.bar-neg { fill: var(--red); }
.guv-gruppe { display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.guv-kopf { display: flex; justify-content: space-between; gap: 12px; }
.guv-kopf.total { font-size: 16px; padding-top: 4px; }
.guv-zeile { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding-left: 12px; }
.guv-zeile > span:first-child { color: var(--muted); }
.rg { display: flex; flex-direction: column; font-size: 13px; }
.rg b { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
fieldset.rechtgruppe { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rechtgruppe legend { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--red); padding: 0; margin-bottom: 8px; }
.opt.gesperrt { opacity: .5; cursor: not-allowed; }
dialog { max-height: calc(100vh - 32px); overflow: hidden; }
.dlg-form { max-height: calc(100vh - 34px); }
.dlg-form > h2, .dlg-form > .dlg-actions, .dlg-form > .err { flex: none; }
.dlg-body { overflow-y: auto; min-height: 0; padding-right: 4px; }
dialog.breit { width: min(780px, calc(100vw - 32px)); }
@media (max-width: 560px) {
  .cf-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cf-bar { display: none; }
  .field.inl { flex-direction: column; align-items: stretch; }
  .filterbar { gap: 10px; }
  .filterbar .seg button { padding: 8px 11px; font-size: 12px; }
  .filterbar > .field { flex: 1 1 140px; }
  .tourkarte .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile b { font-size: 21px; }
  .page-head .btn-row, .page-head > .btn { width: 100%; }
}
#mein-tele, #ueb-dienst, #tele-live { display: flex; flex-direction: column; gap: 16px; }
#mein-tele:empty, #ueb-dienst:empty { display: none; }

/* Gekoppelte PCs (Fahrerprogramm) */
.geraete { display: flex; flex-direction: column; }
.geraet { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.geraete > .eyebrow { margin-bottom: 8px; }
.geraet-name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.geraet-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
