/* Ask Rahul — dark chat-native theme (continuation of rban.dev's brand).
   Tokens below; chat components; lead capture; /admin dashboard. */

:root {
  --bg: #0A0A0B;
  --surface: #131316;
  --surface-2: #1A1A1E;
  --border: #1F1F23;
  --border-strong: #2C2C31;
  --ink: #E8E8EA;
  --ink-2: #A3A3A8;
  --ink-3: #71717A;
  --ink-4: #4B4B52;
  --accent: #34D399;
  --accent-strong: #10B981;
  --accent-bright: #6EE7B7;
  --accent-contrast: #06251B;
  --accent-soft: rgba(52, 211, 153, 0.10);
  --accent-line: rgba(52, 211, 153, 0.35);
  --user-text: #ECFDF5;
  --danger: #F87171;
  --danger-fill: rgba(248, 113, 113, 0.08);
  --danger-line: rgba(248, 113, 113, 0.25);
  --warn: #FBBF24;
  --warn-fill: rgba(251, 191, 36, 0.08);
  --warn-line: rgba(251, 191, 36, 0.30);
  --accent-focus: rgba(52, 211, 153, 0.15);
  --r-bubble: 14px;
  --r-card: 10px;
  --r-control: 8px;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
  --ui-zoom: 1; /* mobile default; the 961px+ zoom block below overrides to 1.5 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-color: var(--border-strong) transparent; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  height: calc(100dvh / var(--ui-zoom, 1)); /* dvh resolves unzoomed; see the zoom block */
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-strong); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--ink); padding: 8px 12px; border-radius: var(--r-control);
  font-family: var(--font-mono); font-size: 11px; text-decoration: none;
  transition: top 150ms ease-out;
}
.skip-link:focus { top: 8px; }
.hidden { display: none !important; }
/* Keep the hidden attribute authoritative even where display is set
   (.lead-success/.lead-error use display:flex, which otherwise overrides
   the UA [hidden] rule and shows both blocks inside the open gate). */
[hidden] { display: none !important; }

/* Icon size utilities — mirror the width/height attributes icons.js writes,
   so runtime icon() output sizes from the class (w-3.5 → 14, w-4 → 16, w-5 → 20). */
.w-3\.5 { width: 14px; } .h-3\.5 { height: 14px; }
.w-4 { width: 16px; } .h-4 { height: 16px; }
.w-5 { width: 20px; } .h-5 { height: 20px; }

/* ---------- Header ---------- */
.site-header {
  flex: none; height: 56px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 48rem; margin: 0 auto; height: 100%;
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  text-decoration: none; padding: 8px 4px; transition: color 150ms ease-out;
}
.back-link:hover { color: var(--ink); }
.avatar {
  background: var(--accent-strong); color: var(--bg);
  font-family: var(--font-display); font-style: italic;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; flex: none; user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 15px; }
.avatar-lg { width: 44px; height: 44px; font-size: 22px; }
.identity { display: flex; flex-direction: column; min-width: 0; }
.name { font-family: var(--font-display); font-style: italic; font-size: 17px; color: var(--ink); line-height: 1.1; }
.status-row { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block;
}
.status-dot.streaming { animation: statusPulse 1.6s ease-in-out infinite; }
.status-text { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.quota-badge {
  font-family: var(--font-mono); font-size: 10px; color: var(--accent);
  border: 1px solid var(--accent-line); border-radius: 999px; padding: 1px 7px;
}
.quota-badge.low { color: var(--warn); border-color: var(--warn-line); background: var(--warn-fill); }
.quota-badge.zero { color: var(--danger); border-color: var(--danger-line); background: var(--danger-fill); }
.lead-gate { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.lead-gate-inner {
  max-width: 26rem; width: 100%; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  /* Short viewports scroll the gate internally instead of the document;
     padding-bottom keeps the submit button clear of the scrollbar. */
  max-height: 100%; overflow-y: auto; padding-bottom: 12px;
}
.lead-gate-title {
  font-family: var(--font-display); font-style: italic; font-size: 30px; line-height: 1.2;
  color: var(--ink); margin-top: 14px;
}
.lead-gate-sub { font-size: 13px; color: var(--ink-2); margin-top: 10px; max-width: 24rem; line-height: 1.6; }
.lead-gate-inner .lead-panel {
  width: 100%; margin-top: 22px; text-align: left;
  background: var(--surface); border-color: var(--border-strong);
}
.header-right { display: flex; align-items: center; gap: 8px; flex: none; }
.ai-chip {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  border: 1px solid var(--border); border-radius: var(--r-control); padding: 2px 8px;
}
.reset-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-control); color: var(--ink-3); transition: all 150ms ease-out;
}
.reset-btn:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- Conversation ---------- */
.conversation { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.empty-state {
  min-height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 32px 16px; max-width: 40rem; margin: 0 auto;
}
.empty-title { font-family: var(--font-display); font-style: italic; font-size: 34px; line-height: 1.2; margin-top: 18px; }
.accent-period { color: var(--accent); }
.empty-sub { font-size: 15px; color: var(--ink-2); margin-top: 10px; max-width: 34rem; }
.trust-line {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 14px;
}
.chips {
  margin-top: 26px; display: grid; gap: 8px; width: 100%; max-width: 36rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
/* Chips rendered inside the post-gate welcome message (chat.js) */
.welcome-chips { margin-top: 14px; max-width: 100%; }
.chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 10px 14px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-card); font-size: 13.5px; color: var(--ink-2);
  transition: all 150ms ease-out;
}
.chip svg { color: var(--ink-4); flex: none; }
.chip:hover { border-color: var(--accent-line); background: var(--surface-2); color: var(--ink); transform: translateY(-1px); }
.chip:active { transform: translateY(0) scale(0.99); }

/* ---------- Messages ---------- */
.message-list { max-width: 48rem; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.msg { display: flex; flex-direction: column; }
.msg-user { align-items: flex-end; }
.msg-user .bubble {
  max-width: 85%; background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-bubble); padding: 10px 14px;
  font-size: 15px; color: var(--user-text); white-space: pre-wrap; overflow-wrap: anywhere;
  animation: msgIn 160ms ease-out;
}
.msg-user .meta { margin-top: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); text-align: right; }
.msg-assistant { display: grid; grid-template-columns: 24px 1fr; gap: 12px; }
.msg-assistant .avatar { width: 24px; height: 24px; font-size: 13px; margin-top: 2px; }
.assistant-body { min-width: 0; }
.assistant-content { font-size: 15px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere; animation: msgIn 160ms ease-out; }
.msg-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.msg-meta-row .meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); }
.copy-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-control); color: var(--ink-3);
}
.copy-btn:hover { color: var(--ink); background: var(--surface-2); }
.copy-btn svg { transition: color 150ms ease-out; }
.copy-btn.copied svg { color: var(--accent); }
.feedback-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-control); color: var(--ink-3); transition: all 150ms ease-out;
}
.feedback-btn:hover { color: var(--ink); background: var(--surface-2); }
.feedback-btn.active { color: var(--accent); background: var(--accent-soft); }
.feedback-btn:disabled { opacity: 0.35; cursor: default; }
.feedback-btn svg { transition: color 150ms ease-out; }
.edit-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-control); color: var(--ink-3);
}
.edit-btn:hover { color: var(--ink); background: var(--surface-2); }
.edit-btn svg { transition: color 150ms ease-out; }
@media (hover: hover) {
  .copy-btn, .edit-btn { opacity: 0.5; } /* visible at rest, full on hover/focus */
  .msg-assistant:hover .copy-btn, .msg-assistant:hover .edit-btn,
  .copy-btn:focus-visible, .edit-btn:focus-visible { opacity: 1; }
}
@media (hover: none) { .copy-btn, .edit-btn { opacity: 1; } }

/* Streaming status note + follow-up chips below an assistant answer */
.stream-note {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  margin-top: 6px; line-height: 1.4;
}
.stream-note svg { flex: none; }
.follow-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-assistant .follow-chips { margin-top: 8px; }
.follow-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; text-align: left;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 7px 13px; transition: all 150ms ease-out;
}
.follow-chip:hover { border-color: var(--accent); color: var(--ink); background: var(--surface-2); transform: translateY(-1px); }
.follow-chip:active { transform: translateY(0) scale(0.99); }
.follow-chip svg { flex: none; transition: color 150ms ease-out; }

/* Markdown rendering (escape-first renderer output) */
.assistant-content p { margin: 6px 0; }
.assistant-content p:first-child { margin-top: 0; }
.assistant-content p:last-child { margin-bottom: 0; }
.assistant-content h3, .assistant-content h2 { color: var(--ink); font-weight: 600; font-size: 15px; margin: 14px 0 6px; }
.assistant-content h2 { font-size: 16px; }
.assistant-content ul, .assistant-content ol { margin: 6px 0; padding-left: 20px; }
.assistant-content li { margin: 4px 0; }
.assistant-content li::marker { color: var(--accent-strong); }
.assistant-content a { color: var(--accent-bright); text-decoration: underline; }
.assistant-content code {
  font-family: var(--font-mono); font-size: 13px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-control); padding: 1.5px 6px;
}
.assistant-content pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 12px 14px; overflow-x: auto; margin: 10px 0; position: relative;
}
.assistant-content pre code { border: none; background: none; padding: 0; font-size: 12.5px; }
.assistant-content blockquote {
  border-left: 2px solid var(--border-strong); color: var(--ink-3); padding-left: 12px; margin: 8px 0;
}
.assistant-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Streaming caret */
.caret {
  display: inline-block; width: 2px; height: 18px; vertical-align: text-bottom;
  background: var(--accent); animation: caretBlink 1s steps(2) infinite;
}

/* Typing indicator */
.typing { display: flex; gap: 4px; padding: 6px 0; }
.typing span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* Error card */
.error-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--danger-fill); border: 1px solid var(--danger-line);
  border-radius: var(--r-card); padding: 12px 14px; font-size: 13.5px; color: var(--ink-2);
}
.error-card svg { color: var(--danger); flex: none; }
.error-card .retry-btn {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--border-strong); border-radius: var(--r-control);
  padding: 5px 10px; margin-left: auto; flex: none;
}
.error-card .retry-btn:hover { background: var(--surface-2); }

/* New message pill — appended by chat.js as the last child of .conversation
   (the scroll container). Centering is sticky + left:50% + translateX(-50%):
   sticky pins it 12px above the scrollport bottom, the 50/translateX pair
   centers it — .conversation has no flex parent to align against. */
.new-pill {
  position: sticky; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  background: var(--surface); border: 1px solid var(--accent-line);
  border-radius: var(--r-control); height: 32px; padding: 0 12px;
  animation: fadeRise 160ms ease-out;
}

/* ---------- Dock / composer ---------- */
.dock {
  flex: none; border-top: 1px solid var(--border); background: var(--bg);
  padding: 12px 16px max(16px, env(safe-area-inset-bottom), env(keyboard-inset-height, 0px));
}
.dock-inner { max-width: 48rem; margin: 0 auto; }
.composer { position: relative; }
/* Height is JS-autosized; the cap lives in chat.js autosize(). */
#composerInput {
  width: 100%; min-height: 48px; resize: none;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-bubble); padding: 12px 56px 12px 14px;
  font-family: var(--font-sans); font-size: 16px; line-height: 1.5; color: var(--ink);
}
#composerInput::placeholder { color: var(--ink-4); }
#composerInput:focus { border-color: var(--accent-line); outline: 2px solid rgba(52, 211, 153, 0.35); outline-offset: 1px; }
#sendBtn {
  position: absolute; right: 6px; bottom: 6px; width: 44px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-control); background: var(--surface-2); color: var(--ink-4);
  transition: all 150ms ease-out;
}
#sendBtn.armed { background: var(--accent); color: var(--accent-contrast); }
#sendBtn.armed:active { transform: scale(0.95); }
#sendBtn.stop-mode { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink-2); }
.disclaimer { margin-top: 10px; text-align: center; font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); line-height: 1.7; }
.char-count {
  display: block; text-align: right; margin-top: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4);
  line-height: 1.4; font-variant-numeric: tabular-nums;
}

/* ---------- Lead capture ---------- */
.lead-strip {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 2px; margin-bottom: 12px;
}
.lead-strip-left {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.4; color: var(--ink-2);
}
.lead-strip-right {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  background: transparent; border: none; cursor: pointer; padding: 4px 0;
  transition: color 150ms ease-out;
}
.lead-strip-right:hover { color: var(--accent-bright); }
.lead-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 20px; margin-bottom: 12px;
}
.lead-header { display: flex; align-items: center; justify-content: space-between; }
.lead-label {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-3);
}
.lead-dismiss { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-control); color: var(--ink-3); }
.lead-dismiss:hover { background: var(--surface-2); color: var(--ink); }
.lead-copy { font-size: 13px; color: var(--ink-2); margin: 10px 0 14px; max-width: 36rem; }
.lead-field input {
  width: 100%; height: 44px; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--r-control); padding: 0 12px;
  font-family: var(--font-mono); font-size: 13px; color: var(--ink);
}
.lead-field input::placeholder { color: var(--ink-4); }
.lead-field input:focus { border-color: var(--accent); outline: 2px solid var(--accent-focus); outline-offset: 1px; }
/* Note textarea — mirrors the email field */
.lead-note-label {
  display: block; margin: 14px 0 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
}
.lead-note-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
#leadNote, .lead-note {
  width: 100%; min-height: 66px; resize: vertical;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--r-control); padding: 10px 12px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.5; color: var(--ink);
}
#leadNote::placeholder, .lead-note::placeholder { color: var(--ink-4); }
#leadNote:focus, .lead-note:focus { border-color: var(--accent); outline: 2px solid var(--accent-focus); outline-offset: 1px; }
.field-error { font-family: var(--font-mono); font-size: 11px; color: var(--danger); margin-top: 6px; }
.lead-check { display: flex; align-items: center; gap: 10px; margin: 14px 0; cursor: pointer; }
.lead-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.checkmark {
  width: 16px; height: 16px; flex: none; border-radius: 2px;
  border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center;
}
.lead-check input:checked + .checkmark { background: var(--accent); border-color: var(--accent); }
.lead-check input:checked + .checkmark::after {
  content: ''; width: 8px; height: 4px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg);
  transform: rotate(-45deg) translate(1px, -1px);
}
.lead-check input:focus-visible + .checkmark { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-text { font-size: 13px; color: var(--ink); }
.check-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.turnstile-caption { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); margin: 6px 0 12px; }
.lead-submit {
  width: 100%; height: 44px; border-radius: var(--r-control);
  background: var(--accent); color: var(--accent-contrast);
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  transition: all 150ms ease-out;
}
.lead-submit:hover:not(:disabled) { background: var(--accent-bright); }
.lead-submit:disabled { background: var(--border); color: var(--ink-4); cursor: not-allowed; }
.lead-success { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 0 6px; }
.lead-success svg { color: var(--accent); }
.lead-success p { font-size: 14px; color: var(--ink); }
.lead-success-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.lead-error {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--danger-fill); border: 1px solid var(--danger-line);
  border-radius: var(--r-control); padding: 10px 14px; font-size: 13px; color: var(--danger);
}
.lead-error button { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-left: auto; }

/* ---------- Admin dashboard ---------- */
.admin-body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); min-height: calc(100dvh / var(--ui-zoom, 1)); }
.admin-header {
  height: 56px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.admin-header-inner {
  max-width: 768px; margin: 0 auto; height: 100%; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.admin-title { display: flex; flex-direction: column; }
.admin-eyebrow { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.admin-name { font-family: var(--font-display); font-style: italic; font-size: 17px; color: var(--ink); }
.admin-actions { display: flex; align-items: center; gap: 10px; }
.admin-back {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-2); text-decoration: none; padding: 8px 4px;
}
.admin-back:hover { color: var(--ink); }
.digest-btn {
  height: 36px; padding: 0 16px; border-radius: var(--r-control);
  background: var(--accent); color: var(--accent-contrast);
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  display: inline-flex; align-items: center; gap: 6px; transition: all 150ms ease-out;
}
.digest-btn:hover:not(:disabled) { background: var(--accent-bright); }
.digest-btn:disabled { background: var(--border); color: var(--ink-4); cursor: not-allowed; }
.admin-main { max-width: 768px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 20px; }
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; }
.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.admin-card-title { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.admin-card-note { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
.tile { padding: 0 16px; }
.tile:first-child { padding-left: 0; }
.tile + .tile { border-left: 1px solid var(--border); }
.tile-value { font-family: var(--font-mono); font-size: 24px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile-value.accent { color: var(--accent); }
.tile-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 4px; }
.tile-sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-sub.up { color: var(--accent); }
.tile-sub.down { color: var(--danger); }
.feedback-line { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: 160px; display: block; }
.chart-tooltip {
  position: absolute; pointer-events: none; display: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 6px 8px; font-family: var(--font-mono); font-size: 10px; color: var(--ink-2);
  white-space: nowrap; z-index: 5;
}
.source-row { display: flex; align-items: center; height: 36px; border-bottom: 1px solid var(--border); position: relative; }
.source-row:last-child { border-bottom: none; }
.source-bar {
  position: absolute; left: 0; top: 6px; bottom: 6px; height: 24px;
  background: var(--accent-soft); border-radius: 4px; z-index: 0;
}
.source-rank { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); width: 32px; flex: none; z-index: 1; }
.source-name { font-size: 13px; color: var(--ink); flex: 1; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); z-index: 1; font-variant-numeric: tabular-nums; }
/* Country / UTM share rows — same anatomy as .source-row, bars reuse .source-bar */
.country-row, .utm-row {
  display: flex; align-items: center; height: 36px;
  border-bottom: 1px solid var(--border); position: relative;
}
.country-row:last-child, .utm-row:last-child { border-bottom: none; }
.bot-note { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); margin-top: 10px; }
.split-bar { display: flex; height: 10px; border-radius: 2px; overflow: hidden; gap: 2px; }
.split-visitor { background: var(--border-strong); }
.split-recruiter { background: var(--accent); }
.split-labels { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 10px; }
.split-labels .vis { color: var(--ink-2); }
.split-labels .rec { color: var(--accent); }
.split-note { font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); margin-top: 10px; }
.leads-table-wrap { overflow-x: auto; }
.leads-table { width: 100%; min-width: 480px; border-collapse: collapse; }
.leads-table th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 500;
  padding: 0 12px 10px 0; border-bottom: 1px solid var(--border);
}
.leads-table td {
  padding: 11px 12px 11px 0; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px; color: var(--ink); white-space: nowrap;
}
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover td { background: var(--surface); }
.lead-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.lead-source { font-size: 10px; color: var(--ink-2); }
.badge { font-family: var(--font-mono); font-size: 10px; padding: 2px 8px; border-radius: 4px; }
.badge-recruiter { background: var(--accent-soft); border: 1px solid rgba(52, 211, 153, 0.3); color: var(--accent); }
.badge-visitor { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink-2); }
.badge-resume {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: var(--accent); color: var(--accent-contrast); white-space: nowrap;
}
.lead-when { font-size: 10px; color: var(--ink-3); }
.lead-note-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: center; padding: 12px 0; }
.auth-card { max-width: 420px; margin: 80px auto; text-align: center; }
.auth-card h1 { font-family: var(--font-display); font-style: italic; font-size: 24px; margin-bottom: 10px; }
.auth-card p { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-bottom: 16px; }
.auth-card input {
  width: 100%; height: 44px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-control); padding: 0 12px; font-family: var(--font-mono);
  font-size: 13px; color: var(--ink); text-align: center; margin-bottom: 12px;
}
.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-control);
  padding: 10px 14px; font-family: var(--font-mono); font-size: 11px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; z-index: 100; animation: fadeRise 180ms ease-out;
}
.toast.ok svg { color: var(--accent); }
.toast.err svg { color: var(--danger); }

/* ---------- Motion ---------- */
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeRise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes statusPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: 0.5; } }
@keyframes caretBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 1; } 30% { transform: translateY(-3px); opacity: 0.6; } }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .back-text { display: none; }
  .ai-chip { display: none; }
  .chips { grid-template-columns: 1fr; }
  .tile-value { font-size: 20px; }
  .admin-cols { grid-template-columns: 1fr; }
  /* Tighten the lead gate so it fits a phone screen; drop the optional
     note (gate context only — the dock panel keeps it). */
  .lead-gate { padding: 16px 12px; }
  .lead-gate-title { font-size: 24px; }
  .lead-gate-inner .lead-panel { margin-top: 12px; }
  .lead-gate .lead-note-label, .lead-gate .lead-note-sub, .lead-gate .lead-note { display: none; }
}
/* Tablet band: stacked admin columns until the layout earns two. */
@media (min-width: 641px) and (max-width: 960px) {
  .admin-cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .caret { display: none; }
  .typing span { animation: none; }
}

/* 150% visual scale (rban.dev + toolbox101 + askrahul): desktop renders at
   root zoom 1.5 at every layout width ≥961px, while media queries and
   viewport units still resolve against the unzoomed viewport — so the
   shell divides its 100dvh by --ui-zoom (1.5 here, 1 on mobile). */
@media (min-width: 961px) {
  html { zoom: 1.5; }
  /* :root outranks the html type selector, so --ui-zoom must be declared at
     :root's own specificity here (same source as the base token, later
     in the cascade) or the mobile default of 1 wins everywhere. */
  :root { --ui-zoom: 1.5; }
}
