/* RankSkillX design system — original, vanilla CSS. No external libraries. */
/* Self-hosted fonts pasted from the reference member app's downloaded
 * assets (UI-clone rebuild 2026-11-28): Inter (body/UI, OFL) and
 * Bricolage Grotesque 700 (display headings). No CDN font requests. */
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/inter-400.woff2?v=20261128-7') format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url('/fonts/inter-500.woff2?v=20261128-7') format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url('/fonts/inter-600.woff2?v=20261128-7') format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/inter-700.woff2?v=20261128-7') format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:800;font-display:swap;src:url('/fonts/inter-800.woff2?v=20261128-7') format('woff2')}
@font-face{font-family:'Bricolage Grotesque';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/bricolage-grotesque-700.woff2?v=20261128-7') format('woff2')}
:root{
  /* RankSkillX brand — SkillX colours (see docs/brand/BRAND.md):
     SkillX green #4a701c primary (dark theme), lime #8DC63F accent, dark neutrals.
     Dark theme: black backgrounds, near-white text, white sidebar text. */
  color-scheme:dark;
  --brand:#4a701c; --brand-2:#3d5f16; --brand-3:#2f4d11;
  --lime:#8DC63F; --lime-dark:#6FA32B; --lime-soft:#22350f;
  --accent:#E77E22; --accent-2:#c96a14;
  --lime-text:#aed65f; --lime-bg:#22350f;
  --silver:#C9CDD2; --silver-soft:#232323;
  --bg:#0b0b0b; --card:#171717; --ink:#f2f2f2; --muted:#b9bec7; --faint:#9aa0ab;
  --border:#2b2b2b; --border-strong:#404040;
  --green:#5cc475; --green-bg:#12291a; --red:#b3261e; --red-text:#ff9a8a; --red-bg:#331713;
  --amber:#d9a400; --amber-text:#f0c040; --amber-bg:#2e2505;
  --radius:12px; --radius-sm:8px;
  --shadow:0 1px 2px rgba(0,0,0,.45),0 4px 16px rgba(0,0,0,.4);
  --font:'Inter',system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-display:'Bricolage Grotesque','Inter',system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
/* Light theme (dark is the default): the toggle in the topbar sets
 * data-theme on <html>; the choice is persisted in localStorage.
 * Every surface is restyled through the tokens above plus the
 * hard-coded dark values overridden below — no dark-only colour
 * may leak into light mode. */
html[data-theme="light"]{
  color-scheme:light;
  /* P2 light-mode tokens (cross-check item 16): the copied eRank look —
   * dark-green primary, orange accent, sage disabled, cream header cards.
   * Dark mode keeps the owner's black theme; only these tokens change. */
  --brand:#004936; --brand-2:#003729; --brand-3:#002a1e;
  --accent:#E77E22; --accent-2:#c96a14;
  --sage:#789A8B; --cream:#F3EEE3;
  --lime-dark:#5d8a24; --lime-soft:#e9f2da;
  --lime-text:#004936; --lime-bg:#eef5e2;
  --silver:#5b6068; --silver-soft:#f0f0ee;
  --bg:#FCFDFD; --card:#F2F6F5; --ink:#1d1d1b; --muted:#565b62; --faint:#71767e;
  --border:#e3e3e0; --border-strong:#c9c9c4;
  --green:#2e7d32; --green-bg:#e4f2e6; --red:#b3261e; --red-text:#9c1f18; --red-bg:#fbeae8;
  --amber:#8a6d00; --amber-text:#6b5200; --amber-bg:#fff7e0;
  --shadow:0 1px 2px rgba(0,0,0,.08),0 4px 16px rgba(0,0,0,.08);
}
/* Light mode: the sidebar is eRank green #004936 with white text (cross-check
 * item 16), NOT the old white sidebar; the active item is the #003729 pill
 * (item 7, deferred here from round 20). */
html[data-theme="light"] .sidebar{background:#004936;color:#fff;border-right:none}
html[data-theme="light"] .brand{border-bottom-color:rgba(255,255,255,.12)}
html[data-theme="light"] .brand-name,
html[data-theme="light"] .nav-group-label,
html[data-theme="light"] .nav-link,
html[data-theme="light"] .sidebar-foot{color:#fff}
html[data-theme="light"] .brand-tag{color:rgba(255,255,255,.75)}
html[data-theme="light"] .nav-link:hover{background:rgba(255,255,255,.08);color:#fff}
html[data-theme="light"] .nav-link.is-active{background:#003729;color:#fff}
html[data-theme="light"] .sidebar-foot{border-top-color:rgba(255,255,255,.12)}
html[data-theme="light"] .nav-group-label:hover{background:rgba(255,255,255,.08)}
html[data-theme="light"] .sidebar-shop{border-top-color:rgba(255,255,255,.12)}
html[data-theme="light"] .sidebar-avatar{background:#003729;color:#fff;border-color:rgba(255,255,255,.25)}
html[data-theme="light"] .sidebar-shop-link{color:#fff}
html[data-theme="light"] .nav-divider{border-top-color:rgba(255,255,255,.12)}
html[data-theme="light"] .sidebar-collapse{color:#fff;border-color:rgba(255,255,255,.25)}
html[data-theme="light"] .sidebar-collapse:hover{background:rgba(255,255,255,.08)}
html[data-theme="light"] .sidebar-link{color:#fff}
html[data-theme="light"] .brand-x{color:#8DC63F}
html[data-theme="light"] .sidebar-upgrade{background:var(--accent);color:#fff}
html[data-theme="light"] .sidebar-upgrade:hover{background:var(--accent-2);color:#fff}
html[data-theme="light"] .icon-btn:hover{background:rgba(0,0,0,.06)}
html[data-theme="light"] thead th{background:#eef3e6;color:var(--ink)}
html[data-theme="light"] tbody tr:hover{background:#f4f4f1}
html[data-theme="light"] .bar,
html[data-theme="light"] .meter{background:#e6e6e2}
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input[type="url"],
html[data-theme="light"] select,
html[data-theme="light"] textarea{background:#ffffff}
html[data-theme="light"] .tab-btn,
html[data-theme="light"] .auth-tab{background:#ffffff}
/* Active pills must beat the light-mode white background above: the plain
 * .tab-btn.is-active rule (0,2,0) loses to it (0,2,1), which left the
 * selected "Search" tab (Keyword Tool) and "All-Time" tab (Top Sellers)
 * white-on-white — a blank pill (screenshots 2026-11-28). */
html[data-theme="light"] .tab-btn.is-active,
html[data-theme="light"] .auth-tab.is-active,
html[data-theme="light"] .cat-pill.is-active{background:var(--brand);color:#fff;border-color:var(--brand)}
html[data-theme="light"] .auth-wrap{background:var(--bg)}
html[data-theme="light"] .badge-grey{background:#ececea;color:var(--muted)}
html[data-theme="light"] .tag-chip{background:#f1f1ee}
html[data-theme="light"] .skeleton{background:linear-gradient(90deg,#e8e8e5 25%,#f2f2ef 50%,#e8e8e5 75%)}
html[data-theme="light"] .banner-brand{background:#e9f2da}
/* P2 light-mode tokens, continued (cross-check item 16): white topbar
 * (cards are #F2F6F5 now, so the topbar needs its own white), 14px body,
 * 20px page titles, dark-green link hover, orange accent buttons, sage
 * disabled buttons. */
html[data-theme="light"] .topbar{background:#ffffff}
html[data-theme="light"] body{font-size:14px}
html[data-theme="light"] h1{font-size:1.25rem}
html[data-theme="light"] a:hover{color:#003729}
html[data-theme="light"] .btn-accent{background:var(--accent);color:#fff}
html[data-theme="light"] .btn-accent:hover{background:var(--accent-2);color:#fff}
html[data-theme="light"] .btn:disabled{background:var(--sage);color:#fff;opacity:1;border-color:var(--sage)}
/* Cream header card (cross-check item 16 token; P3 applies it to the
 * Keyword Tool / Listings / Listing Audit header cards). */
.card-cream{background:var(--card)}
html[data-theme="light"] .card-cream{background:var(--cream)}
/* Create Video drop zone: border colour follows the theme tokens instead
 * of hard-coded greens (was #4a701c / #8DC63F inline in JS). */
#vid-drop{border:2px dashed var(--lime)}
#vid-drop.is-dragging{border-color:var(--brand)}
*{box-sizing:border-box}
/* The hidden attribute must win over author display rules: .badge,
 * .topbar-user and .public-signin all set display, which used to keep
 * hidden elements (DEMO badge, Sign-in link, signed-out user cluster)
 * visible. Cross-check P0-2. */
[hidden]{display:none!important}
html{scroll-behavior:smooth}
body{margin:0;font-family:var(--font);background:var(--bg);color:var(--ink);font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4{color:var(--brand);line-height:1.25;margin:0 0 .5rem}
h1,h2{font-family:var(--font-display);letter-spacing:-.01em}
h1{font-size:1.6rem} h2{font-size:1.3rem} h3{font-size:1.05rem}
p{margin:0 0 .75rem}
a{color:var(--lime-text);text-underline-offset:2px}
a:hover{color:var(--lime)}
:focus-visible{outline:3px solid var(--lime);outline-offset:2px;border-radius:4px}
.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip-link{position:absolute;left:12px;top:-60px;z-index:200;background:var(--brand);color:#fff;padding:.6rem 1rem;border-radius:0 0 8px 8px;text-decoration:none;transition:top .15s}
.skip-link:focus{top:0;color:#fff}

/* ---------- Layout ---------- */
.app{display:flex;min-height:100vh}
/* Public pages (Features / Help / Learn / Blog) render without signing in:
 * hide the members navigation and shop controls; the view carries its own
 * sign-in link. The hamburger opens the sidebar, so it must not show in
 * public mode on mobile either — it used to open an empty scrim (round 22). */
body.public-mode .sidebar{display:none}
body.public-mode .menu-btn{display:none}
body.public-mode .topbar-shop,
body.public-mode .topbar-search,
body.public-mode .topbar-user{display:none}
.public-signin{display:none;margin-left:auto}
body.public-mode .public-signin{display:inline-flex}
.brand-logo-img{height:34px;width:auto;display:block}
.auth-brand img{height:56px;width:auto;display:block;margin:0 auto}
.sidebar-upgrade{display:block;margin:0 .6rem .6rem;padding:.55rem .7rem;border-radius:var(--radius-sm);background:var(--lime);color:var(--brand-3);font-weight:700;font-size:.92rem;text-align:center;text-decoration:none}
.sidebar-upgrade:hover{background:#7DB32F;color:var(--brand-3)}
.usage-chip{font-size:.82rem;font-weight:600;color:var(--lime-text);background:var(--lime-soft);border:1px solid var(--border);border-radius:999px;padding:.3rem .7rem;white-space:nowrap}
.char-count{font-size:.82rem;color:var(--muted);margin:.25rem 0 0}
/* Char-count rides in the label row: a <p> below the input made the
 * Keyword-phrase field one line taller than its form-row siblings, and
 * with .form-row{align-items:flex-end} the input sat a line above the
 * Marketplace/Country selects (screenshot 2026-11-28). */
.field label:has(> .char-count){display:flex;justify-content:space-between;align-items:baseline;gap:.5rem}
.field label .char-count{margin:0;font-weight:400}
.kw-tabs{margin-bottom:1rem}
/* Keyword Tool: trend-source toggles, Columns picker, country bars,
 * stat pills and sparklines (live-data pass, 2026-11-28). */
.trend-toggles{display:flex;gap:1rem;flex-wrap:wrap;margin:0 0 .5rem}
.trend-toggles label{display:inline-flex;align-items:center;gap:.35rem;font-size:.9rem;font-weight:600;cursor:pointer}
.trend-toggles input{width:auto}
.kw-columns{position:relative}
.kw-columns summary{list-style:none;cursor:pointer}
.kw-columns summary::-webkit-details-marker{display:none}
.kw-menu-items{position:absolute;right:0;top:calc(100% + .3rem);z-index:40;min-width:200px;background:var(--card);border:1px solid var(--border-strong);border-radius:var(--radius-sm);box-shadow:var(--shadow);padding:.5rem .7rem}
.kw-menu-items label{display:flex;align-items:center;gap:.45rem;padding:.3rem 0;font-size:.9rem;font-weight:400;cursor:pointer}
.kw-menu-items input{width:auto}
.country-bars li{display:flex;align-items:center;gap:.7rem}
.country-bars .country-name{flex:0 0 120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.country-bars .bar{flex:1}
.country-bars strong{flex:0 0 auto;white-space:nowrap}
.spark{color:var(--lime-text);vertical-align:middle}
.kw-stat-pills{display:flex;gap:.6rem;flex-wrap:wrap;margin:0}
.kw-stat-pill{display:inline-flex;flex-direction:column;gap:.1rem;background:var(--silver-soft);border:1px solid var(--border);border-radius:var(--radius-sm);padding:.5rem .8rem}
.kw-stat-pill-label{font-size:.78rem;color:var(--muted);font-weight:600}
.kw-stat-pill strong{font-size:1.05rem}
.usage-note{font-size:.85rem;color:var(--muted);margin:.4rem 0 0}
.health-group{display:flex;justify-content:space-between;gap:.6rem;padding:.45rem 0;border-bottom:1px solid var(--border)}
.health-group:last-child{border-bottom:none}
.checklist{list-style:none;margin:0;padding:0}
.checklist li{display:flex;gap:.6rem;align-items:baseline;padding:.5rem 0;border-bottom:1px solid var(--border)}
.checklist li:last-child{border-bottom:none}
.checklist .check-done{color:var(--green);font-weight:700}
.checklist .check-pending{color:var(--faint);font-weight:700}
.sidebar{width:278px;flex:0 0 278px;background:#000000;color:#ffffff;display:flex;flex-direction:column;position:sticky;top:0;height:100vh;z-index:60}
.brand{display:flex;align-items:center;gap:.6rem;padding:.9rem .9rem .7rem;border-bottom:1px solid rgba(255,255,255,.12)}
.brand-name{display:block;font-weight:800;font-size:1.15rem;color:#fff;letter-spacing:.2px}
.brand-tag{display:block;font-size:.72rem;color:#ffffff}
.sidebar-close{display:none;margin-left:auto;color:#fff}
/* The sidebar never shows a scrollbar at any width: the nav is compact
 * enough to fit without scrolling at normal desktop heights (single-open
 * accordion, tight spacing), and the scrollbar itself is hidden on every
 * engine — the nav still scrolls by wheel/touch on short viewports, so
 * nothing is ever clipped out of reach. */
#nav{flex:1;overflow-y:auto;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none;padding:.6rem .6rem .5rem}
#nav::-webkit-scrollbar{width:0;height:0}
.nav-group{margin:.15rem 0}
.nav-group-label{display:flex;align-items:center;gap:.55rem;width:100%;padding:.45rem .6rem;border:none;background:none;border-radius:var(--radius-sm);color:#ffffff;font:inherit;font-size:.92rem;font-weight:600;cursor:pointer;text-align:left}
.nav-group-label:hover{background:rgba(255,255,255,.08)}
.nav-group-label .nav-label{flex:1}
.nav-chevron{width:16px;height:16px;flex:0 0 16px;transition:transform .15s;opacity:.7}
.nav-group.is-open .nav-chevron{transform:rotate(180deg)}
.nav-sub{display:none}
.nav-group.is-open .nav-sub{display:block}
.nav-sub .nav-link{padding-left:2.15rem}
.nav-icon{width:18px;height:18px;flex:0 0 18px}
.nav-divider{border:none;border-top:1px solid rgba(255,255,255,.12);margin:.6rem .6rem}
.nav-link{display:flex;align-items:center;gap:.55rem;padding:.45rem .6rem;border-radius:var(--radius-sm);color:#ffffff;text-decoration:none;font-size:.92rem}
.nav-link:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-link.is-active{background:var(--brand);color:#fff;font-weight:700}
/* Dark theme: the active item is a darker charcoal pill on the black
 * sidebar (light-mode tokens land with the P2 light-mode round). */
html[data-theme="dark"] .nav-link.is-active{background:#1e1e1e}
.sidebar-shop{display:flex;align-items:center;gap:.6rem;padding:.6rem .9rem;border-top:1px solid rgba(255,255,255,.12)}
/* The shop row is a button that opens an eRank-style pop-up menu
 * (Connect your shop / Log out) above the row. */
.sidebar-shop{position:relative}
.sidebar-shop-btn{display:flex;align-items:center;gap:.6rem;width:100%;padding:0;background:none;border:none;color:#fff;font:inherit;cursor:pointer;text-align:left}
.sidebar-shop-chevron{margin-left:auto;font-size:.65rem;opacity:.7;flex:0 0 auto}
.sidebar-shop-menu{position:absolute;left:.6rem;right:.6rem;bottom:calc(100% + .4rem);background:var(--card);border:1px solid var(--border-strong);border-radius:var(--radius-sm);box-shadow:var(--shadow);padding:.35rem;z-index:80}
.sidebar-shop-menu a,.sidebar-shop-menu button{display:block;width:100%;padding:.5rem .6rem;border:none;background:none;color:var(--ink);font:inherit;font-size:.9rem;font-weight:600;text-align:left;text-decoration:none;cursor:pointer;border-radius:6px}
.sidebar-shop-menu a:hover,.sidebar-shop-menu button:hover{background:var(--silver-soft)}
.sidebar-avatar{width:32px;height:32px;flex:0 0 32px;border-radius:50%;background:#1e1e1e;border:1px solid rgba(255,255,255,.25);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:.95rem}
.sidebar-shop-link{color:#fff;font-size:.9rem;font-weight:600;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sidebar-shop-link:hover{text-decoration:underline}
.sidebar-upgrade .nav-icon{display:none}
.sidebar-collapse{margin:.1rem .6rem .7rem;padding:.4rem;background:none;border:1px solid rgba(255,255,255,.25);border-radius:var(--radius-sm);color:#fff;font-size:1rem;line-height:1;cursor:pointer}
.sidebar-collapse:hover{background:rgba(255,255,255,.08)}
/* Collapsed icon-only rail (~52px) on desktop widths only; the mobile
 * off-canvas sidebar keeps its full width. */
@media (min-width:769px){
  body.sidebar-collapsed .sidebar{width:52px;flex:0 0 52px}
  body.sidebar-collapsed #nav{padding:.6rem .35rem 1rem}
  body.sidebar-collapsed .brand{justify-content:center;padding:.8rem .4rem}
  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .sidebar-foot,
  body.sidebar-collapsed .sidebar-shop-link,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-chevron{display:none}
  body.sidebar-collapsed .nav-group-label,
  body.sidebar-collapsed .nav-link{justify-content:center;padding:.55rem 0}
  /* In the icon rail the open section's sub-links must vanish entirely:
   * their labels are hidden, so without this they rendered as a stack
   * of empty pills under the section icon. */
  body.sidebar-collapsed .nav-sub{display:none}
  body.sidebar-collapsed .nav-sub .nav-link{padding-left:0}
  body.sidebar-collapsed .sidebar-shop{justify-content:center;padding:.7rem .4rem}
  body.sidebar-collapsed .sidebar-shop-chevron{display:none}
  body.sidebar-collapsed .sidebar-shop-btn{justify-content:center}
  body.sidebar-collapsed .sidebar-upgrade{display:flex;align-items:center;justify-content:center;width:36px;height:36px;margin:0 auto .6rem;padding:0;border-radius:50%}
  body.sidebar-collapsed .sidebar-upgrade .nav-icon{display:inline-block}
  body.sidebar-collapsed .sidebar-collapse{display:block;width:36px;margin:.2rem auto .8rem;padding:.4rem 0}
}
.sidebar-foot{padding:.7rem .9rem;border-top:1px solid rgba(255,255,255,.12);font-size:.78rem;color:#ffffff}
.sidebar-foot p{margin-bottom:.4rem}
.sidebar-foot-links{display:flex;gap:.7rem;flex-wrap:wrap;margin-bottom:.4rem}
.sidebar-copy{margin:0;color:rgba(255,255,255,.75)}
.sidebar-link{color:var(--lime);font-weight:600}
.brand-x{color:var(--lime)}
.shell{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;gap:.75rem;min-height:57px;padding:.45rem 1.25rem;background:var(--card);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:50;flex-wrap:wrap}
.topbar-shop{display:flex;align-items:center;gap:.5rem}
.topbar-shop select{min-width:180px}
.topbar-search{flex:1;display:flex;gap:.4rem;min-width:180px;max-width:560px;margin-left:auto}
.topbar-search select{flex:0 0 auto}
.topbar-search #global-market{max-width:86px}
.topbar-search #global-country{max-width:128px}
.topbar-search input{flex:1;min-width:120px}
.topbar-user{display:flex;align-items:center;gap:.5rem}
.shop-sync{display:inline-flex;align-items:center;gap:.45rem}
.sync-state{font-size:.82rem;color:var(--muted);white-space:nowrap}
.menu-btn{display:none}
.view{padding:1.5rem 1.5rem 2rem;max-width:1280px;width:100%;margin:0 auto}
.app-foot{display:flex;justify-content:space-between;align-items:baseline;gap:.25rem 1.5rem;flex-wrap:wrap;padding:1rem 1.5rem;color:var(--faint);font-size:.8rem;border-top:1px solid var(--border)}
.app-foot nav{display:flex;gap:.85rem;flex-wrap:wrap;align-items:baseline}
.app-foot nav a{white-space:nowrap}
/* Floating keyword-list pill (cross-check P1-15): bottom-left on every
 * app page; the count is the seller's saved keyword lists. No chat widget. */
.list-pill{position:fixed;left:1rem;bottom:1rem;z-index:70;display:inline-flex;align-items:center;gap:.35rem;background:var(--brand);color:#fff;font-weight:700;font-size:.85rem;padding:.5rem .9rem;border-radius:999px;text-decoration:none;box-shadow:var(--shadow)}
.list-pill:hover{background:var(--brand-2);color:#fff}
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:55}

/* ---------- Cards, grids, stats ---------- */
.view-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-bottom:1rem}
.view-head p.lede{color:var(--muted);max-width:640px;margin-bottom:0}
.grid{display:grid;gap:1rem}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
/* Wide tables inside grid cards used to force the grid past the viewport
 * (Keyword Tool / Trend Buzz / Top Sellers tables cut off at the right
 * edge, hiding SAVE / KD / YEAR OPENED): grid children must be allowed
 * to shrink below content width, so the table scrolls inside its own
 * .table-wrap instead of pushing the page wider. */
.grid > *{min-width:0}
.card{min-width:0}
.table-wrap{min-width:0}
.table-wrap table{min-width:620px}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:1.1rem 1.2rem}
.card h3{margin-bottom:.35rem}
.card .muted{color:var(--muted);font-size:.88rem}
.stat-num{font-size:1.7rem;font-weight:800;color:var(--brand);line-height:1.1}
.stat-label{font-size:.82rem;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.04em}
.stat-sub{font-size:.82rem;color:var(--muted);margin-top:.2rem}
.section{margin-top:1.5rem}
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-bottom:.6rem}
.kv{display:grid;grid-template-columns:auto 1fr;gap:.25rem .9rem;font-size:.92rem}
.kv dt{color:var(--muted)} .kv dd{margin:0;font-weight:600}
.source-note{font-size:.78rem;color:var(--faint)}
.freshness{font-size:.78rem;color:var(--muted)}
.freshness::before{content:"Updated ";}

/* ---------- Buttons, badges, pills ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;border-radius:var(--radius-sm);border:1px solid transparent;padding:.55rem 1rem;font:inherit;font-size:.92rem;font-weight:600;cursor:pointer;text-decoration:none;background:var(--card);color:var(--ink)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{background:var(--brand);color:#fff}
.btn-primary:hover{background:var(--brand-2);color:#fff}
.btn-accent{background:var(--lime);color:var(--brand-3)}
.btn-accent:hover{background:#7DB32F;color:var(--brand-3)}
.btn-ghost{border-color:var(--border-strong);background:var(--card)}
.btn-ghost:hover{border-color:var(--brand)}
.btn-danger{background:var(--red);color:#fff}
.btn-sm{padding:.35rem .65rem;font-size:.85rem}
.btn-block{width:100%}
.icon-btn{background:none;border:1px solid transparent;border-radius:8px;font-size:1.3rem;line-height:1;padding:.35rem .55rem;cursor:pointer;color:var(--ink)}
.icon-btn:hover{background:rgba(255,255,255,.08)}
.badge{display:inline-flex;align-items:center;gap:.3rem;border-radius:999px;padding:.15rem .6rem;font-size:.75rem;font-weight:700;letter-spacing:.02em;white-space:nowrap}
.badge-demo{background:var(--lime);color:var(--brand-3)}
.badge-green{background:var(--green-bg);color:var(--green)}
.badge-lime{background:var(--lime-bg);color:var(--lime-text)}
.badge-red{background:var(--red-bg);color:var(--red-text)}
.badge-grey{background:#262626;color:var(--muted)}
.badge-brand{background:var(--brand);color:#fff}
.pill{display:inline-block;border-radius:999px;padding:.1rem .55rem;font-size:.78rem;font-weight:700}
.pill-pass{background:var(--green-bg);color:var(--green)}
.pill-fail{background:var(--red-bg);color:var(--red-text)}
.pill-warn{background:var(--lime-bg);color:var(--lime-text)}
.grade{font-size:2.6rem;font-weight:800;color:var(--brand);line-height:1}
.grade-A{color:var(--green)} .grade-B{color:var(--green)} .grade-C{color:var(--lime-text)} .grade-D,.grade-E,.grade-F{color:var(--red-text)}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto;background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.listing-thumb{width:48px;height:48px;object-fit:cover;border-radius:var(--radius-sm);display:block}
.thumb-placeholder{width:48px;height:48px;display:inline-flex;align-items:center;justify-content:center;background:var(--silver-soft);color:var(--faint);font-size:11px;line-height:1.2;text-align:center;border-radius:var(--radius-sm)}
table{width:100%;border-collapse:collapse;font-size:.92rem}
caption{text-align:left;padding:.8rem 1rem;font-weight:700;color:var(--ink)}
th,td{padding:.65rem .8rem;text-align:left;border-bottom:1px solid var(--border);vertical-align:top}
thead th{background:#20261a;color:#fff;font-size:.82rem;text-transform:uppercase;letter-spacing:.03em;white-space:nowrap}
tbody tr:hover{background:#222222}
tbody tr:last-child td{border-bottom:none}
th[aria-sort="ascending"]::after{content:" ↑"}
th[aria-sort="descending"]::after{content:" ↓"}
.sortable{cursor:pointer;background:none;border:none;font:inherit;color:inherit;text-transform:inherit;letter-spacing:inherit;padding:0;text-align:left}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
.row-link{cursor:pointer}
.bar{height:8px;background:#2a2a2a;border-radius:999px;overflow:hidden;min-width:80px}
.bar > span{display:block;height:100%;background:var(--lime)}
.bar-brand > span{background:var(--brand)}

/* ---------- Forms ---------- */
.field{margin-bottom:.9rem}
.field label,.field legend{display:block;font-weight:600;font-size:.9rem;margin-bottom:.3rem;color:var(--lime-text)}
.field .hint{font-size:.82rem;color:var(--muted);font-weight:400}
input[type="text"],input[type="email"],input[type="password"],input[type="number"],input[type="url"],select,textarea{font:inherit;font-size:.95rem;padding:.55rem .7rem;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:#1e1e1e;color:var(--ink);width:100%}
/* Room for the native dropdown chevron so option text never sits under
 * it ("United States" clipped under the chevron in narrow form fields). */
select{padding-right:2rem}
input:focus,select:focus,textarea:focus{outline:3px solid var(--lime);outline-offset:1px;border-color:var(--brand)}
input[aria-invalid="true"],select[aria-invalid="true"],textarea[aria-invalid="true"]{border-color:var(--red)}
textarea{min-height:110px;resize:vertical}
.field-error{color:var(--red-text);font-size:.85rem;margin:.25rem 0 0}
.form-error{background:var(--red-bg);color:var(--red-text);border:1px solid #5a2721;border-radius:var(--radius-sm);padding:.6rem .8rem;font-size:.9rem}
.form-ok{background:var(--green-bg);color:var(--green);border:1px solid #2c4a35;border-radius:var(--radius-sm);padding:.6rem .8rem;font-size:.9rem}
.form-row{display:flex;gap:.8rem;flex-wrap:wrap;align-items:flex-end}
.form-row .field{flex:1;min-width:180px;margin-bottom:0}
/* Keyword Tool search form: the phrase field gets the extra room so its
 * input never squeezes under the Marketplace/Country selects. */
#kw-form .form-row .field:first-child{flex:2 1 220px}
.checkbox-row{display:flex;align-items:center;gap:.45rem;font-size:.92rem}
.checkbox-row input{width:auto}
fieldset{border:1px solid var(--border);border-radius:var(--radius);padding:1rem;margin:0 0 1rem}
legend{font-weight:700;color:var(--lime-text);padding:0 .4rem}

/* ---------- States ---------- */
.empty{padding:2rem 1.2rem;text-align:center;color:var(--muted)}
.empty h3{color:var(--brand)}
.empty .btn{margin-top:.6rem}
.banner{border-radius:var(--radius);padding:.8rem 1rem;margin-bottom:1rem;font-size:.92rem;border:1px solid}
.banner-lime{background:var(--lime-bg);border-color:#3a4a22;color:var(--lime-text)}
.banner-red{background:var(--red-bg);border-color:#5a2721;color:var(--red-text)}
.banner-green{background:var(--green-bg);border-color:#2c4a35;color:var(--green)}
.banner-amber{background:var(--amber-bg);border-color:#8a6d00;color:var(--amber-text)}
.banner-brand{background:#1e2a12;border-color:#3a4a22;color:var(--lime-text)}
/* Lavender alert banner (cross-check P3 items 19–21): light lavender in
 * light mode, muted purple in dark mode. */
.banner-lavender{background:#241f33;border-color:#4a3d6b;color:#d8c8f0}
html[data-theme="light"] .banner-lavender{background:#f1eaf7;border-color:#d9c8ec;color:#4a3a6b}
/* Dark-green pill badge for Trend Buzz metric cells (P3 item 22):
 * brand green in both themes (light #004936, dark olive #4a701c). */
.pill-badge{display:inline-block;background:var(--brand);color:#fff;border-radius:6px;padding:.15rem .5rem;font-weight:600;font-size:.85rem;white-space:nowrap}
/* KD coloured dot + number (P3 item 22). */
.kd-dot{display:inline-flex;align-items:center;gap:.35rem;white-space:nowrap}
.kd-dot i{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none}
.kd-low i{background:var(--green)} .kd-mid i{background:var(--amber)} .kd-high i{background:var(--red)}
/* Trend Buzz rows ~58px tall (P3 item 22). */
.buzz-table td{padding:.85rem .6rem}
.interest-cell{display:flex;align-items:center;gap:.5rem}
.interest-cell .bar{flex:1}
.trend-bars{display:inline-flex;align-items:flex-end;gap:2px;height:24px;margin-right:.45rem;vertical-align:middle}
.trend-bars i{width:3px;background:#B9BEC7;border-radius:1px}
/* Keyword-cell star + drag dots (P3 item 22, decorative only). */
.kw-star{color:var(--faint);margin-right:.4rem;letter-spacing:.1em;white-space:nowrap}
/* Dark-green "Connect your shop" card (P3 items 19, 23): brand green in
 * both themes, white text, orange/lime accent button. */
.card-connect{background:var(--brand);color:#fff}
.card-connect h2{color:#fff}
.card-connect .muted{color:rgba(255,255,255,.82)}
/* Cream header card layout (P3 items 18, 20): title + lede left, quota
 * right; the "How it works" pill toggles a short explainer. */
.kw-head{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start;flex-wrap:wrap}
.kw-head .kw-quota{padding-top:.3rem;text-align:right}
.pill-info{border:1px solid var(--border-strong);color:var(--muted);background:transparent;cursor:pointer}
.pill-info:hover{border-color:var(--brand);color:var(--brand)}
/* Quick Lookup strip (P3 item 23): white in light mode, card colour in dark. */
html[data-theme="light"] .lookup-strip{background:#fff}
.skeleton{border-radius:var(--radius-sm);background:linear-gradient(90deg,#262626 25%,#333333 50%,#262626 75%);background-size:200% 100%;animation:shimmer 1.2s infinite;min-height:1rem}
@keyframes shimmer{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.skeleton{animation:none}}
.toast-region{position:fixed;right:1rem;bottom:1rem;display:flex;flex-direction:column;gap:.5rem;z-index:300;max-width:min(360px,90vw)}
.toast{background:var(--brand);color:#fff;border-radius:var(--radius-sm);padding:.7rem .9rem;box-shadow:var(--shadow);font-size:.9rem;display:flex;justify-content:space-between;gap:.8rem}
.toast-error{background:var(--red)}
.toast button{background:none;border:none;color:#fff;font-size:1.1rem;cursor:pointer}
.tag-chip{display:inline-block;background:#222222;border:1px solid var(--border);border-radius:999px;padding:.15rem .6rem;font-size:.82rem;margin:.15rem .2rem .15rem 0}
/* Compare Listings: the best value in a row gets a subtle tint plus a
   "Best" text badge (never colour alone). --lime-bg is theme-aware. */
td.cmp-best{background:var(--lime-bg);font-weight:600}
.star-btn{background:none;border:none;font-size:1.25rem;cursor:pointer;color:var(--faint);padding:.1rem .3rem}
.star-btn.is-saved{color:var(--lime-dark)}
.star-btn[aria-pressed="true"]{color:var(--lime-dark)}
.tabs{display:flex;gap:.4rem;flex-wrap:wrap;margin-bottom:1rem}
.tab-btn{border:1px solid var(--border-strong);background:#1e1e1e;border-radius:999px;padding:.4rem .9rem;font:inherit;font-size:.9rem;font-weight:600;cursor:pointer;color:var(--ink)}
.tab-btn.is-active{background:var(--brand);color:#fff;border-color:var(--brand)}
.list-plain{list-style:none;margin:0;padding:0}
.list-plain li{padding:.55rem 0;border-bottom:1px solid var(--border)}
.list-plain li:last-child{border-bottom:none}
.issue{display:flex;gap:.7rem;padding:.6rem 0;border-bottom:1px solid var(--border)}
.issue:last-child{border-bottom:none}
.check{font-weight:700}
.check-pass{color:var(--green)} .check-fail{color:var(--red-text)}
.meter{height:10px;background:#2a2a2a;border-radius:999px;overflow:hidden}
.meter > span{display:block;height:100%;background:var(--brand)}
pre.code{background:var(--brand-3);color:#E8ECF3;border-radius:var(--radius-sm);padding:.9rem;overflow-x:auto;font-family:var(--mono);font-size:.85rem}
.steps{counter-reset:step;margin:0;padding-left:0;list-style:none}
.steps li{counter-increment:step;padding:.5rem 0 .5rem 2.4rem;position:relative}
.steps li::before{content:counter(step);position:absolute;left:0;top:.45rem;width:1.7rem;height:1.7rem;border-radius:50%;background:var(--brand);color:#fff;text-align:center;line-height:1.7rem;font-weight:700;font-size:.85rem}

/* ---------- Auth ---------- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1.5rem;background:#000000}
.auth-card{background:var(--card);border-radius:16px;box-shadow:var(--shadow);padding:2rem;width:100%;max-width:420px;text-align:center}
.auth-card h1{margin:.6rem 0 .2rem}
.auth-sub{color:var(--muted);margin-bottom:1.2rem}
.auth-tabs{display:flex;gap:.4rem;margin-bottom:1.2rem}
.auth-tab{flex:1;padding:.55rem;border:1px solid var(--border-strong);background:#1e1e1e;border-radius:var(--radius-sm);font:inherit;font-weight:700;cursor:pointer;color:var(--ink)}
.auth-tab.is-active{background:var(--brand);color:#fff;border-color:var(--brand)}
.auth-card form{text-align:left}
.auth-note{font-size:.82rem;color:var(--muted);margin-top:1rem}
/* Google-only sign-in: the standard white Google button (white in both
 * themes, dark text, multicolour G mark) — the only auth control. */
.btn-google{background:#ffffff;color:#1f1f1f;border:1px solid #dadce0;margin:.4rem 0 .2rem}
.btn-google:hover{background:#f6f6f4;color:#1f1f1f}
.btn-google svg{width:18px;height:18px;flex:0 0 18px}
/* Auth: show/hide password toggle inside the password field. */
.pw-wrap{position:relative}
.pw-wrap input{padding-right:4rem}
.pw-toggle{position:absolute;right:.35rem;top:50%;transform:translateY(-50%);background:none;border:none;border-radius:6px;color:var(--lime-text);font:inherit;font-size:.82rem;font-weight:700;cursor:pointer;padding:.3rem .45rem}
.pw-toggle:hover{background:rgba(255,255,255,.08)}
html[data-theme="light"] .pw-toggle:hover{background:rgba(0,0,0,.06)}
/* The topbar theme toggle is hidden while signed out, so the auth card
 * carries its own. */
.auth-theme-btn{background:none;border:none;padding:0;font:inherit;font-size:.82rem;color:var(--lime-text);cursor:pointer;text-decoration:underline;text-underline-offset:2px}
.auth-theme-btn:hover{color:var(--lime)}

/* ---------- Responsive ---------- */
@media (max-width:1024px){
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .grid-3{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:768px){
  .sidebar{position:fixed;left:0;top:0;transform:translateX(-100%);transition:transform .2s;box-shadow:0 0 40px rgba(0,0,0,.3)}
  .sidebar.is-open{transform:none}
  .sidebar-close{display:inline-block}
  /* The collapse rail only exists at desktop widths (min-width:769px), so
   * the button is a dead control inside the mobile drawer. */
  .sidebar-collapse{display:none}
  .menu-btn{display:inline-block}
  .topbar-search{order:3;flex-basis:100%;max-width:none}
  .view{padding:1rem}
  .grid-3,.grid-2{grid-template-columns:1fr}
}
@media (max-width:480px){
  .grid-4{grid-template-columns:1fr}
  body{font-size:14px}
  .topbar{padding:.6rem .8rem}
  .stat-num{font-size:1.4rem}
  /* Topbar search: the keyword input takes its own full-width row, so the
   * Marketplace + Country selects and the Search button never overflow a
   * ~360px screen (input min-width 120px + selects + button exceeded it). */
  .topbar-search{flex-wrap:wrap}
  .topbar-search input{order:-1;flex:1 1 100%;min-width:0}
  .topbar-shop select{min-width:140px}
  /* Toasts stack above the fixed keyword-list pill instead of over it. */
  .toast-region{bottom:4.25rem}
  .auth-wrap{padding:1rem}
  .auth-card{padding:1.5rem 1.25rem}
}

/* ---------- Print ---------- */
@media print{
  .sidebar,.topbar,.app-foot,.toast-region,.btn,.skip-link,.list-pill{display:none!important}
  body{background:#fff}
  .card,.table-wrap{box-shadow:none;border:1px solid #999}
  .view{max-width:none;padding:0}
}

/* UI-clone dashboard additions (2026-11-28 fix pass, 16-item table) */
.dash-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:1rem;align-items:start}
.dash-main{min-width:0}
.dash-rail{min-width:0}
.dash-rail .section{margin-top:0}
.dash-rail .card{margin-bottom:1rem}
.view-head-actions{display:flex;gap:.5rem;flex-wrap:wrap;align-items:flex-start}
/* Pale beige lookup strip (light: cream; dark: warm dark beige). */
.lookup-strip{background:#f3eee3}
html[data-theme="light"] .lookup-strip{background:#f3eee3}
.lookup-strip input{background:#fff}
.dash-filters{display:flex;gap:.4rem;flex-wrap:wrap;margin-bottom:.8rem}
.cat-pill{border:1px solid var(--border-strong);background:var(--card);border-radius:999px;padding:.35rem .9rem;font:inherit;font-size:.88rem;font-weight:600;cursor:pointer;color:var(--ink);text-decoration:none}
.cat-pill:hover{border-color:var(--brand)}
.cat-pill.is-active{background:var(--brand);color:#fff;border-color:var(--brand)}
.example-panel{background:var(--silver-soft);border:1px dashed var(--border-strong);border-radius:var(--radius-sm);padding:.8rem 1rem;margin-top:.8rem}
.example-panel p{margin:.3rem 0}
.chart-legend{font-size:.82rem;color:var(--muted);margin:.5rem 0 0;text-align:center}
.legend-solid{color:#8DC63F;font-weight:700}
.legend-dashed{color:#789A8B;font-weight:700}
.rail-close{font-size:1.1rem;line-height:1;padding:.1rem .45rem}
.health-group{display:flex;justify-content:space-between;gap:1rem;padding:.45rem 0;border-bottom:1px solid var(--border)}
.health-group:last-of-type{border-bottom:none}
/* Orange Connect button on the connect card, both themes. */
.card-connect .btn-accent{background:#E77E22;color:#fff}
.card-connect .btn-accent:hover{background:#c96a14;color:#fff}
@media (max-width:900px){
  .dash-layout{grid-template-columns:1fr}
  .dash-rail{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:1rem}
  .dash-rail .card{margin-bottom:0}
}
