:root {
  --bg: #0a0d14; --panel: #121826; --panel2: #1a2133; --line: #273149;
  --text: #e9edf7; --muted: #97a3ba;
  --green: #3fb950; --amber: #e3b341; --red: #f97583; --blue: #4f8ff7; --violet: #b48cff;
  --blue-hover: #74a9ff; --nav-active: #ffffff;
  --brand1: #6366f1; --brand2: #8b5cf6; --header-bg: rgba(18, 24, 38, .88);
  --pill-green: rgba(63, 185, 80, .15); --pill-amber: rgba(227, 179, 65, .15); --pill-red: rgba(249, 117, 131, .15);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  --menu-shadow: 0 16px 44px rgba(0, 0, 0, .55);
}
:root[data-theme="light"] {
  --bg: #f4f6fb; --panel: #ffffff; --panel2: #eef2f9; --line: #dde5f0;
  --text: #17203a; --muted: #64748b;
  --green: #1a7f37; --amber: #9a6700; --red: #cf222e; --blue: #2f6fe0; --violet: #7c3aed;
  --blue-hover: #1d5ccb; --nav-active: #17203a;
  --brand1: #4f46e5; --brand2: #7c3aed; --header-bg: rgba(255, 255, 255, .9);
  --pill-green: rgba(26, 127, 55, .12); --pill-amber: rgba(154, 103, 0, .12); --pill-red: rgba(207, 34, 46, .12);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --menu-shadow: 0 16px 40px rgba(16, 24, 40, .16);
}
body { transition: background-color .25s ease, color .25s ease; }
.card, .stat, .t-summary, .chat-box, .vault-doc, .book-text, .res-item, .chapter-block, .result {
  transition: background-color .25s ease, border-color .25s ease;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--blue-hover); }
#capv-items a[target="_blank"]::after,
#capv-deepdata a[target="_blank"]::after { content: " ↗"; font-size: 11px; }
header { background: var(--header-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; font-weight: 800; padding: 8px 11px; border-radius: 9px; font-size: 17px; letter-spacing: .3px; box-shadow: 0 2px 10px rgba(99, 102, 241, .35); }
h1 { font-size: 17px; letter-spacing: -.01em; }
.tag { color: var(--muted); font-size: 12px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav-dd { position: relative; }
.menu-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.menu-btn:hover, .nav-dd.open .menu-btn { border-color: var(--blue); }
.menu-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: min(620px, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; z-index: 20; display: none; flex-direction: column; gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--menu-shadow); }
.nav-dd.open .menu-dropdown { display: flex; }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; }
.menu-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-dropdown a { display: block; padding: 8px 11px; border-radius: 8px; color: var(--text); font-size: 13px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-dropdown a:hover { background: var(--panel2); }
.menu-dropdown a.active { background: var(--panel2); border: 1px solid var(--line); color: var(--nav-active); font-weight: 600; }
.menu-group { padding: 8px 11px 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; }
.menu-group:hover { color: var(--text); }
.menu-group .chev { font-size: 9px; }
.menu-dropdown a.hidden { display: none; }
nav .theme-btn { margin-left: 10px; border: 1px solid var(--line); border-radius: 20px; padding: 7px 14px; color: var(--text); background: var(--panel2); }
nav .theme-btn:hover { background: var(--panel); color: var(--blue); border-color: var(--blue); }
@media (max-width: 640px) { .menu-grid { grid-template-columns: 1fr; } }
main { max-width: 1180px; margin: 0 auto; padding: 22px; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h3 { font-size: 14px; margin-bottom: 12px; color: var(--blue); text-transform: uppercase; letter-spacing: .5px; }
.card-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.card-toggle .chev { font-size: 11px; color: var(--dim, #888); transition: transform .15s ease; }
.card.collapsed > .card-toggle { margin-bottom: 0; }
.card.collapsed .chev { transform: rotate(-90deg); }
.card.collapsed > :not(.card-toggle) { display: none; }
.hint { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat .sub { font-size: 11.5px; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  main { padding: 12px; }
  header { padding: 10px 14px; }
  nav button { padding: 6px 10px; font-size: 12px; }
}
.card, .stats { min-width: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-row .name { width: 110px; color: var(--muted); font-size: 12.5px; }
.bar-row .bar { flex: 1; height: 14px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 4px; }
.bar-row .val { width: 30px; text-align: right; font-size: 12.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: var(--panel2); }
tr.dim td { opacity: .45; }
table.mini { width: 100%; border-collapse: collapse; white-space: nowrap; }
table.mini th, table.mini td { padding: 4px 10px; font-size: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
input, select, textarea { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
button { background: var(--blue); color: #04121f; border: none; border-radius: 7px; padding: 8px 16px; font-weight: 600; cursor: pointer; font-size: 13px; }
button:hover { filter: brightness(1.12); }
button.ghost { background: transparent; color: var(--blue); border: 1px solid var(--line); font-weight: 400; }
button.ghost:hover { background: var(--panel2); }
.row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.row > input, .row > select, .row > button { min-width: 0; }
.ds-divider { border-top: 1px solid var(--line); padding-top: .55rem; margin-top: .55rem; }
.key-link { font-size: 11px; color: var(--nav-active, #58a6ff); text-decoration: none; padding: 2px 6px; border: 1px solid currentColor; border-radius: 6px; white-space: nowrap; }
.key-link:hover { text-decoration: underline; }
.count { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill.PASS { background: var(--pill-green); color: var(--green); }
.pill.CONDITIONAL { background: var(--pill-amber); color: var(--amber); }
.pill.AVOID, .pill.red { background: var(--pill-red); color: var(--red); }
.pill.neutral { background: var(--panel2); color: var(--muted); }
.result { margin-top: 12px; border-left: 3px solid var(--line); padding: 10px 14px; border-radius: 6px; background: var(--panel2); }
.result.PASS { border-color: var(--green); }
.result.CONDITIONAL { border-color: var(--amber); }
.result.AVOID { border-color: var(--red); }
.result h4 { font-size: 14px; margin-bottom: 6px; }
.result .score-bar { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.result .score-track { flex: 1; height: 10px; background: var(--panel); border-radius: 5px; overflow: hidden; }
.result .score-fill { height: 100%; border-radius: 5px; }
.chip { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 2px; }
.chip-az { font-size: 9px; color: var(--amber); margin-left: 4px; letter-spacing: 0.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--panel); border: none; padding: 3px 12px; font-size: 12px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--blue); color: var(--nav-active); }
.badge { font-size: 11px; color: var(--muted); }
.suggest-box { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.suggest-box .chip { cursor: pointer; }
.suggest-box .chip:hover { border-color: var(--blue); color: var(--blue); }
.keyword-list { margin-top: 8px; }
.memory-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.memory-item:last-child { border-bottom: none; }
.memory-item .t { font-weight: 600; }
.memory-item .m { font-size: 12px; color: var(--muted); }
ul.play { margin: 8px 0 8px 18px; }
ul.play li { margin: 4px 0; }
#app-shell { display: none; }
body.authed #app-shell { display: block; }
body.authed .landing { display: none; }
#app-shell footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 20px; border-top: 1px solid var(--line); }
pre { white-space: pre-wrap; font-family: inherit; color: var(--text); }

/* ---------- auth overlay ---------- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(900px 460px at 50% -120px, rgba(99, 102, 241, .28), transparent 70%), var(--bg);
  display: none; align-items: center; justify-content: center;
}
.auth-card {
  position: relative;
  max-width: 400px; width: 92%; padding: 36px 32px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.auth-close {
  position: absolute; top: 10px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.auth-close:hover { color: var(--text); border-color: var(--brand1); }
.auth-card .auth-brand {
  text-align: center; margin-bottom: 28px;
}
.auth-card .auth-brand .auth-logo {
  display: inline-block; background: linear-gradient(135deg, var(--brand1), var(--brand2));
  color: #fff; font-weight: 800; font-size: 19px; padding: 10px 15px;
  border-radius: 11px; margin-bottom: 12px; letter-spacing: .3px;
  box-shadow: 0 4px 18px rgba(99, 102, 241, .4);
}
.auth-card .auth-brand h2 {
  margin: 0; font-size: 20px; font-weight: 700; color: var(--text);
}
.auth-card .auth-brand p {
  margin: 4px 0 0; font-size: 13px; color: var(--muted);
}
.auth-error {
  display: none; color: var(--red); font-size: 13px; margin-bottom: 14px;
  padding: 10px 12px; border-radius: 8px; background: rgba(248,81,73,.08);
  border: 1px solid rgba(248,81,73,.2);
}
.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.auth-field input {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); font-size: 14px; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input::placeholder { color: var(--muted); opacity: .6; }
.auth-field input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.auth-submit {
  width: 100%; padding: 12px; border: none; border-radius: 8px;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 4px; transition: filter .15s, transform .1s;
  letter-spacing: .3px;
}
.auth-submit:hover { filter: brightness(1.15); }
.auth-submit:active { transform: scale(.98); }
.auth-toggle {
  text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted);
}
.auth-toggle a {
  color: var(--blue); text-decoration: none; font-weight: 600;
}
.auth-toggle a:hover { text-decoration: underline; }

/* ---------- billing / pricing ---------- */
.auth-pricing {
  margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel2);
}
.price-tag { display: flex; align-items: baseline; gap: 4px; margin-bottom: 10px; }
.price-amount { font-size: 30px; font-weight: 700; color: var(--green); }
.price-interval { color: var(--muted); font-size: 13px; }
.price-features { list-style: none; display: grid; gap: 6px; }
.price-features li {
  position: relative; padding-left: 18px; font-size: 13px; color: var(--text);
}
.price-features li::before { content: "\2713"; position: absolute; left: 0; color: var(--green); }
.billing-banner {
  padding: 10px 16px; font-size: 13px; text-align: center;
  border-bottom: 1px solid var(--line);
}
.billing-banner.ok { background: var(--pill-green); color: var(--green); }
.billing-banner.warn { background: var(--pill-amber); color: var(--amber); }
#billing-upgrade { font-size: 12px; padding: 4px 10px; }

/* ---------- testing page ---------- */
.t-track { height: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.t-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--violet)); border-radius: 6px; transition: width .3s ease; }
.t-summary { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 6px; }
.t-summary.ok { border-color: var(--green); background: var(--pill-green); }
.t-summary.bad { border-color: var(--red); background: var(--pill-red); }
.t-summary b { font-size: 14px; }
.t-summary-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.t-stat { font-size: 13px; color: var(--text); }
.t-group { margin: 14px 0 6px; color: var(--blue); font-size: 13px; }
.t-table th, .t-table td { white-space: nowrap; }
.t-row.row-ok { border-left: 3px solid var(--green); }
.t-row.row-bad { border-left: 3px solid var(--red); }
.t-tick { color: var(--green); font-weight: 800; }
.t-cross { color: var(--red); font-weight: 800; }
.t-skip { color: var(--amber); font-weight: 800; }
.t-dot { color: var(--muted); }

/* ---------- author studio ---------- */
.chapter-block { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: var(--panel2); }
.chapter-block.done { border-left-color: var(--green); }
.chapter-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chapter-num { font-weight: 800; color: var(--green); min-width: 18px; }
.book-text { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; line-height: 1.65; margin: 8px 0; white-space: pre-wrap; }

/* ---------- author studio chat ---------- */
.chat-box { height: 320px; max-height: 45vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }
.chat-bubble { max-width: 82%; padding: 8px 12px; border-radius: 12px; line-height: 1.5; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.user .chat-bubble { background: var(--blue); color: #04121f; }
.chat-msg.assistant .chat-bubble { background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.chat-input-row { flex-wrap: nowrap; }
@media (max-width: 520px) { .chat-input-row { flex-wrap: wrap; } .chat-bubble { max-width: 92%; } }

/* ---------- research vault ---------- */
.ghost-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; }
.ghost-chip:hover { color: var(--text); background: var(--panel2); }
.ghost-chip input { accent-color: var(--green); }
button.mini { padding: 3px 10px; font-size: 12px; border-radius: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.mini:hover { border-color: var(--blue); color: var(--blue); }
button.mini.danger:hover { border-color: var(--red); color: var(--red); }
button.mini.on { background: var(--blue); color: #04121f; border-color: var(--blue); }
button.mini.on[data-set="done"] { background: var(--green); color: #04121f; border-color: var(--green); }
.res-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: var(--panel2); }
.res-item .row { margin-bottom: 6px; }
.res-snippet { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 6px; }
.vault-doc { max-height: 55vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; line-height: 1.6; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- about page ---------- */
.about h4 { color: var(--blue); font-size: 14px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .5px; }
.about p { color: var(--text); line-height: 1.55; margin: 6px 0; }
.about code { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 12px; color: var(--blue); }
.about ol, .about ul { margin: 8px 0 8px 20px; }
.about li { margin: 4px 0; line-height: 1.5; }

/* ---------- text fields open to their fullest size ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="email"], input[type="tel"], input:not([type]) {
  min-width: 200px;
  max-width: 100%;
}
textarea {
  min-height: 52px;
  max-height: 55vh;
  resize: vertical;
}
@media (max-width: 520px) {
  input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="email"], input[type="tel"], input:not([type]) {
    min-width: 0;
    width: 100%;
  }
}

/* ---------- saved capture library ---------- */
.muted { opacity: .65; }
tr.row-active { background: var(--panel2); }
#cap-list table, #capv-items table, #capv-deepdata table { width: 100%; }
#cap-list td, #capv-items td, #capv-deepdata td { font-size: 12px; }
#cap-list td:first-child, #capv-items td:first-child, #capv-deepdata td:first-child { max-width: 320px; word-break: break-word; }
#cap-list .mini, #capv-items .mini { padding: 1px 7px; font-size: 11px; }
#capv-items table, #capv-deepdata table { table-layout: auto; }
#capv-items th.num, #capv-items td.num,
#capv-deepdata th.num, #capv-deepdata td.num { text-align: right; font-variant-numeric: tabular-nums; }
#capv-items td.title, #capv-deepdata td.title { max-width: 380px; min-width: 220px; white-space: normal; word-break: break-word; }
#capv-brief { font-size: 13px; line-height: 1.55; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }

/* ---------- niche library redesign ---------- */
.nl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.nl-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .1s; border-left: 3px solid var(--line); }
.nl-stat:hover { border-color: var(--blue); transform: translateY(-1px); }
.nl-stat.active { border-color: var(--blue); background: var(--panel2); }
.nl-stat .num { font-size: 26px; font-weight: 800; line-height: 1; }
.nl-stat .lbl { color: var(--muted); font-size: 11.5px; margin-top: 3px; text-transform: uppercase; letter-spacing: .3px; }
.nl-stat.s-total { border-left-color: var(--blue); }
.nl-stat.s-pass { border-left-color: var(--green); }
.nl-stat.s-cond { border-left-color: var(--amber); }
.nl-stat.s-avoid { border-left-color: var(--red); }
.nl-stat.s-total .num { color: var(--blue); }
.nl-stat.s-pass .num { color: var(--green); }
.nl-stat.s-cond .num { color: var(--amber); }
.nl-stat.s-avoid .num { color: var(--red); }
@media (max-width: 700px) { .nl-stats { grid-template-columns: repeat(2, 1fr); } }

.nl-toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.nl-search { display: flex; gap: 6px; flex: 1; align-items: center; flex-wrap: wrap; min-width: 0; }
.nl-search input { flex: 1.5; min-width: 140px; }
.nl-search select { min-width: 0; }
.nl-actions { display: flex; gap: 6px; }
.nl-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.nl-table-card { padding: 0; overflow: hidden; }
.nl-table-card .table-wrap { max-height: 60vh; overflow-y: auto; }
.nl-table-card table { margin: 0; }
.nl-table-card th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.nl-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.nl-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.modal-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal-overlay[hidden] { display: none; }

/* niche table row enhancements */
.nl-niche-name { font-weight: 600; }
.nl-niche-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.nl-score-bar { display: flex; align-items: center; gap: 6px; }
.nl-score-track { width: 50px; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.nl-score-fill { height: 100%; border-radius: 3px; transition: width .2s; }
.nl-score-val { font-weight: 700; font-size: 13px; min-width: 20px; }
.nl-live-chip { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; white-space: nowrap; }
.nl-live-chip.live-pass { background: var(--pill-green); color: var(--green); }
.nl-live-chip.live-avoid { background: var(--pill-red); color: var(--red); }
.nl-live-chip.live-cond { background: var(--pill-amber); color: var(--amber); }
.nl-kw-chips { display: flex; gap: 3px; flex-wrap: wrap; max-width: 200px; }
.nl-kw-chips .chip { font-size: 10.5px; padding: 1px 5px; }
.nl-action-cell { white-space: nowrap; }

.nl-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }

/* collapsible tool panels */
.nl-collapsible { margin-bottom: 10px; }
.nl-collapsible .card-toggle { cursor: pointer; user-select: none; }
.nl-collapsible .card-toggle .chev { transition: transform .15s; }
.nl-collapsible.collapsed .card-toggle .chev { transform: rotate(-90deg); }
.nl-collapsible.collapsed > :not(.card-toggle) { display: none; }
.about details { margin-bottom: 2px; }
.about details > summary { cursor: pointer; user-select: none; list-style: none; padding: 6px 0; border-bottom: 1px solid var(--line); }
.about details > summary::-webkit-details-marker { display: none; }
.about details > summary::before { content: "▸ "; color: var(--dim, #888); font-size: 12px; }
.about details[open] > summary::before { content: "▾ "; }
.about details > summary h4 { display: inline; margin: 0; font-size: 14px; }
.about details > *:not(summary) { padding-left: 14px; }

/* ---------- accessibility / pill / table helpers ---------- */
.pill-ai { background: var(--pill-green, #0d5); color: var(--green, #033); }
.table-wrap { position: relative; }
.table-wrap.overflowing::after {
  content: "\2192";
  position: sticky;
  right: 0;
  top: 0;
  background: linear-gradient(to right, transparent, var(--panel) 40%);
  padding: 8px 6px;
  pointer-events: none;
  font-size: 14px;
  color: var(--muted);
}
button:focus-visible, button.ghost:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- admin / user management ---------- */
.adm-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.adm-header h2 { margin: 0; }
.adm-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.adm-stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; text-align: center; border-left: 3px solid var(--blue);
  box-shadow: var(--shadow); transition: transform .1s, border-color .15s;
}
.adm-stat-card:hover { transform: translateY(-1px); }
.adm-stat-num { font-size: 26px; font-weight: 800; color: var(--blue); line-height: 1; }
.adm-stat-lbl { color: var(--muted); font-size: 11.5px; margin-top: 4px; text-transform: uppercase; letter-spacing: .3px; }
.adm-stat-active { border-left-color: var(--green); }
.adm-stat-active .adm-stat-num { color: var(--green); }
.adm-stat-admin { border-left-color: var(--violet); }
.adm-stat-admin .adm-stat-num { color: var(--violet); }
.adm-stat-inactive { border-left-color: var(--red); }
.adm-stat-inactive .adm-stat-num { color: var(--red); }
@media (max-width: 700px) { .adm-stats { grid-template-columns: repeat(2, 1fr); } }

.adm-form-card { margin-bottom: 16px; }
.adm-form-header h3 { margin-bottom: 0; }
.adm-form-grid { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; }
.adm-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1; }
.adm-field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.adm-field input, .adm-field select { width: 100%; }
.adm-field-btn { flex: 0 0 auto; }
.adm-add-btn { padding: 9px 20px; font-size: 13px; font-weight: 600; }
@media (max-width: 600px) { .adm-form-grid { flex-direction: column; } .adm-field { min-width: 0; } }

.adm-table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0; }
.adm-table-header h3 { margin-bottom: 0; }

#adm-users-list { max-height: 55vh; overflow-y: auto; }
#adm-users-list table { width: 100%; border-collapse: collapse; white-space: nowrap; }
#adm-users-list th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
#adm-users-list td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
#adm-users-list th { padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); }
#adm-users-list tbody tr:hover { background: var(--panel2); }

.adm-td-email { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.adm-td-date { color: var(--muted); font-size: 12.5px; }
.adm-actions { white-space: nowrap; display: flex; gap: 4px; }

.admin-pill { background: rgba(188,140,255,.15); color: var(--violet); }
.adm-self-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px; background: var(--blue); color: #fff; font-weight: 600; }


/* ================= public landing (signed out) ================= */
.landing {
  min-height: 100vh; display: block;
  overflow-x: clip; /* belt: never allow sideways scroll; clip keeps sticky working */
  background: radial-gradient(760px 430px at 50% 150px, rgba(99, 102, 241, .2), transparent 72%) no-repeat;
}

.lp-mast {
  position: sticky; top: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 13px 26px;
  background: var(--header-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.lp-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.lp-logo {
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  color: #fff; font-weight: 800; font-size: 15px; padding: 7px 10px;
  border-radius: 9px; letter-spacing: .3px;
  box-shadow: 0 2px 12px rgba(99, 102, 241, .4);
}
.lp-word { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; }
.lp-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lp-nav a { color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; padding: 7px 11px; border-radius: 8px; }
.lp-nav a:hover { color: var(--text); background: var(--panel2); }
.lp-nav .ghost { border-radius: 999px; padding: 9px 17px; font-weight: 600; font-size: 13.5px; }
.lp-nav .lp-btn { padding: 9px 18px; }

.lp-btn {
  display: inline-block; border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); border-radius: 999px; padding: 10px 22px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.lp-btn:hover { transform: translateY(-1px); border-color: var(--blue); color: var(--text); filter: none; }
.lp-btn.primary {
  background: linear-gradient(135deg, var(--brand1), var(--brand2));
  border: none; color: #fff;
  box-shadow: 0 6px 22px rgba(99, 102, 241, .35);
}
.lp-btn.primary:hover { color: #fff; box-shadow: 0 10px 28px rgba(99, 102, 241, .45); }
.lp-btn.big { padding: 13px 30px; font-size: 15px; }

.lp-hero {
  position: relative; text-align: center;
  max-width: 900px; margin: 0 auto; padding: 74px 22px 46px;
}
.lp-eyebrow {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--violet);
  background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 22px;
}
.lp-hero h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.025em;
  font-weight: 800; color: var(--text); max-width: 780px; margin: 0 auto 18px;
}
.lp-sub { font-size: clamp(15px, 2vw, 17.5px); color: var(--muted); max-width: 720px; margin: 0 auto 28px; line-height: 1.65; }
.lp-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.lp-micro { font-size: 12.5px; color: var(--muted); margin: 6px 0; }

.lp-subscribe {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  max-width: 470px; margin: 20px auto 4px; position: relative;
}
.lp-subscribe input[type="email"] {
  flex: 1; min-width: 210px; padding: 12px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px;
}
.lp-subscribe input[type="email"]:focus { outline: none; border-color: var(--brand1); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.lp-subscribe button {
  padding: 12px 22px; border-radius: 999px; border: none; font-size: 14px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; cursor: pointer;
}
.lp-subscribe button:hover { filter: brightness(1.1); }
.lp-subscribe button:disabled { opacity: .6; cursor: default; }
.lp-sub-msg { flex-basis: 100%; text-align: center; font-size: 12.5px; min-height: 16px; color: var(--muted); }
.lp-sub-msg.ok { color: var(--green); }
.lp-sub-msg.err { color: var(--red); }
.lp-hp { position: absolute !important; left: -9999px !important; top: 0; width: 1px; height: 1px; opacity: 0; }

.lp-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 860px; margin: 44px auto 0; padding-top: 26px;
  border-top: 1px solid var(--line);
}
.lp-stats div { text-align: center; padding: 4px 6px; }
.lp-stats b { display: block; font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.lp-stats span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.lp-section { max-width: 1080px; margin: 0 auto; padding: 54px 22px; }
.lp-section h2, .lp-final h2 {
  text-align: center; font-size: clamp(24px, 3.4vw, 32px); font-weight: 800;
  letter-spacing: -.02em; margin-bottom: 10px;
}
.lp-lead { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 34px; font-size: 15.5px; line-height: 1.6; }

.lp-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lp-step {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 18px; position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.lp-step:hover { transform: translateY(-3px); border-color: var(--brand1); }
.lp-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff; margin-bottom: 14px;
}
.lp-step h3 { font-size: 15.5px; margin-bottom: 7px; color: var(--text); letter-spacing: -.01em; }
.lp-step p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

.lp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 20px; transition: transform .15s ease, border-color .15s ease;
}
.lp-card:hover { transform: translateY(-3px); border-color: var(--blue); }
.lp-card h3 { font-size: 15px; color: var(--text); margin-bottom: 8px; letter-spacing: -.01em; text-transform: none; }
.lp-card p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

.lp-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 360px)); gap: 20px; justify-content: center; }
.lp-price {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 26px; display: flex; flex-direction: column;
}
.lp-price h3 { font-size: 17px; color: var(--text); text-transform: none; letter-spacing: -.01em; margin-bottom: 6px; }
.lp-price.featured {
  border-color: var(--brand1);
  box-shadow: 0 18px 50px rgba(99, 102, 241, .22);
}
.lp-flag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--brand1), var(--brand2)); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  padding: 5px 14px; border-radius: 999px; white-space: nowrap;
}
.lp-price-tag { display: flex; align-items: baseline; gap: 5px; margin: 8px 0 16px; }
.lp-price-tag b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.lp-price-tag span { color: var(--muted); font-size: 14px; }
.lp-price ul { list-style: none; display: grid; gap: 9px; margin-bottom: 22px; flex: 1; }
.lp-price ul li { position: relative; padding-left: 24px; font-size: 14px; color: var(--text); line-height: 1.45; }
.lp-price ul li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--green); font-weight: 800; }
.lp-price .lp-btn { text-align: center; }

#faq details {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 20px; margin-bottom: 10px;
}
#faq details[open] { border-color: var(--brand1); }
#faq summary {
  cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600; font-size: 15px;
  color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
#faq summary::-webkit-details-marker { display: none; }
#faq summary::after { content: "+"; color: var(--violet); font-size: 20px; font-weight: 400; line-height: 1; }
#faq details[open] summary::after { content: "\2212"; }
#faq details p { padding: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0; }
#faq details p a { color: var(--blue); }

.lp-final {
  max-width: 860px; margin: 30px auto 60px; padding: 46px 26px;
  text-align: center; border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(500px 220px at 50% 0%, rgba(139, 92, 246, .16), transparent 70%),
    var(--panel);
}
.lp-final .lp-lead { margin-bottom: 20px; }

.lp-footer { border-top: 1px solid var(--line); background: var(--panel); margin-top: 20px; }
.lp-foot-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.3fr; gap: 26px;
  max-width: 1080px; margin: 0 auto; padding: 42px 22px 26px;
}
.lp-foot-grid h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 12px;
}
.lp-foot-grid a { display: block; color: var(--muted); text-decoration: none; font-size: 13.5px; padding: 4px 0; }
.lp-foot-grid a:hover { color: var(--text); }
.lp-foot-grid p { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 10px; }
.lp-foot-grid .lp-brand { margin-bottom: 4px; }
.lp-foot-grid .lp-micro { font-size: 12px; margin-top: 6px; }
.lp-copy {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 14px 20px 26px; border-top: 1px solid var(--line); margin: 0;
}

@media (max-width: 900px) {
  .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .lp-mast { padding: 11px 16px; }
  .lp-nav a { display: none; }
  .lp-stats { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
}
@media (max-width: 560px) {
  .lp-steps, .lp-grid, .lp-prices { grid-template-columns: 1fr; }
  .lp-foot-grid { grid-template-columns: 1fr; gap: 20px; padding-top: 32px; }
  .lp-hero { padding-top: 52px; padding-left: 16px; padding-right: 16px; }
  .lp-cta { flex-direction: column; align-items: center; }
  .lp-btn.big { width: 100%; max-width: 340px; }
  .lp-subscribe { flex-direction: column; align-items: stretch; }
  .lp-subscribe input[type="email"] { min-width: 0; width: 100%; }
  .lp-subscribe button { width: 100%; }
  .lp-final { margin: 16px 12px 44px; padding: 36px 18px; }
  .lp-mast { padding: 10px 14px; }
}

/* app shell on small screens: keep the sticky header to two compact rows */
@media (max-width: 560px) {
  header { padding: 10px 12px; }
  header .tag { display: none; }
  header h1 { font-size: 14.5px; }
  .brand { gap: 9px; }
  .menu-btn, nav .theme-btn { padding: 9px 13px; }
  main { padding: 10px; }
}
