/* ==========================================================================
   BrandHub Monitor — internal admin theme
   Single source of visual truth for all EJS templates.
   Fonts are loaded via <link> tags in the layout <head> (see THEME_NOTES.md);
   the @import below is a fallback if the <link> tags are missing.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* Licensed asset (Zetafonts, "Codec Pro") -- self-hosted, not a Google Font. This
   is the same family dev.app.brandhub.ai's own UI uses, so this is a real typeface
   match ahead of integrating with it, not just a similar-looking substitute. */
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Extrabold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* "Codec Pro Warm" is a separate stylistic sub-family (its own internal font name,
   not just a style of "Codec Pro" above) -- only its Extra Bold Italic cut is on
   hand. Kept distinct from the upright family; see .accent-codec below for where
   it's actually applied. */
@font-face {
  font-family: 'Codec Pro Warm';
  src: url('/fonts/CodecProWarm-ExtraBoldItalic.woff2') format('woff2'),
       url('/fonts/CodecProWarm-ExtraBoldItalic.woff') format('woff');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand navy (dark chrome: rail, tab bar, login backdrop) -- #191928 matches
     dev.app.brandhub.ai's own dark chrome (`bg-primary`) exactly, sampled directly
     from the live app ahead of integrating with it. */
  --navy-900: #191928;   /* base chrome background */
  --navy-800: #232335;   /* raised dark surface / hover */
  --navy-700: #2d2d42;   /* borders & dividers on dark */
  --navy-300: #9a9aa8;   /* muted text on dark */
  --navy-100: #e6e6ec;   /* primary text on dark */

  /* Brand mint (primary accent — actions, "safe", active nav) */
  --mint-500: #00e68e;   /* brand accent: buttons, active markers -- BrandHub's `secondary` */
  --mint-600: #00cf80;   /* hover fill */
  --mint-700: #177e45;   /* accessible mint: text/icons/focus on light bg (5:1 on white) */
  --mint-100: #e2f9eb;   /* mint tint: pill bg, selected rows */
  --mint-050: #f2fcf6;   /* faintest tint: row hover */
  /* Exact literal color of "One Place." on dev.app.brandhub.ai (`text-secondary`,
     sampled directly via computed style) -- brighter/less contrast-adjusted than
     --mint-700. Use only for a direct 1:1 match to their own brand text (e.g. our
     tagline echoing theirs); --mint-700 remains the accessible default everywhere
     else. */
  --mint-signature: #00e68e;

  /* Light working surface -- #f4f6ff matches dev.app.brandhub.ai's `bg-lightgrey`
     content background exactly. */
  --surface-page: #f4f6ff;   /* app background behind cards/tables */
  --surface-card: #ffffff;   /* cards, table bodies, inputs */
  --surface-sunken: #ededf0; /* wells, disabled inputs, thead */

  /* Ink (text on light) */
  --ink-900: #15151f;    /* headings, primary text (mirrors navy) */
  --ink-600: #6b6b76;    /* secondary/body-muted text */
  --ink-700: #55555f;    /* small labels / table headers on tinted backgrounds (AA at 12px) */
  --ink-400: #80808c;    /* placeholders, disabled text (raised from #9c9ca6 for contrast) */
  --line-300: #dcdce2;   /* borders on light */
  --line-200: #e9e9ee;   /* hairlines, table row dividers */

  /* Danger — the one deliberate non-brand hue: warm vermilion, not pure red */
  --danger-600: #c03d21; /* text, borders, destructive buttons */
  --danger-500: #d64933; /* hover/accents */
  --danger-100: #fbe7e1; /* tint bg for counterfeit pills / error fields */

  /* Warning amber — "needs review" middle state */
  --amber-700: #8a5a12;  /* text on amber tint */
  --amber-500: #d99a1b;  /* icons/borders */
  --amber-100: #faf0d8;  /* tint bg */

  /* Typography -- Codec Pro is the real dev.app.brandhub.ai typeface (self-hosted
     above, weights 400/700/800 only); Lexend/Inter remain as the fallback stack for
     any weight Codec Pro doesn't cover and for the brief window before it loads. */
  --font-display: 'Codec Pro', 'Lexend', 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Codec Pro', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-xs: 0.75rem;    /* 12px — pills, table meta */
  --text-sm: 0.8125rem;  /* 13px — table cells, helper text */
  --text-base: 0.875rem; /* 14px — app default (dense admin) */
  --text-md: 1rem;       /* 16px — inputs, emphasized body */
  --text-lg: 1.125rem;   /* 18px — card titles */
  --text-xl: 1.5rem;     /* 24px — page titles */
  --text-2xl: 2rem;      /* 32px — login/hero moments */

  /* Spacing (compact 4px scale for a data-dense tool) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* Radius — brand uses small, confident rounding */
  --radius-sm: 4px;      /* pills' inner elements, inputs option */
  --radius: 6px;         /* buttons, inputs, cards */
  --radius-lg: 12px;     /* cards, modals -- BrandHub's Card component */
  --radius-pill: 999px;  /* buttons and tab pills (dev.app.brandhub.ai treatment) */

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(21, 21, 31, 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* Tailwind shadow-md, as BrandHub */
  --shadow-lg: 0 8px 24px rgba(21, 21, 31, 0.16);

  /* Chrome */
  --focus-ring: 0 0 0 3px rgba(23, 126, 69, 0.35);
  --transition: 160ms ease-out;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-900);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 var(--sp-3);
}
h1 { font-size: 2rem; font-weight: 500; color: #111827; letter-spacing: -0.01em; } /* BrandHub page titles */
h2 { font-size: var(--text-lg); font-weight: 700; }
h3 { font-size: var(--text-md); font-weight: 600; }
h4 { font-size: var(--text-base); font-weight: 600; }

p { margin: 0 0 var(--sp-3); }
.text-muted { color: var(--ink-600); }
.text-small { font-size: var(--text-sm); }

/* Decorative accent only -- the one CodecPro cut on hand is Extra Bold Italic
   (old-style figures), not the upright weight dev.app.brandhub.ai's own UI text
   uses. Not applied anywhere by default; opt in per-element where an italic
   flourish actually fits (e.g. a hero moment), not for body copy or dense UI text. */
.accent-codec {
  font-family: 'Codec Pro Warm', var(--font-display);
  font-weight: 800;
  font-style: italic;
}

a {
  color: var(--mint-700);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* --------------------------------------------------------------------------
   3. App shell -- BrandHub web's own frame
   Measured from brandhub-web (PageContainer, LeftSidebar, NavBar, ProfileMenu,
   HomePage tabs) so Protect reads as part of app.brandhub.ai, not a second site:
   100px #191928 rail, 80px #F4F6FF top bar with shadow-md, the "Your Brands. /
   One Place." mark, Availability Explorer, the Protect item, bell, profile menu,
   and the dark segmented tab bar at the top of the page body.
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 16px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink-900);
  font-weight: 700;
}
.skip-link:focus { left: 108px; }

.app {
  display: flex;
  min-height: 100dvh;
}

.rail {
  width: 100px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--navy-900);
  position: sticky;
  top: 0;
  height: 100dvh;
}
.rail-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 8px;
}
.rail-logo img { width: 41px; height: 54px; object-fit: contain; }

/* Pinned tiles, as BrandHub pins brands: white 48px tile, initials, tiny label. */
.rail-pins {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.rail-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  margin: 8px 8px 16px;
  flex-shrink: 0;
  color: #dbeafe;
  text-decoration: none;
}
.rail-pin:hover { text-decoration: none; }
.rail-pin-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  transition: box-shadow var(--transition);
}
.rail-pin:hover .rail-pin-tile { box-shadow: 0 0 0 2px var(--mint-signature); }
.rail-pin-label {
  max-width: 80px;
  margin-top: 6px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--navy-100);
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-spacer { flex: 1; }
.rail-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 8px 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: var(--mint-signature);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: background var(--transition);
}
.rail-fab:hover { background: var(--navy-800); text-decoration: none; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-page);
}

.hi { width: 20px; height: 20px; flex-shrink: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  height: 80px;
  padding: 0 12px 0 22px;
  background: var(--surface-page);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.topbar-brand {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  padding: 0 8px;
  min-width: 160px;
}
.topbar-mark {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 28px;
  text-decoration: none;
}
.topbar-mark:hover { text-decoration: none; }
.topbar-title { color: var(--navy-900); }
.topbar-tagline { color: var(--mint-signature); } /* BrandHub's exact brand mark colour */
.topbar-back {
  display: inline-flex;
  margin: 40px 0 0 8px;
  padding: 0;
  color: #6b7280;
  line-height: 0;
}
.topbar-back .hi { width: 18px; height: 18px; }
.topbar-back:hover { color: var(--navy-900); }

.topbar-search { flex: 1; min-width: 0; padding: 0 16px; }
.search-pill {
  display: flex;
  align-items: center;
  width: 354px;
  max-width: 100%;
  padding: 4px;
  border-radius: 8px;
  background: #ffffff;
  transition: box-shadow var(--transition);
}
.search-pill:focus-within { box-shadow: var(--focus-ring); }
.topbar-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: #111827;
}
.topbar-search input:focus-visible { outline: none; box-shadow: none; }
.search-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background: var(--surface-page);
  color: #4b5563;
  cursor: pointer;
  transition: background var(--transition);
}
.search-icon-btn:hover { background: #f3f4f6; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 8px;
}
.topbar-explorer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-width: 202px;
  margin-right: 16px;
  padding: 10px 20px;
  border: 1px solid var(--navy-900); /* sampled from app.test.brandhub.ai */
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy-900);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color var(--transition);
}
.topbar-explorer:hover { background: var(--surface-page); text-decoration: none; }
.topbar-protect {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-right: 12px;
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  text-decoration: none;
}
.topbar-protect .hi { width: 32px; height: 32px; }
.topbar-protect:hover,
.topbar-protect.active { color: var(--mint-signature); text-decoration: none; }

.topbar-bell {
  position: relative;
  display: inline-flex;
  margin-right: 8px;
  color: var(--navy-900);
  border-radius: 8px;
}
.topbar-bell .hi { width: 40px; height: 40px; }
.topbar-bell:hover,
.topbar-bell.active { color: var(--mint-700); text-decoration: none; }
.bell-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--mint-signature);
  color: #111827; /* BrandHub uses white (1.6:1); dark keeps the count readable */
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.profile-menu { position: relative; }
.profile-menu summary {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:focus-visible { box-shadow: var(--focus-ring); }
.profile-id { display: none; flex-direction: column; text-align: right; line-height: 1.25; }
.profile-name { font-size: 16px; font-weight: 700; text-transform: capitalize; color: var(--navy-900); }
.profile-email { font-size: 12px; text-transform: lowercase; color: var(--ink-600); }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--navy-900);
  font-size: 14px;
  font-weight: 700;
}
.profile-menu .chevron { width: 20px; height: 20px; color: var(--navy-900); transition: transform var(--transition); }
.profile-menu[open] .chevron { transform: rotate(180deg); }
/* Wide screens add the person's name beside the circle when BrandHub gave us one. */
@media (min-width: 1280px) {
  .profile-menu.has-name .profile-id { display: flex; }
}
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 220px;
  padding: 4px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1), 0 0 0 1px rgb(0 0 0 / 0.05);
}
.profile-dropdown-head {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--ink-600);
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-dropdown a,
.profile-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--navy-900);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.profile-dropdown a:hover,
.profile-dropdown button:hover { background: var(--mint-100); text-decoration: none; }
.profile-dropdown form { margin: 0; }

/* Dark segmented tabs -- BrandHub's Customers | Orders bar. */
.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 12px;
  background: var(--navy-900);
}
.tab {
  flex: 1 1 auto;
  padding: 10px 14px;
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.tab:hover { background: rgba(255, 255, 255, 0.12); color: #ffffff; text-decoration: none; }
.tab.active {
  background: #ffffff;
  color: var(--navy-900);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
.tab.active:hover { background: #ffffff; }
.tab:focus-visible { box-shadow: 0 0 0 2px var(--mint-signature); }

.content {
  flex: 1;
  padding: 12px 16px 32px;
  max-width: 1440px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-header h1 { margin-bottom: var(--sp-1); }
.page-header .page-sub {
  color: #676767;
  font-size: 14px;
  font-weight: 400;
  margin: 0;
}
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

@media (max-width: 1100px) {
  .topbar-explorer { min-width: 0; margin-right: 4px; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .rail { width: 100%; height: auto; position: static; flex-direction: row; justify-content: space-between; padding: 0 8px; }
  .rail-logo { width: 48px; height: 48px; margin: 4px; }
  .rail-logo img { width: 30px; height: 40px; }
  .rail-fab { margin: 4px; width: 40px; height: 40px; font-size: 24px; }
  .rail-pins { flex-direction: row; overflow-x: auto; overflow-y: visible; padding: 0 8px; }
  .rail-pin { width: 56px; margin: 4px; }
  .rail-pin-tile { width: 36px; height: 36px; font-size: 15px; }
  .topbar { position: static; flex-wrap: wrap; height: auto; padding: 12px; row-gap: 12px; }
  .topbar-back { margin-top: 30px; }
  .topbar-explorer { display: none; }
  .topbar-actions { margin-left: auto; }
  .topbar-search { order: 3; flex-basis: 100%; padding: 0 8px; }
  .search-pill { width: 100%; }
  .tabbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tab { flex: 0 0 auto; }
  .content { padding: 12px; }
}
@media (max-width: 480px) {
  .topbar-protect span { display: none; }
  .topbar-bell .hi { width: 32px; height: 32px; }
}

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: 8px; /* BrandHub's Button */
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn:disabled:hover, .btn[aria-disabled='true']:hover { background: inherit; }
.btn svg { width: 16px; height: 16px; stroke-width: 1.75; }

/* Primary -- BrandHub's filled `secondary` button ("Open full dashboard"):
   #00E68E, no border, black text. */
.btn-primary {
  background: var(--mint-500);
  border-color: var(--mint-500);
  color: #000000; /* 12:1 on #00E68E */
  font-weight: 600;
}
.btn-primary:hover { background: var(--mint-600); }
.btn-primary:active { background: var(--mint-600); box-shadow: var(--focus-ring); }

/* Secondary -- BrandHub's outlined button ("Download latest report"): white, navy
   text, a 1px border in the text colour at 75%. */
.btn-secondary {
  background: var(--surface-card);
  color: var(--navy-900);
  font-weight: 500;
  border-color: rgb(25 25 40 / 0.75);
}
.btn-secondary:hover {
  border-color: var(--navy-900);
  background: var(--surface-page);
}

/* Destructive — the deliberate non-brand vermilion; use sparingly */
.btn-danger {
  background: var(--danger-600);
  color: #ffffff;
}
.btn-danger:hover { background: var(--danger-500); }

/* Ghost variant of danger for less-final actions (e.g. Dismiss) */
.btn-danger-outline {
  background: transparent;
  color: var(--danger-600);
  border-color: var(--danger-600);
}
.btn-danger-outline:hover { background: var(--danger-100); }

/* Sizes */
.btn-sm {
  min-height: 30px;
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-sm);
}
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   5. Status pills
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.6;
}
/* Dot supplements color so state isn't conveyed by hue alone */
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pill-counterfeit {
  background: #fee2e2;
  color: #b91c1c;
}
.pill-review {
  background: #fef3c7;
  color: #92400e;
}
.pill-legitimate {
  background: #dcfce7;
  color: #15803d;
}
/* Neutral pill for job states (queued, running, done) */
.pill-neutral {
  background: var(--surface-sunken);
  color: var(--ink-600);
  border-color: var(--line-300);
}

/* Marketplace pills -- one accent color per source so a scan down the column
   reads at a glance, same "dot + label" pattern as the verdict/status pills. */
.pill-marketplace-amazon {
  background: #fef3e2;
  color: #9a6400;
  border-color: rgba(154, 100, 0, 0.35);
}
.pill-marketplace-facebook_marketplace {
  background: #e8f0fe;
  color: #1456c9;
  border-color: rgba(20, 86, 201, 0.35);
}
.pill-marketplace-gumtree {
  background: #e6f7ec;
  color: #147a3d;
  border-color: rgba(20, 122, 61, 0.35);
}
.pill-marketplace-aliexpress {
  background: #fde8e8;
  color: #c0301f;
  border-color: rgba(192, 48, 31, 0.35);
}
.pill-marketplace-alibaba {
  background: #fff1e0;
  color: #b4530a;
  border-color: rgba(180, 83, 10, 0.35);
}

/* Social/web platform pills -- same pattern, one accent color per source. */
.pill-platform-instagram {
  background: #fce4f1;
  color: #a3195b;
  border-color: rgba(163, 25, 91, 0.35);
}
.pill-platform-twitter {
  background: #e8f0fe;
  color: #1456c9;
  border-color: rgba(20, 86, 201, 0.35);
}
.pill-platform-youtube {
  background: #fde8e8;
  color: #c0301f;
  border-color: rgba(192, 48, 31, 0.35);
}
.pill-platform-google {
  background: #fef3e2;
  color: #9a6400;
  border-color: rgba(154, 100, 0, 0.35);
}
.pill-platform-tiktok {
  background: #ececec;
  color: #333333;
  border-color: rgba(51, 51, 51, 0.35);
}
.pill-platform-domain {
  background: #e6f4ea;
  color: #1e7b34;
  border-color: rgba(30, 123, 52, 0.35);
}

/* --------------------------------------------------------------------------
   6. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  background: var(--surface-card);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  position: sticky;
  top: 0;
  background: var(--surface-card);
  color: #676767;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line-300);
  white-space: nowrap;
}
.table th.sortable {
  cursor: pointer;
  user-select: none;
}
.table th.sortable:hover { color: var(--ink-900); }
.table th.sortable::after {
  content: '\2195'; /* up-down arrow affordance */
  margin-left: 6px;
  opacity: 0.45;
}
.table th[aria-sort='ascending']::after { content: '\2191'; opacity: 1; color: var(--mint-700); }
.table th[aria-sort='descending']::after { content: '\2193'; opacity: 1; color: var(--mint-700); }

.table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line-200);
  color: var(--ink-900);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr.row-link:hover, .table tbody tr.row-link:focus-within { background: var(--mint-050); }
.table tbody tr.row-link:focus-within { box-shadow: inset 3px 0 0 var(--mint-700); }
.table tbody tr.row-link { cursor: pointer; }
.table td.cell-muted { color: var(--ink-600); }
.table td.cell-num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.table td.cell-actions {
  text-align: right;
  white-space: nowrap;
}
.table th.cell-pin, .table td.cell-pin { width: 32px; padding-right: 0; }

/* Per-user favourites toggle (see PinnedClient) -- a small circular "+"/checkmark
   button on each client row, independent of the client's own active/inactive
   status. Uses --mint-signature (dev.app.brandhub.ai's exact brand green) rather
   than --mint-700 since this is the same "quick add" affordance as the rail FAB. */
.pin-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line-300);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink-600);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.pin-toggle:hover { border-color: var(--mint-signature); color: var(--mint-signature); }
.pin-toggle.pinned {
  background: var(--mint-signature);
  border-color: var(--mint-signature);
  color: var(--navy-900);
}
.pin-toggle.pinned:hover { background: var(--danger-100); border-color: var(--danger-600); color: var(--danger-600); }

/* Empty state inside a table wrap or card */
.empty-state {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--ink-600);
}
.empty-state h3, .empty-state .empty-title { color: var(--ink-900); font-weight: 600; font-size: var(--text-md); margin-bottom: var(--sp-1); }

/* --------------------------------------------------------------------------
   7. Forms
   -------------------------------------------------------------------------- */
.form-group { margin-bottom: var(--sp-4); }

.form-label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-900);
}
.form-label .required {
  color: var(--danger-600);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--text-md); /* 16px — avoids iOS zoom, comfortable to read */
  color: var(--ink-900);
  background: var(--surface-card);
  border: 1px solid var(--line-300);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-textarea { min-height: 96px; resize: vertical; }
.form-input::placeholder,
.form-textarea::placeholder { color: var(--ink-400); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--mint-700);
  box-shadow: var(--focus-ring);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--surface-sunken);
  color: var(--ink-400);
  cursor: not-allowed;
}

.form-help {
  margin-top: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--ink-600);
}

/* Validation */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--danger-600);
}
.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(192, 61, 33, 0.25);
}
.form-error {
  margin-top: var(--sp-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--danger-600);
}

/* Inline field rows (filters above tables) */
.form-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }

/* Login page — full dark-brand backdrop, echoes the marketing hero */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: var(--navy-900);
  /* layered muted half-circles, echoing brandhub.ai hero geometry */
  background-image:
    radial-gradient(circle at 85% 20%, rgba(94, 221, 140, 0.10) 0 180px, transparent 181px),
    radial-gradient(circle at 10% 85%, rgba(94, 221, 140, 0.05) 0 260px, transparent 261px),
    radial-gradient(circle at 70% 90%, rgba(154, 154, 168, 0.08) 0 200px, transparent 201px);
}
/* The "Rev" (light/white) logo variant needs a dark background, but the card
   below it is white -- so the logo sits on the dark page backdrop instead. */
.login-logo-img {
  display: block;
  width: 220px;
  height: auto;
  margin-bottom: var(--sp-5);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
}
.login-card .login-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-1);
}
.login-card .login-brand em { font-style: normal; color: var(--mint-700); }
.login-card .login-sub {
  color: var(--ink-600);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-5);
}

/* Form-level alert (e.g. "Invalid credentials", flash messages) */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
}
.alert-error {
  background: var(--danger-100);
  border-color: rgba(192, 61, 33, 0.35);
  color: var(--danger-600);
}
.alert-success {
  background: var(--mint-100);
  border-color: rgba(23, 126, 69, 0.35);
  color: var(--mint-700);
}
.alert-warning {
  background: var(--amber-100);
  border-color: rgba(217, 154, 27, 0.45);
  color: var(--amber-700);
}

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface-card);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.card-header h2,
.card-header h3 { margin: 0; }
.card-body { padding: 20px; }
.card-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line-200);
  background: var(--surface-page);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Summary tiles -- TM Watch report totals (see brands/tmWatch.ejs). */
.stat-box {
  border: 1px solid var(--line-300);
  border-radius: var(--radius);
  padding: var(--sp-3);
  text-align: center;
}
.stat-box .num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-box .label { font-size: var(--text-sm); color: var(--ink-600); margin-top: 4px; }

/* KPI stat card for dashboard home */
.stat-card { padding: var(--sp-4); }
.stat-card { padding: 20px; }
.stat-card .stat-label {
  font-size: 14px;
  font-weight: 400;
  color: #676767;
  margin-bottom: var(--sp-1);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: #111827;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-value.stat-alert { color: var(--danger-600); }
.stat-card .stat-value.stat-good { color: var(--mint-700); }
.stat-card.row-link { cursor: pointer; transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.stat-card.row-link:hover { border-color: var(--mint-700); box-shadow: var(--shadow-sm); }

/* Card grid helper */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

/* --------------------------------------------------------------------------
   9. Review-queue detail
   -------------------------------------------------------------------------- */
.review-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 1000px) {
  .review-layout { grid-template-columns: 1fr; }
}

.listing-media {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--surface-sunken);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line-200);
}

.listing-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-1) var(--sp-4);
  font-size: var(--text-sm);
}
.listing-meta dt { color: var(--ink-600); font-weight: 500; }
.listing-meta dd { margin: 0; overflow-wrap: anywhere; }

/* AI rationale block — mint accent bar signals "machine assessment" */
.ai-rationale {
  border-left: 3px solid var(--mint-500);
  background: var(--mint-050);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--ink-900);
}
.ai-rationale .ai-rationale-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mint-700);
  margin-bottom: var(--sp-2);
}
.ai-rationale .confidence {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Action bar: approve / dismiss / escalate */
.review-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line-200);
  margin-top: var(--sp-4);
}
.review-actions .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   10. Small utilities (kept deliberately minimal)
   -------------------------------------------------------------------------- */
.flex { display: flex; flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
/* Stacked cards always breathe, whether or not a template remembered a margin class. */
.card + .card, .card + details.card, details.card + .card { margin-top: var(--sp-5); }
/* ...but not cards laid out side by side in a grid (dashboard / seller stat cards). */
.card-grid > .card, .review-layout > .card { margin-top: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Counterfeit Risk Engine (review/show.ejs panel, review/index.ejs chip).
   Bands reuse the verdict hues: danger = high, amber = medium, mint = low.
   -------------------------------------------------------------------------- */
.risk-panel {
  --risk-fg: var(--mint-700);
  --risk-bg: var(--mint-050);
  border: 1px solid var(--line-200);
  border-left: 3px solid var(--risk-fg);
  background: var(--risk-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.risk-panel.risk-medium { --risk-fg: var(--amber-700); --risk-bg: var(--amber-100); }
.risk-panel.risk-high { --risk-fg: var(--danger-600); --risk-bg: var(--danger-100); }
.risk-head { display: flex; align-items: baseline; gap: var(--sp-2); }
.risk-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-600);
}
.risk-score {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--risk-fg);
  font-variant-numeric: tabular-nums;
}
.risk-score small { font-size: var(--text-sm); font-weight: 400; color: var(--ink-600); }
.risk-band {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--risk-fg);
}
.risk-meter {
  height: 6px;
  margin-top: var(--sp-2);
  border-radius: 3px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.risk-meter span { display: block; height: 100%; background: var(--risk-fg); border-radius: 3px; }
.risk-signals { list-style: none; margin: var(--sp-3) 0 0; padding: 0; font-size: var(--text-sm); }
.risk-signals li { display: flex; gap: var(--sp-2); padding: 3px 0; }
.risk-weight {
  flex: 0 0 2.5em;
  text-align: right;
  font-weight: 700;
  color: var(--risk-fg);
  font-variant-numeric: tabular-nums;
}
.risk-chip {
  display: inline-block;
  min-width: 2.2em;
  padding: 1px 6px;
  border-radius: 999px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--mint-700);
  background: var(--mint-100);
}
.risk-chip.risk-medium { color: var(--amber-700); background: var(--amber-100); }
.risk-chip.risk-high { color: var(--danger-600); background: var(--danger-100); }

/* --------------------------------------------------------------------------
   Client-mark highlighting (see clientMarks.service.js). Registrations held by one
   of our own clients are colour-coded in the brand's navy chrome + mint accent --
   deliberately outside the RED/AMBER/GREEN risk hues, so "this is ours" can never
   be misread as a level of threat.
   -------------------------------------------------------------------------- */
.pill-client {
  background: var(--navy-900);
  color: var(--mint-500);
  border-color: var(--navy-900);
}
tr.row-client td { background: var(--surface-page); }
tr.row-client td:first-child { box-shadow: inset 3px 0 0 var(--navy-900); }
.client-tag { color: var(--navy-900); font-weight: 600; margin-top: 2px; }
.client-tag a { color: inherit; }
.stat-box.stat-client { border-color: var(--navy-900); background: var(--navy-900); }
.stat-box.stat-client .num { color: var(--mint-500); }
.stat-box.stat-client .label { color: var(--navy-100); }
.client-marks {
  border: 1px solid var(--line-300);
  border-left: 3px solid var(--navy-900);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-page);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
}
.client-marks-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.client-marks ul { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.client-marks li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); padding: 3px 0; }
/* Unconfirmed client match: same navy, outlined -- "probably ours, not yet confirmed". */
.pill-client-pending {
  background: transparent;
  color: var(--navy-900);
  border: 1px dashed var(--navy-900);
}
.reg-group-title { font-size: var(--text-md); margin: var(--sp-3) 0 var(--sp-1); }
.reg-alert {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--danger-100);
  color: var(--danger-600);
  font-size: var(--text-sm);
}
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--mint-700);
  text-decoration: underline;
  cursor: pointer;
}
.shadow-risk { font-size: var(--text-xs); color: var(--ink-600); margin-top: 3px; }
/* Client registrations table (clients/show.ejs): five columns that wrap instead of
   forcing a horizontal scroll that hid the Confirm / Not ours actions. */
.reg-table { width: 100%; }
.reg-table td { vertical-align: top; }
.reg-table .reg-mark { font-weight: 600; }
.reg-table .reg-id { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: var(--text-sm); }
.reg-table td.cell-actions { white-space: nowrap; text-align: right; }
.reg-table td.cell-actions form + form { margin-left: 4px; }
/* Login: "Keep me signed in" (auth/login.ejs) */
.remember-me { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--sp-4); font-size: var(--text-sm); color: var(--ink-600); cursor: pointer; }
.remember-me input { width: 16px; height: 16px; accent-color: var(--mint-700); }
/* Forgot / reset password pages (auth/*.ejs) */
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.auth-link { font-size: var(--text-sm); color: var(--mint-700); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-title { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--sp-3); }
.auth-footer { margin: var(--sp-4) 0 0; text-align: center; }
/* Error pages (errors/*.ejs) */
.error-card { text-align: center; padding: var(--sp-6); max-width: 560px; margin: var(--sp-6) auto; }
.error-card h1 { margin-bottom: var(--sp-2); }
.error-card .btn { margin-top: var(--sp-3); }
.risk-details { margin: 0 0 var(--sp-3); }
.risk-details summary { cursor: pointer; font-size: var(--text-sm); color: var(--mint-700); margin-bottom: var(--sp-2); }
/* Product photos & image search (brands/show.ejs, lens/show.ejs) */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
.ref-tile { border: 1px solid var(--line-300); border-radius: var(--radius); padding: var(--sp-2); background: var(--surface-card); }
.ref-tile img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-page); border-radius: calc(var(--radius) - 2px); }
.ref-label { font-size: var(--text-sm); font-weight: 600; margin: 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.ref-actions .btn { white-space: nowrap; }
.lens-thumb { width: 56px; height: 56px; object-fit: contain; border-radius: 6px; background: var(--surface-page); flex-shrink: 0; }
.lens-match { display: flex; gap: 10px; align-items: flex-start; }
.lens-reasons { margin: 4px 0 0; padding: 0; list-style: none; font-size: var(--text-xs); color: var(--ink-600); }
.lens-reasons li::before { content: "• "; }
.lens-source { width: 220px; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line-300); background: var(--surface-page); }

/* --------------------------------------------------------------------------
   Reports & alerts (clients/show.ejs), notifications bell + page.
   -------------------------------------------------------------------------- */
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 46px; height: 26px; cursor: pointer; }
.switch.small { width: 40px; height: 22px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: inherit; }
.switch .slider { position: absolute; inset: 0; border-radius: 999px; background: var(--line-300); transition: background var(--transition); }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--transition); }
.switch.small .slider::after { width: 16px; height: 16px; }
.switch input:checked + .slider { background: var(--mint-600); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch.small input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--mint-700); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .slider { opacity: .55; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line-200); }
.settings-form > .setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-row.compact { padding: var(--sp-2) 0; border-top: 1px dashed var(--line-200); }
.setting-title { font-weight: 600; }
.setting-hint { font-size: var(--text-sm); color: var(--ink-600); }
.setting-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: 0 0 var(--sp-3) var(--sp-4); transition: opacity var(--transition); }
.setting-sub.setting-list { display: block; }
.setting-sub.is-off { opacity: .45; }
.segmented { display: inline-flex; border: 1px solid var(--line-300); border-radius: 999px; padding: 2px; background: var(--surface-page); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-600); }
.segmented input:checked + span { background: var(--mint-600); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--mint-700); }
.save-status { min-width: 6em; text-align: right; color: var(--mint-700); }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--line-200); }
.notification:first-child { border-top: 0; }
.notification.is-new { background: linear-gradient(90deg, var(--mint-050), transparent 60%); }
.notification-type { flex: 0 0 150px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; color: var(--ink-600); }
.notification-type.type-counterfeit { color: var(--danger-600); }
.notification-type.type-tm_watch { color: var(--amber-700); }
.notification-type.type-image_search { color: var(--amber-700); } /* red is kept for likely counterfeits */
.notification-type.type-registration { color: var(--navy-900); }
.notification-title { font-weight: 600; }
@media (max-width: 640px) { .notification { flex-direction: column; gap: 4px; } .notification-type { flex-basis: auto; } }
/* Image scan (lens/scan.ejs) */
.scan-progress { display: flex; align-items: center; gap: 10px; margin: 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-300); border-top-color: var(--mint-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.scan-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-3); }
.scan-photo { display: flex; flex-direction: column; gap: 6px; padding: var(--sp-2); border: 1px solid var(--line-300); border-radius: var(--radius); color: inherit; text-decoration: none; background: var(--surface-card); }
.scan-photo:hover { border-color: var(--mint-600); text-decoration: none; }
.scan-photo img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-page); border-radius: 6px; }
.scan-photo-label { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-photo .pill { align-self: flex-start; }
.image-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.image-tools details { margin-left: auto; }
.image-tools details[open] .confirm-box { display: flex; }
.confirm-box { display: none; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--danger-500); border-radius: var(--radius); background: var(--danger-100); font-size: var(--text-sm); }

/* Manage photos: click a tile to select it. */
.photo-pick { position: relative; cursor: pointer; display: block; }
.photo-pick .photo-check { position: absolute; top: calc(var(--sp-2) + 6px); left: calc(var(--sp-2) + 6px); width: 20px; height: 20px; accent-color: var(--brand-600, #16a34a); }
.photo-pick.is-selected { outline: 3px solid var(--brand-500, #22c55e); outline-offset: -1px; }
.photo-removed img { opacity: 0.55; }
.photo-toolbar { position: sticky; top: 0; z-index: 5; }

/* Small "*" that shows an explanation bubble on hover, keyboard focus or tap. */
.info-star { position: relative; display: inline-flex; align-items: center; justify-content: center; align-self: center; width: 22px; height: 22px; margin-left: -2px; border-radius: 50%; color: var(--mint-700); font-weight: 700; font-size: var(--text-md); line-height: 1; cursor: help; user-select: none; }
.info-star:hover, .info-star:focus-visible { background: var(--mint-100); outline: none; }
.info-star:focus-visible { box-shadow: 0 0 0 2px var(--mint-500); }
.info-bubble { position: absolute; bottom: calc(100% + 10px); right: -8px; z-index: 20; width: max-content; max-width: 280px; padding: 8px 12px; border-radius: var(--radius); background: var(--ink-900); color: #fff; font-size: var(--text-sm); font-weight: 400; line-height: 1.45; text-align: left; box-shadow: 0 6px 18px rgba(21, 21, 31, 0.18); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s; pointer-events: none; }
.info-bubble strong { color: var(--mint-500); font-weight: 600; }
.info-bubble::after { content: ''; position: absolute; top: 100%; right: 14px; border: 6px solid transparent; border-top-color: var(--ink-900); }
.info-star:hover .info-bubble, .info-star:focus .info-bubble, .info-star:focus-within .info-bubble { opacity: 1; visibility: visible; transform: translateY(0); }

/* --------------------------------------------------------------------------
   Touch screens and narrow windows: finger-sized targets (UI/UX Pro Max:
   >=44px, 8px apart). The dense desktop layout is unchanged.
   -------------------------------------------------------------------------- */
@media (pointer: coarse), (max-width: 860px) {
  .btn, .btn-sm, .topbar-logout { min-height: 44px; }
  .btn-sm { padding: var(--sp-2) var(--sp-3); }
  .topbar-logout { padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .tab { min-height: 44px; display: inline-flex; align-items: center; }
  .tabbar { gap: var(--sp-2); }
  .search-icon-btn { width: 44px; height: 40px; }
  .topbar-search input { min-height: 40px; }
    .form-input, .form-select { min-height: 44px; }
  .pin-toggle { width: 44px; height: 44px; font-size: 16px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  .switch { position: relative; }
  .switch::before { content: ''; position: absolute; inset: -9px; }
  .link-button, summary, td a, .table a, .notification a, .page-sub a { display: inline-flex; align-items: center; min-height: 44px; }
  .info-star { width: 44px; height: 44px; }
  .page-actions, .cell-actions, .ref-actions, .image-tools { gap: var(--sp-2); }
  .cell-actions form { display: inline-block; margin: 2px; }
}

/* --------------------------------------------------------------------------
   Polish pass (UI/UX Pro Max + Fable review, 2026-10-06)
   -------------------------------------------------------------------------- */
/* Focus must be visible on the dark navy chrome too. */
.tab:focus-visible, .rail-logo:focus-visible, .rail-fab:focus-visible, .rail-pin:focus-visible { box-shadow: 0 0 0 3px var(--mint-500); outline: none; }

/* Small uppercase labels: darker ink for AA contrast. */
.table th, .stat-label, .risk-label { color: var(--ink-700); }

/* Risk 0-29 reads neutral, not "legitimate" green. */
.risk-chip:not(.risk-medium):not(.risk-high) { color: var(--ink-700); background: var(--surface-sunken); }

/* A table that's the only thing in a card shouldn't draw a second frame. */
.card-body > .table-wrap:only-child { border: 0; box-shadow: none; border-radius: 0; margin: calc(-1 * var(--sp-4)); width: auto; }

/* Native controls in the brand style. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--mint-700); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; padding: var(--sp-2) var(--sp-4); margin-right: var(--sp-3); border: 1px solid var(--ink-900); border-radius: var(--radius-pill); background: #fff; color: var(--ink-900); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--mint-050); }

/* Clickable stat cards are real links now. */
a.stat-card, a.stat-card:hover { display: block; color: inherit; text-decoration: none; }

/* Phones: tables scroll sideways -- show a shadow at the edge that has more. */
@media (max-width: 640px) {
  .table-wrap {
    background:
      linear-gradient(90deg, #fff 30%, rgba(255,255,255,0)) left / 40px 100% no-repeat,
      linear-gradient(270deg, #fff 30%, rgba(255,255,255,0)) right / 40px 100% no-repeat,
      radial-gradient(farthest-side at 0 50%, rgba(21,21,31,.14), transparent) left / 14px 100% no-repeat,
      radial-gradient(farthest-side at 100% 50%, rgba(21,21,31,.14), transparent) right / 14px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
  .table th, .table td { padding: var(--sp-2); }
  .table .col-optional { display: none; }
}

/* Phones: add-forms stack, with the Add/Save button full width under the fields. */
@media (max-width: 640px) {
  .form-row .form-group { min-width: 100%; }
  .form-row > .btn { flex-basis: 100%; }
  .card-header { flex-wrap: wrap; gap: var(--sp-2); }
}
.card-header .btn { white-space: nowrap; }

/* Small inline SVG icons inside buttons. */
.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Image search results: collapsed explanations for low-risk rows. */
.lens-why summary { font-size: var(--text-xs); color: var(--ink-600); cursor: pointer; margin-top: 4px; }
.lens-why[open] summary { margin-bottom: 4px; }

/* Touch: the login page's "Forgot password?" link gets a finger-sized hit area. */
@media (pointer: coarse), (max-width: 860px) {
  .auth-link { display: inline-flex; align-items: center; min-height: 44px; }
  td a { min-width: 44px; }
}

/* Phones: the nav is one swipeable row (three wrapped rows took ~300px of an 844px
   screen). The current tab is scrolled into view on load; a fade marks more tabs. */
@media (max-width: 640px) {
  .tabbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabbar.is-scrollable {
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tab { scroll-snap-align: start; }
}

/* White-label report branding (client page) */
.branding-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 860px) { .branding-grid { grid-template-columns: 1fr; } }
.branding-preview { border: 1px solid var(--line-300); border-radius: var(--radius); padding: var(--sp-4); background: #fff; }
.branding-preview-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-700); margin-bottom: var(--sp-3); }
.branding-preview-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 3px solid var(--mint-700); margin-bottom: var(--sp-3); }
.branding-preview-header img { max-height: 48px; max-width: 220px; object-fit: contain; }
.branding-preview-name { font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg); color: var(--ink-900); }
.color-input { padding: 4px; height: 44px; cursor: pointer; }

.branding-preview-meta { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: var(--text-xs); color: var(--ink-700); line-height: 1.45; }

.card-header-meta { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-left: auto; }


/* BrandHub customers (role CUSTOMER, see middleware/customerScope.js) get a read-only
   view. The server refuses every action anyway; this just hides controls they can't use. */
.role-customer .content form[method="POST"],
.role-customer .content form[method="post"],
.role-customer .content a[href$="/edit"],
.role-customer .content a[href$="/new"],
.role-customer .content a[href*="/photos"],
.role-customer .content a[href*="/tm-watch"],
.role-customer .content a[href*="/config/export"],
.role-customer .content a[href^="/sellers"],
.role-customer .content a[href^="/trademark-search"],
.role-customer .content #report-branding,
.role-customer .content .staff-only { display: none !important; }

/* --------------------------------------------------------------------------
   Customer protection overview (brands/customer.ejs) -- BrandHub's Protect tab
   (brandhub-web ProtectContainer): status bar, CountTile grid, flagged table.
   -------------------------------------------------------------------------- */
.protect-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 20px;
  margin-bottom: 16px;
}
.protect-status-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.protect-status-meta { font-size: 14px; color: #676767; }
.protect-status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}
.status-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-active { background: #dcfce7; color: #15803d; }
.status-active::before { background: #22c55e; }
.status-paused { background: #f3f4f6; color: #374151; }

.count-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.count-tile {
  padding: 20px;
  border-radius: var(--radius-lg);
  border-left: 4px solid #d1d5db;
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}
.count-tile-label { font-size: 14px; color: #676767; }
.count-tile-value { margin-top: 4px; font-size: 32px; font-weight: 500; line-height: 1.2; color: #111827; font-variant-numeric: tabular-nums; }
.tile-red { border-left-color: #ef4444; }
.tile-amber { border-left-color: #fbbf24; }
.tile-green { border-left-color: #22c55e; }
.tile-grey { border-left-color: #d1d5db; }
@media (max-width: 1024px) { .count-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.table-scroll { overflow-x: auto; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty-protect {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 20px;
}
.empty-protect .hi { width: 40px; height: 40px; padding: 8px; border-radius: 999px; background: var(--mint-100); color: var(--mint-700); }
.empty-protect p { margin: 4px 0 0; color: #676767; }

.protect-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.protect-split .card + .card { margin-top: 0; }
@media (max-width: 860px) { .protect-split { grid-template-columns: 1fr; } }
.mini-list { list-style: none; margin: 0; padding: 8px 20px 12px; }
.mini-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #e5e7eb;
  font-size: 14px;
}
.mini-list li:first-child { border-top: none; }
.mini-list-main { flex: 1; min-width: 0; }
.mini-empty { padding: 16px 20px; margin: 0; color: #676767; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; flex-shrink: 0; }

/* Tables inside cards sit flat -- one surface, as on BrandHub, not a card in a card. */
.card .table-wrap { border: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: none; }

/* --------------------------------------------------------------------------
   Phone polish (Fable 5 review, 2026-10-08)
   -------------------------------------------------------------------------- */
/* Tables keep whole columns and scroll sideways, rather than squashing titles into
   six lines and clipping the pills. */
@media (max-width: 860px) {
  .table-scroll .table, .table-wrap .table { min-width: 640px; }
  .table td:first-child { min-width: 200px; }
  .table-scroll {
    background:
      linear-gradient(270deg, #fff 30%, rgba(255,255,255,0)) right / 40px 100% no-repeat,
      radial-gradient(farthest-side at 100% 50%, rgba(21,21,31,.14), transparent) right / 14px 100% no-repeat;
    background-attachment: local, scroll;
  }
  /* Less chrome above the content. */
  .topbar { padding: 8px 12px; row-gap: 8px; }
  .topbar-mark { font-size: 16px; line-height: 20px; }
  .topbar-back { margin-top: 20px; }
  .tabbar { margin-bottom: 16px; }
  .role-customer .tab, .tabbar:not(.is-scrollable) .tab { flex: 1 1 0; justify-content: center; }
}
/* Finger-sized header targets. */
@media (pointer: coarse), (max-width: 860px) {
  .topbar-back, .topbar-bell, .profile-menu summary { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .topbar-back { display: inline-flex; }
  .rail-pin-tile { width: 44px; height: 44px; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.625rem; }
  .protect-status-actions { width: 100%; flex-direction: column; }
  .protect-status-actions .btn { width: 100%; }
  .count-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .count-tile { padding: 16px; }
  .count-tile-value { font-size: 28px; }
}

/* BrandHub's notification card, warning variant (brandhub-web Notification.tsx):
   amber-50 card with an amber-300 ring when new, white + amber left edge once seen. */
.bh-alerts { list-style: none; margin: 0; padding: 0; max-width: 1000px; }
.bh-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 8px;
  margin-bottom: 16px;
  padding: 20px;
  border-radius: 12px;
  background: #ffffff;
  border-left: 4px solid #fbbf24;
  box-shadow: var(--shadow-md);
}
.bh-alert.is-new { background: #fffbeb; border-left: 0; box-shadow: 0 0 0 1px #fcd34d; }
.bh-alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #fbbf24;
  color: #ffffff;
}
.bh-alert-main { flex: 1; min-width: 12rem; display: flex; flex-direction: column; gap: 2px; }
.bh-alert-title { font-size: 16px; font-weight: 700; color: #000000; }
.bh-alert-body { font-size: 14px; color: var(--ink-900); }
.bh-alert-meta { font-size: 12px; color: #676767; }
.bh-alert-action {
  margin-left: auto;
  flex: none;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fef3c7;
  color: #78350f;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.bh-alert-action:hover { background: #fde68a; text-decoration: none; }
@media (pointer: coarse), (max-width: 860px) { .bh-alert-action { min-height: 44px; display: inline-flex; align-items: center; } }
