/* =====================================================================
   Domain Inventory · design system
   Tokens → base → app shell → components → pages
   ===================================================================== */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f0f2f7;
  --border: #e5e8ef;
  --border-strong: #d4d9e3;
  --text: #0f1424;
  --text-2: #3a4155;
  --muted: #687087;
  --faint: #9ba1b3;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --accent: #4f46e5;
  --primary-soft: #eef0ff;
  --ring: rgba(79, 70, 229, .22);
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --success: #0c8f63;  --success-soft: #e6f7f0;
  --info: #2563eb;     --info-soft: #eaf1ff;
  --warn: #b45309;     --warn-soft: #fff4e3;
  --danger: #d92d20;   --danger-soft: #fdeeec;
  --danger-solid: #dc2626;

  --sb-bg: linear-gradient(180deg, #131a33 0%, #0c1021 100%);
  --sb-text: #c7cbe0;
  --sb-muted: #7c839e;
  --sb-hover: rgba(255, 255, 255, .06);
  --sb-active: rgba(255, 255, 255, .09);
  --sb-border: rgba(255, 255, 255, .07);

  --dock-bg: #121729;

  --shadow-xs: 0 1px 2px rgba(15, 20, 36, .05);
  --shadow-sm: 0 1px 2px rgba(15, 20, 36, .04), 0 2px 8px -2px rgba(15, 20, 36, .06);
  --shadow-md: 0 8px 20px -6px rgba(15, 20, 36, .12), 0 2px 4px rgba(15, 20, 36, .04);
  --shadow-lg: 0 24px 56px -12px rgba(15, 20, 36, .30), 0 4px 12px rgba(15, 20, 36, .08);

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 16px;
  --sidebar-w: 260px;

  /* DA / DR score tiers: <20, 20–39, 40–59, 60–79, 80+ */
  --s0-bg: #f0f2f7; --s0-fg: #687087;
  --s1-bg: #e9f2ff; --s1-fg: #1f62c9;
  --s2-bg: #eeedff; --s2-fg: #4f43d6;
  --s3-bg: #e3f6ee; --s3-fg: #0a7d57;
  --s4-bg: #0c8f63; --s4-fg: #ffffff;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0e18;
  --surface: #121726;
  --surface-2: #161c2d;
  --surface-3: #1c2336;
  --border: #232a3e;
  --border-strong: #313a54;
  --text: #eceef6;
  --text-2: #c4c9d8;
  --muted: #8f96ab;
  --faint: #646c84;

  --primary: #6366f1;
  --primary-hover: #7477f5;
  --accent: #a5b4fc;
  --primary-soft: rgba(99, 102, 241, .16);
  --ring: rgba(129, 140, 248, .35);

  --success: #34d399;  --success-soft: rgba(52, 211, 153, .13);
  --info: #60a5fa;     --info-soft: rgba(96, 165, 250, .13);
  --warn: #fbbf24;     --warn-soft: rgba(251, 191, 36, .12);
  --danger: #f87171;   --danger-soft: rgba(248, 113, 113, .13);

  --sb-bg: linear-gradient(180deg, #0f1426 0%, #090c16 100%);
  --dock-bg: #1b2236;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px -2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);

  --s0-bg: #1c2336; --s0-fg: #8f96ab;
  --s1-bg: rgba(96, 165, 250, .15); --s1-fg: #93c5fd;
  --s2-bg: rgba(129, 140, 248, .18); --s2-fg: #c7d2fe;
  --s3-bg: rgba(52, 211, 153, .15); --s3-fg: #6ee7b7;
  --s4-bg: #10b981; --s4-fg: #052e20;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) transparent; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
strong { font-weight: 650; }
::selection { background: var(--ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico { flex-shrink: 0; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Brand ---------- */
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 8px 18px -6px rgba(99, 102, 241, .7), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.logo-mark.lg { width: 44px; height: 44px; border-radius: 13px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 70;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--sb-bg);
  color: var(--sb-text);
  border-right: 1px solid var(--sb-border);
  overflow-y: auto;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none;
  background: radial-gradient(260px 160px at 20% 0%, rgba(99, 102, 241, .22), transparent 70%);
}
.sb-brand {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 20px; color: #fff; text-decoration: none;
}
.sb-brand:hover { text-decoration: none; }
.sb-brand .name { font-weight: 650; font-size: 15px; letter-spacing: -.015em; line-height: 1.2; }
.sb-brand .tagline { display: block; font-size: 11.5px; font-weight: 500; color: var(--sb-muted); letter-spacing: .01em; }
.sb-section { position: relative; margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-label {
  padding: 0 10px 6px; font-size: 10.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--sb-muted);
}
.sb-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; border-radius: 9px;
  color: var(--sb-text); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.sb-link .ico { color: var(--sb-muted); transition: color .15s; }
.sb-link:hover { background: var(--sb-hover); color: #fff; text-decoration: none; }
.sb-link:hover .ico { color: #dfe2f0; }
.sb-link.active { background: var(--sb-active); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
.sb-link.active .ico { color: #a5b4fc; }
.sb-link.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-grad);
}
.sb-foot { position: relative; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--sb-border); }
.sb-user {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 11px;
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left;
  transition: background .15s;
}
.sb-user:hover, .sb-user[aria-expanded="true"] { background: var(--sb-hover); }
.sb-user .meta { min-width: 0; flex: 1; }
.sb-user .n { color: #fff; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .l { color: var(--sb-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user > .ico { color: var(--sb-muted); }

.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 650; font-size: 12.5px; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, hsl(var(--h, 240) 70% 58%), hsl(calc(var(--h, 240) + 35) 65% 48%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }

.menu {
  position: absolute; z-index: 80; min-width: 240px; padding: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop-in .14s ease-out;
}
.sb-foot .menu { left: 0; right: 0; bottom: calc(100% + 8px); }
.menu .who { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu .who .n { font-weight: 650; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border: 0; background: none; border-radius: 8px; color: var(--text-2); font: inherit; font-weight: 500;
  cursor: pointer; text-align: left;
}
.menu-item .ico { color: var(--muted); }
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item.danger, .menu-item.danger .ico { color: var(--danger); }
.menu-label { padding: 8px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 0 6px 6px; padding: 3px;
  background: var(--surface-3); border-radius: 10px;
}
.segmented button {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 30px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.nav-backdrop { display: none; }

.page {
  width: 100%; max-width: 1440px; margin: 0 auto;
  padding: 32px 40px 72px;
  display: flex; flex-direction: column; gap: 20px;
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.page-title { min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-size: 12px; font-weight: 650; letter-spacing: .03em; color: var(--accent);
}
a.eyebrow { color: var(--muted); }
a.eyebrow:hover { color: var(--text); text-decoration: none; }
.page-head .sub { margin-top: 6px; color: var(--muted); max-width: 760px; font-size: 14px; }
.page-head .sub a { font-weight: 550; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.card-body { padding: 20px; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.head-ico {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--accent);
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; background: var(--brand-grad); color: #fff;
  font-size: 13px; font-weight: 700; box-shadow: 0 4px 10px -3px rgba(99, 102, 241, .6);
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: 16px 18px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  text-align: left; font: inherit; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .ico-tile {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--accent);
}
.stat .value {
  margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15;
  font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat .value.sm { font-size: 17px; letter-spacing: -.015em; margin-top: 10px; }
.stat .hint { margin-top: 4px; color: var(--muted); font-size: 12px; }
a.stat, button.stat { cursor: pointer; }
a.stat:hover, button.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring), var(--shadow-sm); }
.stat.active:hover { border-color: var(--accent); }
.stat.tone-new .ico-tile { background: var(--success-soft); color: var(--success); }
.stat.tone-existing .ico-tile { background: var(--info-soft); color: var(--info); }
.stat.tone-missing .ico-tile { background: var(--warn-soft); color: var(--warn); }
.stat.tone-bad .ico-tile { background: var(--danger-soft); color: var(--danger); }
.stat.tone-muted .ico-tile { background: var(--surface-3); color: var(--muted); }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.input, .select {
  height: 38px; padding: 0 12px; width: 100%; min-width: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font: inherit; font-size: 13.5px; font-weight: 400;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
textarea.input {
  height: auto; min-height: 100px; padding: 10px 12px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
}
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d94a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.input-icon { position: relative; display: block; min-width: 0; }
.input-icon > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > .input { padding-left: 37px; }
.affix { position: relative; display: inline-block; }
.affix > span {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-weight: 550; pointer-events: none;
}
.affix > .input { padding-left: 26px; }

.range { display: flex; align-items: stretch; }
.range .input { border-radius: var(--r) 0 0 var(--r); }
.range .input + .input { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.range .input:focus { position: relative; z-index: 1; }

input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 18px; height: 18px; margin: 0;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-grid; place-content: center; cursor: pointer; vertical-align: middle;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--accent); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
input[type="checkbox"]:checked {
  border-color: var(--primary);
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
input[type="radio"]:checked { border: 5px solid var(--primary); background: #fff; }
input:disabled { cursor: not-allowed; opacity: .55; }

.check { display: inline-flex; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--text-2); cursor: pointer; line-height: 1.45; }
.check input { margin-top: 1px; }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.radio-card {
  position: relative; display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; border: 1px solid var(--border-strong); border-radius: 14px; cursor: pointer;
  background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s;
}
.radio-card:hover { border-color: var(--faint); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.radio-card input { position: absolute; top: 16px; right: 16px; }
.radio-card .rc-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-3); color: var(--muted);
}
.radio-card:has(input:checked) .rc-ico { background: var(--brand-grad); color: #fff; }
.radio-card strong { display: block; margin-bottom: 2px; padding-right: 26px; }
.radio-card.disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s, transform .06s;
}
.btn .ico { color: var(--muted); transition: color .15s; }
.btn:hover { background-color: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:hover .ico { color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary) linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
  border-color: var(--primary); color: var(--on-primary);
  box-shadow: 0 1px 2px rgba(15, 20, 36, .14), 0 6px 14px -4px rgba(79, 70, 229, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary .ico, .btn-primary:hover .ico { color: currentColor; }
.btn-primary:hover { background-color: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px var(--ring), 0 6px 14px -4px rgba(79, 70, 229, .55); }
.btn-danger { color: var(--danger); }
.btn-danger .ico, .btn-danger:hover .ico { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-danger-solid .ico { color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; gap: 6px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 550; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--danger); }

/* ---------- Filters ---------- */
.fp-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.fp-head h2 { display: flex; align-items: center; gap: 10px; font-size: 15.5px; letter-spacing: -.01em; }
.fp-head h2 .ico { color: var(--text-2); }
.fp-applied {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.fp-applied.on { background: var(--primary-soft); color: var(--accent); }
.fp-reset:disabled { opacity: .45; }
.fp-body { padding: 18px 20px 20px; }

.fp-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fp-bar .input, .fp-bar .select { height: 40px; }
.fp-bar .chips-input { min-height: 40px; }
.fp-search { flex: 1 1 200px; max-width: 520px; }
.fp-search .input { text-overflow: ellipsis; }
.fp-pick { flex: 0 1 190px; min-width: 170px; }
.fp-pick.wide { flex: 1 1 190px; max-width: 380px; }
.fp-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-chip {
  height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 550; box-shadow: var(--shadow-xs);
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.fp-chip:hover { border-color: var(--faint); color: var(--text); }
.fp-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.fp-chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--accent); color: var(--accent); }
.fp-adv-btn { height: 40px; margin-left: auto; }
.fp-adv-btn .fp-chev { transition: transform .2s; }
.fp-adv-btn.open { background: var(--primary-soft); border-color: var(--accent); color: var(--accent); }
.fp-adv-btn.open .ico, .fp-adv-btn.open:hover .ico { color: var(--accent); }
.fp-adv-btn.open .fp-chev { transform: rotate(180deg); }
.fp-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.fp-adv {
  margin-top: 16px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: var(--surface); container-type: inline-size; animation: fp-in .18s ease-out;
}
.fp-adv[hidden] { display: none; }
@keyframes fp-in { from { opacity: 0; transform: translateY(-4px); } }
.fp-adv-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 18px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2));
  color: var(--text); font: inherit; font-size: 14.5px; font-weight: 650; text-align: left;
}
.fp-adv-head .ico { color: var(--text-2); }
.fp-adv-head:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.fp-adv-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.fp-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px 20px 20px; }
.fp-sec + .fp-sec { border-top: 1px solid var(--border); }
.fp-sec h3 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14px; font-weight: 650; }
.fp-sec h3 .ico { color: var(--muted); }
.fp-options .check { align-items: center; }
/* Medium: metrics on their own row, the other sections side by side below.
   Wide: everything in one row. Buyers only have Metrics (solo). */
@container (min-width: 640px) {
  .fp-adv-body { grid-template-columns: repeat(var(--secs), minmax(0, 1fr)); }
  .fp-metrics { grid-column: 1 / -1; border-bottom: 1px solid var(--border); }
  .fp-sec + .fp-sec { border-top: 0; }
  .fp-sec:not(.fp-metrics) + .fp-sec { border-left: 1px solid var(--border); }
}
@container (min-width: 1240px) {
  .fp-adv-body { grid-template-columns: minmax(0, 2.4fr) repeat(var(--secs), minmax(0, 1fr)); }
  .fp-metrics { grid-column: auto; border-bottom: 0; }
  .fp-sec + .fp-sec { border-left: 1px solid var(--border); }
}
.fp-adv-body.solo { grid-template-columns: minmax(0, 1fr); }
.fp-adv-body.solo .fp-metrics { border-bottom: 0; }

/* Dual-handle range slider */
.rs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 24px; }
.rs-head { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; color: var(--text); white-space: nowrap; }
.rs-tip { display: inline-flex; color: var(--faint); cursor: help; }
.rs-tip:hover { color: var(--muted); }
.rs-value {
  display: inline-flex; align-items: center; gap: 1px;
  margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rs-value.on { color: var(--accent); font-weight: 650; }
/* Looks like plain text; a soft background on hover shows it can be typed in */
.rs-num {
  field-sizing: content; min-width: 1ch; height: 20px; padding: 0 3px; margin: 0;
  border: 0; border-radius: 5px; background: transparent; color: inherit;
  font: inherit; font-variant-numeric: inherit; text-align: center; cursor: text;
  transition: background-color .12s, box-shadow .12s;
}
.rs-num:hover { background: var(--surface-3); }
.rs-num:focus { outline: none; background: var(--surface); color: var(--text); box-shadow: 0 0 0 1.5px var(--accent); }
.rs { position: relative; height: 22px; margin-top: 10px; }
.rs-track, .rs-fill { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 999px; }
.rs-track { left: 0; right: 0; background: var(--border); }
.rs-fill { background: var(--primary); }
.rs input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.rs input[type="range"].top { z-index: 2; }
.rs input[type="range"]:focus { outline: none; }
.rs input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.rs input[type="range"]::-moz-range-track { background: transparent; border: 0; }
.rs input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: grab;
  width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary); box-shadow: 0 1px 3px rgba(15, 20, 36, .25);
  transition: box-shadow .15s, transform .1s;
}
.rs input[type="range"]::-moz-range-thumb {
  pointer-events: auto; cursor: grab; box-sizing: border-box;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary); box-shadow: 0 1px 3px rgba(15, 20, 36, .25);
}
.rs input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--ring); }
.rs input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--ring); }
.rs input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); }
.rs input[type="range"]:active::-moz-range-thumb { cursor: grabbing; }

.count-pill {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
}

/* ---------- Toolbar & tables ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.toolbar .count { font-weight: 650; font-size: 14px; }
.toolbar .input-icon { width: 240px; max-width: 100%; }
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th, table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  padding-top: 10px; padding-bottom: 10px;
  background: var(--surface-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
table.data th.num, table.data td.num { text-align: right; }
table.data tbody tr { transition: background-color .1s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.selected { background: var(--primary-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
.th-inner { display: inline-flex; align-items: center; gap: 4px; }
.th-inner .ico { opacity: .45; }
th.sorted { color: var(--text) !important; }
th.sorted .th-inner .ico { opacity: 1; color: var(--accent); }
table.data td.check-col, table.data th.check-col { width: 44px; padding-right: 0; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data td.actions .btn + .btn { margin-left: 4px; }

.dom { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dom-ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px; text-transform: uppercase;
  color: hsl(var(--h, 240) 55% 38%); background: hsl(var(--h, 240) 80% 95%);
  border: 1px solid hsl(var(--h, 240) 60% 90%);
}
:root[data-theme="dark"] .dom-ico {
  color: hsl(var(--h, 240) 85% 80%); background: hsl(var(--h, 240) 35% 18%); border-color: hsl(var(--h, 240) 30% 26%);
}
.dom-name { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-weight: 600; color: var(--text); white-space: nowrap; }
.dom-name .tld { color: var(--muted); font-weight: 500; }
a.dom-name:hover { color: var(--accent); text-decoration: none; }
a.dom-name:hover .tld { color: inherit; }
.dom-name .ext { color: var(--faint); opacity: 0; transition: opacity .15s; }
tr:hover .dom-name .ext, .dom-name:focus-visible .ext { opacity: 1; }

.score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 24px; padding: 0 7px; border-radius: 7px;
  font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.score.s0 { background: var(--s0-bg); color: var(--s0-fg); }
.score.s1 { background: var(--s1-bg); color: var(--s1-fg); }
.score.s2 { background: var(--s2-bg); color: var(--s2-fg); }
.score.s3 { background: var(--s3-bg); color: var(--s3-fg); }
.score.s4 { background: var(--s4-bg); color: var(--s4-fg); }
.score.none { color: var(--faint); font-weight: 500; }
.score.ss-low { background: var(--success-soft); color: var(--success); }
.score.ss-mid { background: var(--warn-soft); color: var(--warn); }
.score.ss-high { background: var(--danger-soft); color: var(--danger); }
.traffic { font-weight: 600; font-variant-numeric: tabular-nums; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.price.none, .traffic.none { color: var(--faint); font-weight: 500; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty::before {
  content: ""; display: block; width: 30px; height: 30px; margin: 0 auto 14px;
  background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.empty a { font-weight: 600; }

.pager {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
.pager .select { width: auto; height: 30px; font-size: 12.5px; padding-left: 10px; border-radius: var(--r-sm); }
.pager .page-no { color: var(--text-2); font-weight: 550; font-variant-numeric: tabular-nums; }
.pager label { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Floating selection bar ---------- */
.selection-bar {
  position: fixed; z-index: 45; bottom: 24px;
  left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2); transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - var(--sidebar-w) - 40px);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 8px 8px 16px; border-radius: 14px;
  background: var(--dock-bg); color: #eef0f7;
  box-shadow: 0 20px 40px -10px rgba(10, 12, 24, .55), 0 0 0 1px rgba(255, 255, 255, .08);
  animation: dock-in .2s cubic-bezier(.2, .8, .2, 1);
}
.selection-bar strong { font-weight: 650; white-space: nowrap; }
.selection-bar .muted { color: #9aa1b8; }
.selection-bar .link-btn { color: #b4bdfd; }
.selection-bar .sep { width: 1px; align-self: stretch; margin: 2px 4px; background: rgba(255, 255, 255, .12); }
.selection-bar .btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); color: #eef0f7; box-shadow: none; }
.selection-bar .btn .ico { color: #a9afc4; }
.selection-bar .btn:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .16); }
.selection-bar .btn:hover .ico { color: #fff; }
.selection-bar .btn-danger, .selection-bar .btn-danger .ico { color: #fca5a5; }
.selection-bar .btn-danger:hover { background: rgba(248, 113, 113, .16); }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle;
  background: var(--surface-3); color: var(--text-2);
}
.badge .ico { width: 12px; height: 12px; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { background: var(--success-soft); color: var(--success); }
.badge.existing { background: var(--info-soft); color: var(--info); }
.badge.missing { background: var(--warn-soft); color: var(--warn); }
.badge.hidden-b { background: var(--danger-soft); color: var(--danger); }
.badge.admin { background: var(--primary-soft); color: var(--accent); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  background: hsl(var(--h, 220) 80% 96%); color: hsl(var(--h, 220) 50% 32%);
  box-shadow: inset 0 0 0 1px hsl(var(--h, 220) 60% 89%);
}
.chip::before { content: "#"; opacity: .45; font-weight: 600; }
:root[data-theme="dark"] .chip {
  background: hsl(var(--h, 220) 35% 17%); color: hsl(var(--h, 220) 75% 80%);
  box-shadow: inset 0 0 0 1px hsl(var(--h, 220) 30% 26%);
}
.chip button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; opacity: .55; }
.chip button:hover { opacity: 1; }

/* Categories: public, so a calm outlined pill instead of the coloured #tag chips */
.cats { display: flex; flex-wrap: wrap; gap: 4px; }
.cat {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong);
}
.cat.more { color: var(--muted); cursor: default; }
.cat button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; opacity: .55; }
.cat button:hover { opacity: 1; }
.dom-cats { display: none; }

.chips-input {
  position: relative; display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  min-height: 38px; padding: 5px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow-xs); cursor: text; transition: border-color .15s, box-shadow .15s;
}
.chips-input:hover { border-color: var(--faint); }
.chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.chips-input input {
  flex: 1; min-width: 110px; height: 26px; border: 0; outline: 0; background: none;
  color: var(--text); font: inherit; font-size: 13.5px; font-weight: 400;
}
.chips-input input::placeholder { color: var(--faint); }
.suggest {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 30;
  max-height: 240px; overflow: auto; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.suggest button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 7px;
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
.suggest button:hover, .suggest button.active { background: var(--primary-soft); color: var(--accent); }

/* ---------- Upload ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 36px 20px; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2);
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--primary-soft); outline: none; }
.dropzone.drag { border-color: var(--accent); background: var(--primary-soft); border-style: solid; }
.dropzone .dz-ico {
  width: 52px; height: 52px; border-radius: 15px; margin-bottom: 8px;
  display: grid; place-items: center; color: var(--accent);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.dropzone.has-file .dz-ico { color: var(--success); }
.dropzone .file-name { font-weight: 650; color: var(--text); font-size: 14.5px; }
.dropzone .file-name .accent { color: var(--accent); }

.callout {
  position: relative; display: block;
  padding: 12px 14px 12px 40px; border-radius: 12px; font-size: 13px; line-height: 1.55;
  background: var(--info-soft); color: var(--text-2);
  border: 1px solid color-mix(in srgb, var(--info) 16%, transparent);
}
.callout::before {
  content: ""; position: absolute; left: 14px; top: 14px; width: 16px; height: 16px; background: var(--info);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.callout.warn::before { background: var(--warn); }
.callout.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 18%, transparent); }
.callout.danger::before { background: var(--danger); }
code {
  font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--border);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(9, 11, 22, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade-in .15s ease-out;
}
.modal {
  width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: modal-in .2s cubic-bezier(.2, .8, .2, 1);
}
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 4px 24px; }
.modal-head h2 { flex: 1; min-width: 0; padding-top: 4px; font-size: 17px; letter-spacing: -.015em; overflow-wrap: anywhere; }
.modal-head .btn { margin-top: -2px; }
.modal-body { padding: 14px 24px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-body > p { color: var(--text-2); }
.modal-foot {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 18px 18px;
}
.credentials {
  padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px;
  border-radius: 12px; background: #141a2e; color: #eef0f7; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 18px 40px -12px rgba(10, 12, 24, .6), 0 0 0 1px rgba(255, 255, 255, .08);
  animation: toast-in .22s cubic-bezier(.2, .8, .2, 1); pointer-events: auto;
}
.toast .ico { color: #a5b4fc; }
.toast.success .ico { color: #34d399; }
.toast.error .ico { color: #f87171; }

/* ---------- Sign-in page ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-aside {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px 56px; color: #dfe2ef;
  background:
    radial-gradient(900px 520px at -10% -15%, rgba(99, 102, 241, .5), transparent 60%),
    radial-gradient(700px 480px at 115% 115%, rgba(139, 92, 246, .38), transparent 60%),
    #0a0e1d;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 650; font-size: 16px; letter-spacing: -.015em; }
.auth-hero h2 { font-size: 42px; line-height: 1.08; letter-spacing: -.035em; font-weight: 700; color: #fff; max-width: 520px; }
.auth-hero h2 em {
  font-style: normal; background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-hero p { margin-top: 18px; color: #a3a9c2; font-size: 15.5px; line-height: 1.6; max-width: 460px; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: #d3d7e6; font-size: 14px; }
.auth-points .pt {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); color: #a5b4fc; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.auth-preview {
  width: min(440px, 100%); padding: 14px; border-radius: 18px;
  background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), 0 30px 60px -20px rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.auth-preview .pv-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 11px; }
.auth-preview .pv-row + .pv-row { margin-top: 2px; }
.auth-preview .pv-row:first-child { background: rgba(255, 255, 255, .06); }
.auth-preview .pv-tile { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; }
.auth-preview .pv-tile.a { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.auth-preview .pv-tile.b { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.auth-preview .pv-tile.c { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.auth-preview .pv-bar { width: 72%; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .16); }
.auth-preview .pv-row:nth-child(2) .pv-bar { width: 58%; }
.auth-preview .pv-row:nth-child(3) .pv-bar { width: 64%; }
.auth-preview .pv-bar.short { width: 38%; background: rgba(255, 255, 255, .08); margin-top: 6px; }
.auth-preview .pv-text { flex: 1; min-width: 0; }
.auth-preview .pv-score { min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.auth-preview .pv-score.hi { background: rgba(52, 211, 153, .16); color: #6ee7b7; }
.auth-preview .pv-score.mid { background: rgba(129, 140, 248, .2); color: #c7d2fe; }
.auth-preview .pv-score.lo { background: rgba(96, 165, 250, .16); color: #93c5fd; }
.auth-preview .pv-price { min-width: 48px; text-align: right; font-weight: 700; color: #fff; font-size: 13px; }
.auth-foot { color: #6f7692; font-size: 12.5px; }

.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: min(400px, 100%); }
.auth-mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 36px; font-weight: 650; font-size: 16px; }
.auth-card h1 { font-size: 30px; letter-spacing: -.03em; }
.auth-card .sub { margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; margin-top: 30px; }
.auth-card .input { height: 44px; font-size: 14.5px; border-radius: 11px; }
.auth-card .input-icon > .ico { left: 14px; }
.auth-card .input-icon > .input { padding-left: 42px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; color: var(--faint);
  display: grid; place-items: center; cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.input-icon .input.has-toggle { padding-right: 46px; }
.form-error { display: none; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 550; font-size: 13px; }
.form-error:not(:empty) { display: flex; }
.auth-note {
  display: flex; align-items: center; gap: 10px; margin-top: 28px; padding: 12px 14px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px;
}
.auth-note .ico { color: var(--success); }

/* ---------- Page transitions ---------- */
/* Cross-document view transitions (Chrome, Edge, Safari): the sidebar and mobile bar stay
   put while the content area fades across. Other browsers simply load the next page. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
.sidebar { view-transition-name: sidebar; }
.mobilebar { view-transition-name: mobilebar; }
::view-transition-old(root) { animation: vt-out .16s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vt-in .26s cubic-bezier(0, 0, .2, 1) both; }
::view-transition-group(sidebar), ::view-transition-group(mobilebar) { animation-duration: .22s; }

/* Page sections rise in as their data arrives (also when a hidden step is revealed).
   "backwards" fill leaves no transform behind, so dropdowns are never trapped under a card. */
.page > :not(.selection-bar) { animation: page-in .42s cubic-bezier(.2, .8, .2, 1) backwards; }
.page > :nth-child(2) { animation-delay: .04s; }
.page > :nth-child(3) { animation-delay: .08s; }
.page > :nth-child(4) { animation-delay: .12s; }
.page > :nth-child(5) { animation-delay: .16s; }
.page > :nth-child(n + 6) { animation-delay: .2s; }
.table-wrap { transition: opacity .2s ease; }

/* ---------- Animations ---------- */
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .page { padding: 28px 28px 72px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 290px);
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(9, 11, 22, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    animation: fade-in .2s;
  }
  body.nav-open { overflow: hidden; }
  .mobilebar {
    display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 10px;
    height: 58px; padding: 0 12px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobilebar .mb-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -.015em; }
  .mobilebar .mb-brand:hover { text-decoration: none; }
  .mobilebar .logo-mark { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
  .selection-bar { left: 50%; max-width: calc(100vw - 24px); bottom: 14px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; }
}
@media (max-width: 640px) {
  .page { padding: 20px 16px 96px; gap: 16px; }
  h1, .auth-card h1 { font-size: 23px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 21px; }
  .stat .ico-tile { width: 28px; height: 28px; }
  .card-head, .toolbar { padding: 12px 14px; }
  .card-body { padding: 16px 14px; }
  .fp-head { padding: 12px 14px; }
  .fp-body { padding: 14px; }
  .fp-search, .fp-pick, .fp-pick.wide { flex: 1 1 100%; max-width: none; }
  .fp-quick { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .fp-quick::-webkit-scrollbar { display: none; }
  .fp-chip { height: 36px; padding: 0 13px; }
  .fp-adv-btn { flex: 1 1 auto; margin-left: 0; }
  .fp-adv { margin-top: 14px; }
  .fp-sec { padding: 14px; }
  .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
  .rs-tip { display: none; } /* hover tooltips don't work on touch screens */
  .toolbar .input-icon { width: 100%; }
  .table-wrap { max-height: none; }
  table.data { font-size: 13px; }
  table.data th, table.data td { padding: 10px 6px; }
  table.data th { font-size: 10.5px; letter-spacing: .03em; }
  table.data th:first-child, table.data td:first-child { padding-left: 14px; }
  table.data th:last-child, table.data td:last-child { padding-right: 14px; }
  .th-inner .ico { display: none; }
  th.sorted .th-inner .ico { display: block; }
  /* Wide tables scroll sideways; the domain column stays in view */
  table.data td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  table.data th:first-child { left: 0; z-index: 3; }
  table.data tbody tr:hover td:first-child { background: var(--surface-2); }
  table.data td:first-child { box-shadow: 1px 0 0 var(--border); }
  .pager .rpp { display: none; }
  .dom-ico { display: none; }
  .dom { flex-wrap: wrap; gap: 3px 8px; }
  .col-cats { display: none; }
  .dom-cats { display: block; flex-basis: 100%; }
  .dom-name .ext { display: none; }
  .score { min-width: 30px; padding: 0 5px; }
  .pager { padding: 12px 14px; }
  .modal-head { padding: 18px 16px 2px 18px; }
  .modal-body { padding: 12px 18px 18px; }
  .modal-foot { padding: 12px 16px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
