/* Shared styles for the static site: list page (filter rail over a dense card grid,
   compare tray docked at the bottom), product pages (sticky left column with name,
   images and price box; diagram and grouped specs on the right) and the compare page. */
:root {
  --bg: #f3f5f8; --surface: #ffffff; --ink: #18202c; --muted: #5d6879; --line: #d9dee7;
  --accent: #2f4fd1; --accent-ink: #ffffff; --price: #b35a00; --good: #1f7a4d; --warn: #a1361f;
  --chip: #e7ebf3; --diff: #fff3d6; --media: #eef1f6; --screen: #1c2433; --screen-ink: #dfe6ff; --dim: #2f4fd1;
  --f-display: "Chakra Petch", "IBM Plex Sans Thai", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151c; --surface: #19202b; --ink: #e7ebf2; --muted: #9aa5b6; --line: #2b3442;
  --accent: #8ea2ff; --accent-ink: #0d1220; --price: #f2a54a; --good: #5fd39a; --warn: #ff8a70;
  --chip: #232c3a; --diff: #3a3220; --media: #e9edf3; --screen: #0b0f17; --screen-ink: #cfd8ff; --dim: #8ea2ff; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #19202b; --ink: #e7ebf2; --muted: #9aa5b6; --line: #2b3442;
  --accent: #8ea2ff; --accent-ink: #0d1220; --price: #f2a54a; --good: #5fd39a; --warn: #ff8a70;
  --chip: #232c3a; --diff: #3a3220; --media: #e9edf3; --screen: #0b0f17; --screen-ink: #cfd8ff; --dim: #8ea2ff; color-scheme: dark }
* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--f-body); margin: 0 }
a { color: var(--accent) }
.wrap { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 120px }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg) }
button { font: inherit; cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

/* site bar */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-block: 4px 12px }
.logo { font: 600 1.05rem var(--f-display); color: var(--ink); text-decoration: none; letter-spacing: .02em }
.logo span { color: var(--accent) }
.logo:has(.logo-mark) { display: inline-flex; align-items: center; gap: 6px }
.logo-mark { display: block; flex: none }
.crumb { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px }
.crumb a { color: var(--muted) }
.crumb li { list-style: none } .crumb ol { display: contents }
.crumb li + li::before { content: "›"; margin-right: 4px }

/* list page */
header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px }
h1 { font: 600 clamp(1.6rem, 3vw, 2.2rem)/1.15 var(--f-display); margin: 0; letter-spacing: .01em; text-wrap: balance }
.sub { color: var(--muted); margin: 4px 0 0; max-width: 65ch }
.stamp { font: 12px/1.4 var(--f-data); color: var(--muted); text-align: right }
.filters { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
input[type=search], input[type=number], select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0 }
input[type=search] { flex: 1 1 260px }
input[type=number] { width: 7.5em; font-family: var(--f-data) }
label.tog { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; cursor: pointer }
.chip { font: 500 13px/1 var(--f-body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 12px; cursor: pointer; text-decoration: none; white-space: nowrap }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.chip .n { font-family: var(--f-data); opacity: .7; margin-left: 4px }
.count { font: 13px var(--f-data); color: var(--muted) }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-top: 16px }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); overflow: hidden; min-width: 0 }
.allmodels { margin-top: 28px; font-size: 13px }
.allmodels summary { cursor: pointer; color: var(--muted) }
.allmodels h3 { font: 600 .95rem var(--f-display); margin: 14px 0 6px }
.allmodels ul { columns: 18rem; margin: 0; padding-left: 1.1em }
.allmodels li { break-inside: avoid; overflow-wrap: anywhere }

/* media: carousel stage + spec rail (rail floats over the right side of the stage) */
.media { position: relative; height: 176px; background: var(--media); overflow: hidden }
.media.norail .stage { right: 0 } .media.norail .nav.next { right: 6px } .media.norail .dots { right: 0 }
.stage { position: absolute; inset: 0 112px 0 0; display: grid; place-items: center; color: inherit; text-decoration: none }
.stage img, .stage .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px; display: block }
.stage .ph { font: 600 1.6rem var(--f-display); color: #6b7487 }
.rail { position: absolute; top: 0; right: 0; bottom: 0; width: 112px; padding: 6px 10px 6px 4px; display: grid; align-content: center; gap: 3px; color: #1e2635 }
.spec { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: center; font: 500 11px/1.2 var(--f-body); min-width: 0 }
.spec svg { width: 16px; height: 16px; stroke: #2f4fd1; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round }
.spec span { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 999px; border: 1px solid #c9d0dc; background: #ffffffd9; color: #1e2635; display: grid; place-items: center; font-size: 15px; line-height: 1; z-index: 2; padding: 0 }
.nav.prev { left: 6px } .nav.next { right: 118px }
.dots { position: absolute; left: 0; right: 112px; bottom: 6px; display: flex; justify-content: center; gap: 4px }
.dots i { width: 6px; height: 6px; border-radius: 999px; background: #b7bfcc } .dots i.on { background: #2f4fd1 }
.slidetag { position: absolute; left: 8px; top: 8px; font: 500 10.5px/1 var(--f-body); background: #ffffffd9; color: #3d4657; padding: 4px 6px; border-radius: 4px; z-index: 1 }

.body { padding: 10px 14px; display: grid; gap: 4px; align-content: start; min-width: 0 }
.brand { font: 500 11px/1.3 var(--f-data); letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.name { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; color: var(--ink); text-decoration: none }
a.name:hover { color: var(--accent) }
.sku { font: 12px var(--f-data); color: var(--muted); overflow-wrap: anywhere }
.card .meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px }
.card .meta .sku { font-size: 11px; text-align: right }
/* price tooltip ("ข้อมูล ณ วันที่"): hover on desktop, tap/focus on touch */
.tip-host { position: relative; cursor: help; text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 4px }
/* the hidden tooltip takes no layout box (display: none), so one near the right edge of a line never widens the page */
.tip-host::after { content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 6px); white-space: nowrap; font: 400 12px/1.3 var(--f-body); color: var(--accent-ink); background: var(--ink); padding: 5px 8px; border-radius: 6px; pointer-events: none; z-index: 3; display: none }
.tip-host:hover::after, .tip-host:focus-visible::after, .tip-host:focus::after { display: block }
.sub .tip-host { white-space: nowrap }
.tip-host:focus { outline: none }
.tip-host.tip-r::after { left: auto; right: 0 }  /* right-aligned prices: the tooltip opens to the left */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line) }
.pricebox { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center }
.asof { font-size: 12px; color: var(--muted) }
.price { font: 600 1.05rem var(--f-data); color: var(--price); font-variant-numeric: tabular-nums }
.price.none { color: var(--muted); font-weight: 400; font-size: 13px; font-family: var(--f-body) }
.pill { font: 500 11px/1 var(--f-body); padding: 4px 7px; border-radius: 999px; background: var(--chip); color: var(--muted) }
.pill.ok { color: var(--good) } .pill.warn { color: var(--warn) }
.lastp { font: 12.5px var(--f-body); color: var(--muted) }
.lastp .mono { color: var(--ink) }
.actions { display: flex; flex-wrap: wrap; gap: 6px }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 6px 10px; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent) }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none }
.more { display: flex; justify-content: center; margin-top: 18px }
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px)) }
.tray .in { max-width: 1320px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.tray .sel { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 300px; min-width: 0 }
.note { color: var(--muted); font-size: 13px; max-width: 75ch; margin: 0 }
.empty { padding: 40px 0; color: var(--muted); text-align: center }
.mono { font-family: var(--f-data); font-variant-numeric: tabular-nums }

/* product page */
.dlayout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; align-items: start }
.dleft { position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px)); overflow-y: auto; display: grid; gap: 12px; min-width: 0; scrollbar-width: thin }
.dstick { display: grid; gap: 8px; min-width: 0 }
.pname { font: 600 clamp(1.15rem, 2vw, 1.5rem)/1.3 var(--f-display); margin: 0; overflow-wrap: anywhere; text-wrap: pretty }
.dleft .media { height: auto; aspect-ratio: 16 / 10; max-height: 40vh; border-radius: 10px }
.buybox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: grid; gap: 4px }
.buybox .price { font-size: 1.5rem }
.buyrow { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px }
/* price and buttons stay on one line; a long shop name in the primary button is cut with an ellipsis */
.buyrow .price { flex: none }
.buyrow .actions { flex: 0 1 auto; flex-wrap: nowrap; min-width: 0 }
.buyrow .btn { flex: none }
.buyrow .btn.primary { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.buybox .price.none { font-size: 14px }
.buybox .asof { font-size: 13px }
.idtable { margin: 0; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px }
.idtable div { display: grid; grid-template-columns: minmax(84px, 30%) 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px }
.idtable div:last-child { border-bottom: 0 }
.idtable dt { color: var(--muted) }
.idtable dd { margin: 0; font-family: var(--f-data); overflow-wrap: anywhere }
.credit { font-size: 12px; color: var(--muted); margin: 0 }
.dright { display: grid; gap: 14px; min-width: 0 }
.banner { border: 1px solid var(--warn); color: var(--warn); background: var(--surface); border-radius: 10px; padding: 10px 14px; font-size: 14px }
/* no longer sold: neutral, not an alarm (the last known price stays visible) */
.banner.ended { border-color: var(--line); color: var(--ink) }
.banner.ended b { margin-right: 4px }
.alts { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: grid; gap: 4px }
.alts h2.sec { margin: 0 }
h2.sec { font: 600 1.1rem var(--f-display); margin: 6px 0 0 }
.diagram-box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px }
.diagram-box svg { width: 100%; height: auto; max-height: 380px }
.dimfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 14px; font-size: 13px }
.dimfacts b { display: block; font: 500 11px var(--f-data); color: var(--muted); letter-spacing: .04em }
.hl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 10px }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; align-items: center; min-width: 0 }
.tile svg, .gh svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round }
.tile b { grid-column: 2; font: 500 11px var(--f-data); color: var(--muted); letter-spacing: .04em }
.tile span { grid-column: 2; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere }
.tile svg { grid-row: span 2 }
.gnav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3; background: var(--bg); padding-block: 8px; display: flex; gap: 6px; overflow-x: auto }
.groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; scroll-margin-top: 60px }
.gh { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line) }
.gh h3 { font: 600 1rem var(--f-display); margin: 0; flex: 1 }
.gh .count { font-size: 12px }
.rows { display: grid; padding: 4px 14px 10px }
.r { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px }
.r:last-child { border-bottom: 0 }
.r > div:first-child { color: var(--muted); font-size: 13px; overflow-wrap: anywhere }
.r > div:last-child { min-width: 0; overflow-wrap: anywhere }
.r ul { margin: 0; padding-left: 1.1em; display: grid; gap: 2px }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.pchip { font: 500 12.5px/1.3 var(--f-body); border: 1px solid var(--line); background: var(--chip); border-radius: 6px; padding: 4px 8px }
.tip { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px }
.tip::before { content: "ⓘ "; color: var(--accent) }
details.gcard summary { cursor: pointer; list-style: none }
details.gcard summary::-webkit-details-marker { display: none }
.src { display: grid; gap: 8px; font-size: 13px; margin: 0; padding: 0; list-style: none }
.src li { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px }
.src a { overflow-wrap: anywhere }

/* after-sales: warranty / service network / extended warranty (tools/after_sales.py) */
.aftersales { display: grid; gap: 10px; min-width: 0 }
.as-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; align-items: start }
.as-card { padding: 12px 14px; display: grid; gap: 6px }
.as-card h3 { font: 600 .95rem var(--f-display); margin: 0; color: var(--muted) }
.as-card p { margin: 0 }
.as-big { font-weight: 600; line-height: 1.35 }
.as-dl { margin: 0; display: grid; font-size: 13px }
.as-dl div { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line) }
.as-dl div:last-child { border-bottom: 0 }
.as-dl dt { color: var(--muted) } .as-dl dd { margin: 0; text-align: right }
.as-list { margin: 0; padding-left: 1.1em; font-size: 13.5px; display: grid; gap: 2px }
.as-src { font-size: 13px } .as-src summary { cursor: pointer; color: var(--muted) }
.as-src ul { margin: 6px 0 0; padding-left: 1.1em; display: grid; gap: 4px } .as-src a { overflow-wrap: anywhere }

/* compare page */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface) }
table { border-collapse: collapse; width: 100%; font-size: 14px }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line) }
th { color: var(--muted); font-weight: 500; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1 }
td { min-width: 200px; overflow-wrap: anywhere }
tr.diff td { background: var(--diff) }
.cmpimg { display: block; height: 160px; background: var(--media); border-radius: 8px; margin-bottom: 8px }
.cmpimg { position: relative }
.cmpimg img, .cmpimg .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; display: block }
.cmphead { display: grid; gap: 4px }

@media (max-width: 860px) {
  .dlayout { grid-template-columns: minmax(0, 1fr); gap: 14px }
  .dleft { display: contents }
  .dstick { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4; background: var(--bg); padding-block: 6px 8px; border-bottom: 1px solid var(--line) }
  .pname { font-size: 1.05rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
  .dstick .brand { display: none }
  .dleft .media { height: 190px; aspect-ratio: auto; max-height: none }
  .gnav { position: static }
  .gcard { scroll-margin-top: 280px }
}
@media (max-width: 420px) { .stage { right: 100px } .rail { width: 100px } .nav.next { right: 104px } .dots { right: 100px } .media.norail .stage { right: 0 } .media.norail .nav.next { right: 6px } .media.norail .dots { right: 0 } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important } }

/* category navigation (site bar) and home page */
.cats { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: none }
.cats .chip[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; margin-top: 8px }
.catcard { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--ink); text-decoration: none }
.catcard:hover { border-color: var(--accent) }
.catcard h2 { font: 600 1.25rem var(--f-display); margin: 0 }
.catcard p { margin: 0; color: var(--muted); font-size: 14px }
.catcard .big { font: 600 2rem/1 var(--f-data); color: var(--ink); font-variant-numeric: tabular-nums }
.catcard .big span { font: 500 14px var(--f-body); color: var(--muted) }
@media (max-width: 560px) { .bar { flex-wrap: wrap } .cats { order: 3; flex-basis: 100% } }

/* shop price table in the buy box */
table.shops { font-size: 13px; margin-top: 4px }
table.shops caption { text-align: left; font: 500 12px var(--f-body); color: var(--muted); padding-bottom: 4px }
table.shops th, table.shops td { padding: 6px 6px; position: static; min-width: 0; white-space: nowrap }
table.shops th { color: var(--ink); font-weight: 500 }
table.shops td.mono { color: var(--price); font-weight: 600 }
table.shops tr:last-child th, table.shops tr:last-child td { border-bottom: 0 }
table.shops tr.ended th, table.shops tr.ended td.mono { color: var(--muted); font-weight: 400 }

/* brand and series pages: series chips, model groups (name · key specs · lowest price) */
.seriesnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px }
.brandnav { display: grid; gap: 4px; margin-top: 22px }
.mgroups { display: grid; gap: 12px; margin: 8px 0 18px }
.mgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 0; scroll-margin-top: 12px }
.mgroup h2 { font: 600 1.02rem/1.35 var(--f-display); margin: 0 0 4px; overflow-wrap: anywhere }
.mgroup h2 a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); text-underline-offset: 3px }
.mgroup h2 a:hover { color: var(--accent) }
.mgroup h2 .count { font-weight: 400; margin-left: 6px; white-space: nowrap }
.mgroup > .note { margin-top: 6px }
.mlist { list-style: none; margin: 0; padding: 0; display: grid }
.mlist li { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) minmax(7.5em, auto); gap: 2px 14px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px }
.mlist li:last-child { border-bottom: 0 }
.mname { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; text-decoration: none }
.mname:hover { color: var(--accent); text-decoration: underline }
.mspec { color: var(--muted); font-size: 13px; overflow-wrap: anywhere }
.mprice { text-align: right; color: var(--price); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap }
.mprice.none { color: var(--muted); font-weight: 400; font-size: 13px }
.mlist li.old .mname { color: var(--muted) }
@media (max-width: 640px) {
  .mlist li { grid-template-columns: minmax(0, 1fr) auto }
  .mname { grid-column: 1 / -1 }
}

/* product page: other configurations of the same model */
.variants { display: grid; gap: 6px; min-width: 0 }
table.vtable { font-size: 13.5px }
table.vtable th, table.vtable td { padding: 7px 10px; min-width: 0; vertical-align: top }
table.vtable td { white-space: nowrap }
table.vtable thead th { position: static; font: 500 12px var(--f-body); color: var(--muted) }
table.vtable thead th:first-child, table.vtable tbody th { position: sticky; left: 0; z-index: 1 }
table.vtable tbody th { white-space: normal; min-width: 8.5em; max-width: 17em; color: var(--ink); font-weight: 500; overflow-wrap: anywhere }
table.vtable tr.cur th, table.vtable tr.cur td { background: var(--chip) }
table.vtable tr:last-child th, table.vtable tr:last-child td { border-bottom: 0 }
.vtable .vsku { display: block; font: 11px var(--f-data); color: var(--muted); margin-top: 1px }
.vtable .vprice { color: var(--price); font-weight: 600 }
.vtable .pill { white-space: nowrap }

/* product page: price history step chart (labels and dots are HTML over a stretched SVG) */
.phist { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; min-width: 0 }
.phist h3 { font: 600 .95rem var(--f-display); margin: 0 }
.phsum { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 0; font-size: 13px; color: var(--muted) }
.phsum b { color: var(--ink); font-weight: 600 }
.phchart { --pad: 6px; position: relative; height: 104px; margin-top: 2px; touch-action: pan-y; cursor: crosshair; user-select: none }
.phchart svg { position: absolute; inset: 0 var(--pad); width: calc(100% - 2 * var(--pad)); height: 100% }
.phchart .g { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke }
.phchart .ln { fill: none; stroke: var(--price); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke }
.phchart .yl { position: absolute; left: var(--pad); font: 500 11px/1 var(--f-data); color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none }
.phchart .yl.hi { transform: translateY(calc(-100% - 7px)) }
.phchart .yl.lo { transform: translateY(7px) }
.phchart .dot { position: absolute; left: calc(var(--pad) + (100% - 2 * var(--pad)) * var(--x) / 100); top: calc(var(--y) * 1%); width: 9px; height: 9px; border-radius: 50%; background: var(--price); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); pointer-events: none }
.phcross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .6; pointer-events: none }
.phtip { position: absolute; top: -4px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); font: 12px/1.3 var(--f-body); padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2 }
.phcross[hidden], .phtip[hidden] { display: none }
.phx { display: flex; justify-content: space-between; gap: 8px; padding-inline: var(--pad, 6px); font: 11px var(--f-data); color: var(--muted) }
.phtab summary { cursor: pointer; font-size: 12px; color: var(--muted); width: max-content }
.phtab table { width: auto; font-size: 12.5px; margin-top: 4px }
.phtab th, .phtab td { position: static; min-width: 0; padding: 3px 14px 3px 0; white-space: nowrap }
.phtab td { color: var(--ink) }
.phflat { margin-top: 2px }
/* the buy box is one column; its shop table must not widen it past the screen */
.buybox { grid-template-columns: minmax(0, 1fr) }
@media (max-width: 480px) { table.shops th { white-space: normal; overflow-wrap: anywhere } table.shops th, table.shops td { padding-inline: 4px } }

/* news: cards (home strip, list), article page, related-news block on product pages */
.ngrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; margin: 12px 0 0; padding: 0; list-style: none }
.nstrip { margin-top: 28px }
.nstrip > .note { margin-top: 10px }
.ncard { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--ink); text-decoration: none; min-width: 0 }
.ncard:hover { border-color: var(--accent) }
.ncard[hidden] { display: none }
.nthumb { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--media); overflow: hidden }
.nthumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.nthumb .ph, .nfig .ph, .ngallery .ph { font: 600 1.4rem var(--f-display); color: #5d6879 }
.nbody { display: grid; gap: 4px; align-content: start; padding: 12px 14px 14px; min-width: 0 }
.nmeta { font-size: 13px; color: var(--muted); margin: 0 }
.ntitle { font: 600 1.02rem/1.35 var(--f-display); overflow-wrap: anywhere }
.nlead { font-size: 14px; color: var(--muted); overflow-wrap: anywhere }
.nbrands { margin: 4px 0 4px }
.nall { margin-top: 12px }
.narticle { max-width: 780px; margin: 8px auto 0; display: grid; gap: 12px; min-width: 0 }
.narticle h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem) }
.narticle .banner { margin-bottom: 4px }
.nfig { margin: 4px 0; background: var(--media); border-radius: 12px; overflow: hidden }
.nfig img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; background: var(--media) }
.nfig figcaption, .ngallery figcaption { font-size: 12px; color: var(--muted); padding: 6px 10px; background: var(--surface) }
.nbodytext p { margin: 0 0 12px; font-size: 16px; line-height: 1.75; overflow-wrap: anywhere }
.nspecs { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; overflow-wrap: anywhere }
.ngallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px }
.ngallery figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--media) }
.ngallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain }
.ncat { font: 600 .95rem var(--f-display); margin: 6px 0 0 }
.nmore { max-width: 780px; margin: 32px auto 0 }
.nmorelist .ncard { height: 100% }
.nrel .nlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px }
.nrel .nlist li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px }
.nrel .nlist a { overflow-wrap: anywhere }

/* เว็บในเครือ menu (scraper/sites.py) */
.sisters { position: relative; font-size: 13px }
.sisters summary { cursor: pointer; color: var(--muted); list-style: none }
.sisters ul { position: absolute; right: 0; z-index: 20; margin: 6px 0 0; padding: 8px; min-width: 220px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px }
.sisters li + li { margin-top: 6px } .sisters small { display: block; color: var(--muted) }

/* ===== appliance site (aircon, fridge, washer, tv): tools/site_appliance.py, appliance.js ===== */
.acpair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px }
.acpair div { display: grid; gap: 2px; background: var(--chip); border-radius: 8px; padding: 8px 12px; min-width: 0 }
.acpair b { font: 500 11px var(--f-data); color: var(--muted); letter-spacing: .04em }
.acpair .mono { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere }
.elabel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border: 1px solid var(--good); border-radius: 8px; padding: 8px 12px }
.elno { font: 600 1rem var(--f-display); background: var(--good); color: var(--surface); border-radius: 6px; padding: 2px 8px }
.elstars { font-size: 1.15rem; letter-spacing: .08em; color: #d79a00 }
.elstars i { font-style: normal; color: var(--line) }
.elstars.none { font-size: 13px; color: var(--muted); letter-spacing: 0 }
.elsrc { font-size: 12.5px; color: var(--muted); flex: 1 1 200px }
.calc, .btutool { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; min-width: 0; scroll-margin-top: 12px }
.calc h2.sec, .btutool h2.sec { margin: 0 }
.calcin { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px 12px; align-items: end }
.calcin label { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); min-width: 0 }
.calcin label[hidden] { display: none }
.calcin input, .calcin select { width: 100%; font-size: 15px }
.calcin .seg { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; border: 0; margin: 0; padding: 0; font-size: 14px }
.calcin .seg legend { font-size: 12.5px; color: var(--muted); padding: 0; margin-bottom: 3px }
.calcin .seg label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); font-size: 14px }
.calcin .seg input { width: auto }
.calcout { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px }
.calcout div { background: var(--chip); border-radius: 8px; padding: 8px 12px; display: grid; gap: 2px; min-width: 0 }
.calcout b { font: 500 11.5px var(--f-body); color: var(--muted) }
.calcout span { font: 600 1.15rem var(--f-data); color: var(--price); font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.formula summary { cursor: pointer; font-size: 13px; color: var(--accent) }
.formula { display: grid; gap: 6px }
.formula[open] { gap: 8px }
.formula .note + .note { margin-top: 6px }
table.apshops th { white-space: normal }
.apshops .instrow { display: block; font-weight: 400; margin-top: 2px; white-space: normal }
.apshops .inst { font-size: 12px; color: var(--muted) }
.apshops .inst.ok { color: var(--good) }
.apshops .instrow .count { font-size: 11.5px }
.apshops .insttot { display: block; font: 500 12px var(--f-body); color: var(--ink) }
.tools { display: grid; gap: 16px; max-width: 980px }
.btuout { display: grid; gap: 4px }
.btuout p { margin: 0 }
.btubig { font: 600 2.2rem/1.1 var(--f-data); color: var(--accent); font-variant-numeric: tabular-nums }
.btubig small { font: 500 14px var(--f-body); color: var(--muted) }
table.btutab th, table.btutab td { min-width: 0; white-space: normal; position: static }
.hometools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; margin-top: 14px }
.catcard.tool { border-style: dashed }
.catcard.tool h2 { font-size: 1.1rem; color: var(--accent) }
/* appliance list cards: price (pills under it) and buttons always on one line; long filter rows on phones */
.ap .card .foot { flex-wrap: nowrap }
.ap .card .pricebox { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0 }
.ap .card .foot .actions { flex-wrap: nowrap; flex: none }
@media (max-width: 560px) {
  .ap .filters { position: static }
  .ap .filters .row > select.flt { flex: 1 1 calc(50% - 8px); width: 0 }
}
/* very long series names (e.g. Samsung aircon series) wrap inside their chip instead of widening the page */
.seriesnav .chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.25 }
/* site footer + GA4 consent bar (tools/site_assets/ga.js) */
.sitefoot { max-width: 1320px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 120px max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center }
.wrap + .sitefoot { margin-top: -96px }
.sitefoot a { color: var(--muted) }
.sitefoot button { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.12); padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; font-size: 14px }
.consent p { margin: 0; max-width: 70ch }
.consent-btns { display: flex; gap: 8px }
.consent-btns .btn { font-size: 14px; padding: 8px 16px; cursor: pointer }
.privacy h2 { font-size: 1.05rem; margin: 24px 0 6px }
.privacy p, .privacy li { max-width: 70ch }
