/* OrgaPilot.ORDER – Design System (basiert auf OrgaPilot WIS) */

:root {
  --bg-0: #0a0d14;
  --bg-1: #111520;
  --bg-2: #171c2d;
  --bg-3: #1e2436;
  --border: #252c40;
  --accent: #3b7efa;
  --accent-dark: #2563eb;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
  --blue: #3b82f6;
  --text-primary: #e8ecf4;
  --text-secondary: #8b97b4;
  --text-muted: #4e596e;
  --prio-sofort: #ef4444;
  --prio-dringend: #f97316;
  --prio-normal: #22c55e;

  --status-neu: #6b7280;
  --status-übermittelt: #3b82f6;
  --status-disponiert: #8b5cf6;
  --status-anfahrt: #f97316;
  --status-angekommen: #eab308;
  --status-transport: #06b6d4;
  --status-abgeschlossen: #22c55e;
  --status-storniert: #ef4444;

  --sidebar-w: 220px;
  --topbar-h: 52px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-0);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── LOGIN ─────────────────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.login-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .badge {
  background: var(--accent); color: #fff;
  font-size: .65rem; padding: 2px 10px;
  border-radius: 4px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
}
.login-logo .wordmark {
  font-size: 1.6rem; font-weight: 800;
  letter-spacing: .04em; margin-top: 8px;
  display: block;
}
.login-logo .wordmark span { color: var(--accent); }
.login-logo .sub {
  font-size: .72rem; color: #ffffff;
  letter-spacing: .15em; text-transform: uppercase; margin-top: 4px;
}
.login-footer { text-align: center; margin-top: 20px; font-size: .72rem; color: var(--text-muted); }

.btn-login {
  width: 100%; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); padding: 13px;
  font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: background .2s;
}
.btn-login:hover { background: var(--accent-dark); }

.form-error {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5; border-radius: var(--radius); padding: 10px 14px;
  font-size: .82rem; margin-bottom: 16px;
}

/* ── APP LAYOUT ─────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

#topbar {
  height: var(--topbar-h); background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  flex-shrink: 0; z-index: 100;
}

.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-brand .badge {
  background: var(--accent); color: #fff;
  font-size: .6rem; padding: 2px 8px; border-radius: 4px;
  font-weight: 700; letter-spacing: .08em;
}
.topbar-brand .wordmark { font-size: .95rem; font-weight: 700; letter-spacing: .04em; }
.topbar-brand .wordmark span { color: var(--accent); }
.topbar-spacer { flex: 1; }
.topbar-inst { font-size: .8rem; color: var(--text-secondary); }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.role-badge {
  font-size: .65rem; padding: 2px 8px; border-radius: 4px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-secondary); font-weight: 600; text-transform: uppercase;
}

#main-layout {
  display: flex; flex: 1; overflow: hidden;
}

/* ── SIDEBAR NAV ─────────────────────────────────────────────────── */
#sidebar-nav {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 12px 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.nav-section {
  font-size: .65rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .12em; text-transform: uppercase;
  padding: 14px 16px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; color: var(--text-secondary);
  text-decoration: none; font-size: .82rem; font-weight: 500;
  cursor: pointer; border-left: 2px solid transparent;
  transition: all .15s;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-2); }
.nav-link.active {
  color: var(--accent); background: rgba(59,126,250,.08);
  border-left-color: var(--accent);
}
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── CONTENT ─────────────────────────────────────────────────────── */
#content-area {
  flex: 1; overflow-y: auto;
  padding: 24px;
  background: var(--bg-0);
}

.view { display: none; animation: fadeIn .2s ease; }
.view.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 1.3rem; font-weight: 700; }
.page-header h2 { font-size: 1rem; font-weight: 600; }

.section-title {
  font-size: .85rem; font-weight: 600; color: var(--text-secondary);
  letter-spacing: .06em; text-transform: uppercase;
  margin: 24px 0 12px;
}

/* ── FORM ELEMENTS ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { font-size: .75rem; color: var(--text-secondary); font-weight: 500; letter-spacing: .04em; }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: var(--radius);
  padding: 10px 12px; font-family: inherit; font-size: .85rem;
  transition: border-color .15s; width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,126,250,.12);
}
.form-group textarea { resize: vertical; min-height: 60px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-row .form-group.flex-2 { flex: 2; }

.form-section {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
}
.form-section-title {
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 12px;
}
.req { color: var(--red); }
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-secondary);
  cursor: pointer; margin-top: 4px;
}
.radio-group { display: flex; gap: 16px; align-items: center; padding: 6px 0; }
.radio-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: .85rem; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius); padding: 9px 18px;
  font-weight: 600; font-size: .82rem; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: var(--radius);
  padding: 9px 18px; font-weight: 500; font-size: .82rem; cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--text-primary); }

.btn-danger {
  background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4);
  color: #fca5a5; border-radius: var(--radius);
  padding: 9px 18px; font-size: .82rem; cursor: pointer; font-weight: 500;
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-icon {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-secondary); border-radius: var(--radius);
  padding: 5px 12px; font-size: .78rem; cursor: pointer;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: .75rem; }

/* ── TABLES ──────────────────────────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .82rem;
}
.data-table th {
  background: var(--bg-2); color: var(--text-muted);
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 10px 12px;
  border-bottom: 1px solid var(--border); text-align: left;
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.data-table tr:hover td { background: var(--bg-2); }
.data-table tr:last-child td { border-bottom: none; }

/* ── STATUS BADGES ───────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; white-space: nowrap;
}
.status-NEU { background: rgba(107,114,128,.2); color: #d1d5db; border: 1px solid rgba(107,114,128,.3); }
.status-ÜBERMITTELT { background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.3); }
.status-DISPONIERT { background: rgba(139,92,246,.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }
.status-AUF_ANFAHRT { background: rgba(249,115,22,.15); color: #fdba74; border: 1px solid rgba(249,115,22,.3); }
.status-ANGEKOMMEN { background: rgba(234,179,8,.15); color: #fde68a; border: 1px solid rgba(234,179,8,.3); }
.status-TRANSPORT { background: rgba(6,182,212,.15); color: #67e8f9; border: 1px solid rgba(6,182,212,.3); }
.status-ABGESCHLOSSEN { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.status-STORNIERT { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }

/* ── CARDS GRID ──────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.institution-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  transition: border-color .15s;
}
.institution-card:hover { border-color: var(--accent); }
.institution-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.institution-card .type-badge {
  font-size: .68rem; background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-muted); padding: 2px 8px; border-radius: 4px;
  font-weight: 600;
}
.institution-card .meta { font-size: .78rem; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }
.institution-card .actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── MISSION TILES ───────────────────────────────────────────────── */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.mission-tile {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.mission-tile:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(59,126,250,.1); }

.tile-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.tile-order-nr { font-size: .75rem; font-weight: 700; color: var(--accent); }
.tile-time { font-size: .8rem; color: var(--text-secondary); }

.tile-status-bar {
  height: 4px;
  background: var(--border);
  position: relative;
}
.tile-status-bar .bar-fill {
  height: 100%; transition: width .5s ease;
  background: var(--accent);
}

.tile-body { padding: 14px; }
.tile-patient { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.tile-route {
  font-size: .78rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
.tile-route .arrow { color: var(--accent); }

.tile-info-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.tile-badge {
  font-size: .7rem; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-secondary);
}
.tile-badge.type-liegend { background: rgba(59,130,246,.1); color: #93c5fd; border-color: rgba(59,130,246,.25); }
.tile-badge.type-sitzend { background: rgba(34,197,94,.1); color: #86efac; border-color: rgba(34,197,94,.25); }
.tile-badge.type-maxicosi { background: rgba(234,179,8,.1); color: #fde68a; border-color: rgba(234,179,8,.25); }

.tile-feedback-msg {
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex; gap: 8px; align-items: flex-start;
}
.tile-eta {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.2);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: .78rem;
  color: #86efac;
  margin-top: 8px;
}

.tile-actions { padding: 0 14px 12px; display: flex; gap: 8px; }

/* Animierter "auf Anfahrt" Tile */
.mission-tile.on-the-way {
  border-color: rgba(249,115,22,.4);
  animation: tile-pulse 2s ease-in-out infinite;
}
@keyframes tile-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249,115,22,.15); }
  50% { box-shadow: 0 0 0 6px rgba(249,115,22,.05); }
}

/* ── STATS ───────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  text-align: center;
}
.stat-box .stat-val {
  font-size: 2rem; font-weight: 800; color: var(--accent);
  line-height: 1;
}
.stat-box .stat-lbl { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
}
.stat-card h3 { font-size: .82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }

.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: .75rem; }
.bar-row .bar-label { width: 120px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.bar-row .bar-val { width: 30px; text-align: right; color: var(--text-primary); font-weight: 600; }

/* Tages-Chart */
.day-chart { display: flex; align-items: flex-end; gap: 2px; height: 100px; }
.day-bar { flex: 1; min-width: 4px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .7; transition: opacity .2s; cursor: pointer; position: relative; }
.day-bar:hover { opacity: 1; }
.day-bar:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 7px; font-size: .68rem;
  white-space: nowrap; color: var(--text-primary); z-index: 10;
}

/* Feedback Donut (CSS only) */
.feedback-bars { display: flex; flex-direction: column; gap: 8px; }
.feedback-row { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.feedback-row .fi { font-size: 1.1rem; }

/* ── MODAL ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.7);
  animation: modalIn .2s ease;
}
.modal-xl { max-width: 920px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.modal-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-1); z-index: 5;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-3); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  position: sticky; bottom: 0; background: var(--bg-1);
}

/* Order Form Grid in Modal */
.order-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 680px) { .order-form-grid { grid-template-columns: 1fr; } }

/* ── FEEDBACK ────────────────────────────────────────────────────── */
.feedback-buttons {
  display: flex; gap: 20px; justify-content: center;
}
.feedback-btn {
  background: var(--bg-2); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: all .2s; font-size: .82rem; color: var(--text-secondary);
}
.feedback-btn:hover, .feedback-btn.selected { border-color: var(--accent); background: var(--bg-3); }
.feedback-btn.selected-1 { border-color: var(--red); }
.feedback-btn.selected-2 { border-color: var(--yellow); }
.feedback-btn.selected-3 { border-color: var(--green); }
.feedback-icon { font-size: 2.5rem; }
.feedback-icon.bad { filter: grayscale(0); }

/* ── TOAST ───────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 16px;
  min-width: 260px; max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: slideIn .3s ease;
  font-size: .82rem;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── ADMIN ───────────────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.admin-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.admin-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 8px; }
.admin-card p { font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }

/* ── SETTINGS ────────────────────────────────────────────────────── */
.settings-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.settings-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: .82rem; padding: 10px 16px;
  cursor: pointer; margin-bottom: -1px; font-family: inherit; font-weight: 500;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-section { max-width: 600px; }
.settings-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }
#settings-transport-doc { max-width: 780px; }

/* ── TRANSPORTSCHEIN SETTINGS ───────────────────────────────────── */
.td-settings-group {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.td-settings-group-title {
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px;
}
.td-settings-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px;
}
.td-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-3); border-radius: 6px; padding: 6px 10px;
  font-size: .82rem; cursor: pointer; user-select: none; gap: 8px;
}
.td-toggle-row:hover { background: var(--bg-1); }
.td-toggle-row input[type="checkbox"] { display: none; }
.td-toggle-label {
  width: 36px; height: 20px; background: var(--bg-1); border-radius: 10px;
  position: relative; flex-shrink: 0; border: 1px solid var(--border); transition: background .2s;
}
.td-toggle-label::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); transition: left .2s, background .2s;
}
.td-toggle-row input[type="checkbox"]:checked ~ .td-toggle-label { background: #ef4444; border-color: #ef4444; }
.td-toggle-row input[type="checkbox"]:checked ~ .td-toggle-label::after { left: 18px; background: #fff; }
.td-toggle-row span:first-child { flex: 1; color: var(--text-primary); }

/* ── TRANSPORTSCHEIN FORMULAR MODAL ─────────────────────────────── */
.td-checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 16px; margin-bottom: 4px;
}
.td-chk-label {
  display: flex; align-items: center; gap: 6px; font-size: .83rem;
  padding: 4px 6px; border-radius: 4px; cursor: pointer;
  color: var(--text-primary); user-select: none;
}
.td-chk-label:hover { background: var(--bg-2); }
.td-chk-label input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--accent);
  flex-shrink: 0; cursor: pointer;
}
.td-chk-label.td-chk-locked { opacity: .5; cursor: not-allowed; }
.td-chk-label.td-chk-locked input { cursor: not-allowed; }

/* ── FILTERS ─────────────────────────────────────────────────────── */
.filters-bar {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.filters-bar input, .filters-bar select {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: var(--radius);
  padding: 8px 12px; font-size: .82rem; font-family: inherit;
}
.filters-bar input { min-width: 200px; }

/* ── TRANSPORT DOC (Druck-Layout) ───────────────────────────────── */
@media print {
  body > *:not(#transport-doc-container) { display: none !important; }
  #transport-doc-container { display: block !important; }
}

.transport-doc {
  font-family: 'Arial', sans-serif; color: #000;
  max-width: 21cm; margin: 0 auto;
  font-size: 12px; line-height: 1.4;
}
.doc-title { font-size: 18px; font-weight: bold; margin-bottom: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.doc-section h4 { font-size: 13px; font-weight: bold; margin-bottom: 8px; }
.doc-row { display: flex; margin-bottom: 4px; }
.doc-row .doc-label { width: 130px; font-weight: bold; flex-shrink: 0; font-size: 11px; }
.doc-row .doc-val { flex: 1; font-size: 11px; }
.doc-checkboxes { margin: 8px 0; }
.doc-checkbox-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 4px; font-size: 11px; }
.doc-checkbox-item { display: flex; align-items: center; gap: 4px; }
.doc-checkbox { width: 12px; height: 12px; border: 1.5px solid #000; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.doc-box { border: 1.5px solid #000; height: 80px; margin-top: 8px; }
.doc-divider { border: none; border-top: 1px solid #000; margin: 16px 0; }
.doc-footer { margin-top: 16px; font-size: 10px; color: #666; }
.doc-bold { font-weight: bold; }

/* ── SCROLLBAR ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── MISC ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.msg-bubble {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  font-size: .8rem; margin-bottom: 8px;
}
.msg-bubble.from-disponent { border-left: 3px solid var(--accent); }
.msg-bubble.from-system { border-left: 3px solid var(--text-muted); color: var(--text-muted); }
.msg-time { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.detail-section { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.detail-section h4 { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 6px; font-size: .82rem; }
.detail-label { color: var(--text-muted); min-width: 100px; }
.detail-val { color: var(--text-primary); font-weight: 500; }

/* Station rows in institution modal */
.station-row {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.station-row .station-name { flex: 1; font-size: .85rem; font-weight: 600; }
.station-row .station-meta { font-size: .75rem; color: var(--text-muted); }
