:root {
  color-scheme: light;
  --navy: #111b39;
  --panel: #182548;
  --paper: #fff;
  --canvas: #eff3f9;
  --ink: #16213a;
  --muted: #4e5c76;
  --line: #d7dfed;
  --accent: #254bd0;
  --accent-dark: #1939ad;
  --tint: #edf2ff;
  --radius: 16px;
  font: 100%/1.5 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-dark); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #5976ed; outline-offset: 3px; }

.topbar { background: var(--navy); color: white; }
.topbar-inner {
  width: min(1180px, calc(100% - 64px));
  min-height: 64px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: white;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}
.brand-icon {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #a8bcff;
}
.brand-icon::before, .brand-icon::after {
  content: "";
  position: absolute;
  border: 2px solid var(--navy);
}
.brand-icon::before { inset: 10px 6px 7px; border-radius: 3px; }
.brand-icon::after { inset: 5px 10px 4px; background: #a8bcff; }
.internal-note { color: #cad5f4; font-size: .875rem; }
.header-login { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 8px 0; }
.header-login form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.header-login input { min-height: 40px; min-width: 0; width: 165px; max-width: 100%; padding: 7px 9px; border: 1px solid #aab7cf; border-radius: 8px; font-size: .875rem; }
.header-login button { font-size: .875rem; }
.header-login .internal-note { text-align: right; }
.header-login .internal-note:empty { display: none; }

main { width: min(1180px, calc(100% - 64px)); margin: auto; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 32px 0 24px;
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.12; letter-spacing: -.045em; }
.page-heading p { margin-top: 8px; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.primary, .secondary, .text-button {
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
}
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.secondary:hover { border-color: var(--accent); color: var(--accent-dark); }
.text-button { padding-inline: 0; color: var(--accent-dark); background: transparent; }
.text-button:hover { text-decoration: underline; }
.catalog-button { display: flex; align-items: center; gap: 8px; }
#catalog-count { border-radius: 5px; padding: 1px 6px; background: var(--tint); color: var(--accent-dark); font-size: .8125rem; }

.workspace, .results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 4px 16px #111b3909;
}
.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.step-panel { padding: 24px 16px; background: var(--panel); color: white; border-radius: 15px 0 0 15px; }
.step-panel h2 { margin: 0 10px 14px; font-size: .875rem; font-weight: 600; color: #bdccef; }
#steps { display: grid; gap: 5px; }
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #dce5fb;
  font-size: .875rem;
  text-align: left;
}
.step:hover { background: #24345e; }
.step.active { border-color: #6d8cf1; background: #2b3f75; color: white; font-weight: 650; }
.step-index {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  height: 26px;
  border: 1px solid #67799f;
  border-radius: 6px;
  font-size: .8125rem;
}
.step.active .step-index { border-color: #b8c8ff; background: #b8c8ff; color: var(--navy); }
.step.done .step-index { border-color: #79cdb4; color: #b5f4df; }
.question-area { padding: 26px clamp(20px, 4vw, 40px); min-width: 0; }
.progress-label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; color: var(--muted); font-size: .875rem; }
#step-label { color: var(--accent-dark); font-weight: 650; }
.progress-track { height: 4px; margin: 8px 0 24px; border-radius: 4px; background: #e4eaf6; overflow: hidden; }
#progress-bar { height: 100%; border-radius: inherit; background: var(--accent); }
#question h2, .results h2, dialog h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.03em; line-height: 1.2; }
.hint { margin: 8px 0 16px; color: var(--muted); }
.subheading { font-weight: 650; margin: 20px 0 8px; }
.choices, .cards, .catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.choice:hover { border-color: #8297d1; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input { accent-color: var(--accent); width: 17px; height: 17px; margin: 4px 0 0; flex-shrink: 0; }
.choice strong, .choice small { display: block; }
.choice strong { font-size: .9375rem; font-weight: 650; }
.choice small { color: var(--muted); font-size: .875rem; line-height: 1.4; }
.choice.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; margin-top: 20px; border-top: 1px solid var(--line); }
#error { margin-top: 10px; color: #a22232; }
#error:empty { display: none; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.size-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.field { display: grid; gap: 5px; font-size: .9375rem; font-weight: 650; }
select, input[type="number"], input[type="search"], #share-url {
  width: 100%;
  min-height: 42px;
  border: 1px solid #aab7cf;
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
  font-weight: 400;
}
select {
  appearance: none;
  padding-right: 32px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%234e5c76' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
}
.volume-box { max-width: 420px; padding: 16px; border-radius: 10px; background: var(--tint); }
.volume-box input { font-size: 1.25rem; margin: 6px 0 12px; }
.chips, .summary, .tags, .ports { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 36px;
  padding: 4px 9px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: .875rem;
}
.chip:hover, .chip:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.chip input { margin: 0; accent-color: var(--accent); }

.results { margin-top: 20px; padding: clamp(16px, 4vw, 32px); scroll-margin-top: 16px; }
.result-header, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-actions, .share-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.result-actions { flex-shrink: 0; }
.share-controls { margin-bottom: 10px; font-size: .9375rem; }
.share-feedback > :not([hidden]) { margin-bottom: 12px; }
.share-choice { display: flex; gap: 8px; align-items: center; align-self: flex-start; margin: 0 0 10px; font-size: .875rem; cursor: pointer; }
.share-choice input { flex: 0 0 auto; margin: 0; }
#share-results:disabled { opacity: .55; cursor: default; }
.summary { margin: 14px 0 18px; }
.summary span, .tag {
  display: inline-block;
  border-radius: 5px;
  padding: 3px 7px;
  background: var(--tint);
  color: #234078;
  font-size: .8125rem;
}
.cards, .catalog-grid { gap: 14px; }
.device {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 17px;
  background: var(--paper);
  min-width: 0;
}
.maker { font-size: .8125rem; color: var(--muted); font-weight: 650; }
.device h3 { margin: 2px 0 8px; font-size: 1.2rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.product-photo { display: block; width: 100%; height: 120px; object-fit: contain; margin: 6px 0 10px; }
.device dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; width: 100%; margin: 12px 0; font-size: .875rem; }
.device dt { color: var(--muted); }
.device dd { margin: 0; text-align: right; }
.speed-condition { display: block; color: var(--muted); }
.ports { color: var(--muted); font-size: .875rem; margin-bottom: 10px; }
.device a { margin-top: auto; font-size: .875rem; font-weight: 650; text-underline-offset: 3px; }
.device .itscope-product-link { display: inline-flex; align-items: center; margin-top: 0; text-decoration: none; }
.notice, .match, .mismatch { border-radius: 7px; padding: 8px 10px; font-size: .875rem; }
.notice { margin-top: 10px; background: #f0f3f9; color: #293854; }
.match { background: #e4f6ef; color: #154f3e; }
.mismatch { background: #fff0e2; color: #863b19; }
.device .notice, .device .match, .device .mismatch { margin: 0 0 10px; }
.results > h3, .results details { margin-top: 20px; }
.results summary { cursor: pointer; font-weight: 650; margin-bottom: 10px; }
#edit-answers { margin-top: 4px; }
dialog {
  width: min(900px, calc(100% - 24px));
  max-height: 90vh;
  padding: clamp(16px, 4vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}
dialog::backdrop { background: #111b39a8; }
.close { min-width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--tint); color: var(--ink); font-size: 1.4rem; }
.catalog-search { margin: 16px 0 8px; }
.catalog-filter { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 38px; font-size: .9375rem; cursor: pointer; }
.catalog-filter input { accent-color: var(--accent); }
#catalog-status, .catalog-note { color: var(--muted); font-size: .875rem; }
.catalog-note { margin-bottom: 12px; }
.data-note { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 16px 0 24px; color: var(--muted); font-size: .8125rem; }
.device .supplies { width: 100%; margin: 4px 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.device .supplies summary { margin: 0; cursor: pointer; font-size: .9375rem; font-weight: 650; }
.supplies-note { margin-top: 8px; color: var(--muted); font-size: .8125rem; }
.supplies-table { overflow-x: auto; }
.supplies-table table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: .8125rem; text-align: left; overflow-wrap: anywhere; }
.supplies-table caption { text-align: left; font-weight: 700; padding: 2px 6px; }
.supplies-table th, .supplies-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.supplies-table th { font-weight: 650; }
.supplies-links { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 9px; }
.device .supplies-links a { margin: 0; font-size: .8125rem; }
.price-check { width: 100%; margin: 6px 0 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.price-check button { font-size: .875rem; }
.price-check button:disabled { opacity: .65; cursor: wait; }
.price-status, .price-offers { font-size: .875rem; color: var(--muted); }
.price-status:not(:empty), .price-offers p, .price-offers label { margin-top: 8px; }
.price-table-scroll { overflow-x: auto; }
.price-offers table { width: 100%; margin-top: 8px; border-collapse: collapse; text-align: left; }
.price-offers th, .price-offers td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.price-offers th { color: var(--ink); }
.price-offers small { display: block; }

@media (max-width: 760px) {
  .topbar-inner, main { width: calc(100% - 32px); }
  .page-heading { padding: 20px 0 16px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .step-panel { border-radius: 15px 15px 0 0; padding: 10px; }
  .step-panel h2, .step-name { display: none; }
  #steps { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .step { justify-content: center; padding: 4px 0; }
  .question-area { padding: 16px; }
  .cards, .catalog-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .topbar-inner { flex-wrap: wrap; gap: 0 12px; padding-block: 8px; }
  .header-login { align-items: flex-start; }
  .header-login form { justify-content: flex-start; }
  .header-login .internal-note { text-align: left; }
  .choices, .fields { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; align-items: flex-start; }
  .device { padding: 12px; }
}
@media print {
  .itscope-product-link { display: none !important; }
  .results .device .supplies[open] { display: block !important; }
  .price-check { display: none !important; }
  .topbar, .page-heading, .workspace, .data-note, .result-header button, #edit-answers, .results details, dialog { display: none !important; }
  .share-controls, .share-feedback, .share-choice, #show-all-results { display: none !important; }
  body, main { background: white; width: auto; }
  .results { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .cards { display: block; }
  .device { display: block; break-inside: avoid; margin: 0 0 12px; }
  .product-photo { height: 75px; }
}
