/* 21CARS Brain – Aufbau und Farben wie die Shopify-Verwaltung (Polaris), Schrift Inter */
:root {
  --side: #1a1a1a; --side-hover: #2a2a2a; --side-on: #303030; --side-text: #e3e3e3; --side-muted: #a3a3a3;
  --bg: #f1f1f1; --surface: #fff; --surface-2: #f7f7f7; --hover: #fafafa;
  --text: #303030; --muted: #616161; --line: #ebebeb; --line-2: #e3e3e3; --input: #8a8a8a;
  --primary: #303030; --lime: #c9d331; --lime-light: #ebf188; --lime-bg: #f7f8e6;
  --ok: #014b40; --ok-bg: #affebf; --info: #00527c; --info-bg: #a4e8f2; --warn: #4f4700; --warn-bg: #ffeb78;
  --bad: #8e1f0b; --bad-bg: #fedad9; --grey: #616161; --grey-bg: #e3e3e3;
  --radius: 12px; --shadow: 0 1px 0 0 rgba(26, 26, 26, .07), 0 1px 0 0 rgba(204, 204, 204, .5) inset, 0 -1px 0 0 rgba(0, 0, 0, .17) inset, -1px 0 0 0 rgba(0, 0, 0, .13) inset, 1px 0 0 0 rgba(0, 0, 0, .13) inset;
  --card-shadow: 0 0 0 1px rgba(0, 0, 0, .07), 0 1px 0 0 rgba(26, 26, 26, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--side); color: var(--text); font: 13px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: #005bd3; text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; line-height: 1.3; margin: 0 0 2px; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 14px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- Rahmen: dunkle Seitenleiste + helle Arbeitsfläche ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100vh; padding: 12px 8px 8px; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 10px; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 20px; display: block; }
.brand span { color: var(--lime); font-weight: 600; font-size: 14px; }
.side-toggle { display: none; background: none; border: 0; color: var(--side-text); padding: 6px; border-radius: 8px; cursor: pointer; }
.side-search { display: flex; align-items: center; gap: 8px; background: #303030; border: 1px solid #4a4a4a; border-radius: 10px; padding: 0 10px; height: 34px; margin: 0 2px 12px; color: var(--side-muted); }
.side-search input { flex: 1; min-width: 0; background: none; border: 0; color: #fff; font: inherit; font-size: 13px; outline: none; padding: 0; }
.side-search input::placeholder { color: var(--side-muted); }
.side-search kbd { font: inherit; font-size: 11px; color: var(--side-muted); }
.side-search:focus-within { border-color: #8a8a8a; }
.side-scroll { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side a { color: var(--side-text); text-decoration: none; }
.nav-main { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 550; min-height: 32px; }
.nav-main:hover { background: var(--side-hover); text-decoration: none; }
.nav-main.on { background: var(--side-on); color: #fff; }
.nav-main span { flex: 1; }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 6px; }
.nav-sub a { display: flex; align-items: center; padding: 5px 10px 5px 40px; border-radius: 8px; font-size: 13px; color: var(--side-muted); min-height: 30px; }
.nav-sub a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav-sub a.on { color: #fff; font-weight: 600; background: var(--side-hover); }
.count { margin-left: auto; background: #4a4a4a; color: #fff; border-radius: 8px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.side-bottom { border-top: 1px solid #333; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.me:hover { background: var(--side-hover); text-decoration: none; }
.me-name { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; color: #fff; min-width: 0; }
.me-name small { color: var(--side-muted); font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--lime); color: #1a1a1a; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; object-fit: cover; flex: none; }
.avatar.big { width: 72px; height: 72px; border-radius: 16px; font-size: 24px; }

.main { flex: 1; min-width: 0; padding: 8px 8px 8px 0; }
.page { background: var(--bg); border-radius: 14px; min-height: calc(100vh - 16px); padding: 20px 32px 48px; }
.page > * { max-width: 1400px; margin-left: auto; margin-right: auto; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 36px; }
.head h1 + .muted, .head p { margin: 2px 0 0; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px; margin-bottom: 16px; color: var(--text); }
a.card:hover { text-decoration: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14), 0 2px 4px rgba(0, 0, 0, .06); }
.card.dark { background: #1a1a1a; color: #fff; }
.card.dark .muted, .card.dark .kpi .label { color: #cfcfcf; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > .wide { flex: 3 1 460px; min-width: 0; }
.cols > .narrow { flex: 1 1 280px; min-width: 0; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 550; }
.kpi .value { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.2px; }
.tag { display: inline-block; background: var(--grey-bg); color: var(--text); font-size: 12px; font-weight: 550; border-radius: 8px; padding: 2px 8px; }
.badge { display: inline-flex; align-items: center; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 550; line-height: 16px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.grey { background: var(--grey-bg); color: var(--grey); }
.msg { background: #eaf4ff; color: #00527c; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; box-shadow: inset 0 0 0 1px #a4cdf2; }

/* ---------- Tabellen (wie Shopify-Listen) ---------- */
.tablebox { overflow-x: auto; padding: 0; }
.tablebox > h2 { padding: 14px 16px 0; }
.tablebox > form, .tablebox > p { padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 550; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--hover); }
td a { color: var(--text); font-weight: 550; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line-2); background: #fff; display: block; }

/* ---------- Formulare ---------- */
form.inline { display: inline; }
label { display: block; font-size: 13px; font-weight: 450; margin: 0 0 4px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--input); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; background: #fdfdfd; color: var(--text); min-height: 32px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #005bd3; outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font: inherit; font-size: 13px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.fields .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: #303030; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 32px; line-height: 1.2; }
.btn:hover { text-decoration: none; }
.btn.primary, .btn.dark { background: linear-gradient(180deg, #3f3f3f 0%, #303030 100%); color: #fff; box-shadow: 0 -1px 0 1px #000 inset, 0 0 0 1px #303030 inset, 0 .5px 0 1.5px #555 inset; }
.btn.primary:hover, .btn.dark:hover { background: #1a1a1a; }
.btn.ghost { background: #fff; color: var(--text); box-shadow: var(--shadow); font-weight: 550; }
.btn.ghost:hover { background: var(--surface-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { display: flex; gap: 8px; max-width: 520px; flex: 1; }
.linkbtn { background: none; border: 0; color: #005bd3; cursor: pointer; font: inherit; font-size: 13px; padding: 0; }

/* ---------- Diagramme, Checklisten, Bilder ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 4px; }
.bars .seg { background: #303030; border-radius: 3px 3px 0 0; }
.bars .seg.lime { background: var(--lime); border-radius: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.checklist li:last-child { border-bottom: 0; }
.dot { width: 18px; height: 18px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: none; }
.dot.ok { background: #29845a; color: #fff; }
.dot.no { background: var(--grey-bg); color: #8a8a8a; }
.progress { height: 6px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: #29845a; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs figure { margin: 0; width: 120px; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); display: block; background: #fff; }
.thumbs figcaption { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }

/* Wareneingang: Strecke */
.route { display: flex; align-items: center; margin: 14px 0 6px; }
.route .stop { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; position: relative; font-size: 12px; text-align: center; color: var(--muted); }
.route .stop::before { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 3px; background: var(--grey-bg); z-index: 0; }
.route .stop:first-child::before { display: none; }
.route .stop.done::before, .route .stop.now::before { background: #303030; }
.route .pt { width: 20px; height: 20px; border-radius: 999px; background: var(--grey-bg); z-index: 1; border: 3px solid #fff; box-shadow: 0 0 0 1px #d4d4d4; }
.route .stop.done .pt { background: #303030; box-shadow: 0 0 0 1px #303030; }
.route .stop.now .pt { background: var(--lime); box-shadow: 0 0 0 2px #303030; width: 24px; height: 24px; margin-top: -2px; }
.route .stop.now { color: var(--text); font-weight: 600; }

/* ---------- Kontoseite ---------- */
.profile { display: flex; align-items: center; gap: 16px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- Anmeldung ---------- */
.login { display: flex; flex-wrap: wrap; min-height: 100vh; background: #fff; }
.login .left { flex: 1 1 380px; background: #1a1a1a; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.login .left img { width: 110px; }
.login .left h1 { font-size: 34px; line-height: 1.15; }
.login .left p { color: #d9d9d9; max-width: 440px; font-size: 15px; }
.login .right { flex: 1 1 380px; display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--bg); }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; background: #fff; padding: 24px; border-radius: 14px; box-shadow: var(--card-shadow); }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
code.key { display: block; background: var(--surface-2); border-radius: 8px; padding: 10px; font-size: 15px; letter-spacing: 2px; word-break: break-all; }

/* ---------- Handy ---------- */
@media (max-width: 900px) {
  .shell { display: block; }
  .side { position: sticky; top: 0; z-index: 20; width: auto; height: auto; padding: 8px 12px; }
  .side-top { padding: 4px 2px; }
  .side-toggle { display: inline-flex; }
  .side-search, .side-scroll, .side-bottom { display: none; }
  body.nav-open .side { height: 100vh; overflow-y: auto; }
  body.nav-open .side-search, body.nav-open .side-bottom { display: flex; }
  body.nav-open .side-scroll { display: block; }
  .main { padding: 0; }
  .page { border-radius: 0; padding: 16px 16px 40px; min-height: auto; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- Startseite: Suche + Ämtli ---------- */
.bigsearch { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; box-shadow: var(--card-shadow); padding: 6px 6px 6px 14px; margin-bottom: 16px; color: var(--muted); }
.bigsearch input { flex: 1; border: 0; background: none; font-size: 14px; min-height: 36px; padding: 0; }
.bigsearch input:focus { outline: none; }
.bigsearch:focus-within { box-shadow: 0 0 0 2px #005bd3; }
.aemtli-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.aemtli-head h2 { margin: 0; }
.aemtli-ring { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.aemtli-team { position: relative; border-radius: 10px; padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.aemtli-team.now { background: #1a1a1a; color: #fff; box-shadow: 0 0 0 2px var(--lime); }
.aemtli-no { width: 22px; height: 22px; border-radius: 999px; background: var(--grey-bg); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.aemtli-team.now .aemtli-no { background: var(--lime); color: #1a1a1a; }
.aemtli-names { font-weight: 650; font-size: 14px; }
.aemtli-when { font-size: 12px; color: var(--muted); }
.aemtli-team.now .aemtli-when { color: var(--lime); font-weight: 600; }

/* ---------- Listen-Kopf (Tabs + Suchen und filtern) ---------- */
.listbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px !important; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--grey-bg); color: var(--text); }
.listsearch { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); padding: 0 8px; border-radius: 8px; }
.listsearch:focus-within { box-shadow: 0 0 0 2px #005bd3; }
.listsearch input { border: 0 !important; background: none !important; outline: none !important; padding: 0 !important; }

/* ---------- Startseite aus Blöcken ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dash > div > .card, .dash > div > form { margin-bottom: 0; }
.w3 { grid-column: span 3; } .w4 { grid-column: span 4; } .w6 { grid-column: span 6; } .w8 { grid-column: span 8; } .w12 { grid-column: span 12; }
@media (max-width: 1100px) { .w3 { grid-column: span 6; } .w4, .w8 { grid-column: span 12; } }
@media (max-width: 700px) { .w3, .w6 { grid-column: span 12; } }
.blockhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.blockhead h2 { margin: 0; }
.card.compact { padding: 12px 16px; }
.rowline { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.rowline .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 550; }
/* To-do-Liste */
.todo-add { display: flex; gap: 6px; margin-bottom: 6px; }
.todo-add input[type=text] { flex: 1; } .todo-add input[type=date] { width: 140px; flex: none; }
.todo-add .btn { min-width: 36px; font-size: 16px; }
.todo { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.todo-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #8a8a8a; background: #fff; cursor: pointer; flex: none; padding: 0; }
.todo-box:hover { border-color: #303030; background: var(--ok-bg); }
.todo-text { flex: 1; min-width: 0; }
/* Ämtli: letzte / diese / nächste Woche */
.aemtli3 { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 6px; }
.aemtli3 > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aemtli3 > div.now { background: #1a1a1a; color: #fff; box-shadow: 0 0 0 2px var(--lime); }
.aemtli3 .when { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.aemtli3 .now .when { color: var(--lime); }
.aemtli3 .names { font-weight: 650; font-size: 13px; }
.aemtli3 .dates { font-size: 11px; color: var(--muted); }
.aemtli3 .now .dates { color: #cfcfcf; }
/* Datenquellen als Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 4px 10px 4px 8px; font-size: 12px; font-weight: 550; }
.chip i { width: 8px; height: 8px; border-radius: 999px; background: #29845a; }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.bad i { background: #c70a24; }
.chip small { color: var(--muted); font-weight: 400; }

/* ---------- Einstellungen ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.seg-choice { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg-choice label { margin: 0; cursor: pointer; }
.seg-choice input { position: absolute; opacity: 0; pointer-events: none; }
.seg-choice span { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 550; color: var(--muted); }
.seg-choice input:checked + span { background: #fff; color: var(--text); box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.06); }
.seg-choice input:focus-visible + span { outline: 2px solid #005bd3; }
