:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #1f7a6b;
  --brand-dark: #15564c;
  --accent: #c9792b;
  --danger: #b42318;
  --shadow: 0 16px 36px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #15233a 0%, #1f7a6b 100%);
}

.login-card {
  width: min(430px, 100%);
  border-radius: 8px;
  padding: 26px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(12, 18, 32, 0.28);
}

.login-brand {
  color: var(--ink);
  margin-bottom: 24px;
}

.login-brand span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-message {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #15233a;
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-logo-wrap {
  width: 76px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.brand-logo {
  width: 68px;
  max-height: 40px;
  display: block;
  object-fit: contain;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #10231f;
  background: #8be0c7;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b8c4d8;
  font-size: 13px;
  margin-top: 3px;
}

.login-brand .brand-logo-wrap {
  width: 118px;
  height: 68px;
  box-shadow: 0 10px 28px rgba(15, 35, 31, 0.14);
}

.login-brand .brand-logo {
  width: 106px;
  max-height: 56px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #ffffff;
}

.field textarea {
  resize: vertical;
}

.sidebar .field span {
  color: #d8e0ee;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.nav-button {
  border: 0;
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  color: #dbe5f3;
  background: transparent;
}

.nav-button.active,
.nav-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.logout-button {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  padding: 11px 12px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.content {
  padding: 28px;
  min-width: 0;
}

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

.topbar p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.split-layout,
.route-layout,
.support-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.file-button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 13px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button,
.file-button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.file-button input {
  display: none;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.seller-form {
  margin-bottom: 16px;
}

.seller-form-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr auto;
  gap: 12px;
  align-items: end;
}

.route-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.qsa-cell {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

.list,
.candidate-list,
.timeline,
.permissions-list,
.help-grid,
.support-form {
  display: grid;
  gap: 10px;
}

.list-item,
.candidate,
.stop,
.permission-row,
.help-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfcff;
}

.list-item strong,
.candidate strong,
.stop strong,
.help-item strong {
  display: block;
  margin-bottom: 5px;
}

.list-item span,
.candidate span,
.stop span,
.help-item span {
  color: var(--muted);
  font-size: 13px;
}

.candidate {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.timeline {
  counter-reset: stop;
}

.stop {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
}

.stop::before {
  counter-increment: stop;
  content: counter(stop);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--brand);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  color: #1c342f;
  background: #d9f4eb;
  font-size: 13px;
  font-weight: 800;
}

.status-message {
  min-height: 20px;
  margin: -6px 0 14px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #ffffff;
}

.segmented button {
  border: 0;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  color: #ffffff;
  background: var(--accent);
}

.permission-row {
  display: grid;
  grid-template-columns: 1fr repeat(3, minmax(130px, auto));
  gap: 12px;
  align-items: center;
}

.permission-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

dialog {
  border: 0;
  border-radius: 8px;
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-form {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    position: static;
  }

  .metric-grid,
  .split-layout,
  .route-layout,
  .support-layout,
  .seller-form-grid,
  .filters,
  .route-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .content,
  .sidebar {
    padding: 18px;
  }

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

  .form-grid,
  .permission-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
