/* ============================================================
   Auswertung – Hauptstylesheet
   ============================================================ */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #9ca3af;
  --line: #e5e7eb;
  --brand: #1d4ed8;
  --brand-2: #1e3a8a;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --sidebar-bg: #111827;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Barlow', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 230px;
  background: var(--sidebar-bg);
  color: #d1d5db;
  display: flex; flex-direction: column;
  z-index: 50;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #1f2937;
}
.brand-icon { font-size: 22px; }
.brand-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800; font-size: 22px; letter-spacing: .5px;
  color: #fff; text-transform: uppercase;
}
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  color: #6b7280; padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin-bottom: 2px;
  border-radius: 8px;
  color: #d1d5db; font-weight: 500; font-size: 14.5px;
}
.nav-item:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-icon { width: 18px; text-align: center; opacity: .9; }
.sidebar-footer {
  padding: 12px 14px; border-top: 1px solid #1f2937;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-user { font-size: 13px; color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  background: none; border: 1px solid #374151; color: #d1d5db;
  font-family: inherit; font-size: 12px;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.logout-btn:hover { background: #1f2937; color: #fff; }

.main-content { margin-left: 230px; min-height: 100vh; }
.main-content.main-full { margin-left: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 0;
}
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px; font-weight: 800; margin: 0;
  text-transform: uppercase; letter-spacing: .4px;
}
.topbar-right { display: flex; gap: 8px; }
.content { padding: 18px 28px 50px; }

/* ---------- Karten / Panels ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}
.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 19px;
  text-transform: uppercase; letter-spacing: .4px;
}
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Barlow', sans-serif; font-weight: 600; font-size: 14px;
  padding: 8px 15px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none !important;
  transition: filter .12s, background .12s;
}
.btn-primary { background: var(--brand); color: #fff !important; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: var(--err); color: #fff !important; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert {
  padding: 11px 15px; border-radius: 8px; margin-bottom: 14px;
  font-weight: 500; font-size: 14.5px;
  border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; }
thead th {
  background: #f9fafb; color: var(--ink-2);
  font-size: 12px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:hover { background: #f9fafb; }
tbody tr:last-child { border-bottom: none; }
td.muted, .muted { color: var(--ink-3); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13.5px; }

/* ---------- Formulare ---------- */
label {
  display: block; font-weight: 600; font-size: 13.5px;
  color: var(--ink-2); margin: 12px 0 5px;
}
label .req { color: var(--err); }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=datetime-local], input[type=date], input[type=time],
select, textarea {
  width: 100%;
  font-family: 'Barlow', sans-serif; font-size: 15px;
  padding: 9px 12px;
  border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 22px; }
.form-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 16px 16px; margin: 0 0 16px;
}
legend {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 17px; text-transform: uppercase;
  padding: 0 8px; color: var(--brand-2);
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

/* ---------- Autocomplete ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid #d1d5db; border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  max-height: 240px; overflow-y: auto;
  display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 9px 12px; cursor: pointer; font-size: 14px; }
.ac-item:hover, .ac-item.hl { background: #eff6ff; }
.ac-item .ac-sub { display: block; color: var(--ink-3); font-size: 12.5px; }
.ac-empty { padding: 9px 12px; color: var(--ink-3); font-size: 13.5px; }

/* ---------- Badges / Chips ---------- */
.badge {
  display: inline-block; padding: 2.5px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #e5e7eb; color: var(--ink-2);
  white-space: nowrap;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-dark { background: #111827; color: #fff; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 16px; font-weight: 600; font-size: 14.5px;
  color: var(--ink-2); border-radius: 8px 8px 0 0;
  text-decoration: none !important;
}
.tab:hover { background: #eef2ff; }
.tab.active { background: var(--brand); color: #fff; }

/* ---------- Sendungs-Detail: Kopf ---------- */
.ship-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.ship-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14.5px; margin-top: 4px; }
.meta-pair b { color: var(--ink); font-weight: 600; }
.route-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.route-box { background: #f9fafb; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; }
.route-box .route-label { font-size: 11.5px; font-weight: 800; letter-spacing: 1px; color: var(--ink-3); text-transform: uppercase; }
.route-box .route-type { font-weight: 700; color: var(--brand-2); margin-top: 5px; }
.route-box .route-addr { font-size: 15px; margin-top: 2px; }
.route-box .route-time { margin-top: 7px; font-weight: 600; }
.route-arrow { display: flex; align-items: center; font-size: 26px; color: var(--ink-3); }

/* ---------- Karte ---------- */
.map-box {
  height: 520px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); position: relative;
}
.map-legend {
  position: absolute; z-index: 1000; right: 10px; bottom: 10px;
  background: rgba(255,255,255,.94); border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  max-width: 280px;
}
.map-legend .lg-row { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.lg-swatch { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.pos-popup table { font-size: 13px; }
.pos-popup td { padding: 2px 7px 2px 0; }
.pos-popup .pp-title { font-weight: 700; margin-bottom: 4px; }

/* ---------- Timeline / Auswertung ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px;
  width: 3px; background: linear-gradient(#dbeafe, #93c5fd);
  border-radius: 3px;
}
.tl-item { position: relative; margin-bottom: 6px; }
.tl-dot {
  position: absolute; left: -28px; top: 14px;
  width: 21px; height: 21px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent);
  box-shadow: 0 0 0 3px #fff;
}
.tl-gap {
  position: relative; margin: 0 0 6px -28px;
  padding: 6px 0 6px 44px;
  display: flex; align-items: center; gap: 10px;
}
.tl-gap-bar {
  height: 8px; border-radius: 5px;
  background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 6px, #f3f4f6 6px, #f3f4f6 12px);
  min-width: 30px;
}
.tl-gap-text { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tl-card {
  background: #fff; border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px; padding: 11px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.tl-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.09); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.tl-type { font-weight: 800; font-size: 15.5px; }
.tl-time { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.tl-facility { font-size: 14px; color: var(--brand-2); font-weight: 600; margin-top: 5px; }
.tl-note { font-size: 14px; color: var(--ink-2); margin-top: 5px; font-style: italic; }
.tl-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tl-actions { margin-left: auto; display: flex; gap: 5px; }
.tl-addr { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

/* ---------- Login / Fehlerseite ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #111827 0%, #1e3a8a 100%);
}
.login-box {
  width: 380px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 14px;
  padding: 30px 32px 34px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-brand { text-align: center; margin-bottom: 14px; }
.login-brand .brand-icon { font-size: 34px; }
.login-brand h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px; font-weight: 800; margin: 4px 0 2px;
  text-transform: uppercase;
}
.login-brand p { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.login-box .btn-block { margin-top: 20px; padding: 11px; font-size: 15.5px; }

.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; }
.error-code { font-family: 'Barlow Condensed', sans-serif; font-size: 90px; font-weight: 800; color: var(--err); line-height: 1; }
.error-title { font-family: 'Barlow Condensed', sans-serif; font-size: 27px; font-weight: 700; margin: 8px 0; }
.error-message { color: var(--ink-2); margin-bottom: 22px; }

/* ---------- Diverses ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.toolbar .field { flex: 0 0 auto; }
.toolbar label { margin-top: 0; }
.stats-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.stat-tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 17px; box-shadow: var(--shadow);
}
.stat-tile .stat-v { font-family: 'Barlow Condensed', sans-serif; font-size: 27px; font-weight: 800; line-height: 1.1; }
.stat-tile .stat-l { font-size: 12.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.pagination { display: flex; gap: 6px; margin-top: 14px; align-items: center; }
.pagination a, .pagination span.cur {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14px;
}
.pagination span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.inline-form { display: inline; }
details.raw pre {
  background: #0f172a; color: #e2e8f0;
  padding: 14px; border-radius: 8px; overflow: auto; max-height: 380px;
  font-size: 12.5px;
}
.flag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: #fff;
}
.list-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hidden { display: none !important; }
.flash-highlight { animation: flashhl 1.6s ease-out; }
@keyframes flashhl {
  0% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .65); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
#mapStats { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

/* Einrichtungs-Picker */
.facility-chosen {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 7px; padding: 4px 8px 4px 10px;
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: #065f46;
}
.facility-chosen .fc-check { color: #059669; font-weight: 800; }
.facility-chosen .fc-clear {
  background: none; border: none; color: #059669;
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.facility-chosen .fc-clear:hover { color: #b91c1c; }
details.raw > summary::-webkit-details-marker { display: none; }
details.raw[open] > summary { border-bottom: 1px solid var(--line); }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .brand-name, .nav-item span:not(.nav-icon), .nav-section, .sidebar-user { display: none; }
  .main-content { margin-left: 64px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .route-grid { grid-template-columns: 1fr; }
  .route-arrow { display: none; }
  .map-box { height: 380px; }
}



