/* BizNis – Oberfläche. Farben als Variablen, hell/dunkel automatisch,
   per Umschalter überschreibbar (data-theme auf <html>). */
:root {
  --bg: #f3f4f7;
  --bg2: #e9ebf0;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #667085;
  --line: #dde1e8;
  --accent: #e8590c;
  --accent-2: #fd7e14;
  --accent-soft: #fff0e6;
  --ok: #2b8a3e;
  --ok-soft: #e6f4ea;
  --warn: #b7791f;
  --warn-soft: #fff6dd;
  --bad: #c92a2a;
  --bad-soft: #fdecec;
  --info: #1c7ed6;
  --info-soft: #e7f1fc;
  --side: #1f2a37;
  --side-text: #d0d6e0;
  --side-active: #2d3b4d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d; --bg2: #19202a; --card: #1a212b; --text: #e3e7ee; --muted: #94a0b4; --line: #2a3442;
    --accent: #ff8a3d; --accent-2: #ffa94d; --accent-soft: #3a2616; --ok: #51cf66; --ok-soft: #173222;
    --warn: #fcc419; --warn-soft: #3a3014; --bad: #ff6b6b; --bad-soft: #3b1d1d; --info: #4dabf7; --info-soft: #14283c;
    --side: #0c1015; --side-text: #b8c2d1; --side-active: #1d2632; --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161d; --bg2: #19202a; --card: #1a212b; --text: #e3e7ee; --muted: #94a0b4; --line: #2a3442;
  --accent: #ff8a3d; --accent-2: #ffa94d; --accent-soft: #3a2616; --ok: #51cf66; --ok-soft: #173222;
  --warn: #fcc419; --warn-soft: #3a3014; --bad: #ff6b6b; --bad-soft: #3b1d1d; --info: #4dabf7; --info-soft: #14283c;
  --side: #0c1015; --side-text: #b8c2d1; --side-active: #1d2632; --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .4rem 0; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- Layout */
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 230px, transparent 230px); }
.side { background: var(--side); color: var(--side-text); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; padding: 4px 8px 14px; }
.brand img { width: 30px; height: 30px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 8px; margin: 1px 0; }
.nav a:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 22px; text-align: center; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 6px; }
.nav .badge { margin-left: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 22px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .company { font-weight: 600; }
.topbar .kpis { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.kpi-mini { display: flex; flex-direction: column; line-height: 1.15; }
.kpi-mini b { font-variant-numeric: tabular-nums; }
.kpi-mini small { font-size: .72rem; }
.menu-btn { display: none; }
.content { padding: 22px; max-width: 1280px; width: 100%; }
.footer { padding: 14px 22px; color: var(--muted); font-size: .8rem; margin-top: auto; }
.banner { background: var(--warn-soft); color: var(--warn); padding: 8px 22px; font-weight: 600; border-bottom: 1px solid var(--line); }

/* ---------------------------------------------------------------- Bausteine */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .8rem; }
.kpi .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--bg2); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent); color: #fff; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.q { display: inline-block; min-width: 34px; text-align: center; padding: 0 6px; border-radius: 6px; font-size: .75rem; font-weight: 700; background: var(--info-soft); color: var(--info); }

.note { padding: 10px 12px; border-radius: 8px; background: var(--info-soft); color: var(--text); border-left: 3px solid var(--info); margin: 8px 0; }
.note.warn { background: var(--warn-soft); border-color: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: var(--bad); }
.note.ok { background: var(--ok-soft); border-color: var(--ok); }
.empty { color: var(--muted); padding: 18px; text-align: center; }

/* Fortschritt */
.progress { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .9s linear; }
.progress.ok > i { background: var(--ok); }

/* Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--bg); }
tr.clickable { cursor: pointer; }
tr.own td { background: var(--accent-soft); }
td .row { flex-wrap: nowrap; }

/* Formulare */
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { width: auto; }
input.small, select.small { width: 110px; padding: 5px 8px; }
input.tiny { width: 80px; padding: 4px 6px; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 10px; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.form-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); font-size: .95rem; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 7px 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
button.ghost { background: transparent; border-color: transparent; }
button.small, .btn.small { padding: 4px 10px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Gebäudekarten */
.bcard { display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s; }
.bcard:hover { border-color: var(--accent); }
.bcard .top { display: flex; gap: 10px; align-items: center; }
.bcard .icon { font-size: 1.8rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--bg2); border-radius: 10px; flex-shrink: 0; }
.bcard .title { font-weight: 700; }
.bcard .meta { font-size: .8rem; color: var(--muted); }
.status-line { font-size: .85rem; }
.region-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

/* Auswahl-Kacheln */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.choice { border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--card); }
.choice:hover { border-color: var(--accent-2); }
.choice.sel { border-color: var(--accent); background: var(--accent-soft); }
.choice .big { font-size: 1.5rem; }
.choice.disabled { opacity: .5; cursor: not-allowed; }

/* Rezept */
.recipe { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; border-radius: 99px; background: var(--bg2); font-size: .82rem; white-space: nowrap; }
.chip.missing { background: var(--bad-soft); color: var(--bad); }
.chip.okc { background: var(--ok-soft); color: var(--ok); }

/* Anmeldung */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(135deg, #1f2a37 0%, #2c3e50 60%, #e8590c 160%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-hero h1 { font-size: 2.3rem; margin-bottom: 10px; }
.auth-hero p { color: #d7dde6; max-width: 520px; }
.auth-hero ul { color: #d7dde6; padding-left: 20px; }
.auth-hero .chain { font-size: 1.6rem; letter-spacing: 4px; margin: 18px 0; }
.auth-form { padding: 40px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; width: 100%; margin: 0 auto; }

/* Modal & Toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 20, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: 12px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal h2 { margin-top: 0; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: pop .2s ease-out; }
.toast.err { border-left-color: var(--bad); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.event-list li:last-child { border-bottom: 0; }
.event-list .t { color: var(--muted); font-size: .78rem; white-space: nowrap; min-width: 92px; }
.event-list li.unread { font-weight: 600; }

.tree { font-size: .9rem; }
.tree .node { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--card); }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 980px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .content { padding: 14px 12px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .grid.c4.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; }
  .auth-hero h1 { font-size: 1.7rem; }
  .auth-form { padding: 22px 16px; }
  th, td { padding: 6px 5px; }
}

/* Bauen: Regionszeilen passen sich der Kachelbreite an (nie breiter als die Kachel) */
.build-rows { margin-top: 6px; }
.build-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.build-row:last-child { border-bottom: 0; }
.build-row .br-region { min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Zurück-Knöpfe: immer als echter Knopf, nie als reiner Text-Link */
.btn.back { margin-bottom: 10px; }

/* ---------------------------------------------------------------- Handy & App (PWA) */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
.layout, .auth-wrap { min-height: 100dvh; }
.side { padding-top: calc(14px + env(safe-area-inset-top)); padding-left: calc(10px + env(safe-area-inset-left)); }
.side-close, .side-backdrop, .bottombar { display: none; }
.menu-btn { position: relative; font-size: 1.35rem; line-height: 1; width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 10px; flex-shrink: 0; }
.bb-dot { position: absolute; top: -4px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
.menu-btn .bb-dot { top: 2px; right: 2px; }
.topbar { padding-top: calc(10px + env(safe-area-inset-top)); }

@media (max-width: 760px) {
  /* Hamburger-Menü: Schublade von links mit abgedunkeltem Hintergrund */
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); height: auto; z-index: 60; transform: translateX(-105%); transition: transform .22s ease-out; overscroll-behavior: contain; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.menu-open { overflow: hidden; }
  body.menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.menu-open .side-backdrop { opacity: 1; pointer-events: auto; }
  .side-close { display: inline-flex; margin-left: auto; background: transparent; border: 0; color: var(--side-text); font-size: 1.2rem; width: 40px; height: 40px; justify-content: center; padding: 0; }
  .brand { padding-right: 0; }
  .nav a { padding: 12px 12px; font-size: 1rem; }

  .menu-btn { display: inline-flex; }
  /* Kopfzeile zweizeilig: ☰ + Firma, darunter die Kennzahlen */
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(12px + env(safe-area-inset-left)); }
  .topbar > div:nth-child(2) { min-width: 0; }
  .topbar > div:nth-child(2) > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .company { font-size: 1.02rem; }
  .topbar .kpis { grid-column: 1 / -1; gap: 8px; margin-left: 0; flex-wrap: nowrap; justify-content: space-between; }
  .topbar .kpi-mini b { font-size: .84rem; white-space: nowrap; }
  .topbar .kpis #theme-btn { min-height: 34px; }
  .content { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  .footer { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* Untere Leiste im Daumenbereich */
  .bottombar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.06);
    padding: 4px calc(4px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left)); }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 10px; color: var(--muted); font-size: .7rem; font-weight: 600; min-height: 52px; justify-content: center; }
  .bottombar a:hover { text-decoration: none; }
  .bottombar a.active { color: var(--accent); background: var(--accent-soft); }
  .bb-ico { position: relative; font-size: 1.3rem; line-height: 1.1; }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }

  /* Eingabefelder ≥ 16px: verhindert das automatische Hineinzoomen auf dem iPhone */
  input, select, textarea { font-size: 16px; padding: 9px 10px; }
  input.small, select.small, input.tiny { font-size: 16px; }

  /* Dialoge als Blatt von unten */
  .modal-back { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 88dvh; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet .2s ease-out; }
  .modal .row.end > button { flex: 1; justify-content: center; }
  .auth-hero { padding-top: calc(28px + env(safe-area-inset-top)); }
}
@keyframes sheet { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Touch-Geräte: größere Tippflächen */
@media (pointer: coarse) {
  button, .btn { min-height: 40px; }
  button.small, .btn.small { min-height: 34px; }
  .tabs a { padding: 10px 14px; }
  input[type=checkbox] { width: 20px; height: 20px; }
}

/* Benachrichtigungen: Schalterzeilen */
.switch-row { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; margin: 0; }
.switch-row:hover { border-color: var(--accent-2); }
.switch-row input { flex-shrink: 0; accent-color: var(--accent); }
#nt-prefs.stack > * + * { margin-top: 6px; }
.quiet-times.off, .switch-row.off { opacity: .5; }
.quiet-times { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 360px; }
.quiet-times .field { margin-bottom: 0; }

/* ---------------------------------------------------------------- Klebende Köpfe (Spielleitung)
   Seitenkopf + Tabs bleiben unter der oberen Leiste stehen. Höhe der Leiste setzt main.js (measureSticky)
   als --topbar-h. Tabellenköpfe und der waagerechte Balken: tables.js. */
.sticky-head { position: sticky; top: var(--topbar-h, 0px); z-index: 15; background: var(--bg);
  margin: -22px -22px 16px; padding: 14px 22px 0; border-bottom: 1px solid var(--line); box-shadow: 0 6px 10px -8px rgba(16, 24, 40, .25); }
.sticky-head .page-head { margin-bottom: 8px; }
.sticky-head .tabs { margin-bottom: 0; border-bottom: 0; scrollbar-width: thin; }
@media (max-width: 760px) {
  .sticky-head { margin: -14px calc(-12px - env(safe-area-inset-right)) 14px calc(-12px - env(safe-area-inset-left));
    padding: 8px calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left)); }
  .sticky-head .page-head small { display: none; }
  .sticky-head h1 { font-size: 1.2rem; }
}
/* Alle Tabellen: Kopf wandert mit (tables.js), erste Spalte (Produkt, Ware …) bleibt beim waagerechten Scrollen links */
.table-wrap thead th { position: relative; z-index: 2; background: var(--card); }
.table-wrap thead.floating th { box-shadow: inset 0 -1px 0 var(--line), 0 4px 6px -4px rgba(16, 24, 40, .3); }
.table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
.table-wrap thead th:first-child { z-index: 3; }
.table-wrap tbody tr:hover td:first-child { background: var(--bg); }
.table-wrap tr.own td:first-child { background: var(--accent-soft); }
.table-wrap.scrolled th:first-child, .table-wrap.scrolled td:first-child { box-shadow: inset -1px 0 0 var(--line), 4px 0 6px -4px rgba(16, 24, 40, .25); }
/* Waagerechte Balken gut sichtbar; zusätzlicher Balken unten am Bildschirm für lange, breite Tabellen */
.table-wrap, .hscroll { scrollbar-width: auto; scrollbar-color: var(--muted) var(--bg2); }
.hscroll { position: fixed; z-index: 25; height: 16px; overflow-x: auto; overflow-y: hidden; display: none; background: var(--bg2);
  border-radius: 8px 8px 0 0; box-shadow: 0 -2px 8px rgba(0, 0, 0, .12); }
.hscroll.show { display: block; }
.hscroll > div { height: 1px; }
@media (pointer: coarse) { .hscroll.show { display: none; } } /* Handy: mit dem Finger wischen */
.admin-page td.row-label { min-width: 120px; max-width: 190px; white-space: normal; line-height: 1.25; }
.admin-page td.row-label code { font-size: .75rem; color: var(--muted); }
@media (max-width: 760px) { .admin-page td.row-label { min-width: 96px; max-width: 120px; font-size: .88rem; } }

/* Mehrere Gebäude markieren und gemeinsam starten */
.bcard .pick { display: grid; place-items: center; width: 34px; height: 44px; margin: -4px -4px -4px -6px; cursor: pointer; flex-shrink: 0; }
.bcard .pick input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.bcard .pick input:disabled { cursor: not-allowed; opacity: .35; }
.bcard.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.pickbar { position: fixed; z-index: 35; left: calc(230px + 22px); right: 22px; bottom: 16px; max-width: 900px; margin: 0 auto;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--card);
  border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.pickbar[hidden] { display: none; }
.pickbar .pb-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
body.has-pickbar .footer { padding-bottom: 90px; }
body.has-pickbar #toasts { bottom: 90px; }
@media (max-width: 760px) {
  .pickbar { left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); padding: 8px 10px; }
  .pickbar .pb-actions { width: 100%; }
  .pickbar .pb-actions .primary { flex: 1; justify-content: center; }
  body.has-pickbar .footer { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body.has-pickbar #toasts { bottom: calc(160px + env(safe-area-inset-bottom)); }
}
.pickbar .pb-info { display: flex; flex-direction: column; min-width: 0; }
.pickbar .pb-info small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal:has(.costbox) { max-width: 860px; }
.mtype { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.mtype select { width: auto; min-width: 180px; }
.costbox { margin: 12px 0 6px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); }
.costbox > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.costbox b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.costbox .total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-size: 1.05rem; }
.costbox .out { display: block; margin-top: 6px; }

/* Gebäude: Filter-Knöpfe und Sortierung */
.filterbar { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.fb-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chipbtn { border-radius: 999px; padding: 5px 12px; font-size: .88rem; font-weight: 600; background: var(--card); white-space: nowrap; flex-shrink: 0; }
.chipbtn span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chipbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chipbtn.on span { color: rgba(255, 255, 255, .85); }
.chipbtn.on .region-dot { box-shadow: 0 0 0 2px #fff; }
.fb-sort { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.fb-sort select { width: auto; padding: 5px 8px; }
@media (max-width: 760px) {
  .fb-sort { width: 100%; }
  .fb-sort select { flex: 1; }
}

/* ---------- Laufband (0.10.0) ---------- */
.ticker { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 22px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: .85rem; overflow: hidden; }
.ticker[hidden] { display: none; }
.ticker .tk-track { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.ticker .tk-move { display: inline-block; padding-left: 100%; animation: tk-scroll 60s linear infinite; }
.ticker .tk-item { margin-right: 56px; }
.ticker:hover .tk-move { animation-play-state: paused; }
.ticker .tk-close { padding: 2px 8px; }
@keyframes tk-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker .tk-move { animation: none; padding-left: 0; } .ticker .tk-track { overflow-x: auto; } }
@media (max-width: 760px) { .ticker { padding-left: 12px; font-size: .8rem; } }
/* Übersicht: Willkommen zurück, Rivale */
.card.welcome { border-left: 3px solid var(--ok); }
.rival-row { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; cursor: pointer; margin-bottom: 4px; }

/* ---------- Wirtschaftslage (0.11.0) ---------- */
.worldbar { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; padding: 5px 22px; background: var(--info-soft); border-bottom: 1px solid var(--line); font-size: .85rem; }
.worldbar[hidden] { display: none; }
.worldbar .wb-label { font-weight: 600; }
.worldbar .wb-item { color: inherit; text-decoration: none; white-space: nowrap; }
.worldbar .wb-item small { color: var(--muted); }
.world-ev { border-left: 3px solid var(--info); padding-left: 10px; }
@media (max-width: 760px) { .worldbar { padding: 5px 12px; font-size: .8rem; } }

/* ---------- Aufträge (0.12.0) ---------- */
.offer-card { border-left: 3px solid var(--accent); }
.offer-card h3 { margin-top: 0; }

/* ---------- Erfolge & Einsteiger-Pfad (0.13.0) ---------- */
.card.tutorial { border-left: 3px solid var(--accent); }
.tut-next { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tut-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.tut-steps li { font-size: .88rem; }
.tut-steps li.done { color: var(--muted); }
.tut-steps li.next { font-weight: 600; }
.card.ach { display: flex; gap: 12px; align-items: flex-start; }
.card.ach .ach-icon { font-size: 1.9rem; line-height: 1; filter: grayscale(1); opacity: .55; }
.card.ach.earned .ach-icon { filter: none; opacity: 1; }
.card.ach.earned { border-left: 3px solid var(--ok); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ach-badge { display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; border-radius: 99px; background: var(--ok-soft); font-size: .85rem; }

/* ---------- Daueraufträge (0.14.0) ---------- */
.card.auto-card { border-left: 3px solid var(--info); }
.warn-text { color: var(--warn); }
