:root {
  --bg: #101317;
  --surface: #171b20;
  --surface-2: #1f252c;
  --surface-3: #252c34;
  --line: rgba(255,255,255,.1);
  --text: #f3f5f7;
  --muted: #aeb7c2;
  --soft: #778391;
  --green: #19c37d;
  --amber: #f2a93b;
  --red: #ef6a5b;
  --blue: #4aa8ff;
  --violet: #b58cff;
  --shadow: 0 16px 40px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(25,195,125,.12), transparent 28%),
    linear-gradient(315deg, rgba(242,169,59,.1), transparent 24%),
    var(--bg);
  color: var(--text);
}

button,
select,
a {
  font: inherit;
}

button,
.ghost-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  min-height: 38px;
}

button {
  padding: 9px 12px;
}

button:hover,
.ghost-link:hover {
  border-color: rgba(255,255,255,.2);
  filter: brightness(1.06);
}

.app-shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 20px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}

.command-panel,
.board-panel,
.compact-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23,27,32,.94);
  box-shadow: var(--shadow);
}

.command-panel,
.board-panel {
  min-height: calc(100vh - 120px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head.small {
  padding: 14px;
}

.board-head {
  align-items: center;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #caffe5;
  font-size: 12px;
  font-weight: 800;
}

.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(25,195,125,.12);
}

.next-card {
  margin: 16px;
  padding: 16px;
  border: 1px solid rgba(25,195,125,.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(25,195,125,.14), rgba(255,255,255,.04));
}

.vehicle-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.vehicle-title strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.plate {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.score {
  min-width: 54px;
  min-height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.22);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.reason-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 16px 16px;
}

.primary-action {
  background: linear-gradient(135deg, rgba(25,195,125,.9), rgba(74,168,255,.78));
  border-color: rgba(255,255,255,.18);
  color: #06100d;
  font-weight: 800;
}

.section-load {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.load-row {
  display: grid;
  grid-template-columns: 92px 1fr 42px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar.warn span { background: var(--amber); }
.bar.hot span { background: var(--red); }

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.segmented button {
  min-height: 32px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
}

.segmented button.active {
  color: #07100c;
  background: var(--green);
  border-color: transparent;
  font-weight: 800;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.queue-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}

.queue-column header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.queue-column h3 {
  margin: 0;
  font-size: 14px;
}

.queue-count {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.vehicle-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.vehicle-card,
.entry-item,
.block-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.vehicle-card {
  padding: 11px;
}

.vehicle-card.top {
  border-color: rgba(25,195,125,.42);
  background: linear-gradient(180deg, rgba(25,195,125,.12), rgba(31,37,44,.96));
}

.meta-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  font-size: 11px;
  font-weight: 700;
}

.tag.urgent { color: #ffe4df; background: rgba(239,106,91,.18); }
.tag.ready { color: #caffe5; background: rgba(25,195,125,.16); }
.tag.work { color: #e5f2ff; background: rgba(74,168,255,.16); }
.tag.wait { color: #ffe7bd; background: rgba(242,169,59,.16); }
.tag.block { color: #f1ddff; background: rgba(181,140,255,.16); }

.side-panel {
  display: grid;
  gap: 14px;
}

.entry-list,
.block-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.entry-item,
.block-item {
  padding: 11px;
}

.entry-item strong,
.block-item strong,
.vehicle-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-item {
  border-color: rgba(181,140,255,.22);
}

.block-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.block-actions button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.empty {
  padding: 14px;
  color: var(--soft);
  font-size: 13px;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
}

dialog::backdrop {
  background: rgba(0,0,0,.62);
}

.dialog-card {
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.dialog-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-card select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--text);
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .side-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .command-panel,
  .board-panel {
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 760px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .layout,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .queue-grid {
    grid-template-columns: 1fr;
  }

  .board-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    justify-content: flex-start;
  }
}
