:root {
  --blue: #1E90FF; --blue-d: #1673D6; --ink: #1B2430; --grey: #5A6573; --line: #D5DAE0; --bg: #F2F5F8; --card: #fff;
  --good: #1F9D55; --bad: #D64545; --warn: #E08A00; --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue-d); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 650; }
h2 { font-size: 1.12rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.muted { color: var(--grey); font-weight: 400; }
.small { font-size: .86rem; }
.center { text-align: center; }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
[hidden] { display: none !important; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); }
.brand img { height: 34px; display: block; border-radius: 3px; }
nav.main { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav.main a, .me a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; min-height: 52px; padding: 4px 10px; border-radius: 10px; color: #cfd6de; font-size: .82rem; font-weight: 600; }
nav.main a .ico { font-size: 1.25rem; line-height: 1.1; }
nav.main a.on, .me a.on { background: var(--blue); color: #fff; }
nav.main a:hover { background: rgba(255,255,255,.08); }
.me { display: flex; gap: 6px; align-items: center; }
.me a { flex-direction: row; gap: 6px; min-width: auto; font-size: .9rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot.lg { width: 16px; height: 16px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; padding-bottom: 80px; }
.wrap.wide { max-width: 1500px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin: 4px 0 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(27,36,48,.06), 0 0 0 1px rgba(27,36,48,.05); }
.card.flush { padding: 0; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + * { margin-top: 14px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover { border-color: #b7c0ca; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.big { min-height: 54px; padding: 10px 22px; font-size: 1.05rem; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.icon { min-width: 44px; padding: 4px 8px; }
.cabin .btn.bad.big { background: var(--bad); color: #fff; }

/* Formulare */
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; font-weight: 600; color: var(--grey); }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 46px; background: #fff; width: 100%; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--blue); }
input[type=color] { padding: 4px; height: 46px; }
fieldset { border: 0; padding: 0; margin: 0; display: contents; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.grid-form.g2 { grid-template-columns: 1fr 1fr; }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
label.chk { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ink) !important; font-weight: 500 !important; }
.chkcol { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline select { width: auto; min-height: 36px; padding: 4px 8px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; background: #E7F6EC; color: #165c33; font-weight: 500; }
.flash.err { background: #FDECEC; color: #8e2020; }
.flash.warn { background: #FFF4E0; color: #7a4d00; }

/* Login */
.auth { max-width: 420px; margin: 40px auto; }
.auth-logo { width: 100%; max-width: 320px; display: block; margin: 0 auto 20px; border-radius: 4px; }
.auth h1 { text-align: center; margin-bottom: 14px; }
.auth .form { display: flex; flex-direction: column; gap: 14px; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border-radius: var(--r); padding: 12px 14px; box-shadow: 0 0 0 1px rgba(27,36,48,.06); }
.kpi b { display: block; font-size: 1.7rem; line-height: 1.1; }
.kpi b.small-b { font-size: 1.05rem; line-height: 1.3; }
.kpi span { color: var(--grey); font-size: .85rem; }
.kpi.warn b { color: var(--warn); } .kpi.bad b { color: var(--bad); } .kpi.good b { color: var(--good); }

.prog { position: relative; height: 22px; background: #E6EBF0; border-radius: 11px; overflow: hidden; margin-top: 6px; }
.prog div { height: 100%; background: var(--good); border-radius: 11px; transition: width .3s; }
.prog span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--ink); }
.w40 { width: 40%; }
.grow { flex: 1; min-width: 0; }

.mytour { display: flex; gap: 16px; align-items: center; border-left: 8px solid var(--c); color: inherit; }
.mytour > div { flex: 1; }
.big-num { font-size: 1.3rem; font-weight: 700; }
.tourrow, .jobrow { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid #eef1f4; color: inherit; }
.tourrow:last-child, .jobrow:last-child { border-bottom: 0; }
.jobrow.done { opacity: .6; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: #E6EBF0; color: var(--grey); white-space: nowrap; }
.tag.lieferung { background: #E1F0FF; color: var(--blue-d); }
.tag.abholung { background: #F3E8FF; color: #7a3fc2; }
.tag.bad { background: #FDECEC; color: var(--bad); }
.tag.warn { background: #FFF1D6; color: #8a5600; }
.tag.st-einsatz { background: #E7F6EC; color: #1a6e3c; }
.tag.st-lager { background: #E6EBF0; color: var(--grey); }
.tag.st-defekt { background: #FDECEC; color: var(--bad); }

/* Tabellen */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--grey); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.tbl.click tbody tr, .tbl.click tr:not(:first-child) { cursor: pointer; }
.tbl.click tr:hover td { background: #F5F9FF; }
.tbl tr.inactive td { opacity: .5; }
.tbl tr.row-bad td { background: #FFF7F7; }
.tbl .num { text-align: right; }
.cabno { display: inline-block; min-width: 2.4em; text-align: center; font-weight: 800; background: var(--ink); color: #fff; border-radius: 6px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.cabno.lg { font-size: 1.4rem; padding: 2px 12px; }
a.cabno { color: #fff; }
.due { font-weight: 600; } .due.over { color: var(--bad); } .due.due { color: var(--warn); } .due.ok { color: var(--good); }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 10px 18px; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.tabs a.on { background: var(--ink); color: #fff; box-shadow: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select, .filters input[type=date] { width: auto; flex: 0 1 auto; }
.filters label { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--grey); }
.listhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 2px 10px; flex-wrap: wrap; }
.listhead h2 { margin: 0; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.daynav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.daynav input[type=date] { width: auto; }
.daynav form { margin: 0; }
.row-line { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #eef1f4; flex-wrap: wrap; }
.plainlist { margin: 0; padding-left: 18px; } .plainlist li { margin: 4px 0; }
.warnlist li { font-size: .9rem; }

/* Karte */
.map { height: 320px; border-radius: var(--r); overflow: hidden; background: #dde5ec; margin-bottom: 14px; z-index: 1; }
.map.tall { height: calc(100vh - 210px); min-height: 420px; position: sticky; top: 80px; }
.map.full { height: calc(100vh - 220px); min-height: 420px; }
.map.hide { display: none; }
.nmark span { display: flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.nmark.depot span { width: 32px; height: 32px; background: var(--ink); font-size: 18px; border-radius: 8px; }
.smark span { display: flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); background: var(--good); }
.smark.over span { background: var(--bad); } .smark.due span { background: var(--warn); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .88rem; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .pin { width: 14px; height: 14px; border-radius: 50%; background: var(--good); display: inline-block; }
.legend .pin.over { background: var(--bad); } .legend .pin.due { background: var(--warn); }
.legend .line { width: 22px; height: 5px; border-radius: 3px; display: inline-block; }

/* Touren */
.tourgrid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.tourhead { display: flex; align-items: center; gap: 10px; }
.tourcol { border-top: 6px solid var(--c); }
.stops { list-style: none; padding: 0; margin: 12px 0 8px; }
.stops li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.stops li.done { opacity: .55; }
.num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.num.big { width: 44px; height: 44px; font-size: 1.25rem; }
.stopbtns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 190px; }
.tourhead-card { display: flex; gap: 12px; align-items: center; border-left: 8px solid var(--c); }
.stopcards { list-style: none; padding: 0; margin: 0; }
.stopcard.done { opacity: .7; }
.stophead { display: flex; gap: 12px; align-items: flex-start; }
.stophead .cust { font-size: 1.15rem; font-weight: 700; }
.stopact { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.note { background: #FFF8E1; border-radius: 6px; padding: 4px 8px; margin-top: 4px; color: #6b5200; }
.cabins { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cabin { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: #F6F8FA; flex-wrap: wrap; }
.cabin.is-done { background: #ECF8F0; } .cabin.is-not { background: #FDF0F0; }
.cabnum { width: 64px; text-align: center; background: var(--ink); color: #fff; border-radius: 8px; padding: 4px 0; line-height: 1.05; }
.cabnum small { display: block; font-size: .62rem; opacity: .7; text-transform: uppercase; }
.cabnum b { font-size: 1.5rem; }
.res { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.assign { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.assign .multi { width: 220px; min-height: 120px; }
.assign label { display: flex; flex-direction: column; font-size: .85rem; color: var(--grey); }

/* Dialog */
.dlg { border: 0; border-radius: 16px; padding: 20px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(27,36,48,.55); }
.dlg form { display: flex; flex-direction: column; gap: 12px; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--grey); font-size: .9rem; }
.photo-pick { position: relative; border: 2px dashed var(--line); border-radius: 12px; padding: 18px; align-items: center; justify-content: center; cursor: pointer; min-height: 110px; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-pick span { font-size: 1.1rem; color: var(--blue-d); }
.photo-pick img { max-width: 100%; max-height: 220px; border-radius: 8px; margin-top: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: .88rem; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.dlgbtns { display: flex; justify-content: flex-end; gap: 10px; }

/* Kalender */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.calh { text-align: center; font-weight: 700; color: var(--grey); font-size: .85rem; padding: 4px; }
.cald { background: #fff; border-radius: 10px; min-height: 104px; padding: 6px; color: inherit; display: flex; flex-direction: column; gap: 3px; box-shadow: 0 0 0 1px rgba(27,36,48,.06); }
.cald.empty { background: transparent; box-shadow: none; }
.cald.we { background: #F7F9FB; }
.cald.today { box-shadow: 0 0 0 2px var(--blue); }
.cald.sel { background: #EAF4FF; }
.cald .dn { font-weight: 800; }
.ev { font-size: .74rem; border-radius: 5px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.r { background: #E7F6EC; color: #1a6e3c; } .ev.rp { background: #EEF2F6; color: var(--grey); }
.ev.l { background: #E1F0FF; color: var(--blue-d); } .ev.a { background: #F3E8FF; color: #7a3fc2; } .ev.o { background: #FFF4E0; color: #7a4d00; }
.legend .chip i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-r { background: #6cc28f; } .lg-l { background: var(--blue); } .lg-a { background: #a36ee0; }

.live-note { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 2000; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.live-note a { color: #9fd0ff; font-weight: 700; }

@media (max-width: 1000px) {
  .tourgrid { grid-template-columns: 1fr; }
  .map.tall { position: relative; top: auto; height: 360px; min-height: 0; }
}
@media (max-width: 820px) {
  .grid2 { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .span3 { grid-column: 1 / -1; }
  nav.main a { min-width: 58px; padding: 4px 6px; font-size: .74rem; }
  .brand { display: none; }
  .hide-s { display: none; }
  .cald { min-height: 74px; } .ev { font-size: .66rem; }
}
@media (max-width: 560px) {
  .grid-form, .grid-form.g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .me a span + * { display: none; }
  .cal { gap: 3px; } .cald { padding: 3px; }
  .w40 { width: 34%; }
}
.dlg .btn.bad { background: var(--bad); color: #fff; } .dlg .btn.bad:disabled { background: #fff; color: var(--bad); }
.btn.primary .dot { box-shadow: 0 0 0 2px #fff; }

.lbl { font-size: .88rem; font-weight: 600; color: var(--grey); margin-bottom: 4px; }
.daychips { display: flex; gap: 6px; flex-wrap: wrap; }
.daychips .chip input { width: 18px; height: 18px; }
.daychips .chip:has(input:checked) { background: var(--blue); color: #fff; border-color: var(--blue); }
.tbl tr.row-move td { background: #FFF8E6; } .tbl tr.row-new td { background: #EEF6FF; }
.form .daychips label.chip { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: .95rem; padding: 8px 14px; }
