:root {
  color-scheme: dark;
  font-family: var(--font-sans);
  line-height: 1.55;
  color: var(--text-1);
  background: var(--surface-0);
  scrollbar-gutter: stable;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button { appearance: none; font: inherit; color: inherit; }
h2 { font-size: 1.19rem; font-weight: 720; }
h3 { font-size: 1rem; font-weight: 680; }
p, .muted { color: var(--text-2); }
:focus-visible { outline: 2px solid var(--theme-primary); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.masthead { background: var(--surface-1); border-bottom: 1px solid var(--border-2); }
.masthead-inner, .brand, .account { display: flex; align-items: center; }
.masthead-inner { min-height: 70px; justify-content: space-between; gap: 16px; }
.brand, .account { gap: 16px; min-width: 0; }
.logo { display: block; flex: none; height: auto; }
.brand-service { border-inline-start: 1px solid var(--border-strong); padding-inline-start: 16px; color: var(--text-2); font-size: .875rem; white-space: nowrap; }
.account { justify-content: end; }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.main { padding-block: 38px 72px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  isolation: isolate;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: var(--surface-1);
}
.hero-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(30px, 5vw, 66px); }
.hero h1 { font-size: clamp(3.3rem, 6.4vw, 5.3rem); line-height: 1.05; letter-spacing: -.06em; font-weight: 850; }
.hero h1 span { color: var(--theme-primary); }
.hero-description { margin-top: 20px; max-width: 22em; font-size: 1rem; line-height: 1.75; }
.login { display: grid; justify-items: start; gap: 10px; margin-top: 32px; }
.login p { font-size: .8125rem; }
.hero-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
  padding: 30px clamp(24px, 3.4vw, 46px) 30px 30px;
}
.hero-city {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 -22%;
  background:
    linear-gradient(90deg, var(--surface-1) 0%, transparent 47%),
    linear-gradient(0deg, rgba(16, 13, 11, .86), transparent 63%),
    url('/city.webp') center 54% / cover;
}
.edition-route {
  position: relative;
  display: grid;
  gap: 15px;
  margin-top: auto;
  padding: 13px 19px 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-0) 91%, transparent);
}
.route-stop { display: flex; align-items: center; gap: 10px; font-size: .875rem; line-height: 1.45; }
.route-stop::before { z-index: 1; content: ""; width: 9px; height: 9px; flex: none; border: 2px solid var(--text-2); border-radius: 50%; background: var(--surface-1); }
.route-stop:last-child::before { background: var(--theme-primary); border-color: var(--theme-primary); }
.route-stop:first-child::after { position: absolute; content: ""; inset: 26px auto 26px 18px; width: 1px; background: var(--theme-border-strong); }
.route-stop > span { color: var(--text-2); white-space: nowrap; }
.route-stop strong { font-weight: 650; }
.opening {
  display: grid;
  justify-items: start;
  gap: 2px;
  padding-left: 11px;
  border-left: 2px solid var(--theme-primary);
  font-variant-numeric: tabular-nums;
}
.phase { color: var(--theme-hover); font-size: .78rem; font-weight: 700; }
.opening-time { display: flex; align-items: baseline; column-gap: 8px; flex-wrap: wrap; }
.opening-time strong { font-size: 1.125rem; white-space: nowrap; }
.opening-time > span { color: var(--text-2); font-size: .75rem; white-space: nowrap; }
.portal[data-view="workspace"] .hero { min-height: 0; grid-template-columns: minmax(0, 1fr) auto; }
.portal[data-view="workspace"] .hero-copy { padding: 25px 30px; }
.portal[data-view="workspace"] .hero h1 { font-size: 2.5rem; }
.portal[data-view="workspace"] .hero-description { max-width: none; margin-top: 8px; font-size: .875rem; }
.portal[data-view="workspace"] .hero-side { justify-content: center; padding: 25px 30px; }
.portal[data-view="workspace"] :is(.hero-city, .edition-route) { display: none; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--duration-fast), border-color var(--duration-fast);
}
.button.primary { background: var(--theme-primary); color: var(--text-inverse); }
.button.primary:hover:not(:disabled) { background: var(--theme-hover); }
.button.secondary { color: var(--text-1); background: var(--surface-2); border-color: var(--border-strong); }
.button.secondary:hover:not(:disabled) { background: var(--surface-3); }
.button:disabled { color: var(--text-2); background: var(--surface-3); border-color: var(--border-2); cursor: default; }
.button.logout { min-height: 38px; padding-inline: 12px; background: transparent; border-color: var(--border-2); color: var(--text-2); font-size: .8125rem; }
.button.logout:hover { background: var(--surface-2); color: var(--text-1); }
.login-button { min-height: 52px; padding-inline: 18px; }

.icon { position: relative; display: inline-block; width: 1.125rem; height: 1.125rem; flex: none; color: inherit; }
.icon::before, .icon::after { position: absolute; content: ""; }
.arrow::before { width: 14px; height: 2px; left: 2px; top: 8px; background: currentColor; }
.arrow::after { width: 8px; height: 8px; right: 2px; top: 5px; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); }
.chevron::before { width: 8px; height: 8px; left: 5px; top: 3px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.coins::before, .coins::after { width: 13px; height: 7px; left: 2px; border: 1.5px solid currentColor; border-radius: 50%; }
.coins::before { top: 3px; }
.coins::after { top: 8px; border-top-color: transparent; }
.bag::before { inset: 5px 3px 1px; border: 1.5px solid currentColor; border-radius: 4px 4px 3px 3px; }
.bag::after { inset: 2px 6px auto; height: 4px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 3px 3px 0 0; }
.car::before { inset: 7px 1px 3px; border: 1.5px solid currentColor; border-radius: 3px; }
.car::after { inset: 3px 4px 11px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; }

.guide { margin-top: 30px; }
.guide h2 { margin-bottom: 11px; }
.guide-list { display: grid; grid-template-columns: 1.45fr .95fr 1.1fr; border: 1px solid var(--border-2); border-radius: 16px; background: var(--surface-1); }
.guide-list li { display: flex; align-items: flex-start; gap: 10px; padding: 20px; }
.guide-list li + li { border-inline-start: 1px solid var(--border-2); }
.guide-icon { margin-top: 3px; color: var(--theme-primary); }
.guide-list h3 { font-size: .925rem; }
.guide-list p { margin-top: 5px; font-size: .8125rem; line-height: 1.65; }
.notice, .loading-line { margin-top: 14px; font-size: .9rem; }
.notice { padding: 10px 14px; border: 1px solid var(--theme-border); border-radius: 10px; background: var(--theme-muted); color: var(--text-1); overflow-wrap: anywhere; }
.notice.error { border-color: var(--color-danger-border); background: var(--color-danger-soft); }

.workspace { margin-top: 16px; }
.panel { min-width: 0; border: 1px solid var(--border-2); border-radius: 16px; background: var(--surface-1); }
.character-panel { padding: 17px 20px 20px; }
.character-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; margin-top: 12px; }
.character-arrow { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--theme-muted); color: var(--theme-hover); }
.picker { position: relative; min-width: 0; padding: 11px 12px 12px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface-0); }
.picker-label { display: inline-block; margin-inline-end: 7px; font-size: .875rem; font-weight: 680; }
.picker-edition { color: var(--text-2); font-size: .75rem; }
.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  padding: 8px 11px;
  text-align: start;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.picker-trigger:not(:disabled):hover, .picker-trigger[aria-expanded="true"] { border-color: var(--theme-border-strong); }
.picker-trigger:disabled { cursor: default; border-color: transparent; background: var(--surface-1); }
.picker-trigger:disabled .chevron { display: none; }
.picker-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.picker-value { min-width: 0; font-size: .9rem; font-weight: 680; overflow-wrap: anywhere; }
.picker-options {
  position: absolute;
  inset: calc(100% - 8px) 12px auto;
  z-index: var(--z-dropdown);
  max-height: 230px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 41px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: .875rem;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}
.picker-option:hover, .picker-option:focus { outline-offset: -2px; background: var(--surface-3); }
.picker-option[aria-selected="true"] { color: var(--theme-hover); background: var(--theme-selected-bg); }
.picker-option[aria-selected="true"]::after { content: ""; width: 7px; height: 11px; flex: none; margin-right: 3px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .46fr);
  grid-template-areas: "assets totals" "vehicles totals" "receipts totals";
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}
.summary .loading-line { grid-column: 1 / -1; margin-top: 0; }
.assets { grid-area: assets; }
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 15px 20px; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 3px 12px; padding: 12px 20px; border-top: 1px solid var(--border-2); }
.metric-desc { grid-column: 1; font-size: .8125rem; }
.metric-value { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-self: end; text-align: end; overflow-wrap: anywhere; }
.metric-value strong, .totals-amount strong, .receipt-value strong { font-size: 1.16rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.value-unit { margin-inline-start: .32em; color: var(--text-2); font-size: .76rem; white-space: nowrap; }
.music-note { grid-column: 1 / -1; margin-top: 5px; padding: 8px 10px; border-inline-start: 2px solid var(--theme-border-strong); border-radius: 0 6px 6px 0; background: var(--theme-muted); color: var(--text-1); font-size: .8125rem; }
.vehicles { grid-area: vehicles; }
.vehicle-list > li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 20px; border-top: 1px solid var(--border-2); }
.vehicle-info { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.vehicle-name { font-size: .9rem; font-weight: 675; }
.plate { color: var(--text-2); font-size: .76rem; letter-spacing: .045em; }
.status { flex: 0 1 auto; padding: 4px 8px; border: 1px solid var(--border-2); border-radius: 6px; color: var(--text-2); font-size: .75rem; }
.status.ready, .status.delivered { border-color: var(--color-success-border); background: var(--color-success-soft); color: #8ee7a8; }
.status.missing, .status.slots, .status.review, .status.unverified { border-color: var(--color-warning-border); background: var(--color-warning-soft); color: #f4cc65; }
.vehicle-empty, .case-id { padding: 10px 20px; border-top: 1px solid var(--border-2); font-size: .8125rem; overflow-wrap: anywhere; }

.totals { grid-area: totals; position: sticky; top: 14px; min-width: 0; padding: 18px; border-color: var(--theme-border); background: linear-gradient(150deg, var(--theme-muted), transparent 75%), var(--surface-1); }
.totals h2 { font-size: .94rem; }
.totals-amount { margin-block: 5px 12px; }
.totals-amount strong { color: var(--theme-hover); font-size: clamp(1.75rem, 3.7vw, 2.7rem); line-height: 1.12; overflow-wrap: anywhere; }
.totals-amount .value-unit { font-size: .875rem; }
.totals p { padding-top: 12px; border-top: 1px solid var(--theme-border); font-size: .8125rem; }
.totals .button { width: 100%; margin-top: 14px; }
.receipt-list { grid-area: receipts; }
.receipt-list .panel-heading { flex-wrap: wrap; }
.receipt-list h2 { scroll-margin-top: 14px; }
.receipt-case { color: var(--text-2); font-size: .75rem; overflow-wrap: anywhere; }
.receipts > li { border-top: 1px solid var(--border-2); padding: 12px 20px; }
.receipt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.receipt-top time { min-width: max-content; color: var(--text-2); font-size: .75rem; font-variant-numeric: tabular-nums; }
.receipt-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; font-size: .8125rem; }
.receipt-details > div { display: flex; gap: 5px; flex-wrap: wrap; }
.receipt-details dt { color: var(--text-2); }
.receipts .vehicle-list { margin-top: 9px; }
.receipts .vehicle-list > li { padding-inline: 0; }

body.modal-open { overflow: hidden; }
.modal-layer { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 14px; background: var(--surface-overlay); }
.modal { width: min(100%, 460px); max-height: 100%; overflow: auto; overscroll-behavior: contain; padding: 23px; border: 1px solid var(--border-strong); border-radius: 19px; background: var(--surface-elevated); box-shadow: var(--shadow-lg); }
.modal h2 { font-size: 1.35rem; }
.modal > p { margin-top: 7px; font-size: .875rem; }
.confirm-summary { margin-top: 15px; padding: 12px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface-0); }
.confirm-summary dl { display: grid; gap: 6px; }
.confirm-summary dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: baseline; gap: 8px; }
.confirm-summary dt { color: var(--text-2); font-size: .8125rem; }
.confirm-summary dd { text-align: end; overflow-wrap: anywhere; }
.confirm-summary dl > div:last-child { padding-top: 7px; border-top: 1px solid var(--border-2); }
.confirm-summary dl > div:last-child dd { color: var(--theme-hover); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 820px) {
  .shell { width: calc(100% - 40px); }
  .hero-copy { padding: 32px; }
  .summary { grid-template-columns: minmax(0, 1fr) minmax(0, .56fr); }
  .guide-list { grid-template-columns: 1fr; }
  .guide-list li { padding: 14px 17px; }
  .guide-list li + li { border-inline-start: 0; border-top: 1px solid var(--border-2); }
}

@media (max-width: 630px) {
  .shell { width: calc(100% - 28px); }
  .masthead-inner { min-height: 60px; }
  .brand, .account { gap: 8px; }
  .logo { width: 102px; }
  .brand-service { font-size: .75rem; padding-inline-start: 8px; }
  .portal[data-view="workspace"] .brand-service { display: none; }
  .main { padding-block: 16px 36px; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; border-radius: 17px; }
  .hero-copy { padding: 24px 19px 22px; }
  .hero h1 { font-size: 3.25rem; }
  .hero-description { margin-top: 12px; font-size: .9rem; }
  .login { width: 100%; margin-top: 18px; }
  .login-button { width: 100%; }
  .hero-side { min-height: 162px; padding: 10px 19px 16px; gap: 10px; }
  .hero-city { inset: -16px 0 0; background-image: linear-gradient(180deg, var(--surface-1), transparent 40%), linear-gradient(0deg, rgba(16, 13, 11, .88), transparent 75%), url('/city.webp'); }
  .edition-route { gap: 9px; padding: 8px 11px; }
  .route-stop { font-size: .78rem; gap: 8px; }
  .route-stop:first-child::after { inset: 17px auto 17px 15px; }
  .opening-time strong { font-size: .98rem; }
  .portal[data-view="workspace"] .hero { grid-template-columns: minmax(0, 1fr); }
  .portal[data-view="workspace"] .hero-copy { padding: 17px 15px 9px; }
  .portal[data-view="workspace"] .hero h1 { font-size: 2.15rem; }
  .portal[data-view="workspace"] .hero-side { min-height: 0; padding: 0 15px 15px; }
  .guide { margin-top: 19px; }
  .character-panel { padding: 13px; }
  .character-route { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .character-arrow { justify-self: center; width: 25px; height: 25px; }
  .character-arrow .icon { transform: rotate(90deg); }
  .summary { grid-template-columns: minmax(0, 1fr); grid-template-areas: "assets" "vehicles" "totals" "receipts"; gap: 10px; }
  .totals { position: static; padding: 14px; }
  .totals-amount strong { font-size: 2rem; }
  .panel-heading, .metric, .vehicle-list > li, .vehicle-empty, .case-id, .receipts > li { padding-inline: 13px; }
  .modal { padding: 17px; }
  .modal-actions > .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
