/* ═══════════════════════════════════════════════════════════════════════════
   Copart → Ukraine landed-cost calculator
   Freight-manifest aesthetic: slate ground, amber cargo accent, tabular figures.
   Deliberately distinct from the wiring-diagram pages (Audi red on near-black).
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0b1216;
  --panel:     #111d24;
  --panel-2:   #16252e;
  --line:      #21343f;
  --line-soft: #1a2a34;

  --amber:     #f0a828;
  --amber-dim: #f0a82833;
  --teal:      #4ec9b0;
  --violet:    #8b8fe0;
  --rose:      #e8636f;

  --text:      #dee7ec;
  --text-hi:   #ffffff;
  --muted:     #78909e;
  --faint:     #4a6270;

  --stage-w:   26px;
}

:root[data-theme="light"] {
  --bg:        #f2f5f6;
  --panel:     #ffffff;
  --panel-2:   #eef2f4;
  --line:      #d3dde2;
  --line-soft: #e3eaed;

  --amber:     #b06f00;
  --amber-dim: #b06f0018;
  --teal:      #0f7d68;
  --violet:    #4a4fa8;
  --rose:      #c0323f;

  --text:      #1d2c34;
  --text-hi:   #000000;
  --muted:     #5d7280;
  --faint:     #8ba0ac;
}

html, body {
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* Every figure in this document lines up in a column. */
.num { font-variant-numeric: tabular-nums; }

/* ── Masthead ───────────────────────────────────────────────────────────── */
.mast {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 12px #0006;
}
:root[data-theme="light"] .mast { box-shadow: 0 1px 8px #0000000f; }

.mast-back {
  /*display: flex; */
  display: none;
  align-items: center; gap: 6px; flex-shrink: 0;
  padding: 6px 12px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px; text-decoration: none;
  transition: border-color .15s, color .15s;
}
.mast-back:hover { border-color: var(--amber); color: var(--text-hi); }

.mast-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  border: 2px solid var(--amber); border-radius: 50%;
  display: grid; place-items: center;
}
.mast-icon svg { width: 18px; height: 18px; }

.mast-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
}
.mast-title b { color: var(--amber); font-weight: 600; }
.mast-tag {
  flex-shrink: 0;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
}

.club-badge {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
}
.club-badge svg { width: 30px; height: 15px; }
.club-badge span {
  font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}

.theme-btn {
  flex-shrink: 0; width: 32px; height: 32px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 14px; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .15s, color .15s;
}
.theme-btn:hover { border-color: var(--amber); color: var(--text); }

/* ── Sheet ──────────────────────────────────────────────────────────────── */
.sheet {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 26px;
  align-items: start;
}

/* ── Auction venue switch ───────────────────────────────────────────────────
   Sits above stage 1 because it governs the whole stage-1 fee schedule rather
   than being one input among many. */
.venue {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px; padding: 13px 16px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
}
.venue-label {
  flex-shrink: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.venue .seg { width: 100%; flex-shrink: 0; }
.venue-note {
  flex: 1; min-width: 180px;
  font-size: 11.5px; line-height: 1.45; color: var(--faint);
}
.venue-note:empty { display: none; }

/* ── Stage blocks ───────────────────────────────────────────────────────── */
/* The 1..4 numbering is the actual sequence a car passes through on import,
   not decoration. */
.stage { margin-bottom: 22px; }

.stage-head {
  display: flex; align-items: center; gap: 11px;
  padding-bottom: 9px; margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
}
.stage-no {
  flex-shrink: 0;
  width: var(--stage-w); height: var(--stage-w);
  display: grid; place-items: center;
  border: 1px solid var(--amber); border-radius: 50%;
  color: var(--amber); font-size: 11.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stage-name {
  font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text);
}
.stage-note { margin-left: auto; font-size: 11px; color: var(--faint); }

/* ── Fields ─────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 13px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
/* `display: flex` above beats the UA sheet's [hidden] rule, so restate it —
   same class of bug as .row[hidden] elsewhere in this file. */
.field[hidden] { display: none; }
.field > label {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted);
}
.lbl-opt { color: var(--faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.field-hint { font-size: 11px; color: var(--faint); line-height: 1.45; }
.yard { color: var(--muted); }
.yard:empty::before { content: 'not specified'; color: var(--faint); }

/* Marks a value the lot URL supplied rather than the user. */
.auto-badge {
  padding: 1.5px 6px; border-radius: 3px;
  background: var(--amber-dim); border: 1px solid var(--amber);
  color: var(--amber); font-size: 8.5px; font-weight: 700; letter-spacing: .08em;
}
.auto-badge[hidden] { display: none; }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 9px 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font-size: 14px; font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
input::placeholder { color: var(--faint); }
select { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Prefixed money input */
.money { position: relative; }
.money > span {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 14px; pointer-events: none;
}
.money > input { padding-left: 26px; }

/* Suffixed variant: the unit sits on the right instead. */
.money-pct > span { left: auto; right: 11px; }
.money-pct > input { padding-left: 11px; padding-right: 28px; }

/* ── Searchable location combobox ───────────────────────────────────────── */
.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 30;
  max-height: 262px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  box-shadow: 0 10px 28px #0009;
}
:root[data-theme="light"] .combo-list { box-shadow: 0 10px 28px #0000001f; }
.combo-list[hidden] { display: none; }
.combo-list::-webkit-scrollbar { width: 5px; }
.combo-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.combo-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 5px; cursor: pointer;
  font-size: 13.5px;
}
.combo-opt:hover,
.combo-opt[aria-selected="true"] { background: var(--amber-dim); }
.combo-opt[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--amber); }
.co-name { color: var(--text); }
.co-code {
  flex-shrink: 0; padding: 1px 5px; border-radius: 3px;
  background: var(--line-soft); color: var(--muted);
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
}
.co-port { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }
.combo-empty { padding: 13px 10px; font-size: 12.5px; color: var(--faint); }

/* Standalone checkbox field — an optional surcharge toggle, not a segmented
   choice, so it gets its own compact row instead of the .field label pattern. */
.check-field {
  display: flex; align-items: center; gap: 9px;
  margin: 13px 0; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; user-select: none;
}
.check-field input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; accent-color: var(--amber);
  cursor: pointer;
}
.check-field span:nth-child(2) { font-size: 13.5px; color: var(--text); font-weight: 500; }
.check-hint { margin-left: auto; font-size: 11.5px; color: var(--faint); }

/* Segmented control (fuel type) */
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-2 > button { padding: 10px 4px; font-size: 13px; }
.seg-3 > button { padding: 10px 4px; font-size: 12.5px; }
/* Five fuel types don't fit one row at panel width — wrap 3+2, drop the
   inner border where a button now sits on the visual edge of its row. */
.seg-5 { flex-wrap: wrap; }
.seg-5 > button {
  flex: 1 1 33.333%; padding: 9px 3px; font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.seg-5 > button:nth-last-child(-n+2) { border-bottom: none; }
.seg > button {
  flex: 1; padding: 9px 4px;
  background: var(--panel); border: none; border-right: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-family: inherit; cursor: pointer;
  transition: background .12s, color .12s;
}
.seg > button:last-child { border-right: none; }
.seg > button:hover { background: var(--panel-2); color: var(--text); }
.seg > button[aria-pressed="true"] {
  background: var(--amber); color: #14100a; font-weight: 600;
}

/* ── Ledger ─────────────────────────────────────────────────────────────── */
.ledger { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 0;
  font-size: 13.5px;
}
/* `display: flex` above beats the UA sheet's [hidden] rule, so restate it. */
.row[hidden] { display: none; }
.row-label { color: var(--muted); white-space: nowrap; }
.row-lead {
  flex: 1; min-width: 12px;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-3px);
}
.row-val { color: var(--text); white-space: nowrap; }
.row-sub { font-size: 11px; color: var(--faint); padding: 0 0 6px 0; }

/* Intermediate subtotal inside a ledger — a hairline and a little weight, but
   it leaves the amber emphasis to the section total below it. */
.row-sub-total {
  margin-top: 6px; padding-top: 7px;
  border-top: 1px dashed var(--line);
}
.row-sub-total .row-label { color: var(--muted); font-weight: 600; }
.row-sub-total .row-val { color: var(--text); font-weight: 600; }

.row-total {
  margin-top: 7px; padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.row-total .row-label { color: var(--text); font-weight: 600; }
.row-total .row-val { color: var(--amber); font-weight: 700; }

/* ── Running subtotal band ──────────────────────────────────────────────────
   A waypoint between stages, not a stage itself: inset panel, quieter head,
   no stage number. Reuses .ledger rows so the figures stay in the same column. */
.subtotal {
  margin: 0 0 22px;
  padding: 13px 16px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.subtotal-head {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 8px;
}

/* ── Summary rail ───────────────────────────────────────────────────────── */
.rail { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.card-body { padding: 14px 16px; }

/* The one loud element on the page. */
.grand {
  border-color: var(--amber);
  background: linear-gradient(180deg, var(--amber-dim), transparent 60%), var(--panel);
}
.grand-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber);
}
.grand-usd {
  margin-top: 6px;
  font-size: 38px; font-weight: 700; line-height: 1.05;
  color: var(--text-hi);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.grand-uah { margin-top: 3px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grand-split {
  margin-top: 14px; padding-top: 13px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
}

/* Proportion bar — where the money actually goes */
.bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--line-soft); }
.bar > i { display: block; height: 100%; }
.bar-key { display: flex; flex-direction: column; gap: 5px; margin-top: 11px; }
.bar-key > div { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-key i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.bar-key .k-name { color: var(--muted); }
.bar-key .k-pct { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }

.route {
  display: flex; flex-direction: column; gap: 0;
  font-size: 12.5px;
}
.route-leg { display: flex; gap: 10px; }
.route-pin {
  flex-shrink: 0; width: 11px;
  display: flex; flex-direction: column; align-items: center;
}
.route-pin i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--panel); border: 1.5px solid var(--amber);
  margin-top: 5px; flex-shrink: 0;
}
.route-pin s { flex: 1; width: 1px; background: var(--line); border: none; min-height: 9px; }
.route-leg:last-child .route-pin s { display: none; }
.route-txt { padding-bottom: 11px; min-width: 0; }
.route-place { color: var(--text); }
.route-mode { font-size: 11px; color: var(--faint); }

.disclaimer {
  font-size: 11.5px; line-height: 1.55; color: var(--faint);
}
.disclaimer b { color: var(--muted); font-weight: 600; }

.warn {
  display: flex; gap: 9px;
  padding: 11px 13px;
  background: var(--amber-dim);
  border: 1px solid var(--amber); border-radius: 7px;
  font-size: 12.5px; line-height: 1.5; color: var(--text);
}
.warn::before { content: '!'; flex-shrink: 0; font-weight: 700; color: var(--amber); }
.warn[hidden] { display: none; }

/* Editable-assumption disclosure */
details.assump { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
details.assump > summary {
  padding: 11px 15px; cursor: pointer; list-style: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
details.assump > summary::-webkit-details-marker { display: none; }
details.assump > summary::after {
  content: '+'; margin-left: auto; font-size: 15px; color: var(--faint);
}
details.assump[open] > summary::after { content: '−'; }
details.assump > summary:hover { color: var(--text); }
details.assump > div { padding: 4px 15px 15px; border-top: 1px solid var(--line-soft); }

/* Sub-groups inside the editable-rates panel — Rates, Company Rates,
   Surcharges, Delivery. A label plus a hairline, no boxed card: these are
   still one panel, just organized. */
.rate-group { margin-top: 16px; }
.rate-group:first-child { margin-top: 12px; }
.rate-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 10px;
  padding-bottom: 7px; border-bottom: 1px solid var(--line-soft);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
}

@media (max-width: 620px) {
  body { font-size: 14px; }
  .mast { padding: 0 12px; gap: 10px; height: 52px; }
  .mast-tag { display: none; }
  .mast-back span { display: none; }
  .club-badge span { display: none; }
  .club-badge { padding: 4px 6px; }
  .sheet { padding: 18px 13px 60px; gap: 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grand-usd { font-size: 31px; }
  .row { font-size: 13px; }
  .stage-note { display: none; }
}
