/* InstantBlock console, auth and error surfaces — InstantNode "lunaris" house style.
   Loaded LAST (via partials/lunaris-styles.ejs) on top of the existing console stack
   (lunaris-vendor → base → app-shell → surface css → lunaris-tokens → lunaris-console).
   Matches the marketing site: Satoshi 500 with tight tracking, cream/ghost pills,
   hairline rgba(255,255,255,.08) borders, 16px radii, faint dot-grid ambience, ink links,
   blue used sparingly. Status colour only where the UI means a decision.
   CSS-only: no selector here is a JS hook, and every CSS var the JS reads stays defined. */

@font-face { font-family: 'Satoshi'; src: url(/Satoshi.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }

/* ---------- tokens ---------- */
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) {
  color-scheme: dark;
  --void: #060606; --panel: #0b0b0c; --panel-2: #0e0e10; --panel-3: #121214;
  --ink: #f2f1ee; --ink-2: #cfcec9; --mute: #9a9994; --dim: #6b6a65;
  --line: rgba(255, 255, 255, .08); --line-soft: rgba(255, 255, 255, .05); --line-2: rgba(255, 255, 255, .14);
  --ember: #3b82f6; --focus: rgba(96, 165, 250, .75);
  --allow: #3ecf8e; --warn: #e8b45f; --warning: #e8b45f; --rose: #ff5a7e; --danger: #ff5a7e; --block: #ff5a7e; --review: #e8b45f;
  --warning-soft: rgba(232, 180, 95, .08); --danger-soft: rgba(255, 90, 126, .08); --block-dim: rgba(255, 90, 126, .08);
  /* chart.js reads these live: --accent = Allowed series */
  --accent: var(--allow); --accent-soft: rgba(62, 207, 142, .07);
  --surface: var(--panel); --surface-soft: var(--panel-2); --surface-strong: var(--panel-3);
  --subtle: var(--dim); --muted: var(--mute);
  /* links + "violet" accents → ink, like the marketing site */
  --cobalt: var(--ink); --cobalt-soft: rgba(255, 255, 255, .05); --accent-strong: var(--ink);
  --admin-violet: var(--ink); --db-violet: var(--ink); --ops-violet: var(--ink);
  --db-violet-soft: rgba(255, 255, 255, .05); --db-violet-line: var(--line-2);
  --acc: var(--ember); --acc-dim: rgba(255, 255, 255, .05); --acc-line: var(--line-2);
  --bg: var(--void); --bg-1: var(--panel); --bg-2: var(--panel-2);
  --tx: var(--ink); --tx-2: var(--ink-2); --tx-3: var(--mute);
  --db-bg: var(--void); --db-ink: var(--ink); --db-copy: var(--ink-2); --db-subtle: var(--mute);
  --db-line: var(--line); --db-line-strong: var(--line-2); --db-panel: var(--panel); --db-panel-soft: var(--panel-2); --db-hover: rgba(255, 255, 255, .025);
  --db-allow: var(--allow); --db-challenge: var(--warn); --db-block: var(--block);
  --db-allow-soft: rgba(62, 207, 142, .08); --db-challenge-soft: rgba(232, 180, 95, .08); --db-block-soft: rgba(255, 90, 126, .08);
  --ops-ink: var(--ink); --ops-muted: var(--mute); --ops-line: var(--line); --ops-soft: var(--panel-2);
  --font: 'Satoshi', system-ui, -apple-system, BlinkMacSystemFont, sans-serif; --sans: var(--font); --disp: var(--font);
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius-sm: 10px; --radius: 16px; --radius-lg: 20px; --shadow: none;

  background-color: var(--void);
  background-image:
    radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    radial-gradient(55% 38% at 50% 0%, rgba(59, 130, 246, .06), transparent 70%);
  background-size: 26px 26px, 100% 100%;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) ::selection { background: rgba(59, 130, 246, .35); color: var(--ink); }
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- type: weight 500, tight tracking (no heavy display weights) ---------- */
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) :is(h1, h2, h3, h4) { font-weight: 500; color: var(--ink); }
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) h1 { letter-spacing: -.028em; }
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) :is(h2, h3) { letter-spacing: -.015em; }
html[data-theme] body.app-surface:not(#_) :is(.main-head h1, .ops-header h1, .mail-page-head h1, .admin-page-head h1) {
  font-weight: 500; letter-spacing: -.028em; font-size: clamp(30px, 2.6vw, 38px); line-height: 1.12;
}
html[data-theme] body.app-surface:not(#_) :is(.main-head p, .ops-header p) { color: var(--mute); }
/* every big number: medium weight, tabular */
html[data-theme] body.app-surface:not(#_) :is(.stat-value, .stat-card strong, .admin-overview-metric strong, .admin-overview-site-volume strong,
  [class*="metric"] strong, [class*="-total"] strong, [class*="hero-number"], [class*="big-number"], .ops-total strong, .ops-hero strong) {
  font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
html[data-theme] body.app-surface :is(b, strong) { font-weight: 600; }
html[data-theme] body.app-surface :is(.mono, code, kbd, samp) { font-family: var(--mono); }

/* ---------- sidebar ---------- */
html[data-theme] body.app-surface:not(#_) .console-nav {
  background: rgba(8, 8, 9, .82); border-right: 1px solid var(--line); box-shadow: none;
  backdrop-filter: saturate(1.1) blur(10px); -webkit-backdrop-filter: saturate(1.1) blur(10px);
}
html[data-theme] body.app-surface:not(#_) .console-brand { color: var(--ink); font-weight: 600; letter-spacing: -.01em; border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .console-brand .brand-sub { color: var(--ember); }
html[data-theme] body.app-surface:not(#_) .console-nav-link {
  color: var(--mute); font-weight: 500; border-radius: 10px; background: transparent; transition: color .15s, background .15s;
}
html[data-theme] body.app-surface:not(#_) .console-nav-link :is(svg, i) { color: var(--dim); transition: color .15s; }
html[data-theme] body.app-surface:not(#_) .console-nav-link:is(:hover, :focus-visible) { color: var(--ink); background: rgba(255, 255, 255, .03); }
html[data-theme] body.app-surface:not(#_) .console-nav-link:is(:hover, :focus-visible) :is(svg, i) { color: var(--mute); }
html[data-theme] body.app-surface:not(#_) .console-nav-link[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, .055); box-shadow: inset 0 0 0 1px var(--line-soft); }
html[data-theme] body.app-surface:not(#_) .console-nav-link[aria-current="page"] :is(svg, i) { color: var(--ink); }
html[data-theme] body.app-surface:not(#_) .console-nav-link[aria-current="page"]::before { display: none; }
html[data-theme] body.app-surface:not(#_) :is(.console-nav-divider, .console-account) { border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .console-account-email { color: var(--mute); font-family: var(--mono); font-size: 11.5px; }
html[data-theme] body.app-surface:not(#_) .console-credit { color: var(--dim); }
html[data-theme] body.app-surface:not(#_) .console-credit a { color: var(--mute); }

/* ---------- links: ink, quiet ---------- */
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) main a:not(.btn):not(.console-nav-link) { transition: color .15s, opacity .15s; }
html[data-theme] body.app-surface:not(#_) :is(.back-link, .viewer-back) { color: var(--mute); font-weight: 500; }
html[data-theme] body.app-surface:not(#_) :is(.back-link, .viewer-back):hover { color: var(--ink); }
html[data-theme] body.app-surface:not(#_) :is(.section-heading a, .surface-head a, .ops-section-head a, .admin-overview-section-head a,
  .admin-signals-heading a, .admin-search-toolbar a:not(.btn), .admin-clear-link, .ops-site-more, .admin-site-card-foot a) {
  color: var(--mute); font-weight: 500;
}
html[data-theme] body.app-surface:not(#_) :is(.section-heading a, .surface-head a, .ops-section-head a, .admin-overview-section-head a,
  .admin-signals-heading a, .admin-search-toolbar a:not(.btn), .admin-clear-link, .ops-site-more, .admin-site-card-foot a):hover { color: var(--ink); }
html[data-theme] body.app-surface:not(#_) :is(.data-table a, .admin-row-link, .admin-overview-event-site a, .admin-overview-site-name a,
  .viewer-device-link a, .admin-verification-card-row a) { color: var(--ink); font-weight: 500; text-decoration: none; }
html[data-theme] body.app-surface:not(#_) :is(.data-table a, .admin-row-link, .admin-overview-event-site a, .viewer-device-link a):hover {
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
}
html[data-theme] body.app-surface:not(#_) :is(.admin-overview-event-action a, .admin-overview-site-arrow, .ops-site-arrow) { color: var(--mute); }
html[data-theme] body.app-surface:not(#_) :is(.admin-overview-event-action a, .admin-overview-site-arrow, .ops-site-arrow):hover { color: var(--ink); }
html[data-theme] body.app-surface:not(#_) .admin-signal-rank { color: var(--dim); }

/* ---------- surfaces / cards ---------- */
html[data-theme] body.app-surface:not(#_) :is(.surface, .stat-card, .viewer-summary, .blog-editor-panel, .blog-visual-frame, .card, .callout,
  .dashboard-create-panel, .dashboard-list-panel, .site-task-panel, .site-traffic-panel, .site-signals-panel, .admin-overview-metrics,
  .admin-settings-section, .mail-workspace, .dashboard-form-section) {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: none;
}
html[data-theme] body.app-surface:not(#_) :is(.surface-head, .form-section, .credential-row, .admin-overview-metrics-head, .ops-header, .admin-page-head, .main-head) {
  border-color: var(--line);
}
html[data-theme] body.app-surface:not(#_) :is(.surface-head h2, .surface-head h3, .section-heading h2, .ops-section-head h2, .admin-overview-section-head h2) {
  font-weight: 500; font-size: 17px; letter-spacing: -.012em;
}
html[data-theme] body.app-surface:not(#_) :is(.stat-label, .admin-overview-cell-label, .ops-label) { color: var(--mute); font-weight: 500; }
html[data-theme] body.app-surface:not(#_) :is(hr, .console-nav-divider) { border-color: var(--line); background: var(--line); }
html[data-theme] body.app-surface:not(#_) .empty-state { border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .empty-state .empty-icon { background: rgba(255, 255, 255, .04); color: var(--mute); border: 1px solid var(--line); }

/* ---------- buttons: cream / ghost pills (same as marketing .btn-light / .btn-ghost) ---------- */
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn {
  border-radius: 999px; font-weight: 500; letter-spacing: 0; box-shadow: none; transform: none;
  transition: background .15s, border-color .15s, box-shadow .2s, color .15s;
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn:active { transform: translateY(1px); }
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn:is(.btn-acc, .btn-primary),
html[data-theme] body.auth-surface:not(#_) .auth-form .btn.btn-acc {
  background: #f5f4f1; color: #0a0a0a; border: 1px solid transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 10px 40px -8px rgba(59, 130, 246, .5);
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn:is(.btn-acc, .btn-primary):hover,
html[data-theme] body.auth-surface:not(#_) .auth-form .btn.btn-acc:hover {
  background: #fff; color: #0a0a0a; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2), 0 14px 52px -6px rgba(96, 165, 250, .7);
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn:is(.btn-acc, .btn-primary):disabled {
  opacity: .55; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1);
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn.btn-line {
  background: rgba(255, 255, 255, .02); color: var(--ink); border: 1px solid var(--line);
}
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface):not(#_) .btn.btn-line:hover { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .22); }
html[data-theme] body.app-surface:not(#_) .btn.btn-danger { background: transparent; color: var(--block); border: 1px solid rgba(255, 90, 126, .32); }
html[data-theme] body.app-surface:not(#_) .btn.btn-danger:hover { background: rgba(255, 90, 126, .07); border-color: rgba(255, 90, 126, .5); }
/* segmented range picker (site.js .rng[data-range]) */
html[data-theme] body.app-surface:not(#_) :is(.rng, .range-picker, .seg) { border-color: var(--line); background: rgba(255, 255, 255, .02); border-radius: 999px; }
html[data-theme] body.app-surface:not(#_) :is(.rng button, .rng a, [data-range])[aria-pressed="true"],
html[data-theme] body.app-surface:not(#_) :is(.rng button, .rng a, [data-range]).on,
html[data-theme] body.app-surface:not(#_) :is(.rng button, .rng a, [data-range]).active,
html[data-theme] body.app-surface:not(#_) :is(.rng button, .rng a, [data-range])[aria-current] { background: rgba(255, 255, 255, .08); color: var(--ink); box-shadow: none; }

/* ---------- forms ---------- */
html[data-theme] body:is(.app-surface, .auth-surface):not(#_) .field label,
html[data-theme] body:is(.app-surface, .auth-surface):not(#_) label.field-label { color: var(--ink-2); font-weight: 500; }
html[data-theme] body:is(.app-surface, .auth-surface):not(#_) :is(.field, .filter-bar, .viewer-filter, .admin-search-toolbar, .auth-form, .dashboard-form-section, .admin-settings-section)
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; outline: none;
}
html[data-theme] body:is(.app-surface, .auth-surface):not(#_) :is(.field, .filter-bar, .viewer-filter, .admin-search-toolbar, .auth-form, .dashboard-form-section, .admin-settings-section)
  :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  border-color: rgba(96, 165, 250, .55); box-shadow: 0 0 0 3px rgba(59, 130, 246, .14); outline: none;
}
html[data-theme] body:is(.app-surface, .auth-surface):not(#_) :is(input, textarea)::placeholder { color: var(--dim); opacity: 1; }
html[data-theme] body.app-surface:not(#_) :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--ink); }
html[data-theme] body.app-surface:not(#_) :is(.field-hint, .muted, small) { color: var(--mute); }

/* ---------- tables ---------- */
html[data-theme] body.app-surface:not(#_) .data-table { border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .data-table th {
  background: transparent; color: var(--dim); font-weight: 500; font-size: 12px; letter-spacing: 0; text-transform: none; border-color: var(--line);
}
html[data-theme] body.app-surface:not(#_) .data-table td { border-color: var(--line-soft); color: var(--mute); }
html[data-theme] body.app-surface:not(#_) .data-table td:first-child { color: var(--ink); }
html[data-theme] body.app-surface:not(#_) .data-table tbody tr:is(:hover, :focus-within) { background: rgba(255, 255, 255, .02); }
html[data-theme] body.app-surface:not(#_) :is(.admin-overview-event, .admin-overview-site, .ops-site, .admin-overview-signal-list > *, .ops-feed li) { border-color: var(--line-soft); }

/* ---------- decisions: quiet dot + coloured text, never a glossy pill ---------- */
html[data-theme] body.app-surface:not(#_) :is(.decision, .dec-accept, .dec-challenge, .dec-reject, .vbadge) {
  background: transparent; border: 0; padding: 0; border-radius: 0; box-shadow: none; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
html[data-theme] body.app-surface:not(#_) :is(.decision, .dec-accept, .dec-challenge, .dec-reject, .vbadge)::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}
html[data-theme] body.app-surface:not(#_) :is(.decision, .dec-accept, .dec-challenge, .dec-reject, .vbadge) > :is(i, .dot):first-child { display: none; }
html[data-theme] body.app-surface:not(#_) :is(.decision.allow, .dec-accept, .vbadge.ok) { color: var(--allow); }
html[data-theme] body.app-surface:not(#_) :is(.decision.review, .decision.challenge, .dec-challenge) { color: var(--warn); }
html[data-theme] body.app-surface:not(#_) :is(.decision.block, .decision.reject, .dec-reject, .vbadge.no) { color: var(--block); }

/* generic tags/badges inside the console: hairline, no uppercase eyebrow look */
html[data-theme] body.app-surface:not(#_) :is(.badge, .viewer-flag, .tag, .chip) {
  background: rgba(255, 255, 255, .03); color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px;
  text-transform: none; letter-spacing: 0; font-weight: 500; box-shadow: none;
}
html[data-theme] body.app-surface:not(#_) .credential-row .badge.secret { color: var(--warn); border-color: rgba(232, 180, 95, .3); background: transparent; }

/* status line + engine dot */
html[data-theme] body.app-surface:not(#_) .side-status { color: var(--mute); }
html[data-theme] body.app-surface:not(#_) .callout { color: var(--ink-2); }
html[data-theme] body.app-surface:not(#_) .callout.info { border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .callout.danger { border-color: rgba(255, 90, 126, .3); background: rgba(255, 90, 126, .04); }

/* tabs */
html[data-theme] body.app-surface:not(#_) .viewer-tabs { border-color: var(--line); }
html[data-theme] body.app-surface:not(#_) .viewer-tabs a { color: var(--mute); font-weight: 500; }
html[data-theme] body.app-surface:not(#_) .viewer-tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

/* mail */
html[data-theme] body.mail-surface:not(#_) .mail-folder[aria-current="page"] { background: rgba(255, 255, 255, .055); color: var(--ink); }
html[data-theme] body.mail-surface:not(#_) .mail-folder[aria-current="page"] .mail-folder-count { color: var(--ink); }
html[data-theme] body.mail-surface:not(#_) .mail-search:focus-within { border-color: rgba(96, 165, 250, .55); outline: 0; box-shadow: 0 0 0 3px rgba(59, 130, 246, .14); }

/* blog editor */
html[data-theme] body.blog-admin:not(#_) :is(.blog-editor-toolbar button, .blog-image-position button)[aria-pressed="true"] {
  background: rgba(255, 255, 255, .08); border-color: var(--line-2); color: var(--ink);
}

/* ---------- auth ---------- */
html[data-theme] body.auth-surface:not(#_) :is(.auth-topline, .auth-footer) { border-color: var(--line); }
html[data-theme] body.auth-surface:not(#_) .auth-logo { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
html[data-theme] body.auth-surface:not(#_) .auth-top-link { color: var(--mute); font-weight: 500; }
html[data-theme] body.auth-surface:not(#_) .auth-top-link:hover { color: var(--ink); }
html[data-theme] body.auth-surface:not(#_) .auth-top-link span { color: inherit; }
html[data-theme] body.auth-surface:not(#_) .auth-card h1 { font-weight: 500; letter-spacing: -.03em; font-size: clamp(40px, 4.4vw, 56px); line-height: 1.04; }
html[data-theme] body.auth-surface:not(#_) .auth-card .lead { color: var(--mute); }
html[data-theme] body.auth-surface:not(#_) :is(.auth-switch, .auth-gate) { color: var(--mute); }
html[data-theme] body.auth-surface:not(#_) :is(.auth-switch a, .auth-gate a) { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
html[data-theme] body.auth-surface:not(#_) .auth-aside {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: none;
}
html[data-theme] body.auth-surface:not(#_) .auth-aside-art { filter: saturate(.55); opacity: .9; }
html[data-theme] body.auth-surface:not(#_) .auth-aside-copy strong { font-weight: 500; letter-spacing: -.025em; }
html[data-theme] body.auth-surface:not(#_) .auth-aside-copy p { color: var(--mute); }
html[data-theme] body.auth-surface:not(#_) .auth-art-mark::before { font-weight: 500; letter-spacing: -.04em; opacity: .9; }
html[data-theme] body.auth-surface:not(#_) .auth-error { background: rgba(255, 90, 126, .05); border: 1px solid rgba(255, 90, 126, .3); color: var(--ink); border-radius: 12px; }
html[data-theme] body.auth-surface:not(#_) .auth-footer a { color: var(--mute); }

/* ---------- error ---------- */
html[data-theme] body.error-surface:not(#_) .error-code { color: var(--dim); font-family: var(--mono); font-weight: 500; letter-spacing: .04em; }
html[data-theme] body.error-surface:not(#_) .error-content h1 { font-weight: 500; letter-spacing: -.03em; }
html[data-theme] body.error-surface:not(#_) .error-content p { color: var(--mute); }
html[data-theme] body.error-surface:not(#_) .error-credit, html[data-theme] body.error-surface:not(#_) .error-credit a { color: var(--dim); }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  html[data-theme] body.app-surface:not(#_) .console-nav { background: rgba(6, 6, 6, .92); border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 600px) {
  html[data-theme] body.app-surface:not(#_) .main { padding-left: 16px; padding-right: 16px; }
  html[data-theme] body.auth-surface:not(#_) .auth-card h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) :is(.btn, .console-nav-link, a) { transition: none; }
}

/* dashboard verdict strip (stat columns, not badges): medium weight numbers */
html[data-theme] body.operations-overview:not(#_) .ops-verdict strong { font-weight: 500; letter-spacing: -.02em; }
html[data-theme] body.operations-overview:not(#_) .ops-verdicts,
html[data-theme] body.operations-overview:not(#_) .ops-verdict + .ops-verdict { border-color: var(--line); }
html[data-theme] body:is(.app-surface, .auth-surface, .error-surface) .theme-toggle { display: none !important; }
