:root {
  --bg: #08090b;
  --panel: #111318;
  --panel-2: #181b22;
  --text: #f4f5f7;
  --muted: #9aa3b2;
  --line: #282d37;
  --accent: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(56, 189, 248, 0.09), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(8, 9, 11, 0.9);
  padding: 18px 14px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
}

.brand-name,
.brand-mode,
.eyebrow,
.muted,
.metric-label {
  margin: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 750;
}

.brand-mode,
.muted,
.metric-label {
  color: var(--muted);
}

.brand-mode {
  margin-top: 2px;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-button,
.segment {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-button {
  padding: 11px 12px;
}

.nav-button:hover,
.nav-button.active,
.segment.active {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.sidebar-note {
  position: absolute;
  right: 14px;
  bottom: 18px;
  left: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--green);
}

.main {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  max-width: 1220px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
}

.topbar-actions,
.action-row,
.panel-title,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions,
.panel-title {
  justify-content: space-between;
}

.view {
  display: none;
  max-width: 1220px;
  margin: 0 auto;
}

.view.active {
  display: grid;
  gap: 16px;
}

.hero-grid,
.content-grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.92);
  box-shadow: var(--shadow);
  padding: 16px;
}

.priority-panel {
  min-height: 260px;
}

.priority-panel h2 {
  max-width: 780px;
  margin: 10px 0 12px;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 0.98;
}

.panel h2 {
  margin: 2px 0 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  min-height: 38px;
  transition: border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.primary-button {
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--bg);
  padding: 0 13px;
  font-weight: 750;
}

.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.secondary-button,
.ghost-button {
  padding: 0 12px;
}

.ghost-button {
  color: var(--muted);
}

.icon-button {
  width: 38px;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.action-row {
  flex-wrap: wrap;
  margin-top: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 28px;
  padding: 0 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.good {
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--green);
}

.status-pill.warn {
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--amber);
}

.status-pill.bad {
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--red);
}

#ops-score {
  font-size: 64px;
  line-height: 0.92;
}

.progress-track {
  height: 9px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-grid > div,
.stat-card,
.list-item,
.draft-card,
.dispatch-card,
.channel-card,
.validation-box,
.quote-result,
.draft-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.mini-grid > div {
  padding: 10px;
}

.metric-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.stat-card {
  padding: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.list,
.dispatch-board,
.channel-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item,
.dispatch-card,
.channel-card {
  padding: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.list-item h3,
.dispatch-card h3,
.channel-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.list-item p,
.dispatch-card p,
.channel-card p,
.validation-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.textarea,
.quote-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  outline: 0;
}

.textarea {
  resize: vertical;
  min-height: 310px;
  margin-top: 14px;
  padding: 12px;
  line-height: 1.55;
}

.textarea:focus,
.quote-form input:focus {
  border-color: var(--accent);
}

.draft-empty,
.quote-result,
.validation-box {
  margin-top: 14px;
  padding: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.draft-card {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
}

.draft-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.draft-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.draft-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.message-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 9, 11, 0.45);
  padding: 10px;
  white-space: pre-wrap;
}

.dispatch-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dispatch-card {
  display: grid;
  gap: 12px;
}

.dispatch-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dispatch-meta span {
  color: var(--muted);
  font-size: 12px;
}

.driver-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.driver-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
}

.driver-chip.active {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
}

.segmented {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 3px;
}

.segment {
  padding: 7px 10px;
  text-align: center;
}

.quote-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.quote-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.quote-form input {
  min-height: 40px;
  padding: 0 10px;
}

.quote-price {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 44px;
  line-height: 1;
}

.validation-box ol {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 14px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    display: grid;
    height: auto;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 0;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-button {
    min-width: 128px;
    text-align: center;
  }

  .sidebar-note {
    position: static;
  }

  .hero-grid,
  .content-grid.two,
  .stats-grid,
  .dispatch-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .action-row,
  .segmented {
    width: 100%;
  }

  .topbar-actions > *,
  .action-row > *,
  .segmented > * {
    flex: 1;
  }

  .priority-panel h2 {
    font-size: 34px;
  }

  .draft-grid,
  .mini-grid,
  .dispatch-meta {
    grid-template-columns: 1fr;
  }
}

