/* ==========================================================================
   Rheinfracht · Disposition — Demo-UI
   Bewusst NICHT im Fairwaydevs-Portfolio-Look, sondern als nüchternes,
   glaubwürdiges Business-Tool eines (fiktiven) Logistik-Kunden: neutrale
   Sans, Navy statt Signalrot, Sidebar-Layout. Der Fairwaydevs-Bezug lebt
   nur in der schmalen Meta-Leiste oben.
   ========================================================================== */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../../fonts/jetbrains-mono-latin-var.woff2") format("woff2");
}

:root {
  --brand: #1b4f8a;
  --brand-600: #163f6d;
  --brand-050: #edf3f9;

  --ink: #1b2430;
  --bg: #eef1f5;
  --paper: #ffffff;
  --line: #e2e7ef;
  --line-2: #eef1f5;
  --muted: #6a7688;

  --st-offen: #64748b;
  --st-disponiert: #bd7b12;
  --st-unterwegs: #0d8f9c;
  --st-zugestellt: #1c9d5f;

  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar-w: 232px;
  --radius: 9px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Meta-Leiste (Fairwaydevs-Rahmen) ────────────────────────────────── */
.demobar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 8px clamp(16px, 4vw, 28px);
  background: var(--ink); color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}
.demobar__back {
  display: inline-flex; align-items: center; gap: 7px;
  color: #fff; text-decoration: none; font-weight: 500;
}
.demobar__back:hover { color: #fff; opacity: 0.85; }
.demobar__meta { text-align: right; }
.demobar__meta strong { color: #fff; font-weight: 600; }
/* Impressum und Datenschutz müssen von jeder Seite aus erreichbar sein. */
.demobar__meta a { color: #fff; text-decoration: none; margin-left: 14px; }
.demobar__meta a:hover { text-decoration: underline; }

/* ── Shell ───────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: calc(100vh - 37px); }

/* ── Sidebar (Kundenmarke) ───────────────────────────────────────────── */
.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: flex-start; height: calc(100vh - 37px);
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px; border-bottom: 1px solid var(--line-2);
}
.brand__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand-050); color: var(--brand);
}
.brand__name { display: flex; flex-direction: column; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand__sub { font-weight: 500; font-size: 10.5px; letter-spacing: 0.02em; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; flex: 1; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 7px;
  font-size: 13.5px; font-weight: 500; color: #45505f;
  text-decoration: none;
}
.nav__item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav__item.is-active {
  background: var(--brand-050); color: var(--brand); font-weight: 600;
}
.nav__item.is-muted { color: #aab2be; cursor: default; }
.nav__item:not(.is-active):not(.is-muted):hover { background: #f4f6fa; }

.sidebar__foot { padding: 14px 16px; border-top: 1px solid var(--line-2); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.who small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.who__av {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600;
}

/* ── Main ────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 3vw, 32px);
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.topbar__sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.content { padding: clamp(18px, 3vw, 28px) clamp(16px, 3vw, 32px) 44px; }

/* ── Hinweis ─────────────────────────────────────────────────────────── */
.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 22px;
  background: #fbf7ec; border: 1px solid #eadfbf; border-radius: var(--radius);
}
.notice__badge {
  flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #fff; background: var(--st-disponiert);
  padding: 3px 8px; border-radius: 5px;
}
.notice p { margin: 0; flex: 1 1 320px; font-size: 12.5px; color: #6a5a34; }
.notice__reset {
  flex: 0 0 auto; font-size: 12px; font-weight: 500;
  padding: 6px 12px; background: #fff; color: var(--ink);
  border: 1px solid #e0d6b8; border-radius: 6px; cursor: pointer;
}
.notice__reset:hover { border-color: #cbbf98; }

/* ── Kennzahlen ──────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  display: flex; flex-direction: column; gap: 5px; text-align: left;
  padding: 15px 16px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: box-shadow .14s, border-color .14s;
}
.stat::before {
  content: ""; width: 26px; height: 3px; border-radius: 3px;
  background: var(--sc, var(--line)); margin-bottom: 3px;
}
.stat:hover { box-shadow: 0 3px 12px rgba(27, 36, 48, 0.06); }
.stat.is-active { border-color: var(--sc, var(--brand)); box-shadow: 0 0 0 1px var(--sc, var(--brand)) inset; }
.stat--offen { --sc: var(--st-offen); }
.stat--disponiert { --sc: var(--st-disponiert); }
.stat--unterwegs { --sc: var(--st-unterwegs); }
.stat--zugestellt { --sc: var(--st-zugestellt); }
.stat__num { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 11.5px; font-weight: 500; color: var(--muted); }

/* ── Toolbar ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 200px;
  padding: 9px 13px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted);
}
.search:focus-within { border-color: var(--brand); }
.search input {
  border: none; outline: none; background: transparent; width: 100%;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
}
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 500; padding: 8px 13px;
  background: var(--paper); color: #4b5563; border: 1px solid var(--line);
  border-radius: 7px; cursor: pointer; transition: background-color .14s, color .14s, border-color .14s;
}
.chip:hover { border-color: #cfd6e0; }
.chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 10px 15px; background: var(--brand); color: #fff;
  border: none; border-radius: 8px; cursor: pointer; transition: background-color .14s;
}
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 10px 15px; background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { border-color: #cfd6e0; }

/* ── Tabelle ─────────────────────────────────────────────────────────── */
.table-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.orders { width: 100%; border-collapse: collapse; }
.orders thead th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted); padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: #f9fafc;
}
.orders tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.orders tbody tr:last-child td { border-bottom: none; }
.orders tbody tr { transition: background-color .12s; }
.orders tbody tr:hover { background: #f9fafc; }

.nr { font-family: var(--mono); font-size: 12.5px; color: #3a4553; }
.kunde { font-weight: 600; }
.termin { font-variant-numeric: tabular-nums; color: var(--muted); }
.termin.due-soon { color: var(--st-disponiert); font-weight: 600; }

.driver { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.driver em { color: #9aa3af; font-style: normal; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; background: #e7ebf1; color: #5a6472;
}

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  padding: 5px 11px 5px 9px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; color: var(--bc, var(--ink));
  background: var(--bg2, var(--bg)); transition: box-shadow .12s;
}
.badge:hover { box-shadow: 0 0 0 3px rgba(27,36,48,0.05); }
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge__chev { margin-left: 1px; opacity: 0.65; transition: transform .15s; }
.badge[aria-expanded="true"] .badge__chev { transform: rotate(180deg); }

/* Status-Dropdown */
.status-menu {
  position: absolute; z-index: 50; min-width: 172px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 12px 34px rgba(27, 36, 48, 0.16); padding: 5px;
}
.status-opt {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: none; background: transparent; border-radius: 6px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink);
  text-align: left; cursor: pointer; transition: background-color .12s;
}
.status-opt:hover { background: #f4f6fa; }
.status-opt__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--oc, var(--muted)); }
.status-opt--offen      { --oc: var(--st-offen); }
.status-opt--disponiert { --oc: var(--st-disponiert); }
.status-opt--unterwegs  { --oc: var(--st-unterwegs); }
.status-opt--zugestellt { --oc: var(--st-zugestellt); }
.status-opt.is-selected { color: var(--oc); font-weight: 600; }
.status-opt__check { margin-left: auto; color: var(--oc); }
.badge--offen      { --bc: var(--st-offen);      --bg2: #eef1f5; }
.badge--disponiert { --bc: var(--st-disponiert); --bg2: #fbf1de; }
.badge--unterwegs  { --bc: var(--st-unterwegs);  --bg2: #e2f4f6; }
.badge--zugestellt { --bc: var(--st-zugestellt); --bg2: #e4f5ec; }

.row-actions { width: 40px; text-align: right; }
.icon-btn {
  display: inline-flex; padding: 6px; border: none; background: transparent;
  color: #9aa3af; border-radius: 6px; cursor: pointer;
  opacity: 0; transition: opacity .12s, background-color .12s, color .12s;
}
tr:hover .icon-btn { opacity: 1; }
.icon-btn:hover { background: #fdeaea; color: #d23b3b; }

.empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }
.hint { margin: 14px 2px 0; font-size: 12.5px; color: var(--muted); }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal {
  border: none; border-radius: 12px; padding: 0; width: min(460px, 92vw);
  box-shadow: 0 24px 70px rgba(27, 36, 48, 0.25);
}
.modal::backdrop { background: rgba(27, 36, 48, 0.42); }
.modal form { padding: 24px 26px 20px; }
.modal h2 { margin: 0 0 18px; font-size: 19px; font-weight: 700; }
.modal__grid { display: grid; gap: 15px; }
.modal label {
  display: grid; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--muted);
}
.modal input {
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; outline: none;
}
.modal input:focus { border-color: var(--brand); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { flex-direction: column; min-height: 0; }
  .sidebar {
    flex: none; width: 100%; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--line);
    flex-direction: row; align-items: center; gap: 8px; padding: 0 8px 0 0;
  }
  .brand { border-bottom: none; padding: 12px 16px; }
  .nav { flex-direction: row; padding: 0; gap: 2px; overflow-x: auto; flex: 1; }
  .nav__item { padding: 8px 11px; white-space: nowrap; }
  .nav__item span { display: none; }
  .sidebar__foot { display: none; }
  .topbar { position: static; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .brand__sub { display: none; }
  .orders thead { display: none; }
  .orders, .orders tbody, .orders tr, .orders td { display: block; width: 100%; }
  .orders tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .orders tbody td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 5px 0; border: none;
  }
  .orders tbody td::before {
    content: attr(data-label); font-size: 11px; font-weight: 500; color: var(--muted);
  }
  .row-actions { justify-content: flex-end; }
  .row-actions::before { content: none; }
  .icon-btn { opacity: 1; }
}
