/* Find Right Journal — design system */
:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #eceef4;
  --border: #e3e6ee;
  --border-strong: #cfd4e0;
  --text: #0e1526;
  --text-2: #4a5468;
  --muted: #7f889b;
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef0ff;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #c026d3 100%);
  --good: #0f8a5f; --good-bg: #e7f6ef;
  --bad: #c2362f; --bad-bg: #fdecea;
  --warn: #9a6200; --warn-bg: #fff4dc;
  --sidebar: #0d1230;
  --sidebar-2: #151b43;
  --sidebar-text: #aab1d6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 9px;

  /* index identity colours — categorical slots, fixed order */
  --c-scopus: #2a78d6;
  --c-wos: #eb6834;
  --c-abdc: #1baf7a;
  --c-doaj: #eda100;
  --c-5: #e87ba4;
  --c-6: #008300;
  --c-7: #4a3aa7;
  --c-8: #e34948;
  --c-1: #2a78d6; --c-2: #eb6834; --c-3: #1baf7a; --c-4: #eda100;
  /* sequential (single hue, light → dark) */
  --seq-1: #dbe8fb; --seq-2: #a9c8f3; --seq-3: #6fa3e8; --seq-4: #2a78d6; --seq-5: #1a4f95;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e1a; --surface: #131829; --surface-2: #1a2034; --surface-3: #222a41;
    --border: #262e47; --border-strong: #36405e;
    --text: #eef1fa; --text-2: #b4bbd0; --muted: #7e87a1;
    --brand: #7c7cff; --brand-600: #9494ff; --brand-50: #1e2146;
    --good: #3fcf94; --good-bg: #0f2b22; --bad: #ff7b72; --bad-bg: #331616; --warn: #f0b84a; --warn-bg: #2e2412;
    --sidebar: #080b18; --sidebar-2: #10152b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
    --c-scopus: #3987e5; --c-wos: #d95926; --c-abdc: #199e70; --c-doaj: #c98500;
    --c-5: #d55181; --c-6: #008300; --c-7: #9085e9; --c-8: #e66767;
    --c-1: #3987e5; --c-2: #d95926; --c-3: #199e70; --c-4: #c98500;
    --seq-1: #1b2d4d; --seq-2: #1f4880; --seq-3: #2d68b8; --seq-4: #4f8fe6; --seq-5: #9cc2f5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e1a; --surface: #131829; --surface-2: #1a2034; --surface-3: #222a41;
  --border: #262e47; --border-strong: #36405e;
  --text: #eef1fa; --text-2: #b4bbd0; --muted: #7e87a1;
  --brand: #7c7cff; --brand-600: #9494ff; --brand-50: #1e2146;
  --good: #3fcf94; --good-bg: #0f2b22; --bad: #ff7b72; --bad-bg: #331616; --warn: #f0b84a; --warn-bg: #2e2412;
  --sidebar: #080b18; --sidebar-2: #10152b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --c-scopus: #3987e5; --c-wos: #d95926; --c-abdc: #199e70; --c-doaj: #c98500;
  --c-5: #d55181; --c-6: #008300; --c-7: #9085e9; --c-8: #e66767;
  --c-1: #3987e5; --c-2: #d95926; --c-3: #199e70; --c-4: #c98500;
  --seq-1: #1b2d4d; --seq-2: #1f4880; --seq-3: #2d68b8; --seq-4: #4f8fe6; --seq-5: #9cc2f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ── Buttons & inputs ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .28); }
.btn.primary:hover { background: var(--brand-600); }
.btn.grad { background: var(--brand-grad); border: 0; color: #fff; box-shadow: 0 6px 18px rgba(124, 58, 237, .35); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }

.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f889b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* segmented / chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; user-select: none; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand); }
.chip .dot { width: 8px; height: 8px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button.on.in { background: var(--good); color: #fff; }
.seg button.on.out { background: var(--bad); color: #fff; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }
input[type=range] { accent-color: var(--brand); width: 100%; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--dc, var(--muted)); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 650; color: var(--text); white-space: nowrap;
  background: color-mix(in srgb, var(--dc, var(--muted)) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--dc, var(--muted)) 35%, transparent);
}
.badge .dot { width: 7px; height: 7px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.q { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 11.5px; font-weight: 750; }
.q.Q1 { background: var(--seq-5); color: #fff; } .q.Q2 { background: var(--seq-4); color: #fff; }
.q.Q3 { background: var(--seq-2); color: var(--text); } .q.Q4 { background: var(--seq-1); color: var(--text); }
:root[data-theme="dark"] .q.Q1 { color: #0b0e1a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .q.Q1 { color: #0b0e1a; } }
.rank { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.rank.r4 { background: var(--c-abdc); border-color: var(--c-abdc); color: #fff; }
.rank.r3 { background: color-mix(in srgb, var(--c-abdc) 55%, var(--surface)); border-color: transparent; }
.rank.r2 { background: color-mix(in srgb, var(--c-abdc) 25%, var(--surface)); }
.tag-ok { color: var(--good); font-weight: 700; } .tag-no { color: var(--muted); }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; color: #fff; }
.logo { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-grad); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(124, 58, 237, .45); }
.logo svg { width: 20px; height: 20px; stroke: #fff; }
.brand b { display: block; font-size: 15.5px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11px; color: var(--sidebar-text); opacity: .8; }
.nav-group { margin: 14px 0 4px; padding: 0 12px; font-size: 10.5px; letter-spacing: .09em; font-weight: 700; text-transform: uppercase; color: #6d76a3; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: var(--sidebar-text);
  font-weight: 550; font-size: 13.5px; margin: 1px 0; position: relative;
}
.nav a:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(124,124,255,.22), rgba(124,124,255,.06)); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #8b8bff; }
.nav a .dot { width: 8px; height: 8px; margin: 0 5px; }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,.07); color: #cdd2ee; }
.nav a .new { margin-left: auto; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 5px; background: var(--brand-grad); color: #fff; letter-spacing: .04em; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.side-note { font-size: 11px; line-height: 1.45; color: #6d76a3; padding: 10px 12px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .search { max-width: 520px; flex: 1; }
.topbar .search .input { height: 40px; background: var(--surface); }
.kbd { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }
.search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.menu-btn { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 13px; color: #fff; background: var(--brand-grad); flex: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 99px; cursor: pointer; border: 1px solid transparent; background: none; }
.user-chip:hover { background: var(--surface); border-color: var(--border); }
.user-chip .meta { text-align: left; line-height: 1.2; }
.user-chip .meta b { font-size: 13px; display: block; }
.user-chip .meta small { font-size: 11px; color: var(--muted); }
.role-tag { font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; background: var(--brand-50); color: var(--brand); }
.dropdown { position: absolute; right: 24px; top: 58px; width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.dropdown button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 550; }
.dropdown button:hover { background: var(--surface-2); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

.view { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .ph-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--dc, var(--brand)); flex: none; box-shadow: 0 8px 20px color-mix(in srgb, var(--dc, var(--brand)) 35%, transparent); }
.page-head .ph-icon svg { width: 24px; height: 24px; }
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.02em; line-height: 1.25; }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 760px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.edition { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.edition .live { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { margin: 0; font-size: 14.5px; letter-spacing: -.005em; }
.card-h .sub { font-size: 12px; color: var(--muted); }
.card-h .actions { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 16px; }

.kpi { padding: 16px 16px 14px; position: relative; overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--dc, var(--brand)) 45%, var(--border)); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--dc, var(--brand)); }
.kpi .k-top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 650; }
.kpi .k-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--dc, var(--brand)); background: color-mix(in srgb, var(--dc, var(--brand)) 13%, transparent); }
.kpi .k-val { font-size: 28px; font-weight: 780; letter-spacing: -.025em; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }

.hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 26px 28px; color: #fff; background: var(--brand-grad);
  box-shadow: 0 16px 40px rgba(79, 70, 229, .28); margin-bottom: 18px;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero::before { width: 360px; height: 360px; right: -80px; top: -180px; }
.hero::after { width: 220px; height: 220px; right: 180px; bottom: -150px; }
.hero h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; position: relative; }
.hero p { margin: 0 0 16px; opacity: .88; position: relative; }
.hero form { display: flex; gap: 10px; max-width: 760px; position: relative; }
.hero .input { height: 46px; border: 0; background: rgba(255,255,255,.96); color: #0e1526; }
.hero .btn { height: 46px; background: #0e1526; color: #fff; border: 0; }
.hero .hint-row { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; }
.hero .hint-row button { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; }
.hero .hint-row button:hover { background: rgba(255,255,255,.26); }

/* ── Toolbar & table ──────────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1; min-width: 220px; }
.toolbar .select { width: auto; min-width: 150px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters-row .fg { display: flex; align-items: center; gap: 8px; }
.filters-row .fg > .label { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.sorted { color: var(--brand); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.j-title { font-weight: 650; color: var(--text); line-height: 1.35; }
.j-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.star { border: 0; background: none; cursor: pointer; color: var(--border-strong); padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.star:hover { color: var(--c-doaj); background: var(--surface-2); }
.star.on { color: var(--c-doaj); }
.star.on svg { fill: currentColor; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pager .grow { min-width: 120px; }
.empty { padding: 50px 20px; text-align: center; color: var(--text-2); }
.empty .e-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted); }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.metric { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-in { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar-in > i { display: block; height: 100%; border-radius: 99px; background: var(--dc, var(--brand)); }

/* ── Stat strip ───────────────────────────────────────────────────────────── */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.strip .s { padding: 13px 15px; }
.strip .s .v { font-size: 21px; font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.strip .s .l { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ── Charts ───────────────────────────────────────────────────────────────── */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--text-2); font-size: 11.5px; }
.chart .axis-l { stroke: var(--border); }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 2 4; }
.chart .val { fill: var(--text); font-weight: 700; font-size: 12px; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .mark { transition: opacity .15s; }
.chart g.hov:hover .mark { opacity: .8; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--surface); padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; box-shadow: var(--shadow-lg); max-width: 280px; opacity: 0; transition: opacity .1s; }
.tip.on { opacity: 1; }
.tip b { font-weight: 750; }
.heat { display: grid; gap: 3px; font-size: 11.5px; }
.heat .hc { height: 34px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; transition: transform .1s; }
.heat .hc:hover { transform: scale(1.06); }
.heat .hl { display: flex; align-items: center; color: var(--text-2); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .ht { writing-mode: horizontal-tb; text-align: center; color: var(--text-2); font-weight: 650; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Compare ──────────────────────────────────────────────────────────────── */
.cmp { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.cmp-side { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; }
.src-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.src-row:last-child { border-bottom: 0; }
.src-row.sub { padding-left: 20px; }
.src-row .nm { font-weight: 650; font-size: 13.5px; }
.src-row .ct { font-size: 11.5px; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 16px; }
.preset { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: all .15s; display: grid; gap: 6px; }
.preset:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.preset.on { border-color: var(--brand); background: var(--brand-50); }
.preset .p-t { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.preset .p-k { font-size: 11px; font-weight: 800; color: var(--brand); background: var(--brand-50); border-radius: 5px; padding: 1px 6px; }
.preset .p-d { font-size: 12px; color: var(--muted); }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.formula .op { font-weight: 800; color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.result-num { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.venn-wrap { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.venn circle { mix-blend-mode: multiply; }
:root[data-theme="dark"] .venn circle { mix-blend-mode: screen; }
.venn .region { cursor: pointer; }
.venn .region text { fill: var(--text); font-weight: 800; font-size: 13px; pointer-events: none; }
.venn .region .rb { fill: var(--surface); stroke: var(--border-strong); transition: all .15s; }
.venn .region:hover .rb { stroke: var(--brand); stroke-width: 2; }
.venn .region.sel .rb { fill: var(--brand); stroke: var(--brand); }
.venn .region.sel text { fill: #fff; }
.venn .lbl { font-weight: 750; font-size: 12.5px; fill: var(--text); }

/* ── Finder ───────────────────────────────────────────────────────────────── */
.finder { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 16px; align-items: start; }
.finder-form { position: sticky; top: 80px; }
.wc { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: -8px; margin-bottom: 10px; }
.res-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) 150px; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.res-card:hover { background: color-mix(in srgb, var(--brand) 3.5%, var(--surface)); }
.res-card:last-child { border-bottom: 0; }
.res-rank { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--text-2); }
.res-card:nth-child(1) .res-rank { background: var(--brand-grad); color: #fff; }
.res-card:nth-child(2) .res-rank, .res-card:nth-child(3) .res-rank { background: var(--brand-50); color: var(--brand); }
.fit { text-align: right; }
.fit .fv { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fit .fl { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.meter { display: grid; grid-template-columns: 70px 1fr 30px; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.meter .bar-in { min-width: 0; }
.terms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.term { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; background: var(--brand-50); color: var(--brand); font-weight: 600; }
.ai-glow { position: relative; }
.ai-glow::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--brand-grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--border); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ── Drawer & modal ───────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(8, 11, 24, .45); backdrop-filter: blur(2px); z-index: 70; animation: fadein .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 80; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-h { padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { margin: 6px 0 4px; font-size: 20px; letter-spacing: -.015em; line-height: 1.3; }
.drawer-b { padding: 18px 22px 30px; overflow-y: auto; flex: 1; }
.drawer-f { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.sec-t { font-size: 11.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 20px 0 10px; }
.idx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.idx-tile { border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; position: relative; overflow: hidden; }
.idx-tile.yes { border-color: color-mix(in srgb, var(--dc) 45%, var(--border)); background: color-mix(in srgb, var(--dc) 6%, var(--surface)); }
.idx-tile.no { opacity: .6; }
.idx-tile .it-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.idx-tile .it-s { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; }
.idx-tile .it-m { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.idx-tile .it-m div { font-size: 11px; color: var(--muted); }
.idx-tile .it-m b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.live-box { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; z-index: 90; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(980px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 4px 20px 16px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--border); }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 28px; text-align: center; cursor: pointer; transition: all .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.preview-tbl { font-size: 12px; }
.preview-tbl td, .preview-tbl th { padding: 6px 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice { display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; background: var(--warn-bg); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.notice svg { color: var(--warn); margin-top: 1px; }
.notice.info { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.notice.info svg { color: var(--brand); }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 550; font-size: 13px; animation: slidein .2s; }
.toast.err { background: var(--bad); color: #fff; }
.toast.ok svg { color: var(--good); }

/* ── Activity feed ────────────────────────────────────────────────────────── */
.feed { display: grid; }
.feed-i { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed-i:last-child { border-bottom: 0; }
.feed-i .fi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.feed-i .fi-t { font-size: 11.5px; color: var(--muted); }

/* ── Side-by-side ─────────────────────────────────────────────────────────── */
.sbs th, .sbs td { vertical-align: top; }
.sbs td:first-child { color: var(--muted); font-weight: 650; width: 170px; }
.sbs tbody tr { cursor: default; }
.best { background: var(--good-bg); color: var(--good); border-radius: 5px; padding: 0 5px; font-weight: 800; }

/* ── Auth page ────────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at -10% -10%, #7c3aed 0%, transparent 55%), radial-gradient(900px 700px at 110% 110%, #c026d3 0%, transparent 55%), #1b1d5e; color: #fff; padding: 44px 52px; display: flex; flex-direction: column; }
.auth-art .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.auth-art > * { position: relative; }
.auth-art h1 { font-size: 42px; line-height: 1.08; letter-spacing: -.035em; margin: 54px 0 14px; max-width: 560px; }
.auth-art h1 span { background: linear-gradient(90deg, #a5b4fc, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p.lead { font-size: 16px; opacity: .85; max-width: 520px; margin: 0 0 30px; }
.feat { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 580px; }
.feat div { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.feat div b { display: block; font-size: 13.5px; }
.feat div small { opacity: .75; }
.feat svg { flex: none; margin-top: 2px; }
.idx-logos { margin-top: auto; padding-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }
.idx-logos span { padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 700; display: inline-flex; gap: 7px; align-items: center; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 22px 0 18px; }
.auth-tabs .seg { display: grid; grid-template-columns: 1fr 1fr; }
.auth-tabs .seg button { height: 34px; }
.demo-box { margin-top: 18px; padding: 14px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface); }
.demo-box .row { margin-top: 8px; }
.err-msg { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 20px; margin: -4px 0 8px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cmp, .finder { grid-template-columns: 1fr; }
  .cmp-side, .finder-form { position: static; max-height: none; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .g-2, .g-3, .g-21, .g-12, .venn-wrap { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .user-chip .meta { display: none; }
}
@media (max-width: 640px) {
  .view { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search .kbd { display: none; }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-card { grid-template-columns: 36px minmax(0, 1fr); }
  .res-card .fit { grid-column: 2; text-align: left; }
  .idx-grid, .grid2 { grid-template-columns: 1fr; }
  .hero form { flex-direction: column; }
  .page-head .actions { margin-left: 0; }
}

/* ── Global coverage banner & category browser ───────────────────────────── */
.global-banner { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(180px, .8fr); gap: 20px; align-items: center; padding: 16px 20px; margin-bottom: 16px; position: relative; overflow: hidden;
  background: linear-gradient(100deg, color-mix(in srgb, var(--dc) 10%, var(--surface)) 0%, var(--surface) 60%); border-color: color-mix(in srgb, var(--dc) 30%, var(--border)); }
.global-banner::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dc); }
.gb-num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.gb-num span { font-size: 14px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.gb-break { display: flex; gap: 18px; flex-wrap: wrap; }
.gb-break > div { display: grid; }
.gb-break b { font-size: 16px; }
.gb-cat { border-left: 1px dashed var(--border-strong); padding-left: 18px; }
.cat-card { margin-bottom: 16px; }
.cat-card:empty { display: none; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; text-align: left; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all .15s; }
.cat:hover { border-color: var(--dc); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cat.on { border-color: var(--dc); background: color-mix(in srgb, var(--dc) 10%, var(--surface)); box-shadow: 0 0 0 1px var(--dc) inset; }
.cat-n { font-weight: 650; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-c { font-weight: 750; font-size: 12.5px; color: var(--text-2); }
.cat-b { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cat-b i { display: block; height: 100%; background: var(--dc); border-radius: 99px; }

/* ── Platform tiles (dashboard + platforms page) ──────────────────────────── */
.plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.plat { position: relative; display: grid; gap: 4px; padding: 14px 15px 13px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; cursor: pointer; text-align: left; }
.plat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--dc) 55%, var(--border)); text-decoration: none; }
.plat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--dc) 12%, transparent); }
.plat .p-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.plat .p-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--dc); background: color-mix(in srgb, var(--dc) 14%, transparent); flex: none; }
.plat .p-n { font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.plat .p-u { font-size: 12px; color: var(--muted); }
.plat .p-f { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-2); }
.plat .p-f .go { margin-left: auto; color: var(--dc); font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.hero .hero-actions { position: absolute; top: 22px; right: 24px; z-index: 1; }
.hero .hero-actions .btn { height: 38px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); color: #fff; backdrop-filter: blur(6px); }
.hero .hero-actions .btn:hover { background: rgba(255,255,255,.28); }
.plat-detail { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
.grade-row { display: grid; grid-template-columns: 90px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; margin: 6px 0; }
@media (max-width: 980px) { .global-banner, .plat-detail { grid-template-columns: 1fr; } .gb-cat { border-left: 0; padding-left: 0; } .hero .hero-actions { position: static; margin-bottom: 12px; } }
