:root {
  --ink: #16213c;
  --muted: #5d6880;
  --line: #d9dfeb;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --accent: #3159b8;
  --accent-dark: #23438e;
  --soft: #e8eefc;
  --notice: #fff8e8;
  --focus: #7b4bdb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, input, select { min-height: 44px; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 10; padding: .75rem 1rem; background: var(--surface); }
.skip-link:focus { top: 1rem; }
.site-header, main { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; gap: 2rem; align-items: end; padding: 3rem 0 1.5rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .5rem; font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.04em; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: 1rem; margin-top: 1.5rem; }
.lead, .hint, .query-caption, .disclaimer { color: var(--muted); }
.lead { margin-bottom: 0; max-width: 680px; font-size: 1.08rem; }
.eyebrow, .step { color: var(--accent-dark); font-size: .75rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.panel { margin-bottom: 1rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 28px rgba(22, 33, 60, .055); }
.search-panel { display: grid; grid-template-columns: minmax(180px, .6fr) minmax(0, 1.4fr); gap: clamp(1.5rem, 5vw, 5rem); }
label, legend { display: block; font-weight: 650; }
input:not([type="radio"]), select { width: 100%; margin-top: .45rem; padding: .7rem .8rem; border: 1px solid #9da8bc; border-radius: 9px; background: var(--surface); color: var(--ink); }
fieldset { margin: 1.5rem 0; padding: 0; border: 0; }
legend { margin-bottom: .65rem; }
.choice { display: flex; gap: .6rem; align-items: center; margin: .45rem 0; font-weight: 500; }
.choice input { width: 20px; height: 20px; }
.field-heading, .section-heading, .dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.class-picker, .class-map { display: grid; grid-template-columns: repeat(9, minmax(54px, 1fr)); gap: .45rem; }
.class-toggle, .class-card { min-height: 50px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 700; }
.class-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
.class-card { display: grid; place-items: center; gap: .1rem; padding: .4rem; }
.class-card small { color: var(--muted); font-weight: 500; }
.class-card.has-results { border-width: 2px; border-color: var(--accent); }
.goods-heading { margin-top: 1.5rem; }
.goods-row { display: grid; grid-template-columns: 1fr 110px 44px; gap: .6rem; align-items: end; margin-top: .75rem; }
.primary, .secondary, .link-button, .icon-button { border-radius: 9px; font-weight: 700; }
.primary { padding: .75rem 1.15rem; border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { padding: .65rem .9rem; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-dark); }
.link-button { padding: .3rem; border: 0; background: transparent; color: var(--accent-dark); text-decoration: underline; }
.icon-button { width: 44px; border: 1px solid var(--line); background: var(--surface); font-size: 1.4rem; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; }
.form-actions .disclaimer { margin: 0; font-size: .85rem; }
.status-panel { text-align: center; }
.status-panel p { margin: .4rem 0 0; }
.spinner { display: inline-block; width: 1rem; height: 1rem; margin-right: .6rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-hero { display: flex; justify-content: space-between; gap: 2rem; align-items: center; }
.result-hero h2 { margin-bottom: .35rem; }
.coverage-badge { min-width: 230px; padding: .9rem 1rem; border: 2px solid var(--ink); border-radius: 12px; }
.coverage-badge span, .coverage-badge small { display: block; }
.coverage-badge span { font-weight: 800; }
.coverage-badge small { margin-top: .2rem; color: var(--muted); }
.notice { margin-bottom: 1rem; padding: 1rem 1.25rem; border: 1px solid #caa959; border-radius: 12px; background: var(--notice); }
.notice p { margin: .25rem 0 0; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.coverage-list, .facts { display: grid; grid-template-columns: minmax(150px, 1fr) auto; gap: .65rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 650; text-align: right; }
.plain-list { padding-left: 1.2rem; }
.matches-list { display: grid; gap: .75rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.match-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.rank { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft); font-weight: 800; }
.match-card h3 { margin: 0 0 .25rem; font-size: 1.15rem; overflow-wrap: anywhere; }
.match-meta { margin: 0; color: var(--muted); }
.match-card .secondary { white-space: nowrap; }
.empty-state { padding: 2rem; border: 1px dashed #9da8bc; border-radius: 12px; text-align: center; }
.empty-state p { margin: .4rem 0 0; color: var(--muted); }
dialog { width: min(760px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 1.5rem; border: 0; border-radius: 18px; color: var(--ink); }
dialog::backdrop { background: rgba(22, 33, 60, .52); }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.metric { padding: .9rem; border: 1px solid var(--line); border-radius: 10px; }
.metric strong, .metric span { display: block; }
.metric span { margin-top: .25rem; color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) {
  .site-header { align-items: start; padding-top: 2rem; }
  .search-panel, .result-grid { grid-template-columns: 1fr; }
  .class-picker, .class-map { grid-template-columns: repeat(5, 1fr); }
  .result-hero, .section-heading { align-items: stretch; flex-direction: column; }
  .coverage-badge { min-width: 0; }
  .match-card { grid-template-columns: 44px minmax(0, 1fr); }
  .match-card .secondary { grid-column: 1 / -1; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
@media (max-width: 460px) {
  .site-header { flex-direction: column; }
  .goods-row { grid-template-columns: 1fr 86px 44px; }
  .class-picker, .class-map { grid-template-columns: repeat(3, 1fr); }
  .metrics { grid-template-columns: 1fr; }
}
@media print {
  :root { background: #fff; }
  body { font-size: 10.5pt; }
  .site-header, main { width: 100%; }
  .site-header { padding-top: 0; }
  .search-panel, .print-only-control, dialog { display: none !important; }
  .panel { box-shadow: none; break-inside: avoid; }
  .matches-list { break-inside: auto; }
  .match-card { break-inside: avoid; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
