/* =========================================================================
   OX Management – Desktop-App · Dark Theme
   Design-Tokens identisch mit Techniker-PWA (techapp/styles.css)
   ========================================================================= */
:root {
  --bg:            #0c0e13;
  --surface:       #181c25;
  --surface-2:     #1f242f;
  --surface-3:     #262d3a;
  --border:        #242a36;
  --border-strong: #313847;
  --text:          #e8eaf1;
  --muted:         #9097a6;
  --faint:         #5d6473;
  --accent:        #6c6cf5;
  --accent-2:      #8a6cff;
  --accent-soft:   rgba(108,108,245,.15);
  --success:       #38d39f;
  --success-soft:  rgba(56,211,159,.15);
  --warning:       #f7b955;
  --warning-soft:  rgba(247,185,85,.15);
  --danger:        #f46a6a;
  --danger-soft:   rgba(244,106,106,.15);
  --info:          #45b6f5;
  --info-soft:     rgba(69,182,245,.15);
  --radius:   14px;
  --radius-m: 10px;
  --radius-s: 7px;
  --shadow:   0 2px 8px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --sidebar-w: 220px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, select { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* =========================================================================
   LOGIN
   ========================================================================= */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
}

.login-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}
.login-brand strong { display: block; font-size: 17px; font-weight: 600; }
.login-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-m);
  letter-spacing: .5px;
  flex-shrink: 0;
}
.logo-mark.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-s);
  padding: 11px;
  font-weight: 600;
  font-size: 14px;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .5; cursor: default; }

.err {
  color: var(--danger);
  font-size: 13px;
  background: var(--danger-soft);
  border-radius: var(--radius-s);
  padding: 9px 12px;
}

.login-hint { font-size: 12px; color: var(--faint); text-align: center; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-label { font-size: 14px; font-weight: 600; color: var(--text); }

.nav-items {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  font-size: 14px;
  color: var(--muted);
  transition: background .12s, color .12s;
  text-align: left;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.badge-soon {
  margin-left: auto;
  font-size: 10px;
  background: var(--surface-3);
  color: var(--faint);
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 500;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: var(--radius-s);
  overflow: hidden;
  min-width: 0;
}
.user-chip svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.user-chip span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-logout {
  padding: 6px 8px;
  border-radius: var(--radius-s);
  color: var(--muted);
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.btn-logout svg { width: 17px; height: 17px; }
.btn-logout:hover { background: var(--danger-soft); color: var(--danger); }

/* ---- Main area ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.view[hidden] { display: none; }
.view.active { display: flex; }

/* =========================================================================
   AUFTRÄGE VIEW
   ========================================================================= */
.view-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-wrap {
  flex: 1;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 9px 12px 9px 36px;
  outline: none;
  transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--accent); }

.filter-select {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 9px 12px;
  outline: none;
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
}
.filter-select:focus { border-color: var(--accent); }

/* Split layout */
.split-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.list-panel {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.detail-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* Vorgang list */
.vorgang-list { display: flex; flex-direction: column; }

.list-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.vorgang-card {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.vorgang-card:hover { background: var(--surface); }
.vorgang-card.selected { background: var(--accent-soft); border-left: 3px solid var(--accent); }

.vc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vc-number { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.vc-date { font-size: 11px; color: var(--faint); }
.vc-kunde { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-geraet { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sb-neu        { background: var(--info-soft); color: var(--info); }
.sb-angenommen { background: var(--accent-soft); color: var(--accent); }
.sb-pruefung   { background: var(--warning-soft); color: var(--warning); }
.sb-reparatur  { background: var(--accent-soft); color: var(--accent-2); }
.sb-warten_teil{ background: var(--warning-soft); color: var(--warning); }
.sb-fertig     { background: var(--success-soft); color: var(--success); }
.sb-abgeholt   { background: rgba(56,211,159,.08); color: #5bbf9e; }
.sb-storniert  { background: var(--danger-soft); color: var(--danger); }

/* ---- Detail panel ---- */
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--faint);
  gap: 14px;
}
.detail-empty svg { width: 56px; height: 56px; opacity: .4; }
.detail-empty p { font-size: 14px; }

.detail-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.detail-title { font-size: 20px; font-weight: 700; }
.detail-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.info-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--faint);
  margin-bottom: 2px;
}
.kv-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.kv-key { font-size: 12px; color: var(--muted); min-width: 110px; flex-shrink: 0; }
.kv-val { font-size: 13px; color: var(--text); font-weight: 500; }
.kv-val a { color: var(--accent); }
.kv-val a:hover { text-decoration: underline; }

.flags-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.flag-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}
.flag-chip.warn { background: var(--warning-soft); color: var(--warning); }

/* Status timeline */
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
  position: relative;
}
.timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}
.timeline-item:last-child { padding-bottom: 0; }
.tl-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
}
.tl-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}
.tl-dot.last { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.tl-line {
  flex: 1;
  width: 2px;
  background: var(--border-strong);
  margin-top: 2px;
}
.timeline-item:last-child .tl-line { display: none; }
.tl-body { flex: 1; }
.tl-code { font-size: 11px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.tl-note { font-size: 13px; color: var(--text); }
.tl-ts { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* Termine in detail */
.termin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.termin-item {
  background: var(--surface-2);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.termin-item svg { width: 15px; height: 15px; color: var(--muted); }
.termin-info { flex: 1; }
.termin-date { font-size: 13px; font-weight: 600; }
.termin-tech { font-size: 12px; color: var(--muted); }

/* =========================================================================
   KALENDER VIEW
   ========================================================================= */
.cal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-s);
  color: var(--muted);
  transition: background .12s, color .12s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.cal-week-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 230px;
  text-align: center;
}

.btn-today {
  padding: 6px 14px;
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  transition: background .12s;
  margin-left: 4px;
}
.btn-today:hover { background: var(--surface-3); }

.tech-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tech-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.tech-dot-mark {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Workload bars */
.workload-bars {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  flex-shrink: 0;
}
.workload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.workload-item:hover { background: var(--surface-2); }
.workload-item.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.wl-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.wl-name { font-size: 13px; font-weight: 500; min-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.wl-bar { height: 100%; border-radius: 4px; transition: width .3s; }
.wl-hours { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 50px; text-align: right; }

/* Calendar scroll wrapper */
.cal-scroll-wrap {
  flex: 1;
  overflow: auto;
}

/* Calendar grid */
.cal-grid-outer {
  display: grid;
  /* time labels column + 7 day columns */
  grid-template-columns: 52px repeat(7, minmax(120px, 1fr));
  min-width: 900px;
  position: relative;
}

.cal-day-header {
  text-align: center;
  padding: 10px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.cal-day-header.today { color: var(--accent); }
.cal-day-header .day-name { color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.cal-day-header .day-num { font-size: 18px; font-weight: 700; }
.cal-corner {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  z-index: 6;
}

/* Time rows */
.cal-time-label {
  text-align: right;
  padding-right: 8px;
  padding-top: 0;
  font-size: 11px;
  color: var(--faint);
  line-height: 1;
  transform: translateY(-6px);
  user-select: none;
}
.cal-day-col {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  background: var(--bg);
}
.cal-day-col.today-col { background: rgba(108,108,245,.03); }
.cal-hour-row {
  height: 60px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.cal-hour-row.half::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  border-top: 1px dashed var(--border);
}
.cal-time-col {
  border-right: 1px solid var(--border);
}

/* Appointments */
.cal-apt {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  line-height: 1.35;
  transition: filter .1s;
  border-left: 3px solid rgba(255,255,255,.3);
}
.cal-apt:hover { filter: brightness(1.1); z-index: 3; }
.cal-apt-dim { opacity: .2; pointer-events: none; }
.cal-apt-time { font-weight: 700; opacity: .9; }
.cal-apt-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-apt-tech { opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tooltip on hover */
.apt-tooltip {
  position: fixed;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 12px;
  z-index: 100;
  max-width: 260px;
  pointer-events: none;
  box-shadow: var(--shadow);
  display: none;
}
.apt-tooltip.visible { display: block; }
.att-title { font-weight: 700; margin-bottom: 4px; }
.att-row { display: flex; gap: 6px; color: var(--muted); }
.att-key { min-width: 70px; }
.att-val { color: var(--text); }

/* Calendar loading */
.cal-loading {
  grid-column: 1 / -1;
  padding: 60px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}

/* =========================================================================
   CONTROLLING VIEW
   ========================================================================= */
.ctrl-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.ctrl-coming-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 520px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
.ctrl-coming-card svg { width: 72px; height: 72px; color: var(--faint); opacity: .5; }
.ctrl-coming-card h2 { font-size: 22px; font-weight: 700; }
.ctrl-coming-card p { color: var(--muted); font-size: 14px; line-height: 1.7; }

.ctrl-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.chip-soon {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--faint);
  border: 1px solid var(--border-strong);
}

/* =========================================================================
   MODAL (mobile fallback)
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay[hidden] { display: none !important; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 22px;
  color: var(--muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-s);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* =========================================================================
   UTILITIES
   ========================================================================= */
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* =========================================================================
   MOBILE – nur ≤768px
   ========================================================================= */

/* Mobile topbar: standardmäßig versteckt (Desktop zeigt Sidebar) */
.mobile-topbar { display: none; }
.mobile-cal { display: none; }

@media (max-width: 768px) {
  html, body { overflow: hidden; }

  /* App-Shell: vertikal stapeln */
  .app-shell {
    flex-direction: column;
    height: 100vh; /* Fallback für ältere Browser */
    height: 100dvh;
  }

  /* Mobile Topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(12,14,19,.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 20;
  }
  .mobile-topbar-title {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    flex-shrink: 0;
  }
  .mobile-back svg { width: 18px; height: 18px; }
  .mobile-back:active { background: var(--surface-2); }
  .mobile-user-badge {
    font-size: 11px;
    color: var(--faint);
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 10px;
    color: var(--muted);
    flex-shrink: 0;
  }
  .mobile-logout-btn svg { width: 18px; height: 18px; }
  .mobile-logout-btn:active { background: var(--danger-soft); color: var(--danger); }

  /* Sidebar → Bottom-Nav */
  .sidebar {
    order: 3;
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
  .sidebar-brand { display: none; }
  .sidebar-footer { display: none; }
  .nav-items {
    flex-direction: row;
    padding: 4px 0 0;
    gap: 0;
    justify-content: space-around;
    align-items: stretch;
    flex: 1;
  }
  .nav-item {
    flex: 1;
    flex-direction: column;
    padding: 8px 4px 10px;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 0;
    align-items: center;
    justify-content: flex-start;
    color: var(--faint);
  }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item.active {
    background: none;
    color: var(--accent);
    font-weight: 700;
  }
  .badge-soon { display: none; }

  /* Main area: Mitte, scroll-container */
  .main-area {
    flex: 1;
    overflow: hidden;
    order: 2;
    min-height: 0;
  }

  /* Views: volle Höhe, einzelne Spalte */
  .view { height: 100%; overflow: hidden; display: flex; flex-direction: column; }

  /* Aufträge: Suchleiste + scrollbare Liste */
  .view-head {
    padding: 10px 12px;
    flex-shrink: 0;
    z-index: 5;
  }
  .search-row { flex-direction: column; gap: 8px; }
  .filter-select { width: 100%; min-width: 0; }

  .split-layout {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .list-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-right: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: auto;
  }
  /* Desktop detail panel versteckt; Mobile nutzt Overlay */
  .detail-panel { display: none !important; }

  /* Vorgang-Karte: etwas mehr Padding für Touch */
  .vorgang-card { padding: 14px 16px; }
  .vc-head { flex-wrap: wrap; gap: 6px; }

  /* Kalender: kein Desktop-Grid, stattdessen Mobile-View */
  .cal-header {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 12px;
    flex-shrink: 0;
  }
  .cal-nav { gap: 2px; }
  .cal-week-label { font-size: 13px; min-width: 0; }
  .tech-legend { display: none; } /* zu eng auf Mobile */

  .cal-body { overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0; }
  /* Workload-Balken → horizontale Chip-Leiste auf Mobile */
  .workload-bars {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    flex-shrink: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .workload-bars::-webkit-scrollbar { display: none; }
  .workload-item {
    flex: none;
    min-width: auto;
    max-width: none;
    padding: 6px 12px;
    border-radius: 20px;
    gap: 6px;
    white-space: nowrap;
    flex-direction: row;
    align-items: center;
  }
  .workload-item.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
  }
  /* Balken verstecken auf Mobile, nur Chip sichtbar */
  .workload-item .wl-bar-wrap { display: none; }
  .wl-name { min-width: auto; font-size: 13px; }
  .wl-hours { min-width: auto; font-size: 12px; }
  .desktop-only { display: none !important; }

  /* Mobile Kalender: Tag-Auswahl + Liste */
  .mobile-cal {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
  }
  .mobile-day-sel {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    scrollbar-width: none;
  }
  .mobile-day-sel::-webkit-scrollbar { display: none; }
  .mobile-day-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    min-width: 46px;
    cursor: pointer;
    flex-shrink: 0;
    gap: 2px;
    transition: background .1s, color .1s;
  }
  .mobile-day-btn .mdb-name { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
  .mobile-day-btn .mdb-num { font-size: 16px; font-weight: 700; }
  .mobile-day-btn .mdb-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--accent); opacity: 0;
  }
  .mobile-day-btn.has-apts .mdb-dot { opacity: 1; }
  .mobile-day-btn.today { border-color: var(--accent); color: var(--accent); }
  .mobile-day-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }
  .mobile-day-btn.selected .mdb-dot { background: rgba(255,255,255,.6); }

  .mobile-day-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .mobile-apt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }
  .mobile-apt-color-bar {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
  }
  .mobile-apt-body { flex: 1; min-width: 0; }
  .mobile-apt-time { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  .mobile-apt-vnr { font-size: 15px; font-weight: 700; }
  .mobile-apt-kunde { font-size: 13px; color: var(--text); }
  .mobile-apt-tech { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .mobile-apt-empty {
    text-align: center;
    color: var(--faint);
    font-size: 13px;
    padding: 40px 20px;
  }

  /* Controlling: kompakter auf Mobile */
  .ctrl-wrap { padding: 20px; align-items: flex-start; }
  .ctrl-coming-card { padding: 28px 20px; }
  .ctrl-coming-card svg { width: 48px; height: 48px; }
  .ctrl-coming-card h2 { font-size: 18px; }

  /* Detail-Content auf Mobile (im Overlay) */
  .detail-content { padding: 16px; gap: 14px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-title { font-size: 17px; }
}

/* Mobile Detail Overlay (wird per JS erzeugt) */
.mobile-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mobile-detail-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(12,14,19,.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-detail-topbar-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-detail-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

