/* ===========================================================
   YMS-Admin  -  industriell-klares Logistik-Design
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg:          #ece9e3;   /* warmes Papiergrau */
  --surface:     #ffffff;
  --ink:         #1b1d22;   /* fast schwarz */
  --ink-soft:    #5a5d66;
  --line:        #d8d4cc;
  --sidebar:     #16181d;   /* dunkle Schiene */
  --sidebar-soft:#9aa0ab;
  --accent:      #ff6a1a;   /* hi-vis orange */
  --accent-ink:  #1b1d22;
  --ok:          #1e8a52;
  --ok-bg:       #def0e4;
  --off:         #8a8d95;
  --off-bg:      #e6e3dd;
  --danger:      #c0341d;
  --radius:      4px;
  --shadow:      0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

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

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand b {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
  display: block;
}
.brand .tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}
.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--sidebar-soft);
  text-decoration: none;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav-foot {
  margin-top: auto;
  padding: 16px 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,.35);
  border-top: 1px solid rgba(255,255,255,.08);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 14px;
}
.topbar h1 {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -.025em;
  margin: 0;
}
.topbar .sub { color: var(--ink-soft); margin: 2px 0 0; font-size: 13px; }
.content { padding: 8px 32px 48px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .06s, opacity .12s;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }

/* ---------- Card / Table ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 {
  font-family: 'Archivo', sans-serif;
  font-size: 15px;
  margin: 0;
  letter-spacing: -.01em;
}
.filterbar { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: #faf9f7;
}
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf9f7; }
.mono { font-family: 'IBM Plex Mono', monospace; color: var(--ink-soft); font-size: 12.5px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.pill.on  { background: var(--ok-bg);  color: var(--ok); }
.pill.off { background: var(--off-bg); color: var(--off); }
.pill.tag { background: #efece6; color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; font-weight: 500; }

.empty { padding: 40px 18px; text-align: center; color: var(--ink-soft); }

/* ---------- Forms / Modal ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20,22,26,.55);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px; z-index: 50;
}
.overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 6px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-family: 'Archivo', sans-serif; margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-soft); line-height: 1; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-weight: 600; font-size: 12.5px;
  margin-bottom: 5px; color: var(--ink);
}
.field input, .field select {
  width: 100%; font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,106,26,.15);
}
.field .hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.checkrow { display: flex; align-items: center; gap: 9px; }
.checkrow input { width: auto; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: var(--radius);
  font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

.assign-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.assign-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #faf9f7;
}
.assign-item .meta { font-size: 13px; }
.assign-item .meta .lvl { font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase; color: var(--accent); letter-spacing: .06em; }

@media (max-width: 720px) {
  .sidebar { position: fixed; transform: translateX(-100%); transition: .2s; z-index: 60; }
  .sidebar.open { transform: none; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .field-row { flex-direction: column; gap: 0; }
}

/* ===========================================================
   Hof-Editor (Canvas)
   =========================================================== */
.editor {
  display: grid;
  grid-template-columns: 190px 1fr 280px;
  gap: 16px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h3 {
  font-family: 'Archivo', sans-serif;
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  margin: 0; padding: 13px 15px; border-bottom: 1px solid var(--line); color: var(--ink-soft);
}
.panel .pad { padding: 14px 15px; }

/* Palette */
.pal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; font-weight: 600; font-size: 13px;
  transition: transform .06s, box-shadow .12s;
}
.pal-item:hover { box-shadow: var(--shadow); transform: translateX(2px); }
.pal-item .swatch { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }

/* Canvas */
.canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 0;
}
#yard { display: block; cursor: default; background: #fbfaf8; }

/* Properties */
.prop-empty { color: var(--ink-soft); font-size: 13px; padding: 6px 0; }
.mini { display: flex; gap: 8px; }
.mini .field { flex: 1; }
.chip-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #faf9f7; font-size: 13px;
}
.chip .st { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-soft); }
.add-row { display: flex; gap: 6px; }
.add-row input { flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; }
}

/* ===========================================================
   Tabs + Fahrzeug-Badges
   =========================================================== */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit; font-weight: 600; font-size: 13.5px;
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabview { display: none; }
.tabview.active { display: block; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: -1px; }
.kuehl {
  display: inline-flex; align-items: center; gap: 5px;
  background: #e0f2fe; color: #0369a1; font-weight: 600;
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
}
.eignung-box { margin-top: 8px; padding: 10px; background: #faf9f7; border: 1px solid var(--line); border-radius: var(--radius); }
.eignung-box label { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 12.5px; margin: 3px 0; cursor: pointer; }
.eignung-box .swatch { width: 12px; height: 12px; border-radius: 3px; }
.chip.expandable { flex-direction: column; align-items: stretch; }
.chip .chip-top { display: flex; align-items: center; justify-content: space-between; }
.chip .chip-top .grp { display: flex; gap: 6px; align-items: center; }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }

/* ===========================================================
   Belegung / Status
   =========================================================== */
.st-pill { display:inline-block; font-size:11.5px; font-weight:600; padding:2px 9px; border-radius:999px; }
.st-vorgeschlagen   { background:#fef3c7; color:#92400e; }
.st-geplant         { background:#dbeafe; color:#1e40af; }
.st-aktiv           { background:#dcfce7; color:#166534; }
.st-raeumungsfaellig{ background:#fee2e2; color:#991b1b; }
.st-beendet         { background:#e6e3dd; color:#6b7280; }
.herkunft { font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--ink-soft); }
.warnbar { background:#fef3c7; border:1px solid #fcd34d; color:#92400e; padding:10px 14px; border-radius:var(--radius); font-size:13px; margin-bottom:14px; }
.jobbar { display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.jobbar .res { font-size:13px; color:var(--ink-soft); }

/* ===========================================================
   Rangierauftraege / Moves
   =========================================================== */
.flow { display:flex; align-items:center; gap:8px; font-weight:600; }
.flow .arrow { color:var(--accent); font-size:16px; }
.node { background:#faf9f7; border:1px solid var(--line); border-radius:4px; padding:3px 9px; font-size:13px; }
.prio { display:inline-block; width:22px; height:22px; line-height:22px; text-align:center; border-radius:50%; font-size:12px; font-weight:700; color:#fff; }
.prio-1 { background:#dc2626; } .prio-2 { background:#ea580c; } .prio-3 { background:#64748b; }
.prio-4 { background:#94a3b8; } .prio-5 { background:#cbd5e1; color:#475569; }
.st-offen        { background:#e6e3dd; color:#475569; }
.st-zugewiesen   { background:#dbeafe; color:#1e40af; }
.st-unterwegs    { background:#fef3c7; color:#92400e; }
.st-erledigt     { background:#dcfce7; color:#166534; }
.st-abgebrochen  { background:#fee2e2; color:#991b1b; }

/* ===========================================================
   Rangierer-Ansicht (tablet-tauglich)
   =========================================================== */
.rangierer-pick { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.rangierer-pick button {
  font:inherit; font-weight:700; font-size:15px; padding:14px 22px;
  border:2px solid var(--ink); background:#fff; color:var(--ink);
  border-radius:8px; cursor:pointer;
}
.rangierer-pick button.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.move-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
.move-card {
  background:var(--surface); border:1px solid var(--line); border-left:6px solid var(--accent);
  border-radius:8px; box-shadow:var(--shadow); padding:16px;
}
.move-card.prio1 { border-left-color:#dc2626; }
.move-card.prio2 { border-left-color:#ea580c; }
.move-card .kz { font-family:'IBM Plex Mono',monospace; font-size:20px; font-weight:600; }
.move-card .route { display:flex; align-items:center; gap:10px; margin:12px 0; font-size:17px; font-weight:600; }
.move-card .route .arrow { color:var(--accent); font-size:22px; }
.move-card .meta { font-size:13px; color:var(--ink-soft); margin-bottom:14px; }
.move-card .acts { display:flex; gap:10px; }
.move-card .acts .btn { flex:1; justify-content:center; font-size:16px; padding:14px; }
.big-empty { padding:60px 20px; text-align:center; color:var(--ink-soft); font-size:16px; }

/* ===========================================================
   Rangierer - Hofuebersicht
   =========================================================== */
.r-tabs { display:flex; gap:6px; margin-bottom:16px; }
.r-tabs button { font:inherit; font-weight:700; font-size:14px; padding:10px 18px; border:2px solid var(--line); background:#fff; color:var(--ink-soft); border-radius:8px; cursor:pointer; }
.r-tabs button.active { border-color:var(--accent); color:var(--ink); }
.r-view { display:none; } .r-view.active { display:block; }

.spot-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px; }
.spot {
  background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:12px 14px;
  border-left:6px solid #cbd5e1;
}
.spot.belegt { border-left-color:#16a34a; }
.spot.raeumungsfaellig { border-left-color:#dc2626; }
.spot.gesperrt { border-left-color:#8a8d95; opacity:.7; }
.spot .pt { display:flex; align-items:center; justify-content:space-between; }
.spot .pt b { font-size:15px; }
.spot .art { font-family:'IBM Plex Mono',monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-soft); }
.spot .kz { font-family:'IBM Plex Mono',monospace; font-size:17px; font-weight:600; margin-top:8px; }
.spot .frei { color:var(--ink-soft); margin-top:8px; font-size:14px; }
.spot .seit { font-size:12px; color:var(--ink-soft); margin-top:3px; }

.planwrap { background:var(--surface); border:1px solid var(--line); border-radius:8px; box-shadow:var(--shadow); overflow:auto; margin-bottom:16px; }
#hofplan { display:block; background:#fbfaf8; }

/* ---------- Hof-Anmeldung live in der linken Leiste ---------- */
.nav a .badge { margin-left: auto; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; font-family: 'IBM Plex Sans', sans-serif; }
.nav a .badge.neu { animation: hofBadge 1s step-end infinite; }
@keyframes hofBadge { 50% { background: #fff; color: #e5484d; } }
.hof-live { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--sidebar-soft); }
.hof-live .dot { width: 8px; height: 8px; border-radius: 50%; background: #5a5d66; display: inline-block; margin-right: 6px; }
.hof-live.on .dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.2); }
.hof-live button { font: inherit; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 3px 10px; cursor: pointer; }
.hof-live button.an { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hof-live button.wartet { animation: hofBadge 1.2s step-end infinite; }
.hof-melder { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.hof-melder .k { background: #16181d; color: #fff; border-left: 5px solid #e5484d; border-radius: 6px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; font-size: 13px; }
.hof-melder .k b { font-size: 16px; letter-spacing: .03em; display: block; }
.hof-melder .k a { background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 6px 12px; border-radius: 4px; text-decoration: none; white-space: nowrap; }
.hof-melder .k .zu { background: none; border: 0; color: rgba(255,255,255,.6); font-size: 18px; cursor: pointer; padding: 0 2px; }
