:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --surface: #fff; --text: #1a1d21; --muted: #6b7280;
  --border: #e5e7eb; --accent: #2563eb; --accent-hover: #1d4ed8;
  --primary: #2563eb;
  --green: #16a34a; --green-bg: #dcfce7; --red: #dc2626; --red-bg: #fee2e2;
  --amber: #d97706; --amber-bg: #fef3c7; --chip: #eef2ff;
  --glass: rgba(255, 255, 255, .72); --glass-border: rgba(229, 231, 235, .7);
  --th-bg: #f9fafb; --row-hover: #f9fafb;
  --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --font-sans: 'Roboto', -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: 'Roboto Serif', Georgia, "Times New Roman", serif;
}
/* Explicit theme choice wins; otherwise follow the OS preference. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --surface: #131c2e; --text: #e8edf5; --muted: #94a3b8;
  --border: #263449; --accent: #2f7cf6; --accent-hover: #3b82f6;
  --primary: #2f7cf6;
  --green: #4ade80; --green-bg: rgba(22, 163, 74, .22); --red: #f87171; --red-bg: rgba(220, 38, 38, .25);
  --amber: #fbbf24; --amber-bg: rgba(217, 119, 6, .22); --chip: #1e3a5f;
  --glass: rgba(19, 28, 46, .72); --glass-border: rgba(38, 52, 73, .7);
  --th-bg: #0f1729; --row-hover: #182238;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220; --surface: #131c2e; --text: #e8edf5; --muted: #94a3b8;
    --border: #263449; --accent: #2f7cf6; --accent-hover: #3b82f6;
    --primary: #2f7cf6;
    --green: #4ade80; --green-bg: rgba(22, 163, 74, .22); --red: #f87171; --red-bg: rgba(220, 38, 38, .25);
    --amber: #fbbf24; --amber-bg: rgba(217, 119, 6, .22); --chip: #1e3a5f;
    --glass: rgba(19, 28, 46, .72); --glass-border: rgba(38, 52, 73, .7);
    --th-bg: #0f1729; --row-hover: #182238;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[readonly], input[disabled] { opacity: .65; cursor: not-allowed; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; font-family: var(--font-display); }
p { margin: 0 0 10px; }

/* header */
header.site { background: var(--glass); backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5); border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; z-index: 50; }
/* header: logo + controls share one row (no wrapping on desktop); the
   search box lives in the nav row, right before the account name. */
.header-inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; }
.logo { font-size: 22px; font-weight: 700; font-family: var(--font-display); color: var(--primary); white-space: nowrap; flex: none; }
.logo img { height: 30px; width: auto; vertical-align: middle; margin-right: 8px; border-radius: 6px; }
.logo:hover { text-decoration: none; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a { padding: 6px 10px; border-radius: 8px; color: var(--text); font-weight: 600; }
nav.main a:hover, nav.main a.active { background: var(--chip); text-decoration: none; }
.search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-wrap input { padding-right: 34px; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); margin-top: 4px; z-index: 60; overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; }
.suggest button:hover { background: var(--chip); }
.suggest .stype { color: var(--muted); font-size: 12px; margin-inline-end: 6px; }
.header-controls { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; flex: none; }
.header-controls select { width: auto; padding: 6px 8px; }
/* header account menu: logged-in users see their account name; the
   dropdown holds the account functions. Click (not hover) toggles it,
   so it works on touch screens too; an outside click or Escape closes
   it. inset-inline-end keeps the menu under the button in RTL too. */
.account-menu { position: relative; }
.account-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; }
.account-btn .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .caret { font-size: 11px; transition: transform .15s ease; flex: none; }
.account-menu.open .account-btn .caret { transform: rotate(180deg); }
.account-dropdown { display: none; position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 190px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 70; }
.account-menu.open .account-dropdown { display: block; }
.account-dropdown a, .account-dropdown button { display: block; width: 100%; text-align: start; padding: 8px 12px; border: 0; border-radius: 6px; background: none; color: var(--text); font-weight: 600; font-size: 14px; }
.account-dropdown a:hover, .account-dropdown button:hover { background: var(--chip); text-decoration: none; }
.account-dropdown .menu-sep { border-top: 1px solid var(--border); margin: 6px 4px; }
.account-dropdown #logoutBtn { color: var(--red); }
/* account page sections linked from the header menu: keep clear of the
   sticky header when scrolled into view. */
#acct-profile, #acct-subscriptions, #acct-notifications, #acct-password, #acct-bindings { scroll-margin-top: 70px; }
/* account page: bind/unbind rows (email code + provider proof). */
.bind-panel label { display: block; margin: 0 0 6px; font-weight: 600; }
.bind-code-row { display: flex; gap: 8px; align-items: center; }
.bind-code-row input { max-width: 180px; flex: none; }
.bind-code-row .btn { flex: none; }
.bind-msg { margin-top: 8px; }
.bind-hint { margin: 10px 0; }
/* search box in the nav row, immediately before the account name
   (username menu); the suggestion dropdown stays anchored to
   .search-wrap. Logged-out users have no account menu, so the search
   just sits at the right end of the nav row. */
.nav-bar .search-wrap { flex: 0 1 300px; min-width: 180px; }
.nav-bar .search-wrap input { padding: 6px 34px 6px 10px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; text-align: center; }
/* .btn.small was used in markup but never defined, so "small" buttons
   rendered full-size. Small = tighter padding + smaller text. */
.btn.small { padding: 6px 12px; font-size: 13.5px; }
.btn:hover { text-decoration: none; background: var(--row-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.buy { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.buy:hover { background: var(--accent-hover); }
.btn.out { background: var(--red); border-color: var(--red); color: #fff; cursor: not-allowed; opacity: .85; }
.btn.sub { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.btn.sub.active { background: var(--accent); color: #fff; }
.btn.tg { background: #229ed9; border-color: #229ed9; color: #fff; }
.btn.tg:hover { background: #1b8ac0; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* layout */
main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }
.hero { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border-radius: var(--radius); padding: 28px 24px; margin-bottom: 20px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; color: #fff; }
.hero p { opacity: .9; margin: 0; }
/* banner carousel */
.hero.carousel { position: relative; overflow: hidden; height: 300px; padding: 0; }
.hero.carousel .slides { position: absolute; inset: 0; }
.hero.carousel .slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .8s ease; }
.hero.carousel .slide.active { opacity: 1; }
.hero-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; padding: 28px 56px; background: linear-gradient(90deg, rgba(2, 10, 30, .72), rgba(2, 10, 30, .35) 55%, rgba(2, 10, 30, .08)); pointer-events: none; }
.hero-overlay h1 { font-size: 30px; text-shadow: 0 2px 12px rgba(0, 0, 0, .55); }
.hero-overlay p { font-size: 16px; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 24px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0 0 2px; }
.carousel-arrow:hover { background: rgba(0, 0, 0, .65); }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }
.carousel-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; }
.carousel-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, .5); cursor: pointer; }
.carousel-dots button.active { background: #fff; width: 26px; border-radius: 5px; }
/* homepage order: header (logo) / banner / nav menu + search + account / cards / footer */
.hero-wrap { max-width: 1240px; margin: 0 auto; padding: 20px 16px 16px; }
.hero-wrap .hero { margin-bottom: 0; }
.nav-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
/* nav row: tags on the left, account area on the right, same row. The
   logged-in account name (with its dropdown) lives here, not in the
   header; the logged-out login button stays in the header. */
.nav-bar-inner { max-width: 1240px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.nav-bar nav.main { flex: 1 1 auto; min-width: 0; }
#navAuthLinks { flex: none; margin-inline-start: auto; display: flex; align-items: center; }
.stats { display: flex; gap: 16px; margin: 20px 0; flex-wrap: wrap; }
.stat { flex: 1; min-width: 140px; background: var(--glass); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat b { font-size: 28px; display: block; color: var(--primary); font-family: var(--font-display); }
.stat span { font-size: 13px; color: var(--muted); }
.section { margin: 28px 0 8px; }
.section h2 { font-size: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head a { font-size: 14px; font-weight: 600; white-space: nowrap; }
.muted { color: var(--muted); }
.notice { background: var(--amber-bg); border: 1px solid #fcd34d; color: #92400e; padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.error { background: var(--red-bg); border: 1px solid #fca5a5; color: #991b1b; padding: 10px 14px; border-radius: 10px; margin: 12px 0; }
.success { background: var(--green-bg); border: 1px solid #86efac; color: #166534; padding: 10px 14px; border-radius: 10px; margin: 12px 0; }

/* product grid / cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { position: relative; background: var(--glass); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card:hover { border-color: #c7d2fe; }
.card-row1 { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.provider-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #f3f4f6; border: 1px solid var(--border); flex: none; }
.provider-logo-fallback { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex: none; }
.provider-name { font-weight: 800; font-size: 16px; }
/* merchant tag on a card: logo on top, name below; clicking it toggles
   the card's detail popover (provider info + product details). */
.provider-tag { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; border-radius: 8px; min-width: 0; }
.provider-tag .provider-name { font-size: 14px; text-align: center; line-height: 1.2; }
.provider-tag:hover .provider-name, .provider-tag:focus-visible .provider-name { text-decoration: underline; }
.provider-tag:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.badge.region { background: #e0e7ff; color: #3730a3; }
.spec-ic { display: inline-flex; align-items: center; gap: 5px; }
.spec-ic svg { width: 15px; height: 15px; flex: none; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-inline-start: auto; white-space: nowrap; }
.badge.premium { background: #fef3c7; color: #92400e; }
.badge.in { background: var(--green-bg); color: var(--green); }
.badge.out { background: var(--red-bg); color: var(--red); }
.badge.delisted { background: #e5e7eb; color: #6b7280; }
.badge.archive { background: #fef3c7; color: #92400e; }
.badge.unknown { background: #e5e7eb; color: #374151; }
.card h3 { margin: 0; font-size: 17px; }
.card h3 a { color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.tag { background: var(--chip); color: #3730a3; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13.5px; }
.specs div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #f0f0f0; padding: 2px 0; }
.specs span:first-child { color: var(--muted); }
.locs { font-size: 13px; color: var(--muted); }
.price { display: flex; align-items: baseline; gap: 10px; margin-top: auto; }
.price .m { font-size: 22px; font-weight: 800; color: var(--accent); }
.price .y { font-size: 14px; color: var(--muted); }
.price .orig { font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }
.card-actions .btn.tg { flex: 0 0 auto; }
/* Product cards only (the detail page keeps the old stretched buttons):
   small action buttons pinned to the bottom-right corner, in order
   buy / subscribe / Telegram. margin-top:auto keeps them at the card
   bottom even when the price block is hidden by card-field settings. */
.card .card-actions { justify-content: flex-end; flex-wrap: wrap; margin-top: auto; }
.card .card-actions .btn { flex: 0 0 auto; }
.rank-chip { font-weight: 800; color: var(--accent); font-size: 15px; flex: none; }
.compare-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.compare-check input { width: auto; }

/* hover detail popover: shown by JS (.popover-open) after a short delay,
   or immediately for keyboard users via :focus-within. Sits below the card
   so it never covers the card's action buttons. */
.popover { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px; font-size: 13.5px; }
.card.popover-open .popover, .card:focus-within .popover { display: block; }
.popover h4 { margin: 0 0 8px; font-size: 14px; }
.popover .specs { grid-template-columns: 1fr 1fr; }
/* provider info inside the hover popovers (card popover + shared list-row
   popover): name, description, website, in-stock count, Telegram entry. */
.pop-provider { border-bottom: 1px dashed var(--border); padding-bottom: 10px; margin-bottom: 10px; }
.pop-provider-head { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.pop-provider-head a { color: var(--text); }
.pop-provider-desc { margin: 0 0 8px; font-size: 13px; }
.pop-provider-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; }
.pop-provider-meta span { color: var(--muted); }
#providerPop { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 14px 16px; font-size: 13.5px; }
#providerPop .pop-provider { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }

/* table view */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: middle; }
table.list th { background: var(--th-bg); font-size: 13px; color: var(--muted); white-space: nowrap; }
table.list tr:hover td { background: var(--row-hover); }
.table-scroll { overflow-x: auto; }

/* filters */
.layout { display: flex; gap: 20px; align-items: flex-start; }
.filters { width: 250px; flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.filters h3 { font-size: 15px; margin-bottom: 4px; }
.filter-group { margin: 14px 0; }
.filter-group > b { display: block; font-size: 13px; margin-bottom: 6px; }
.filter-group label { display: flex; gap: 6px; align-items: center; font-size: 13.5px; padding: 2px 0; }
.filter-group input[type=checkbox] { width: auto; }
.filter-group input[type=number] { width: 90px; padding: 5px 8px; }
.results { flex: 1; min-width: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-toggle button { border: 0; background: var(--surface); padding: 7px 12px; font-weight: 600; }
.view-toggle button.active { background: var(--accent); color: #fff; }

/* providers */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.provider-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.provider-card .head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.provider-card .head img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: #f3f4f6; }
.stars { color: #f59e0b; letter-spacing: 1px; }

/* detail / ranking */
.detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.detail .head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.detail .head img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 24px; margin: 18px 0; font-size: 14.5px; }
.kv div { display: flex; justify-content: space-between; border-bottom: 1px dashed #eee; padding: 4px 0; }
.kv span:first-child { color: var(--muted); }
.rank-item { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.rank-num { font-size: 22px; font-weight: 800; width: 34px; text-align: center; color: var(--accent); flex: none; }

/* forms / admin */
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 560px; margin: 0 auto; box-shadow: var(--shadow); }
.form label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
.form .row { display: flex; gap: 10px; }
.form .row > * { flex: 1; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.admin-tabs button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; }
.admin-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Admin left sidebar navigation (desktop); falls back to a horizontal tab
   row on narrow screens. The settings sub-tabs keep .admin-tabs. */
.admin-layout { display: flex; gap: 20px; align-items: flex-start; }
.admin-sidebar { display: flex; flex-direction: column; gap: 6px; width: 180px; flex-shrink: 0; position: sticky; top: 16px; }
.admin-sidebar button { text-align: left; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; }
.admin-sidebar button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin-content { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .admin-layout { flex-direction: column; gap: 12px; }
  .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; position: static; }
}
.admin-tabs.sub-tabs { margin: 0 0 14px; }
.admin-tabs.sub-tabs button { padding: 6px 12px; font-size: 13.5px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
table.admin { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.admin th, table.admin td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; vertical-align: top; }
table.admin input, table.admin select { padding: 5px 7px; font-size: 13.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; }

/* compare */
.compare-tray { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 80; background: #111827; color: #fff; border-radius: 12px; padding: 10px 16px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: calc(100vw - 32px); flex-wrap: wrap; }
.compare-tray .btn { border-color: #374151; background: #1f2937; color: #fff; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.compare-table th, .compare-table td { border: 1px solid var(--border); padding: 10px; text-align: left; font-size: 14px; vertical-align: top; }
.compare-table th { background: var(--th-bg); }
td.diff { background: #fef9c3; font-weight: 700; }

footer.site { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 16px 20px; color: var(--muted); font-size: 13.5px; }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer-inner h3 { font-size: 15px; color: var(--text); margin-bottom: 10px; }
.footer-inner ul { list-style: none; margin: 0; padding: 0; }
.footer-inner li { margin: 6px 0; }
.footer-brand .logo { font-size: 20px; }
.footer-bottom { max-width: 1240px; margin: 22px auto 0; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; font-size: 12.5px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 22px 0; }
.pagination button { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-weight: 600; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .filters { width: 100%; position: static; max-height: none; }
  /* Narrow screens may wrap the header: logo stays on its own row, the
     controls wrap below it instead of squeezing the site name away. */
  .header-inner { gap: 8px; flex-wrap: wrap; }
  .header-controls { flex-wrap: wrap; }
  /* Narrow screens may wrap the nav row: tags first, the search takes
     its own full-width line, the account menu drops to its own line,
     still right-aligned. */
  .nav-bar-inner { flex-wrap: wrap; }
  .nav-bar .search-wrap { flex: 1 1 100%; min-width: 0; }
  /* long account names (often an email) must not push the header out */
  .account-btn { max-width: 150px; }
  .hero h1 { font-size: 21px; }
  .hero.carousel { height: 210px; }
  .hero-overlay { padding: 20px 44px; }
  .hero-overlay h1 { font-size: 21px; }
  .hero-overlay p { font-size: 13.5px; }
  .carousel-arrow { width: 32px; height: 32px; font-size: 20px; }
  .footer-inner { grid-template-columns: 1fr; }
}
[dir="rtl"] .header-controls { margin-inline-start: 0; margin-inline-end: auto; }

/* tag library: custom tags as selectable chips in one box.
   Click toggles selection (multi); double-click renames inline. */
.tag-chip-box { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.tag-chip { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 14px; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip input { width: 120px; padding: 2px 6px; }
/* card display settings: draggable field rows (drag on desktop,
   ↑/↓ buttons on touch). The row order is the card spec-row order. */
#cardFieldsList { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.card-field-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.card-field-row.dragging { opacity: .5; }
.card-field-row.drag-over { border-top: 2px solid var(--accent); }
.card-field-row .drag-handle { cursor: grab; color: var(--muted); font-size: 16px; line-height: 1; flex: none; user-select: none; }
.card-field-row .drag-handle:active { cursor: grabbing; }
.card-field-row label { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; margin: 0; font-weight: 600; cursor: pointer; }
.card-field-row label input { width: auto; }
.card-field-row .row-movers { display: flex; gap: 4px; flex: none; }
/* merchant-grouped products: breadcrumb above a provider product group */
.admin-crumb { margin: 0 0 10px; font-size: 13.5px; color: var(--muted, #6b7280); }
.admin-crumb a { font-weight: 600; }
