:root { color-scheme: light; font-family: Inter, "Hiragino Sans", "Yu Gothic UI", sans-serif; color: #172554; background: #f6f7f9; }
* { box-sizing: border-box; }
body { margin: 0; background: #f6f7f9; overflow-x: hidden; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f6f7f9; }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(100%, 420px); padding: 32px; border: 1px solid #e4e8ef; border-radius: 14px; background: #fff; box-shadow: 0 12px 32px rgba(23,37,84,.09); }
.auth-card h1 { margin: 26px 0 8px; font-size: 24px; }
.auth-card p { color: #64748b; line-height: 1.6; font-size: 14px; }
.auth-card label { display: grid; gap: 7px; margin: 22px 0 16px; color: #334155; font-size: 14px; font-weight: 700; }
.auth-card input { width: 100%; height: 46px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 12px; color: #172554; outline-color: #172554; }
.auth-card .refresh { width: 100%; }
.text-button { display: block; width: 100%; margin-top: 12px; border: 0; background: transparent; color: #475569; cursor: pointer; font-size: 13px; }
.auth-message { min-height: 22px; margin: 12px 0 0 !important; color: #b91c1c !important; }
button, input { font: inherit; }
.app-shell { width: min(1420px, calc(100% - 32px)); margin: 32px auto; }
.topbar, .controls, .comparison-wrap { background: #fff; border: 1px solid #e4e8ef; box-shadow: 0 8px 30px rgba(23,37,84,.06); }
.topbar { min-height: 76px; display: flex; align-items: center; gap: 24px; padding: 16px 22px; border-radius: 14px 14px 0 0; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.brand span { font-weight: 500; }
.status { margin-left: auto; display: flex; gap: 18px; color: #64748b; font-size: 13px; }
.status span + span { padding-left: 18px; border-left: 1px solid #dbe2ea; }
.refresh { border: 0; background: #172554; color: #fff; padding: 11px 16px; border-radius: 8px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.refresh:disabled { opacity: .65; cursor: progress; }
.refresh-caution { margin: 0; padding: 7px 22px 0; background: #fff; border-left: 1px solid #e4e8ef; border-right: 1px solid #e4e8ef; color: #7c8798; font-size: 11px; line-height: 1.45; }
.controls { position: relative; padding: 22px; border-top: 0; }
.price-alert { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 13px 22px; border: 1px solid #f59e0b; background: #fffbeb; color: #92400e; }
.price-alert[hidden] { display: none !important; }
.price-alert strong { margin-right: 10px; }
.price-alert span { font-size: 13px; }
.price-alert button { border: 1px solid #d97706; border-radius: 7px; background: #fff; color: #92400e; padding: 7px 10px; cursor: pointer; white-space: nowrap; }
.selection-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-width: 0; }
.selection-toolbar > div { min-width: 0; }
.selection-toolbar strong { font-size: 15px; }
.selection-toolbar span { margin-left: 10px; color: #64748b; font-size: 12px; }
.selection-toolbar button { border: 1px solid #172554; border-radius: 8px; background: #172554; color: #fff; padding: 8px 12px; font-weight: 700; cursor: pointer; }
.product-dialog { width: min(760px, calc(100% - 32px)); max-height: min(720px, calc(100% - 32px)); border: 0; border-radius: 14px; padding: 0; color: #172554; box-shadow: 0 24px 70px rgba(15,23,42,.28); }
.product-dialog::backdrop { background: rgba(15,23,42,.38); }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #e4e8ef; background: #fff; }
.dialog-header strong { display: block; font-size: 17px; }
.dialog-header span { color: #64748b; font-size: 12px; }
.dialog-header button { border: 0; border-radius: 7px; background: #f1f5f9; color: #475569; width: 32px; height: 32px; cursor: pointer; font-size: 20px; }
.model-picker { display: grid; gap: 10px; }
.product-dialog .model-picker { padding: 20px; }
.picker-group { display: flex; align-items: center; gap: 14px; }
.picker-group > span { flex: 0 0 128px; font-weight: 750; color: #172554; }
.picker-group > div { display: flex; flex-wrap: wrap; gap: 7px; }
.picker-group button { border: 1px solid #dbe2ea; border-radius: 20px; padding: 7px 12px; color: #334155; background: #fff; cursor: pointer; }
.picker-group button:hover:not(:disabled) { border-color: #172554; background: #eef4ff; }
.picker-group button:disabled { color: #94a3b8; background: #f8fafc; cursor: default; }
.selected { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip { border: 1px solid #dbe2ea; background: #f8fafc; color: #334155; border-radius: 20px; padding: 7px 10px; font-size: 13px; }
.chip button { border: 0; background: transparent; color: #64748b; cursor: pointer; padding: 0 0 0 7px; font-size: 15px; }
.comparison-wrap { overflow-x: auto; border-radius: 0 0 14px 14px; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
table { border-collapse: separate; border-spacing: 0; min-width: 840px; width: 100%; }
th, td { border-right: 1px solid #e4e8ef; border-bottom: 1px solid #e4e8ef; padding: 16px; text-align: center; background: #fff; }
thead th { vertical-align: top; background: #fbfcfe; font-size: 14px; min-width: 250px; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 2; min-width: 145px; text-align: left; font-weight: 700; }
thead th:first-child { z-index: 4; text-align: center; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
.model { display: flex; justify-content: center; gap: 4px; align-items: center; line-height: 1.35; }
.remove { border: 0; background: transparent; color: #94a3b8; cursor: pointer; font-size: 16px; }
.swatches { display: flex; justify-content: center; gap: 9px; margin-top: 14px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(15,23,42,.18); cursor: pointer; position: relative; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid #172554; outline-offset: 3px; }
.swatch[aria-pressed="true"]::after { content: "✓"; font-size: 11px; color: #172554; position: absolute; inset: 3px; display: grid; place-items: center; border-radius: 50%; background: #fff; }
.price { font-weight: 750; font-size: 18px; color: #172554; }
.winner { background: #f0fdf4; box-shadow: inset 0 0 0 1px #22a45d; color: #15803d; }
.winner .price::after { content: "♛"; margin-left: 7px; font-size: 15px; }
.unavailable { color: #94a3b8; }
.empty { padding: 48px; color: #64748b; text-align: center; }
.notice { margin: 12px 4px; font-size: 12px; color: #64748b; }
@media (max-width: 720px) {
  .app-shell { width: 100%; margin: 0; }
  .topbar { border-radius: 0; padding: 16px; flex-wrap: wrap; gap: 12px; }
  .brand { font-size: 18px; }
  .status { order: 3; margin: 0; width: 100%; gap: 8px; flex-direction: column; }
  .status span + span { padding: 0; border: 0; }
  .refresh { margin-left: auto; padding: 9px 12px; font-size: 13px; }
  .refresh-caution { padding: 7px 16px 0; font-size: 10px; }
  .controls { padding: 16px; }
  .price-alert { padding: 12px 16px; align-items: flex-start; }
  .price-alert span { display: block; margin-top: 4px; }
  /* Keep the add action visible on every iPhone width.  The old one-line
     toolbar pushed the button beyond the right edge on Pro Max screens. */
  .selection-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
  .selection-toolbar strong { display: block; }
  .selection-toolbar span { display: block; margin: 4px 0 0; }
  .selection-toolbar button { min-height: 44px; padding: 10px 13px; font-size: 14px; }
  .selected { flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 5px; margin: 14px -2px 0; scrollbar-width: none; }
  .selected::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; white-space: nowrap; }
  .product-dialog { width: 100%; max-width: none; max-height: min(82dvh, 760px); margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .product-dialog::backdrop { background: rgba(15,23,42,.48); }
  .dialog-header { padding: 16px; }
  .product-dialog .model-picker { padding: 14px 16px 28px; }
  .picker-group > div { width: 100%; }
  .picker-group button { min-height: 42px; }
  .picker-group { align-items: flex-start; flex-direction: column; gap: 6px; }
  .picker-group > span { flex-basis: auto; }
  .comparison-wrap { border-radius: 0; scroll-snap-type: x proximity; }
  table { min-width: 650px; }
  th, td { padding: 13px 9px; }
  thead th { min-width: 150px; font-size: 13px; }
  th:first-child, td:first-child { min-width: 96px; font-size: 13px; }
  thead th:not(:first-child), tbody td:not(:first-child) { scroll-snap-align: start; }
  .model { font-size: 13px; }
  .swatches { gap: 8px; margin-top: 12px; }
  .swatch { width: 20px; height: 20px; }
  .price { font-size: 16px; white-space: nowrap; }
  .notice { padding: 0 16px; }
}
