/* ==========================================================================
   Coexa Layouts — Direction 2: "Instrument Panel"
   Built from Coexa's real flat/single-accent design system, reviewed at
   coexa-ruby-showcase/dashboard-comparison.html (search ".flat" and
   data-style="merged"). Same recipe, renamed for a standalone page:
   pure black night palette, one solid accent, flat bordered tiles,
   merged-style tinted category fills, zero blur. This direction reads as
   the actual app screen (dense, table/grid-forward) rather than a
   marketing hero, so whitespace is tighter and the grid is doing more of
   the work than typography drama.
   ========================================================================== */

:root{
  /* ---- palette (verbatim recipe from .flat[data-theme="night"]) ---- */
  --page:#000000;
  --surface:#101010;
  --surface-2:#181818;
  --surface-3:#222222;
  --ink:#ffffff;
  --ink-2:#cfcfcf;
  --muted:#969696;
  --border:#2a2a2a;
  --border-2:#1e1e1e;
  --track:#262626;
  --accent:#8B5CF6;
  --accent-deep:#a389f7;
  --accent-2:#FF6FA8;
  --good:#22c55e;
  --bad:#ef4444;
  --warn:#eab308;
  --card-bg: linear-gradient(180deg, #141414, #0d0d0d);
  --card-shadow: inset 0 1px 0 rgba(255,255,255,.04);

  /* ---- type ---- */
  --font-sans:'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ---- shape ---- */
  --radius-lg:16px;
  --radius-md:14px;
  --radius-sm:10px;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after{ box-sizing:border-box; }
html, body{ margin:0; padding:0; max-width:100%; overflow-x:hidden; }
body{
  background-color:var(--page);
  background-image:
    radial-gradient(900px 620px at 12% -6%, rgb(124 58 237 / .14), transparent 55%),
    radial-gradient(760px 600px at 100% 10%, rgb(190 36 110 / .10), transparent 55%);
  background-attachment:fixed;
  color:var(--ink-2);
  font-family:var(--font-sans);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  padding:24px 16px 60px;
}
img, svg{ display:block; max-width:100%; }
a{ color:inherit; }

/* -------------------------------------------------------------- shell */
.instrument{
  max-width:1240px;
  margin:0 auto;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:var(--surface);
  box-shadow:0 40px 100px -40px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.03);
}

/* ------------------------------------------------------------- topbar */
.topbar{
  position:sticky; top:0; z-index:5;
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; flex-wrap:wrap;
  padding:14px 20px;
  border-bottom:1px solid var(--border);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  background:var(--surface);
}
.brand{ display:flex; align-items:center; gap:9px; flex:0 0 auto; }
.brand-mark{ width:22px; height:22px; flex:0 0 auto; }
.brand-name{ font-size:14.5px; font-weight:700; color:var(--ink); letter-spacing:-.01em; }

.navtabs{
  display:flex; align-items:center; gap:4px;
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:999px; padding:4px;
}
.navtab{ font-size:12px; font-weight:600; color:var(--muted); padding:7px 14px; border-radius:999px; }
.navtab.is-active{ background:var(--surface-3); color:var(--ink); }

.status-live{
  display:flex; align-items:center; gap:7px; flex:0 0 auto;
  font-family:var(--font-mono); font-size:11px; font-weight:700;
  letter-spacing:.03em; color:var(--good);
}
.status-dot{ width:7px; height:7px; border-radius:50%; background:var(--good); box-shadow:0 0 0 3px rgb(34 197 94 / .18); }

/* -------------------------------------------------------- control bar */
.control-bar{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; flex-wrap:wrap;
  padding:14px 20px;
  border-bottom:1px solid var(--border);
}
.control-label{
  font-family:var(--font-mono); font-size:11px; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase; color:var(--muted);
}
.range-pills{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.range-pill{ font-size:11.5px; font-weight:600; color:var(--muted); padding:6px 13px; border-radius:999px; }
.range-pill.is-active{ color:#fff; background:var(--accent); }

/* ---------------------------------------------------------------- main */
main{ display:flex; flex-direction:column; gap:30px; padding:22px 20px 0; }
.section{ display:flex; flex-direction:column; min-width:0; }

.section-label{
  display:flex; align-items:center; gap:8px;
  font-family:var(--font-mono); font-size:11px; font-weight:600;
  letter-spacing:.08em; text-transform:uppercase; color:var(--muted);
  margin:0 0 14px;
}
.section-label::before{ content:""; width:6px; height:6px; border-radius:50%; background:var(--accent); flex:0 0 auto; }
.section-title{ font-size:15px; font-weight:700; color:var(--ink); margin:-6px 0 14px; }

/* ------------------------------------------------------------ card base */
.card{
  background:var(--card-bg); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:18px 20px;
  box-shadow:var(--card-shadow); min-width:0;
}
.card-head{ margin-bottom:14px; }
.card-title{ font-size:13px; font-weight:700; color:var(--ink); margin:0 0 3px; }
.card-sub{ font-size:11.5px; color:var(--muted); margin:0; }

/* ----------------------------------------------------- duo grid (row 1) */
.duo-grid{ display:grid; grid-template-columns:1.3fr 1fr; gap:14px; align-items:start; }
.duo-grid > *{ min-width:0; }

/* ------------------------------------------------------------ chat log */
.chat-log{ display:flex; flex-direction:column; gap:2px; max-height:420px; overflow-y:auto; }
.chat-row{ display:flex; gap:10px; padding:8px 10px; border-radius:8px; align-items:baseline; }
.chat-row.is-coexa{ background:var(--surface-2); }
.chat-role{
  flex:0 0 60px; width:60px;
  font-family:var(--font-mono); font-size:9.5px; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase;
}
.chat-row.is-coexa .chat-role{ color:var(--accent-deep); }
.chat-row.is-prospect .chat-role{ color:var(--muted); }
.chat-text{ flex:1; min-width:0; font-size:13px; line-height:1.5; color:var(--ink-2); }
.chat-row.is-coexa .chat-text{ color:var(--ink); }

/* --------------------------------------------------------- field list */
.field-list{ display:flex; flex-direction:column; }
.field-row{ padding:10px 0; border-bottom:1px solid var(--border-2); }
.field-row:last-child{ border-bottom:none; padding-bottom:0; }
.field-k{
  display:block; margin-bottom:4px;
  font-family:var(--font-mono); font-size:10px; font-weight:700;
  letter-spacing:.07em; text-transform:uppercase; color:var(--muted);
}
.field-v{ display:block; font-size:13.5px; color:var(--ink-2); line-height:1.4; }
.field-v.is-good{ color:var(--good); font-weight:700; font-family:var(--font-mono); letter-spacing:.03em; }
.field-v.is-accent{ color:var(--accent-2); font-weight:700; font-family:var(--font-mono); letter-spacing:.03em; }

/* -------------------------------------------------------- pillars strip */
.pillars-strip{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.pillar{ display:flex; flex-direction:column; gap:6px; }
.pillar-index{ font-family:var(--font-mono); font-size:11px; font-weight:700; letter-spacing:.05em; color:var(--accent); }
.pillar-name{ font-size:15px; font-weight:700; color:var(--ink); }
.pillar-desc{ font-size:12px; line-height:1.45; color:var(--muted); }

/* ----------------------------------------------------------- tile grid */
.tile-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.tile{
  position:relative; min-width:0;
  background:var(--card-bg); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:16px 18px;
  box-shadow:var(--card-shadow);
}
.tile-value{
  font-family:var(--font-mono); font-size:24px; font-weight:700;
  letter-spacing:-.02em; color:var(--ink); line-height:1.05;
  font-variant-numeric:tabular-nums;
}
.tile-label{ font-size:11px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); margin-top:6px; }
.tile-sub{ font-size:11px; margin-top:4px; color:var(--ink-2); font-variant-numeric:tabular-nums; }
.tile--wide{ grid-column:span 2; }
.tile[data-cat="yellow"]{ background:linear-gradient(165deg, rgb(234 179 8 / .22), var(--surface) 65%); border-color:rgb(234 179 8 / .4); }
.tile[data-cat="purple"]{ background:linear-gradient(165deg, rgb(139 92 246 / .24), var(--surface) 65%); border-color:rgb(139 92 246 / .45); }
.tile[data-cat="green"]{ background:linear-gradient(165deg, rgb(34 197 94 / .20), var(--surface) 65%); border-color:rgb(34 197 94 / .4); }

/* --------------------------------------------------------------- funnel */
.funnel-list{ display:flex; flex-direction:column; gap:12px; }
.funnel-row{ display:grid; grid-template-columns:minmax(72px,110px) minmax(0,1fr) auto; align-items:center; gap:12px; }
.funnel-label{ font-size:11.5px; font-weight:600; color:var(--muted); line-height:1.3; }
.funnel-track{ height:6px; border-radius:4px; background:var(--track); overflow:hidden; min-width:0; }
.funnel-fill{ display:block; height:100%; border-radius:4px; background:linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); }
.funnel-value{ font-family:var(--font-mono); font-size:12.5px; font-weight:700; color:var(--ink); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }

/* -------------------------------------------------------------- closing */
.closing{ display:flex; flex-direction:column; align-items:center; text-align:center; gap:18px; padding:48px 20px 56px; }
.closing-mark{ width:34px; height:34px; }
.closing-line{ font-size:clamp(18px,2.6vw,24px); font-weight:700; color:var(--ink); max-width:600px; line-height:1.4; margin:0; }
.btn-cta{
  background:var(--accent); color:#fff; font-size:14px; font-weight:700;
  padding:14px 30px; border-radius:10px; text-decoration:none; display:inline-block;
  transition:background .15s ease;
}
.btn-cta:hover{ background:var(--accent-deep); }

/* ---------------------------------------------------------- responsive */
@media (max-width:900px){
  .duo-grid{ grid-template-columns:1fr; }
  .pillars-strip{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tile-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:640px){
  .navtabs{ display:none; }
  .tile-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:480px){
  body{ padding:16px 10px 48px; }
  .instrument{ border-radius:12px; }
  .topbar{ border-radius:12px 12px 0 0; padding:12px 14px; }
  .control-bar{ padding:12px 14px; }
  main{ padding:18px 14px 0; gap:24px; }
  .pillars-strip{ grid-template-columns:minmax(0,1fr); }
  .closing{ padding:40px 16px 44px; }
}
@media (max-width:400px){
  .tile-grid{ grid-template-columns:minmax(0,1fr); }
  .tile--wide{ grid-column:auto; }
}
