:root {
  --primary: #1d4ed8;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #111827;
  --muted: #64748b;
  --border: #d8dee9;
  --danger: #dc2626;
  --success: #047857;
  --warning: #b45309;
  --radius: 8px;
  color-scheme: light;
}

.theme-light {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #111827;
  --muted: #64748b;
  --border: #d8dee9;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  .theme-auto {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #172033;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #2d3748;
    color-scheme: dark;
  }

  .theme-auto.tablet-page {
    --tablet-shell-bg:
      linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .55) 12%, rgba(0, 0, 0, .8) 100%),
      var(--bg);
    --tablet-card-bg: #242528;
    --tablet-card-border: #383a40;
    --tablet-card-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    --tablet-step-bg: #15161a;
    --tablet-control-bg: #050506;
    --tablet-control-border: #303138;
    --tablet-control-text: #fff;
    --tablet-panel-bg: #17181b;
    --tablet-panel-border: #383a40;
    --tablet-choice-bg: #4a4b50;
    --tablet-choice-border: #63656c;
    --tablet-choice-text: #fff;
    --tablet-selected-mix: #111827;
    --tablet-fallback-bg: #111217;
    --tablet-fallback-text: #fff;
    --tablet-model-muted: #d5d9e2;
    --tablet-empty-border: #565861;
    --tablet-footer-bg: #050506;
    --tablet-footer-text: #7e8390;
    --tablet-logo-title: #fff;
    --tablet-signature-bg: #050506;
    --tablet-signature-border: rgba(255, 255, 255, .42);
    --tablet-signature-ink: #fff;
    --tablet-ocr-border-mix: #383a40;
    --tablet-ocr-bg-mix: #17181b;
    --tablet-ocr-text: #dbeafe;
  }
}

.theme-dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #172033;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #2d3748;
  color-scheme: dark;
}

.theme-dark.tablet-page {
  --tablet-shell-bg:
    linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .55) 12%, rgba(0, 0, 0, .8) 100%),
    var(--bg);
  --tablet-card-bg: #242528;
  --tablet-card-border: #383a40;
  --tablet-card-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  --tablet-step-bg: #15161a;
  --tablet-control-bg: #050506;
  --tablet-control-border: #303138;
  --tablet-control-text: #fff;
  --tablet-panel-bg: #17181b;
  --tablet-panel-border: #383a40;
  --tablet-choice-bg: #4a4b50;
  --tablet-choice-border: #63656c;
  --tablet-choice-text: #fff;
  --tablet-selected-mix: #111827;
  --tablet-fallback-bg: #111217;
  --tablet-fallback-text: #fff;
  --tablet-model-muted: #d5d9e2;
  --tablet-empty-border: #565861;
  --tablet-footer-bg: #050506;
  --tablet-footer-text: #7e8390;
  --tablet-logo-title: #fff;
  --tablet-signature-bg: #050506;
  --tablet-signature-border: rgba(255, 255, 255, .42);
  --tablet-signature-ink: #fff;
  --tablet-ocr-border-mix: #383a40;
  --tablet-ocr-bg-mix: #17181b;
  --tablet-ocr-text: #dbeafe;
}

* { box-sizing: border-box; }

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

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.theme-logo-set {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.theme-logo-set img {
  grid-area: 1 / 1;
}

.theme-logo-dark {
  display: none;
}

.theme-dark .theme-logo-light {
  display: none;
}

.theme-dark .theme-logo-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  .theme-auto .theme-logo-light {
    display: none;
  }

  .theme-auto .theme-logo-dark {
    display: block;
  }
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.topbar nav a {
  padding: 8px 10px;
  border-radius: 7px;
}

.topbar nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 32px);
}

.site-footer {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto 24px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.footer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(720px, 100%);
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 16px 44px rgba(15, 23, 42, .1);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.footer-copy {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 42px); line-height: 1.05; margin-bottom: 10px; }
h2 { font-size: 22px; line-height: 1.2; margin-bottom: 16px; }
h3 { font-size: 17px; margin: 22px 0 10px; }

.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.panel,
.tablet-card,
.app-panel,
.public-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .06);
}

.panel { padding: clamp(18px, 2.5vw, 28px); margin-bottom: 22px; }

.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.danger-zone h2 {
  color: var(--danger);
}

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

.cleanup-action {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 210px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--border));
  border-radius: 8px;
  background: var(--surface);
}

.cleanup-action span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cleanup-action strong {
  display: block;
  margin: 8px 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.cleanup-action p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cleanup-action .btn {
  width: 100%;
}

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

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled {
  opacity: .56;
  cursor: not-allowed;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.flash {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.flash.success {
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
  background: color-mix(in srgb, var(--success) 11%, var(--surface));
  color: var(--success);
}

.flash.warning {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  color: var(--warning);
}

.flash.danger {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 11%, var(--surface));
  color: var(--danger);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

input[type="file"] {
  padding: 7px;
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  min-height: 28px;
  margin-right: 10px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  min-height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  accent-color: var(--primary);
}

textarea { min-height: 96px; resize: vertical; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.grid-form.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 { grid-column: 1 / -1; }

.inline-actions,
.inline-form,
.import-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-form input,
.inline-form select {
  width: auto;
  min-width: 130px;
  min-height: 34px;
  padding: 6px 8px;
}

.inline-form .order-input {
  width: 84px;
  min-width: 84px;
}

.inline-form .check.compact {
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.inline-form .check.compact input {
  margin: 0;
}

.category-chip {
  display: inline-grid;
  min-height: 26px;
  place-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-2));
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.consultant-category-control {
  display: grid;
  gap: 8px;
  min-width: min(460px, 100%);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.consultant-category-control > label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.category-check-grid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.category-check-grid .check.compact {
  background: var(--surface);
}

.user-inline-form {
  max-width: 1120px;
}

.hide-name-control.disabled {
  opacity: .54;
}

.duration-control {
  display: grid;
  min-width: 230px;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.duration-control-head,
.duration-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.duration-control-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.duration-control-head strong {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
  font-size: 12px;
}

.duration-control input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  min-width: 0;
  background: linear-gradient(
    to right,
    var(--primary) 0%,
    var(--primary) var(--duration-progress, 14%),
    color-mix(in srgb, var(--border) 82%, var(--surface)) var(--duration-progress, 14%),
    color-mix(in srgb, var(--border) 82%, var(--surface)) 100%
  );
}

.duration-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(15, 23, 42, .2);
  cursor: grab;
}

.duration-control input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(15, 23, 42, .2);
  cursor: grab;
}

.duration-scale {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.inline-form .duration-control {
  flex: 0 1 240px;
  min-width: 210px;
  padding: 8px 10px;
}

.inline-form .duration-control input[type="range"],
.inline-form .duration-control input[type="hidden"] {
  width: 100%;
  min-width: 0;
}

.brand-inline-form textarea {
  width: min(360px, 100%);
  min-width: 240px;
  min-height: 74px;
}

.section-title,
.admin-head,
.consultant-head,
.workflow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-user-line {
  margin-top: 6px;
}

.admin-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: -2px 0 22px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
}

.admin-nav a {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
}

.admin-nav a.active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 38%, transparent);
}

.settings-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 6px 0 18px;
}

.settings-intro h2 {
  margin-bottom: 6px;
}

.settings-intro span {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.settings-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.settings-board > .autosave-state {
  grid-column: 1 / -1;
  justify-self: end;
  margin-bottom: -4px;
}

.autosave-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.autosave-state.compact {
  min-height: 34px;
}

.autosave-state.dirty {
  border-color: color-mix(in srgb, var(--warning) 48%, var(--border));
  color: var(--warning);
}

.autosave-state.saving {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  color: var(--primary);
}

.autosave-state.saved {
  border-color: color-mix(in srgb, var(--success) 48%, var(--border));
  color: var(--success);
}

.autosave-state.error {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--border));
  color: var(--danger);
}

.settings-card,
.settings-save {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .06);
}

.settings-card {
  padding: clamp(18px, 2vw, 24px);
}

.settings-card-wide,
.settings-save {
  grid-column: 1 / -1;
}

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

.settings-card-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.field-help {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.color-input {
  min-height: 42px;
  padding: 5px;
}

.logo-preview {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.logo-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.logo-preview img {
  max-width: 220px;
  max-height: 54px;
  object-fit: contain;
}

.logo-preview.empty strong {
  color: var(--muted);
  font-size: 14px;
}

.settings-save {
  display: flex;
  justify-content: flex-end;
  padding: 16px;
}

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

.stat {
  min-height: 96px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.stat strong {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

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

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

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

tr:last-child td { border-bottom: 0; }

.admin-table-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 340px) auto;
  align-items: end;
  gap: 12px;
  margin: 18px 0 10px;
}

.admin-table-title {
  display: grid;
  gap: 4px;
}

.admin-table-title strong {
  font-size: 15px;
}

.admin-table-title span,
.admin-table-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-table-search {
  gap: 5px;
}

.admin-table-search span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.admin-table-search input {
  min-height: 38px;
  background: var(--surface-2);
}

.admin-table-status {
  justify-self: end;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  white-space: nowrap;
}

.admin-table-status.saving { color: var(--primary); }
.admin-table-status.saved { color: var(--success); }
.admin-table-status.error { color: var(--danger); }

.admin-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-data-table tbody tr {
  background: var(--surface);
}

.admin-data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 52%, var(--surface));
}

.admin-data-table tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}

.admin-data-table td {
  font-size: 13px;
}

.admin-data-table .url-cell {
  max-width: 220px;
  word-break: break-word;
  color: var(--muted);
  font-size: 12px;
}

.admin-data-table .inline-form {
  max-width: 920px;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-edit-button {
  min-width: 86px;
}

body.admin-modal-open {
  overflow: hidden;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 32px);
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(5px);
}

.admin-modal-card {
  width: min(820px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(2, 6, 23, .34);
}

.admin-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.admin-modal-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.admin-modal-body {
  padding: 20px;
}

.admin-modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.admin-modal-form .consultant-category-control,
.admin-modal-form .duration-control {
  min-width: 0;
}

.admin-modal-form .check.compact {
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.admin-modal-form .check.compact input {
  width: auto;
  min-height: 0;
}

.admin-modal-form .order-input {
  min-width: 0;
}

.admin-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.admin-modal-actions .autosave-state {
  margin-right: auto;
}

.order-cell {
  min-width: 96px;
  white-space: nowrap;
}

.drag-handle {
  width: 30px;
  min-height: 30px;
  margin-right: 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.reorder-table tr.is-dragging {
  opacity: .55;
}

.reorder-table tr.drag-target {
  outline: 2px solid color-mix(in srgb, var(--primary) 62%, transparent);
  outline-offset: -2px;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: #64748b;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.status.queued { background: #fdab3d; }
.status.assigned { background: #579bfc; }
.status.available { background: #00c875; }
.status.in_test_drive { background: #a25ddc; }
.status.arriving { background: #fdab3d; }
.status.unavailable { background: #676879; }
.status.in_progress { background: #a25ddc; }
.status.completed { background: #00c875; }
.status.cancelled { background: #e2445c; }
.status.no_show { background: #676879; }

.auth-shell,
.tablet-shell,
.consultant-app,
.queue-public {
  min-height: calc(100vh - 128px);
  display: grid;
  place-items: center;
}

.auth-card,
.tablet-card,
.app-panel,
.public-card {
  width: min(760px, 100%);
  padding: clamp(20px, 4vw, 34px);
}

.tablet-card { width: min(980px, 100%); }

.no-topbar .page {
  padding-top: 0;
}

.public-page .queue-public {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 4vw, 28px) max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 44%),
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--bg)), var(--bg));
}

.queue-public-card {
  width: min(560px, 100%);
  border-radius: 28px;
  display: grid;
  gap: 20px;
}

.queue-public-head {
  display: grid;
  gap: 8px;
  text-align: center;
}

.queue-public-head span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.queue-public-head h1 {
  margin: 0;
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1;
}

.queue-pwa-install {
  border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--border));
  border-radius: 8px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.queue-pwa-install[hidden] {
  display: none;
}

.queue-pwa-install strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 900;
}

.queue-pwa-install p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.queue-public #queue-state {
  display: grid;
  gap: 14px;
}

.queue-public #queue-state h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.08;
}

.queue-public #queue-state > p {
  margin: 0;
  text-align: center;
}

.queue-public-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.queue-public-actions .btn {
  width: 100%;
  justify-content: center;
}

.queue-notify-status {
  min-height: 20px;
  margin: 0;
  text-align: center;
  font-size: 13px;
}

.btn.success {
  background: #00c875;
  border-color: #00c875;
  color: #fff;
}

.tablet-page {
  --tablet-shell-bg:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--bg)), var(--bg));
  --tablet-card-bg: var(--surface);
  --tablet-card-border: var(--border);
  --tablet-card-shadow: 0 20px 60px rgba(15, 23, 42, .12);
  --tablet-step-bg: var(--surface-2);
  --tablet-control-bg: var(--surface);
  --tablet-control-border: var(--border);
  --tablet-control-text: var(--text);
  --tablet-panel-bg: var(--surface-2);
  --tablet-panel-border: var(--border);
  --tablet-choice-bg: var(--surface-2);
  --tablet-choice-border: var(--border);
  --tablet-choice-text: var(--text);
  --tablet-selected-mix: var(--surface);
  --tablet-fallback-bg: var(--surface);
  --tablet-fallback-text: var(--text);
  --tablet-model-muted: var(--muted);
  --tablet-empty-border: var(--border);
  --tablet-footer-bg: var(--surface);
  --tablet-footer-text: var(--muted);
  --tablet-logo-title: var(--text);
  --tablet-signature-bg: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  --tablet-signature-border: color-mix(in srgb, var(--text) 24%, var(--border));
  --tablet-signature-ink: var(--text);
  --tablet-ocr-border-mix: var(--border);
  --tablet-ocr-bg-mix: var(--surface);
  --tablet-ocr-text: color-mix(in srgb, var(--primary) 60%, var(--text));
  min-height: 100vh;
  background: var(--tablet-shell-bg);
}

.tablet-page .topbar { display: none; }
.tablet-page .page {
  max-width: none;
  min-height: 100vh;
  padding: 0;
  background: var(--tablet-shell-bg);
}

.tablet-page .site-footer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  width: min(760px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
}

.tablet-page .footer-pill {
  min-height: 44px;
  background: color-mix(in srgb, var(--tablet-footer-bg) 86%, transparent);
}

.consultant-page .topbar,
.consultant-page .site-footer {
  display: none;
}

.consultant-page .page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

.tablet-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 44px) clamp(18px, 4vw, 44px) 92px;
  background: var(--tablet-shell-bg);
}

.tablet-frame {
  width: min(780px, 100%);
  display: grid;
  gap: 22px;
}

.tablet-logo {
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
  margin-bottom: 4px;
}

.tablet-logo img {
  width: min(var(--tablet-logo-width), 78vw);
  max-height: var(--tablet-logo-height);
  object-fit: contain;
}

.tablet-logo strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 12px 20px;
  color: var(--tablet-logo-title);
  font-size: clamp(28px, 7vw, 50px);
  line-height: 1;
  text-transform: uppercase;
}

.tablet-page .tablet-card {
  width: min(720px, 100%);
  margin: 0 auto;
  background: var(--tablet-card-bg);
  border-color: var(--tablet-card-border);
  box-shadow: var(--tablet-card-shadow);
}

.tablet-page .step-heading {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.tablet-page .step-heading h1,
.tablet-page .step-heading h2,
.centered-step h1 {
  margin-bottom: 0;
}

.tablet-page .steps {
  margin-top: 0;
}

.tablet-page .steps span {
  background: var(--tablet-step-bg);
}

.tablet-page .steps span.active {
  background: var(--primary);
}

.tablet-page .steps span.completed {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
  color: var(--text);
}

.tablet-page input,
.tablet-page select,
.tablet-page textarea {
  background: var(--tablet-control-bg);
  border-color: var(--tablet-control-border);
  color: var(--tablet-control-text);
}

.scan-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--tablet-panel-border);
  border-radius: 8px;
  background: var(--tablet-panel-bg);
}

.qr-actions {
  justify-content: center;
}

.qr-lookup-result {
  display: grid;
  gap: 3px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 36%, var(--tablet-panel-border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, var(--tablet-panel-bg));
  color: var(--tablet-control-text);
  text-align: center;
}

.qr-lookup-result[hidden] {
  display: none;
}

.qr-lookup-result strong {
  font-size: 14px;
}

.qr-lookup-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.qr-lookup-result.success {
  border-color: color-mix(in srgb, #00c875 50%, var(--tablet-panel-border));
  background: color-mix(in srgb, #00c875 14%, var(--tablet-panel-bg));
}

.qr-lookup-result.warning {
  border-color: color-mix(in srgb, #fdab3d 58%, var(--tablet-panel-border));
  background: color-mix(in srgb, #fdab3d 14%, var(--tablet-panel-bg));
}

.centered-step {
  justify-items: center;
  text-align: center;
}

.brand-grid,
.model-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.brand-choice,
.model-choice {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px;
  background: var(--tablet-choice-bg);
  border: 1px solid var(--tablet-choice-border);
  color: var(--tablet-choice-text);
  border-radius: 6px;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}

.brand-choice {
  min-height: 78px;
  padding: 10px 14px;
}

.brand-choice.selected,
.model-choice.selected {
  background: color-mix(in srgb, var(--primary) 72%, var(--tablet-selected-mix));
  border-color: color-mix(in srgb, var(--primary) 80%, #fff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent);
}

.brand-choice img {
  max-width: 150px;
  max-height: 40px;
  object-fit: contain;
}

.brand-choice.hide-name img {
  max-height: 58px;
}

.brand-choice.no-logo {
  min-height: 78px;
  padding: 18px 14px;
}

@media (max-height: 760px) and (min-width: 760px) {
  .tablet-shell {
    padding-top: 22px;
  }

  .tablet-frame {
    gap: 14px;
  }

  .tablet-logo img {
    max-height: 72px;
  }

  .tablet-page .tablet-card {
    padding: 24px 34px;
  }

  .step.active {
    gap: 12px;
  }

  .steps-slim {
    margin-bottom: 16px;
  }

  .brand-grid {
    gap: 6px;
  }

  .brand-choice {
    min-height: 58px;
    padding: 7px 12px;
  }

  .brand-choice img {
    max-height: 32px;
  }

  .brand-choice.hide-name img {
    max-height: 42px;
  }

  .brand-choice.no-logo {
    min-height: 58px;
    padding: 8px 12px;
  }
}

.brand-choice.no-logo strong,
.model-choice.no-media strong {
  overflow-wrap: anywhere;
  line-height: 1.16;
}

.model-choice {
  min-height: 156px;
  align-content: center;
}

.model-choice.no-media {
  min-height: 104px;
  padding: 18px 14px;
}

.model-media {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 70px;
}

.model-choice img {
  width: 100%;
  max-width: 190px;
  height: 82px;
  object-fit: contain;
}

.model-choice small {
  color: var(--tablet-model-muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 18px;
  border: 1px dashed var(--tablet-empty-border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--tablet-panel-bg);
}

.tablet-step-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.tablet-step-actions .btn {
  min-width: 160px;
}

.tablet-footer {
  min-height: 76px;
  display: grid;
  place-items: center;
  border-top: 2px solid color-mix(in srgb, var(--primary) 60%, #f5c84c);
  background: var(--tablet-footer-bg);
  color: var(--tablet-footer-text);
  font-size: 12px;
  font-weight: 700;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 24px;
}

.steps-progress {
  display: none;
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 18%, var(--tablet-step-bg));
}

.steps-progress i {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .25s ease;
}

.steps span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.steps span.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.steps-slim {
  display: block;
  margin: 4px 0 24px;
}

.steps-slim .steps-progress {
  display: block;
}

.steps-slim span {
  display: none;
}

.steps-hidden {
  display: none;
}

.step { display: none; }
.step.active { display: grid; gap: 18px; }

#qr-reader {
  width: 100%;
  min-height: 0;
}

.cnh-upload-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cnh-upload-option {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--tablet-panel-border);
  border-radius: 10px;
  background: var(--tablet-panel-bg);
  color: var(--tablet-control-text);
  cursor: pointer;
}

.cnh-upload-option:hover,
.cnh-upload-option.selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent);
}

.cnh-upload-option strong {
  font-size: 15px;
  font-weight: 900;
}

.cnh-upload-option span,
.cnh-upload-option::after {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cnh-upload-option input {
  align-self: end;
  width: 100%;
}

.cnh-upload-option.selected::after {
  content: attr(data-file-name);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signature-box {
  display: grid;
  gap: 10px;
}

.signature-box canvas {
  width: 100%;
  height: 220px;
  border: 1px solid var(--tablet-signature-border);
  border-radius: var(--radius);
  background: var(--tablet-signature-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tablet-signature-border) 48%, transparent);
  touch-action: none;
}

.ocr-note {
  margin: -4px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--tablet-ocr-border-mix));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 14%, var(--tablet-ocr-bg-mix));
  color: var(--tablet-ocr-text);
  font-size: 13px;
  font-weight: 700;
}

.terms-box {
  max-height: 190px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--tablet-panel-border);
  border-radius: 8px;
  background: var(--tablet-panel-bg);
  color: var(--tablet-control-text);
  font-size: 13px;
  line-height: 1.55;
  text-align: left;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.45;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.success-state {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.success-state canvas,
.queue-qr-rendered canvas,
.queue-qr-rendered img {
  width: min(240px, 80vw) !important;
  height: min(240px, 80vw) !important;
}

.queue-qr-box {
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
}

.queue-qr-rendered {
  display: grid;
  place-items: center;
}

.queue-pwa-handoff {
  width: min(520px, 100%);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--surface) 94%, var(--primary));
}

.queue-pwa-handoff strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.queue-pwa-handoff ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.queue-pwa-handoff .btn {
  margin-top: 12px;
}

.qr-fallback {
  max-width: 340px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.consultant-page .consultant-app {
  place-items: stretch center;
  align-items: start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.consultant-page .app-panel {
  width: min(1180px, 100%);
  padding: 0;
}

.consultant-page .app-panel.is-login {
  width: min(390px, calc(100% - 28px));
  min-height: calc(100dvh - 28px);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.login-card,
.consultant-login-card {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
  margin: clamp(32px, 8vh, 92px) auto 0;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.consultant-page .app-panel.is-login .login-card,
.consultant-page .consultant-login-card {
  width: min(390px, 100%);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.consultant-login-copy span {
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.consultant-login-copy h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1;
}

.consultant-page .app-panel.is-login .login-card h1,
.consultant-login-copy h1 {
  font-size: clamp(30px, 7vw, 44px);
}

.consultant-page .app-panel.is-login .login-card p,
.consultant-login-copy p {
  max-width: 360px;
  margin-inline: auto;
  line-height: 1.5;
}

.login-card form,
.consultant-login-form {
  display: grid;
  gap: 16px;
}

.consultant-login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 900;
}

.login-card input,
.consultant-login-form input {
  height: 64px;
  text-align: center;
  text-transform: uppercase;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 6px;
}

.consultant-token-otp {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-top: 6px;
}

.consultant-token-otp input {
  width: 100%;
  height: 58px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid color-mix(in srgb, var(--muted) 42%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: none;
  -webkit-text-security: disc;
}

.consultant-token-otp input:focus {
  border-color: var(--primary);
  outline: 0;
}

.consultant-page .app-panel.is-login .btn,
.consultant-login-form .btn {
  width: 100%;
  min-height: 56px;
}

.consultant-login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
}

.consultant-shell {
  display: grid;
  gap: 16px;
}

.consultant-topbar,
.consultant-operation,
.consultant-kpi-strip article,
.consultant-car-counts,
.consultant-list-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .06);
}

.consultant-topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.consultant-user {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.consultant-online-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 14%, transparent);
}

.consultant-user strong,
.consultant-user span {
  display: block;
  min-width: 0;
}

.consultant-user strong {
  font-size: 15px;
}

#category-scope-line {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.consultant-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.gps-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--success) 36%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: var(--success);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.consultant-token-box {
  position: relative;
}

.consultant-token-box summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.consultant-token-form {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 12;
  width: 250px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(2, 6, 23, .18);
}

.consultant-token-form input {
  text-align: center;
  text-transform: uppercase;
  font-weight: 900;
}

.consultant-notice {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.consultant-notice.success {
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  color: var(--success);
}

.consultant-notice.error {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.consultant-workspace {
  display: grid;
  gap: 16px;
}

.consultant-workspace.has-current-client {
  min-height: calc(100dvh - 112px);
  align-content: stretch;
}

.consultant-shell.has-current-client {
  gap: 0;
}

.consultant-shell.has-current-client .consultant-topbar {
  display: none;
}

.consultant-shell.has-current-client .consultant-notice:not([hidden]) {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  z-index: 60;
  width: min(560px, calc(100% - 28px));
  transform: translateX(-50%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}

.consultant-workspace.has-current-client .consultant-kpi-strip,
.consultant-workspace.has-current-client .consultant-support-grid {
  display: none;
}

.consultant-operation {
  overflow: hidden;
}

.operation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  align-items: stretch;
  min-height: 236px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), var(--surface));
}

.operation-card.running {
  background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 10%, var(--surface)), var(--surface));
}

.operation-card.client-focus {
  min-height: calc(100dvh - 132px);
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}

.operation-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(22px, 4vw, 38px);
}

.operation-stage {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.operation-stage.danger {
  background: color-mix(in srgb, var(--danger) 13%, var(--surface));
  color: var(--danger);
}

.operation-card h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .96;
}

.operation-card p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 800;
  line-height: 1.45;
}

.client-focus-main {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(26px, 5vw, 54px);
}

.client-focus-main h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: .92;
}

.client-phone-line {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 900;
}

.client-contact-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.client-contact-btn,
.contact-disabled {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 900;
}

.client-contact-btn.whatsapp {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.client-contact-btn.call {
  background: var(--surface-2);
  color: var(--text);
}

.contact-disabled {
  color: var(--muted);
  background: var(--surface-2);
}

.operation-vehicle {
  display: grid;
  gap: 4px;
}

.operation-vehicle strong {
  font-size: clamp(18px, 2.4vw, 24px);
}

.operation-vehicle span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.pager-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.operation-action {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: clamp(18px, 3vw, 28px);
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 58%, var(--surface));
}

.client-focus-action {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: clamp(22px, 4vw, 38px);
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 62%, var(--surface));
}

.client-focus-action > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
}

.client-focus-action > strong {
  font-size: clamp(42px, 6vw, 72px);
  line-height: .92;
}

.operation-action > strong {
  font-size: clamp(42px, 7vw, 76px);
  line-height: .9;
}

.operation-action > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.consultant-main-action {
  min-height: 58px;
  font-size: 17px;
}

.client-focus-action .consultant-main-action {
  max-width: 100%;
  min-height: clamp(76px, 12vh, 118px);
  padding-inline: 14px;
  border-radius: 14px;
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.08;
  text-align: center;
  white-space: normal;
  text-wrap: balance;
}

.consultant-main-action:disabled {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
  opacity: 1;
}

.consultant-secondary-action {
  min-height: 44px;
}

.client-call-action .consultant-secondary-action {
  width: 100%;
  min-height: 52px;
  white-space: normal;
}

.no-show-action:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  color: var(--danger);
}

.operation-card.running .consultant-main-action:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.pulse-action:not(:disabled) {
  animation: consultantPulse 1.35s ease-in-out infinite;
}

@keyframes consultantPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 42%, transparent);
  }
  50% {
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--primary) 0%, transparent);
  }
}

.consultant-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.consultant-kpi-strip article {
  min-height: 92px;
  padding: 16px;
}

.consultant-kpi-strip strong {
  display: block;
  margin-bottom: 6px;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1;
}

.consultant-kpi-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.consultant-support-grid {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.consultant-car-counts,
.consultant-list-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.consultant-car-counts > header,
.consultant-list-panel > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.consultant-car-counts h2,
.consultant-list-panel h2 {
  margin: 0;
  font-size: 18px;
}

#consultant-car-counts,
.consultant-list {
  display: grid;
  gap: 10px;
}

.car-count-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.car-count-card > strong {
  display: grid;
  place-items: center;
  width: 52px;
  height: 48px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.car-count-card b,
.car-count-card span,
.queue-row strong,
.queue-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-count-card span,
.queue-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.car-count-card.empty,
.queue-row.empty {
  border-style: dashed;
}

.car-count-card.empty > strong {
  background: var(--surface);
  color: var(--muted);
}

.queue-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1.1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.queue-row > span:first-child {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
}

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

.queue-row.empty strong,
.queue-row.empty small {
  white-space: normal;
}

.queue-row .status {
  min-width: 86px;
  min-height: 30px;
  font-size: 11px;
}

.public-card {
  display: grid;
  gap: 18px;
  max-width: 620px;
}

.queue-meter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.queue-meter-two {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.queue-meter article {
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.queue-meter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.queue-meter strong { font-size: 26px; }

.queue-reservation-note {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--primary), transparent 62%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary), transparent 90%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.tv-page .topbar { display: none; }
.tv-page .page { max-width: none; padding: 24px; }
.tv-board { min-height: calc(100vh - 48px); }
.tv-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.tv-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tv-table th:nth-child(1),
.tv-table td:nth-child(1),
.tv-table th:nth-child(2),
.tv-table td:nth-child(2),
.tv-table th:nth-child(5),
.tv-table td:nth-child(5) {
  text-align: center;
  vertical-align: middle;
}

.tv-table .status {
  width: 132px;
  margin: 0 auto;
}

.vehicle-status-panel {
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.vehicle-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.vehicle-status-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.vehicle-status-head > div:first-child span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.vehicle-status-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.vehicle-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.vehicle-status-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.vehicle-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 7px;
}

.vehicle-status-square {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 7px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  cursor: help;
  box-shadow: inset 0 -18px 24px rgba(0, 0, 0, .12);
}

.vehicle-status-square strong {
  font-size: 23px;
  line-height: 1;
}

.vehicle-status-square .vehicle-waiting-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #111827;
  font-size: 11px;
  font-weight: 900;
}

.vehicle-status-square small {
  margin-top: 3px;
  color: rgba(255, 255, 255, .9);
  font-size: 11px;
  font-weight: 900;
}

.vehicle-hover-badge {
  position: absolute;
  left: 0;
  bottom: calc(100% + 9px);
  z-index: 40;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 220px;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--text) 16%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
  text-align: left;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .14s ease, transform .14s ease;
}

.vehicle-hover-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: 1px solid color-mix(in srgb, var(--text) 16%, var(--border));
  border-bottom: 1px solid color-mix(in srgb, var(--text) 16%, var(--border));
  transform: translate(-50%, -5px) rotate(45deg);
}

.vehicle-hover-badge b,
.vehicle-hover-badge em,
.vehicle-hover-badge i {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.vehicle-hover-badge b {
  font-size: 13px;
}

.vehicle-hover-badge em {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vehicle-hover-badge i {
  width: fit-content;
  min-height: 24px;
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface-2));
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.vehicle-status-square:hover .vehicle-hover-badge,
.vehicle-status-square:focus .vehicle-hover-badge,
.vehicle-status-square:focus-visible .vehicle-hover-badge {
  opacity: 1;
  transform: translateY(0);
}

.vehicle-status-square.available,
.vehicle-status-legend i.available { background: #00c875; }
.vehicle-status-square.in_test_drive,
.vehicle-status-legend i.in_test_drive { background: #a25ddc; }
.vehicle-status-square.arriving,
.vehicle-status-legend i.arriving { background: #fdab3d; }
.vehicle-status-square.unavailable,
.vehicle-status-legend i.unavailable { background: #676879; }

.pager-badge {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--primary) 88%, #111827);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.tv-columns {
  --tv-queue-scroll-height: 672px;
  --tv-queue-panel-height: calc(var(--tv-queue-scroll-height) + 80px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  align-items: start;
  gap: 18px;
}

.tv-section {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tv-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.tv-queue-scroll {
  height: var(--tv-queue-scroll-height);
}

.tv-side-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.tv-history-scroll {
  height: 320px;
}

.tv-section.span-main {
  grid-row: auto;
}

.tv-section.span-all {
  grid-column: 1 / -1;
}

.tv-side-stack {
  min-width: 0;
  min-height: 0;
  height: var(--tv-queue-panel-height);
  max-height: var(--tv-queue-panel-height);
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-self: start;
}

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

.tv-section-head h2 {
  margin: 0;
}

.tv-section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.queue-table.no-pager th:nth-child(2),
.queue-table.no-pager td:nth-child(2),
.queue-table.no-pager th:nth-child(3),
.queue-table.no-pager td:nth-child(3) {
  text-align: left;
}

.queue-table.no-pager th:nth-child(4),
.queue-table.no-pager td:nth-child(4) {
  text-align: center;
}

.vehicle-grid {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: 9px;
}

.vehicle-summary-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  gap: 9px;
}

.vehicle-summary-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.vehicle-summary-card > strong {
  display: grid;
  place-items: center;
  width: 46px;
  height: 40px;
  border-radius: 7px;
  background: #fdab3d;
  color: #fff;
  font-size: 22px;
}

.vehicle-summary-card b,
.vehicle-summary-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-summary-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vehicle-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.vehicle-card.available { border-left: 5px solid #00c875; }
.vehicle-card.in_test_drive { border-left: 5px solid #a25ddc; }
.vehicle-card.arriving { border-left: 5px solid #fdab3d; }
.vehicle-card.unavailable {
  border-left: 5px solid #676879;
  opacity: .78;
}

.vehicle-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 3px;
}

.vehicle-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.vehicle-card .vehicle-client {
  color: var(--text);
  text-align: left;
}

.vehicle-card .vehicle-time {
  text-align: center;
}

.vehicle-card > .status {
  display: inline-flex;
  align-self: start;
  justify-self: end;
  margin-top: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.availability {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.availability.available { background: #00c875; }
.availability.in_test_drive { background: #a25ddc; }
.availability.arriving { background: #fdab3d; }
.availability.unavailable { background: #676879; }

.vehicle-card .availability {
  display: inline-flex;
  color: #fff;
  margin-top: 0;
}

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

.queue-lane {
  min-width: 0;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.queue-lane header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.queue-lane header strong,
.queue-lane li strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-lane header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue-lane header b {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
}

.queue-lane ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-lane li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface);
}

.queue-lane li > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #fdab3d;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.queue-lane li small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-sheet table {
  font-size: 12px;
}

.history-sheet th,
.history-sheet td {
  padding: 7px 9px;
  line-height: 1.15;
  white-space: nowrap;
}

.history-sheet th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
}

.history-sheet th:nth-child(2),
.history-sheet td:nth-child(2),
.history-sheet th:nth-child(3),
.history-sheet td:nth-child(3),
.history-sheet th:nth-child(4),
.history-sheet td:nth-child(4) {
  text-align: left;
}

.history-sheet th:nth-child(6),
.history-sheet td:nth-child(6) {
  text-align: center;
}

.history-sheet .status {
  min-width: 92px;
  min-height: 24px;
  padding: 0 8px;
  font-size: 10px;
}

.history-summary-grid,
.print-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.history-summary-grid article,
.print-grid article {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.history-summary-grid span,
.print-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-summary-grid strong,
.print-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

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

.history-media-grid article,
.terms-detail,
.history-tracks,
.history-route-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.history-route-card {
  margin: 18px 0;
}

.route-source {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
  border-radius: 999px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.route-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr);
  gap: 16px;
  align-items: stretch;
}

.route-map {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent 46%),
    var(--surface-2);
}

.route-map-canvas {
  width: 100%;
  min-height: 430px;
  height: 100%;
}

.route-map .leaflet-container {
  background: var(--surface-2);
  color: #111827;
  font-family: inherit;
}

.route-map .leaflet-control-attribution,
.route-map .leaflet-control-zoom a {
  color: #111827;
}

.route-pin-icon {
  background: transparent;
  border: 0;
}

.route-pin {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .32);
}

.route-pin::after {
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: rgba(255, 255, 255, .9);
  content: "";
}

.route-pin.start { background: #10b981; }
.route-pin.end { background: var(--primary); }

.route-insights {
  display: grid;
  align-content: start;
  gap: 12px;
}

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

.route-metric,
.route-speed-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.route-metric span,
.route-speed-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.route-metric strong,
.route-speed-card strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 16px;
}

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

.speed-strip {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 118px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 8px;
  background:
    repeating-linear-gradient(to top, transparent 0 23px, color-mix(in srgb, var(--border) 55%, transparent) 24px),
    color-mix(in srgb, var(--surface) 72%, var(--surface-2));
}

.speed-strip i {
  flex: 1 1 3px;
  min-width: 3px;
  height: var(--h);
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, #ef4444 0%, #f59e0b 45%, #10b981 100%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .16);
}

.route-note {
  margin: 0;
  line-height: 1.5;
}

.route-map-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
}

.history-doc-image,
.history-signature-image {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.terms-detail div {
  max-height: 280px;
  overflow: auto;
  color: var(--text);
  line-height: 1.55;
}

.history-tracks {
  margin-top: 18px;
}

.print-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.print-sheet {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.print-sheet header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.print-sheet h1,
.print-sheet h2 {
  margin-bottom: 0;
}

.print-terms {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.5;
}

.print-media article {
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.print-media img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

@media print {
  .topbar,
  .site-footer,
  .print-actions {
    display: none !important;
  }

  body,
  .page {
    background: #fff !important;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .print-sheet {
    max-width: none;
    padding: 0;
    border: 0;
    box-shadow: none;
    color: #111827;
  }

  .print-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .page { padding: 14px; }
  .stats-grid,
  .consultant-queue-kpis,
  .consultant-kpi-strip,
  .consultant-support-grid,
  #consultant-car-counts,
  .tv-grid,
  .tv-columns,
  .queue-lanes,
  .settings-board,
  .settings-grid,
  .grid-form,
  .grid-form.compact,
  .cnh-upload-options,
  .cleanup-grid,
  .queue-meter,
  .route-overview {
    grid-template-columns: 1fr;
  }
  .history-summary-grid,
  .history-media-grid,
  .print-grid,
  .print-media {
    grid-template-columns: 1fr;
  }
  .history-grid,
  .brand-grid,
  .model-grid {
    grid-template-columns: 1fr;
  }
  .route-map,
  .route-map-canvas {
    min-height: 340px;
  }
  .tv-section.span-all {
    grid-column: auto;
  }
  .consultant-topbar,
  .consultant-top-actions,
  .consultant-car-counts > header,
  .consultant-list-panel > header {
    align-items: stretch;
    flex-direction: column;
  }
  .consultant-topbar {
    position: static;
  }
  .consultant-top-actions {
    justify-content: stretch;
  }
  .consultant-token-box summary,
  .consultant-top-actions .btn,
  .gps-pill {
    width: 100%;
    justify-content: center;
  }
  .consultant-token-form {
    position: static;
    width: 100%;
    margin-top: 8px;
  }
  .operation-card {
    grid-template-columns: 1fr;
  }
  .consultant-workspace.has-current-client {
    min-height: auto;
  }
  .operation-card.client-focus {
    min-height: calc(100dvh - 28px);
    grid-template-columns: 1fr;
  }
  .client-focus-main {
    align-content: start;
    gap: 16px;
    padding: 24px 20px;
  }
  .client-focus-main h1 {
    font-size: clamp(38px, 12vw, 58px);
    line-height: .94;
  }
  .client-phone-line {
    font-size: clamp(21px, 7vw, 32px);
  }
  .client-contact-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .client-contact-btn,
  .contact-disabled {
    width: 100%;
  }
  .client-focus-action {
    align-content: center;
    padding: 20px;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .client-focus-action > strong {
    font-size: clamp(42px, 12vw, 68px);
  }
  .client-focus-action .consultant-main-action {
    width: 100%;
    min-height: 88px;
    font-size: clamp(22px, 6vw, 30px);
  }
  .operation-action {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .queue-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .queue-row.empty {
    grid-template-columns: 1fr;
  }
  .queue-row.empty > div {
    grid-column: auto;
  }
  .queue-row > div:nth-of-type(2),
  .queue-row .status {
    grid-column: 2;
  }
  .queue-row .status {
    justify-self: start;
  }
  .vehicle-status-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .vehicle-status-legend {
    justify-content: flex-start;
  }
  .vehicle-status-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  }
  .steps { grid-template-columns: 1fr; }
  .section-title,
  .admin-head,
  .workflow-head,
  .settings-intro {
    display: grid;
  }
  .settings-save { justify-content: stretch; }
  .settings-save .btn { width: 100%; }
  .admin-table-tools {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .admin-modal {
    align-items: end;
    padding: 10px;
  }
  .admin-modal-card {
    max-height: 92vh;
  }
  .admin-modal-form {
    grid-template-columns: 1fr;
  }
  .admin-modal-actions,
  .admin-modal-actions .btn {
    width: 100%;
  }
  .admin-modal-actions .autosave-state {
    width: 100%;
    margin-right: 0;
  }
  .admin-table-status {
    justify-self: stretch;
  }
  table { min-width: 680px; }
}
