/* TOPLED Produktionsplanung – Stylesheet
   Optik nach der bestehenden App: hell, feine Rahmen, blaue Primärfarbe,
   Zahlen in Monospace. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --line: #e4e7ec;
  --line-2: #eef0f3;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --primary: #1d5fe0;
  --primary-hover: #174fc2;
  --primary-soft: #eaf1ff;
  --today: #eef4ff;
  --today-line: #a9c4f5;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fff7e6;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --orange: #ea580c;

  /* Auftragstypen */
  --t-gross: #d7c5b5;      --t-gross-b: #8b5e3c;    --t-gross-dot: #8b5e3c;
  --t-klein: #fbe5b5;      --t-klein-b: #e5a50a;    --t-klein-dot: #f2b705;
  --t-ruest: #bfe3f7;      --t-ruest-b: #1a9fe0;    --t-ruest-dot: #1a9fe0;
  --t-express: #fde2e2;    --t-express-b: #dc2626;  --t-express-dot: #dc2626;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
  --hour: 56px; /* Höhe einer Stunde im Kalender */
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.ic { flex: none; vertical-align: middle; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
[data-icon] { display: inline-flex; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text-2);
  cursor: pointer; white-space: nowrap; line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--panel-2); border-color: #d5d9e0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { background: #93b3f0; border-color: #93b3f0; opacity: 1; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: var(--danger-soft); border-color: #f7c9c9; color: var(--danger); }
.btn-danger:hover { background: #fbdcdc; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12.5px; border-radius: 5px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 15px; justify-content: center; }
.btn.is-active { background: var(--primary-soft); border-color: #bcd1fa; color: var(--primary); }
.btn-muted { color: var(--muted-2); }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; padding: 4px 6px; border-radius: 6px; margin-right: 10px; }
.brand img { display: block; width: auto; }
.brand-dark { background: #111; padding: 6px 10px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-right: 14px; }
.mainnav { display: flex; gap: 4px; margin-right: 10px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px; border-radius: 6px;
  font-size: 15px; color: var(--text-2);
}
.nav-btn:hover { background: var(--line-2); }
.nav-btn.active { background: #e9ecf1; color: var(--text); }
.nav-count { font-size: 11px; color: var(--muted); margin-left: 4px; font-family: var(--mono); }
.user-mail { font-size: 12px; color: var(--muted); margin-left: 8px; }
.nav-logout { color: var(--muted); font-size: 14.5px; }
.topbar .btn-primary { height: 32px; font-size: 15px; }

/* Dropdown "Auftrag anlegen" */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: 290px; padding: 6px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 40;
}
.dropdown.open .dropdown-menu { display: block; }
.menu-item {
  display: flex; gap: 12px; width: 100%; padding: 9px 10px; text-align: left;
  border: 0; background: none; border-radius: 7px; cursor: pointer;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item b { display: block; font-size: 14px; font-weight: 600; }
.menu-item small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.menu-ic { color: var(--primary); padding-top: 2px; }
.menu-tip { border-top: 1px solid var(--line); margin-top: 4px; padding: 8px 10px 4px; font-size: 11px; color: var(--muted); }

/* ---------- Seitenkopf ---------- */
.page { padding: 10px 12px 24px; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; min-height: 36px; }
.page-head h1 { font-size: 18px; font-weight: 600; margin: 0; }
.page-head .date { font-size: 13px; color: var(--muted); }
.page-head .spacer { flex: 1; }
.toolbar { display: flex; gap: 6px; align-items: center; }
.toolbar .btn { color: var(--text-2); }
.toolbar .btn-soft { color: var(--muted-2); }

.page-title-block { margin: 8px 0 14px 20px; }
.crumbs { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: var(--primary); text-transform: uppercase; }
.crumbs span { color: #9ab4ea; margin: 0 6px; }
.page-title-block h1 { font-size: 26px; font-weight: 500; margin: 4px 0 2px; letter-spacing: -.01em; }
.page-title-block .date { font-size: 12.5px; color: var(--muted); }
.head-row { display: flex; align-items: flex-start; }
.head-row .toolbar { margin-left: auto; margin-top: 8px; }

/* Hinweisbanner (z. B. "Auftrag … importiert") */
.banner {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 8px;
  background: #e8effc; border: 1px solid #cddcf8; border-radius: 6px; font-size: 13px;
}
.banner .btn { margin-left: auto; }

/* Legende-Leiste */
.legend-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 7px 12px; margin-bottom: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  font-size: 10.5px; color: var(--text-2);
}
.legend-bar .lg-title { color: var(--muted); margin-right: 4px; }
.legend-bar .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend-bar .lg small { color: var(--muted); }
.legend-bar .sep { width: 1px; height: 14px; background: var(--line); margin: 0 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-gross { background: var(--t-gross-dot); }
.dot-klein { background: var(--t-klein-dot); }
.dot-ruest { background: var(--t-ruest-dot); }
.lg-express { color: var(--danger); }
.pill-r { background: var(--primary); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 8px; }
.pill-nf { background: #e11d74; color: #fff; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.lg-paint { color: var(--orange); }

/* ---------- Karten / Panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.card-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.card-head .btn-primary { margin-left: auto; }

/* ---------- Kalender ---------- */
.cal { overflow: hidden; }
.cal-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.cal-range { font-size: 17px; font-weight: 500; margin-left: 6px; }
.cal-toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--panel-2); }
.seg button { border: 0; background: none; padding: 0 10px; height: 26px; border-radius: 4px; cursor: pointer; color: var(--text-2); font-size: 14.5px; }
.seg button.on { background: #e6eaf0; color: var(--text); }
.filter-btn { position: relative; }
.filter-btn .fb-badge { font-size: 11px; background: var(--primary); color: #fff; border-radius: 8px; padding: 1px 6px; }

.cal-grid { display: grid; grid-template-columns: 40px repeat(7, minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-corner { font-size: 10px; color: var(--muted); padding: 8px 6px; border-right: 1px solid var(--line); }
.day-head { padding: 7px 8px 6px; border-right: 1px solid var(--line); position: relative; min-height: 64px; }
.day-head:last-child { border-right: 0; }
.day-head.today { background: var(--today); box-shadow: inset 0 0 0 1px var(--today-line); }
.day-head.today .dh-name { color: var(--primary); }
.day-head.off .dh-state { color: var(--muted); }
.dh-name { font-size: 10.5px; font-weight: 600; text-transform: uppercase; color: var(--text-2); letter-spacing: .01em; }
.dh-load { font-family: var(--mono); font-size: 11px; font-weight: 600; margin-top: 3px; }
.dh-load.over { color: var(--danger); }
.dh-persons { font-size: 9.5px; color: var(--muted); }
.dh-state { font-size: 10.5px; color: var(--text-2); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.dh-state .deliv { color: var(--primary); display: inline-flex; align-items: center; gap: 3px; }
.dh-bar { height: 3px; background: var(--line-2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.dh-bar i { display: block; height: 100%; background: var(--ok); border-radius: 2px; }
.dh-bar i.warn { background: #f59e0b; }
.dh-bar i.over { background: var(--danger); }
.dh-edit { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; }
.dh-edit:hover { background: rgba(0,0,0,.05); color: var(--text); }

.cal-body { height: calc(100vh - 300px); min-height: 360px; overflow-y: auto; position: relative; }
.cal-body .cal-grid { position: relative; }
.time-col { border-right: 1px solid var(--line); }
.time-col div { height: var(--hour); font-family: var(--mono); font-size: 10px; color: var(--text-2); text-align: right; padding: 2px 6px 0 0; }
.day-col {
  position: relative; border-right: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: 100% var(--hour);
}
.day-col:last-child { border-right: 0; }
.day-col.today { background-color: var(--today); }
.day-col.off { background-color: #fafafb; }
.day-col.drop-ok { background-color: #e6f6ec; }
.day-col.drop-bad { background-color: #fdeeee; }
.cap-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #f0a3a3; pointer-events: none; }
.cap-line span { position: absolute; right: 4px; top: -14px; font-size: 9px; color: #d77; font-family: var(--mono); }

/* Auftragskarte im Kalender */
.oc {
  position: absolute; left: 3px; right: 3px;
  border-radius: 4px; border-left: 4px solid; padding: 5px 7px;
  font-size: 11px; line-height: 1.3; overflow: hidden; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: box-shadow .12s, transform .12s;
}
.oc:hover { box-shadow: 0 3px 10px rgba(0,0,0,.16); z-index: 3; }
.oc.dragging { opacity: .45; }
.oc-gross { background: var(--t-gross); border-color: var(--t-gross-b); }
.oc-klein { background: var(--t-klein); border-color: var(--t-klein-b); }
.oc-ruest { background: var(--t-ruest); border-color: var(--t-ruest-b); }
.oc-express { background: var(--t-express); border-color: var(--t-express-b); }
.oc.st-vorgeplant { outline: 1px dashed rgba(0,0,0,.25); outline-offset: -2px; }
.oc.st-abgeschlossen, .oc.st-verrechnet { opacity: .6; }
.oc.risk { box-shadow: inset 0 0 0 2px var(--danger); }
.oc-top { display: flex; align-items: center; gap: 4px; }
.oc-no { font-family: var(--mono); font-weight: 700; font-size: 11px; }
.oc-st { color: var(--text-2); display: inline-flex; }
.oc-cust { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-comm, .oc-type { font-size: 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-meta { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 4px; }
.oc-small .oc-comm, .oc-small .oc-type { display: none; }
.oc-small .oc-meta { margin-top: 2px; }
.oc-tiny { padding: 1px 6px; }
.oc-tiny .oc-cust, .oc-tiny .oc-comm, .oc-tiny .oc-type, .oc-tiny .oc-assign { display: none; }
.oc-tiny .oc-meta { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; height: 17px; padding: 0 5px;
  background: rgba(255,255,255,.85); border-radius: 4px; font-size: 9.5px; font-family: var(--mono); font-weight: 600; white-space: nowrap;
}
.chip-lt { color: var(--orange); border: 1px solid #fbc7a4; background: #fff7f1; font-family: var(--sans); font-weight: 600; }
.chip-lt.late { color: #fff; background: var(--danger); border-color: var(--danger); }
.chip-box { background: var(--primary); color: #fff; }
.chip-nf { background: #e11d74; color: #fff; }
.chip-paint { color: var(--orange); }
.oc-assign { font-size: 9.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 3px; flex-wrap: wrap; }
.emp-chip { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; border-radius: 8px; color: #fff; font-size: 9px; font-weight: 700; }
.oc-lock { color: var(--muted); }

/* Lastleiste "Vom Büro vorbereitet" */
.office { border-top: 1px solid var(--line); }
.office-head, .legend-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; border: 0; background: var(--panel); cursor: pointer; font-size: 14.5px; text-align: left;
}
.office-head .ic:last-child, .legend-head .ic:last-child { margin-left: auto; color: var(--muted); }
.office-row { display: grid; grid-template-columns: 40px repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--panel-2); padding: 6px 0; }
.office-row .lbl { font-size: 9px; color: var(--muted); align-self: center; padding-left: 8px; }
.office-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; }
.office-cell .meter { width: 30px; height: 30px; border-radius: 5px; background: #e9ecf1; position: relative; overflow: hidden; }
.office-cell .meter i { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(135deg, #9ca3af 0 3px, #e5e7eb 3px 6px); }
.office-cell small { font-family: var(--mono); font-size: 9.5px; color: var(--text-2); }
.office-list { padding: 4px 14px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.office-list .chip { cursor: pointer; background: var(--panel-2); border: 1px dashed #c6ccd6; height: 22px; font-size: 11px; }

.legend-card { margin-top: 10px; }
.legend-body { padding: 4px 16px 14px; font-size: 12.5px; color: var(--text-2); display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 28px; }
.legend-body p { margin: 4px 0; }
.legend-head { text-transform: uppercase; font-size: 12.5px; letter-spacing: .03em; color: var(--text-2); border-radius: var(--radius); }

/* Monatsansicht */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-wd { font-size: 10.5px; font-weight: 600; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.month-cell { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; position: relative; }
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell.other { background: #fafafb; color: var(--muted-2); }
.month-cell.today { background: var(--today); }
.month-cell.off { background: #fafafb; }
.mc-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.mc-top b { font-weight: 600; }
.mc-load { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.mc-chips { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.mc-chip { border-left: 3px solid; border-radius: 3px; padding: 1px 5px; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mc-more { font-size: 10.5px; color: var(--muted); }

/* ---------- Tabellen / Auftragsliste ---------- */
.filters { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); align-items: center; }
.search { position: relative; flex: 1; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 36px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.input, .select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
}
.select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .search input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 95, 224, .15);
}
.checks { display: flex; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.list-meta { display: flex; justify-content: space-between; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }
.list-meta .mono { font-size: 10.5px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
.tbl th.num { font-family: var(--sans); font-size: 13px; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: 14px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 14px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.tbl .date { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.tbl .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; font-family: var(--sans); }
.tbl .sub.soon { color: var(--orange); }
.tbl .sub.late { color: var(--danger); font-weight: 600; }
.tbl .no { font-family: var(--mono); font-weight: 700; font-size: 12px; }
.tbl .dash { color: var(--muted-2); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions button { border: 0; background: none; color: var(--text-2); padding: 4px 5px; cursor: pointer; border-radius: 4px; }
.tbl .actions button:hover { background: var(--line-2); }
.tbl .actions button.on { color: var(--danger); }
.tbl th.sortable { cursor: pointer; }
.empty { padding: 50px 20px; text-align: center; font-size: 14px; font-weight: 600; }
.empty .empty-ic { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--ok); margin-bottom: 10px; }

.type-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 5px; border: 1px solid; white-space: nowrap; }
.tb-gross { background: #f3ece6; border-color: #d9c1ad; color: #6b4426; }
.tb-klein { background: #fdf2cf; border-color: #f2d27a; color: #7a5200; }
.tb-ruest { background: #e6f5fd; border-color: #a9daf5; color: #0a6b9c; }
.tb-express { background: var(--danger-soft); border-color: #f5b5b5; color: var(--danger); }

.status-sel {
  height: 30px; padding: 0 28px 0 28px; border: 1px dashed #cfd5de; border-radius: 6px; background-color: var(--panel);
  appearance: none; cursor: pointer; font-size: 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.status-wrap { position: relative; display: inline-flex; align-items: center; }
.status-wrap .ic { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.status-sel.s-geplant, .status-sel.s-produktion, .status-sel.s-teil { border-style: solid; }
.status-sel.s-produktion { border-color: #a9c4f5; background-color: #f3f7ff; }
.status-sel.s-teil { border-color: #f5c29b; background-color: #fff6ef; }
.status-sel.s-abgeschlossen { border-style: solid; border-color: #a8dfbc; background-color: var(--ok-soft); }
.status-sel.s-verrechnet { border-style: solid; border-color: #d5d9e0; background-color: #f3f4f6; color: var(--muted); }
.posdot { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.posdot::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); margin-right: 5px; vertical-align: 1px; }
.posdot.part::before { background: #f59e0b; }
.posdot.full::before { background: var(--ok); }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); padding: 14px 14px 12px; }
.stat-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .02em; }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 6px; }
.stat-value.ok { color: var(--ok); }
.stat-value.bad { color: var(--danger); }
.stat-cap { display: flex; justify-content: space-between; align-items: center; }
.stat-cap .pct { font-size: 18px; color: var(--ok); }
.progress { height: 5px; background: var(--line-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 28px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 100%; max-width: 740px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 56px);
}
.modal-wide { max-width: 1030px; }
.modal-sm { max-width: 440px; }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.modal-head h2 .ic { color: var(--primary); }
.modal-head p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.modal-close { margin-left: auto; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 5px; color: var(--text); }
.modal-close:hover { background: var(--line-2); }
.modal-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.modal-foot .btn { height: 38px; padding: 0 16px; font-size: 14px; }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field-label { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .02em; }
.field > span .req, .field-label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  height: 44px; padding: 0 12px; border: 1px solid #d5d9e0; border-radius: 8px; background: var(--panel); width: 100%; font-size: 14px;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); text-transform: none; font-weight: 400; letter-spacing: 0; }
.field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.form-grid { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dur-wrap { display: flex; gap: 6px; align-items: center; }
.dur-wrap .dur-input { position: relative; width: 92px; flex: none; }
.dur-wrap .dur-input input { padding-right: 34px; }
.dur-wrap .dur-input em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; }
.dur-wrap .dur-text { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.quick button { height: 42px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.quick button:hover { border-color: #c9cfd9; background: #f1f3f6; }
.status-hint { font-size: 11px; color: var(--text-2); margin-top: 6px; line-height: 1.45; }

.box-panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 14px; background: var(--panel-2); }
.box-panel h3 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.box-panel h3 .ic { color: var(--primary); }
.box-legend { display: flex; gap: 12px; font-size: 10px; color: var(--muted); align-items: center; }
.box-legend .r { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #cfd5de; display: inline-block; vertical-align: -1px; margin-right: 3px; }
.box-legend .r.used { background: #e5e7eb; }
.box-legend .r.mine { background: var(--primary); border-color: var(--primary); }
.box-legend .free-count { margin-left: auto; color: var(--text-2); }
.box-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.box-row > label { font-size: 11px; color: var(--text-2); }
.boxes { display: grid; grid-template-columns: repeat(10, 30px); gap: 4px; }
.boxes button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #cfd5de; background: var(--panel); cursor: pointer; font-size: 12px; }
.boxes button:hover:not(:disabled) { border-color: var(--primary); }
.boxes button.used { background: #e5e7eb; color: var(--muted-2); cursor: not-allowed; }
.boxes button.mine { background: var(--primary); border-color: var(--primary); color: #fff; }
.box-next { font-size: 11px; color: var(--text-2); margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.toggle-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.toggle-row .ic { color: var(--text-2); }
.toggle-row input[type=checkbox] { margin-left: auto; width: 16px; height: 16px; accent-color: var(--primary); }
.switch { margin-left: auto; position: relative; width: 32px; height: 18px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #d5d9e0; border-radius: 10px; transition: .15s; }
.switch i::after { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(14px); }

.sub-panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; background: var(--panel-2); }
.sub-panel h3 { margin: 0; font-size: 12.5px; font-weight: 600; }
.sub-panel h3 small { font-weight: 400; color: var(--muted); }
.sub-panel .hint { font-size: 11.5px; color: var(--muted); margin: 3px 0 8px; }
.track-row { display: grid; grid-template-columns: 1fr 160px auto auto; gap: 8px; }
.track-row input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--panel); }
.track-list { margin: 8px 0 0; padding: 0; list-style: none; }
.track-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin-top: 4px; font-family: var(--mono); font-size: 12px; }
.track-list li small { font-family: var(--sans); color: var(--muted); }
.track-list li button { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); }
.emp-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.emp-pick button { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; font-size: 14px; }
.emp-pick button .d { width: 9px; height: 9px; border-radius: 50%; }
.emp-pick button.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.emp-note { font-size: 11px; color: var(--muted); margin-top: 8px; }
.type-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; align-items: end; }
.type-box { height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; border: 1px solid; font-size: 13px; font-weight: 500; }
.type-box select { border: 0; background: transparent; font-weight: 500; width: 100%; height: 100%; cursor: pointer; }
.express-box { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 8px; border: 1px solid #f7c3c3; background: #fff3f3; color: var(--danger); font-weight: 600; cursor: pointer; }
.express-box input { width: 18px; height: 18px; accent-color: var(--danger); }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lock-note { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.lock-note button { border: 0; background: none; color: var(--primary); cursor: pointer; font-size: 11px; padding: 0; }
.warn-box { display: flex; gap: 8px; padding: 9px 12px; border-radius: 8px; background: var(--warn-soft); border: 1px solid #f6d79b; color: #8a4b00; font-size: 12.5px; margin-top: 10px; }
.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-2); margin: 14px 0 6px; letter-spacing: .02em; }

/* Positionen */
.pos-head { display: flex; align-items: center; gap: 10px; }
.pos-head h3 { font-size: 14px; margin: 0; }
.pos-head small { color: var(--muted); font-size: 11.5px; display: block; margin-top: 2px; }
.pos-head .btn { margin-left: auto; height: 38px; }
.pos-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.pos {
  display: grid; grid-template-columns: 26px 56px 80px 70px 1fr 100px 30px; gap: 8px; align-items: end;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel);
}
.pos.done { background: #f5fbf7; border-color: #cfe9d8; }
.pos label { display: flex; flex-direction: column; gap: 2px; font-size: 10px; font-weight: 600; color: var(--text-2); min-width: 0; }
.pos input[type=text], .pos input:not([type]) { height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; font-size: 12px; width: 100%; }
.pos .title-in { grid-column: 2 / 7; }
.pos .chk { align-self: center; width: 18px; height: 18px; accent-color: var(--ok); }
.pos .del { border: 0; background: none; color: var(--muted); cursor: pointer; align-self: center; }
.pos .warn { border-color: #f5a5a5 !important; box-shadow: 0 0 0 2px rgba(220,38,38,.08); }

/* Notizen, Banner */
.notice { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin: 8px 0; border: 1px solid; }
.notice-ok { background: var(--ok-soft); border-color: #b9e5c9; color: #14532d; font-weight: 600; }
.notice-error { background: var(--danger-soft); border-color: #f5b5b5; color: #991b1b; }
.notice-warn { background: var(--warn-soft); border-color: #f6d79b; color: #8a4b00; }
.notice-info { background: #eef4ff; border-color: #cddcf8; color: #1e3a8a; }

/* QR-Import */
.drop {
  border: 1px dashed #cfd5de; border-radius: 10px; padding: 22px; text-align: center; background: var(--panel-2);
}
.drop .ic { color: var(--primary); }
.drop b { display: block; margin: 8px 0 4px; }
.drop small { color: var(--muted); display: block; margin-bottom: 10px; }
.qr-video { width: 100%; max-height: 300px; background: #000; border-radius: 8px; margin-top: 10px; object-fit: cover; }
.qr-text { width: 100%; min-height: 90px; font-family: var(--mono); font-size: 12px; border: 1px solid #d5d9e0; border-radius: 8px; padding: 10px; }
.qr-table td input { height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; width: 100%; font-size: 12.5px; }
.qr-table td { padding: 6px; }
.qr-table td.st { font-size: 11px; white-space: nowrap; }
.qr-table .err { color: var(--danger); }
.qr-table .ok { color: var(--ok); }

/* ---------- Einstellungen (Seitenleiste) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .35); z-index: 100; display: flex; justify-content: flex-end; }
.drawer {
  width: 400px; max-width: 100%; height: calc(100vh - 16px); margin: 8px; background: var(--panel); border-radius: 14px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.drawer .modal-head h2 { font-size: 18px; }
.drawer .modal-head p { font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.drawer .modal-body { padding: 14px 16px; background: var(--panel); }
.s-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel-2); }
.s-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.s-card p { margin: 0 0 8px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.s-card.danger { background: #fdf0f0; border-color: #f2b8b8; }
.s-plain { margin-bottom: 14px; }
.s-plain h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.s-plain p { margin: 0 0 8px; font-size: 12px; color: var(--text-2); }
.logo-prev { background: #fff; border-radius: 8px; padding: 16px; display: flex; justify-content: center; margin: 10px 0; }
.logo-prev.dark { background: #111; }
.range-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-top: 6px; }
.range-row span { font-family: var(--mono); font-weight: 400; color: var(--text-2); font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--primary); }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.radio-card input { width: 17px; height: 17px; accent-color: var(--primary); margin: 1px 0 0; flex: none; }
.radio-card b { font-size: 14px; font-weight: 600; display: block; }
.radio-card small { font-size: 11.5px; color: var(--text-2); display: block; margin-top: 4px; line-height: 1.4; }
.db-ok { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.db-ok i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.db-ok.bad i { background: var(--danger); }
.wd-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.wd-pick button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.wd-pick button.on { background: #e8f0fe; border-color: #bcd1fa; color: var(--primary); }
.emp-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px; margin-top: 8px; }
.emp-card .row1 { display: grid; grid-template-columns: 1fr 64px; gap: 8px; }
.emp-card input { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; width: 100%; }
.emp-card .row2 { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.emp-card .row2 input { width: 64px; height: 34px; }
.emp-card .row3 { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.colors { display: grid; grid-template-columns: repeat(3, 22px); gap: 7px; }
.colors button { width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; position: relative; padding: 0; }
.colors button.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }
.colors button.on::after { content: ''; position: absolute; left: 7px; top: 4px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.emp-tools { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.emp-tools button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; }
.emp-tools button:disabled { opacity: .35; cursor: default; }
.count-pill { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 11.5px; color: var(--text-2); background: var(--panel); margin-bottom: 8px; }
.drawer .modal-foot { justify-content: flex-end; background: var(--panel-2); border-radius: 0 0 14px 14px; }

/* Toasts */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow-lg); max-width: 520px; }
.toast.error { background: var(--danger); }
.toast.ok { background: #14532d; }

/* Popover für Tagesausnahme */
.popover { position: absolute; z-index: 50; width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px; }
.popover h4 { margin: 0 0 8px; font-size: 13px; }
.popover .field input { height: 36px; }
.popover .row { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* Tooltip */
[data-tip] { position: relative; }
.tip {
  position: fixed; z-index: 300; background: #fff; color: var(--text); border: 1px solid #333; padding: 3px 7px; font-size: 12px; pointer-events: none; white-space: nowrap;
}

/* ---------- Login / Installation ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth-logo { margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.form-section h2 { font-size: 14px; margin: 18px 0 8px; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checklist .ok { color: var(--ok); }
.checklist .bad { color: var(--danger); font-weight: 600; }

/* ---------- Vollbild / Tablet / Druck ---------- */
body.fullscreen .topbar { display: none; }
body.fullscreen .cal-body { height: calc(100vh - 210px); }

@media (max-width: 1280px) {
  .user-mail, .brand-sub { display: none; }
  .legend-bar { font-size: 10px; }
}
@media (max-width: 1000px) {
  .nav-btn { font-size: 13.5px; padding: 0 7px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pos { grid-template-columns: 26px 50px 64px 60px 1fr 80px 26px; }
}
@media print {
  .topbar, .toolbar, .legend-bar, .cal-toolbar .btn, .seg, .filter-btn, .office, .legend-card, .dh-edit { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .card { box-shadow: none; }
  .cal-body { height: auto !important; overflow: visible; }
  .oc { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
