/* ============================================================
   DealRadar — design system
   Mobile-first. Every value below is a token; screens compose
   tokens, never raw colours or one-off pixel numbers.
   ============================================================ */
/* "Paper & ink" — the same palette as the app: warm off-white / warm
   charcoal, ink-black actions, orange only for discounts, green only for
   price drops. No blues, no gradients, no glass. */
:root {
  /* --- surfaces & text (light) --- */
  --bg:            #f5f2ec;
  --bg-sunk:       #ece8e0;
  --surface:       #ffffff;
  --surface-2:     #f0ece5;
  --surface-3:     #e6e1d8;
  --border:        #e3ded4;
  --border-strong: #d2ccc0;
  --text:          #17150f;
  --text-2:        #5e5a52;
  --text-3:        #8f897e;
  /* Product photos are shot on white; a light tile keeps them looking intended. */
  --media-bg:      #ffffff;

  /* --- brand: ink --- */
  --accent:        #17150f;
  --accent-hover:  #000000;
  --accent-soft:   rgba(23, 21, 15, .06);
  --accent-line:   rgba(23, 21, 15, .18);
  --accent-text:   #f5f2ec;
  --cyan:          #2f6f8f;
  --cyan-soft:     rgba(47, 111, 143, .12);

  /* --- semantic --- */
  --good:          #1f7a4d;
  --good-soft:     rgba(31, 122, 77, .12);
  --good-line:     rgba(31, 122, 77, .30);
  --hot:           #d9480f;
  --hot-soft:      rgba(217, 72, 15, .10);
  --warn:          #a15c07;
  --warn-soft:     rgba(196, 122, 20, .13);
  --gold:          #a15c07;          /* price-history chart accent */
  --overlay:       rgba(23, 21, 15, .45);
  --skeleton:      #e8e3da;

  /* --- shape --- */
  --r-xs:   8px;
  --r-sm:  12px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-xl:  24px;
  --r-full: 999px;
  /* kept for compatibility with anything still reading the old names */
  --radius: var(--r-md);
  --radius-sm: var(--r-sm);
  --radius-lg: var(--r-lg);

  /* --- spacing --- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --page-pad: 16px;

  /* --- elevation: hairlines, not shadows --- */
  --shadow-1: none;
  --shadow-2: 0 1px 0 rgba(23, 21, 15, .04);
  --shadow-3: 0 12px 40px rgba(23, 21, 15, .18);
  --shadow:    var(--shadow-2);
  --shadow-lg: var(--shadow-3);
  --ring: 0 0 0 3px var(--accent-soft);

  /* --- motion --- */
  --t-fast:   120ms;
  --t-normal: 200ms;
  --t-smooth: 300ms;
  --t-page:   350ms;
  --ease:     cubic-bezier(.32, .72, .3, 1);

  /* --- type --- */
  --font: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* --- chrome metrics --- */
  --appbar-h:   56px;
  --bottomnav-h: 58px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  --bg:            #14120e;
  --bg-sunk:       #0f0d0a;
  --surface:       #1c1914;
  --surface-2:     #24201a;
  --surface-3:     #2d2922;
  --border:        #2d2922;
  --border-strong: #3b362d;
  --text:          #f1ece2;
  --text-2:        #b4ad9f;
  --text-3:        #857f73;
  --media-bg:      #f4f1eb;

  --accent:        #f1ece2;
  --accent-hover:  #ffffff;
  --accent-soft:   rgba(241, 236, 226, .08);
  --accent-line:   rgba(241, 236, 226, .22);
  --accent-text:   #14120e;
  --cyan:          #6fb3cf;
  --cyan-soft:     rgba(111, 179, 207, .14);

  --good:          #52c48c;
  --good-soft:     rgba(82, 196, 140, .14);
  --good-line:     rgba(82, 196, 140, .32);
  --hot:           #ff7a45;
  --hot-soft:      rgba(255, 122, 69, .14);
  --warn:          #e8a94a;
  --warn-soft:     rgba(232, 169, 74, .14);
  --gold:          #e8a94a;
  --overlay:       rgba(0, 0, 0, .6);
  --skeleton:      #26221c;

  --shadow-1: none;
  --shadow-2: none;
  --shadow-3: 0 12px 48px rgba(0, 0, 0, .55);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--appbar-h) + 8px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
  font-size: 16px;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  /* Landscape iPhones: keep content clear of the notch / dynamic island. */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
/* One visible, consistent keyboard focus ring for every interactive element. */
:where(button, a, [role="button"], [tabindex], summary, select):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.noscript {
  padding: 16px; text-align: center; font-weight: 650;
  background: var(--warn-soft); color: var(--warn);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.22; letter-spacing: -.022em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0; }
a  { color: var(--accent); }
button { font: inherit; cursor: pointer; color: inherit; }
img { max-width: 100%; }
/* Icons default to text size and never stretch — a bare <svg> in a flex row
   with height:100% is how icons end up rendering as full-width artwork. */
svg {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.hidden { display: none !important; }
.muted  { color: var(--text-2); }
.small  { font-size: .82rem; }
.fineprint { font-size: .76rem; color: var(--text-3); line-height: 1.5; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.spacer { flex: 1; }

::selection { background: var(--accent-soft); }

/* Scrollbars: visible enough to hint at overflow, quiet enough to ignore. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; min-height: 46px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 650; font-size: .92rem; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), opacity var(--t-fast), color var(--t-fast);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-soft:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--hot-soft); color: var(--hot); border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; min-height: 40px; font-size: .86rem; border-radius: var(--r-xs); }
.btn-xs { padding: 8px 13px; min-height: 40px; font-size: .82rem; border-radius: var(--r-xs); gap: 5px; }
.btn .ico { width: 16px; height: 16px; flex: none; }
.btn-xs .ico { width: 14px; height: 14px; }

.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--accent-text); animation: spin .7s linear infinite;
}
.btn-soft.loading::after, .btn-ghost.loading::after { color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Icon-only round button (app bar actions) */
.iconbtn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn:hover { color: var(--text); background: var(--surface-3); }
.iconbtn:active { transform: scale(.92); }
.iconbtn:disabled { opacity: .6; cursor: default; }
.iconbtn.spinning svg { animation: spin 1s linear infinite; }
.iconbtn.spinning { color: var(--accent); }

/* ============================================================
   Inputs
   ============================================================ */
.input, select.input, textarea.input,
input[type="text"], input[type="tel"], input[type="password"],
input[type="number"], input[type="search"] {
  width: 100%; padding: 13px 14px; min-height: 48px;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, input::placeholder { color: var(--text-3); }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
select.input {
  cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 18px;
}
:root[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7789' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--s-4); }
.field > span { font-size: .85rem; font-weight: 650; color: var(--text-2); }

.range { width: 100%; accent-color: var(--accent); height: 30px; }
.check {
  display: flex; align-items: center; gap: 11px; min-height: 44px;
  font-size: .9rem; cursor: pointer; color: var(--text);
}
.check input { accent-color: var(--accent); width: 19px; height: 19px; flex: none; cursor: pointer; }

/* Toggle switch — a styled checkbox, so the DOM contract stays a checkbox. */
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer; z-index: 2;
}
.switch .track {
  position: absolute; inset: 0; border-radius: var(--r-full);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background var(--t-normal) var(--ease), border-color var(--t-normal);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1);
  transition: transform var(--t-normal) var(--ease);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
}

.alert { padding: 12px 15px; border-radius: var(--r-sm); font-size: .87rem; line-height: 1.5; }
.alert-error { background: var(--hot-soft); color: var(--hot); margin-top: var(--s-3); }
.alert-warn  { background: var(--warn-soft); color: var(--warn); margin-bottom: var(--s-4); }

/* ============================================================
   Brand
   ============================================================ */
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px; font-size: .95rem;
  background: linear-gradient(140deg, var(--accent), var(--cyan));
  box-shadow: 0 2px 10px var(--accent-soft);
}
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.035em; }
.brand-name span { color: var(--accent); }
.brand-lg .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 1.5rem; }
.brand-lg .brand-name { font-size: 1.45rem; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-view {
  min-height: 100dvh; display: grid; align-items: start;
  padding: calc(var(--safe-top) + 26px) var(--page-pad) calc(var(--safe-bottom) + 32px);
  background:
    radial-gradient(900px 420px at 12% -10%, var(--accent-soft), transparent 62%),
    radial-gradient(760px 400px at 92% 104%, var(--cyan-soft), transparent 64%),
    var(--bg);
}
.login-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; width: 100%; max-width: 560px; margin: 0 auto; }
.login-pitch { animation: rise var(--t-page) var(--ease) both; }
.login-pitch h1 { margin: 20px 0 12px; font-size: clamp(1.55rem, 7vw, 2.05rem); }
.lede { color: var(--text-2); font-size: .96rem; max-width: 54ch; }
/* DOM order is pitch → sign-in card → "why", so on a phone the form is the
   second thing you see rather than sitting under five bullet points. */
.login-why { animation: rise var(--t-page) var(--ease) 140ms both; }
.pitch-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.pitch-list li {
  padding-left: 28px; position: relative; color: var(--text-2); font-size: .89rem; line-height: 1.5;
}
.pitch-list li b { color: var(--text); font-weight: 650; }
.pitch-list li::before {
  content: ""; position: absolute; left: 0; top: .34em; width: 17px; height: 17px;
  border-radius: 50%; background: var(--good-soft);
  border: 1.5px solid var(--good-line);
}
.pitch-list li::after {
  content: ""; position: absolute; left: 5px; top: .62em; width: 6px; height: 3px;
  border-left: 1.8px solid var(--good); border-bottom: 1.8px solid var(--good);
  transform: rotate(-45deg);
}
.pitch-foot {
  margin-top: 24px; font-size: .78rem; color: var(--text-3);
  border-top: 1px solid var(--border); padding-top: 14px;
}
.login-panel { animation: rise var(--t-page) var(--ease) 80ms both; }
.auth-card { padding: 22px; border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.auth-card h2 { margin-bottom: 7px; font-size: 1.2rem; }
.auth-card > form > .muted { font-size: .89rem; margin-bottom: 18px; line-height: 1.5; }
.auth-step { display: block; animation: rise var(--t-normal) var(--ease) both; }
.auth-step .btn-block + .btn-block { margin-top: 9px; }
.auth-step .fineprint { margin-top: 14px; }
.auth-secure {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 14px; font-size: .78rem; color: var(--text-3);
}
.auth-secure svg { width: 13px; height: 13px; flex: none; }
/* OTP-style field: reads as a code box without breaking one-time-code autofill. */
.code-input {
  text-align: center; font-family: var(--mono); font-size: 1.5rem !important;
  font-weight: 700; letter-spacing: .34em; text-indent: .34em; padding: 16px 12px !important;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ============================================================
   APP BAR
   ============================================================ */
.appbar {
  position: sticky; top: 0; z-index: 60;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-normal), background var(--t-normal);
}
.appbar.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-1); }
.appbar-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 9px var(--page-pad) 10px;
  max-width: 1440px; margin: 0 auto;
}
/* flex-basis 0, not auto: a wrapping flex container breaks lines using each
   item's *hypothetical* size, so an auto-basis brand claims its max-content
   width and shoves the action buttons onto a third row on a 320px phone. */
.appbar-brand { flex: 1 1 0; min-width: 0; }
.appbar-greet {
  display: flex; flex-direction: column; min-width: 0;
  line-height: 1.2;
}
.appbar-greet .brand-name {
  font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.greet-hi {
  font-size: .73rem; color: var(--text-2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar-actions { display: flex; align-items: center; gap: 7px; flex: none; }

/* alert bell with a real count */
.bell { position: relative; }
.bell-dot {
  position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center; border-radius: var(--r-full);
  background: var(--hot); color: #fff; font-size: .62rem; font-weight: 800;
  border: 2px solid var(--bg);
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 1px solid var(--accent-line);
  background: linear-gradient(140deg, var(--accent), var(--cyan));
  color: #fff; font-weight: 800; font-size: .92rem;
  display: grid; place-items: center;
  transition: transform var(--t-fast);
}
.avatar:active { transform: scale(.92); }

/* search — wraps to its own full-width row on phones, sits inline on desktop */
.search { position: relative; display: flex; align-items: center; order: 3; flex: 1 1 100%; }
.search-icon {
  position: absolute; left: 15px; width: 18px; height: 18px;
  color: var(--text-3); pointer-events: none; transition: color var(--t-normal);
}
.search input {
  flex: 1; min-width: 0; height: 48px; padding: 0 92px 0 44px;
  background: var(--surface-2); border-radius: var(--r-full);
  border-color: transparent; font-size: .92rem; text-overflow: ellipsis;
}
.search input:focus { background: var(--surface); border-color: var(--accent); }
.search:focus-within .search-icon { color: var(--accent); }
.search .btn { position: absolute; right: 5px; border-radius: var(--r-full); min-height: 38px; padding: 0 15px; }
.search-clear {
  position: absolute; right: 80px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-3);
  border: none; color: var(--text-2); padding: 0;
}
.search-clear:active { background: var(--border-strong); }
.search-clear svg { width: 14px; height: 14px; }

/* search suggestion panel */
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); padding: 8px; max-height: 58vh; overflow-y: auto;
  animation: rise var(--t-fast) var(--ease);
}
.suggest-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.suggest-head button { background: none; border: none; color: var(--accent); font-size: .74rem; font-weight: 650; padding: 2px 4px; }
.suggest-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px;
  padding: 9px 10px; background: none; border: none; border-radius: var(--r-xs);
  color: var(--text); font-size: .9rem; text-align: left;
}
.suggest-item:hover, .suggest-item:focus-visible { background: var(--surface-2); outline: none; }
.suggest-item svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.suggest-item .s-count { margin-left: auto; font-size: .76rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.suggest-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 8px 8px; }
.suggest {
  max-height: min(64vh, 560px); max-height: min(64dvh, 560px);
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.suggest [role="group"] + [role="group"], .suggest .s-query + [role="group"] { margin-top: 2px; }
.suggest-item { cursor: pointer; min-height: 48px; }
.suggest-item.active { background: var(--accent-soft); }
.suggest-item.active svg { color: var(--accent); }
.suggest-item .s-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .s-emoji { width: 16px; flex: none; text-align: center; font-size: .95rem; line-height: 1; }
.suggest-item.s-query .s-text b { font-weight: 700; }
.s-kbd {
  display: none; flex: none; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
  font: 600 .68rem/1.4 var(--font); color: var(--text-3);
}
@media (hover: hover) and (pointer: fine) { .s-kbd { display: inline-block; } }
.s-dealrow { align-items: center; padding-block: 7px; }
.s-thumb {
  position: relative; flex: none; width: 46px; height: 46px; overflow: hidden;
  border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 1.1rem;
}
.s-thumb > span { opacity: .4; }
.s-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 3px; background: var(--media-bg);
}
.s-deal { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.s-title {
  font-size: .86rem; font-weight: 600; line-height: 1.3; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.s-price { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.s-price .price-now { font-size: .9rem; }
.s-price .price-off { font-size: .68rem; padding: 1px 6px; }
.s-store { font-size: .7rem; color: var(--text-3); text-transform: capitalize; }
.suggest-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; font-size: .8rem; color: var(--text-3); text-align: center;
}
.s-spin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.suggest.stale [role="group"] { opacity: .6; transition: opacity var(--t-fast); }

/* matched query terms */
mark {
  background: var(--warn-soft); color: inherit;
  border-radius: 3px; padding: 0 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.deal-title mark, .rail-title mark, .s-title mark { font-weight: 750; }

/* unseen notifications: a dot on the bell and on the bottom-nav Alerts tab */
.bell.has-unseen::after, .navbtn.has-unseen::after {
  content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.bell.has-unseen::after { top: 4px; left: 4px; }
.navbtn.has-unseen::after { top: 6px; left: 50%; margin-left: -18px; border-color: var(--surface); }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; align-items: stretch;
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
}
.navbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: var(--bottomnav-h); padding: 6px 2px 4px;
  background: none; border: none; color: var(--text-3);
  font-size: .68rem; font-weight: 650; letter-spacing: .01em;
  position: relative; transition: color var(--t-normal);
}
.navbtn .navicon { width: 23px; height: 23px; transition: transform var(--t-normal) var(--ease); }
.navbtn::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%) scaleX(0);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
  transition: transform var(--t-normal) var(--ease);
}
.navbtn.active { color: var(--accent); }
.navbtn.active::before { transform: translateX(-50%) scaleX(1); }
.navbtn.active .navicon { transform: translateY(-1px) scale(1.06); }
.navbtn:active .navicon { transform: scale(.9); }
.navbtn .nav-badge {
  position: absolute; top: 5px; left: 50%; margin-left: 6px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--r-full);
  background: var(--hot); color: #fff; font-size: .6rem; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}

/* Desktop top nav — hidden on phones, where the bottom bar owns navigation. */
.topnav { display: none; align-items: center; gap: 4px; }
.navlink {
  background: none; border: none; color: var(--text-2); font-weight: 650; font-size: .9rem;
  padding: 9px 13px; min-height: 40px; border-radius: var(--r-xs);
  transition: color var(--t-fast), background var(--t-fast);
}
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: var(--accent); background: var(--accent-soft); }

/* ============================================================
   ACCOUNT MENU  (bottom sheet on phones, dropdown on desktop)
   ============================================================ */
.dropdown {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 130;
  padding: 8px 10px calc(14px + var(--safe-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-3);
  animation: sheet-up var(--t-smooth) var(--ease);
}
.dropdown::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: var(--r-full);
  background: var(--border-strong); margin: 4px auto 12px;
}
.drop-head {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.drop-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--cyan)); color: #fff;
  font-weight: 800; font-size: 1rem;
}
.drop-name { font-weight: 700; font-size: .98rem; }
.drop-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px;
  text-align: left; padding: 11px 12px; background: none; border: none;
  border-radius: var(--r-sm); color: var(--text); font-size: .93rem; font-weight: 550;
}
.drop-item:hover { background: var(--surface-2); }
.drop-item:active { background: var(--surface-3); }
.drop-item.danger { color: var(--hot); }
.drop-item .ico { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.drop-item.danger .ico { color: var(--hot); }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ============================================================
   PAGES
   ============================================================ */
.page {
  max-width: 1440px; margin: 0 auto;
  padding: 4px var(--page-pad) calc(var(--bottomnav-h) + var(--safe-bottom) + 28px);
  animation: page-in var(--t-normal) var(--ease);
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.page-head { margin-bottom: var(--s-5); padding-top: var(--s-2); }
.page-head h2 { font-size: 1.42rem; }
.page-head p { margin-top: 6px; font-size: .89rem; max-width: 62ch; color: var(--text-2); }
.page-head-actions { display: flex; gap: 9px; margin-top: 14px; flex-wrap: wrap; }
.page-head-actions .btn { flex: 1; min-width: 130px; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.02rem; font-weight: 750; letter-spacing: -.02em;
}
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: var(--s-6) 0 var(--s-3);
}
.section-head .section-sub { font-size: .78rem; color: var(--text-3); }
.section-head > div { min-width: 0; }

/* ============================================================
   DROP COUNTDOWN  (next featured-deal refresh)
   ============================================================ */
.dropcountdown {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 10px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-2);
}
.dc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, .5);
  animation: dc-pulse 1.8s ease-out infinite;
}
@keyframes dc-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
  70%  { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}
.dc-label { color: var(--text-3); }
.dc-time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .dc-dot { animation: none; } }

/* ============================================================
   SPOTLIGHT  (biggest banner: best deal of the current drop)
   ============================================================ */
.spotlight {
  display: flex; flex-wrap: wrap;
  margin: 14px 0 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  min-height: 220px;
}
.spotlight-media {
  position: relative;
  flex: 1 1 320px;
  min-height: 220px;
  background: var(--surface-3);
}
.spotlight-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spotlight-badge {
  position: absolute; top: 14px; left: 14px;
  background: var(--hot); color: #fff;
  font-size: .82rem; font-weight: 800;
  padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, .35);
}
.spotlight-copy {
  flex: 1 1 320px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  padding: 28px 32px;
}
.spotlight-kicker {
  font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.spotlight-title {
  margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.75rem); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spotlight-price { display: flex; align-items: baseline; gap: 10px; }
.spotlight-now { font-size: 1.6rem; font-weight: 800; color: var(--good); }
.spotlight-was { font-size: 1rem; color: var(--text-3); text-decoration: line-through; }
.spotlight-cta {
  margin-top: 4px; font-weight: 700; color: var(--accent); font-size: .92rem;
}
@media (max-width: 640px) {
  .spotlight { min-height: 0; }
  .spotlight-media { min-height: 180px; }
  .spotlight-copy { padding: 20px; }
}

/* ============================================================
   RADAR STATUS  (live counters + sync state)
   ============================================================ */
.statstrip { margin: 10px 0 var(--s-4); }
.radarcard {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 15px 16px;
  background:
    radial-gradient(420px 150px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.radar-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.livedot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none;
  box-shadow: 0 0 0 0 var(--good-line); animation: pulse 2.4s var(--ease) infinite;
}
.livedot.syncing { background: var(--accent); box-shadow: 0 0 0 0 var(--accent-line); }
.livedot.idle { animation: none; background: var(--text-3); box-shadow: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--good-line); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.radar-status { font-size: .8rem; font-weight: 650; color: var(--text-2); min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radar-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { min-width: 0; }
.stat + .stat { border-left: 1px solid var(--border); padding-left: 10px; }
.stat-value {
  font-size: 1.42rem; font-weight: 800; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-label {
  font-size: .68rem; color: var(--text-3); margin-top: 3px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 650;
  line-height: 1.3;   /* wraps rather than truncating on a 320px phone */
}
.stat-value.up { color: var(--good); }

/* ============================================================
   CATEGORY RAIL
   ============================================================ */
.catrow {
  display: flex; gap: 9px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 2px 0 4px;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad);
  -webkit-overflow-scrolling: touch;
}
.catrow::-webkit-scrollbar { display: none; }
.catrow { scrollbar-width: none; }
.cat {
  flex: none; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 68px; padding: 0; background: none; border: none;
  color: var(--text-2); font-size: .7rem; font-weight: 600; line-height: 1.25;
  text-align: center;
}
.cat-icon {
  display: grid; place-items: center; width: 56px; height: 56px;
  border-radius: 18px; font-size: 1.42rem;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-normal),
              background var(--t-normal), box-shadow var(--t-normal);
}
.cat:active .cat-icon { transform: scale(.92); }
.cat-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color var(--t-normal);
}
.cat.active { color: var(--accent); }
.cat.active .cat-icon {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* pill chips (used for suggestions, active filters, quick facets) */
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 36px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .82rem; font-weight: 600;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-x { display: grid; place-items: center; width: 15px; height: 15px; opacity: .7; }
.chip-x svg { width: 11px; height: 11px; stroke-width: 2.6; }
.chip.removable { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ============================================================
   RESULTS TOOLBAR
   ============================================================ */
.toolbar {
  position: sticky; top: var(--appbar-h); z-index: 40;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 0 9px; background: var(--bg);
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad);
}
.toolbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--border); opacity: 0; transition: opacity var(--t-normal);
}
.toolbar.stuck::after { opacity: 1; }
#results-summary {
  flex: 1; min-width: 0; font-size: .82rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#results-summary b { color: var(--text); font-weight: 750; }
.filters-toggle { flex: none; position: relative; }
.filters-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full); background: var(--accent); color: var(--accent-text);
  font-size: .68rem; font-weight: 800;
}
.activefilters {
  display: flex; gap: 7px; overflow-x: auto; padding: 0 0 12px;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad);
  scrollbar-width: none;
}
.activefilters::-webkit-scrollbar { display: none; }

/* result categories with counts, directly above the grid */
.resultcats {
  display: flex; gap: 7px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0 0 12px;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.resultcats::-webkit-scrollbar { display: none; }
.rcat {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 12px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .8rem; font-weight: 650; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.rcat:hover { border-color: var(--border-strong); color: var(--text); }
.rcat-icon { font-size: .9rem; line-height: 1; }
.rcat-count {
  min-width: 20px; padding: 1px 6px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-3);
  font-size: .7rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center;
}
.rcat.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.rcat.active .rcat-count { background: var(--accent); color: var(--accent-text); }
@media (max-width: 599px) {
  .resultcats {
    -webkit-mask-image: linear-gradient(to right, #000 86%, transparent);
    mask-image: linear-gradient(to right, #000 86%, transparent);
  }
}

/* ============================================================
   HORIZONTAL DEAL RAILS
   ============================================================ */
.rail {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 2px 0 8px;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad);
  -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { display: none; }
.rail { scrollbar-width: none; }
.railcard {
  flex: none; scroll-snap-align: start; width: 152px;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); text-decoration: none; color: inherit;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-normal), box-shadow var(--t-normal);
}
.railcard:active { transform: scale(.97); }
.railcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.railcard .rail-media { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.railcard .rail-body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.rail-title {
  font-size: .78rem; font-weight: 600; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-price { display: flex; align-items: baseline; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.rail-price .price-now { font-size: 1rem; }
.rail-price .price-was { font-size: .72rem; }
.rail-note {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 700; color: var(--good);
}
.rail-note svg { width: 12px; height: 12px; }
.rail-note.hot { color: var(--hot); }
.rail-note.muted-note { color: var(--text-3); font-weight: 600; }
.cat-rails { display: block; }

/* ============================================================
   DEAL GRID + CARD
   ============================================================ */
.layout { display: block; }
/* Two columns on every phone, however narrow — one giant card per row wastes the screen. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 359px) {
  /* Tapping the photo already opens details; the narrowest phones keep one clear CTA. */
  .grid:not(.list) .deal-actions .btn-soft { display: none; }
  .grid:not(.list) .deal-body { padding: 9px 9px 6px; }
  .grid:not(.list) .deal-actions { padding: 0 9px 9px; }
  .price-now { font-size: 1.05rem; }
}

.deal {
  display: flex; flex-direction: column; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-normal), border-color var(--t-normal);
}
.deal:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.deal.pressed { transform: scale(.975); }

.deal-media { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
/* contain, not cover: a cropped product photo is the fastest way to look amateur. */
.deal-media img, .rail-media img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; object-fit: contain; display: block;
  padding: 8px; background: var(--media-bg);
  animation: fade-in var(--t-smooth) var(--ease);
}
.deal-media .badges, .deal-media .store-tag, .rail-media .badges { z-index: 2; }
@keyframes fade-in { from { opacity: 0; } }
/* The placeholder is a layer *under* the image, so an image that 404s simply
   reveals it — nothing has to rewrite the container and blow away the badges. */
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.9rem; opacity: .32;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.deal-media .placeholder { font-size: 2.2rem; }
.rail-media { position: relative; overflow: hidden; }
.detail-hero .placeholder { font-size: 3rem; }

.badges {
  position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column;
  align-items: flex-start; gap: 4px; max-width: calc(100% - 16px);
}
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: var(--r-xs);
  font-size: .66rem; font-weight: 800; letter-spacing: .015em;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-off  { background: var(--hot); color: #fff; }
.badge-low  { background: #fbbf24; color: #33240a; }
.badge-hot  { background: #16a34a; color: #fff; }
.badge-new  { background: var(--accent); color: #fff; }
.badge-score { background: rgba(8, 12, 20, .74); color: #fff; backdrop-filter: blur(6px); }
.badge-warn { background: #f59e0b; color: #2a1a02; cursor: help; }
.sparkline-slot { display: inline-flex; align-items: center; margin-left: auto; }
.sparkline { width: 44px; height: 16px; display: block; }
.sparkline-down polyline { stroke: #16a34a; }
.sparkline-up polyline { stroke: #ef4444; }
.store-tag {
  position: absolute; bottom: 8px; left: 8px; max-width: calc(100% - 16px);
  padding: 3px 9px; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); color: var(--text);
  font-size: .67rem; font-weight: 700; text-transform: capitalize;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.deal-body { padding: 10px 11px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.deal-title {
  font-size: .82rem; font-weight: 600; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.2em;
}
.deal-price { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-top: auto; }
.price-now {
  font-size: 1.16rem; font-weight: 800; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.price-was { font-size: .76rem; color: var(--text-3); text-decoration: line-through; }
.price-from { font-size: .62em; font-weight: 650; color: var(--text-2); letter-spacing: 0; margin-right: 1px; }
.price-off {
  align-self: center; padding: 2px 7px; border-radius: 6px;
  background: var(--hot-soft); color: var(--hot);
  font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.price-save {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 750; color: var(--good);
}
.price-save svg { width: 12px; height: 12px; }
.deal-signal {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 700; color: var(--good);
}
.deal-signal svg { width: 12px; height: 12px; flex: none; }
.deal-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .69rem; color: var(--text-3);
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); flex: none; }
.reposts { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 650; }
.coupon {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px;
  background: var(--warn-soft); color: var(--warn);
  font-family: var(--mono); font-size: .7rem; font-weight: 700;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deal-actions { display: flex; gap: 6px; padding: 0 11px 11px; }
.deal-actions .btn { flex: 1; min-width: 0; padding-inline: 8px; }
.deal-actions .btn-buy { flex: 1.35; }

/* ============================================================
   FILTER SHEET
   ============================================================ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 120; background: rgba(3, 7, 15, .55);
  backdrop-filter: blur(2px); animation: fade-in var(--t-normal);
}
.filters {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 125;
  display: flex; flex-direction: column; max-height: 88dvh;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-3);
  transform: translateY(100%); transition: transform var(--t-smooth) var(--ease);
  will-change: transform;
}
.filters.open { transform: translateY(0); }
.filters.dragging { transition: none; }
.sheet-grab { padding: 10px 0 4px; flex: none; cursor: grab; touch-action: none; }
.sheet-grab::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: var(--r-full);
  background: var(--border-strong); margin: 0 auto;
}
.filter-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 6px 16px 12px; border-bottom: 1px solid var(--border); flex: none;
}
.filter-head h3 { font-size: 1.1rem; }
.filter-head .head-actions { display: flex; gap: 8px; align-items: center; }
.filter-body { overflow-y: auto; padding: 16px 16px 8px; flex: 1; -webkit-overflow-scrolling: touch; }
.filter-block { margin-bottom: var(--s-5); }
.filter-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: .74rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); margin-bottom: 9px;
}
.filter-label span { color: var(--accent); text-transform: none; letter-spacing: 0; font-size: .82rem; }
.facet-list { display: flex; flex-direction: column; gap: 2px; }
.facet-more {
  align-self: flex-start; margin-top: 4px; padding: 8px 11px; min-height: 40px;
  background: none; border: none; border-radius: var(--r-xs);
  color: var(--accent); font-size: .84rem; font-weight: 650;
}
.facet-more:hover { background: var(--accent-soft); }
.facet {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; min-height: 42px; padding: 8px 11px;
  border: none; background: none; border-radius: var(--r-xs);
  color: var(--text-2); font-size: .89rem; text-align: left;
  text-transform: capitalize;
}
.facet:hover { background: var(--surface-2); color: var(--text); }
.facet.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.facet-count { font-size: .76rem; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.filter-foot {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border); background: var(--surface);
}
.filter-foot .btn { flex: none; }
#filter-count { flex: 1; min-width: 0; font-size: .82rem; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   CHANNELS
   ============================================================ */
.addpublic { padding: 15px 16px; margin-bottom: var(--s-4); }
.addpublic .field { margin: 0; }
.row-inputs { display: flex; gap: 9px; }
.row-inputs .input { flex: 1; min-width: 0; }
.row-inputs .btn { flex: none; }
.channel-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s-3); }
.channel-toolbar .input { flex: 1; max-width: 420px; }
#channel-count { flex: none; font-size: .78rem; color: var(--text-2); }
.channel-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.channel {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); cursor: pointer;
  transition: border-color var(--t-normal), background var(--t-normal), transform var(--t-fast);
}
.channel:active { transform: scale(.99); }
.channel.on { border-color: var(--accent-line); background: var(--accent-soft); }
.channel-avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1rem; letter-spacing: -.02em;
}
.channel-info { min-width: 0; flex: 1; overflow: hidden; }
.channel-name {
  font-weight: 650; font-size: .93rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-sub {
  font-size: .76rem; color: var(--text-3); margin-top: 2px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.channel-deals { color: var(--good); font-weight: 700; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert-form { padding: 16px; margin-bottom: var(--s-4); }
.alert-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.alert-form .btn { margin-top: 2px; }
.alert-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.alert-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 15px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.alert-main { min-width: 0; flex: 1 1 180px; }
.alert-q {
  font-weight: 700; font-size: .96rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alert-filters { font-size: .77rem; color: var(--text-3); margin-top: 3px; }
.alert-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; color: var(--good); margin-top: 6px;
}
.alert-status.off { color: var(--text-3); }
.alert-status .sdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.alert-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* notification history ("Recent matches") */
.notif-section { margin-top: var(--s-2); }
.notif-section .section-head { align-items: center; flex-wrap: wrap; }
.notif-list {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
}
.notif-list > .skel-row { border-radius: 0; border: none; border-bottom: 1px solid var(--border); }
.notif {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 56px;
  padding: 13px 15px; text-align: left; background: none; border: none;
  border-bottom: 1px solid var(--border); color: var(--text);
  transition: background var(--t-fast);
}
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--surface-2); }
.notif:active { background: var(--surface-3); }
.notif-ico {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px;
  border-radius: 50%; background: var(--surface-2); color: var(--text-3);
}
.notif-ico svg { width: 16px; height: 16px; }
.notif.unseen .notif-ico { background: var(--accent-soft); color: var(--accent); }
.notif-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.notif-title { font-weight: 650; font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.notif.unseen .notif-title { font-weight: 750; }
.notif-body {
  font-size: .8rem; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-time { flex: none; font-size: .72rem; color: var(--text-3); white-space: nowrap; padding-top: 2px; }
.notif-empty {
  display: flex; align-items: flex-start; gap: 10px; padding: 16px 15px;
  font-size: .85rem; color: var(--text-2); line-height: 1.5;
}
.notif-empty svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--text-3); }

/* ============================================================
   EMPTY / ERROR / SKELETON
   ============================================================ */
.empty { text-align: center; padding: 56px 18px; color: var(--text-2); }
.channel-list > .empty, .alert-list > .empty, .alert-list > .alert { grid-column: 1 / -1; }
.empty .emoji {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: var(--r-lg); background: var(--surface-2); font-size: 1.9rem;
}
.empty h3 { margin-bottom: 7px; color: var(--text); font-size: 1.08rem; }
.empty p { max-width: 40ch; margin: 0 auto; font-size: .89rem; }
.empty-actions {
  margin-top: 20px; display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
}
.loadmore { display: flex; justify-content: center; padding: 24px 0 0; }
.loadmore .btn { min-width: 200px; }

.skel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; position: relative;
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-card { display: flex; flex-direction: column; }
.skel-card .sk-media { aspect-ratio: 1; background: var(--surface-2); }
.skel-card .sk-lines { padding: 11px; display: grid; gap: 8px; }
.sk-line { height: 10px; border-radius: 5px; background: var(--surface-2); }
.sk-line.w70 { width: 70%; }
.sk-line.w45 { width: 45%; height: 15px; }
.skel-rail { width: 152px; flex: none; }
.skel-row { height: 68px; border-radius: var(--r-md); }

/* ============================================================
   MODAL / DEAL DETAIL SHEET
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-end; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 7, 15, .6); backdrop-filter: blur(3px); }
.modal-body {
  position: relative; width: 100%; max-height: 92dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-3);
  padding: 0 0 calc(16px + var(--safe-bottom));
  animation: sheet-up var(--t-smooth) var(--ease);
  -webkit-overflow-scrolling: touch;
}
.modal-pad { padding: 0 16px; }
.modal-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.05rem; line-height: 1.35; }
.modal-head .btn { flex: none; }

.detail-hero {
  position: relative; aspect-ratio: 16/10; background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
}
/* Absolutely pinned: a percentage height inside an aspect-ratio grid box
   doesn't resolve reliably, and the photo overflowed on phones. */
.detail-hero img {
  position: absolute; inset: 0; z-index: 1;   /* above the placeholder layer */
  width: 100%; height: 100%; object-fit: contain; padding: 12px; background: var(--media-bg);
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.detail-badges .badge { font-size: .7rem; padding: 5px 10px; border-radius: var(--r-full); }
.detail-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.detail-price .price-now { font-size: 1.9rem; }
.detail-price .price-was { font-size: .95rem; }
.detail-save {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: var(--r-full); background: var(--good-soft); color: var(--good);
  font-size: .82rem; font-weight: 750;
}
.detail-save svg { width: 14px; height: 14px; }
.detail-note {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 11px 13px; border-radius: var(--r-sm); font-size: .84rem; line-height: 1.45;
}
.detail-note.good { background: var(--good-soft); color: var(--good); }
.detail-note.warn { background: var(--warn-soft); color: var(--warn); }
.detail-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* deal-quality meter */
.scorecard {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
  padding: 14px; border-radius: var(--r-md); background: var(--surface-2);
}
.scoredial { position: relative; width: 58px; height: 58px; flex: none; }
.scoredial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.scoredial .track-ring { stroke: var(--border); }
.scoredial .value-ring { stroke: var(--accent); transition: stroke-dashoffset var(--t-page) var(--ease); }
.scoredial b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .95rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.scoretext { min-width: 0; }
.scoretext .st-title { font-weight: 750; font-size: .95rem; }
.scoretext .st-sub { font-size: .8rem; color: var(--text-2); margin-top: 2px; }
.reasons { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 7px; }
.reasons li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .84rem; color: var(--text-2); line-height: 1.45;
}
.reasons svg { width: 15px; height: 15px; flex: none; color: var(--good); margin-top: 2px; }

.kv {
  display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr); gap: 9px 14px;
  font-size: .86rem; margin: 18px 0;
}
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; text-transform: capitalize; }
.kv dd.raw { text-transform: none; }

.detail-cta {
  position: sticky; bottom: 0; z-index: 3;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  margin-top: 8px;
}
.rawpost {
  white-space: pre-wrap; font-size: .8rem; color: var(--text-2);
  margin: 10px 0 0; padding: 12px; border-radius: var(--r-sm);
  background: var(--surface-2); max-height: 240px; overflow-y: auto; font-family: var(--mono);
}
details.raw summary {
  cursor: pointer; font-size: .85rem; color: var(--text-2); padding: 10px 0;
  list-style: none; display: flex; align-items: center; gap: 7px;
}
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--t-normal);
}
details.raw[open] summary::before { transform: rotate(45deg); }

/* price history chart */
.price-chart-wrap { margin: 18px 0 6px; }
.price-chart-title {
  font-size: .74rem; font-weight: 750; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3); margin-bottom: 10px;
}
.price-chart { position: relative; width: 100%; touch-action: pan-y; }
/* stroke: none — the global icon rule would otherwise outline every label
   and the hover rect; chart lines set their own stroke explicitly. */
.price-chart svg { display: block; width: 100%; height: auto; overflow: visible; stroke: none; }
.price-chart-empty {
  padding: 20px 14px; text-align: center; color: var(--text-3);
  font-size: .83rem; background: var(--surface-2); border-radius: var(--r-sm); line-height: 1.5;
}
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; padding: 7px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xs);
  box-shadow: var(--shadow-2); font-size: .78rem; white-space: nowrap; opacity: 0;
  transition: opacity var(--t-fast); transform: translate(-50%, -100%); top: 0; left: 0;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .ct-value { font-weight: 800; font-size: .9rem; color: var(--text); }
.chart-tooltip .ct-date { color: var(--text-3); margin-top: 1px; }

/* ============================================================
   TOASTS
   ============================================================ */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 200;
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 var(--page-pad); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 460px;
  padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-3); font-size: .88rem; font-weight: 550;
  animation: toast-in var(--t-smooth) var(--ease);
  transition: opacity var(--t-normal), transform var(--t-normal);
  pointer-events: auto;
}
.toast .t-ico {
  display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
}
.toast .t-ico svg { width: 13px; height: 13px; stroke-width: 2.6; }
.toast.ok   .t-ico { background: var(--good-soft); color: var(--good); }
.toast.err  .t-ico { background: var(--hot-soft);  color: var(--hot); }
.toast.info .t-ico { background: var(--accent-soft); color: var(--accent); }
.toast span { min-width: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* "Get the app" banner: Android browsers only (initAppBanner in app.js). Sits above the bottom nav, under toasts. */
.app-banner {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 150;
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 10px);
  display: flex; align-items: center; gap: 10px; width: calc(100% - 2 * var(--page-pad)); max-width: 460px;
  padding: 10px 8px 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3);
}
.app-banner img { border-radius: 10px; flex: none; }
.app-banner .ab-text { display: grid; gap: 1px; min-width: 0; flex: 1; font-size: .8rem; color: var(--text-2); }
.app-banner .ab-text b { font-size: .88rem; color: var(--text); }
.app-banner .ab-close {
  flex: none; width: 36px; height: 36px; border-radius: 50%; background: none; border: 0;
  color: var(--text-2); font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* ============================================================
   SORT TABS + VIEW TOGGLE  (one bar, like DesiDime / Amazon)
   ============================================================ */
.sortbar { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s-3); }
.sorttabs {
  flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.sorttabs::-webkit-scrollbar { display: none; }
.sorttabs button {
  flex: none; min-height: 36px; padding: 7px 14px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: .82rem; font-weight: 650; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.sorttabs button:hover { color: var(--text); border-color: var(--border-strong); }
.sorttabs button[aria-selected="true"] {
  background: var(--text); border-color: var(--text); color: var(--bg);
}
.viewtoggle {
  flex: none; display: flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface);
}
.viewtoggle button {
  display: grid; place-items: center; width: 34px; height: 30px; padding: 0;
  border: none; border-radius: var(--r-full); background: none; color: var(--text-3);
}
.viewtoggle button svg { width: 16px; height: 16px; }
.viewtoggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* ---------- list view: photo left, details right ---------- */
.grid.list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.grid.list .deal {
  display: grid; grid-template-columns: 112px minmax(0, 1fr);
  grid-template-rows: 1fr auto; align-items: stretch;
}
.grid.list .deal-media { grid-row: 1 / span 2; aspect-ratio: auto; min-height: 112px; }
.grid.list .deal-body { padding: 11px 12px 6px; }
.grid.list .deal-title { font-size: .9rem; min-height: 0; }
.grid.list .deal-actions { padding: 0 12px 11px; }
.grid.list .deal-actions .btn { min-height: 36px; }
.grid.list .store-tag { display: none; }
.grid.list .badges { top: 6px; left: 6px; }
.grid.list .badge { font-size: .6rem; padding: 2px 6px; }

/* ---------- rail arrows (mouse users can't swipe) ---------- */
.section-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.rail-nav { display: none; gap: 6px; flex: none; }
.rail-nav .iconbtn { width: 34px; height: 34px; }
.rail-nav .iconbtn svg { width: 16px; height: 16px; }
.rail-nav .iconbtn:disabled { opacity: .35; }
@media (hover: hover) and (pointer: fine) {
  .rail-nav { display: flex; }
  /* Hover lift reads as "clickable" with a mouse; on touch it would stick. */
  .deal:hover, .railcard:hover { transform: translateY(-2px); }
}

/* ---------- back to top ---------- */
.totop {
  position: fixed; z-index: 80; right: 16px;
  bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 16px);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-2); animation: rise var(--t-normal) var(--ease);
}
.totop svg { width: 18px; height: 18px; }

/* ---------- login preview (desktop only) ---------- */
.login-preview { display: none; position: relative; margin-top: 28px; height: 150px; }
.lp-card {
  position: absolute; left: 0; top: 0; width: 330px;
  display: flex; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  z-index: 2; animation: rise var(--t-page) var(--ease) 200ms both;
}
.lp-card.lp-back { left: 150px; top: 58px; z-index: 1; opacity: .75; animation-delay: 320ms; }
.lp-media {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: 2rem; background: var(--media-bg);
}
.lp-media .badge { position: absolute; left: 4px; top: 4px; font-size: .5rem; padding: 2px 5px; }
.lp-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lp-title { font-size: .84rem; font-weight: 650; line-height: 1.3; }

/* ---------- deal detail: wide two-column on large screens ---------- */
.detail-layout { display: block; }

/* ============================================================
   RESPONSIVE — phone first, then up
   ============================================================ */

/* Larger phones: a little more air and slightly bigger cards. */
@media (min-width: 400px) {
  :root { --page-pad: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 12px; }
  .railcard { width: 165px; }
  .skel-rail { width: 165px; }
}

/* Large phones / small tablets. */
@media (min-width: 600px) {
  :root { --page-pad: 20px; --appbar-h: 62px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  .railcard, .skel-rail { width: 190px; }
  .radarcard { padding: 18px 20px; }
  .stat-value { font-size: 1.65rem; }
  .deal-title { font-size: .87rem; }
  .price-now { font-size: 1.26rem; }
  .alert-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
  .login-grid { max-width: 600px; }
  .auth-card { padding: 28px; }
  .modal { align-items: center; padding: 24px; }
  .modal-body {
    max-width: 620px; margin: 0 auto; border-radius: var(--r-xl);
    border-bottom: 1px solid var(--border); max-height: 88dvh;
    padding-bottom: 0; animation: rise var(--t-smooth) var(--ease);
  }
  .modal-head { border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .detail-cta { padding-bottom: 12px; }
  .toasts { align-items: flex-end; padding-right: 20px; }
  .toast { width: auto; min-width: 280px; }
  /* A full-bleed bottom sheet looks stretched on a tablet: centre it instead. */
  .filters, .dropdown { max-width: 560px; margin-inline: auto; }
  .grid.list .deal { grid-template-columns: 140px minmax(0, 1fr); }
  .grid.list .deal-media { min-height: 140px; }
}

/* Tablets (iPad portrait and up): one-row app bar with the search inline. */
@media (min-width: 768px) {
  .appbar-row { flex-wrap: nowrap; gap: 14px; }
  .appbar-brand { flex: none; max-width: 230px; }
  .search { order: 0; flex: 1 1 auto; min-width: 0; }
  .channel-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablet / desktop: top navigation returns, filters become a sidebar. */
@media (min-width: 1024px) {
  :root { --page-pad: 24px; }

  .bottomnav { display: none; }
  .topnav { display: flex; }
  .page { padding-bottom: 60px; }
  .toasts { bottom: 22px; }
  .totop { bottom: 24px; right: 24px; }
  .login-preview { display: block; }
  .grid.list { grid-template-columns: minmax(0, 1fr); }
  .alert-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters, .dropdown { max-width: none; margin-inline: 0; }

  /* Mouse users can't swipe, so on desktop the category row wraps instead. */
  .catrow { flex-wrap: wrap; overflow: visible; row-gap: 12px; }
  .cat { flex: 1 1 76px; width: auto; max-width: 120px; }

  .modal-body.wide:has(.has-hero) { max-width: 980px; }
  .modal-body.wide .detail-layout.has-hero {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start;
  }
  .modal-body.wide .detail-hero {
    position: sticky; top: 72px; aspect-ratio: 1; margin: 16px 0 16px 16px;
    border-radius: var(--r-md); background: var(--media-bg);
  }
  .modal-body.wide .detail-hero img { padding: 20px; }
  .modal-body.wide .modal-pad { padding: 0 20px 8px; }

  .appbar-row { flex-wrap: nowrap; gap: 16px; padding: 11px var(--page-pad); }
  .appbar-brand { flex: none; }
  .search { order: 0; flex: 1 1 auto; max-width: 560px; min-width: 0; }
  .search input { height: 44px; }

  /* Account menu returns to a dropdown anchored under the avatar. It stays
     position:fixed (it lives outside the backdrop-filtered app bar) and is
     placed against the viewport instead of a relative parent. */
  .dropdown {
    left: auto; right: var(--page-pad); top: calc(var(--appbar-h) + 6px); bottom: auto;
    width: 262px; padding: 8px; border: 1px solid var(--border);
    border-radius: var(--r-md); border-top-width: 1px;
    animation: rise var(--t-fast) var(--ease);
  }
  .dropdown::before { display: none; }

  .layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 24px; align-items: start; }
  .filters {
    /* z-index drops from the sheet's 125 so the app bar's search dropdown stays on top. */
    position: sticky; z-index: 10; top: calc(var(--appbar-h) + 20px); left: auto; right: auto; bottom: auto;
    transform: none; max-height: calc(100dvh - var(--appbar-h) - 44px);
    border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  }
  .sheet-grab, .filters-toggle, .filters-close, .filter-foot .btn-primary { display: none; }
  .filter-head { padding: 14px 16px 12px; }
  .filter-foot { border-top: none; padding: 4px 16px 14px; }
  .filter-foot .btn { flex: 1; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .channel-list { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
  .page-head-actions { margin-top: 0; flex: none; }
  .page-head-actions .btn { flex: none; min-width: 0; }
  .alert-form-grid { grid-template-columns: 2fr minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
  /* Desktop reflows the same three blocks into two columns: pitch and "why"
     stack on the left, the sign-in card spans both rows on the right. */
  .login-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 24px 50px; max-width: 1080px; align-items: start; align-content: center;
  }
  .login-pitch { grid-column: 1; grid-row: 1; }
  .login-why   { grid-column: 1; grid-row: 2; }
  .login-panel { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .login-view { align-items: center; }
}

@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 16px; }
  .grid.list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .railcard, .skel-rail { width: 210px; }
}

/* Large monitors: use the width instead of floating in a 1440px column. */
@media (min-width: 1600px) {
  .appbar-row, .page, .footer { max-width: 1680px; }
  .layout { grid-template-columns: 288px minmax(0, 1fr); gap: 28px; }
  .grid.list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Landscape phones: the sheet can't be 88dvh of a 380px-tall viewport. */
@media (max-height: 480px) and (orientation: landscape) {
  .filters, .modal-body { max-height: 96dvh; }
  .login-view { align-items: start; }
  .greet-hi { display: none; }
  .appbar-row { padding-block: 6px; }
  .bottomnav, .toasts { padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ============================================================
   Misc structure
   ============================================================ */
.results { min-width: 0; }
.rail-section { margin-bottom: var(--s-2); }
.rail-section .section-head { margin-top: var(--s-5); }
.footer {
  max-width: 1440px; margin: 0 auto; text-align: center;
  padding: 18px var(--page-pad) calc(var(--bottomnav-h) + var(--safe-bottom) + 18px);
}
@media (min-width: 1024px) { .footer { padding-bottom: 28px; } }
.footer:empty { display: none; }

/* First-paint loader — replaced the instant the auth check resolves. */
#boot { min-height: 100dvh; display: grid; place-items: center; gap: 14px; align-content: center; }
#boot .brand-mark { animation: boot-pulse 1.6s var(--ease) infinite; }
@keyframes boot-pulse { 50% { opacity: .45; transform: scale(.94); } }

/* On phones the toolbar is tight: the alert button keeps its icon, drops its label. */
@media (max-width: 599px) {
  .save-search-label { display: none; }
  #btn-save-search { padding-inline: 11px; }
  /* The controls that dismiss a sheet get a full-size target — they are the
     ones people jab at without looking. */
  .filters-close, [data-close], #btn-see-lows { min-height: 44px; }
  /* Fade the clipped edge so the sort chips read as scrollable. */
  .sorttabs {
    -webkit-mask-image: linear-gradient(to right, #000 82%, transparent);
    mask-image: linear-gradient(to right, #000 82%, transparent);
  }
}

/* ============================================================
   Native Android shell (class set by MainActivity's glue script)
   ============================================================ */
:root.dr-native-android body { overscroll-behavior-y: contain; }

.detail-cta { display: grid; gap: 8px; }

/* Public mode visitors: channel picking, alerts and sync need a Telegram
   account, so those controls disappear instead of failing with 401s. */
:root.guest [data-nav="channels"], :root.guest [data-nav="alerts"], :root.guest #btn-sync,
:root.guest #btn-bell, :root.guest #btn-save-search, :root.guest [data-action="logout"],
:root.guest #nav-account .nav-badge { display: none !important; }

/* Visitor header: logo left, search centred and wide, account pinned right.
   With Channels/Alerts gone the lone "Deals" tab is noise, so it goes too. */
:root.guest .topnav { display: none !important; }
@media (min-width: 768px) {
  :root.guest .appbar-row { gap: 20px; }
  :root.guest .appbar-brand { flex: 0 0 auto; }
  :root.guest .search { flex: 1 1 auto; max-width: 720px; margin-inline: auto; }
  :root.guest .appbar-actions { margin-left: auto; }
}

/* ---------- visitor storefront headline ---------- */
.visitor-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px;
  padding: 20px 22px; border-radius: var(--r-lg); border: 1px solid var(--border);
  background:
    radial-gradient(600px 220px at 0% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 200px at 100% 100%, var(--cyan-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-1);
}
.vh-copy { min-width: 0; flex: 1 1 360px; }
.vh-copy h1 { font-size: clamp(1.25rem, 3.2vw, 1.75rem); letter-spacing: -.03em; line-height: 1.2; }
.vh-copy h1 span { color: var(--accent); }
.vh-copy p { margin-top: 6px; color: var(--text-2); font-size: .92rem; max-width: 60ch; }
.vh-stats { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.vh-stats > div { display: flex; flex-direction: column; line-height: 1.15; }
.vh-stats b { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.vh-stats b.up { color: var(--good); }
.vh-stats span { font-size: .72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.vh-stats .vh-live { flex-direction: row; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.vh-stats .vh-live span:last-child { text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--text-2); }
@media (max-width: 599px) {
  .visitor-hero { padding: 16px; }
  .vh-copy p { font-size: .86rem; }
  .vh-stats { gap: 18px; }
  .vh-stats b { font-size: 1.25rem; }
}

/* Past deals from the archive read as history, not live offers */
.archive { margin-top: 28px; padding-top: 6px; border-top: 1px dashed var(--border-strong); }
#archive-grid .deal { opacity: .88; }
#archive-grid .deal .price-now { color: var(--text-2); }

/* Floating "N new deals" pill */
.newdeals {
  position: fixed; z-index: 95; left: 50%; transform: translateX(-50%);
  top: calc(var(--appbar-h) + 12px);
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  font-weight: 700; font-size: .86rem; color: var(--accent-text); border: none;
  background: var(--accent); box-shadow: var(--shadow-3);
  animation: rise var(--t-smooth) var(--ease);
}
.newdeals .livedot { background: var(--hot); }

/* ---------- ♡ save, share, price alert ---------- */
.heart {
  position: absolute; z-index: 3; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--glass-line, var(--border));
  background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--text-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform var(--t-fast) var(--ease), color var(--t-fast), background var(--t-fast);
}
.heart svg { width: 17px; height: 17px; }
.heart:hover { color: var(--hot); transform: scale(1.08); }
.heart.on { color: #fff; background: var(--hot); border-color: transparent; }
.heart.on svg, .btn.on .ico { fill: currentColor; }
.heart.on { animation: pop .35s var(--ease); }
@keyframes pop { 40% { transform: scale(1.25); } }
.grid.list .heart { top: 6px; right: auto; left: 6px; width: 30px; height: 30px; }
.btn.on { color: var(--hot); border-color: color-mix(in srgb, var(--hot) 40%, transparent); }

.deal-actions-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.deal-actions-row .btn { flex: 1; min-width: 120px; }
.pricealert {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
}
.pa-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: .9rem; margin-bottom: 8px; }
.pa-copy span { color: var(--text-2); font-size: .82rem; }
.pa-row { display: flex; align-items: center; gap: 8px; }
.pa-row .input { flex: 1; min-width: 0; min-height: 40px; padding: 8px 12px; }
.pa-cur { font-weight: 800; color: var(--text-2); }
.share-grid { display: grid; gap: 10px; padding: 16px 0; }

/* ---------- richer filters ---------- */
.price-range { display: flex; align-items: center; gap: 8px; }
.price-range .input { min-height: 42px; padding: 9px 12px; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chipset .chip { min-height: 32px; padding: 6px 12px; font-size: .78rem; }
.chipset .chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- good-price meter, store row, check price, similar ---------- */
.verdict { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; padding: 6px 12px;
  border-radius: 999px; font-size: .82rem; font-weight: 750; }
.verdict::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.verdict-great { background: var(--good-soft); color: var(--good); }
.verdict-good  { background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good); }
.verdict-fair  { background: var(--warn-soft); color: var(--warn); }
.verdict-high  { background: var(--hot-soft); color: var(--hot); }
.storerow { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad); }
.storerow::-webkit-scrollbar { display: none; }
.storerow .chip { flex: none; text-transform: none; }
.storerow .chip.active .facet-count { color: inherit; }
.check-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.similar .rail { margin-inline: 0; padding-inline: 0; }

/* "Join our Telegram channel" popup */
.tg-invite { position: relative; padding: 28px 20px 8px; text-align: center; display: grid; gap: 12px; }
.tg-invite h2 { font-size: 1.25rem; }
.tg-invite p { line-height: 1.5; }
.tg-invite-icon {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; background: #229ED9; box-shadow: 0 8px 24px rgba(34, 158, 217, .35);
}
.tg-invite-join { background: #229ED9; color: #fff; justify-content: center; font-weight: 700; }
.tg-invite-join:hover { background: #1c8cc2; }
.tg-invite-later { justify-content: center; }
.tg-invite-close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}

/* ============================================================
   UPCOMING SALES RAIL  (Big Billion Days, Great Indian Festival…)
   ============================================================ */
.salerail { display: flex; gap: 10px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; }
.salerail::-webkit-scrollbar { display: none; }
.salecard {
  flex: none; min-width: 220px; max-width: 260px;
  padding: 12px 14px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
  border: 1px solid var(--accent-line);
  display: flex; flex-direction: column; gap: 4px;
}
.salecard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.salecard-store { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.salecard-when { font-size: .72rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.salecard-name { font-size: .92rem; font-weight: 700; line-height: 1.25; color: var(--text); }
.salecard-hype { font-size: .76rem; color: var(--text-2); line-height: 1.35; }
.salecard-approx { font-size: .68rem; color: var(--text-3); }

/* Admin: upcoming sales editor */
.sale-events-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sale-event-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border);
}
.sale-event-row .sev-main { flex: 1; min-width: 0; }
.sale-event-row .sev-name { font-weight: 700; font-size: .9rem; }
.sale-event-row .sev-meta { font-size: .76rem; color: var(--text-2); margin-top: 2px; }
.sale-event-row .sev-hype { font-size: .76rem; color: var(--text-2); margin-top: 2px; font-style: italic; }
.sev-badge { font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.sev-badge.confirmed { background: var(--accent-soft); color: var(--accent); }
.sev-badge.posted { background: rgba(16,185,129,.15); color: #10b981; }
.sale-event-form { display: flex; flex-direction: column; gap: 8px; }

/* "More offers" under a search: sales & round-ups that aren't deal cards */
.offers { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-top: 8px; }
.offer-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.offer-row:hover { background: var(--surface-2); }
.offer-logo { width: 28px; height: 28px; flex: none; border-radius: 8px; background: #fff; border: 1px solid var(--border); padding: 4px; box-sizing: border-box; object-fit: contain; }
.offer-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.offer-title { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.offer-meta { display: flex; gap: 8px; align-items: baseline; font-size: 11px; color: var(--text-3); letter-spacing: .03em; }
.offer-meta b { font-size: 13px; color: var(--text); letter-spacing: 0; }
.offer-go { color: var(--text-3); }

/* ============================================================
   PAPER & INK — the app's look on the website
   Flat surfaces, hairlines instead of shadows, ink actions,
   orange only for discounts, green only for price drops.
   Last in the file so it wins over the older rules above.
   ============================================================ */
body { font-family: var(--font); background: var(--bg); letter-spacing: -.005em; }
h1, h2, h3, h4 { letter-spacing: -.025em; }
.btn { font-weight: 600; border-radius: var(--r-sm); }
.btn:active:not(:disabled) { transform: none; opacity: .85; }
.btn-soft { background: var(--surface); border-color: var(--border-strong); }
.btn-soft:hover:not(:disabled) { background: var(--surface-2); }
.iconbtn { background: transparent; border: 1px solid var(--border-strong); color: var(--text); box-shadow: none; }
.iconbtn:hover { background: var(--surface-2); }

/* brand */
.brand-mark { width: 30px; height: 30px; border-radius: 0; background: none; box-shadow: none; }
.brand-svg { width: 100%; height: 100%; }
.brand-name { font-weight: 800; letter-spacing: -.04em; }
.brand-name span { color: var(--text); }
.greet-hi { font-family: var(--mono); font-size: .68rem; letter-spacing: .02em; text-transform: uppercase; color: var(--text-3); }
.avatar { background: var(--text); color: var(--bg); border: none; font-weight: 700; }
.bell-dot, .nav-badge { background: var(--hot); }

/* app bar + search: solid paper, a hairline when scrolled */
.appbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.appbar.scrolled { box-shadow: none; border-bottom-color: var(--border); }
.search input { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); }
.search input:focus { border-color: var(--text); box-shadow: none; }
.search:focus-within .search-icon { color: var(--text); }
.search .btn { border-radius: var(--r-sm); }

/* section heads: 18/700 title, mono sub-label like the app */
.section-title { font-size: 1.12rem; font-weight: 700; letter-spacing: -.025em; }
.section-head .section-sub { font-family: var(--mono); font-size: .7rem; letter-spacing: .02em; color: var(--text-3); }

/* status line instead of a dashboard card */
.dropcountdown { background: transparent; border: 0; padding: 0; margin: 8px 0 0; font-family: var(--mono); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .03em; }
.dc-dot { background: var(--good); animation: none; box-shadow: none; }
.dc-time { font-weight: 600; }
.visitor-hero { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 18px 0 16px; box-shadow: none; }
.vh-copy h1 { font-size: clamp(1.5rem, 5.4vw, 2.3rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; max-width: 18ch; }
.vh-copy h1 span { color: inherit; background: none; animation: none; }
.vh-copy p { color: var(--text-2); max-width: 56ch; }
.vh-stats b { font-weight: 800; letter-spacing: -.04em; }
.vh-stats b.up { color: var(--good); }
.vh-stats span { font-family: var(--mono); letter-spacing: .03em; }
.vh-stats .vh-live { background: transparent; border-color: var(--border-strong); }
.vh-live .livedot { box-shadow: none; }
.radarcard { background: var(--surface); box-shadow: none; }
.spotlight { background: var(--surface); }
.spotlight-kicker { color: var(--hot); font-family: var(--mono); font-weight: 600; }
.spotlight-now { color: var(--text); }
.spotlight-badge { background: var(--hot); box-shadow: none; border-radius: 6px; font-family: var(--mono); }
.spotlight-cta { color: var(--text); }

/* categories: text chips (no emoji tiles) */
.catrow { gap: 8px; padding-top: 12px; }
.cat { width: auto; flex-direction: row; padding: 0 14px; height: 36px; border-radius: var(--r-full);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: .84rem; font-weight: 600; }
.cat-icon { display: none; }
.cat-label { max-width: none; overflow: visible; }
.catrow .cat { flex: none; max-width: none; }
.cat.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); font-weight: 600; }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip .store-logo { margin-left: -4px; }
.facet-count { font-family: var(--mono); font-size: .72rem; color: var(--text-3); }
.rcat { background: var(--surface); border-color: var(--border-strong); }
.rcat.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* sort tabs + view toggle */
.sorttabs button { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); font-weight: 600; }
.sorttabs button[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.viewtoggle { background: transparent; border: 1px solid var(--border-strong); }
.viewtoggle button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.toolbar { background: var(--bg); }

/* horizontal rows keep the page gutter when snapped/scrolled */
.salerail, .rail, .catrow, .storerow, .resultcats { scroll-padding-inline: var(--page-pad); }

/* store logo tile (store's own favicon on white) */
.store-logo { flex: none; border-radius: 5px; background: #fff; border: 1px solid var(--border); padding: 1px; object-fit: contain; box-sizing: border-box; }

/* ---------- deal card ---------- */
.deal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: none; }
.deal:hover { border-color: var(--border-strong); box-shadow: none; }
.deal.pressed { transform: none; background: var(--surface-2); }
.deal-media { background: var(--media-bg); border-bottom: 1px solid var(--border); }
.deal-media img, .rail-media img { padding: 10px; background: var(--media-bg); }
.placeholder { background: var(--media-bg); opacity: 1; color: var(--border-strong); font-size: 1.6rem; }
.deal-body { padding: 10px 11px 12px; gap: 5px; cursor: pointer; }
.deal-meta { gap: 6px; flex-wrap: nowrap; font-family: var(--mono); font-size: .66rem; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-3); min-width: 0; }
.deal-meta > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-title { font-size: .88rem; font-weight: 500; line-height: 1.35; min-height: 2.7em; }
.deal-price, .rail-price, .detail-price { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.deal-price { margin-top: 2px; }
.price-now { font-weight: 800; letter-spacing: -.035em; color: var(--text); font-size: 1.12rem; }
.price-was { color: var(--text-3); }
.price-off { background: none; padding: 0; border-radius: 0; color: var(--hot); font-weight: 700; font-size: .78rem; align-self: baseline; }
.coupon { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-2); border-radius: 6px;
  font-family: var(--mono); font-weight: 500; }
.badge { border-radius: 5px; font-size: .64rem; font-weight: 700; letter-spacing: .01em; text-transform: none; }
.badge-low  { background: var(--good); color: #fff; }
.badge-hot  { background: var(--hot); color: #fff; }
.badge-new  { background: var(--text); color: var(--bg); }
.badge-score { background: var(--text); color: var(--bg); backdrop-filter: none; }
.badge-warn { background: var(--warn); color: #fff; }
.sparkline-down polyline { stroke: var(--good); }
.sparkline-up polyline { stroke: var(--hot); }
/* plain heart, no bubble */
.heart { top: 6px; right: 6px; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
  color: var(--text-3); width: 38px; height: 38px; }
.heart svg { width: 19px; height: 19px; }
.heart:hover { color: var(--hot); transform: none; }
.heart.on { background: transparent; color: var(--hot); }
.deal .heart { background: color-mix(in srgb, var(--media-bg) 70%, transparent); border-radius: 50%; }

/* list rows: flat, edge-to-edge, hairline between rows — like the app */
.grid.list { gap: 0; margin-inline: calc(var(--page-pad) * -1); border-top: 1px solid var(--border-strong); }
.grid.list .deal { display: grid; grid-template-columns: 92px minmax(0, 1fr) 40px; gap: 14px; align-items: start;
  border: 0; border-bottom: 1px solid var(--border-strong); border-radius: 0; padding: 14px var(--page-pad); background: transparent; }
.grid.list .deal:hover { background: var(--surface); }
.grid.list .deal-media { grid-row: auto; width: 92px; height: 92px; min-height: 0; aspect-ratio: 1; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); }
.grid.list .deal-media img { padding: 6px; }
.grid.list .deal-body { padding: 0; }
.grid.list .deal-title { font-size: .95rem; min-height: 0; line-height: 1.32; }
.grid.list .badges { top: 4px; left: 4px; }
.grid.list .badge { font-size: .56rem; padding: 2px 5px; }
.grid.list .heart { position: static; margin: -8px -6px 0 0; background: transparent; }
@media (min-width: 700px) {
  .grid.list { margin-inline: 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
  .grid.list .deal:last-child { border-bottom: 0; }
}
#archive-grid .deal { opacity: .9; }

/* ---------- rails ---------- */
.railcard { border: 0; background: transparent; width: 148px; border-radius: 0; }
.railcard:hover { box-shadow: none; }
.railcard:active { transform: none; opacity: .85; }
.railcard .rail-media { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--media-bg); overflow: hidden; }
.railcard .rail-body { padding: 8px 2px 0; gap: 4px; }
.rail-title { font-weight: 500; font-size: .8rem; }
.rail-off { position: absolute; z-index: 2; left: 6px; top: 6px; background: var(--hot); color: #fff; font-family: var(--mono);
  font-size: .62rem; font-weight: 600; padding: 2px 6px; border-radius: 5px; letter-spacing: .02em; }
.rail-foot { display: flex; align-items: center; gap: 5px; min-width: 0; }
.rail-note { font-family: var(--mono); font-weight: 500; font-size: .64rem; letter-spacing: .02em; color: var(--good); }
.rail-note.muted-note { color: var(--text-3); text-transform: uppercase; }

/* ---------- upcoming sales: each store in its own colours ---------- */
.salerail { gap: 12px; padding: 14px 0 4px; scroll-snap-type: x mandatory;
  margin-inline: calc(var(--page-pad) * -1); padding-inline: var(--page-pad); }
.salecard { position: relative; overflow: hidden; flex: none; width: min(84vw, 330px); min-width: 0; max-width: none;
  scroll-snap-align: start; padding: 16px; gap: 6px; border: 0; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; }
.salecard::before, .salecard::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  border: solid rgba(255, 255, 255, .07); }
.salecard::before { right: -40px; top: -40px; width: 150px; height: 150px; border-width: 18px; }
.salecard::after { right: 5px; top: 5px; width: 60px; height: 60px; border-width: 10px; }
.salecard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.salecard-brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.salecard-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; display: grid; place-items: center; flex: none;
  color: var(--c1); font-weight: 800; overflow: hidden; }
.salecard-logo img { width: 24px; height: 24px; object-fit: contain; }
.salecard-store { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; color: rgba(255, 255, 255, .85); font-weight: 500; }
.salecard-when { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.salecard-when.live { background: var(--acc); color: var(--pill-ink); }
.salecard-when i { width: 6px; height: 6px; border-radius: 50%; background: var(--pill-ink); }
.salecard-name { font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; color: #fff; }
.salecard-detail { font-size: .82rem; color: rgba(255, 255, 255, .8); }
.salecard-hype { font-size: .74rem; color: rgba(255, 255, 255, .7); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.salecard-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; position: relative; z-index: 1; }
.salecard-open, .salecard-deals { flex: 1; min-height: 42px; border-radius: var(--r-sm); display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; font-size: .84rem; text-decoration: none; cursor: pointer; }
.salecard-open { background: #fff; color: var(--c1); font-weight: 700; border: 0; }
.salecard-open svg { width: 14px; height: 14px; }
.salecard-deals { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .45); font-weight: 600; }
.salecard-open:hover, .salecard-deals:hover { opacity: .88; }

/* ---------- detail sheet ---------- */
.modal-backdrop { background: var(--overlay); backdrop-filter: none; }
.modal-body { background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow-3); }
.detail-hero { background: var(--media-bg); border: 1px solid var(--border); border-radius: var(--r-lg); }
.detail-meta { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: .7rem; letter-spacing: .03em;
  color: var(--text-3); margin-bottom: 6px; }
.detail-price .price-now { font-size: 1.9rem; }
.detail-price .price-off { font-size: .95rem; }
.detail-save { color: var(--good); background: none; padding: 0; }
.scorecard, .price-chart-wrap, .pricealert { background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
.pricealert { border-color: var(--border-strong); }
.kv dt { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.detail-cta { background: var(--bg); border-top: 1px solid var(--border); }
.verdict-great, .verdict-good { background: var(--good-soft); }

/* ---------- bottom nav, filters, misc chrome ---------- */
.bottomnav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-top: 1px solid var(--border-strong); }
.navbtn { color: var(--text-3); font-weight: 600; }
.navbtn.active { color: var(--text); }
.navbtn::before, .navbtn.active::before { display: none; }
.filters { background: var(--bg); box-shadow: none; }
.dropdown { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); }
.dropdown::before { display: none; }
.empty .emoji { font-size: 0; display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--border-strong); color: var(--text-3); }
.empty .emoji svg { width: 24px; height: 24px; }
.skel, .sk-line, .skel-card .sk-media { background: var(--skeleton); }
.offers { border-top-color: var(--border-strong); }
.offer-row { border-bottom-color: var(--border-strong); }
.offer-meta { font-family: var(--mono); }
.offer-meta b { font-family: var(--font); }

/* our own Telegram channel popup: ink, not blue */
.tg-invite-icon { background: var(--text); color: var(--bg); box-shadow: none; font-size: 0; }
.tg-invite-icon svg { width: 28px; height: 28px; }
.tg-invite-join { background: var(--text); color: var(--bg); }
.tg-invite-join:hover { background: var(--accent-hover); }
.tg-invite-close { display: grid; place-items: center; }
.tg-invite-close svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .salecard, .deal, .railcard { transition: none; }
}
.drop-avatar { background: var(--text); color: var(--bg); font-weight: 700; }
.sheet-backdrop { background: var(--overlay); backdrop-filter: none; -webkit-backdrop-filter: none; }
/* No frosted glass anywhere — solid paper surfaces only. */
*, *::before, *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

.salecard-live { padding: 0; overflow: hidden; display: block; background: var(--surface-2, #eee); }
.salecard-live img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.salecard-live::before, .salecard-live::after { display: none; }
.salecard-live { position: relative; }
.salecard-credit { position: absolute; right: 6px; bottom: 4px; font-size: .62rem; color: #fff; background: rgba(0,0,0,.5); padding: 1px 6px; border-radius: 6px; }
