/* Tariff Preflight — the checking page. */

.tool section { padding: 44px 0; }
.tool-top { padding: 40px 0 26px; }
.tool-top h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin-bottom: 6px; }
.tool-top .lede { margin-bottom: 22px; }

/* Intake */
.intake { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: stretch; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 230px; padding: 26px; background: var(--card); border: 2px dashed var(--line-2); border-radius: 14px; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.drop:hover, .drop.is-over { border-color: var(--green); background: var(--green-wash); }
.drop.is-busy { cursor: progress; opacity: 0.7; }
.drop p { margin: 0; }
.drop-main { font-size: 1.12rem; margin-top: 8px !important; }
.linkish { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.ico-line { fill: none; stroke: var(--green); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.intake-side { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; }
.intake-side h2 { font-size: 1.15rem; margin-bottom: 10px; }
.kinds { list-style: none; padding: 0; margin: 0 0 18px; }
.kinds li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.95rem; color: var(--ink-2); }
.kinds li:first-child { border-top: 0; padding-top: 0; }
.kinds b { color: var(--ink); }

.paste-box { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.paste-box label { display: block; font-weight: 600; margin-bottom: 8px; }
.paste-box textarea, .options textarea { width: 100%; font: 0.95rem/1.5 var(--mono); padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; color: var(--ink); resize: vertical; margin-bottom: 12px; }

.options { margin-top: 16px; font-size: 0.95rem; }
.options summary { cursor: pointer; color: var(--ink-2); font-weight: 600; width: fit-content; }
.options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 12px; }
.options-grid label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.options-grid label.wide { grid-column: 1 / -1; }
.options-grid input, .options-grid select { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
.options-grid .fine { font-weight: 400; }
.options textarea { margin-bottom: 0; font-weight: 400; }

.status { min-height: 1.5em; margin: 16px 0 0; color: var(--ink-3); font-size: 0.93rem; }
.alert { background: var(--red-wash); border: 1px solid #ebc4bf; color: #6f1f1a; border-radius: var(--radius); padding: 14px 18px; margin-top: 14px; }

/* Results */
.results { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-top: 36px !important; }
.res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.res-head h2 { margin-bottom: 4px; font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
.res-head .sub { color: var(--ink-3); margin: 0; font-size: 0.95rem; }
.res-block { margin-top: 34px; }
.res-block > h3 { font-size: 1.25rem; margin-bottom: 6px; }
.res-block > .sub { color: var(--ink-2); margin-bottom: 14px; max-width: 52em; }

.banner { border-radius: var(--radius); padding: 14px 18px; margin: 0 0 16px; border: 1px solid; }
.banner p { margin: 0 0 6px; }
.banner p:last-child { margin-bottom: 0; }
.banner.sample { background: var(--violet-wash); border-color: #d5cdee; color: #3e3273; }
.banner.urgent { background: var(--amber-wash); border-color: #efd9ac; color: #6b3c05; }
.banner.pass { background: var(--green-wash); border-color: #c8e2d9; color: #0b4a3c; }
.banner.fail { background: var(--red-wash); border-color: #ebc4bf; color: #6f1f1a; }
.banner.info { background: var(--slate-wash); border-color: #d5dbe1; color: #33414e; }
.banner b.big { display: block; font: 600 1.2rem/1.3 var(--serif); margin-bottom: 4px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 4px solid var(--line-2); }
.tile .k { font: 600 0.74rem/1.2 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.tile .v { font: 600 1.9rem/1.1 var(--serif); letter-spacing: -0.02em; }
.tile .d { color: var(--ink-2); font-size: 0.9rem; margin-top: 6px; }
.tile.lead { background: #14232c; border-color: #14232c; color: #fff; }
.tile.lead .k { color: #9fb0b8; }
.tile.lead .d { color: #c3ced3; }
.tile.cape { border-top-color: var(--green); }
.tile.protest { border-top-color: #d28a1a; }
.tile.court { border-top-color: var(--red); }
.tile.ok { border-top-color: var(--green); }
.tile.bad { border-top-color: var(--red); }
.tile.wait { border-top-color: var(--slate); }

/* Route chips and the entries table */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { font: 600 0.88rem/1 var(--sans); padding: 9px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-weight: 400; opacity: 0.8; }
.route-blurb { color: var(--ink-2); font-size: 0.95rem; margin: 0 0 12px; max-width: 60em; }
.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table-tools input[type="search"] { font: inherit; font-size: 0.93rem; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; min-width: 240px; background: #fff; color: var(--ink); }
.pager { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-3); }
.pager button { font: 600 0.85rem/1 var(--sans); padding: 8px 11px; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; }
.pager button[disabled] { opacity: 0.4; cursor: default; }

table.entries { width: 100%; border-collapse: collapse; font-size: 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
table.entries th, table.entries td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.entries thead th { font: 600 0.74rem/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: #f5f2eb; white-space: nowrap; }
table.entries thead th button { all: unset; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
table.entries thead th button:hover { color: var(--ink); }
table.entries thead th button:focus-visible { outline: 3px solid #f0a431; outline-offset: 2px; border-radius: 3px; }
table.entries thead th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 0.7em; }
table.entries thead th[aria-sort="descending"] button::after { content: " ▼"; font-size: 0.7em; }
table.entries tbody tr:last-child td { border-bottom: 0; }
table.entries td.num, table.entries th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.entries td.entry { font-family: var(--mono); white-space: nowrap; }
table.entries td.notes { color: var(--ink-2); font-size: 0.86rem; min-width: 16em; max-width: 30em; }
table.entries td.notes p { margin: 0 0 5px; }
table.entries td.notes p:last-child { margin-bottom: 0; }
table.entries tr.is-urgent td.days { color: var(--red); font-weight: 700; }
.kind { display: block; font-size: 0.74rem; color: var(--ink-3); }
.empty { padding: 26px; text-align: center; color: var(--ink-3); }

.rp { display: inline-block; font: 600 0.74rem/1 var(--sans); padding: 5px 8px; border-radius: 5px; white-space: nowrap; background: var(--slate-wash); color: var(--slate); }
.rp.cape { background: var(--green-wash); color: var(--green); }
.rp.protest { background: var(--amber-wash); color: var(--amber); }
.rp.court { background: var(--red-wash); color: var(--red); }
.rp.hold { background: var(--violet-wash); color: var(--violet); }
.rp.verify { background: var(--red-wash); color: var(--red); }

/* Downloads */
.downloads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.dl b { display: block; font-size: 0.98rem; }
.dl .what { color: var(--ink-2); font-size: 0.88rem; }
.dl .name { font: 0.8rem/1.4 var(--mono); color: var(--ink-3); word-break: break-all; }
.dl.is-main { border-color: var(--green); background: var(--green-wash); }
.btn.is-locked::before { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3.5 5V3.5a2.5 2.5 0 0 1 5 0V5H9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h.5Zm1.2 0h2.6V3.5a1.3 1.3 0 0 0-2.6 0V5Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3.5 5V3.5a2.5 2.5 0 0 1 5 0V5H9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h.5Zm1.2 0h2.6V3.5a1.3 1.3 0 0 0-2.6 0V5Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.dl .btn.is-locked { opacity: 1; cursor: pointer; }
.unlock { background: var(--amber-wash); border: 1px solid #efd9ac; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; }
.unlock p { margin: 0 0 10px; }
.unlock p:last-child { margin-bottom: 0; }

/* Findings (list check) */
.findings { display: grid; gap: 10px; }
.finding { display: grid; grid-template-columns: 124px 1fr; gap: 14px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; }
.finding p { margin: 0; }
.finding .more { font-size: 0.86rem; margin-top: 5px; }
.sev { font: 600 0.72rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 8px; border-radius: 5px; text-align: center; }
.sev.block { background: var(--red-wash); color: var(--red); }
.sev.fix { background: var(--green-wash); color: var(--green); }
.sev.warn { background: var(--amber-wash); color: var(--amber); }
.sev.note { background: var(--slate-wash); color: var(--slate); }

/* Groups (CBP result files) */
.groups { display: grid; gap: 14px; }
.group { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.group-head .cbp { font: 600 1rem/1.4 var(--mono); }
.group-head .count { color: var(--ink-3); font-size: 0.9rem; white-space: nowrap; }
.group p { margin: 0 0 8px; }
.group .label { font: 600 0.72rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); display: block; margin: 10px 0 4px; }
.group details { margin-top: 8px; font-size: 0.9rem; }
.group details summary { cursor: pointer; color: var(--green); font-weight: 600; }
.entry-cloud { font: 0.84rem/1.9 var(--mono); color: var(--ink-2); margin-top: 6px; word-spacing: 0.7em; }
.next { display: inline-block; font: 600 0.75rem/1 var(--sans); padding: 6px 9px; border-radius: 999px; white-space: nowrap; background: var(--slate-wash); color: var(--slate); }
.next.retry { background: var(--green-wash); color: var(--green); }
.next.wait { background: var(--amber-wash); color: var(--amber); }
.next.fix { background: var(--violet-wash); color: var(--violet); }
.next.route, .next.drop { background: var(--red-wash); color: var(--red); }

/* Column mapping, small tables, lists */
details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 0 18px; margin-top: 12px; }
details.fold > summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
details.fold[open] { padding-bottom: 16px; }
details.fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
table.map { width: 100%; border-collapse: collapse; font-size: 0.92rem; table-layout: fixed; }
table.map select { width: 100%; }
table.map th, table.map td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.map th { font: 600 0.74rem/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
table.map select, .map-tools input { font: inherit; font-size: 0.9rem; padding: 6px 9px; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; color: var(--ink); max-width: 100%; }
table.map .req { color: var(--red); font-size: 0.8rem; }
table.map .missing { color: var(--ink-3); }
.map-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.map-tools input { width: 5em; }
ul.plain-list { margin: 0; padding-left: 1.2em; }
ul.plain-list li { margin-bottom: 8px; color: var(--ink-2); }
ol.steps { margin: 0; padding-left: 1.3em; }
ol.steps li { margin-bottom: 10px; }
ol.steps li b { color: var(--ink); }
.toggle { display: flex; align-items: flex-start; gap: 9px; font-size: 0.93rem; color: var(--ink-2); margin: 10px 0 0; }
.toggle input { margin-top: 5px; }

/* Decoder and license */
#decoder h2, #license h2 { font-size: 1.4rem; }
#decode-out { margin: 14px 0; }
.decoded { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; }
.decoded .cbp { font: 600 1rem/1.4 var(--mono); margin-bottom: 8px; }
.decoded p { margin: 0 0 8px; }
.decoded p:last-child { margin-bottom: 0; }
.license-ok { color: var(--green); font-weight: 600; }

@media (max-width: 900px) {
  .intake, .downloads, .options-grid { grid-template-columns: 1fr; }
  .tiles, .tiles.three { grid-template-columns: 1fr 1fr; }
  .finding { grid-template-columns: 1fr; }
  .table-scroll { overflow-x: auto; }
  table.entries { min-width: 760px; }
}
@media (max-width: 520px) {
  .tiles, .tiles.three { grid-template-columns: 1fr; }
}

@media print {
  .tool-top, #decoder, #license, .chips, .table-tools, .unlock, .dl .btn, details.fold:not([open]), .res-head .btn-row { display: none !important; }
  .results { border: 0; padding-top: 0 !important; background: #fff; }
  .tile, .dl, .group, .finding { break-inside: avoid; }
  table.entries { font-size: 8.5pt; }
  table.entries td.notes { max-width: none; }
}
