:root {
  --ink: #16233a;
  --ink-soft: #45536b;
  --surface: #f2f4f7;
  --card: #ffffff;
  --line: #dfe4ec;
  --brand: #0e7c86;
  --frei: #94a3b8;
  --c-anfahrt: #2563eb;
  --c-remoteservice: #7c3aed;
  --c-vor_ort: #059669;
  --c-werkstatt: #d97706;
  --c-internes: #64748b;
  --radius: 14px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--surface);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Kopfzeile */
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); display: inline-block; }
#nav { display: flex; gap: 4px; }
.navbtn {
  background: none; border: 0; color: #cbd5e1; font: inherit;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.navbtn.active { background: rgba(255,255,255,.14); color: #fff; }
.navbtn.subtle { color: #7d8aa0; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

h1 { font-size: 1.15rem; margin: 8px 0 14px; }
.muted { color: var(--ink-soft); font-size: .875rem; }

/* Karten */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.card.tappable { cursor: pointer; }
.card.tappable:active { transform: scale(.99); }
.card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ticketnr { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .8rem; }
.kunde { font-weight: 650; }
.titel { margin-top: 2px; font-size: .92rem; color: var(--ink-soft); }

/* Status-Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 650; letter-spacing: .01em;
  padding: 3px 10px; border-radius: 999px; color: #fff; background: var(--frei);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.85); }
.chip.neu { background: var(--ink); }
.chip.anfahrt { background: var(--c-anfahrt); }
.chip.remoteservice { background: var(--c-remoteservice); }
.chip.vor_ort { background: var(--c-vor_ort); }
.chip.werkstatt { background: var(--c-werkstatt); }
.chip.internes { background: var(--c-internes); }

/* Buttons */
button.primary, button.status {
  font: inherit; font-weight: 650; border: 0; cursor: pointer;
  border-radius: 12px; padding: 12px 16px; color: #fff; background: var(--brand);
  width: 100%;
}
button.primary:active { filter: brightness(.92); }
button.ghost {
  font: inherit; background: none; border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 16px; cursor: pointer; color: var(--ink); width: 100%;
}
button:disabled { opacity: .5; cursor: default; }

/* Statuswahl auf dem aktiven Auftrag */
.statusgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
button.status { text-align: left; padding: 14px; }
button.status small { display: block; font-weight: 400; opacity: .85; font-size: .75rem; margin-top: 2px; }
button.status.anfahrt { background: var(--c-anfahrt); }
button.status.remoteservice { background: var(--c-remoteservice); }
button.status.vor_ort { background: var(--c-vor_ort); }
button.status.werkstatt { background: var(--c-werkstatt); }
button.status.internes { background: var(--c-internes); }
button.status.laufend { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Laufende Zeit */
.timerbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px;
}
.timer { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 700; }

/* Formulare */
input, textarea {
  font: inherit; width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; background: #fff; color: var(--ink); margin-bottom: 10px;
}
textarea { min-height: 130px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Dashboard */
.techtile { display: flex; align-items: center; gap: 12px; }
.techtile .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--frei); flex: none; }
.techtile .dot.anfahrt { background: var(--c-anfahrt); }
.techtile .dot.remoteservice { background: var(--c-remoteservice); }
.techtile .dot.vor_ort { background: var(--c-vor_ort); }
.techtile .dot.werkstatt { background: var(--c-werkstatt); }
.techtile .dot.internes { background: var(--c-internes); }
.techtile .info { flex: 1; min-width: 0; }
.techtile .name { font-weight: 650; }
.techtile .detail { font-size: .85rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.techtile .seit { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--ink-soft); }

/* Zeiten-Tabelle */
table.zeiten { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.zeiten td { padding: 6px 4px; border-top: 1px solid var(--line); }
table.zeiten td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Login */
.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { text-align: center; }

/* Leerzustand */
.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: .9rem; z-index: 50;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
