/* =====================================================================
   Zustellung – Oberfläche
   Ein einziges Stylesheet, keine externen Abhängigkeiten.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Farben & Grundwerte
   --------------------------------------------------------------------- */
:root {
    --bg:            #f6f7f9;
    --bg-elev:       #ffffff;
    --bg-sunken:     #eef0f4;
    --bg-hover:      #e9ecf2;
    --surface-line:  #dfe3ea;

    --text:          #111827;
    --text-muted:    #5b6472;
    --text-faint:    #8b93a1;

    --accent:        #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft:   #dbe6fe;
    --accent-text:   #ffffff;

    --ok:            #15803d;
    --ok-soft:       #dcfce7;
    --warn:          #b45309;
    --warn-soft:     #fef3c7;
    --danger:        #b91c1c;
    --danger-soft:   #fee2e2;
    --info:          #0369a1;
    --info-soft:     #e0f2fe;

    --radius-sm: 8px;
    --radius:    14px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
    --shadow:    0 4px 6px -1px rgba(15,23,42,.07), 0 2px 4px -2px rgba(15,23,42,.05);
    --shadow-lg: 0 20px 25px -5px rgba(15,23,42,.10), 0 8px 10px -6px rgba(15,23,42,.06);

    --sidebar-w: 260px;
    --header-h:  62px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="dark"] {
    --bg:            #0b1120;
    --bg-elev:       #131c2e;
    --bg-sunken:     #0f1725;
    --bg-hover:      #1c2740;
    --surface-line:  #24304a;

    --text:          #e7ecf4;
    --text-muted:    #98a3b8;
    --text-faint:    #6b7689;

    --accent:        #4f8bff;
    --accent-strong: #6d9fff;
    --accent-soft:   #1b2f55;
    --accent-text:   #061024;

    --ok:            #4ade80;
    --ok-soft:       #10301d;
    --warn:          #fbbf24;
    --warn-soft:     #3a2a08;
    --danger:        #f87171;
    --danger-soft:   #3a1414;
    --info:          #38bdf8;
    --info-soft:     #0b2a3d;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow:    0 4px 10px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 40px rgba(0,0,0,.55);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        --bg:            #0b1120;
        --bg-elev:       #131c2e;
        --bg-sunken:     #0f1725;
        --bg-hover:      #1c2740;
        --surface-line:  #24304a;
        --text:          #e7ecf4;
        --text-muted:    #98a3b8;
        --text-faint:    #6b7689;
        --accent:        #4f8bff;
        --accent-strong: #6d9fff;
        --accent-soft:   #1b2f55;
        --accent-text:   #061024;
        --ok:            #4ade80;
        --ok-soft:       #10301d;
        --warn:          #fbbf24;
        --warn-soft:     #3a2a08;
        --danger:        #f87171;
        --danger-soft:   #3a1414;
        --info:          #38bdf8;
        --info-soft:     #0b2a3d;
    }
}

/* ---------------------------------------------------------------------
   Zurücksetzen
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------------
   Grundgerüst
   --------------------------------------------------------------------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    background: var(--bg-elev);
    border-right: 1px solid var(--surface-line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--surface-line);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.02em;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    flex: 0 0 auto;
}
.brand-sub { font-size: .72rem; font-weight: 500; color: var(--text-faint); display: block; letter-spacing: 0; }

.nav { padding: .8rem .7rem; flex: 1; }
.nav-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-faint); font-weight: 700;
    padding: .9rem .6rem .35rem;
}
.nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .65rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
html[data-theme="dark"] .nav a.is-active { color: var(--accent-strong); }
.nav a .badge { margin-left: auto; }

.sidebar-foot {
    padding: .8rem;
    border-top: 1px solid var(--surface-line);
    display: flex; align-items: center; gap: .6rem;
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-strong);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem;
    flex: 0 0 auto;
}

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

.topbar {
    height: var(--header-h);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.4rem;
    border-bottom: 1px solid var(--surface-line);
    background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 40;
}
.topbar h1 { margin: 0; font-size: 1.08rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.content { padding: 1.4rem; flex: 1; max-width: 1500px; width: 100%; }

.menu-toggle { display: none; }

/* ---------------------------------------------------------------------
   Mobil
   --------------------------------------------------------------------- */
@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0;
        width: min(84vw, var(--sidebar-w));
        z-index: 100;
        transform: translateX(-102%);
        transition: transform .22s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-flex; }
    .content { padding: 1rem; padding-bottom: 5rem; }
    .scrim {
        position: fixed; inset: 0; background: rgba(2,6,23,.55);
        z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
    }
    .scrim.open { opacity: 1; pointer-events: auto; }
}

/* ---------------------------------------------------------------------
   Karten & Flächen
   --------------------------------------------------------------------- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex; align-items: center; gap: .8rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--surface-line);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: .7rem; }
.card-foot {
    padding: .85rem 1.15rem;
    border-top: 1px solid var(--surface-line);
    background: var(--bg-sunken);
    border-radius: 0 0 var(--radius) var(--radius);
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stack   { display: flex; flex-direction: column; gap: 1rem; }
.row     { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row-end { margin-left: auto; }
.mt      { margin-top: 1rem; }
.mb      { margin-bottom: 1rem; }
.muted   { color: var(--text-muted); }
.faint   { color: var(--text-faint); }
.small   { font-size: .84rem; }
.tiny    { font-size: .76rem; }
.mono    { font-family: var(--mono); font-size: .86em; }
.right   { text-align: right; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden  { display: none !important; }

/* ---------------------------------------------------------------------
   Kennzahlen
   --------------------------------------------------------------------- */
.stat {
    background: var(--bg-elev);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-label {
    font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-faint); font-weight: 700;
}
.stat-value { font-size: 1.95rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: .25rem; }
.stat-hint  { font-size: .8rem; color: var(--text-muted); }
.stat.accent .stat-value { color: var(--accent); }
.stat.ok     .stat-value { color: var(--ok); }
.stat.warn   .stat-value { color: var(--warn); }

/* ---------------------------------------------------------------------
   Kacheln (Schnellzugriff)
   --------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.tile {
    display: flex; flex-direction: column; gap: .55rem;
    padding: 1.05rem;
    background: var(--bg-elev);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
}
.tile:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--surface-line));
}
.tile .ico { color: var(--accent); }
.tile small { font-weight: 500; color: var(--text-muted); font-size: .8rem; }
.tile.primary {
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-color: transparent; color: #fff;
}
.tile.primary .ico, .tile.primary small { color: rgba(255,255,255,.9); }

/* ---------------------------------------------------------------------
   Bezirkskarten
   --------------------------------------------------------------------- */
.district-card {
    display: block; padding: 1.05rem 1.15rem;
    background: var(--bg-elev);
    border: 1px solid var(--surface-line);
    border-left: 4px solid var(--dc, var(--accent));
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.district-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.district-card .dc-name { font-weight: 650; font-size: 1.05rem; }
.district-card .dc-count { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; }

/* ---------------------------------------------------------------------
   Schaltflächen
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem .95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--surface-line);
    background: var(--bg-elev);
    color: var(--text);
    font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ok      { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn    { background: var(--warn); border-color: var(--warn); color: #241a02; }
.btn-ghost   { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm      { padding: .34rem .6rem; font-size: .82rem; }
.btn-lg      { padding: .85rem 1.4rem; font-size: 1rem; }
.btn-block   { width: 100%; }
.btn-icon    { padding: .45rem; }

/* ---------------------------------------------------------------------
   Marken / Abzeichen
   --------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .16rem .5rem;
    border-radius: 999px;
    font-size: .74rem; font-weight: 700;
    background: var(--bg-sunken); color: var(--text-muted);
    border: 1px solid var(--surface-line);
    white-space: nowrap;
}
.badge-ok     { background: var(--ok-soft);     color: var(--ok);     border-color: transparent; }
.badge-warn   { background: var(--warn-soft);   color: var(--warn);   border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info   { background: var(--info-soft);   color: var(--info);   border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

.chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .55rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600;
    border: 1px solid var(--surface-line);
    background: var(--bg-sunken);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.day-pills { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.day-pill {
    width: 25px; height: 22px;
    display: grid; place-items: center;
    border-radius: 6px;
    font-size: .68rem; font-weight: 700;
    background: var(--bg-sunken); color: var(--text-faint);
    border: 1px solid var(--surface-line);
}
.day-pill.on { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

/* ---------------------------------------------------------------------
   Tabellen
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th {
    text-align: left; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-faint); font-weight: 700;
    padding: .6rem .75rem; border-bottom: 1px solid var(--surface-line);
    background: var(--bg-sunken); position: sticky; top: 0; z-index: 2;
    white-space: nowrap;
}
table.tbl td { padding: .6rem .75rem; border-bottom: 1px solid var(--surface-line); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--bg-hover); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.shrink { width: 1%; white-space: nowrap; }

/* ---------------------------------------------------------------------
   Formulare
   --------------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.field > label, .label {
    display: block; font-size: .82rem; font-weight: 650;
    color: var(--text-muted); margin-bottom: .35rem;
}
.hint { font-size: .78rem; color: var(--text-faint); margin-top: .3rem; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="date"], input[type="file"], select, textarea {
    width: 100%;
    padding: .58rem .7rem;
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit; font-size: .92rem;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--bg-sunken); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[type="color"] { padding: .2rem; height: 40px; cursor: pointer; }
textarea { resize: vertical; min-height: 90px; font-family: inherit; }
select { cursor: pointer; }

.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .9rem; }
.check input { width: auto; margin: 0; accent-color: var(--accent); width: 17px; height: 17px; }

.field-row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field-row.narrow { grid-template-columns: 2fr 1fr; }

fieldset { border: 1px solid var(--surface-line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 650; font-size: .9rem; padding: 0 .4rem; color: var(--text-muted); }

/* Tagesauswahl */
.daypick { display: flex; gap: .35rem; flex-wrap: wrap; }
.daypick input { position: absolute; opacity: 0; pointer-events: none; }
.daypick label {
    padding: .38rem .6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--surface-line); background: var(--bg);
    cursor: pointer; font-size: .84rem; font-weight: 650;
    user-select: none; transition: all .15s var(--ease); min-width: 44px; text-align: center;
}
html[data-theme="dark"] .daypick label { background: var(--bg-sunken); }
.daypick input:checked + label {
    background: var(--accent); border-color: var(--accent); color: var(--accent-text);
}
.daypick input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------------
   Hinweise
   --------------------------------------------------------------------- */
.alert {
    display: flex; gap: .7rem; align-items: flex-start;
    padding: .8rem 1rem; border-radius: var(--radius);
    border: 1px solid transparent; margin-bottom: 1rem;
    font-size: .9rem;
}
.alert .ico { margin-top: 1px; }
.alert-success { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-error   { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-warn    { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-info    { background: var(--info-soft);   color: var(--info);   border-color: color-mix(in srgb, var(--info) 30%, transparent); }

.toast-host {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 300;
    display: flex; flex-direction: column; gap: .5rem; max-width: min(90vw, 380px);
}
.toast {
    background: var(--bg-elev); border: 1px solid var(--surface-line);
    border-radius: var(--radius); padding: .75rem .95rem;
    box-shadow: var(--shadow-lg); font-size: .88rem;
    animation: toast-in .22s var(--ease);
}
.toast.ok    { border-left: 4px solid var(--ok); }
.toast.err   { border-left: 4px solid var(--danger); }
.toast.info  { border-left: 4px solid var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   Fortschritt
   --------------------------------------------------------------------- */
.progress {
    height: 10px; border-radius: 999px;
    background: var(--bg-sunken); overflow: hidden;
    border: 1px solid var(--surface-line);
}
.progress > span {
    display: block; height: 100%;
    background: linear-gradient(90deg, var(--accent), #22c55e);
    border-radius: 999px;
    transition: width .35s var(--ease);
}
.progress.lg { height: 16px; }

/* ---------------------------------------------------------------------
   Sortierbare Liste (Drag & Drop)
   --------------------------------------------------------------------- */
.sortable { list-style: none; margin: 0; padding: 0; }
.sortable li {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem .8rem;
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
    margin-bottom: .4rem;
    touch-action: pan-y;
}
.sortable li.dragging { opacity: .45; }
.sortable li.drop-target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sortable li.locked { border-left: 4px solid var(--warn); }
.drag-handle {
    cursor: grab; color: var(--text-faint); padding: .25rem;
    touch-action: none; border-radius: 6px;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle:hover { background: var(--bg-hover); color: var(--text); }
.seq {
    width: 34px; height: 34px; flex: 0 0 auto;
    display: grid; place-items: center;
    border-radius: 9px; background: var(--bg-sunken);
    font-weight: 700; font-size: .82rem; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   Route-Seite (mobil optimiert)
   --------------------------------------------------------------------- */
.route-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--bg);
}
.route-top {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem 1rem;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--surface-line);
    position: sticky; top: 0; z-index: 30;
}
.route-top .rt-title { font-weight: 700; font-size: 1rem; line-height: 1.15; }
.route-top .rt-sub { font-size: .78rem; color: var(--text-muted); }

.route-progress { padding: .6rem 1rem; background: var(--bg-elev); border-bottom: 1px solid var(--surface-line); }
.route-progress .rp-nums { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .35rem; }

.route-body { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }

.next-card {
    background: var(--bg-elev);
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: var(--shadow);
}
.next-eyebrow {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
    font-weight: 800; color: var(--accent);
}
.next-addr { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; margin: .3rem 0 .1rem; }
.next-city { color: var(--text-muted); font-size: .98rem; }
.next-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.next-dist {
    display: flex; align-items: baseline; gap: .4rem;
    font-size: 1.5rem; font-weight: 750; color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.next-dist small { font-size: .82rem; font-weight: 600; color: var(--text-muted); }

.note-box {
    margin-top: .8rem; padding: .7rem .85rem;
    background: var(--warn-soft); color: var(--warn);
    border-radius: var(--radius-sm); font-size: .92rem; font-weight: 600;
    display: flex; gap: .55rem;
}

#map, .map {
    width: 100%; height: 340px;
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--surface-line);
    background: var(--bg-sunken);
    z-index: 1;
}
.map-lg { height: 460px; }

.route-actions {
    position: sticky; bottom: 0;
    display: grid; gap: .55rem;
    padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--surface-line);
    z-index: 30;
}
.route-actions .btn-huge {
    padding: 1.05rem; font-size: 1.08rem; font-weight: 750;
    border-radius: var(--radius); letter-spacing: .01em;
    min-height: 62px;
}
.route-actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }

.stop-list { list-style: none; margin: 0; padding: 0; }
.stop-list li {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem .7rem; border-radius: var(--radius-sm);
    border: 1px solid var(--surface-line); margin-bottom: .35rem;
    background: var(--bg-elev); font-size: .9rem;
}
.stop-list li.done   { opacity: .55; }
.stop-list li.done .stop-name { text-decoration: line-through; }
.stop-list li.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.stop-list li.skipped { border-left: 4px solid var(--warn); }
.stop-list li.problem { border-left: 4px solid var(--danger); }

/* ---------------------------------------------------------------------
   Dialoge
   --------------------------------------------------------------------- */
dialog {
    border: 1px solid var(--surface-line);
    border-radius: var(--radius-lg);
    padding: 0;
    background: var(--bg-elev);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    max-width: min(94vw, 620px);
    width: 100%;
}
dialog::backdrop { background: rgba(2,6,23,.62); backdrop-filter: blur(2px); }
dialog .dlg-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--surface-line); display: flex; align-items: center; gap: .6rem; }
dialog .dlg-head h3 { margin: 0; }
dialog .dlg-body { padding: 1.2rem; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { padding: .9rem 1.2rem; border-top: 1px solid var(--surface-line); display: flex; gap: .5rem; justify-content: flex-end; background: var(--bg-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------------------------------------------------------------------
   Reiter
   --------------------------------------------------------------------- */
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--surface-line); margin-bottom: 1.2rem; }
.tabs a {
    padding: .6rem .9rem; font-weight: 600; font-size: .9rem;
    color: var(--text-muted); border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------
   Import-Vorschau
   --------------------------------------------------------------------- */
.preview-row.low  { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.preview-row.mid  { background: color-mix(in srgb, var(--warn-soft) 45%, transparent); }
.preview-row.skip { opacity: .5; }
.preview-row td input, .preview-row td select { font-size: .85rem; padding: .35rem .45rem; }
.conf-bar { width: 46px; height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.conf-bar > span { display: block; height: 100%; background: var(--ok); }
.conf-bar.mid > span { background: var(--warn); }
.conf-bar.low > span { background: var(--danger); }

.raw-text {
    font-family: var(--mono); font-size: .8rem; line-height: 1.5;
    background: var(--bg-sunken); border: 1px solid var(--surface-line);
    border-radius: var(--radius-sm); padding: 1rem;
    white-space: pre-wrap; word-break: break-word;
    max-height: 60vh; overflow: auto;
}

.dropzone {
    border: 2px dashed var(--surface-line);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    background: var(--bg-sunken);
    transition: border-color .15s var(--ease), background .15s var(--ease);
    cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ico { color: var(--accent); }

/* ---------------------------------------------------------------------
   Anmeldeseite
   --------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh; min-height: 100dvh;
    display: grid; place-items: center; padding: 1.5rem;
    background:
        radial-gradient(900px 480px at 12% -8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
        radial-gradient(700px 420px at 88% 108%, color-mix(in srgb, #7c3aed 20%, transparent), transparent 60%),
        var(--bg);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-logo {
    width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 1rem;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------------
   Leerzustand
   --------------------------------------------------------------------- */
.empty {
    text-align: center; padding: 2.6rem 1.4rem; color: var(--text-muted);
}
.empty .ico { width: 44px; height: 44px; color: var(--text-faint); margin-bottom: .7rem; }
.empty h3 { color: var(--text); }

/* ---------------------------------------------------------------------
   Leaflet-Anpassungen (Karte im dunklen Modus lesbar halten)
   --------------------------------------------------------------------- */
.leaflet-container { background: var(--bg-sunken); font: inherit; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.75) !important; }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(10,16,28,.75) !important; color: #94a3b8; }
html[data-theme="dark"] .leaflet-control-attribution a { color: #7dd3fc; }
html[data-theme="dark"] .leaflet-tile { filter: brightness(.82) contrast(1.05); }
.leaflet-bar a { background: var(--bg-elev); color: var(--text); border-color: var(--surface-line); }
.leaflet-bar a:hover { background: var(--bg-hover); }

.marker-num {
    background: var(--accent); color: #fff;
    border: 2px solid #fff; border-radius: 50%;
    width: 26px; height: 26px; display: grid; place-items: center;
    font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.marker-num.done { background: var(--ok); }
.marker-num.current { background: #f59e0b; transform: scale(1.25); }
.marker-me {
    width: 18px; height: 18px; border-radius: 50%;
    background: #2563eb; border: 3px solid #fff;
    box-shadow: 0 0 0 6px rgba(37,99,235,.25);
}

/* ---------------------------------------------------------------------
   Bewegung reduzieren
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ---------------------------------------------------------------------
   Druck
   --------------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .route-actions, .btn, .no-print { display: none !important; }
    .app { grid-template-columns: 1fr; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ccc; box-shadow: none; }
}
