/* =====================================================================
   TimeDesk · Produkt-Ebene (v4, November 2026)
   ---------------------------------------------------------------------
   Liegt über style.css und macht die Oberfläche „aus einem Guss":
     A  Rollen & Debug-Modus (Sichtbarkeit)
     B  Bausteine: Segmente, Blätter (Sheets), Hinweise, Badges
     C  App-Rahmen mobil: Kopfzeile, Unternavigation, Tab-Leiste, Konto
     D  Diagnose (Einstellungen, nur Admins)
     E  Kalender
     F  Aufgaben (Buchungsliste)
     G  Tickets & Team
     H  Tagesansicht (mobil zuerst) + Zeitabschnitt-Editor
     I  Dialoge & Feinschliff
     J  Bestellungen (Material)
   Grundsatz: mobil zuerst, Touch-Ziele ≥ 44 px, nie 100vw/100vh in
   Vollbild-Flächen (Body ist auf den Viewport genagelt), keine Emojis.
   ===================================================================== */

:root {
  --tabbar-h: 58px;
  --subnav-h: 52px;
  --sheet-radius: 18px;
  --field-h: 48px;
  --chip-h: 34px;
}

/* ── A · Rollen & Debug-Modus ─────────────────────────────────────── */
.admin-only { display: none !important; }
html.td-admin .admin-only { display: revert !important; }
html.td-admin .settings-nav-item.admin-only,
html.td-admin .sheet-item.admin-only { display: flex !important; }
html.td-admin .settings-pane.admin-only:not(.active) { display: none !important; }
html.td-admin .settings-pane.admin-only.active { display: block !important; }
html.td-admin .user-dropdown-item.admin-only { display: block !important; }

.debug-only { display: none !important; }
html.td-debug .debug-only { display: revert !important; }
html.td-debug a.debug-only, html.td-debug button.debug-only { display: inline-flex !important; }
/* Die Prozesskarte blendet den Dynamics-Button erst nach Erfolg ein – .hidden gewinnt */
html.td-debug .debug-only.hidden { display: none !important; }

.debug-badge {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px; margin-left: 6px;
  border-radius: 999px;
  font: 700 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--warn-ink); background: var(--warn-soft);
  border: 1px solid color-mix(in oklch, var(--warn) 55%, transparent);
  cursor: pointer; flex-shrink: 0;
}
.debug-badge[hidden] { display: none; }

/* D365-Links im Debug-Modus: dezent als externe Links erkennbar */
.is-d365-link { text-decoration: none; }
.is-d365-link .d365-ext { font-size: .85em; margin-left: 3px; opacity: .6; }
.is-d365-link:hover { text-decoration: underline; }
.booking-ctx-item--debug { color: var(--warn-ink) !important; }
.booking-ctx-item--debug .ctx-ico { color: var(--warn-ink) !important; }

/* ── B · Bausteine ────────────────────────────────────────────────── */
/* Segmente (iOS-Stil): eine Auswahl aus 2–4 Möglichkeiten */
.seg {
  display: inline-flex; align-items: stretch; gap: 2px;
  padding: 3px; border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  min-width: 0;
}
.seg--fill { display: flex; width: 100%; }
.seg-btn {
  flex: 1 1 0; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 10px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active, .seg-btn[aria-pressed="true"], .seg-btn[aria-selected="true"] {
  background: var(--surface); color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(15,23,42,.10), 0 0 0 1px var(--line);
}
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg--sm .seg-btn { height: 30px; font-size: 12.5px; padding: 0 9px; }
.seg-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font: 600 11px/1 var(--mono);
  background: var(--surface-3); color: var(--ink-3);
}
.seg-count:empty { display: none; }
.seg-btn.is-active .seg-count { background: var(--accent-soft); color: var(--accent-ink); }

/* Blätter: unten andockende Fläche (mobil), mittiger Dialog (Desktop) */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-end; justify-content: center;
  background: oklch(0.2 0.02 250 / 0);
  transition: background .2s var(--ease);
}
.sheet-overlay.is-open { background: oklch(0.2 0.02 250 / .42); }
.sheet {
  position: relative;
  width: 100%; max-width: 520px; max-height: calc(100% - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: calc(var(--safe-bottom) + 10px);
  transform: translateY(100%);
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.sheet-overlay.is-open .sheet { transform: none; }
.sheet-grip { width: 38px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 8px auto 2px; flex-shrink: 0; }
@media (min-width: 881px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: var(--sheet-radius); padding-bottom: 10px; transform: translateY(16px) scale(.98); opacity: 0; transition: transform .2s var(--ease), opacity .2s var(--ease); }
  .sheet-overlay.is-open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-overlay { transition: none; } }

.sheet-list { display: flex; flex-direction: column; padding: 6px 10px 4px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 52px; padding: 0 12px;
  border-radius: 12px;
  font-size: 15.5px; font-weight: 500; color: var(--ink); text-align: left;
}
.sheet-item > svg:first-child { width: 21px; height: 21px; color: var(--ink-3); flex-shrink: 0; }
.sheet-item > span { flex: 1; min-width: 0; }
.sheet-item:hover, .sheet-item:active { background: var(--surface-2); }
.sheet-item .sheet-chev { width: 18px; height: 18px; color: var(--ink-4); flex-shrink: 0; }
.sheet-item--danger, .sheet-item--danger > svg:first-child { color: var(--danger-ink); }
.sheet-foot { padding: 6px 22px 2px; font: 500 11px/1.4 var(--mono); color: var(--ink-4); text-align: center; }

.avatar.avatar--lg { width: 48px; height: 48px; font-size: 17px; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* Hinweis-Meldungen (Toasts): gestapelt, über Tab-Leiste & Footern */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 20px);
  z-index: 30000;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  width: min(480px, calc(100% - 24px));
  pointer-events: none;
}
.toast-stack .toast {
  position: static; transform: translateY(10px); left: auto; bottom: auto;
  max-width: 100%; width: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px 12px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.4;
  background: oklch(0.25 0.02 250); color: #fff; border: none;
  box-shadow: 0 10px 30px -10px rgba(15,23,42,.45);
  pointer-events: auto;
}
.toast-stack .toast--visible { transform: none; }
.toast-stack .toast::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: oklch(0.8 0.08 223);
}
.toast-stack .toast--success::before { background: oklch(0.78 0.15 156); }
.toast-stack .toast--error { background: oklch(0.36 0.12 27); }
.toast-stack .toast--error::before { background: oklch(0.82 0.11 27); }
.toast-stack .toast--warn::before, .toast-stack .toast--warning::before { background: var(--warn); }
.toast-msg { flex: 1; min-width: 0; white-space: pre-line; }
.toast-action {
  flex-shrink: 0; margin: -4px -4px -4px 4px; padding: 6px 10px; border-radius: 8px;
  font-weight: 700; font-size: 13px; color: oklch(0.85 0.09 223);
}
.toast-action:hover { background: rgba(255,255,255,.08); }

/* ── C · App-Rahmen mobil (≤ 880 px) ──────────────────────────────── */
.tabbar, .mobile-subnav { display: none; }

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
  }
  .mobile-topbar { grid-row: 1; }
  .mobile-subnav { grid-row: 2; }
  .main          { grid-row: 3; padding-bottom: 0 !important; min-height: 0; }
  .tabbar        { grid-row: 4; }

  /* Kopfzeile: großer Titel links, Aktionen rechts – kein Hamburger mehr */
  .mobile-menu-btn { display: none !important; }
  .mobile-topbar { gap: 6px; padding-left: 16px; padding-right: 10px; border-bottom-color: transparent; }
  body.has-subnav .mobile-topbar { border-bottom: none; }
  .mobile-topbar-brand { gap: 10px; }
  .mobile-topbar-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .mobile-topbar-title { font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
  .mobile-topbar-actions { display: flex; align-items: center; gap: 2px; }
  .mobile-action-btn { width: 44px; height: 44px; border-radius: 12px; color: var(--ink-2); }
  .mobile-action-btn .avatar--xs { width: 32px; height: 32px; font-size: 12px; }
  .mobile-refresh-btn.is-spinning svg { animation: td-spin .8s linear infinite; }

  .mobile-subnav {
    display: block;
    padding: 4px 14px 10px;
    background: color-mix(in oklch, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    z-index: 49;
  }
  .mobile-subnav[hidden] { display: none; }
  .mobile-subnav .seg[hidden] { display: none; }
  .mobile-subnav .seg-btn { height: 38px; font-size: 14px; }

  /* Tab-Leiste */
  .tabbar {
    display: flex; align-items: stretch; justify-content: space-around;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 0 calc(6px + var(--safe-left, 0px)) var(--safe-bottom);
    background: color-mix(in oklch, var(--surface) 92%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    z-index: 60;
  }
  .tabbar-item {
    position: relative;
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding-top: 2px;
    color: var(--ink-3);
    font-size: 11px; font-weight: 600; letter-spacing: .01em;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar-item svg {
    width: 24px; height: 24px; padding: 3px 14px; box-sizing: content-box;
    border-radius: 999px;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .tabbar-item.is-active { color: var(--accent-ink); }
  .tabbar-item.is-active svg { background: var(--accent-soft); }
  .tabbar-item:active svg { background: var(--surface-3); }
  .tabbar-badge {
    position: absolute; top: 4px; left: calc(50% + 10px);
    min-width: 17px; height: 17px; padding: 0 5px;
    border-radius: 999px; background: var(--danger); color: #fff;
    font: 700 10px/17px var(--mono); text-align: center;
  }
  .tabbar-badge[hidden] { display: none; }

  /* Drawer wird nicht mehr gebraucht */
  .sidebar { display: none !important; }
  .drawer-backdrop { display: none !important; }

  /* FAB über der Tab-Leiste */
  #btn-new-stoerung { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px) !important; }
  .toast-stack { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); }
  /* In Vollbild-Flächen (Tagesansicht, Dialoge) gibt es keine Tab-Leiste */
  body.has-fullscreen .toast-stack { bottom: calc(var(--safe-bottom) + 92px); }

  /* In-View-Überschriften doppeln den Titel der Kopfzeile → mobil weg */
  .vw-h1, .tk-h1 { display: none; }
  .vw-title-block, .tk-title-block { min-height: 0; }
}

/* Konto-Blatt */
.account-head { display: flex; align-items: center; gap: 14px; padding: 10px 18px 14px; }
.account-head-text { flex: 1; min-width: 0; }
.account-name { font-size: 17px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-mail { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-close { flex-shrink: 0; }
.account-sync {
  display: flex; align-items: center; gap: 12px;
  margin: 0 16px 6px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
}
.account-sync .sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; }
.account-sync.zalaris-state-ok .sync-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.account-sync.zalaris-state-syncing .sync-dot,
.account-sync.zalaris-state-refreshing .sync-dot { background: var(--warn); }
.account-sync.zalaris-state-error .sync-dot { background: var(--danger); }
.account-sync-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-sync-label { font-size: 14px; font-weight: 600; }
.account-sync-sub { font-size: 12.5px; color: var(--ink-3); }

@keyframes td-spin { to { transform: rotate(360deg); } }

/* ── D · Diagnose (Einstellungen › Diagnose) ──────────────────────── */
.diag-h { margin: 22px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.diag-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.diag-info {
  display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  user-select: text; -webkit-user-select: text;
}
.diag-kv { display: contents; }
.diag-k, .diag-v { padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.diag-k { color: var(--ink-3); background: var(--surface-2); }
.diag-v { color: var(--ink); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.diag-kv:last-child .diag-k, .diag-kv:last-child .diag-v { border-bottom: none; }
.diag-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.diag-search { flex: 1 1 220px; min-width: 0; }
.diag-mine { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.settings-pane[data-pane="diagnose"]:not(.diag--server) .diag-mine { display: none; }
.diag-log {
  height: 360px; overflow: auto;
  background: oklch(0.22 0.015 250); color: oklch(0.92 0.01 250);
  border-radius: 12px; padding: 8px 0;
  font: 500 11.5px/1.5 var(--mono);
  user-select: text; -webkit-user-select: text;
  overscroll-behavior: contain;
}
.diag-line { display: flex; gap: 10px; padding: 1px 12px; white-space: pre-wrap; word-break: break-word; }
.diag-line:hover { background: rgba(255,255,255,.04); }
.diag-ts { color: oklch(0.65 0.02 250); flex-shrink: 0; }
.diag-user { color: oklch(0.78 0.08 223); flex-shrink: 0; }
.diag-src { color: oklch(0.82 0.11 80); flex-shrink: 0; }
.diag-msg { min-width: 0; }
.diag-line--warn .diag-msg { color: oklch(0.88 0.12 85); }
.diag-line--error .diag-msg { color: oklch(0.80 0.13 27); }
.diag-line--debug .diag-msg { color: oklch(0.70 0.02 250); }
.diag-empty { padding: 24px; text-align: center; color: oklch(0.7 0.02 250); font-family: var(--font); }
.diag-log.is-jobs { background: var(--surface-2); color: var(--ink); padding: 8px; font-family: var(--font); }
.diag-log.is-jobs .diag-empty { color: var(--ink-3); }
.diag-job { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 6px; }
.diag-job summary { display: flex; gap: 10px; align-items: center; padding: 9px 12px; cursor: pointer; font-size: 13px; }
.diag-job-type { font-weight: 600; flex: 1; }
.diag-job-status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); }
.diag-job--done .diag-job-status { background: var(--ok-soft); color: var(--ok-ink); }
.diag-job--error .diag-job-status { background: var(--danger-soft); color: var(--danger-ink); }
.diag-job--running .diag-job-status { background: var(--accent-soft); color: var(--accent-ink); }
.diag-job-time { font: 500 11.5px var(--mono); color: var(--ink-3); }
.diag-job-err { margin: 0 12px 8px; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger-ink); font-size: 12.5px; user-select: text; }
.diag-steps { margin: 0 12px 6px 30px; font-size: 12.5px; color: var(--ink-2); }
.diag-step em { display: block; font-style: normal; color: var(--ink-3); font-size: 11.5px; }
.diag-step--error { color: var(--danger-ink); }
.diag-step--done { color: var(--ok-ink); }
.diag-job-id { margin: 0 12px 10px; font-size: 11px; color: var(--ink-4); user-select: text; }
.diag-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.diag-count { font: 500 12px var(--mono); color: var(--ink-3); }
.diag-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.settings-pane[data-pane="diagnose"]:not(.diag--jobs) #diag-clear { display: inline-flex; }
.settings-pane[data-pane="diagnose"].diag--jobs .diag-level-seg,
.settings-pane[data-pane="diagnose"].diag--jobs .diag-search,
.settings-pane[data-pane="diagnose"].diag--jobs #diag-clear,
.settings-pane[data-pane="diagnose"].diag--server #diag-clear { display: none; }
/* Diagnose braucht keine Speichern/Abbrechen-Leiste */
.settings-modal.is-diagnose .settings-foot { display: none; }
@media (max-width: 880px) {
  .diag-log { height: calc(100dvh - 420px); min-height: 260px; }
  .diag-info { grid-template-columns: minmax(0, 1fr); }
  .diag-k { border-bottom: none; padding-bottom: 0; background: none; font-size: 11.5px; }
  .diag-v { padding-top: 2px; }
}

/* ── E · Kalender ─────────────────────────────────────────────────── */
.week-range { display: none; }
.btn-today { height: 34px; padding: 0 12px; font-weight: 600; margin-right: 6px; }
#topbar-calendar-actions { align-items: center; }

/* Tageszustand: ✓ = alles eingetragen, Punkt = noch offen */
.day-state { display: none; }
.day-state--done .day-state, .day-state--open .day-state {
  display: inline-grid; place-items: center; flex-shrink: 0;
}
.day-state--done .day-state { width: 16px; height: 16px; border-radius: 50%; background: var(--ok-soft); color: var(--ok-ink); }
.day-state--done .day-state svg { width: 10px; height: 10px; }
.day-state--open .day-state { width: 8px; height: 8px; margin: 0 4px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.day-cell.other-month .day-state { display: none; }

/* Gerade gespeicherter / angesprungener Tag: kurzes Aufleuchten */
.day-cell--updated { animation: td-day-flash 2.4s ease-out; }
@keyframes td-day-flash {
  0%, 30% { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
  100% { }
}
@media (prefers-reduced-motion: reduce) { .day-cell--updated { animation: none; outline: 2px solid var(--accent); } }

/* Stiller Abgleich im Hintergrund: feine Laufleiste unter dem Monatskopf */
.cal-panel { position: relative; }
.cal-panel:has(#calendar.is-syncing) .cal-panel-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: td-sync-bar 1.1s linear infinite;
}
.cal-panel-head { position: relative; }
@keyframes td-sync-bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* Lade-Skelett statt „Lade …"-Text */
.cal-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.cal-skel-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-skel-row span {
  height: 64px; border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: td-shimmer 1.3s ease-in-out infinite;
}
@keyframes td-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .cal-skel-row span, .cal-panel:has(#calendar.is-syncing) .cal-panel-head::after { animation: none; } }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty-state-text { max-width: 360px; font-size: 14px; line-height: 1.5; }
.empty-state--error .empty-state-text { color: var(--danger-ink); }

@media (max-width: 880px) {
  /* Raster passt ohne Querscrollen auf jeden Bildschirm */
  #calendar.cal-view--grid { min-width: 0 !important; overflow-x: hidden !important; }
  #calendar.cal-view--grid .calendar-header,
  #calendar.cal-view--grid .week-row { min-width: 0 !important; grid-template-columns: 42px repeat(7, minmax(0, 1fr)) !important; }
  #calendar.cal-view--grid .day-cell { min-height: 76px; padding: 6px 4px 5px; gap: 3px; }
  #calendar.cal-view--grid .day-header-cell { gap: 2px; flex-wrap: nowrap; }
  #calendar.cal-view--grid .day-total { font-size: 9.5px; letter-spacing: -.02em; }
  #calendar.cal-view--grid .day-state--open .day-state { position: absolute; top: 5px; right: 4px; margin: 0; width: 6px; height: 6px; box-shadow: none; }
  #calendar.cal-view--grid .day-state--done .day-state { display: none; }
  #calendar.cal-view--grid .zalaris-tag { display: none; }
  #calendar.cal-view--grid .timeline-container { height: 10px; }
  #calendar.cal-view--grid .week-label { padding: 6px 3px; gap: 4px; }
  #calendar.cal-view--grid .week-number::before { content: ""; }
  #calendar.cal-view--grid .week-hours { display: none; }
  #calendar.cal-view--grid .week-progress-outer { max-width: 32px; height: 4px; }
  #calendar.cal-view--grid .week-pct { font-size: 9.5px; padding: 1px 4px; }
  #calendar.cal-view--grid .week-done-ico { width: 9px; height: 9px; }
  #calendar.cal-view--grid .oncall-gutter-label { display: none; }
}

@media (max-width: 640px) {
  /* Monatskopf: eine Zeile – Monat, Heute, Ansicht (Aktualisieren steckt oben rechts) */
  .cal-panel-head {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-areas: "nav actions toggle" !important;
    column-gap: 6px; row-gap: 0;
    min-height: 54px; padding: 8px 10px 8px 6px !important;
  }
  #topbar-calendar-nav { justify-self: start !important; }
  #btn-refresh-calendar { display: none !important; }
  .btn-today { margin-right: 0; height: 36px; }
  .month-display-btn { font-size: 17px; min-width: 0 !important; padding: 0 6px; }
  #cal-view-toggle { grid-area: toggle; padding: 2px; border-radius: 10px; }
  #cal-view-toggle .cvt-btn { width: 38px; height: 32px; padding: 0; gap: 0; }
  #cal-view-toggle .cvt-btn span { display: none; }

  /* Liste: jede Woche eine klare Einheit mit waagerechtem Kopf (KW · Zeitraum · Stunden · 100%-Pill) */
  #calendar.cal-view--list { padding: 10px 12px 16px; }
  #calendar.cal-view--list .week-row {
    display: flex !important; flex-direction: column !important;
    margin-bottom: 14px; border-radius: 16px;
  }
  #calendar.cal-view--list .week-label {
    display: flex !important;
    flex-direction: row !important; flex-wrap: wrap !important;
    align-items: center !important; justify-content: space-between !important;
    gap: 8px 10px !important; padding: 10px 14px !important;
    border-right: none !important; border-bottom: 1px solid var(--line) !important;
  }
  #calendar.cal-view--list .week-head-top {
    display: flex; flex-direction: row; align-items: baseline; gap: 7px;
  }
  #calendar.cal-view--list .week-number { font-size: 13px; font-weight: 700; color: var(--ink); }
  #calendar.cal-view--list .week-number::before { color: var(--ink-3); }
  #calendar.cal-view--list .week-range { display: inline; font-size: 12px; color: var(--ink-3); font-weight: 500; }
  #calendar.cal-view--list .week-meter {
    display: contents;
  }
  #calendar.cal-view--list .week-hours {
    display: inline; order: 2; margin-left: auto;
    font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums;
  }
  #calendar.cal-view--list .week-pct {
    display: inline-flex !important; order: 3;
    font-size: 11.5px; font-weight: 700; line-height: 1.15;
  }
  #calendar.cal-view--list .week-progress-outer {
    order: 10; flex: 1 0 100% !important; width: 100% !important; max-width: none !important;
    height: 5px !important; min-height: 0 !important;
    border: none; border-radius: 999px; background: var(--line);
  }
  #calendar.cal-view--list .week-progress-bar {
    height: 100% !important; border-radius: 999px;
    transition: width .35s cubic-bezier(.4,0,.2,1);
  }
  #calendar.cal-view--list .week-row .day-cell {
    grid-column: 1 !important;
    grid-template-columns: 40px minmax(0, 1fr) auto 18px !important;
    grid-template-areas:
      "name strip meta state"
      "date strip meta state"
      "oncall oncall oncall oncall" !important;
    column-gap: 12px !important;
    min-height: 60px; padding: 9px 12px 9px 10px !important;
  }
  #calendar.cal-view--list .day-cell .day-state { grid-area: state; justify-self: center; }
  #calendar.cal-view--list .day-cell .day-total { font-size: 13px; }
  #calendar.cal-view--list .day-cell:active { background: var(--surface-2); }
  #calendar.cal-view--list .day-cell.today { box-shadow: inset 3px 0 0 var(--accent) !important; }
  .cal-skel-row { grid-template-columns: 1fr; }
  .cal-skel-row span:nth-child(n+2) { display: none; }
}
@media (max-width: 640px) {
  .month-display-btn { white-space: nowrap; font-size: 16.5px !important; letter-spacing: -.01em; }
  #btn-prev-month, #btn-next-month { width: 34px; min-width: 34px; height: 36px; padding: 0; }
}

/* ── H · Tagesansicht ─────────────────────────────────────────────── */
/* Kopf: Tag zurück · Datum + Summe · Tag vor · (Bereich) · Schließen */
.dv-header { gap: 6px; padding-top: 10px; padding-bottom: 10px; }
.dv-head-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.dv-head-date { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.dv-header strong.dv-head-date { flex: 0 1 auto; }
.dv-date-short { display: none; }
.dv-today-chip { font: 700 10.5px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 7px; border-radius: 999px; align-self: center; }
.dv-head-sum { font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dv-head-spacer { flex: 0 0 auto; }
.dv-day-nav { color: var(--ink-2); }
.dv-card.is-switching { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* Geplanter Tag: Kopf mit Summe, Aktionen mit „Zeitabschnitt" */
.dv-slots-header { display: flex; align-items: baseline; gap: 10px; }
.dv-plan-sum { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.dv-plan-sum .readout { color: var(--ink); }
.dv-plan-target { color: var(--ink-3); font-weight: 500; }
.dv-panel-actions { align-items: center; }
.dv-actions-spacer { flex: 1; }
.dv-btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-ink); background: var(--surface); border: 1px solid var(--accent-line);
  font-weight: 600;
}
.dv-btn-add:hover { background: var(--accent-soft); }
.dv-plan-cards { display: none; }
.dv-slot-name--link { cursor: pointer; }
.dv-slot-name--link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.dv-sel-pulse { animation: td-sel-pulse 1.3s ease-out; }
@keyframes td-sel-pulse { 0%, 40% { box-shadow: 0 0 0 4px color-mix(in oklch, var(--dv-sel-color, var(--accent)) 45%, transparent); } }

/* ── Telefon & Tablet hochkant: Karten statt Tabelle ── */
@media (max-width: 880px) {
  .dv-overlay { padding: 0 !important; align-items: stretch !important; justify-content: stretch !important; background: var(--surface) !important; backdrop-filter: none !important; }
  .dv-card {
    width: 100% !important; max-width: 100% !important;
    height: 100% !important; max-height: 100% !important;
    border-radius: 0 !important; border: none !important; box-shadow: none !important; animation: none !important;
  }
  .dv-header {
    padding: calc(var(--safe-top) + 6px) calc(var(--safe-right, 0px) + 6px) 6px calc(var(--safe-left, 0px) + 4px) !important;
    gap: 2px; min-height: calc(var(--safe-top) + 58px);
  }
  .dv-header .btn-icon { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 12px; }
  .dv-date-long { display: none; }
  .dv-date-short { display: inline; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
  .dv-head-title { justify-content: center; flex-direction: column; align-items: center; gap: 1px; }
  .dv-head-date { gap: 6px; }
  .dv-head-sum { font-size: 12.5px; color: var(--ink-3); }
  .dv-time-filter-btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .dv-oncall { padding: 8px 14px; }

  /* Zeitstrahl: kompakt, gut treffbar; Stunden nur jede zweite beschriftet */
  .dv-timeline-wrap { padding: 6px calc(var(--safe-right, 0px) + 10px) 8px calc(var(--safe-left, 0px) + 10px) !important; border-bottom: 1px solid var(--line); }
  .dv-ruler { height: 18px !important; }
  .dv-ruler-tick { font-size: 10px !important; }
  .dv-ruler-tick--odd { display: none !important; }
  .dv-track { height: 76px !important; border-radius: 12px !important; }
  .dv-touchbar, .dv-hint, .dv-seg { display: none !important; }

  /* Unterer Bereich: Karten scrollen, Aktionen kleben unten */
  .dv-panel { display: none !important; }
  .dv-slots-section {
    display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0;
    padding: 0 !important; background: var(--bg) !important; border-top: none !important;
  }
  .dv-slots-header {
    padding: 12px 16px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
  }
  .dv-slots-header .dv-plan-sum { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 13px; }
  .dv-slots-wrap { display: none !important; }
  .dv-plan-cards {
    display: flex; flex-direction: column; gap: 8px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 4px 12px 16px;
  }
  .dv-panel-actions {
    display: flex !important; flex-shrink: 0; gap: 8px; margin: 0 !important;
    padding: 10px calc(var(--safe-right, 0px) + 12px) calc(var(--safe-bottom) + 10px) calc(var(--safe-left, 0px) + 12px) !important;
    background: var(--surface) !important; border-top: 1px solid var(--line);
  }
  .dv-panel-actions .btn { flex: 1 1 0; min-height: 50px; font-size: 15px; border-radius: 14px; justify-content: center; }
  .dv-actions-spacer { display: none; }
  .dv-btn-add { flex: 1.15 1 0 !important; }
  #dv-panel-error { margin: 0 12px 8px; }
}

/* Karte eines Abschnitts */
.dvc {
  position: relative; width: 100%;
  display: grid; grid-template-columns: 4px 74px minmax(0, 1fr) auto auto; align-items: center; column-gap: 12px;
  min-height: 64px; padding: 10px 12px 10px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  text-align: left; color: var(--ink);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  overflow: hidden;
  transition: background var(--dur), box-shadow var(--dur), transform var(--dur);
  -webkit-tap-highlight-color: transparent;
}
.dvc:active { background: var(--surface-2); transform: scale(.995); }
.dvc-bar { align-self: stretch; margin: -10px 0; background: var(--c, var(--accent)); }
.dvc-time { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; font-weight: 650; color: var(--ink); white-space: nowrap; padding-left: 2px; }
.dvc-time small { font: 500 11.5px/1 var(--font); color: var(--ink-3); }
.dvc-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dvc-name { font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dvc-meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dvc-se { color: var(--accent-ink); font-weight: 600; }
.dvc-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1px; }
.dvc-flag { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 999px; color: var(--warn-ink); background: var(--warn-soft); }
.dvc .dve-chev { width: 18px; height: 18px; color: var(--ink-4); }
.dvc-dirty { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dvc--locked { background: var(--surface-2); grid-template-columns: 4px 74px minmax(0, 1fr); }
.dvc--locked .dvc-bar { opacity: .55; }
.dvc--locked .dvc-name { color: var(--ink-2); }
.dvc-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; }
.dvc-badge svg { width: 12px; height: 12px; }
.dvc-badge--done { color: var(--ok-ink); }
.dvc.is-new { animation: td-card-new 1.5s ease-out; }
@keyframes td-card-new { 0%, 35% { box-shadow: 0 0 0 3px var(--accent-line); background: var(--accent-soft); } }
.dvc-empty { margin: 24px 8px; padding: 22px 18px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 16px; color: var(--ink-3); }
.dvc-empty-title { font-size: 15px; font-weight: 650; color: var(--ink-2); margin-bottom: 4px; }
.dvc-empty-text { font-size: 13.5px; line-height: 1.5; }

/* ── Zeitabschnitt-Editor ── */
.dve-overlay {
  position: absolute; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.2 0.02 250 / 0); transition: background .18s var(--ease);
}
.dve-overlay.is-open { background: oklch(0.2 0.02 250 / .34); }
.dve-overlay.is-behind { visibility: hidden; }
.dve-sheet {
  position: relative; display: flex; flex-direction: column;
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 48px);
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(14px) scale(.985); opacity: 0;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.dve-overlay.is-open .dve-sheet { transform: none; opacity: 1; }
@media (max-width: 880px) {
  .dve-overlay { align-items: flex-end; }
  .dve-sheet {
    width: 100%; max-height: 100%; height: calc(100% - var(--safe-top) - 10px);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%); opacity: 1;
    transition: transform .26s cubic-bezier(.2,.8,.2,1);
  }
}
@media (prefers-reduced-motion: reduce) { .dve-sheet, .dve-overlay { transition: none; } }

.dve-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  min-height: 56px; padding: 6px 8px;
  border-bottom: 1px solid var(--line); flex-shrink: 0; background: var(--surface);
}
.dve-head-l { justify-self: start; display: flex; }
.dve-head-r { justify-self: end; display: flex; }
.dve-title { font-size: 16px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dve-head-btn {
  min-height: 44px; padding: 0 12px; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: var(--accent-ink);
}
.dve-head-btn:hover { background: var(--accent-soft); }
.dve-head-btn--primary { background: var(--accent); color: #fff; padding: 0 16px; }
.dve-head-btn--primary:hover { background: var(--accent-strong); }
.dve-head-btn--icon { width: 44px; padding: 0; display: grid; place-items: center; color: var(--ink-2); }
.dve-head-btn--icon svg { width: 22px; height: 22px; }

.dve-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 881px) { .dve-body { padding-bottom: 20px; } }

.dve-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--accent)); flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in oklch, var(--c, var(--accent)) 22%, transparent); }
.dve-target {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in oklch, var(--c, var(--accent)) 7%, var(--surface));
  border: 1px solid color-mix(in oklch, var(--c, var(--accent)) 30%, var(--line));
  text-align: left;
}
.dve-target.is-locked { cursor: default; }
.dve-target-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dve-target-name { font-size: 15.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.dve-target-sub { font-size: 12.5px; color: var(--ink-3); }
.dve-chev { width: 18px; height: 18px; color: var(--ink-4); flex-shrink: 0; }

.dve-sec { display: flex; flex-direction: column; gap: 8px; }
.dve-sec-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); display: flex; gap: 8px; align-items: baseline; }
.dve-opt { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-4); font-size: 12px; }

.dve-times { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
.dve-times--point { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.dve-time { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dve-time-lbl { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.dve-time input {
  width: 100%; height: 56px; padding: 0 12px;
  border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface);
  font: 650 22px/1 var(--mono); color: var(--ink); text-align: center;
  font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none;
}
.dve-time input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dve-time input::-webkit-date-and-time-value { text-align: center; }
.dve-times-sep { padding-bottom: 16px; color: var(--ink-4); font-size: 20px; }
.dve-dur { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: center; }
.dve-times--point .dve-dur { grid-column: auto; text-align: left; color: var(--ink-3); font-weight: 500; }
.dve-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dve-chip {
  height: var(--chip-h); padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.dve-chip:hover, .dve-chip:active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.dve-msg { min-height: 0; font-size: 13px; line-height: 1.45; }
.dve-msg.is-error { padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger-ink); }
.dve-fix { margin-left: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid currentColor; font-weight: 650; font-size: 12.5px; color: inherit; }

.dve-fields { gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.dve-fields > .dve-sec-title { padding: 12px 14px 4px; }
.dve-field {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lbl chev" "val chev";
  align-items: center; column-gap: 10px;
  width: 100%; min-height: 60px; padding: 9px 14px;
  text-align: left; border-bottom: 1px solid var(--line);
}
.dve-field:last-child { border-bottom: none; }
.dve-field:not(:disabled):active { background: var(--surface-2); }
.dve-field .dve-chev { grid-area: chev; }
.dve-field-lbl { grid-area: lbl; font-size: 12.5px; font-weight: 600; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.dve-field-val { grid-area: val; font-size: 15px; font-weight: 550; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dve-field.has-value .dve-field-val { color: var(--ink); }
.dve-field.is-missing .dve-field-lbl { color: var(--warn-ink); }
.dve-field.is-missing { box-shadow: inset 3px 0 0 var(--warn); }
.dve-field:disabled { cursor: default; }
.dve-req { font-style: normal; color: var(--warn-ink); font-weight: 700; }
.dve-auto { font-size: 10.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 1px 6px; border-radius: 999px; }
.dve-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: td-spin .7s linear infinite; }
.dve-switch {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.dve-switch:last-child { border-bottom: none; }
.dve-switch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dve-switch-lbl { font-size: 15px; font-weight: 550; color: var(--ink); }
.dve-switch-sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.dve-switch .switch-input + .switch-track { flex-shrink: 0; }

.dve-input-wrap { position: relative; }
.dve-input { height: 50px; font-size: 16px; padding-right: 60px; }
.dve-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 500 11.5px var(--mono); color: var(--ink-4); }
.dve-hint { font-size: 12.5px; color: var(--ink-3); }

.dve-delete {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; margin-top: 4px; border-radius: 14px;
  color: var(--danger-ink); background: var(--danger-soft); font-weight: 650; font-size: 15px;
}
.dve-delete svg { width: 18px; height: 18px; }

/* Auftragsauswahl */
.dve-pick { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 0; }
.dve-pick-time { font-size: 13.5px; color: var(--ink-2); background: var(--accent-soft); border-radius: 12px; padding: 9px 12px; }
.dve-search { height: 46px; }
.dve-search input { font-size: 16px; }
.dve-cats .seg-btn { font-size: 13px; padding: 0 6px; }
.dve-pick-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -14px; padding: 0 8px calc(var(--safe-bottom) + 16px); }
.dve-group { padding: 12px 8px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dve-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 10px 10px; border-radius: 12px; text-align: left;
}
.dve-row:hover, .dve-row:active { background: var(--surface-2); }
.dve-row.is-selected { background: var(--accent-soft); }
.dve-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dve-row-name { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.dve-row-sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dve-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* Ansicht abgeschlossener Einträge */
.dve-locked-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--c, var(--ok)); font-weight: 600; color: var(--ink-2); }
.dve-locked-note svg { width: 18px; height: 18px; color: var(--ink-3); }
.dve-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.dve-dl dt, .dve-dl dd { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.dve-dl dt { color: var(--ink-3); background: var(--surface-2); font-weight: 600; font-size: 13px; }
.dve-dl dd { color: var(--ink); user-select: text; }
.dve-dl dt:nth-last-child(2), .dve-dl dd:last-child { border-bottom: none; }
.dve-ro-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; color: var(--ink); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; user-select: text; }

/* Auswahlliste (Material, Kennzeichen, Fehlercode) über dem Editor */
.dve-list-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.2 0.02 250 / .22);
}
.dve-list {
  display: flex; flex-direction: column;
  width: min(520px, calc(100% - 24px)); max-height: calc(100% - 40px);
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
@media (max-width: 880px) {
  .dve-list-overlay { align-items: stretch; background: var(--surface); }
  .dve-list { width: 100%; max-height: 100%; height: 100%; border-radius: 0; box-shadow: none; }
}
.dve-list .dve-search { margin: 10px 12px 4px; }
.dve-list-items { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px calc(var(--safe-bottom) + 12px); }
.dve-opt-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 54px; padding: 10px 12px; border-radius: 12px;
  text-align: left; font-size: 15px; color: var(--ink);
}
.dve-opt-row:hover, .dve-opt-row:active { background: var(--surface-2); }
.dve-opt-row.is-selected { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.dve-opt-row svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--accent); }

/* Eintragen-Bestätigung */
.dv-eintragen-overlay { z-index: 200; padding: 16px; }
.dv-eintragen-modal {
  display: flex; flex-direction: column;
  width: min(540px, 100%); max-height: calc(100% - 16px);
  padding: 0 !important; gap: 0 !important;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.dv-em-head { padding: 18px 20px 10px; }
.dv-em-head h3 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.dv-em-sub { font-size: 13.5px; color: var(--ink-3); }
.dv-em-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.dv-em-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.dv-em-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.dv-em-item:last-child { border-bottom: none; }
.dv-em-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); flex-shrink: 0; }
.dv-em-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dv-em-name { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.dv-em-meta { font-size: 12.5px; color: var(--ink-3); }
.dv-em-state { font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.dv-em-state.is-ok { color: var(--ok-ink); background: var(--ok-soft); }
.dv-em-state.is-warn { color: var(--warn-ink); background: var(--warn-soft); }
.dv-em-note { font-size: 13px; color: var(--ink-2); }
.dv-em-sig { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.dv-em-sig img { height: 36px; border-radius: 6px; background: #fff; border: 1px solid var(--line); padding: 2px; }
.dv-em-sig.is-ok span { color: var(--ok-ink); font-weight: 600; }
.dv-em-sig.is-missing { background: var(--warn-soft); color: var(--warn-ink); }
.dv-em-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 20px calc(var(--safe-bottom) + 14px); border-top: 1px solid var(--line); }
.dv-em-foot .btn { min-height: 46px; padding: 0 20px; }
@media (max-width: 880px) {
  .dv-eintragen-overlay { padding: 0; align-items: flex-end; }
  .dv-eintragen-modal { width: 100%; max-height: 92%; border-radius: 20px 20px 0 0; }
  .dv-em-foot .btn { flex: 1; }
}
/* Scroll-Spalten: Inhalte nie stauchen (sonst schneidet overflow:hidden Felder ab) */
.dve-body > *, .dv-em-body > *, .dve-pick > *:not(.dve-pick-list), .diag-toolbar, .sheet > * { flex-shrink: 0; }
.dve-search { flex: 0 0 auto !important; height: 46px; }
.dve-cats .seg-btn { font-size: 12.5px; gap: 3px; padding: 0 4px; }
.dve-cats .seg-count { min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.dvc { grid-template-columns: 4px 92px minmax(0, 1fr) auto auto; }
.dvc--locked { grid-template-columns: 4px 92px minmax(0, 1fr); }
.dvc-time { font-size: 13px; }
@media (max-width: 360px) {
  .dvc { grid-template-columns: 4px 84px minmax(0, 1fr) auto auto; column-gap: 10px; }
  .dvc-time { font-size: 12.5px; }
}
/* Schalter: überall gleich (nicht nur in Einstellungs-Zeilen) */
.switch-input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch-input:checked + .switch-track::after { transform: translateX(16px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.dve-switch .switch-track { transform: scale(1.12); transform-origin: right center; }

/* ── F · Aufgaben (Buchungsliste) ─────────────────────────────────── */
.bt-sub-label { color: var(--ink-2); font-weight: 600; }
@media (max-width: 640px) {
  /* Kopf der Liste: Offen/Abgeschlossen + Suche, kompakt */
  .bkg-toolbar { padding: 10px 12px 10px !important; gap: 8px !important; background: var(--bg) !important; border-bottom: none !important; position: static !important; }
  .bkg-toolbar-left { gap: 8px; }
  .bkg-filter-tabs .tab { height: 36px; font-size: 13.5px; }
  .bkg-search input { height: 44px !important; border-radius: 12px; }

  /* Primäraktion je Kategorie als schwebende Taste (Neue Störung / Koffer) */
  #btn-auftraegekoffer, #btn-wartungskoffer {
    position: fixed; right: calc(16px + var(--safe-right, 0px)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
    z-index: 80; height: 52px !important; padding: 0 20px; border-radius: 999px; flex: 0 0 auto !important;
    background: var(--accent); color: #fff; border: none; font-size: 15px; font-weight: 600; gap: 8px;
    box-shadow: 0 12px 28px -8px oklch(0.45 0.108 224 / .55), 0 2px 6px rgba(15,23,42,.18);
  }
  #btn-auftraegekoffer svg, #btn-wartungskoffer svg { width: 18px; height: 18px; }
  .bkg-toolbar-right { position: static; height: 0; margin: 0 !important; padding: 0; overflow: visible; }

  /* Karten */
  .bkg-panel { background: transparent !important; border: none !important; }
  .bookings-table tbody { display: flex !important; flex-direction: column; gap: 8px; padding: 0 12px; }
  .bookings-table tbody tr { border: 1px solid var(--line) !important; border-radius: 14px; background: var(--surface); padding: 12px 14px !important; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
  .bookings-table tbody tr.is-search-hidden { display: none !important; }
  tr.booking-group-header, tr.booking-single-row {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-areas:
      "num   hours action"
      "asset asset asset"
      "fall  fall  fall"
      "ort   date  meta" !important;
    row-gap: 3px !important; column-gap: 8px !important;
  }
  tr.booking-group-header td[data-c="created"], tr.booking-single-row td[data-c="created"] {
    display: block !important; grid-area: date; justify-self: end; align-self: center; text-align: right;
  }
  tr.booking-group-header td[data-c="created"] .bt-date-created,
  tr.booking-single-row td[data-c="created"] .bt-date-created { display: none; }
  tr.booking-group-header td[data-c="created"] .bt-date-logged,
  tr.booking-single-row td[data-c="created"] .bt-date-logged,
  tr.booking-group-header td[data-c="created"] .bt-date-primary,
  tr.booking-single-row td[data-c="created"] .bt-date-primary { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
  tr.booking-group-header td[data-c="num"], tr.booking-single-row td[data-c="num"] { display: flex !important; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
  tr.booking-group-header .booking-expand-spacer, tr.booking-single-row .booking-expand-spacer { display: none; }
  tr.booking-group-header td[data-c="fall"], tr.booking-single-row td[data-c="fall"] {
    display: block !important; grid-area: fall; font-size: 13px; color: var(--ink-2); line-height: 1.35;
  }
  .bookings-table--wartung tr td[data-c="fall"], .bookings-table--auftrag tr td[data-c="fall"] { display: none !important; }
  tr.booking-group-header td[data-c="myh"], tr.booking-single-row td[data-c="myh"] { font-size: 14px !important; font-weight: 650; }
  tr.booking-group-header td[data-c="action"], tr.booking-single-row td[data-c="action"] { margin: -6px -8px -6px 0; }
  .booking-action-btn { width: 40px; height: 40px; border-radius: 10px; font-size: 20px; }
  .booking-expand-btn { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); }
  tr.booking-group-row { border-radius: 12px !important; margin: -4px 0 0 18px; padding: 9px 12px !important; background: var(--surface-2) !important; }
  #bookings-list::after { height: calc(var(--tabbar-h) + 60px) !important; }
}

/* ── G · Teamplanung (mobil) ─────────────────────────────────────── */
@media (max-width: 880px) {
  #view-teamplan .tp-toolbar, #view-teamplan .tp-panel, #view-teamplan .tp-hint {
    padding-left: 12px !important; padding-right: 12px !important;
  }
  #view-teamplan .tp-toolbar { padding-top: 10px !important; }
  #tp-refresh { display: none !important; }
  .vw-summary, .tk-summary, #tp-summary { font-size: 13px; color: var(--ink-3); }
  #view-teamplan .tp-panel { padding-left: 0 !important; padding-right: 0 !important; margin: 0 12px; }
}

/* ── I · Seitenköpfe & Feinschliff ────────────────────────────────── */
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.page-h1 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.page-sub { font-size: 13px; color: var(--ink-3); }
@media (max-width: 880px) { .page-head { display: none; } }
@media (max-width: 880px) {
  /* Installations-Taste links über der Tab-Leiste (rechts sitzt die Hauptaktion) */
  .pwa-install-fab { right: auto; left: calc(16px + var(--safe-left, 0px)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 79; }
  body.has-subnav .ios-install-hint { top: calc(var(--mobile-topbar-h) + var(--subnav-h) + var(--safe-top) + 8px); }
}
.callout[hidden], .dve-msg:empty { display: none !important; }
.day-cell.is-loading { opacity: .6; pointer-events: none; }


/* ── J · Bestellungen (Material) ──────────────────────────────────────
   Liste (#view-orders), Detail (#order-detail-overlay), Editor
   (#order-editor-overlay, z 5100), Auswahl-Blatt (z 5300). Prozesskarte
   (25000) und Bestätigung (26000) liegen darüber. Mobil: Editor vollflächig
   in zwei Schritten (Material → Lieferung), Auswahl als Blatt von unten. */
#view-orders.active { gap: 14px; min-height: 0; flex: 1; }
.or-toolbar { display: flex; flex-direction: column; gap: 12px; }
.or-toolbar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.or-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.or-list-search { width: 340px; max-width: 100%; }
.or-new-btn { display: inline-flex; align-items: center; gap: 7px; }
.or-filter-rail { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.or-seg .seg-btn { min-width: 96px; }
.or-rail-note { margin: 0; padding: 7px 11px; font-size: 12.5px; display: inline-flex; gap: 7px; align-items: center; }
.or-panel { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 14px; }
.or-list { display: flex; flex-direction: column; gap: 8px; }
.or-group-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 12px 2px 0; }
.or-group-label:first-child { margin-top: 2px; }
.or-group { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.or-muted { color: var(--ink-3); }
.or-danger-text { color: var(--danger-ink) !important; }

.or-card {
  position: relative; width: 100%; text-align: left; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px 11px; cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform .05s;
}
.or-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.or-card:active { transform: translateY(1px); }
.or-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.or-card.is-new { animation: or-flash 2.6s var(--ease) 1; }
.or-card--cancelled { opacity: .7; }
.or-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.or-num { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.or-card-date { font-size: 12px; color: var(--ink-3); }
.or-card-top .or-pill { margin-left: auto; }
.or-card-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.or-qty { font-family: var(--mono); font-weight: 500; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.or-card-more { font-size: 12.5px; color: var(--ink-3); margin-top: -3px; }
.or-card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.or-meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.or-meta-item svg { color: var(--ink-4); flex-shrink: 0; }

.or-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.or-pill--accent { background: var(--accent-soft); color: var(--accent-ink); }
.or-pill--ok     { background: var(--ok-soft); color: var(--ok-ink); }
.or-pill--warn   { background: var(--warn-soft); color: var(--warn-ink); }
.or-pill--danger { background: var(--danger-soft); color: var(--danger-ink); }
.or-pill--info   { background: oklch(0.955 0.03 255); color: oklch(0.45 0.12 258); }
.or-pill--muted  { background: var(--surface-3); color: var(--ink-3); }

.or-lbl { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 6px; border: 1px solid; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.or-lbl--wdc  { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.or-lbl--hub  { color: oklch(0.46 0.10 165); border-color: oklch(0.86 0.05 165); background: oklch(0.965 0.025 165); }
.or-lbl--ext  { color: oklch(0.46 0.10 300); border-color: oklch(0.87 0.04 300); background: oklch(0.968 0.02 300); }
.or-lbl--none { color: var(--ink-3); border-color: var(--line-2); background: var(--surface-2); }

/* Fortschritt: Angelegt → An SAP → Erhalten */
.or-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 3px; }
.or-track.is-cancelled { grid-template-columns: 1fr; }
.or-track-seg { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.or-track-bar { height: 4px; border-radius: 3px; background: var(--surface-3); }
.or-track-lbl { font-size: 11px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-track-lbl em { font-style: normal; color: var(--ink-3); }
.or-track-seg.is-done .or-track-bar { background: var(--accent); }
.or-track-seg.is-done .or-track-lbl { color: var(--ink-2); }
.or-card--received .or-track-seg.is-done .or-track-bar { background: var(--ok); }
.or-track-seg.is-active .or-track-bar { background: linear-gradient(90deg, var(--accent) 0 50%, var(--surface-3) 50% 100%); }
.or-track-seg.is-active .or-track-lbl { color: var(--ink-2); }
.or-track-seg.is-pulse .or-track-bar { background: var(--warn); animation: or-pulse 1.4s ease-in-out infinite; }
.or-track-seg.is-error .or-track-bar { background: var(--danger); }
.or-track-seg.is-error .or-track-lbl, .or-track-seg.is-error .or-track-lbl em { color: var(--danger-ink); }
.or-track-seg.is-muted .or-track-bar { background: var(--line-2); }
.or-track-seg.is-late .or-track-lbl, .or-track-seg.is-late .or-track-lbl em { color: var(--warn-ink); }
.or-tl-row.is-late .or-tl-dot { border-color: var(--warn); }
.or-tl-row.is-late .or-tl-s { color: var(--warn-ink); }

.or-hero { max-width: 560px; margin: 28px auto; text-align: center; padding: 30px 24px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.or-hero-ico { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.or-hero h2 { font-size: 19px; font-weight: 700; margin: 4px 0 0; color: var(--ink); }
.or-hero p { color: var(--ink-2); font-size: 14px; line-height: 1.55; margin: 0; }
.or-hero-steps { text-align: left; margin: 8px 0 12px; padding: 0; list-style: none; counter-reset: orstep; display: flex; flex-direction: column; gap: 9px; width: 100%; max-width: 420px; }
.or-hero-steps li { counter-increment: orstep; display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--ink-2); }
.or-hero-steps li::before { content: counter(orstep); flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font: 700 12px/22px var(--mono); text-align: center; }
.or-hero-steps b { color: var(--ink); font-weight: 600; }
.or-hero .btn-large { display: inline-flex; align-items: center; gap: 8px; }
.or-empty { padding: 34px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.or-empty--loading { flex-direction: row; justify-content: center; }
.or-empty--err { color: var(--danger-ink); }
.or-empty span { color: var(--ink-3); font-size: 12.5px; }
.or-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-line); border-top-color: var(--accent); display: inline-block; flex-shrink: 0; margin-right: 8px; animation: or-spin .8s linear infinite; }
#or-refresh.is-busy { opacity: .6; pointer-events: none; }
.or-fab { display: none; }
.or-fab[hidden] { display: none !important; }

/* ── Detail ── */
.modal-card.or-detail-card { width: min(700px, 96vw); max-height: min(88dvh, 920px); display: flex; flex-direction: column; }
.or-d-head { display: flex; align-items: flex-start; gap: 12px; }
.or-d-titles { flex: 1; min-width: 0; }
.or-d-titles h2 { font-size: 18px; margin: 0; }
.or-d-titles h2 .readout { color: var(--accent-ink); }
.or-d-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; font-size: 12.5px; color: var(--ink-3); }
.or-d-body { overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.or-tl { display: flex; flex-direction: column; padding: 2px 0; }
.or-tl-row { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-bottom: 12px; }
.or-tl-row:last-child { padding-bottom: 0; }
.or-tl-row:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.or-tl-row.is-done:not(:last-child)::before { background: var(--accent-line); }
.or-tl-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); background: var(--surface); color: #fff; box-sizing: border-box; }
.or-tl-row.is-done .or-tl-dot   { background: var(--accent); border-color: var(--accent); }
.or-tl-row.is-active .or-tl-dot { border-color: var(--warn); background: var(--warn-soft); }
.or-tl-row.is-error .or-tl-dot  { background: var(--danger); border-color: var(--danger); }
.or-tl-t { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 22px; }
.or-tl-row.is-todo .or-tl-t, .or-tl-row.is-muted .or-tl-t { color: var(--ink-3); font-weight: 550; }
.or-tl-row.is-error .or-tl-t { color: var(--danger-ink); }
.or-tl-s { font-size: 12.5px; color: var(--ink-3); }
.or-d-section { display: flex; flex-direction: column; gap: 8px; }
.or-d-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); display: flex; gap: 6px; }
.or-l-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: clip; background: var(--surface); }
.or-l { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 10px 12px; }
.or-l + .or-l { border-top: 1px solid var(--line); }
.or-l-qty { font-size: 16px; font-weight: 600; color: var(--ink); text-align: right; line-height: 1.15; }
.or-l-qty small { display: block; font: 500 10.5px var(--font); color: var(--ink-3); }
.or-l-name { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.or-l-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.or-l-recv { color: var(--warn-ink); font-weight: 600; }
.or-l-recv.is-full { color: var(--ok-ink); }
.or-d-grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.or-d-k { color: var(--ink-3); }
.or-d-v { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.or-d-desc { font-size: 13.5px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; overflow-wrap: anywhere; }
.or-d-foot { display: flex; align-items: center; gap: 10px; }
.or-d-acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.or-d-acts .btn, .or-ed-foot .btn { display: inline-flex; align-items: center; gap: 7px; }

/* ── Editor ── */
.or-ed-overlay { position: fixed; inset: 0; z-index: 5100; display: flex; align-items: center; justify-content: center; padding: 20px; background: oklch(0.2 0.01 250 / .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.or-ed-overlay.hidden { display: none; }
.or-ed { width: 100%; max-width: 1180px; height: 100%; max-height: 880px; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.or-ed-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.or-ed-titles { flex: 1; min-width: 0; }
.or-ed-titles h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--ink); }
.or-ed-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-ed-steps { display: none; }
.or-ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.or-pane { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.or-pane--catalog { background: var(--surface); border-right: 1px solid var(--line); }
.or-ed-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.or-foot-sum { margin-left: auto; font-size: 13px; color: var(--ink-2); }
.or-foot-sum b { font-family: var(--mono); color: var(--ink); }
.or-foot-next { display: none !important; }
.or-foot-next.is-bump { animation: or-bump .35s var(--ease); }
.or-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--accent-ink); font: 700 11.5px var(--mono); }

.or-search { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px 0 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); flex-shrink: 0; }
.or-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.or-search > svg { color: var(--ink-4); flex-shrink: 0; }
.or-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); }
.or-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.or-search-clear { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-3); }
.or-search-clear:hover { background: var(--surface-2); }
.or-search-clear[hidden] { display: none; }
.or-cat-tabs { align-self: flex-start; max-width: 100%; transition: opacity var(--dur); }
.or-cat-tabs.is-dim { opacity: .5; }
.or-cat-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.or-cat-status:empty { display: none; }
.or-cat-status.is-error { color: var(--danger-ink); }
.or-cat-list { display: flex; flex-direction: column; gap: 6px; }
.or-cat-empty { color: var(--ink-3); font-size: 13.5px; line-height: 1.55; padding: 16px 6px; }

.or-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 8px 10px 8px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.or-item:hover, .or-item.is-hi { border-color: var(--accent-line); background: color-mix(in oklch, var(--accent-soft) 40%, var(--surface)); }
.or-item.is-in-cart { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.or-item.is-gone { opacity: .62; cursor: default; }
.or-item-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.or-item-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.or-item-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.or-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--ink-3); }
.or-sap { font-size: 12px; color: var(--ink-2); }
.or-info { font-size: 11px; font-weight: 650; color: var(--warn-ink); background: var(--warn-soft); border-radius: 5px; padding: 1px 6px; }
.or-pop { font-size: 11.5px; color: var(--ink-3); }
.or-item-gone { display: flex; gap: 5px; align-items: center; font-size: 12px; color: var(--danger-ink); }
.or-fav { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--ink-4); }
.or-fav:hover { color: var(--warn); background: var(--surface-2); }
.or-fav.is-on { color: var(--warn); }
.or-fav.is-on svg { fill: currentColor; }
.or-add { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.or-add:hover { background: var(--accent-strong); }
.or-stepper { display: inline-flex; align-items: center; height: 42px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--surface); overflow: clip; }
.or-stepper button { width: 38px; height: 100%; display: grid; place-items: center; color: var(--accent-ink); }
.or-stepper button:hover { background: var(--accent-soft); }
.or-stepper span, .or-stepper input { min-width: 30px; text-align: center; font: 600 14px var(--mono); color: var(--ink); }
.or-stepper input { width: 52px; height: 100%; border: 0; outline: 0; background: transparent; padding: 0; }

.or-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.or-block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.or-block-h h3 { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0; }
.or-block-aside { font-size: 12px; color: var(--ink-3); }
.or-ed-errors { display: flex; flex-wrap: nowrap; gap: 8px; align-items: flex-start; font-size: 13px; margin: 0; }
.or-ed-errors[hidden] { display: none; }
.or-cart { display: flex; flex-direction: column; }
.or-cart-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.5; padding: 12px 8px; }
.or-cart-empty svg { color: var(--ink-4); }
.or-cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 26px 38px; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.or-cart > .or-cart-row:first-child, .or-cart-group + .or-cart-row, .or-split + .or-cart-row { border-top: 0; }
.or-cart-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.or-unit { font-size: 11.5px; color: var(--ink-3); }
.or-cart-group { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 10px; padding-bottom: 2px; }
.or-split { display: flex; flex-wrap: nowrap; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 0 0 2px; }
.or-split > svg, .or-ed-errors > svg, .or-rail-note > svg { flex-shrink: 0; margin-top: 2px; }
.or-split > div, .or-ed-errors > div { flex: 1 1 auto; min-width: 0; }

.or-deliv-seg .seg-btn svg { margin-right: 3px; }
.or-field { display: flex; align-items: center; gap: 6px; }
.or-field-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; min-height: 58px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; transition: border-color var(--dur); }
.or-field-btn:hover { border-color: var(--accent-line); }
.or-field.is-empty .or-field-title { color: var(--accent-ink); }
.or-field.is-invalid .or-field-btn, .or-deliv-addr.is-invalid input, .or-date.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.or-field-ico { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.or-field-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.or-field-title { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-field-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-field-chev { color: var(--ink-4); flex-shrink: 0; }
.or-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.or-f > span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.or-f input, .or-f select, .or-date, .or-desc-wrap textarea {
  width: 100%; min-width: 0; height: 44px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  font: inherit; font-size: 14.5px; color: var(--ink);
}
.or-f input:focus, .or-f select:focus, .or-date:focus, .or-desc-wrap textarea:focus { outline: 0; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.or-desc-wrap { position: relative; }
.or-desc-wrap textarea { height: auto; min-height: 66px; padding: 10px 50px 10px 12px; resize: vertical; line-height: 1.45; display: block; }
.or-desc-mic { position: absolute; right: 8px; bottom: 8px; }
.or-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.or-grid-street { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; }
.or-grid-city { display: grid; grid-template-columns: 104px minmax(0, 1fr) 72px; gap: 10px; }
.or-deliv-addr { display: flex; flex-direction: column; gap: 10px; }
.or-deliv-addr[hidden], .or-deliv-dop[hidden] { display: none; }
.or-hint { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); }
.or-hint:empty { display: none; }
.or-date-row { display: flex; flex-direction: column; gap: 8px; }
.or-date { max-width: 220px; }
.or-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.or-chip { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 44px; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.or-chip small { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.or-chip:hover { border-color: var(--accent-line); }
.or-chip.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.or-chip.is-on small { color: var(--accent-ink); }
.or-more > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 30px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink); }
.or-more > summary::-webkit-details-marker { display: none; }
.or-more-sum { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-more-chev { flex-shrink: 0; color: var(--ink-4); transition: transform var(--dur); }
.or-more[open] .or-more-chev { transform: rotate(90deg); }
.or-more-body { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }

/* Auswahl-Blatt */
.or-pick-overlay { position: fixed; inset: 0; z-index: 5300; display: flex; align-items: center; justify-content: center; padding: 20px; background: oklch(0.2 0.01 250 / .38); }
.or-pick-overlay.hidden { display: none; }
.or-pick { width: 100%; max-width: 560px; height: 100%; max-height: 660px; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.or-pick-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; }
.or-pick-head h3 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.or-pick-search { margin: 0 16px 8px; }
.or-pick-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 14px; }
.or-pick-sec { padding: 12px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.or-pick-item { width: 100%; min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.or-pick-item:hover { background: var(--surface-2); }
.or-pick-item.is-on { background: var(--accent-soft); }
.or-pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.or-pick-t { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.or-pick-s { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.or-pick-check { flex-shrink: 0; color: var(--accent); }
.or-pick-empty { display: flex; align-items: center; padding: 18px 12px; font-size: 13px; color: var(--ink-3); }

/* Prüfen vor dem Senden */
.app-confirm-card.or-review { width: min(540px, 100%); max-width: 540px; }
.or-rv-body { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; max-height: 420px; max-height: min(58dvh, 520px); overflow-y: auto; }
.or-rv-group { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.or-rv-gh { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.or-rv-n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font: 700 11px/20px var(--mono); text-align: center; }
.or-rv-line { display: flex; gap: 8px; font-size: 13.5px; color: var(--ink); }
.or-rv-q { min-width: 36px; text-align: right; color: var(--ink-2); }
.or-rv-grid { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.or-rv-note { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-3); }

.modal-card.or-preview-card { width: min(920px, 96vw); max-height: 88dvh; display: flex; flex-direction: column; }
.or-preview-card .modal-body { overflow: auto; }
.or-pre { margin: 10px 0 0; padding: 12px; font: 11.5px/1.45 var(--mono); white-space: pre; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }

@keyframes or-spin  { to { transform: rotate(360deg); } }
@keyframes or-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes or-flash { 0% { box-shadow: 0 0 0 3px var(--accent-line); border-color: var(--accent); } 100% { box-shadow: none; } }
@keyframes or-bump  { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

@media (max-width: 880px) {
  #view-orders .or-toolbar, #view-orders .or-panel { padding-left: 12px; padding-right: 12px; }
  #view-orders .or-toolbar { padding-top: 10px; }
  .or-new-btn, #or-refresh { display: none !important; }
  .or-actions, .or-list-search { width: 100%; }
  .or-group { grid-template-columns: minmax(0, 1fr); }
  .or-panel { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); }
  .or-fab {
    display: inline-flex; align-items: center; gap: 8px;
    position: fixed; right: calc(16px + var(--safe-right)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 80;
    height: 52px; padding: 0 22px; border-radius: 999px; font-size: 15px; font-weight: 600;
    box-shadow: 0 12px 28px -8px oklch(0.45 0.108 224 / 0.55), 0 2px 6px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }
  .or-fab:disabled { display: none; }

  .or-ed-overlay { padding: 0; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .or-ed { max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .or-ed-head { flex-wrap: wrap; gap: 8px 10px; padding: calc(var(--safe-top) + 8px) 12px 10px; }
  .or-ed-titles h2 { font-size: 17px; }
  .or-ed-steps { display: flex; order: 3; width: 100%; }
  .or-ed-body { display: block; position: relative; overflow: hidden; }
  .or-pane { height: 100%; padding: 12px 12px 18px; border-right: 0 !important; }
  .or-pane--order { background: var(--bg); }
  .or-ed[data-step="catalog"] .or-pane--order,
  .or-ed[data-step="order"] .or-pane--catalog { display: none; }
  .or-ed-foot { padding: 10px 12px calc(var(--safe-bottom) + 10px); gap: 8px; }
  .or-ed-foot .btn { min-height: 48px; }
  .or-ed-foot .btn-primary { flex: 1; justify-content: center; }
  .or-foot-sum { display: none; }
  .or-ed[data-step="catalog"] .or-foot-submit { display: none !important; }
  .or-ed[data-step="catalog"] .or-foot-next { display: inline-flex !important; }
  .or-search input, .or-f input, .or-f select, .or-date, .or-desc-wrap textarea { font-size: 16px; }  /* kein iOS-Zoom */
  .or-f input, .or-f select, .or-date { height: var(--field-h); }
  .or-grid2 { grid-template-columns: minmax(0, 1fr); }
  .or-grid-city { grid-template-columns: 92px minmax(0, 1fr) 64px; }
  .or-date { max-width: none; }
  .or-item { grid-template-columns: 36px minmax(0, 1fr) auto; padding-right: 8px; }
  /* Warenkorb mobil: Name über die volle Breite, Menge darunter */
  .or-cart-row { grid-template-columns: auto minmax(0, 1fr) 40px; grid-template-areas: "main main del" "step unit unit"; row-gap: 8px; column-gap: 10px; }
  .or-cart-main { grid-area: main; }
  .or-cart-row .or-stepper--edit { grid-area: step; }
  .or-cart-row .or-unit { grid-area: unit; }
  .or-cart-row .or-cart-del { grid-area: del; align-self: start; }

  .or-pick-overlay { padding: 0; align-items: flex-end; }
  .or-pick { max-width: none; max-height: none; height: calc(100% - var(--safe-top) - 28px); border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; border-bottom: 0; padding-bottom: var(--safe-bottom); animation: or-sheet-up .2s var(--ease); }
  .or-d-foot { flex-wrap: wrap; }
  .or-d-acts { width: 100%; }
  .or-d-acts .btn { flex: 1 1 auto; justify-content: center; min-height: 46px; }
}
@media (max-width: 640px) {
  .or-d-grid, .or-rv-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .or-d-grid .or-d-k, .or-rv-grid .or-d-k { margin-top: 8px; font-size: 12px; }
  .or-card-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
@keyframes or-sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ── Nicht bestellbare D365-Artikel (Regions-Transparenz, rein lesend) ── */
.or-unavail {
  margin-top: 12px; padding: 12px;
  border: 1px dashed var(--line-2); border-radius: 12px;
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 8px;
}
.or-unavail-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.or-unavail-head svg { color: var(--ink-3); flex-shrink: 0; }
.or-unavail-hint {
  font-size: 11.5px; color: var(--ink-3); line-height: 1.45;
}
.or-unavail-list { display: flex; flex-direction: column; gap: 6px; }
.or-unavail-item {
  padding: 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
}
.or-unavail-name { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.or-unavail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; color: var(--ink-3); }
.or-unavail-reason {
  font-size: 11.5px; color: var(--warn-ink); font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.or-unavail-reason--retired { color: var(--ink-3); }
.or-unavail-trigger {
  margin-top: 8px; align-self: flex-start;
  font-size: 12px; color: var(--ink-3);
}
.or-unavail--elsewhere { border-style: solid; border-color: color-mix(in oklch, var(--warn) 45%, transparent); background: var(--warn-soft); }
.or-unavail--elsewhere .or-unavail-head svg,
.or-unavail--error .or-unavail-head svg { color: var(--warn-ink); }
.or-unavail-hint b { color: var(--ink-2); font-weight: 700; }
.or-unavail-item.is-retired { opacity: .7; }
.or-unavail-where { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.or-region-chip {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-ink);
  font: 600 11px/1.5 var(--mono);
}
.or-unavail-none {
  margin-top: 10px; display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3);
}

/* ── K · Tagesplan v5, Kurztext je Eintrag, Koffer-Auswahl (26.11.2026) ─────────
   Tagesplan: Abschnittszeilen ohne Auftrags-Felder (die stehen einmal je Auftrag
   im Block „Zum Auftrag") → Platz für den Kurztext Arbeit in derselben Zeile.
   Koffer: Wartungen + Aufträge mit gleichem Aufbau, Auswahl + „N zubuchen". */
.dv-slots-table--v5 { table-layout: auto; }
.dv-slots-table--v5 thead th { padding: 4px 6px; }
.dv-slots-table--v5 td { padding: 5px 6px; }
.dv-slots-table--v5 .dv-col-bar { width: 6px; padding-right: 0; }
.dv-slots-table--v5 .dv-col-time { width: 1%; white-space: nowrap; }
.dv-slots-table--v5 .dv-col-name { min-width: 150px; max-width: 250px; }
.dv-slots-table--v5 .dv-col-name .dv-slot-name,
.dv-orders-table .dv-col-name .dv-slot-name { max-width: 250px; font-weight: 600; color: var(--ink); }
.dv-slot-row--locked .dv-col-name .dv-slot-name { color: var(--ink-3); font-weight: 500; }
.dv-slot-sub {
  margin-top: 3px; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px;
  font-size: 11px; color: var(--ink-3); line-height: 1.2;
}
.dv-slot-sub .dv-slot-art { padding: 1px 5px; font-size: 10.5px; }
.dv-slot-sub .dv-slot-contract, .dv-slot-sub .dv-slot-locked-badge, .dv-slot-sub .dv-slot-auto-badge { margin: 0; }
.dv-slot-art--code { background: var(--surface-3); color: var(--ink-2); }
.dv-slots-table--v5 .dv-col-type { width: 1%; }
.dv-slots-table--v5 .dv-col-lm .dv-slot-dropdown { width: 100%; min-width: 118px; max-width: 170px; }
.dv-slots-table--v5 .dv-col-bi .dv-slot-dropdown { width: 100%; min-width: 104px; max-width: 150px; }
.dv-slots-table--v5 .dv-col-lm.dv-slot-ro, .dv-slots-table--v5 .dv-col-bi.dv-slot-ro {
  max-width: 160px; white-space: nowrap; overflow: hidden; overflow: clip; text-overflow: ellipsis;
}
.dv-slots-table--v5 .dv-col-bl { width: 1%; text-align: center; }
.dv-slots-table--v5 .dv-col-kt { min-width: 150px; width: 28%; }
.dv-slots-table--v5 .dv-col-act { width: 1%; text-align: center; }
.dv-slots-table--v5 .dv-code-meta { font-size: 11px; }
.dv-code-none { color: var(--ink-4); font-size: 11px; white-space: nowrap; }
.dv-slot-lock { display: inline-flex; color: var(--ink-4); }

/* Art: Arbeit | Reise als kleiner Umschalter */
.dv-type-toggle {
  display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px;
  background: var(--surface-3); border: 1px solid var(--line); white-space: nowrap;
}
.dv-type-opt {
  border: none; background: none; cursor: pointer;
  font: 600 11px/1 var(--font); color: var(--ink-3); padding: 4px 7px; border-radius: 5px;
}
.dv-type-opt:hover { color: var(--ink); }
.dv-type-opt.is-active { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(15,23,42,.10); }
.dv-type-opt--travel.is-active { color: var(--warn-ink); }

/* Kurztext Arbeit – Eingabe je Zeile */
.dv-kt { position: relative; display: flex; align-items: center; margin: 0; }
.dv-kt-input {
  width: 100%; min-width: 130px; box-sizing: border-box; height: 26px;
  padding: 3px 46px 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 12px/1.2 var(--font);
  user-select: text; -webkit-user-select: text;
  transition: border-color var(--dur, .15s), box-shadow var(--dur, .15s);
}
.dv-kt-input::placeholder { color: var(--ink-4); }
.dv-kt-input:hover { border-color: var(--line-2); }
.dv-kt-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dv-kt-count {
  position: absolute; right: 7px; pointer-events: none;
  font: 10px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-4);
  opacity: 0; transition: opacity .12s;
}
.dv-kt:focus-within .dv-kt-count { opacity: 1; }
.dv-kt.is-full .dv-kt-count { color: var(--warn-ink); opacity: 1; }
.dv-slots-table--v5 td.dv-kt-ro {
  color: var(--ink-2); max-width: 260px; white-space: nowrap; overflow: hidden; overflow: clip; text-overflow: ellipsis;
}

/* „Zum Auftrag": je Auftrag einmal */
.dv-orders { margin: 6px 0 8px; }
.dv-orders-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 2px 0 4px; }
.dv-orders-title { font-size: 13px; font-weight: 700; color: var(--ok-ink); }
.dv-orders-hint { font-size: 11.5px; color: var(--ink-3); }
.dv-orders-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dv-orders-table thead th {
  padding: 4px 6px; text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.dv-orders-table td { padding: 5px 6px; vertical-align: middle; border-bottom: 1px solid oklch(0.62 0.14 155 / 0.2); }
.dv-orders-table .dv-col-bar { width: 6px; padding-right: 0; }
.dv-orders-table .dv-col-name { min-width: 180px; }
.dv-orders-table .dv-col-sum { width: 1%; white-space: nowrap; color: var(--ink-2); font-weight: 600; }
.dv-orders-table .dv-col-ec { width: 1%; }
.dv-orders-table .dv-col-wb, .dv-orders-table .dv-col-rm, .dv-orders-table .dv-col-fu { width: 1%; white-space: nowrap; }
.dv-order-row--locked { background: var(--surface-2); }
.dv-order-row--locked td { color: var(--ink-3); }
.dv-rueckmeldung-btn--missing, .dv-bericht-btn--missing {
  border-color: var(--warn); background: var(--warn-soft); color: var(--warn-ink); font-weight: 600;
}
.dv-rueckmeldung-btn--missing:hover, .dv-bericht-btn--missing:hover { background: var(--warn-soft); border-color: var(--warn-ink); }
.dv-fu-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.dv-fu-toggle .dv-nnb-checkbox { margin: 0; accent-color: var(--accent); }

/* Editor & Karten: Kurztext */
.dve-kt-chips { margin-top: 8px; }
.dve-kt-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dve-kt-chip small { margin-left: 6px; font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
.dve-kt-chip.is-active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.dvc-kt {
  font-size: 12.5px; color: var(--ink-2); font-style: italic;
  white-space: nowrap; overflow: hidden; overflow: clip; text-overflow: ellipsis;
}

/* Koffer (Wartungen + Aufträge): Auswahl links, „+" rechts – überall gleich */
.auftrag-item.koffer-item, .wartung-item.koffer-item {
  grid-template-columns: 24px 96px minmax(0, 1fr) auto auto; gap: 14px;
}
.koffer-check { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0; cursor: pointer; }
.koffer-check--none { cursor: default; }
.koffer-check-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.koffer-check-box {
  width: 20px; height: 20px; box-sizing: border-box; border-radius: 6px;
  border: 1.5px solid var(--line-2); background: var(--surface); color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.koffer-check-box svg { width: 13px; height: 13px; display: block; }
.koffer-item.is-selectable { cursor: pointer; }
.koffer-item.is-selectable:hover .koffer-check-box { border-color: var(--accent); }
.koffer-check-input:checked + .koffer-check-box,
.koffer-item.is-selected .koffer-check-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.koffer-check-input:focus-visible + .koffer-check-box { box-shadow: 0 0 0 3px var(--accent-soft); }
.koffer-item.is-selected, .koffer-item.is-selected:hover { background: var(--accent-soft); }
.koffer-item--locked { cursor: default; }
.koffer-item--locked .wartung-item-wonr, .koffer-item--locked .auftrag-item-wonr { color: var(--ink-3); }
.koffer-add-btn svg { display: block; }
.koffer-mine {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-sm); cursor: help;
  display: flex; align-items: center; justify-content: center;
  color: var(--ok-ink); background: var(--ok-soft); border: 1px solid color-mix(in oklch, var(--ok) 30%, transparent);
}
.koffer-mine svg { width: 15px; height: 15px; }
html.td-debug .koffer-wonr { cursor: alias; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Monat komplett auswählen – links, auf einer Linie mit den Kästchen */
.wartung-group-header .koffer-month-check-slot { display: inline-block; width: 24px; flex: 0 0 24px; order: -1; }
.koffer-month-check {
  order: -1; flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border: none; background: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.koffer-month-check:hover .koffer-check-box { border-color: var(--accent); }
.koffer-month-check.is-all .koffer-check-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.koffer-month-check.is-some .koffer-check-box { border-color: var(--accent); background: var(--accent-soft); }
.koffer-month-check.is-some .koffer-check-box svg { display: none; }
.koffer-month-check.is-some .koffer-check-box::after { content: ""; width: 9px; height: 2px; border-radius: 1px; background: var(--accent); }

/* Auswahlleiste im Fuß */
.auftraege-footer .koffer-bar { display: none; }
.auftraege-footer.has-selection > .auftraege-count-label,
.auftraege-footer.has-selection > div:not(.koffer-bar) { display: none !important; }
.auftraege-footer.has-selection { background: var(--accent-soft); }
.auftraege-footer.has-selection .koffer-bar { display: flex; align-items: center; gap: 10px; width: 100%; }
.koffer-bar-count { font-size: 13px; font-weight: 650; color: var(--accent-ink); white-space: nowrap; }
.koffer-bar-clear { color: var(--ink-2); }
.koffer-bar-spacer { flex: 1; }
.koffer-bar-book { min-width: 132px; justify-content: center; }

@media (max-width: 640px) {
  .auftrag-item.koffer-item, .wartung-item.koffer-item {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    grid-template-areas:
      "check left   right"
      "check center action";
    column-gap: 10px;
  }
  .koffer-item .koffer-check { grid-area: check; align-self: center; width: 28px; height: 28px; }
  .koffer-item .koffer-check-box { width: 24px; height: 24px; border-radius: 7px; }
  .koffer-item .koffer-check-box svg { width: 15px; height: 15px; }
  .koffer-mine { grid-area: action; justify-self: end; width: 40px; height: 40px; }
  .wartung-group-header { padding-left: 17px; padding-right: 16px; }
  .wartung-group-header .koffer-month-check-slot, .koffer-month-check { flex-basis: 28px; width: 28px; height: 28px; }
  .auftraege-footer.has-selection .koffer-bar { flex-wrap: wrap; }
  .koffer-bar-spacer { display: none; }
  .koffer-bar-count { flex: 1 1 auto; }
  .koffer-bar-book { flex: 1 1 100%; min-height: 48px; font-size: 15px; border-radius: 12px; }
}
