:root {
  color-scheme: light;
  --ink: #172526;
  --muted: #627071;
  --line: #dbe4e0;
  --paper: #ffffff;
  --wash: #f4f7f5;
  --deep: #153b3d;
  --brand-red: #ff0000;
  --teal: #27736f;
  --green: #287b4b;
  --amber: #b46a16;
  --red: #b33b35;
  --violet: #7050a8;
  --gold: #e2ad39;
  --shadow: 0 18px 50px rgba(23, 37, 38, 0.12);
  --refresh-remaining: 100%;
  --status-scroll-progress: 0;
  --logo-x: 0px;
  --logo-y: 0px;
  --logo-scale: 1;
  --logo-start-left: 0px;
  --logo-start-top: 0px;
  --logo-placeholder-width: 46px;
  --logo-placeholder-height: 46px;
}

@property --refresh-remaining {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 100%;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  min-height: 100dvh;
  background: var(--wash);
  touch-action: pan-x pan-y;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(39, 115, 111, 0.13), transparent 28rem),
    linear-gradient(180deg, #eef5f1 0%, var(--wash) 22rem);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  letter-spacing: 0;
  touch-action: pan-x pan-y;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.as-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.app-shell {
  width: min(980px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 0;
  backdrop-filter: blur(18px);
}

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

.brand::before {
  content: "";
  display: block;
  flex: 0 0 var(--logo-placeholder-width);
  width: var(--logo-placeholder-width);
  height: var(--logo-placeholder-height);
}

.brand-mark {
  position: fixed;
  left: var(--logo-start-left);
  top: var(--logo-start-top);
  z-index: 12;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-red);
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(255, 0, 0, 0.12);
  transform: translate3d(var(--logo-x), var(--logo-y), 0) scale(var(--logo-scale));
  transform-origin: top left;
  will-change: transform;
}

.brand h1 {
  margin-left: 8px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1;
}

.brand p,
.view-heading p,
.detail-head p,
.source-note,
.field-note {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-size: 13px;
}

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

.icon-button,
.text-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-radius: 8px;
  min-height: 42px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 22px;
}

.icon-button:hover,
.text-button:hover {
  border-color: rgba(39, 115, 111, 0.38);
  transform: translateY(-1px);
}

.icon-button:active,
.text-button:active {
  transform: translateY(0);
}

.icon-button.subtle {
  background: transparent;
  border-color: transparent;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 700;
  text-decoration: none;
}

.text-button.primary {
  background: var(--deep);
  border-color: var(--deep);
  color: #fff;
}

.text-button.danger {
  color: var(--red);
}

.text-button.ghost {
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
}

.text-button:disabled {
  cursor: default;
  opacity: 0.62;
  transform: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-strip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 34px rgba(23, 37, 38, 0.08);
}

.status-logo-slot {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 46px;
  height: 46px;
  pointer-events: none;
  transform: translateY(-50%);
}

.status-copy {
  min-width: 0;
  justify-self: end;
  text-align: right;
  padding-left: calc(48px * var(--status-scroll-progress));
}


.status-strip strong,
.status-strip span {
  display: block;
}

.status-strip strong {
  font-size: 14px;
}

.status-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.refresh-controls {
  display: grid;
  grid-template-columns: minmax(104px, 122px) 42px;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
}

.refresh-meter {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(98, 112, 113, 0.16);
}

.refresh-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--gold);
  transition: width 0.9s linear;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-heading,
.detail-head,
.detail-nav,
.vehicle-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.view-heading {
  margin-bottom: 18px;
}

.heading-tools {
  display: flex;
  align-items: end;
  gap: 10px;
}

.view-heading h2,
.detail-head h2 {
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1.02;
}

.view-heading p,
.detail-head p {
  margin-top: 7px;
  font-size: 15px;
}

.select-wrap,
.search-box,
.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.select-wrap {
  min-width: 122px;
}

.select-wrap.compact {
  min-width: 0;
}

.select-wrap.compact select {
  min-height: 42px;
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-size: 16px;
  outline: none;
}

input {
  text-transform: uppercase;
}

select:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(39, 115, 111, 0.16);
}

.checkpoint-groups,
.settings-list {
  display: grid;
  gap: 18px;
}

.border-group {
  display: grid;
  gap: 8px;
}

.border-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.checkpoint-list,
.vehicle-list {
  display: grid;
  gap: 8px;
}

.checkpoint-list.collapsed {
  display: none;
}

.checkpoint-card,
.vehicle-row,
.my-car-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(23, 37, 38, 0.07);
}

.checkpoint-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  text-align: left;
}

.checkpoint-emoji {
  font-size: 26px;
}

.checkpoint-card h3,
.vehicle-row strong,
.my-car-card strong {
  font-size: 17px;
}

.checkpoint-card p,
.vehicle-row p,
.my-car-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.vehicle-row .raw-data {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.78;
}

.count-stack {
  min-width: 72px;
  text-align: right;
}

.count-stack strong {
  display: block;
  font-size: 27px;
  line-height: 1;
}

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

.checkpoint-main {
  min-width: 0;
}

.metric-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.trend {
  font-weight: 900;
}

.trend.up {
  color: var(--red);
}

.trend.down {
  color: var(--green);
}

.trend.flat {
  color: var(--muted);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
}

.mini-button {
  min-height: 34px;
  border: 1px solid rgba(39, 115, 111, 0.24);
  border-radius: 8px;
  background: #edf7f3;
  color: var(--deep);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.status-empty,
.status-light {
  color: var(--green);
}

.status-moderate {
  color: var(--amber);
}

.status-heavy {
  color: var(--red);
}

.status-nodata {
  color: var(--muted);
}

.detail-nav {
  align-items: center;
  margin: 4px 0 16px;
}

.detail-head {
  align-items: center;
  margin-bottom: 16px;
}

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

.route-picker {
  position: relative;
}

.route-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: none;
  min-width: 176px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 16px 36px rgba(18, 18, 22, 0.18);
}

.route-picker.open .route-menu {
  display: grid;
}

.route-menu button {
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}

.route-menu button:last-child {
  border-bottom: 0;
}

.route-menu button:active {
  background: #f1f1f3;
}

@media (max-width: 430px) {
  .route-picker {
    position: static;
  }

  .detail-actions {
    position: relative;
  }

  .route-menu {
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 0;
    border-radius: 8px;
  }

  .route-menu button {
    min-height: 48px;
    padding: 0 16px;
    font-size: 16px;
  }
}

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

.stat {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.stat strong {
  display: block;
  font-size: 24px;
}

.stat span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.stat-select {
  width: auto;
  min-height: 28px;
  margin-left: 3px;
  padding: 0 24px 0 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.my-car-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 14px;
  border-color: rgba(226, 173, 57, 0.45);
  background: #fffaf0;
}

.search-box {
  margin: 14px 0;
}

.vehicle-list-head {
  align-items: baseline;
  margin: 12px 0 8px;
}

.vehicle-list-head h3 {
  font-size: 17px;
}

.vehicle-list-head span {
  color: var(--muted);
  font-size: 13px;
}

.vehicle-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
}

.vehicle-row.highlight {
  border-color: rgba(226, 173, 57, 0.55);
  background: #fffaf0;
}

.vehicle-row.status-flash {
  animation: vehicle-status-flash 1.8s ease-out;
}

@keyframes vehicle-status-flash {
  0% {
    background: rgba(226, 173, 57, 0.34);
  }

  42% {
    background: rgba(226, 173, 57, 0.18);
  }

  100% {
    background: rgba(255, 255, 255, 0.86);
  }
}

.vehicle-row.highlight.status-flash {
  animation-name: vehicle-status-flash-highlight;
}

@keyframes vehicle-status-flash-highlight {
  0% {
    background: rgba(226, 173, 57, 0.4);
  }

  100% {
    background: #fffaf0;
  }
}

.position {
  width: 46px;
  color: var(--teal);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-weight: 800;
}

.regnum {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0;
}

.row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
}

.pill.called {
  background: rgba(180, 106, 22, 0.14);
  color: var(--amber);
}

.pill.priority {
  background: rgba(112, 80, 168, 0.13);
  color: var(--violet);
}

.pill.mine {
  background: rgba(226, 173, 57, 0.18);
  color: #8a640e;
}

.source-note {
  margin: 18px 0 0;
  font-size: 12px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.car-dialog {
  width: min(420px, calc(100% - 28px));
  max-height: min(80dvh, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}

.car-dialog::backdrop {
  background: rgba(15, 30, 31, 0.42);
  backdrop-filter: blur(4px);
}

.car-dialog form {
  padding: 18px;
}

.dialog-title,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-title {
  margin-bottom: 18px;
}

.dialog-title h2 {
  font-size: 22px;
}

.field-note {
  margin-top: 8px;
  font-size: 13px;
}

.dialog-actions {
  margin-top: 18px;
}

.toggle-row,
.number-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(23, 37, 38, 0.06);
}

.toggle-row strong,
.number-row strong {
  display: block;
  font-size: 15px;
}

.toggle-row small,
.number-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.toggle-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--teal);
}

.number-row input {
  width: 92px;
  text-align: right;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.refresh-controls {
  position: relative;
}

.refresh-controls .select-wrap {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  display: none;
  min-width: 104px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(18, 18, 22, 0.14);
}

.refresh-controls.open .select-wrap {
  display: block;
}

.refresh-controls .select-wrap span {
  display: none;
}

.refresh-controls .select-wrap select {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}

.interval-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 7;
  display: none;
  min-width: 96px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(18, 18, 22, 0.14);
}

.refresh-controls.open .interval-menu {
  display: grid;
}

.interval-menu button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.interval-menu button:last-child {
  border-bottom: 0;
}

.interval-menu button.active {
  background: #f1f1f3;
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 12px;
  }

  .view-heading,
  .detail-head {
    display: grid;
  }

  .heading-tools {
    align-items: stretch;
  }

  .status-strip {
    display: grid;
  }

  .refresh-controls {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .select-wrap {
    min-width: 0;
  }

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

  .checkpoint-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .count-stack {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    text-align: left;
  }

  .card-actions {
    grid-column: 1 / -1;
  }

  .mini-button {
    width: 100%;
  }

  .vehicle-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .position {
    width: auto;
    grid-column: 1 / -1;
  }

  .toggle-row,
  .number-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Dark road-mode home inspired by the provided mockups */
:root {
  color-scheme: dark;
  --ink: #f5f5f5;
  --muted: #9d9da3;
  --line: #2d2d30;
  --paper: #151516;
  --wash: #101011;
  --deep: #202124;
  --green: #49b66b;
  --amber: #c57a29;
  --red: #d34b55;
  --shadow: none;
  --refresh-progress: 0%;
}

html,
body {
  background: #101011;
}

body {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.05), transparent 18rem),
    linear-gradient(180deg, #151516 0%, #0f0f10 18rem, #101011 100%);
  color: var(--ink);
}

.app-shell {
  width: min(980px, 100%);
  padding-inline: 26px;
}

.topbar {
  padding-top: 30px;
  position: relative;
  backdrop-filter: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  font-size: 28px;
  box-shadow: none;
}

.brand h1 {
  font-size: 30px;
  font-weight: 850;
}

.top-actions .icon-button {
  background: #171719;
  border-color: #353539;
  color: #f4f4f5;
}

.top-actions #installButton {
  display: none;
}

.status-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 14px 14px;
  border-color: #323236;
  border-radius: 18px;
  background: rgba(24, 24, 25, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5fc57a;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 0;
}

.live-chip span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5fc57a;
  box-shadow: 0 0 16px rgba(95, 197, 122, 0.7);
}

.refresh-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#202124 var(--refresh-remaining), #d8d8dc 0);
  transition: --refresh-remaining 1s linear;
}

.refresh-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--paper);
}

.refresh-ring span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #202124;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.status-strip strong {
  font-size: 24px;
  line-height: 1.05;
  font-weight: 800;
}

.status-strip span {
  color: #9d9da3;
  font-size: 18px;
}

.refresh-controls {
  grid-template-columns: 54px;
  gap: 0;
}

.refresh-controls .select-wrap {
  display: none;
}

.refresh-controls .refresh-meter {
  display: none;
}

.border-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 10px 0;
  overflow: hidden;
  border: 1px solid #323236;
  border-radius: 5px;
  background: #2c2c2f;
}

.tab-button {
  min-height: 54px;
  border: 0;
  border-right: 1px solid #3e3e42;
  background: transparent;
  color: #a9a9ad;
  font-weight: 850;
  font-size: 17px;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button.active {
  background: #55555b;
  color: #fff;
}

.checkpoint-groups {
  gap: 10px;
}

.border-group {
  gap: 0;
  overflow: hidden;
  border: 1px solid #303034;
  border-radius: 4px;
  background: #141415;
}

.border-toggle {
  min-height: 49px;
  border: 0;
  border-bottom: 1px solid #303034;
  border-radius: 0;
  background: #181819;
  color: #b6b6bc;
  font-size: 15px;
  font-weight: 900;
}

.checkpoint-list {
  gap: 0;
}

.checkpoint-card {
  position: relative;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 0;
  min-height: 104px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #29292d;
  border-radius: 0;
  background: #141415;
  box-shadow: none;
}

.checkpoint-card:last-child {
  border-bottom: 0;
}

.checkpoint-emoji {
  display: none;
}

.checkpoint-main {
  padding: 12px 10px 12px 16px;
}

.checkpoint-card h3 {
  color: #fff;
  font-size: 20px;
  line-height: 1.12;
  font-weight: 820;
}

.checkpoint-card p {
  color: #a6a6ac;
  font-size: 14px;
}

.metric-line {
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.metric-line::-webkit-scrollbar {
  display: none;
}

.metric-line span {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #303034;
  color: #d5d5d9;
  font-size: 12px;
  font-weight: 800;
}

.metric-line .trend.down {
  color: #61c67d;
}

.metric-line .trend.up {
  color: #e15d65;
}

.count-stack {
  position: relative;
  align-self: stretch;
  display: grid;
  place-content: center;
  min-width: 88px;
  padding: 8px 0;
  border-left: 1px solid #313136;
  background: rgba(197, 122, 41, 0.3);
  text-align: center;
}

.wait-stack {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 8px;
  color: #f4f4f5;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
}

.count-stack strong {
  font-size: 34px;
  font-weight: 900;
}

.count-stack span {
  color: #c4c4ca;
  font-size: 13px;
  font-weight: 800;
}

.count-stack .my-car-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 0 0 0 4px;
  background: #bd7629;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  transform: translateY(-1px);
}

.card-actions {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.mini-button {
  width: 42px;
  min-height: 72px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: #b9babf;
  color: #111;
  font-size: 0;
}

.mini-button::before {
  content: "⚑";
  font-size: 30px;
  font-weight: 900;
}

.status-empty,
.status-light {
  color: #61c67d;
}

.status-moderate {
  color: #d08a3c;
}

.status-heavy {
  color: #d94e58;
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 16px;
  }

  .status-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .checkpoint-card {
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .wait-stack,
  .count-stack strong {
    font-size: 28px;
  }

  .count-stack,
  .card-actions {
    grid-column: auto;
    border-top: 0;
  }
}

/* Light theme */
:root {
  color-scheme: light;
  --ink: #111113;
  --muted: #6c6c72;
  --line: #d8d8de;
  --paper: #ffffff;
  --wash: #f4f4f6;
  --deep: #111113;
  --green: #3aa66b;
  --amber: #b87522;
  --red: #b82f3c;
  --shadow: 0 10px 28px rgba(18, 18, 22, 0.08);
}

html,
body {
  background: var(--wash);
}

body {
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.8), transparent 18rem),
    linear-gradient(180deg, #f7f7f8 0%, #eeeeef 100%);
  color: var(--ink);
}

.top-actions .icon-button {
  background: #f8f8f9;
  border-color: #d6d6dc;
  color: #111113;
}

.status-strip {
  border-color: #d5d5db;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 22px rgba(18, 18, 22, 0.06);
}

.live-chip {
  color: #45a763;
}

.live-chip span {
  background: #45a763;
  box-shadow: 0 0 14px rgba(69, 167, 99, 0.45);
}

.refresh-ring {
  background: conic-gradient(#202124 var(--refresh-remaining), #d8d8dc 0);
}

.refresh-ring span {
  color: #202124;
}

.status-strip span {
  color: #6c6c72;
}

.border-tabs {
  border-color: #d5d5db;
  background: #e3e3e7;
}

.tab-button {
  border-right-color: #d0d0d6;
  color: #73737a;
}

.tab-button.active {
  background: #fff;
  color: #111113;
  box-shadow: 0 6px 16px rgba(18, 18, 22, 0.12);
}

.border-group {
  border-color: #d3d3d8;
  background: #fff;
}

.border-toggle {
  border-bottom-color: #d3d3d8;
  background: #f7f7f8;
  color: #66666d;
}

.border-toggle {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 24px;
  min-height: 56px;
  padding: 0 16px 0 0;
  overflow: hidden;
  align-items: stretch;
  text-align: left;
}

.country-mark {
  align-self: stretch;
  display: block;
  width: 24px;
  min-height: 56px;
  height: 100%;
  border-right: 1px solid rgba(0, 0, 0, 0.04);
}

.country-lt {
  background: linear-gradient(180deg, #f7c948 0 33.33%, #22966d 33.33% 66.66%, #c42d3a 66.66%);
}

.country-pl {
  background: linear-gradient(180deg, #ffffff 0 50%, #dc143c 50%);
}

.country-lv {
  background: linear-gradient(180deg, #9e2534 0 40%, #ffffff 40% 60%, #9e2534 60%);
}

.country-name {
  align-self: center;
  color: #5f5f66;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.country-total,
.country-chevron {
  align-self: center;
  color: #4e4e55;
  font-size: 19px;
  font-weight: 900;
}

.country-chevron {
  justify-self: end;
  color: #4e4e55;
  font-size: 12px;
  line-height: 1;
}

.checkpoint-card {
  border-bottom-color: #dedee3;
  background: #fff;
  grid-template-columns: minmax(0, 1fr) 96px;
}

.wait-stack {
  color: #111113;
  min-width: 132px;
  padding-inline: 10px;
  overflow: hidden;
  font-size: 30px;
}

.checkpoint-card h3 {
  color: #111113;
}

.checkpoint-card p {
  color: #606067;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 820;
}

.metric-line span {
  background: #ededf0;
  color: #111113;
}

.metric-line .trend.down {
  color: #32985e;
}

.metric-line .trend.up {
  color: #b82f3c;
}

.count-stack {
  border-left-color: #d5d5db;
  background: #fff2df;
  min-width: 96px;
  z-index: 1;
}

.count-stack.status-empty,
.count-stack.status-light,
.card-actions.status-empty,
.card-actions.status-light {
  background: #dff5e8;
}

.count-stack.status-moderate,
.card-actions.status-moderate {
  background: #fff0dc;
}

.count-stack.status-heavy,
.card-actions.status-heavy {
  background: #f8dede;
}

.count-stack.status-nodata,
.card-actions.status-nodata {
  background: #ececf0;
}

.status-empty,
.status-light {
  color: #3aa66b;
}

.status-moderate {
  color: #b87522;
}

.status-heavy {
  color: #b82f3c;
}

.count-stack span {
  color: #8d6a38;
}

.count-stack.status-empty span,
.count-stack.status-light span {
  color: #2f8c58;
}

.count-stack.status-moderate span {
  color: #a46417;
}

.count-stack.status-heavy span {
  color: #a92e39;
}

.queue-label {
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.count-stack .my-car-ribbon {
  background: #c9822b;
  color: #fff;
}

.card-actions {
  background: #f1f1f3;
}

.mini-button {
  background: #fff;
  color: #111113;
  box-shadow: 0 1px 3px rgba(18, 18, 22, 0.12);
}

.mini-button::before {
  content: "➤";
  display: block;
  transform: rotate(-45deg);
  font-size: 31px;
  line-height: 1;
}

.count-stack .my-car-ribbon,
.count-stack.status-empty .my-car-ribbon,
.count-stack.status-light .my-car-ribbon,
.count-stack.status-moderate .my-car-ribbon,
.count-stack.status-heavy .my-car-ribbon,
.count-stack.status-nodata .my-car-ribbon {
  color: #fff;
}

/* Typography cleanup */
.brand h1 {
  font-weight: 700;
}

.live-chip,
.status-strip strong,
.tab-button,
.border-toggle,
.country-name,
.country-total,
.checkpoint-card p,
.metric-line span,
.count-stack span,
.mini-button,
.pill,
.toggle-row strong,
.number-row strong {
  font-weight: 600;
}

.wait-stack,
.count-stack strong {
  font-weight: 700;
}

.queue-label,
.count-stack .my-car-ribbon {
  font-weight: 500;
}

@media (max-width: 520px) {
  .checkpoint-card {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .wait-stack {
    min-width: 104px;
    font-size: 24px;
    padding-inline: 6px;
  }

  .count-stack {
    min-width: 82px;
  }

  .count-stack strong {
    font-size: 30px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-inline: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .topbar {
    gap: 10px;
    padding: 8px 0;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }

  .brand h1 {
    font-size: 28px;
  }

  .top-actions {
    gap: 6px;
  }

  .icon-button {
    width: 40px;
    min-height: 40px;
    font-size: 20px;
  }

  .status-strip {
    grid-template-columns: auto minmax(0, 1fr) 44px;
    gap: 9px;
    margin: 6px 0 10px;
    padding: 10px 10px;
    border-radius: 12px;
  }

  .live-chip {
    gap: 6px;
    font-size: 18px;
  }

  .live-chip span {
    width: 11px;
    height: 11px;
  }

  .status-copy {
    min-width: 0;
  }

  .status-strip strong {
    font-size: 18px;
    line-height: 1.05;
    white-space: nowrap;
  }

  .status-copy span {
    display: none;
  }

  .refresh-controls {
    grid-template-columns: 44px;
  }

  .refresh-ring {
    width: 44px;
    height: 44px;
  }

  .refresh-ring span {
    font-size: 14px;
  }

  .border-tabs {
    margin: 8px 0;
  }

  .tab-button {
    min-height: 44px;
    font-size: 15px;
  }

  .fastest-card {
    padding: 9px 10px;
    font-size: 15px;
  }

  .border-toggle {
    grid-template-columns: 34px minmax(0, 1fr) auto 18px;
    min-height: 44px;
  }

  .country-name,
  .country-total {
    font-size: 15px;
  }

  .checkpoint-card {
    grid-template-columns: minmax(0, 1fr) 60px;
    min-height: 86px;
    contain: layout paint;
  }

  .checkpoint-main {
    padding: 9px 6px 8px 10px;
  }

  .checkpoint-card p {
    font-size: 16px;
    line-height: 1.12;
  }

  .metric-line {
    gap: 4px;
    margin-top: 7px;
    max-width: 100%;
  }

  .metric-line span {
    min-height: 20px;
    padding: 2px 5px;
    font-size: 11px;
  }

  .wait-stack {
    min-width: 106px;
    padding-inline: 3px;
    font-size: 16px;
    line-height: 1;
  }

  .count-stack {
    min-width: 60px;
    padding: 6px 0;
  }

  .queue-label {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .count-stack strong {
    font-size: 24px;
    line-height: 0.95;
  }

  .count-stack span {
    font-size: 12px;
  }

  .count-stack .my-car-ribbon {
    min-height: 22px;
    padding: 4px 6px;
    font-size: 0;
  }

  .count-stack .my-car-ribbon::after {
    content: "Мой авто";
    font-size: 10px;
    line-height: 1;
  }

  .card-actions {
    padding: 5px;
  }

  .mini-button {
    width: 28px;
    min-height: 54px;
    border-radius: 5px;
  }

  .mini-button::before {
    font-size: 24px;
  }
}

/* Refresh widget layout */
.status-strip {
  position: sticky;
  top: 0;
  z-index: 80;
  grid-template-columns: minmax(0, 1fr) auto;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.status-strip::before {
  content: none;
}

.status-strip-pinned .status-strip {
  border-radius: 0;
  box-shadow: 0 10px 24px rgba(18, 18, 22, 0.2);
}

.topbar {
  z-index: 100;
}

.brand-mark {
  z-index: 110;
}

.status-copy {
  justify-self: start;
  text-align: left;
  padding-left: calc(62px * var(--status-scroll-progress));
}

.refresh-controls {
  justify-self: end;
}

.status-logo-visible .brand-mark {
  pointer-events: auto;
}

.refresh-controls .select-wrap {
  display: none;
}

@media (max-width: 430px) {
  .status-strip {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .status-copy {
    padding-left: calc(58px * var(--status-scroll-progress));
  }
}
