/* Entrepreneur Digital Toolkit — design system v1 (docs/UI-UX-SPECIFICATION.md)
   Layers: tokens → base → layout → components → console → utilities.
   Color pairs used for text are WCAG 2.2 AA checked in UI-UX-SPECIFICATION §2. */

@layer tokens, base, layout, components, console, utilities;

/* ------------------------------------------------------------------ fonts */
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/libre-franklin-latin-400-normal.6b939122bafb.woff2") format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/libre-franklin-latin-500-normal.c1334571aaf9.woff2") format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/libre-franklin-latin-600-normal.6c5ae80149ae.woff2") format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/libre-franklin-latin-700-normal.d4a55f8e4456.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/barlow-condensed-latin-600-normal.ba4513495282.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/barlow-condensed-latin-700-normal.e1180918b873.woff2") format("woff2"); }

/* ----------------------------------------------------------------- tokens */
@layer tokens {
  :root {
    /* Brand (SRS §10.2; subject to brand validation) */
    --c-purple: #512698;
    --c-purple-700: #43207e;
    --c-purple-900: #2e1561;
    --c-purple-50: #e9e3f3;
    --c-purple-25: #f4f0fa;
    --c-gold: #ffc82e;
    --c-gold-100: #fff4d1;

    /* Neutrals */
    --c-surface: #ffffff;
    --c-bg: #f7f7fa;
    --c-text: #24212b;
    --c-text-2: #5f5a6b;
    --c-border-control: #8a8494;  /* ≥ 3:1 for component boundaries (WCAG 1.4.11) */
    --c-border: #e4e1ea;          /* decorative dividers only */

    /* Status (text / tint) */
    --c-success: #1e6b3a; --c-success-bg: #e7f3ec;
    --c-danger: #b3261e;  --c-danger-bg: #fbeae8;
    --c-warning: #8a5300; --c-warning-bg: #fff4d1;
    --c-info: var(--c-purple); --c-info-bg: var(--c-purple-50);

    /* Type */
    --font-text: "Franklin Gothic", "Libre Franklin", Arial, system-ui, sans-serif;
    --font-display: "Franklin Gothic Condensed", "Barlow Condensed", "Arial Narrow", sans-serif;
    --fs-display: clamp(2.25rem, 1.6rem + 2.6vw, 3rem);
    --fs-h1: clamp(1.875rem, 1.6rem + 1.1vw, 2.25rem);
    --fs-h2: 1.75rem;
    --fs-h3: 1.375rem;
    --fs-h4: 1.125rem;
    --fs-body: 1rem;
    --fs-sm: 0.875rem;

    /* Space (4 px base) */
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
    --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

    /* Shape and depth */
    --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
    --e1: 0 1px 2px rgb(36 33 43 / 0.06), 0 0 0 1px var(--c-border);
    --e2: 0 8px 24px rgb(36 33 43 / 0.12), 0 0 0 1px var(--c-border);

    --content-max: 1200px;
    --focus: 2px solid var(--c-purple);
    --ease: 160ms ease-out;
  }
}

/* ------------------------------------------------------------------- base */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; background: var(--c-bg); color: var(--c-text);
    font: 400 var(--fs-body)/1.5 var(--font-text);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  }
  h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s-3); font-weight: 700; letter-spacing: -0.01em; }
  h1 { font-size: var(--fs-h1); }
  h2 { font-size: var(--fs-h2); }
  h3 { font-size: var(--fs-h3); font-weight: 600; }
  h4 { font-size: var(--fs-h4); font-weight: 600; }
  p { margin: 0 0 var(--s-4); max-width: 70ch; }
  a { color: var(--c-purple); text-underline-offset: 0.18em; }
  a:hover { color: var(--c-purple-700); }
  img, svg { max-width: 100%; }
  :focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: 2px; }
  .on-dark :focus-visible { outline-color: var(--c-gold); }
  ::selection { background: var(--c-purple-50); }
  code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  }
}

/* ----------------------------------------------------------------- layout */
@layer layout {
  .container { width: min(100% - 2 * var(--s-5), var(--content-max)); margin-inline: auto; }
  .stack > * + * { margin-top: var(--s-4); }
  .cluster { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
  .grid { display: grid; gap: var(--s-5); }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
  .section { padding-block: var(--s-7); }
  .section-tight { padding-block: var(--s-6); }
  /* Consecutive sections share one gap instead of adding both paddings. */
  .section + .section, .section + .section-tight { padding-top: 0; }

  .skip-link {
    position: absolute; left: var(--s-4); top: -100px; z-index: 100;
    background: var(--c-surface); color: var(--c-purple); padding: var(--s-2) var(--s-4);
    border-radius: var(--r-sm); box-shadow: var(--e2); font-weight: 600;
  }
  .skip-link:focus { top: var(--s-4); }

  /* Endorsement bar and header */
  .endorsement { background: var(--c-purple-900); color: #fff; font-size: var(--fs-sm); }
  .endorsement .container { display: flex; gap: var(--s-3); align-items: center; min-height: 36px; }
  .site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); position: relative; }
  .site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); min-height: 76px; }
  .brand { display: inline-flex; align-items: center; gap: var(--s-3); text-decoration: none; color: var(--c-text); }
  .brand-symbol { width: 40px; height: 40px; flex: none; }
  .wordmark { display: grid; line-height: 1; }
  .wordmark-top { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-purple); }
  .wordmark-bottom { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--c-text); margin-top: 3px; }
  .primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-1); }
  .primary-nav a {
    display: block; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm);
    color: var(--c-text); text-decoration: none; font-weight: 500;
  }
  .primary-nav a:hover { background: var(--c-purple-25); color: var(--c-purple); }
  .primary-nav a[aria-current="page"] { color: var(--c-purple); box-shadow: inset 0 -3px 0 var(--c-gold); border-radius: 0; }
  .nav-toggle { display: none; }
  @media (max-width: 900px) {
    .nav-toggle {
      display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-3);
      border: 1px solid var(--c-border-control); border-radius: var(--r-sm); background: var(--c-surface);
      font: inherit; font-weight: 600; color: var(--c-text); cursor: pointer;
    }
    .primary-nav { display: none; position: absolute; inset: 100% 0 auto 0; background: var(--c-surface);
      border-bottom: 1px solid var(--c-border); box-shadow: var(--e2); z-index: 20; }
    .primary-nav.is-open { display: block; }
    .primary-nav ul { flex-direction: column; padding: var(--s-3) var(--s-5) var(--s-5); }
    .primary-nav a { padding: var(--s-3); min-height: 44px; }
  }

  /* Footer */
  .site-footer { background: var(--c-purple-900); color: #fff; padding-block: var(--s-7) var(--s-6); margin-top: var(--s-6); }
  .site-footer a { color: #fff; }
  .site-footer a:hover { color: var(--c-gold); }
  .footer-grid { display: grid; gap: var(--s-6); grid-template-columns: 2fr 1fr 1fr; }
  @media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
  .site-footer h2 { font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-gold); margin-bottom: var(--s-3); }
  .site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .footer-legal { max-width: none; border-top: 1px solid rgb(255 255 255 / 0.18); margin-top: var(--s-6); padding-top: var(--s-4); font-size: var(--fs-sm); color: #e9e3f3; }
  .site-footer .wordmark-top { color: var(--c-gold); }
  .site-footer .wordmark-bottom { color: #fff; }
}

/* ------------------------------------------------------------- components */
@layer components {
  /* Icons */
  .icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }

  /* Eyebrow / display */
  .eyebrow { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; font-size: 1rem; color: var(--c-purple); margin: 0 0 var(--s-3); }
  .display { font-size: var(--fs-display); line-height: 1.1; letter-spacing: -0.02em; }
  .lead { font-size: 1.125rem; color: var(--c-text-2); }
  .display-face { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }

  /* Hero */
  .hero { position: relative; overflow: hidden; color: #fff; background-color: var(--c-purple-700);
    /* The motif stays behind a gradient so it never competes with the text. */
    background-image: linear-gradient(90deg, rgb(67 32 126) 0%, rgb(67 32 126) 38%, rgb(67 32 126 / 0) 72%),
                      url("../img/motif-graticule.dd5b147cd95c.svg");
    background-position: center, right center; background-size: cover, cover; background-repeat: no-repeat; }
  @media (max-width: 760px) {
    .hero { background-image: linear-gradient(rgb(67 32 126 / 0.88), rgb(67 32 126 / 0.88)),
                              url("../img/motif-graticule.dd5b147cd95c.svg"); }
  }
  .hero .container { position: relative; padding-block: var(--s-8) var(--s-9); }
  .hero .eyebrow { color: var(--c-gold); font-size: 1.125rem; }
  .hero h1 { color: #fff; max-width: 18ch; }
  .hero .lead { color: #f4f0fa; max-width: 56ch; }

  /* Buttons */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
    min-height: 44px; padding: 0 var(--s-5); border-radius: var(--r-sm); border: 2px solid transparent;
    font: 600 1rem/1 var(--font-text); text-decoration: none; cursor: pointer; transition: background var(--ease), border-color var(--ease);
  }
  .btn-primary { background: var(--c-gold); color: var(--c-text); }
  .btn-primary:hover { background: #ffd65c; color: var(--c-text); }
  .btn-secondary { background: var(--c-purple); color: #fff; }
  .btn-secondary:hover { background: var(--c-purple-700); color: #fff; }
  .btn-outline { background: var(--c-surface); color: var(--c-purple); border-color: var(--c-purple); }
  .btn-outline:hover { background: var(--c-purple-25); }
  .btn-ghost-dark { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.7); }
  .btn-ghost-dark:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
  .btn-danger { background: var(--c-surface); color: var(--c-danger); border-color: var(--c-danger); }
  .btn-danger:hover { background: var(--c-danger-bg); }
  .btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
  .btn-link { background: none; border: 0; padding: 0; min-height: auto; color: var(--c-purple); text-decoration: underline; font-weight: 600; cursor: pointer; font: inherit; }

  /* Cards */
  .card { background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--e1); padding: var(--s-5); }
  .card-title { font-size: var(--fs-h3); margin-bottom: var(--s-2); }
  .tile-icon {
    display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 12px;
    background: var(--c-purple-50); color: var(--c-purple); margin-bottom: var(--s-4);
  }
  .tile-icon .icon { width: 26px; height: 26px; }
  .module-card { display: flex; flex-direction: column; height: 100%; position: relative; transition: box-shadow var(--ease), transform var(--ease); }
  .module-card:hover { box-shadow: var(--e2); transform: translateY(-2px); }
  .module-card p { color: var(--c-text-2); flex: 1; }
  .module-card .card-link { font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: var(--s-1); }
  .module-card .card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
  .module-card:focus-within { outline: var(--focus); outline-offset: 3px; }
  .module-card .card-link:focus-visible { outline: none; }

  /* Badges (always icon + text; UX-16, UX-17) */
  .badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; line-height: 1.6; white-space: nowrap; }
  .badge .icon { width: 1em; height: 1em; }
  .badge-success { background: var(--c-success-bg); color: var(--c-success); }
  .badge-danger { background: var(--c-danger-bg); color: var(--c-danger); }
  .badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
  .badge-info { background: var(--c-info-bg); color: var(--c-info); }
  .badge-neutral { background: #eeedf2; color: var(--c-text-2); }

  /* Alerts */
  .alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); border-left: 4px solid currentColor; margin-bottom: var(--s-4); }
  .alert p { margin: 0; color: var(--c-text); }
  .alert-success { background: var(--c-success-bg); color: var(--c-success); }
  .alert-error, .alert-danger { background: var(--c-danger-bg); color: var(--c-danger); }
  .alert-warning { background: var(--c-warning-bg); color: var(--c-warning); }
  .alert-info { background: var(--c-info-bg); color: var(--c-info); }

  /* Forms */
  .field { display: grid; gap: var(--s-1); margin-bottom: var(--s-4); }
  .field label, .field legend, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--c-text); }
  .field .help { font-size: var(--fs-sm); color: var(--c-text-2); margin: 0; }
  .field .error { font-size: var(--fs-sm); color: var(--c-danger); font-weight: 600; margin: 0; display: flex; gap: 6px; align-items: center; }
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
    font: inherit; font-size: 1rem; color: var(--c-text); background: var(--c-surface);
    border: 1px solid var(--c-border-control); border-radius: var(--r-sm); padding: 10px 12px; min-height: 44px; width: 100%;
  }
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline: var(--focus); outline-offset: 1px; border-color: var(--c-purple); }
  [aria-invalid="true"] { border-color: var(--c-danger) !important; }
  fieldset { border: 0; padding: 0; margin: 0 0 var(--s-4); }
  .checkbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .checkbox-list label { display: flex; gap: var(--s-2); align-items: flex-start; font-weight: 400; font-size: 1rem; cursor: pointer; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--c-purple); flex: none; }
  .form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; margin-top: var(--s-5); }

  /* Segmented control (radius selector) */
  .segmented { justify-self: start; align-self: start; display: inline-flex; flex-wrap: wrap; border: 1px solid var(--c-border-control); border-radius: var(--r-sm); overflow: hidden; }
  .segmented label { position: relative; }
  .segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
  .segmented span { display: block; padding: 10px 14px; min-height: 44px; font-weight: 600; font-size: var(--fs-sm); border-right: 1px solid var(--c-border); background: var(--c-surface); }
  .segmented label:last-child span { border-right: 0; }
  .segmented input:checked + span { background: var(--c-purple); color: #fff; }
  .segmented input:focus-visible + span { outline: var(--focus); outline-offset: -4px; }

  /* Tables */
  .table-wrap { overflow-x: auto; background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--e1); }
  table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
  th, td { text-align: left; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-border); vertical-align: top; }
  th { font-size: var(--fs-sm); color: var(--c-text-2); font-weight: 600; background: var(--c-purple-25); }
  tbody tr:last-child td { border-bottom: 0; }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

  /* Page header and empty state */
  .page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-4); margin-bottom: var(--s-5); }
  .page-header p { margin: 0; color: var(--c-text-2); }
  .empty-state { text-align: center; padding: var(--s-7) var(--s-5); background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--e1); }
  .empty-state .tile-icon { margin-inline: auto; }
  .empty-state p { margin-inline: auto; color: var(--c-text-2); }

  /* Narrow auth panel */
  .auth-panel { max-width: 460px; margin: var(--s-7) auto; }
  .auth-panel .card { padding: var(--s-6); }
  .qr { background: #fff; padding: var(--s-3); border-radius: var(--r-sm); box-shadow: var(--e1); width: 216px; }
  .qr svg { display: block; width: 100%; height: auto; }
  .codes { columns: 2; list-style: none; padding: 0; font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; }
  .codes li { padding: var(--s-1) 0; }

  /* Location picker (combobox) */
  .combobox { position: relative; }
  .combobox-listbox { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: var(--s-1) 0; list-style: none;
    background: var(--c-surface); border-radius: var(--r-sm); box-shadow: var(--e2); max-height: 280px; overflow-y: auto; }
  .combobox-listbox[hidden] { display: none; }
  .combobox-listbox [role="option"] { display: flex; justify-content: space-between; gap: var(--s-3); padding: 10px var(--s-3); min-height: 44px; align-items: center; cursor: pointer; }
  .combobox-listbox [role="option"]:hover, .combobox-listbox .is-active { background: var(--c-purple-50); }
  .combobox-listbox .is-active { box-shadow: inset 3px 0 0 var(--c-purple); }
  .combobox-detail { color: var(--c-text-2); font-size: var(--fs-sm); }

  /* Map */
  .map { height: 420px; border-radius: var(--r-md); box-shadow: var(--e1); background: #eeedf2; z-index: 0; }
  .map-notice { margin: var(--s-2) 0 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--c-warning-bg); color: var(--c-warning); font-size: var(--fs-sm); font-weight: 600; }
  .map-notice[hidden] { display: none; }
  .map-pin { display: grid !important; place-items: center; border-radius: 50%; background: var(--c-purple); color: #fff;
    font: 700 12px/1 var(--font-text); border: 1.5px solid #fff; box-shadow: 0 1px 4px rgb(36 33 43 / 0.3); }
  .map-pin--s { width: 24px !important; height: 24px !important; margin: -12px 0 0 -12px !important; font-size: 11px; }
  .map-pin--m { width: 30px !important; height: 30px !important; margin: -15px 0 0 -15px !important; font-size: 12px; }
  .map-pin--l { width: 38px !important; height: 38px !important; margin: -19px 0 0 -19px !important; font-size: 13px; }
  /* Color steps by count (log scale); text contrast ≥ 5:1, light steps outlined for 3:1 on the basemap. */
  .map-pin--t1 { background: #d9cff0; color: var(--c-text); border-color: var(--c-purple); }
  .map-pin--t2 { background: #b3a0de; color: var(--c-text); border-color: var(--c-purple); }
  .map-pin--t3 { background: #7c5cc4; color: #fff; }
  .map-pin--t4 { background: var(--c-purple); color: #fff; }
  .map-pin--t5 { background: var(--c-purple-900); color: #fff; }
  .map-pin--selected { background: var(--c-gold); color: var(--c-text); border-color: var(--c-text); box-shadow: 0 0 0 5px rgb(255 200 46 / 0.45), 0 2px 8px rgb(36 33 43 / 0.4); }
  .map-pin:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 2px; }
  /* Search area: radius, distance bands and center (CSS overrides Leaflet's SVG attributes). */
  .map-radius { stroke: var(--c-purple); stroke-width: 1.5; stroke-opacity: 0.55; fill: var(--c-purple); fill-opacity: 0.05; }
  .map-band { stroke: var(--c-purple); stroke-width: 1.25; stroke-dasharray: 5 5; stroke-opacity: 0.7; fill: none; }
  .map-center { stroke: #fff; stroke-width: 1.5; fill: var(--c-purple-900); fill-opacity: 0.9; }
  .leaflet-tooltip.map-ring-label { background: rgb(255 255 255 / 0.9); border: 0; box-shadow: none; padding: 0 5px; border-radius: 999px;
    color: var(--c-purple); font: 700 11px/1.5 var(--font-text); }
  .leaflet-tooltip.map-ring-label::before { display: none; }
  .leaflet-container { font-family: var(--font-text); }
  .leaflet-container a { color: var(--c-purple); }
  .skip-map { position: absolute; left: -9999px; }
  .skip-map:focus { position: static; display: inline-block; margin-bottom: var(--s-2); }

  /* Professional Finder (FR-03) */
  .finder-header { margin-bottom: var(--s-4); }
  .finder-header h1 { font-size: var(--fs-h2); margin-bottom: var(--s-1); }
  .finder-sub { color: var(--c-text-2); margin-bottom: var(--s-3); max-width: none; }
  .finder-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-2) var(--s-5); border-bottom: 1px solid var(--c-border); }
  .finder-freshness { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2); align-items: start; color: var(--c-text-2); font-size: var(--fs-sm); max-width: 62ch; margin: 0 0 var(--s-2); }
  .finder-freshness .icon { margin-top: 0.15em; }
  .mode-tabs { display: flex; flex-wrap: wrap; gap: var(--s-1); }
  .mode-tabs a { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-4); color: var(--c-text); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
  .mode-tabs a:hover { color: var(--c-purple); background: var(--c-purple-25); }
  .mode-tabs a[aria-current="page"] { color: var(--c-purple); border-bottom-color: var(--c-gold); }
  .finder-layout { display: grid; gap: var(--s-5); grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); align-items: start; }
  .finder-layout > * { min-width: 0; }
  @media (max-width: 900px) { .finder-layout { grid-template-columns: 1fr; } }
  .finder-form .segmented { display: flex; }
  .finder-form .segmented label { flex: 1 1 auto; text-align: center; }
  .finder-form select, .finder-form input[type="text"] { width: 100%; max-width: 100%; }
  .finder-more { margin-bottom: var(--s-4); }
  .finder-more summary, details > summary { cursor: pointer; font-weight: 600; color: var(--c-purple); display: inline-flex; gap: var(--s-2); align-items: center; min-height: 44px; }
  .finder-more[open] summary { margin-bottom: var(--s-3); }
  .check { display: flex; gap: var(--s-2); align-items: flex-start; }
  /* Professional picker: area chips, filter, families with license types */
  .chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-1) 0 var(--s-3); }
  .chip { position: relative; }
  .chip input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
  .chip span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-3); border: 1px solid var(--c-border-control); border-radius: 999px; background: var(--c-surface); font-size: var(--fs-sm); font-weight: 600; color: var(--c-text); }
  .chip input:checked + span { background: var(--c-purple); border-color: var(--c-purple); color: #fff; }
  .chip input:focus-visible + span { outline: var(--focus); outline-offset: 2px; }
  .chip:hover span { border-color: var(--c-purple); }
  .picker-tools input { margin-bottom: var(--s-2); }
  .picker-selected { margin: 0 0 var(--s-2); font-size: var(--fs-sm); color: var(--c-purple); font-weight: 600; min-height: 0; }
  .picker-selected:empty { display: none; }
  .picker-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--c-border-control); border-radius: var(--r-sm); background: var(--c-surface); }
  .picker-list:focus-visible { outline: var(--focus); outline-offset: 2px; }
  .picker-family { border-bottom: 1px solid var(--c-border); }
  .picker-family:last-of-type { border-bottom: 0; }
  .picker-family[hidden] { display: none; }
  .picker-family > summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: 44px; padding: 0 var(--s-3); color: var(--c-text); font-weight: 600; cursor: pointer; list-style: none; }
  .picker-family > summary::-webkit-details-marker { display: none; }
  .picker-family > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--c-text-2); border-bottom: 2px solid var(--c-text-2); transform: rotate(-45deg); flex: none; transition: transform var(--ease); }
  .picker-family[open] > summary::before { transform: rotate(45deg); }
  .picker-family > summary:hover { background: var(--c-purple-25); }
  .picker-label { flex: 1; }
  .picker-count { font-variant-numeric: tabular-nums; color: var(--c-text-2); font-size: var(--fs-sm); font-weight: 400; white-space: nowrap; }
  .picker-family ul { list-style: none; margin: 0; padding: 0 var(--s-3) var(--s-2) calc(var(--s-3) + 15px); }
  .picker-family li { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-2); padding: 4px 0; }
  .picker-family li[hidden] { display: none; }
  .picker-family li label { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-sm); font-weight: 400; cursor: pointer; }
  .picker-family .picker-all label { font-weight: 600; }
  .picker-family input:disabled + * , .picker-family input:disabled { opacity: 0.7; }
  .picker-empty { padding: var(--s-3); margin: 0; color: var(--c-text-2); font-size: var(--fs-sm); }
  .results-what { color: var(--c-purple); font-weight: 600; }
  [data-outside][hidden] { display: none; }
  .finder-results:focus { outline: none; }
  .results-summary h2 { margin-bottom: var(--s-1); font-size: var(--fs-h3); }
  .map-wrap { position: relative; }
  .map-legend { position: absolute; top: var(--s-3); right: var(--s-3); z-index: 500; width: 230px; background: rgb(255 255 255 / 0.95); border-radius: var(--r-sm); box-shadow: var(--e2); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); }
  .map-legend-title { font-size: var(--fs-sm); margin: 0 0 var(--s-1); }
  .map-legend .ring-table th, .map-legend .ring-table td { padding: 3px 4px; border: 0; background: none; font-size: var(--fs-sm); }
  .map-legend .ring-bar-cell { width: 45%; }
  .map-legend-note { margin: var(--s-1) 0 0; display: flex; gap: var(--s-2); align-items: center; font-weight: 600; }
  .map-scale { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-1); color: var(--c-text-2); font-size: 0.75rem; }
  .map-scale-bar { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #d9cff0, #b3a0de, #7c5cc4, #512698, #2e1561); box-shadow: inset 0 0 0 1px rgb(81 38 152 / 0.4); }
  .map-scale-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c-gold); border: 1px solid var(--c-text); flex: none; }
  @media (max-width: 700px) {
    .map-legend { position: static; width: auto; margin-top: var(--s-2); box-shadow: var(--e1); }
  }
  .result-list { display: grid; gap: var(--s-3); }
  .result-card { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--e1); padding: var(--s-4) var(--s-5); }
  .result-main { flex: 1 1 320px; min-width: 0; }
  .result-title { font-size: var(--fs-h4); margin-bottom: var(--s-1); overflow-wrap: anywhere; }
  .result-meta { margin: 0 0 var(--s-1); color: var(--c-text-2); display: flex; flex-wrap: wrap; gap: 0 var(--s-1); align-items: center; }
  .result-tags { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
  .result-actions { display: grid; gap: var(--s-2); align-content: start; justify-items: start; }
  .pagination { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: center; margin-top: var(--s-5); }
  .ring-table th[scope="row"] { background: none; color: var(--c-text); font-size: 0.9375rem; white-space: nowrap; }
  .ring-bar-cell { width: 55%; vertical-align: middle; }
  .ring-bar { display: block; width: 100%; height: 12px; border-radius: 6px; overflow: hidden; }
  .ring-track { fill: var(--c-purple-25); }
  .ring-fill { fill: var(--c-purple); }
  .disclaimer { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--c-border); color: var(--c-text-2); }
  .disclaimer p { max-width: 90ch; }
  .verify-layout { max-width: 820px; }

  /* Import review (console) */
  .gate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .gate-list li { display: flex; gap: var(--s-3); align-items: flex-start; }
  .gate-list .badge { flex: none; }

  /* Label + status rows */
  .status-list { list-style: none; margin: 0; padding: 0; }
  .status-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); }
  .status-list li:last-child { border-bottom: 0; }

  /* Definition list */
  .meta-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); margin: 0; }
  .meta-list dt { font-weight: 600; color: var(--c-text-2); }
  .meta-list dd { margin: 0; }

  /* Style guide swatches */
  .swatches { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .swatch { border-radius: var(--r-sm); box-shadow: var(--e1); overflow: hidden; background: var(--c-surface); font-size: var(--fs-sm); }
  .swatch-color { height: 64px; }
  .swatch div:last-child { padding: var(--s-2) var(--s-3); }
  .sw-purple { background: #512698; } .sw-gold { background: #ffc82e; } .sw-purple-700 { background: #43207e; }
  .sw-purple-900 { background: #2e1561; } .sw-purple-50 { background: #e9e3f3; } .sw-text { background: #24212b; }
  .sw-text-2 { background: #5f5a6b; } .sw-bg { background: #f7f7fa; }
  .symbol-dark-box { display: inline-flex; padding: var(--s-3); border-radius: var(--r-md); background: var(--c-purple-900); }
  .motif-preview { height: 120px; border-radius: var(--r-md); background: var(--c-purple-700) url("../img/motif-graticule.dd5b147cd95c.svg") right center / cover no-repeat; }
  .logo-slot { display: inline-flex; align-items: center; justify-content: center; min-width: 180px; min-height: 48px; border: 2px dashed var(--c-border-control); border-radius: var(--r-sm); color: var(--c-text-2); font-size: var(--fs-sm); padding: var(--s-2) var(--s-3); }
}

/* ---------------------------------------------------------------- console */
@layer console {
  .console-body { background: var(--c-bg); }
  .console-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
  .console-sidebar { background: var(--c-purple-900); color: #fff; padding: var(--s-5) var(--s-3); display: flex; flex-direction: column; gap: var(--s-5); }
  .console-sidebar .brand { color: #fff; padding: 0 var(--s-2); }
  .console-sidebar .wordmark-top { color: var(--c-gold); font-size: 0.95rem; }
  .console-sidebar .wordmark-bottom { color: #fff; font-size: 1rem; }
  .console-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .console-nav a { display: flex; gap: var(--s-3); align-items: center; padding: 10px var(--s-3); border-radius: var(--r-sm); color: #f4f0fa; text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
  .console-nav a:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
  .console-nav a[aria-current="page"] { background: var(--c-purple-700); color: #fff; border-left-color: var(--c-gold); }
  .console-main { min-width: 0; }
  .console-topbar { display: flex; justify-content: flex-end; align-items: center; gap: var(--s-4); background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: var(--s-3) var(--s-6); min-height: 60px; }
  .console-content { padding: var(--s-6); max-width: 1180px; }
  .console-content h1 { font-size: 1.75rem; }
  .stat { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c-purple); line-height: 1.1; }
  .perm-group { margin-bottom: var(--s-5); }
  .perm-group h3 { font-size: 1rem; text-transform: capitalize; }
  .muted { color: var(--c-text-2); }
  @media (max-width: 900px) {
    .console-shell { grid-template-columns: 1fr; }
    .console-sidebar { padding: var(--s-3); gap: var(--s-3); }
    .console-nav ul { display: flex; flex-wrap: wrap; }
    .console-content { padding: var(--s-4); }
    .console-topbar { padding: var(--s-3) var(--s-4); }
  }
}

/* -------------------------------------------------------------- utilities */
@layer utilities {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mb-0 { margin-bottom: 0; } .mt-5 { margin-top: var(--s-5); } .mb-5 { margin-bottom: var(--s-5); }
  .text-sm { font-size: var(--fs-sm); }
  .text-purple { color: var(--c-purple); }
  .input-narrow { max-width: 16rem; }
  .inline-form { display: inline; }
}
