/* ============================================================
   Logitrace – schlichtes, ruhiges Design
   Systemfonts (keine externen Requests), wenig Farbe, feine Linien
   ============================================================ */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2328;
  --ink-2: #57606a;
  --ink-3: #8b949e;
  --line: #e4e7eb;
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 216px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none !important;
}
.brand-logo { height: 26px; width: auto; display: block; }
.brand-name {
  font-size: 17px; font-weight: 650; color: var(--ink);
  letter-spacing: -0.01em;
}
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-section {
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-3); padding: 14px 10px 5px;
}
.nav-item {
  display: block;
  padding: 7px 10px; margin-bottom: 1px;
  border-radius: 6px;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: #f3f4f6; text-decoration: none; color: var(--ink); }
.nav-item.active { background: #eff6ff; color: var(--accent-ink); font-weight: 600; }
.sidebar-footer {
  padding: 11px 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-user { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  background: none; border: 1px solid var(--line); color: var(--ink-2);
  font-family: inherit; font-size: 12.5px;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.logout-btn:hover { background: #f3f4f6; color: var(--ink); }

/* ---------- Hauptbereich ---------- */
.main-content { margin-left: 216px; min-height: 100vh; }
.main-content.main-full { margin-left: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px 0;
}
.page-title { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.topbar-right { display: flex; gap: 8px; }
.content { padding: 14px 24px 48px; max-width: 1320px; }

/* ---------- Karten ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 15px; font-weight: 650; color: var(--ink); }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-weight: 550; font-size: 14px;
  padding: 7px 14px; border-radius: 6px;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none !important;
  transition: background .12s, border-color .12s, filter .12s;
}
.btn-primary { background: var(--accent); color: #fff !important; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #d0d5dd; }
.btn-secondary:hover { background: #f6f7f9; }
.btn-danger { background: #fff; color: var(--err) !important; border-color: #f0c2c2; }
.btn-danger:hover { background: #fdf2f2; }
.btn-ghost { background: transparent; color: var(--accent-ink); border-color: transparent; padding-left: 4px; padding-right: 4px; }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Meldungen ---------- */
.alert {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 13px;
  font-size: 14.3px; border: 1px solid transparent;
}
.alert-success { background: #f0f9f4; border-color: #d3ead9; color: #14532d; }
.alert-error { background: #fdf2f2; border-color: #f3d4d4; color: #7f1d1d; }
.alert-warning { background: #fffaeb; border-color: #f2e3c4; color: #78350f; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.3px; }
th, td { padding: 9px 14px; text-align: left; vertical-align: top; }
thead th {
  background: #fafbfc; color: var(--ink-2);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #eef0f2; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child { border-bottom: none; }
td.muted, .muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13.3px; }

/* ---------- Formulare ---------- */
label {
  display: block; font-weight: 550; font-size: 13.5px;
  color: var(--ink-2); margin: 11px 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: inherit; font-size: 14.5px;
  padding: 8px 11px;
  border: 1px solid #d0d5dd; border-radius: 6px;
  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, .13);
}
textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.form-hint { font-size: 12.7px; color: var(--ink-3); margin-top: 4px; }
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2px 14px 14px; margin: 0 0 14px;
}
legend { font-size: 13.5px; font-weight: 650; padding: 0 8px; color: var(--ink); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

/* ---------- Autovervollständigung ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid #d0d5dd; border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 18px rgba(31, 35, 40, .10);
  max-height: 236px; overflow-y: auto;
  display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 8px 11px; cursor: pointer; font-size: 14px; }
.ac-item:hover, .ac-item.hl { background: #f0f6ff; }
.ac-item .ac-sub { display: block; color: var(--ink-3); font-size: 12.5px; }
.ac-empty { padding: 8px 11px; color: var(--ink-3); font-size: 13.5px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 5px; font-size: 12px; font-weight: 600;
  background: #f3f4f6; color: var(--ink-2);
  white-space: nowrap;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #ecfdf3; color: #15803d; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-amber { background: #fffaeb; color: #b45309; }
.badge-gray { background: #f3f4f6; color: var(--ink-2); }
.badge-dark { background: #1f2328; color: #fff; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  padding: 8px 14px; font-weight: 550; font-size: 14px;
  color: var(--ink-2); border-radius: 6px 6px 0 0;
  text-decoration: none !important;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: #eff6ff; color: var(--accent-ink); font-weight: 650; }

/* ---------- Sendungsseite ---------- */
.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: 5px 18px; color: var(--ink-2); font-size: 14.3px; margin-top: 5px; }
.meta-pair b { color: var(--ink); font-weight: 600; }
.route-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.route-box { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.route-box .route-label { font-size: 11.5px; font-weight: 650; letter-spacing: .03em; color: var(--ink-3); }
.route-box .route-type { font-weight: 600; color: var(--accent-ink); margin-top: 4px; font-size: 14px; }
.route-box .route-addr { font-size: 14.5px; margin-top: 2px; }
.route-box .route-time { margin-top: 6px; font-weight: 600; font-size: 14px; }
.route-arrow { display: flex; align-items: center; font-size: 22px; color: var(--ink-3); }

/* ---------- Karte ---------- */
.map-box {
  height: 520px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); position: relative; background: #e9edf2;
}
.map-legend {
  position: absolute; z-index: 1000; right: 10px; bottom: 10px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 11px; font-size: 12.5px;
  max-width: 290px;
}
.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,.3); }
.pos-popup table { font-size: 13.3px; }
.pos-popup td { padding: 2px 8px 2px 0; }
.pos-popup .pp-title { font-weight: 650; margin-bottom: 4px; }
#mapStats { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

/* Start/Ziel-Label (prägnant) */
.endpoint-label {
  display: inline-block; padding: 3px 9px;
  border-radius: 5px; font-size: 12.5px; font-weight: 700; color: #fff;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  white-space: nowrap;
}
/* Event-Pin */
.event-pin {
  width: 15px; height: 15px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(31, 35, 40, .85), 0 2px 4px rgba(0, 0, 0, .5);
}

/* ---------- Statistik ---------- */
.stats-row { display: flex; flex-wrap: wrap; gap: 11px; margin-bottom: 15px; }
.stat-tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 15px;
}
.stat-tile .stat-v { font-size: 21px; font-weight: 650; line-height: 1.2; }
.stat-tile .stat-l { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 1px; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: #e4e7eb;
}
.tl-item { position: relative; margin-bottom: 6px; }
.tl-dot {
  position: absolute; left: -26px; top: 15px;
  width: 17px; height: 17px; 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 -26px;
  padding: 5px 0 5px 42px;
  display: flex; align-items: center; gap: 10px;
}
.tl-gap-bar {
  height: 7px; border-radius: 4px;
  background: repeating-linear-gradient(45deg, #e4e7eb, #e4e7eb 6px, #f3f4f6 6px, #f3f4f6 12px);
  min-width: 30px;
}
.tl-gap-text { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tl-card {
  background: #fff; border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px; padding: 10px 13px;
}
.tl-card:hover { border-color: #d7dce2; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.tl-type { font-weight: 650; font-size: 15px; }
.tl-time { font-size: 13.5px; color: var(--ink-2); font-weight: 550; }
.tl-facility { font-size: 14px; color: var(--accent-ink); font-weight: 550; margin-top: 5px; }
.tl-note { font-size: 14px; color: var(--ink-2); margin-top: 5px; }
.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 / Fehler ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box {
  width: 370px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 28px 30px 32px;
  box-shadow: 0 10px 30px rgba(31, 35, 40, .08);
}
.login-brand { text-align: center; margin-bottom: 16px; }
.login-brand img { height: 40px; margin-bottom: 6px; }
.login-brand h1 { font-size: 24px; font-weight: 650; margin: 2px 0 2px; }
.login-brand p { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.login-box .btn-block { margin-top: 18px; padding: 10px; font-size: 15px; }

.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; }
.error-code { font-size: 76px; font-weight: 700; color: var(--ink-3); line-height: 1; letter-spacing: -0.02em; }
.error-title { font-size: 24px; font-weight: 650; 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; }
.pagination { display: flex; gap: 6px; margin-top: 14px; align-items: center; }
.pagination a, .pagination span.cur {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); font-weight: 550; font-size: 14px;
}
.pagination span.cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.empty { text-align: center; padding: 42px 20px; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 6px; color: var(--ink-3); }
.inline-form { display: inline; }
details.raw pre {
  background: #f6f7f9; border: 1px solid var(--line);
  padding: 14px; border-radius: 6px; overflow: auto; max-height: 380px;
  font-size: 12.5px;
}
details.raw > summary::-webkit-details-marker { display: none; }
details.raw[open] > summary { border-bottom: 1px solid var(--line); }
.flag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12.3px; font-weight: 650; color: #fff;
}
.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, .55); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.list-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Einrichtungs-Picker */
.facility-chosen {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 7px; padding: 4px 8px 4px 10px;
  background: #ecfdf3; border: 1px solid #d3ead9; border-radius: 999px;
  font-size: 13.3px; font-weight: 600; color: #14532d;
}
.facility-chosen .fc-check { color: var(--ok); font-weight: 700; }
.facility-chosen .fc-clear {
  background: none; border: none; color: var(--ok);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.facility-chosen .fc-clear:hover { color: var(--err); }

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



