/* Shared design system — chrome/deep-metallic, used identically by both
   the broker and owner shells. Shell-specific layout differences live in
   each page's own small <style> block, not here. */
:root {
  --bg: #080b0a;
  --panel-hi: rgba(255,255,255,0.055);
  --panel-lo: rgba(255,255,255,0.018);
  --stroke: rgba(255,255,255,0.09);
  --stroke-hi: rgba(255,255,255,0.16);
  --text: #eef1f5;
  --muted: #838d99;
  --muted-dim: #565e68;
  --chrome-hi: #e8ecf0;
  --chrome-mid: #9aa3ad;
  --ice: #47e6a4;
  --ice-dim: rgba(71,230,164,0.14);
  --green: #3ddc97;
  --amber: #ffb454;
  --red: #ff6b6b;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow: 0 30px 60px -24px rgba(0,0,0,0.85), 0 12px 26px -14px rgba(0,0,0,0.75);
  --shadow-deep: 0 50px 100px -30px rgba(0,0,0,0.9), 0 20px 40px -20px rgba(0,0,0,0.8);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Dash-cluster readout font for scores, amounts, stats — everything that
     reads as a live number gets this instead of the body sans. */
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", "JetBrains Mono", Consolas, monospace;
  --cut: 14px; /* angled-cut corner size, used sparingly on key panels */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background:
    radial-gradient(1100px 650px at 82% -12%, rgba(71,230,164,0.07), transparent 58%),
    radial-gradient(900px 560px at 4% 8%, rgba(255,255,255,0.035), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.scene::after {
  content: "SAN MARCOS · GT  /  14.96° N · 91.79° O";
  position: absolute; right: 22px; bottom: 16px;
  color: rgba(71,230,164,.34); font: 700 9px/1 var(--font-mono); letter-spacing: .12em;
}
.bg-inner { position: absolute; inset: -90px; transform: translate3d(var(--mx, 0px), var(--my, 0px), 0); transition: transform .4s ease-out; }
.grid-bg {
  position: absolute; inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='520' viewBox='0 0 720 520'%3E%3Cg fill='none' stroke='%2347e6a4' stroke-opacity='.13' stroke-width='1'%3E%3Cpath d='M-40 72C80 5 170 137 292 73S510 10 760 98'/%3E%3Cpath d='M-50 108C76 38 178 170 302 109S526 45 770 132'/%3E%3Cpath d='M-62 146C70 72 188 207 315 146S540 82 782 166'/%3E%3Cpath d='M-70 188C66 108 196 245 328 186S555 121 790 202'/%3E%3Cpath d='M-78 234C62 148 210 286 344 228S566 164 798 240'/%3E%3Cpath d='M-84 284C58 194 222 330 360 274S580 210 806 282'/%3E%3Cpath d='M-90 338C54 244 238 375 378 322S596 258 812 330'/%3E%3Cpath d='M-96 396C50 300 252 424 396 374S610 310 818 382'/%3E%3Cpath d='M-102 456C48 358 270 474 418 428S628 366 824 438'/%3E%3C/g%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.035' stroke-width='.7'%3E%3Cpath d='M95-20c48 52 15 91 67 132s89 77 52 130-19 103 42 151 57 93 22 147'/%3E%3Cpath d='M532-30c-34 70 24 104-21 165s-62 111-8 159 29 112-27 168'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 720px 520px;
  opacity: .85;
  -webkit-mask-image: linear-gradient(to bottom, #000 10%, rgba(0,0,0,.8) 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 10%, rgba(0,0,0,.8) 60%, transparent 100%);
}
.brushed {
  position: absolute; inset: 0; opacity: .55;
  background:
    linear-gradient(115deg, transparent 0 46%, rgba(71,230,164,.04) 46.1% 46.25%, transparent 46.35%),
    radial-gradient(ellipse 42% 30% at 67% 33%, transparent 62%, rgba(71,230,164,.045) 62.5%, transparent 63%);
}
/* Fine asphalt-grain noise — road-surface texture under the brushed-metal
   lines, kept very low-opacity so it reads as material, not decoration. */
.grain {
  position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Speed-line: a thin diagonal highlight sweep, used sparingly on the top
   bar and the score gauge — the one literal "motion" cue in the system. */
@keyframes speedSweep { 0% { background-position: -160% 0; } 100% { background-position: 260% 0; } }
.speed-line { position: relative; overflow: hidden; }
.speed-line::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(100deg, transparent 42%, rgba(71,230,164,0.14) 49%, rgba(71,230,164,0.25) 50%, rgba(71,230,164,0.14) 51%, transparent 58%);
  background-size: 260% 100%;
  animation: speedSweep 7s ease-in-out infinite;
}
.orb { display: none; }
@keyframes drift { 0%, 100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(50px, 34px, 0) scale(1.1); } }

.page { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 28px 22px 70px; }

.glass {
  position: relative;
  background: linear-gradient(160deg, var(--panel-hi), var(--panel-lo));
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0) 22%);
  border: 1px solid rgba(255,255,255,0.05);
}

.drift { transform: translate3d(var(--px, 0px), var(--py, 0px), 0); transition: transform .5s cubic-bezier(.2,.6,.3,1); will-change: transform; }
.float { animation: floatY 7s ease-in-out infinite; }
.float.f2 { animation-duration: 8.6s; animation-delay: 1.1s; }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.tilt { transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .3s ease; will-change: transform; }

.hidden { display: none !important; }
.mobile-only { display: none !important; }
button, input, select, textarea { font-family: inherit; }

.connectivity-state {
  position:fixed; left:50%; bottom:calc(14px + env(safe-area-inset-bottom)); z-index:100;
  max-width:calc(100vw - 28px); padding:9px 13px; transform:translate(-50%,24px);
  border:1px solid rgba(240,181,77,.5); border-radius:4px; background:#17130b; color:#f5ce83;
  font:700 11px/1.3 var(--font-mono); opacity:0; pointer-events:none; transition:.18s ease;
}
.connectivity-state.visible { opacity:1; transform:translate(-50%,0); }
.mobile-action { min-height:52px; padding:10px 12px; border:1px solid var(--stroke-hi); border-radius:4px; background:#111718; color:var(--text); font-weight:700; }
.mobile-action.primary { border-color:var(--ice); background:var(--ice); color:#07120d; }

@media (max-width: 680px) {
  .mobile-only { display:grid !important; }
  body { padding-top:env(safe-area-inset-top); }
  .page { padding-left:max(12px, env(safe-area-inset-left)); padding-right:max(12px, env(safe-area-inset-right)); padding-bottom:calc(72px + env(safe-area-inset-bottom)); }
  button, .nav-btn, .filter-btn, .chip, .logout-btn { min-height:44px; }
  input, select, textarea { font-size:16px; }
  .top { position:sticky; top:env(safe-area-inset-top); z-index:12; }
  .top .brand span, .top .role-badge, .top .mode { display:none; }
  .nav { position:sticky; top:calc(58px + env(safe-area-inset-top)); z-index:11; margin:8px -12px 0; padding:6px 12px; background:rgba(7,10,11,.96); }
  .stat-tile { min-height:92px; }
  .stat-tile b { font-size:24px; }
  .q-row { min-height:76px; }
  .decision-actions { grid-template-columns:1fr; }
  .decision-actions button { min-height:52px; width:100%; }
  .scene::after { right: 12px; bottom: 8px; font-size: 8px; }
}

/* ── Token gate ─────────────────────────────────────────────────── */
.gate-wrap { min-height: 100vh; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.gate-card {
  max-width: 430px; width: 100%; padding: 40px 38px 36px; text-align: left;
  border-color: rgba(222,246,239,.18); box-shadow: 0 34px 80px -42px #000, 0 1px 0 rgba(255,255,255,.06) inset;
}
.gate-card::after { content:""; display:block; position:absolute; left:38px; right:38px; top:0; height:2px; background:linear-gradient(90deg, var(--ice), transparent 72%); pointer-events:none; }
.gate-mark { font-weight: 800; letter-spacing: 0.1em; font-size: 15px; margin-bottom: 20px; }
.gate-mark b { color: var(--ice); }
.gate-mark span { color: var(--muted); font-weight: 500; }
.gate-card h1 { font-size: clamp(25px, 7vw, 32px); margin: 0 0 8px; letter-spacing: 0; line-height:1.15; }
.gate-card p { color: #a6b5b0; font-size: 14px; margin-bottom: 24px; line-height: 1.55; }
.gate-label { display:block; margin-bottom:8px; color:#c7d3cf; font-size:11px; font-weight:700; text-transform:uppercase; }
.gate-input {
  width: 100%; min-height:56px; background: rgba(4,9,9,.72); border: 1px solid rgba(222,246,239,.16); border-radius: var(--r-md);
  padding: 15px 16px; color: var(--text); font-size: 16px; outline: none; text-align: left; letter-spacing: 0;
}
.gate-input::placeholder { color:#667570; }
.gate-input:focus { border-color: rgba(71,230,164,.58); box-shadow: 0 0 0 3px var(--ice-dim); }
.gate-btn {
  margin-top: 12px; width: 100%; min-height:56px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--ice);
  background: var(--ice); color: #03100c; font-weight: 800; font-size: 15px;
  cursor: pointer; letter-spacing: 0; box-shadow: 0 16px 32px -18px rgba(71,230,164,.72);
}
.gate-btn:hover { background:#62ebb0; }
.gate-err { margin-top: 12px; padding:0 2px; font-size: 13px; font-weight:700; color: #ff9999; min-height: 20px; }
.gate-spin { margin-top: 12px; font-size: 12.5px; color: var(--muted); min-height: 16px; }
@media (max-width: 480px) {
  .gate-wrap { place-items:center; padding-left:14px; padding-right:14px; }
  .gate-card { padding:32px 22px 28px; }
  .gate-card::after { left:22px; right:22px; }
}

/* ── Top bar / nav ──────────────────────────────────────────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px;
  border-radius: var(--r-lg);
  /* Angled-cut top-right corner — the one "machined panel" cut in the
     system, reserved for the header so it reads as a deliberate accent
     rather than a pattern repeated everywhere. */
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}
.brand { font-weight: 800; letter-spacing: 0.08em; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.brand b { color: var(--ice); }
.brand span { color: var(--muted); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 10px; }
.role-badge {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--stroke-hi); color: var(--chrome-hi); background: rgba(255,255,255,0.05);
}
.role-badge.owner { color: #0a0b0d; background: linear-gradient(160deg, var(--chrome-hi), var(--chrome-mid)); border-color: transparent; font-weight: 700; }
.mode {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 11px; border: 1px solid var(--stroke); border-radius: 999px;
  color: var(--muted); background: rgba(255,255,255,0.03); white-space: nowrap;
}
.mode.online { color: var(--green); border-color: rgba(61,220,151,0.4); }
.mode.off { color: var(--red); border-color: rgba(255,107,107,0.4); }
.logout-btn {
  background: none; border: 1px solid var(--stroke); color: var(--muted); font-size: 11px;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.logout-btn:hover { color: var(--text); border-color: var(--stroke-hi); }

.nav { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.nav-btn {
  background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); color: var(--muted);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; cursor: pointer; letter-spacing: 0.01em;
  transition: all .18s ease;
}
.nav-btn:hover { color: var(--text); border-color: var(--stroke-hi); }
.nav-btn.active { color: #0a0b0d; background: linear-gradient(160deg, var(--chrome-hi), var(--chrome-mid)); border-color: transparent; font-weight: 700; }

.view { margin-top: 22px; display: grid; gap: 20px; }

/* ── Stat tiles ─────────────────────────────────────────────────── */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-tile { padding: 16px 18px; }
.stat-tile span { display: block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-tile b { font-family: var(--font-mono); font-size: 22px; letter-spacing: -0.01em; }

.premium-paywall { padding: 18px 20px; display: grid; gap: 8px; border: 1px solid rgba(255,180,84,0.32); background: linear-gradient(150deg, rgba(255,180,84,0.08), rgba(255,255,255,0.02)); }
.premium-paywall h3 { font-size: 15px; color: #ffe3ba; }
.premium-paywall p { color: var(--muted); font-size: 13px; }

.premium-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.premium-card { padding: 16px 18px; }
.premium-card h3 { font-size: 13.5px; margin-bottom: 10px; }
.premium-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.premium-kpis div { border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 9px; background: rgba(255,255,255,0.02); }
.premium-kpis span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.premium-kpis b { display: block; font-size: 14px; margin-top: 2px; }
.premium-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.premium-list { margin: 7px 0 0 16px; display: grid; gap: 3px; font-size: 12.5px; color: #d8dee5; }
.premium-row { display: flex; gap: 8px; }
.premium-input { flex: 1; border: 1px solid var(--stroke); border-radius: 9px; padding: 8px 10px; background: rgba(255,255,255,0.03); color: var(--text); }

/* ── Queue ──────────────────────────────────────────────────────── */
.queue-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 20px 22px 0; }
.queue-head h2 { font-size: 17px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.queue-search-row { min-width: 260px; flex: 1; }
.queue-search-row input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 12.5px;
  outline: none;
}
.queue-search-row input:focus {
  border-color: rgba(111,211,255,0.45);
  box-shadow: 0 0 0 2px rgba(111,211,255,0.14);
}
.filter-btn {
  background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.filter-btn.active { color: var(--ice); border-color: rgba(111,211,255,0.4); background: var(--ice-dim); }
.queue-list { display: grid; gap: 8px; padding: 16px 22px 22px; }
.q-row {
  display: grid; grid-template-columns: 1fr auto auto auto auto auto; gap: 14px; align-items: center;
  background: rgba(255,255,255,0.025); border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 13px 16px; cursor: pointer; text-align: left; width: 100%; color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.q-row:hover { border-color: var(--stroke-hi); background: rgba(255,255,255,0.045); }
.q-row.search-row.active { border-color: rgba(111,211,255,0.45); background: rgba(111,211,255,0.1); }
.q-row-main { display: grid; gap: 2px; min-width: 0; }
.q-row-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row-main span { font-size: 11.5px; color: var(--muted); }
.q-row-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.q-row-meta small { font-size: 11px; color: var(--muted-dim); }
.q-row-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.q-row-attr { font-size: 10.5px; color: var(--muted-dim); white-space: nowrap; border: 1px solid var(--stroke); padding: 3px 8px; border-radius: 999px; }
.q-score {
  --c: var(--chrome-mid); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 800; background: conic-gradient(var(--c) calc(var(--v, 0) * 1%), rgba(255,255,255,0.08) 0);
  color: var(--text);
}
.q-score-pending { background: rgba(255,255,255,0.06); color: var(--muted); }
.q-empty, .q-loading { padding: 30px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ── Activity ───────────────────────────────────────────────────── */
.act-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--stroke); font-size: 12.5px; }
.act-row:last-child { border-bottom: none; }
.act-row b { color: var(--text); font-weight: 600; }
.act-row span { color: var(--muted); }
.act-row small { color: var(--muted-dim); white-space: nowrap; }

/* ── Pipeline breakdown (both shells) ──────────────────────────────── */
.pipeline-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--stroke); font-size: 13px; }
.pipeline-row:last-child { border-bottom: none; }
.pipeline-row b { font-family: var(--font-mono); font-size: 15px; }

/* ── Detail / dossier ───────────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--stroke);
  color: var(--muted); padding: 7px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.back-btn:hover { color: var(--text); border-color: var(--stroke-hi); }
.card { padding: 26px; }

.d-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.avatar {
  width: 60px; height: 60px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #0a0b0d;
  background: linear-gradient(155deg, var(--chrome-hi), var(--chrome-mid));
  box-shadow: 0 16px 34px -12px rgba(255,255,255,0.16);
}
.d-who { flex: 1; min-width: 200px; }
.d-who h2 { font-size: 21px; letter-spacing: -0.01em; margin-top: 9px; }
.d-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.status-chip, .ref-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--stroke);
  color: var(--ice); background: rgba(255,255,255,0.03);
}
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ice); box-shadow: 0 0 8px rgba(111,211,255,0.7); }
.status-chip.approved { color: var(--green); } .status-chip.approved::before { background: var(--green); box-shadow: 0 0 8px rgba(61,220,151,0.7); }
.status-chip.declined { color: var(--red); } .status-chip.declined::before { background: var(--red); box-shadow: 0 0 8px rgba(255,107,107,0.7); }
.status-chip.needs_more_info { color: var(--amber); } .status-chip.needs_more_info::before { background: var(--amber); box-shadow: 0 0 8px rgba(255,180,84,0.7); }
.d-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.7; }

.gauge { --score: 0; --c: var(--amber); width: 118px; height: 118px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--score) * 1%), rgba(255,255,255,0.07) 0);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 22px 46px -18px var(--c);
}
.g-inner {
  width: 92px; height: 92px; border-radius: 50%; text-align: center;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.10), rgba(8,9,11,0.96) 62%);
  display: grid; place-items: center; align-content: center; padding: 6px;
}
.g-inner b { display: block; font-family: var(--font-mono); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.g-inner small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 5px; }

.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 22px; }
.stat { background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); border-radius: var(--r-sm); padding: 12px 14px; }
.stat span { display: block; font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.stat b { font-family: var(--font-mono); font-size: 15px; letter-spacing: -0.01em; }

.cats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--stroke); color: var(--muted); background: rgba(255,255,255,0.03); }
.cat i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cat.ok { color: var(--green); } .cat.ok i { background: var(--green); box-shadow: 0 0 7px rgba(61,220,151,0.7); }
.cat.warn { color: var(--amber); } .cat.warn i { background: var(--amber); box-shadow: 0 0 7px rgba(255,180,84,0.7); }

.flags { display: grid; gap: 9px; margin-top: 20px; }
.flag { border-radius: var(--r-sm); padding: 12px 14px; font-size: 13px; line-height: 1.5; border: 1px solid; }
.flag.alert { background: rgba(255,107,107,0.07); border-color: rgba(255,107,107,0.32); color: #ffc9c9; }
.flag.watch { background: rgba(255,180,84,0.06); border-color: rgba(255,180,84,0.32); color: #ffe3ba; }
.flag.ok { background: rgba(61,220,151,0.06); border-color: rgba(61,220,151,0.3); color: #b6f4dc; }
.flag.alert::before, .flag.watch::before, .flag.ok::before {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%; text-align: center; line-height: 18px;
  font-weight: 800; margin-right: 9px; font-size: 12px;
}
.flag.alert::before { content: "!"; background: rgba(255,107,107,0.22); color: #ffc9c9; }
.flag.watch::before { content: "i"; background: rgba(255,180,84,0.2); color: #ffe3ba; }
.flag.ok::before { content: "✓"; background: rgba(61,220,151,0.18); color: #b6f4dc; }

.rec { margin-top: 20px; border-radius: var(--r-md); padding: 15px 17px; background: linear-gradient(150deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012)); border: 1px solid var(--stroke); }
.rec h4 { font-size: 11px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--chrome-hi); margin-bottom: 6px; }
.rec p { font-size: 13.5px; line-height: 1.6; color: #dfe4ea; }
.ai-rec { border-color: rgba(111,211,255,0.28); background: linear-gradient(150deg, var(--ice-dim), rgba(255,255,255,0.02)); }
.ai-rec-badge { display: inline-block; font-weight: 800; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--stroke); }
.ai-rec-badge.approve { color: var(--green); border-color: rgba(61,220,151,0.5); background: rgba(61,220,151,0.1); }
.ai-rec-badge.decline { color: var(--red); border-color: rgba(255,107,107,0.5); background: rgba(255,107,107,0.1); }
.ai-rec-badge.manual_review { color: var(--amber); border-color: rgba(255,180,84,0.5); background: rgba(255,180,84,0.1); }

.decision-box textarea {
  width: 100%; margin-top: 4px; min-height: 64px; resize: vertical; border-radius: var(--r-sm);
  border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); color: var(--text); padding: 10px 12px; outline: none; font-size: 13px;
}
.decision-actions { display: flex; gap: 10px; margin-top: 10px; }
.chip-approve, .chip-decline, .chip-more-info { flex: 1; justify-content: center; font-weight: 700; }
.chip-approve { color: var(--green); border-color: rgba(61,220,151,0.4); }
.chip-approve:hover { background: rgba(61,220,151,0.12); }
.chip-decline { color: var(--red); border-color: rgba(255,107,107,0.4); }
.chip-decline:hover { background: rgba(255,107,107,0.12); }
.chip-more-info { color: var(--amber); border-color: rgba(255,180,84,0.4); }
.chip-more-info:hover { background: rgba(255,180,84,0.12); }
.decision-done.approved { border-color: rgba(61,220,151,0.35); }
.decision-done.declined { border-color: rgba(255,107,107,0.35); }
.decision-done.needs_more_info { border-color: rgba(255,180,84,0.35); }

.profile-grid { display: grid; gap: 8px; margin-top: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-row { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,0.02); padding: 10px 12px; }
.profile-row span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 4px; }
.profile-row b { font-size: 12.5px; color: var(--text); font-weight: 600; line-height: 1.5; }

.src-evidence-grid { display: grid; gap: 10px; margin-top: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.src-evidence { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255,255,255,0.02); padding: 10px 12px; }
.src-evidence ul { margin: 8px 0 0 16px; display: grid; gap: 4px; color: #d8dee5; font-size: 12px; }
.src-empty { font-size: 12px; color: var(--muted); margin-top: 8px; }

.hist-list { display: grid; gap: 8px; margin-top: 8px; }
.hist-row { border: 1px solid var(--stroke); border-radius: 10px; padding: 9px 11px; display: grid; gap: 2px; background: rgba(255,255,255,0.02); }
.hist-row b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--chrome-hi); }
.hist-row span { font-size: 12.5px; color: #d8dee5; }
.hist-row small { font-size: 11px; color: var(--muted); }

.cash-select, .cash-input {
  width: 100%; margin-top: 6px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03);
  color: var(--text); padding: 10px 12px; font-size: 13px; outline: none;
}
.cash-select:focus, .cash-input:focus { border-color: rgba(111,211,255,0.45); box-shadow: 0 0 0 2px rgba(111,211,255,0.12); }

.src-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.src-head h3 { font-size: 15px; }
.src-count { font-size: 11.5px; color: var(--muted); }
.sources { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 16px; }
.src { border-radius: var(--r-sm); border: 1px solid var(--stroke); background: rgba(255,255,255,0.025); padding: 11px 13px; display: flex; flex-direction: column; gap: 4px; }
.src-top { display: flex; align-items: center; gap: 8px; }
.src-top b { font-size: 13px; font-weight: 600; }
.src-meta { font-size: 11.5px; color: var(--muted); }
.src .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.official { background: var(--ice); box-shadow: 0 0 7px rgba(111,211,255,0.7); }
.dot.open { background: var(--chrome-mid); box-shadow: 0 0 7px rgba(154,163,173,0.6); }

/* ── Search ─────────────────────────────────────────────────────── */
.lookup { max-width: 640px; padding: 26px; }
.lookup .label { display: block; font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }
.input-row { display: flex; align-items: center; gap: 12px; margin-top: 11px; background: rgba(255,255,255,0.035); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 6px 8px 6px 12px; transition: border-color .2s ease, box-shadow .2s ease; }
.input-row:focus-within { border-color: rgba(111,211,255,0.5); box-shadow: 0 0 0 3px var(--ice-dim); }
.search-ic { width: 38px; height: 38px; border-radius: 10px; flex: none; background: linear-gradient(150deg, var(--chrome-hi), var(--chrome-mid)); display: grid; place-items: center; box-shadow: 0 10px 22px -8px rgba(255,255,255,0.18); }
#waInput { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: 0.03em; padding: 9px 0; font-family: inherit; min-width: 0; }
#waInput::placeholder { color: var(--muted-dim); font-weight: 500; }
.clear { background: none; border: 0; color: var(--muted); font-size: 14px; line-height: 1; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.clear:hover { color: #fff; background: rgba(255,255,255,0.07); }
.hint { margin-top: 11px; font-size: 12.5px; color: var(--muted); min-height: 17px; }
.hint.ok { color: var(--green); } .hint.warn { color: var(--amber); } .hint.err { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chip { border: 1px solid var(--stroke); background: rgba(255,255,255,0.035); color: var(--muted); padding: 6px 11px; border-radius: 999px; font-size: 12px; cursor: pointer; transition: all .18s ease; letter-spacing: 0.01em; }
.chip:hover { color: #fff; border-color: rgba(111,211,255,0.4); background: var(--ice-dim); }
.chat-mode-row { margin-top: 14px; display: flex; gap: 8px; align-items: center; }
.chat-mode-row label { color: var(--muted); font-size: 12.5px; }
.chat-mode-row select { border-radius: 9px; padding: 7px 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); color: var(--text); font-size: 12.5px; }

.state { text-align: center; padding: 42px 28px; }
.state .s-ic { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 16px; background: rgba(255,255,255,0.05); border: 1px solid var(--stroke); display: grid; place-items: center; color: var(--muted); font-size: 22px; }
.state h3 { font-size: 18px; margin-bottom: 7px; }
.state p { color: var(--muted); font-size: 13.5px; max-width: 440px; margin: 0 auto; line-height: 1.6; }
.state.warn h3 { color: var(--amber); } .state.err h3 { color: var(--red); }

.loading .bar { height: 15px; border-radius: 7px; margin-bottom: 13px; background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.13), rgba(255,255,255,0.05)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.loading .bar:last-child { margin-bottom: 0; }
.w100 { width: 100%; } .w80 { width: 80%; } .w60 { width: 60%; } .w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Billing ────────────────────────────────────────────────────── */
.section-head { text-align: center; margin-bottom: 20px; }
.section-head h2 { font-size: 22px; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); font-size: 13.5px; margin-top: 7px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan { padding: 26px; display: flex; flex-direction: column; gap: 9px; }
.plan .k { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ice); }
.plan h3 { font-size: 19px; }
.plan .price { font-family: var(--font-mono); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.plan .price small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.plan p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.plan ul { list-style: none; margin-top: 5px; display: grid; gap: 6px; }
.plan li { font-size: 12.5px; padding-left: 20px; position: relative; color: #dfe4ea; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.plan-email { margin-top: 9px; background: rgba(255,255,255,0.035); border: 1px solid var(--stroke); border-radius: 9px; padding: 10px 12px; color: var(--text); font-size: 13px; outline: none; }
.plan-email:focus { border-color: rgba(111,211,255,0.5); }
.plan-pay { margin-top: 3px; justify-content: center; }
.plan-pay:disabled { opacity: 0.55; cursor: default; }
.plan-note { font-size: 12px; min-height: 15px; color: var(--muted); }
.plan-note.ok { color: var(--green); } .plan-note.warn { color: var(--amber); }
.plans-off { color: var(--muted); font-size: 13px; text-align: center; padding: 10px 0; }

/* ── Owner tools ────────────────────────────────────────────────── */
.tester { padding: 22px; }
.tester-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.tester-head h3 { font-size: 16px; }
.tester-head p { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.tester-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 12px; margin-top: 16px; }
.tester-grid .field { display: grid; gap: 7px; }
.tester-grid label { font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); }
.tester-grid input, .tester-grid select, .tester-grid textarea {
  width: 100%; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.03); color: var(--text);
  padding: 11px 13px; outline: none;
}
.tester-grid textarea { min-height: 100px; resize: vertical; }
.tester-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 13px; }
.tester-output { margin-top: 15px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(255,255,255,0.02); padding: 13px; color: #d6dce3; font-size: 12px; line-height: 1.5; overflow: auto; max-height: 240px; }
.tester-output.ok { border-color: rgba(61,220,151,0.3); }
.tester-output.err { border-color: rgba(255,107,107,0.3); color: #ffc9c9; }

footer { margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--stroke); color: var(--muted); font-size: 11.5px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .premium-grid { grid-template-columns: 1fr; }
  .sources { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .q-row { grid-template-columns: 1fr auto; }
  .q-row-meta, .q-row-attr, .q-row-time { display: none; }
  .profile-grid, .src-evidence-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Unified operations HUD ────────────────────────────────────── */
:root {
  --bg: #070a0b;
  --panel-hi: rgba(21, 29, 30, 0.96);
  --panel-lo: rgba(11, 16, 17, 0.98);
  --glass-solid: rgba(11, 17, 17, 0.97);
  --glass-surface: rgba(13, 21, 20, 0.76);
  --glass-surface-strong: rgba(10, 16, 16, 0.88);
  --glass-border: rgba(222, 246, 239, 0.13);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --glass-blur: 18px;
  --glass-blur-mobile: 8px;
  --glass-shadow: 0 22px 52px -34px rgba(0, 0, 0, 0.96), 0 1px 0 rgba(255, 255, 255, 0.035) inset;
  --stroke: rgba(206, 232, 226, 0.10);
  --stroke-hi: rgba(206, 232, 226, 0.22);
  --text: #edf5f2;
  --muted: #8d9d99;
  --muted-dim: #596561;
  --chrome-hi: #edf5f2;
  --chrome-mid: #8d9d99;
  --ice: #47e6a4;
  --ice-dim: rgba(71, 230, 164, 0.10);
  --green: #4bd69b;
  --amber: #efb84f;
  --red: #ef6868;
  --r-lg: 8px;
  --r-md: 6px;
  --r-sm: 5px;
  --shadow: 0 18px 45px -30px #000;
  --shadow-deep: 0 24px 60px -36px #000;
  --font-sans: "Bahnschrift", "Aptos Display", "Segoe UI Variable", sans-serif;
}

body {
  background-color: #070a0b;
  letter-spacing: 0;
}
.orb { display: none; }
.grid-bg {
  opacity: .85;
}
.grain { opacity: .025; }
.bg-inner { transition: none; transform: none; }
.glass {
  isolation: isolate;
  background: var(--glass-solid);
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.glass::before {
  display: block;
  z-index: -1;
  background: linear-gradient(180deg, var(--glass-highlight), transparent 26%);
  border-color: rgba(255, 255, 255, 0.035);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: linear-gradient(155deg, rgba(25, 36, 34, 0.82), var(--glass-surface));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(128%);
    backdrop-filter: blur(var(--glass-blur)) saturate(128%);
  }
}
.drift, .tilt { transform: none; transition: none; }
.float { animation: none; }
.speed-line::after {
  background: linear-gradient(100deg, transparent 44%, rgba(57,230,176,.12) 50%, transparent 56%);
  animation-duration: 12s;
}

.page { padding-top: 18px; }
.top {
  min-height: 64px;
  border-left: 2px solid var(--ice);
  clip-path: none;
}
.brand { letter-spacing: .06em; }
.brand b { color: var(--ice); }
.brand span { letter-spacing: 0; }
.role-badge.owner, .role-badge.broker {
  color: var(--ice);
  background: var(--ice-dim);
  border-color: rgba(57,230,176,.28);
  font-weight: 700;
}
.mode, .role-badge, .logout-btn, .nav-btn, .filter-btn, .chip, .back-btn,
.status-chip, .ref-chip, .cat, .q-row-attr { border-radius: 4px; }
.mode.online { color: var(--green); }
.nav {
  margin-top: 10px;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--stroke);
  background: var(--glass-surface-strong);
  border-radius: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-btn {
  min-height: 38px;
  padding: 8px 14px;
  border-color: transparent;
  background: transparent;
  white-space: nowrap;
}
.nav-btn.active {
  color: #03100c;
  background: var(--ice);
  border-color: var(--ice);
  box-shadow: 0 0 18px rgba(57,230,176,.12);
}
.view { gap: 12px; margin-top: 14px; }
.section-head { text-align: left; margin-bottom: 8px; }
.section-head h2 { font-size: 20px; }
.section-head p { margin-top: 3px; max-width: 660px; }

.stat-tiles { gap: 8px; }
.stat-tile {
  min-height: 94px;
  padding: 15px 16px;
  border-top: 2px solid rgba(57,230,176,.32);
}
.stat-tile span { margin-bottom: 10px; color: #74847f; }
.stat-tile b { font-size: clamp(21px, 3vw, 29px); color: var(--text); }
.premium-grid, .premium-kpis, .profile-grid, .src-evidence-grid { gap: 6px; }
.premium-card, .profile-row, .src-evidence, .hist-row, .stat, .src, .amount-box {
  border-radius: 4px;
  box-shadow: none;
}

.queue-head { padding: 16px 16px 0; }
.queue-list { gap: 5px; padding: 12px 16px 16px; }
.q-row {
  min-height: 62px;
  padding: 11px 13px;
  border-radius: 4px;
  background: rgba(255,255,255,.018);
}
.q-row:hover, .q-row.search-row.active {
  border-color: rgba(57,230,176,.38);
  background: rgba(57,230,176,.055);
}
.q-score { border-radius: 4px; background: rgba(255,255,255,.055); border-left: 3px solid var(--c); }
.q-loading {
  min-height: 80px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.q-loading::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  display: inline-block;
  background: var(--ice);
  box-shadow: 0 0 12px rgba(57,230,176,.55);
  animation: hudPulse 1.2s ease-in-out infinite;
}
@keyframes hudPulse { 50% { opacity: .3; } }

.card { padding: 20px; }
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 5px;
  color: #03100c;
  background: var(--ice);
  box-shadow: none;
}
.gauge { width: 108px; height: 108px; box-shadow: none; }
.g-inner { width: 84px; height: 84px; background: #0b1011; }
.stat-row { gap: 6px; margin-top: 16px; }
.cats { margin-top: 12px; }
.rec { margin-top: 10px; border-radius: 5px; background: rgba(255,255,255,.018); }
.rec h4 { color: #9aa9a5; }
.ai-rec { border-color: rgba(57,230,176,.25); background: rgba(57,230,176,.04); }
.decision-box {
  border-color: rgba(57,230,176,.36);
  border-left: 3px solid var(--ice);
  padding: 18px;
}
.decision-actions { gap: 7px; }
.decision-actions .chip {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 13px;
}
.chip-approve {
  color: #03100c;
  background: var(--green);
  border-color: var(--green);
}
.chip-approve:hover { color: #03100c; background: #62e5ac; }
.chip-decline { color: var(--red); }
.chip-more-info { color: var(--amber); }
.cash-box { padding: 16px; }
.cash-box .decision-actions { flex-wrap: wrap; }
.cash-box .decision-actions input, .cash-box .decision-actions select { flex: 1 1 140px; }
.cash-box .decision-actions button { flex: 1 1 170px; }
.cash-select, .cash-input, .decision-box textarea, .premium-input, .plan-email,
.tester-grid input, .tester-grid select, .tester-grid textarea {
  border-radius: 4px;
  background: rgba(5, 10, 10, 0.68);
}
.cash-select:focus, .cash-input:focus, .queue-search-row input:focus,
.plan-email:focus, .gate-input:focus, .input-row:focus-within {
  border-color: rgba(57,230,176,.48);
  box-shadow: 0 0 0 2px rgba(57,230,176,.08);
}
.chip:hover { border-color: rgba(57,230,176,.38); background: var(--ice-dim); }
.plan .k, .filter-btn.active { color: var(--ice); }
.search-ic { border-radius: 4px; background: var(--ice); box-shadow: none; }
.state .s-ic { border-radius: 4px; }
.state { padding: 34px 22px; }
.q-empty { color: #778681; }
footer { margin-top: 28px; }

@media (max-width: 680px) {
  .glass {
    background: var(--glass-solid);
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass {
      background: linear-gradient(155deg, rgba(20, 29, 28, 0.91), var(--glass-surface-strong));
      -webkit-backdrop-filter: blur(var(--glass-blur-mobile)) saturate(112%);
      backdrop-filter: blur(var(--glass-blur-mobile)) saturate(112%);
    }
  }
  .page { padding: 10px 10px 72px; }
  .top { min-height: 54px; padding: 10px 12px; }
  .brand span { display: none !important; }
  .role-badge { display: none; }
  .mode { max-width: 108px; overflow: hidden; text-overflow: ellipsis; }
  .nav { margin-top: 7px; }
  .nav-btn { flex: 0 0 auto !important; min-width: 82px; }
  .stat-tile { min-height: 82px; padding: 12px; }
  .stat-tile b { font-size: 20px; }
  .card { padding: 15px; }
  .decision-actions { display: grid; grid-template-columns: 1fr; }
  .decision-actions .chip { width: 100%; }
  .d-head { gap: 12px; }
  .gauge { width: 92px; height: 92px; }
  .g-inner { width: 70px; height: 70px; }
  .g-inner b { font-size: 22px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row .stat:last-child { grid-column: 1 / -1; }
  footer { display: none; }
}
