/* ============================================================
   ReferHive — Custom Design System
   Phase 1 : Foundation
   100% hand-written. No Bootstrap / Tailwind / template.
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  /* brand gradient */
  --g-1: #7C3AED;
  --g-2: #4F46E5;
  --g-3: #06B6D4;
  --grad-brand: linear-gradient(120deg, var(--g-1) 0%, var(--g-2) 48%, var(--g-3) 100%);
  --grad-money: linear-gradient(120deg, #F59E0B 0%, #FBBF24 50%, #FDE68A 100%);
  --grad-glow: radial-gradient(60% 60% at 50% 0%, rgba(124, 58, 237, .35) 0%, rgba(6, 182, 212, 0) 70%);

  /* semantic */
  --ok: #10B981;
  --warn: #F59E0B;
  --bad: #F43F5E;
  --info: #38BDF8;

  /* radius + motion */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-pill: 999px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-fast: .18s;
  --t-mid: .32s;

  /* type */
  --f-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  /* layout */
  --shell: 1240px;
  --nav-h: 68px;
  --side-w: 262px;
  --tabbar-h: 68px;
}

/* ---------- 2. THEMES (dark = default) ---------- */
html[data-theme="dark"] {
  --bg: #070B16;
  --bg-2: #0B1120;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .18);
  --ink: #EEF2FF;
  --ink-2: #A9B4CC;
  --ink-3: #6C7A96;
  --shadow: 0 22px 60px -24px rgba(0, 0, 0, .9);
  --glass: rgba(11, 17, 32, .72);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F5F6FB;
  --bg-2: #FFFFFF;
  --surface: rgba(15, 23, 42, .035);
  --surface-2: rgba(15, 23, 42, .06);
  --line: rgba(15, 23, 42, .10);
  --line-strong: rgba(15, 23, 42, .18);
  --ink: #0B1120;
  --ink-2: #4A5568;
  --ink-3: #7C8AA5;
  --shadow: 0 20px 50px -26px rgba(15, 23, 42, .35);
  --glass: rgba(255, 255, 255, .82);
  color-scheme: light;
}

/* ---------- 3. RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  min-height: 100dvh;
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image: var(--grad-glow);
  background-repeat: no-repeat;
  background-size: 100% 720px;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t-mid) var(--ease), color var(--t-mid) var(--ease);
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--g-3);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: rgba(124, 58, 237, .35); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- 4. TYPE ---------- */
h1, h2, h3, h4, h5 { font-family: var(--f-display); font-weight: 800; line-height: 1.14; letter-spacing: -.022em; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.8rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
h4 { font-size: 1.06rem; }
p { color: var(--ink-2); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.money { font-family: var(--f-mono); font-weight: 700; letter-spacing: -.02em; }
.muted { color: var(--ink-3); }
.small { font-size: .84rem; }

/* ---------- 5. LAYOUT ---------- */
.shell { width: min(100% - 36px, var(--shell)); margin-inline: auto; }
.section { padding: clamp(56px, 8vw, 110px) 0; }
.stack-6 > * + * { margin-top: 6px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-20 > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.center { text-align: center; }
.spacer { flex: 1; }

/* ---------- 6. SURFACES ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px;
  backdrop-filter: blur(14px);
  transition: transform var(--t-mid) var(--ease), border-color var(--t-mid) var(--ease), background var(--t-mid) var(--ease);
}
.card-hover:hover { transform: translateY(-4px); border-color: var(--line-strong); background: var(--surface-2); }

.card-glow {
  position: relative;
  overflow: hidden;
}
.card-glow::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-brand);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .5;
  pointer-events: none;
}

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow);
}

/* ---------- 7. BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-weight: 650;
  font-size: .92rem;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: 0 12px 30px -12px rgba(79, 70, 229, .85); }
.btn-primary:hover { filter: brightness(1.12); }

.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-money { background: var(--grad-money); color: #1B1300; font-weight: 750; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); background: var(--surface); }

.btn-sm { height: 38px; padding: 0 15px; font-size: .84rem; }
.btn-lg { height: 54px; padding: 0 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- 8. FORMS ---------- */
.field { display: block; }
.field > label, .label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { min-height: 118px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--g-2);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .16);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C8AA5' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 17px; padding-right: 40px; }

.input-icon { position: relative; }
.input-icon .input { padding-left: 44px; }
.input-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }

.err { color: var(--bad); font-size: .8rem; margin-top: 6px; }
.hint { color: var(--ink-3); font-size: .8rem; margin-top: 6px; }

/* segmented role picker */
.segment { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label {
  display: block;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  background: var(--surface);
}
.segment input:checked + label {
  border-color: transparent;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 12px 26px -14px rgba(79, 70, 229, .9);
}
.segment input:checked + label .muted { color: rgba(255, 255, 255, .82); }
.segment strong { font-family: var(--f-display); display: block; }

/* toggle */
.switch { width: 46px; height: 26px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 99px; background: var(--ink-3); transition: all var(--t-fast) var(--ease); }
.switch[aria-checked="true"] { background: var(--grad-brand); border-color: transparent; }
.switch[aria-checked="true"]::after { left: 22px; background: #fff; }

/* ---------- 9. BADGES / CHIPS ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .01em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-ok { color: var(--ok); border-color: rgba(16, 185, 129, .3); background: rgba(16, 185, 129, .12); }
.badge-warn { color: var(--warn); border-color: rgba(245, 158, 11, .3); background: rgba(245, 158, 11, .12); }
.badge-bad { color: var(--bad); border-color: rgba(244, 63, 94, .3); background: rgba(244, 63, 94, .12); }
.badge-info { color: var(--info); border-color: rgba(56, 189, 248, .3); background: rgba(56, 189, 248, .12); }
.badge-brand { color: #fff; background: var(--grad-brand); border-color: transparent; }
.badge-plain::before { display: none; }

/* ---------- 10. SIGNATURE: ESCROW RAIL ---------- */
.rail { --p: 0; position: relative; padding: 26px 0 4px; }
.rail-track {
  position: relative;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.rail-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p);
  border-radius: 99px;
  background: var(--grad-brand);
  box-shadow: 0 0 18px rgba(124, 58, 237, .7);
  transition: width .8s var(--ease);
}
.rail-nodes { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: -13px; }
.rail-node { text-align: center; }
.rail-dot {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border-radius: 99px;
  background: var(--bg-2);
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  position: relative; z-index: 2;
  transition: all var(--t-mid) var(--ease);
}
.rail-dot span { width: 7px; height: 7px; border-radius: 99px; background: var(--ink-3); }
.rail-node.done .rail-dot { border-color: transparent; background: var(--grad-brand); }
.rail-node.done .rail-dot span { background: #fff; }
.rail-node.live .rail-dot { border-color: var(--g-3); box-shadow: 0 0 0 6px rgba(6, 182, 212, .16); }
.rail-node.live .rail-dot span { background: var(--g-3); animation: pulse 1.6s infinite; }
.rail-label { font-size: .78rem; font-weight: 650; }
.rail-node:not(.done):not(.live) .rail-label { color: var(--ink-3); }
.rail-sub { font-size: .7rem; color: var(--ink-3); font-family: var(--f-mono); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- 11. TOP NAV ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  background: var(--glass);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar .shell { display: flex; align-items: center; gap: 16px; height: 100%; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-size: 1.08rem; letter-spacing: -.03em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  color: #fff; font-size: .9rem; font-weight: 800;
  box-shadow: 0 10px 22px -10px rgba(124, 58, 237, .9);
}

.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 9px 14px; border-radius: var(--r-pill); font-size: .9rem; font-weight: 550; color: var(--ink-2); transition: all var(--t-fast) var(--ease); }
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--surface-2); }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: all var(--t-fast) var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }

.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: var(--grad-brand);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: .85rem;
  font-family: var(--f-display);
}
.avatar-lg { width: 62px; height: 62px; border-radius: 18px; font-size: 1.3rem; }

/* dropdown */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 224px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: all var(--t-fast) var(--ease);
  z-index: 70;
}
.menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font-size: .88rem; color: var(--ink-2); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu svg { width: 17px; height: 17px; }

/* ---------- 12. DASHBOARD SHELL ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: calc(100dvh - var(--nav-h)); }

.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky; top: var(--nav-h);
  height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
}
.side-title { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); font-family: var(--f-mono); padding: 0 12px; margin: 20px 0 8px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--ink-2); font-size: .9rem; font-weight: 550;
  transition: all var(--t-fast) var(--ease);
}
.side-link svg { width: 19px; height: 19px; flex: none; }
.side-link:hover { background: var(--surface); color: var(--ink); }
.side-link.active { background: var(--surface-2); color: var(--ink); position: relative; }
.side-link.active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 99px; background: var(--grad-brand); }
.side-link .count { margin-left: auto; font-size: .72rem; font-family: var(--f-mono); background: var(--surface-2); padding: 2px 8px; border-radius: 99px; }

.main { padding: clamp(18px, 3vw, 32px); min-width: 0; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); }

/* stat cards */
.stat { padding: 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.stat .eyebrow { margin-bottom: 10px; }
.stat b { font-family: var(--f-display); font-size: 1.7rem; display: block; letter-spacing: -.03em; }

/* ---------- 13. TABLES ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table th {
  text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
  padding: 13px 16px; background: var(--surface); white-space: nowrap;
}
table td { padding: 14px 16px; border-top: 1px solid var(--line); font-size: .9rem; white-space: nowrap; }
table tbody tr:hover { background: var(--surface); }

/* ---------- 14. ALERTS / EMPTY ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: .89rem; }
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.alert-ok { border-color: rgba(16, 185, 129, .32); background: rgba(16, 185, 129, .1); color: var(--ok); }
.alert-bad { border-color: rgba(244, 63, 94, .32); background: rgba(244, 63, 94, .1); color: var(--bad); }
.alert-warn { border-color: rgba(245, 158, 11, .32); background: rgba(245, 158, 11, .1); color: var(--warn); }

.empty { text-align: center; padding: 54px 20px; }
.empty-mark { width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 20px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.empty-mark svg { width: 26px; height: 26px; }

/* toast */
.toast-zone { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 380px;
  padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--bg-2); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: .88rem;
  animation: toastIn .4s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ---------- 15. MOBILE TAB BAR (app feel) ---------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tabbar nav { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-3); font-size: .66rem; font-weight: 600; }
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--ink); }
.tab.active svg { color: var(--g-3); }
.tab-fab {
  width: 46px; height: 46px; margin-top: -18px;
  border-radius: 16px; background: var(--grad-brand); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 14px 28px -10px rgba(124, 58, 237, .95);
}

/* mobile drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(3, 6, 15, .6); backdrop-filter: blur(3px); z-index: 90; opacity: 0; visibility: hidden; transition: all var(--t-mid) var(--ease); }
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 95;
  width: min(84vw, 300px);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  transform: translateX(-102%);
  transition: transform var(--t-mid) var(--ease);
  overflow-y: auto;
}
.drawer.open { transform: none; }

/* ---------- 16. LANDING BITS ---------- */
.hero { position: relative; padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 60px); align-items: center; }
.hero h1 { margin: 18px 0 18px; }
.hero p.lead { font-size: clamp(1rem, 1.6vw, 1.12rem); max-width: 52ch; }

.pill-note {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 8px 7px 7px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  font-size: .8rem; color: var(--ink-2);
}
.pill-note b { background: var(--grad-brand); color: #fff; padding: 3px 10px; border-radius: 99px; font-size: .72rem; }

.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; gap: 40px; width: max-content; animation: slide 26s linear infinite; }
.marquee span { color: var(--ink-3); font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; white-space: nowrap; }
@keyframes slide { to { transform: translateX(-50%); } }

.step-n { font-family: var(--f-mono); font-size: .78rem; color: var(--g-3); }

.price-tag {
  display: inline-flex; align-items: baseline; gap: 3px;
  font-family: var(--f-display); font-weight: 800; letter-spacing: -.03em;
}
.price-tag small { font-size: .68em; opacity: .7; font-weight: 700; }

/* listing card */
.listing { display: grid; gap: 14px; }
.listing-top { display: flex; gap: 13px; align-items: flex-start; }
.logo-sq { width: 46px; height: 46px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; flex: none; }
.stars { display: inline-flex; gap: 2px; color: var(--warn); }
.stars svg { width: 13px; height: 13px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 46px 0 34px; margin-top: 40px; }
.footer a { color: var(--ink-3); font-size: .88rem; }
.footer a:hover { color: var(--ink); }

/* ---------- 17. UTIL ---------- */
.hide { display: none !important; }
.only-mobile { display: none; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 18. RESPONSIVE ---------- */
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links { display: none; }
  .only-mobile { display: block; }
  .no-mobile { display: none !important; }
}

@media (max-width: 620px) {
  body { font-size: 14.5px; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .shell { width: calc(100% - 26px); }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .tabbar { display: block; }
  .card { padding: 17px; border-radius: var(--r-sm); }
  .panel { padding: 18px; border-radius: var(--r-md); }
  .rail-label { font-size: .68rem; }
  .rail-sub { display: none; }
  .btn { height: 48px; }           /* thumb-friendly */
  .main { padding: 16px 13px 24px; }
  table td, table th { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print { .topbar, .tabbar, .sidebar, .btn { display: none !important; } }

/* ============================================================
   PHASE 2 — marketplace additions
   ============================================================ */

/* filter bar collapses cleanly on small screens */
@media (max-width: 860px) {
  .panel form .g-4 > .field[style*="span 2"] { grid-column: span 1 !important; }
}

/* listing cards keep an even height in a row */
.listing { height: 100%; }
.listing-top { align-items: center; }

/* radio + checkbox get a visible custom look instead of the browser default */
input[type="radio"], input[type="checkbox"] {
  appearance: none;
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
input[type="radio"] { border-radius: 99px; }
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"]:checked, input[type="checkbox"]:checked {
  background: var(--grad-brand);
  border-color: transparent;
}
input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 13px;
  background-position: center;
  background-repeat: no-repeat;
}
input[type="radio"]:checked::after {
  content: ""; display: block;
  width: 6px; height: 6px; margin: 4px auto;
  border-radius: 99px; background: #fff;
}

/* file inputs */
input[type="file"] { padding: 10px 14px; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink);
  font-size: .82rem; font-weight: 600; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface); }

/* details/summary used for FAQs */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; float: right; color: var(--ink-3); font-weight: 400; }
details[open] summary::after { content: "–"; }

/* sticky side panels must not stick on mobile */
@media (max-width: 860px) {
  [style*="position:sticky"] { position: static !important; }
}

/* ============================================================
   PHASE 4 & 5 — trust, program and admin depth
   ============================================================ */

/* the stat card is a link on the admin dashboard now */
a.stat { display: block; color: inherit; }

/* details blocks used for FAQs, applications and milestones */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* rating radio pills */
.badge input[type="radio"] { width: 15px; height: 15px; }

/* the report bar chart must stay usable on a phone */
@media (max-width: 620px) {
  .table-scroll { -webkit-overflow-scrolling: touch; }
  .page-head h1 { font-size: 1.4rem; }
}

/* long codes and serials should never break a layout */
.money { overflow-wrap: anywhere; }

/* print: certificates and statements only */
@media print {
  .alert, .badge { break-inside: avoid; }
  .panel, .card { box-shadow: none; }
}
