/* Clearmap — styled on the FRI design kit (audit-deck palette + brand tokens):
   warm paper ground, ink text, deep green primary, orange to point (60-30-10),
   Archivo for display type. Grade + kind hues stay semantic. WCAG AA checked on
   the pairs used (ink/paper 14.9:1, white/green 7.4:1, muted/paper 4.6:1). */

* { box-sizing: border-box; }
:root {
  /* primitives (FRI kit) */
  --paper: #FBF8F2; --card: #FFFFFF; --ink: #1B2024; --warm-gray: #6B7177;
  --border: #E5E0D7; --border-strong: #DCD6CB;
  --green-700: #0A423B; --green-600: #0E5A50; --green-100: #EAF1EE;
  --orange-500: #E08A3C; --orange-100: #FBF3E8;
  --red-500: #B3382C; --purple-500: #7A4FA0; --blue-500: #2C6E8F;
  /* semantic */
  --bg: var(--paper); --panel: var(--card); --line: var(--border);
  --muted: var(--warm-gray);
  --accent: var(--green-600); --accent-ink: #ffffff;
  --verified: var(--green-600); --directional: #C77B2B; --vendor: var(--red-500);
  --pain: var(--red-500); --process: var(--blue-500); --function: #4A4540;
  --system: var(--purple-500); --candidate: var(--orange-500);
  --highlight: var(--orange-100); --highlight-line: var(--orange-500);
  --display: Archivo, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* polish tokens: shared elevation + motion rhythm */
  --shadow-xs: 0 1px 2px rgba(27,32,36,0.05);
  --shadow-sm: 0 2px 8px rgba(27,32,36,0.08);
  --shadow-md: 0 8px 28px rgba(27,32,36,0.12);
  --shadow-lg: 0 18px 48px rgba(27,32,36,0.16);
  --ease: cubic-bezier(0.22,0.8,0.3,1);
  --t-fast: 0.15s ease;
  --t-med: 0.2s var(--ease);
}
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--warm-gray); background-clip: padding-box; }

body { margin: 0; font: 15px/1.6 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
h1, h2, h3 { font-family: var(--display); }
:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }

.center-page { display: grid; place-items: center; min-height: 100vh; padding: 32px 20px;
               background:
                 radial-gradient(720px 420px at 12% -8%, rgba(14,90,80,0.07), transparent 60%),
                 radial-gradient(640px 380px at 100% 8%, rgba(224,138,60,0.08), transparent 55%),
                 var(--bg); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px;
        box-shadow: var(--shadow-sm); }
.hero { max-width: 460px; text-align: center; padding: 40px 36px; }
.hero h1 { margin: 0 0 8px; letter-spacing: -0.6px; font-size: 30px; color: var(--green-600); }
.tagline { color: var(--muted); margin-top: 0; font-size: 16px; line-height: 1.5; }
.login-form { display: flex; gap: 8px; margin: 22px 0 8px; }
.login-form input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
                    transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.login-form input:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(14,90,80,0.12); outline: none; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.btn { border: 1px solid var(--border-strong); background: var(--panel); color: var(--ink);
       border-radius: 8px; padding: 7px 13px;
       transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.btn:hover { box-shadow: var(--shadow-xs); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--green-700); border-color: var(--green-700); box-shadow: var(--shadow-sm); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:hover { box-shadow: none; transform: none; }
.btn.small-a { font-size: 12px; padding: 3px 9px; }

/* ── top bar: the green band (FRI section-header device) ─────────────────── */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 18px;
          background: var(--green-600); color: #fff; border-bottom: 3px solid var(--green-700);
          position: sticky; top: 0; z-index: 30; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -0.2px; }
.brand .by { font-family: Inter, sans-serif; font-weight: 400; font-size: 11.5px;
             opacity: 0.75; margin-left: 6px; letter-spacing: 0.02em; }
.biz { opacity: 0.9; font-size: 14px; }
.surface-tabs { display: flex; gap: 0; margin-left: auto; border: 1px solid rgba(255,255,255,0.45);
                border-radius: 9px; overflow: hidden; }
.tab { border: none; background: transparent; color: #fff; padding: 6px 18px; font-weight: 600;
       text-decoration: none; display: inline-flex; align-items: center; font-size: 15px;
       transition: background var(--t-fast), color var(--t-fast); }
.tab.active { background: #fff; color: var(--green-600); }
.tab:hover { background: rgba(255,255,255,0.14); }
.tab.active:hover { background: #fff; }
.tab:focus-visible { outline-color: #fff; outline-offset: -2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.topbar .btn.ghost { border-color: rgba(255,255,255,0.45); color: #fff; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,0.12); box-shadow: none; }
.topbar .btn.primary { background: var(--orange-500); border-color: var(--orange-500); color: #2B1A08; }
.topbar .btn.primary:hover { background: #EC9A52; border-color: #EC9A52; }
.topbar .muted, .topbar a.muted { color: rgba(255,255,255,0.75); }

/* ── layout: chat drawer LEFT (1/3) · expanded-pane drawer · content ─────── */
.layout { display: flex; height: calc(100vh - 60px); }
.chat-rail { flex: 0 0 33.333%; min-width: 300px; max-width: 560px; border-right: 1px solid var(--line);
             background: var(--panel); display: flex; flex-direction: column; position: relative; }
.content { flex: 1 1 auto; min-width: 0; display: flex; }
.surface { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 22px 26px 80px; }
.hidden { display: none !important; }

/* the expanded-pane drawer (FILG's rdrawer, overlay form): slides out from behind the chat's
   right edge and COVERS the content partially — the content's layout never moves (no reflow;
   the map viewport doesn't shift either). The chat rail sits above it in z so the drawer
   emerges from under its edge. */
.xdrawer { position: fixed; top: 60px; bottom: 0; left: 33.333%;
           width: min(33.333vw, 480px); min-width: 300px;
           transform: translateX(-103%); opacity: 0; pointer-events: none;
           border-right: 1px solid var(--line); background: var(--bg);
           box-shadow: 10px 0 30px rgba(27,32,36,0.18);
           display: flex; flex-direction: column; padding: 10px 12px; z-index: 24;
           transition: transform 0.45s cubic-bezier(0.22,0.8,0.3,1), opacity 0.3s ease; }
.layout.xopen .xdrawer { transform: none; opacity: 1; pointer-events: auto; }
.chat-rail { z-index: 29; }   /* the drawer slides out from UNDER the chat's edge */

/* ── deck ─────────────────────────────────────────────────────────────────── */
.deck-nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 16px;
            border-bottom: 1px solid var(--border-strong); scrollbar-width: thin; }
.deck-nav button { border: none; border-bottom: 3px solid transparent; background: transparent;
                   border-radius: 0; padding: 8px 14px 9px; font-size: 13.5px; color: var(--muted);
                   white-space: nowrap; flex: 0 0 auto; transition: color var(--t-fast), border-color var(--t-fast); }
.deck-nav button:hover { color: var(--ink); }
.deck-nav button.active { color: var(--green-600); font-weight: 700;
                          border-bottom-color: var(--orange-500); }
.deck-nav { padding-bottom: 1px; }
/* the deck is a column: tabs pinned top, page scrolls, pager anchored at the bottom */
#deck.surface { display: flex; flex-direction: column; padding: 22px 26px 0; overflow: hidden; }
#deck-nav { flex: 0 0 auto; }
#deck-page { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 24px; }
.deck-page { max-width: 760px; }
.deck-pager { flex: 0 0 auto; display: flex; justify-content: space-between; max-width: 760px;
              width: 100%; padding: 10px 0 14px; border-top: 1px solid var(--line);
              background: var(--bg); margin-top: 0; }
.eyebrow { font-family: var(--display); font-size: 10px; font-weight: 700;
           text-transform: uppercase; letter-spacing: 0.18em; color: #A6ABAF; margin-bottom: 2px; }
.deck-page h2 { margin: 2px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--green-600);
                letter-spacing: -0.3px; color: var(--green-600); }
.element { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
           padding: 14px 16px; margin-bottom: 12px; cursor: pointer; position: relative;
           transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.element:hover { border-color: var(--green-600); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.element .etype { font-size: 10px; font-family: var(--display); text-transform: uppercase;
                  letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.element.changed { background: var(--highlight); border-color: var(--highlight-line); }
.dp { display: inline-flex; align-items: center; gap: 6px; margin: 8px 8px 0 0; padding: 4px 10px;
      background: var(--bg); border: 1px solid var(--line); border-radius: 16px; font-size: 13px; }
.dp .basis { font-size: 11px; color: var(--muted); }
.dp.changed { background: var(--highlight); border-color: var(--highlight-line); }
.dp .corrected { font-size: 11px; color: var(--verified); font-weight: 600; }

/* grade badges */
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.badge.verified { background: var(--verified); }
.badge.directional { background: var(--directional); }
.badge.vendor { background: var(--vendor); }

/* cover */
.cover-panel { background: var(--green-600); color: #fff; border-radius: 12px; padding: 34px 30px;
               margin-bottom: 14px; }
.cover-brand { font-family: var(--display); font-size: 13px; font-weight: 700; opacity: 0.9; }
.cover-brand span { font-family: Inter, sans-serif; font-weight: 400; opacity: 0.7; margin-left: 4px; }
.cover-panel h1 { margin: 14px 0 8px; font-size: 30px; letter-spacing: -0.5px; }
.cover-sub { opacity: 0.85; max-width: 480px; }
.element.cover-line { border: none; border-left: 3px solid var(--border-strong); border-radius: 0;
                      padding: 4px 14px; margin-bottom: 6px; }
.element.cover-line .etype { display: none; }

/* the 2x2 matrix */
.matrix-wrap { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: 1fr 22px;
               max-width: 760px; margin-bottom: 14px; }
.matrix-ylab { writing-mode: vertical-rl; transform: rotate(180deg); display: flex;
               align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
               text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.matrix-xlab { grid-column: 2; display: flex; justify-content: space-between; padding-top: 6px;
               font-size: 11px; font-weight: 700; text-transform: uppercase;
               letter-spacing: 0.08em; color: var(--muted); }
.mcell { border: 1.5px solid var(--border-strong); border-radius: 10px; padding: 12px 14px;
         min-height: 150px; background: var(--panel); }
.mcell-title { font-family: var(--display); font-weight: 800; text-transform: uppercase;
               font-size: 12px; letter-spacing: 0.08em; }
.mcell-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 8px; }
.mcell.q-qw { border-color: var(--green-600); background: var(--green-100); }
.mcell.q-qw .mcell-title { color: var(--green-600); }
.mcell.q-mp { border-color: var(--blue-500); }
.mcell.q-mp .mcell-title { color: var(--blue-500); }
.mcell.q-fi .mcell-title { color: var(--muted); }
.mcell.q-ig { border-color: #D8B3AD; }
.mcell.q-ig .mcell-title { color: var(--vendor); }
.mitem { border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
         padding: 7px 10px; margin: 6px 0; font-size: 13.5px; cursor: pointer;
         transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.mitem:hover { border-color: var(--green-600); box-shadow: var(--shadow-xs); }
.mitem.changed { background: var(--highlight); }

/* stat tiles (the FRI financial slide) */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 12px; margin-bottom: 14px; }
.stat-tile { border: 1px solid var(--line); border-top: 4px solid var(--green-600);
             border-radius: 10px; background: var(--panel); padding: 14px 16px; cursor: pointer;
             transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.stat-tile:hover { border-color: var(--green-600); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-tile.changed { background: var(--highlight); border-top-color: var(--highlight-line); }
.stat-label { font-family: var(--display); font-size: 11px; font-weight: 700;
              text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-value { font-family: var(--display); font-size: 34px; font-weight: 800;
              letter-spacing: -1px; margin: 6px 0 2px; color: var(--green-600); }
.stat-unit { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 5px; }
.stat-basis { font-size: 12px; color: var(--verified); font-weight: 600; }
.stat-assumption { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

.element.qwin { border-left: 4px solid var(--green-600); }
.element.qwin .etype { display: none; }

/* the inline implementation roadmap */
.roadmap-toggle { display: block; margin-top: 10px; border: none; background: transparent;
                  color: var(--green-600); font-size: 13px; font-weight: 600; padding: 0; }
.roadmap { margin: 8px 0 2px; padding-left: 0; counter-reset: step; list-style: none; }
.roadmap li { position: relative; padding: 7px 10px 7px 40px; font-size: 13.5px; line-height: 1.5;
              counter-increment: step; }
.roadmap li::before { content: counter(step); position: absolute; left: 6px; top: 7px;
                      width: 22px; height: 22px; border-radius: 50%; background: var(--green-600);
                      color: #fff; font-size: 11.5px; font-weight: 700; display: grid;
                      place-items: center; }
.roadmap li:not(:last-child)::after { content: ""; position: absolute; left: 16.5px; top: 31px;
                                      bottom: -7px; width: 1.5px; background: var(--border-strong); }

/* ── map (spatial graph) ──────────────────────────────────────────────────── */
.map-shell { position: relative; padding: 0 !important; overflow: hidden !important; }
#graph { position: absolute; inset: 0; cursor: grab; touch-action: none;
         background: radial-gradient(circle, #EDE7DB 1.2px, transparent 1.2px);
         background-size: 26px 26px; }
#graph.dragging { cursor: grabbing; }
#gview { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
#gview.ease { transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.3, 1); }
#gedges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
#gedges path { fill: none; stroke: var(--border-strong); stroke-width: 1.6px;
               vector-effect: non-scaling-stroke; }
#gedges path.on { stroke: var(--green-600); stroke-width: 2px; }
#gedges path.new { stroke-dasharray: 1; stroke-dashoffset: 1; animation: gdraw 0.55s ease forwards; }
#gedges path.touch { stroke: var(--orange-500); stroke-width: 1.6px;
                     stroke-dasharray: 6 5; opacity: 0.9; }
@keyframes gdraw { to { stroke-dashoffset: 0; } }

.gnode { position: absolute; width: 212px; background: var(--panel);
         border: 1px solid var(--line); border-top: 3px solid var(--function);
         border-radius: 11px; padding: 9px 12px; cursor: pointer;
         box-shadow: 0 1px 4px rgba(27,32,36,0.07);
         transition: left 0.5s cubic-bezier(0.22,0.8,0.3,1), top 0.5s cubic-bezier(0.22,0.8,0.3,1),
                     opacity 0.4s ease, transform 0.4s ease, box-shadow 0.15s ease; }
.gnode:hover { box-shadow: 0 3px 14px rgba(27,32,36,0.16); }
.gnode.enter { opacity: 0; transform: translateY(-12px); }
.gnode.focus { outline: 2px solid var(--green-600);
               box-shadow: 0 4px 18px rgba(14,90,80,0.3); z-index: 5; }
.gnode.changed { background: var(--highlight); }
.gnode .nk { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
             color: var(--muted); display: flex; gap: 5px; align-items: center; }
.gnode .nk .nsrc { margin-left: auto; background: var(--bg); border: 1px solid var(--line);
                   border-radius: 9px; padding: 0 7px; text-transform: none; letter-spacing: 0; }
.gnode .nt { font-size: 13px; font-weight: 600; margin-top: 3px; overflow: hidden;
             display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* map-this landing pulse */
.gnode.pulse { animation: gpulse 0.85s ease-out 3; }
@keyframes gpulse {
  0% { box-shadow: 0 0 0 0 rgba(224,138,60,0.65); }
  100% { box-shadow: 0 0 0 14px rgba(224,138,60,0); }
}

/* the in-place expanded cell (FILG's open doc, right-sized) */
.gnode.xpand { width: 360px; max-height: 330px; overflow-y: auto; cursor: default; z-index: 6;
               box-shadow: 0 6px 22px rgba(27,32,36,0.18); }
.gnode.xpand .nt { -webkit-line-clamp: unset; font-size: 14.5px; }
.gnode .xclose { margin-left: auto; border: none; background: transparent; color: var(--muted);
                 font-size: 13px; padding: 0 2px; cursor: pointer; }
.gnode .xclose:hover { color: var(--ink); }
.gnode .xsum { font-size: 12.5px; line-height: 1.5; margin-top: 5px; }
.gnode .xcap { font-size: 11px; color: var(--muted); margin-top: 4px; }
.gnode.xpand .research-row { margin: 7px 0 0; font-size: 12px; padding: 7px 9px; }
.gnode .xactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.gnode.k-pain { border-top-color: var(--pain); }
.gnode.k-process { border-top-color: var(--process); }
.gnode.k-system { border-top-color: var(--system); }
.gnode.k-candidate { border-top-color: var(--candidate); }

.gctrls { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; z-index: 8; }
.gctrls .btn { padding: 5px 10px; font-size: 13px; }

#minimap { position: absolute; right: 14px; bottom: 14px; width: 156px; height: 104px;
           background: rgba(255,255,255,0.94); border: 1px solid var(--line);
           border-radius: 8px; z-index: 8; cursor: crosshair; overflow: hidden;
           box-shadow: 0 2px 10px rgba(27,32,36,0.12); }
#minimap i.mmdot { position: absolute; background: #C9C2B4; border-radius: 1.5px; }
#minimap i.mmdot.k-pain { background: var(--pain); }
#minimap i.mmdot.k-process { background: var(--process); }
#minimap i.mmdot.k-system { background: var(--system); }
#minimap i.mmdot.k-candidate { background: var(--candidate); }
#minimap i.mmdot.act { background: var(--green-600); }
#minimap b.mmview { position: absolute; border: 1.5px solid var(--green-600);
                    background: rgba(14,90,80,0.08); border-radius: 3px; pointer-events: none; }

/* chip */
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
        font-size: 12px; padding: 2px 10px; }

/* ── chat drawer (left column) ────────────────────────────────────────────── */
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px;
             padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600;
             flex: 0 0 auto; }
.chat-head #chat-surface { max-width: 55%; overflow: hidden; text-overflow: ellipsis;
                           white-space: nowrap; }
.chat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex;
            flex-direction: column; gap: 10px; transition: flex 0.45s ease, opacity 0.3s ease; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.msg.owner { align-self: flex-end; background: var(--green-600); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.msg .msurface { display: block; font-size: 10.5px; opacity: 0.7; margin-top: 3px; }
.msg .mename { color: var(--green-600); font-size: 12px; }

.promptwrap { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 8px 10px 10px; }
.mode-chips { display: flex; gap: 4px; padding: 0 2px 8px; }
.mchip { border: 1px solid var(--border-strong); background: transparent; border-radius: 14px;
         padding: 3px 12px; font-size: 12.5px; color: var(--muted);
         transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.mchip:hover { border-color: var(--green-600); color: var(--ink); }
.mchip.on { background: var(--green-600); color: #fff; border-color: var(--green-600); }
.mchip.on:hover { color: #fff; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; padding: 8px 12px; border: 1px solid var(--border-strong);
                   border-radius: 8px; background: var(--panel); }

/* the split pane (FILG's rpane): flush in the drawer, dashed divider below */
.cpane { display: none; flex-direction: column; min-height: 0; position: relative;
         border-bottom: 1px dashed var(--border-strong); padding: 0 4px 8px;
         transition: flex 0.45s ease, opacity 0.3s ease; }
.cpane.open { display: flex; flex: 0 0 46%; }
.rpane-head { display: flex; justify-content: space-between; align-items: center;
              padding: 8px 10px 6px; flex: 0 0 auto; }
.eyebrow-t { font-family: var(--display); font-size: 10.5px; font-weight: 700;
             text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.cpane-actions { display: flex; gap: 4px; }
.cpane-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 10px 8px;
              display: flex; flex-direction: column; gap: 6px; }
.vgrip { position: absolute; left: 0; right: 0; bottom: -4px; height: 8px; cursor: ns-resize;
         z-index: 2; }
.vgrip:hover, .vgrip.dragging { background: rgba(14,90,80,0.18); }

.rrow { font-size: 13px; line-height: 1.45; border: 1px solid var(--line); border-radius: 8px;
        padding: 7px 9px; background: var(--panel); border-left-width: 3px; }
.rrow.g-verified { border-left-color: var(--verified); }
.rrow.g-directional { border-left-color: var(--directional); }
.rrow.g-vendor { border-left-color: var(--vendor); }
.rrow a { color: var(--green-600); font-size: 12px; margin-left: 6px; }

.xrow { display: flex; gap: 8px; align-items: baseline; border: 1px solid var(--line);
        border-radius: 8px; padding: 8px 10px; background: var(--panel); font-size: 13.5px;
        cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.xrow:hover { border-color: var(--green-600); }
.xrow.on { border-color: var(--green-600); box-shadow: 0 0 0 1px rgba(14,90,80,0.35); }
.xbuild { display: flex; gap: 6px; margin-top: 4px; }
.xbuild input { flex: 1; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px; }

.hblurb { font-size: 13px; line-height: 1.5; border: 1px solid var(--line); border-radius: 8px;
          padding: 9px 11px; background: var(--panel); }
.hfaq { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
.hfaq summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.hfaq .hfaqa { font-size: 13px; line-height: 1.5; margin-top: 6px; }

/* ── node drawer — beside the chat column ─────────────────────────────────── */
.drawer { position: fixed; top: 60px; left: 33.333%; width: 400px; max-width: 90vw;
          height: calc(100vh - 60px); background: var(--panel); border-right: 1px solid var(--line);
          box-shadow: 6px 0 18px rgba(27,32,36,0.08); z-index: 25; display: flex;
          flex-direction: column; transition: transform 0.35s cubic-bezier(0.22,0.8,0.3,1); }
.drawer.folded { transform: translateX(calc(-100% - 33.333vw)); }
.drawer.folded .drawer-fold-tab { transform: translateX(100%); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
               border-bottom: 1px solid var(--line); }
.drawer-head strong { flex: 1; }
.drawer-body { padding: 14px 16px; overflow-y: auto; }
.research-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
                margin: 8px 0; font-size: 13.5px; }
.research-row a { color: var(--green-600); word-break: break-all; font-size: 12px; }
.drawer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.drow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
        border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
        padding: 10px 14px; cursor: pointer;
        transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.drow:hover { border-color: var(--green-600); background: var(--green-100); box-shadow: var(--shadow-xs); }
.drow-ic { font-size: 17px; flex: 0 0 auto; }
.drow strong { display: block; font-size: 14px; }
.drow .muted.small { display: block; }

/* popover — fixed, anchored to the clicked card (never at the mouse point) */
.popover { position: fixed; z-index: 40; background: var(--panel); border: 1px solid var(--line);
           border-radius: 10px; box-shadow: 0 8px 24px rgba(27,32,36,0.15); padding: 12px;
           width: 340px; }
.popover h4 { margin: 0 0 8px; font-size: 14px; }
.popover .verbs { display: flex; gap: 8px; margin-bottom: 4px; }
.popover label { font-size: 12px; color: var(--muted); display: block; margin-top: 8px; }
.popover input, .popover textarea, .popover select { width: 100%; padding: 7px 10px;
    border: 1px solid var(--border-strong); border-radius: 7px; margin-top: 3px; }
.popover .verdict { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
                    padding: 10px; margin-top: 10px; font-size: 13.5px; }
.popover .verdict .v-label { font-family: var(--display); font-weight: 700;
    text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; color: var(--green-600); }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(27,32,36,0.5); display: grid;
         place-items: center; z-index: 50; }
.modal-card { background: var(--panel); border-radius: 12px; width: 520px; max-width: 94vw;
              max-height: 84vh; overflow-y: auto; padding: 18px 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px;
              margin-top: 14px; }
.tray-list .edit-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
                       margin: 8px 0; font-size: 13.5px; display: flex; gap: 10px;
                       align-items: flex-start; }
.tray-list .edit-row .grow { flex: 1; }
.wall { text-align: center; padding: 10px 6px 4px; }
.wall h3 { margin: 6px 0 8px; color: var(--green-600); }

/* activity feed */
.feed { position: fixed; left: 18px; bottom: 18px; z-index: 45; display: flex;
        flex-direction: column; gap: 6px; }
.feed .line { background: var(--ink); color: #E5E0D7; font: 12.5px/1.4 ui-monospace, monospace;
              border-radius: 8px; padding: 7px 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.28); }

/* ── fold tabs (mobile chrome, the FILG tuck pattern) ─────────────────────── */
.fold-tab { position: absolute; display: none; z-index: 26; border: 1px solid var(--line);
            background: var(--panel); box-shadow: 0 2px 8px rgba(27,32,36,0.14); }
.drawer-fold-tab { top: 10px; right: -34px; width: 34px; height: 44px;
                   border-radius: 0 9px 9px 0; border-left: none; font-size: 17px;
                   transition: transform 0.35s cubic-bezier(0.22,0.8,0.3,1); }
.chat-fold-tab { top: -36px; right: 14px; height: 36px; padding: 0 14px;
                 border-radius: 9px 9px 0 0; border-bottom: none; font-size: 13px; }

/* ── the platform surfaces: onboarding wizard · consultant studio · admin ── */
.wizard .wlabel { display: block; font-size: 12px; font-weight: 700; color: var(--muted);
                  text-transform: uppercase; letter-spacing: 0.05em; margin: 16px 0 5px; }
.wizard input, .wizard textarea { width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong);
                                  border-radius: 8px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.wizard input:focus, .wizard textarea:focus { border-color: var(--green-600); outline: none;
                                               box-shadow: 0 0 0 3px rgba(14,90,80,0.12); }
.wchoices { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 16px; }
.wnews { background: var(--green-100); border: 1px solid var(--green-600); border-radius: 10px;
         padding: 16px 18px; margin-bottom: 16px; line-height: 1.55; box-shadow: var(--shadow-xs); }
.wbig { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--green-600); }
.wnext { margin-top: 8px; }

/* step indicator (onboarding wizard) */
.step-dots { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 26px; }
.step-dots .sd { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong);
                 transition: background var(--t-med), transform var(--t-med); }
.step-dots .sd.active { background: var(--green-600); transform: scale(1.35); }
.step-dots .sd.done { background: var(--green-600); }
.step-dots .sdline { width: 26px; height: 2px; background: var(--border-strong); }
.step-dots .sdline.done { background: var(--green-600); }
.niche-hits { margin: 8px 0; min-height: 30px; }
.niche-picked { margin: 6px 0 10px; }
.chip.picked { background: var(--green-600); color: #fff; border-color: var(--green-600);
               margin: 3px 4px 0 0; display: inline-flex; gap: 6px; }
.chip.picked b { cursor: pointer; font-weight: 700; }
.chip.nhit { cursor: pointer; margin: 2px; transition: border-color var(--t-fast), background var(--t-fast); }
.chip.nhit:hover { border-color: var(--green-600); background: var(--green-100); }

.studio { max-width: 980px; margin: 0 auto; padding: 24px 26px 90px; }
.studio-tabs { display: flex; gap: 0; margin-left: auto; border: 1px solid rgba(255,255,255,0.45);
               border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.stab h2 { color: var(--green-600); border-bottom: 2px solid var(--green-600); padding-bottom: 8px; }
.admin-banner { background: var(--orange-100); border-bottom: 1px solid var(--orange-500);
                padding: 9px 20px; font-size: 13.5px; }
.cx-pre { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 10px;
          border-radius: 8px; border: 1px solid var(--line); }
.cx-ver { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 6px 0;
          border-top: 1px dashed var(--line); }
.cx-ver details { flex-basis: 100%; }
.swatch { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-left: 3px;
          vertical-align: middle; border: 1px solid rgba(0,0,0,0.15); }

/* the plan graph (/w/plan — plan.js) */
.gnode.plan-suggestion { border-style: dashed; border-color: var(--orange-500); }
.gnode.plan-open { opacity: 0.85; }
.plan-wall { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center;
             background: rgba(251,248,242,0.75); backdrop-filter: blur(2px); }

/* client-portal whitelabel: the consultant's monogram chip */
.wl-monogram { display: inline-grid; place-items: center; width: 26px; height: 26px;
               border-radius: 7px; background: #fff; color: var(--green-600);
               font-family: var(--display); font-weight: 800; font-size: 12px; margin-right: 7px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; height: auto; min-height: calc(100vh - 60px); }
  .chat-rail { position: fixed; bottom: 0; left: 0; right: 0; height: 46vh; max-width: none;
               border-top: 1px solid var(--line); border-right: none; z-index: 28;
               transition: transform 0.35s cubic-bezier(0.22,0.8,0.3,1); }
  .chat-rail.folded { transform: translateY(100%); }
  .layout.xopen .xdrawer { position: fixed; inset: 60px 0 46vh 0; min-width: 0; z-index: 27;
                            background: var(--panel); }
  .drawer { left: 0; }
  .drawer.folded { transform: translateX(-100%); }
  .fold-tab { display: block; }
}

/* landing-page sign-in box */
.signin-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
              margin: 18px 0 6px; text-align: left; }
.signin-box .login-form { margin: 6px 0 0; }

/* ── the owner interview panel (op-map surface) ────────────────────────────── */
.iv-count { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.iv-prog { height: 4px; background: var(--line); overflow: hidden; }
.iv-bar { height: 100%; width: 0; background: var(--green-600); transition: width 0.35s ease; }

.iv-qcard { flex: 0 0 auto; padding: 12px 14px 13px; border-bottom: 1px solid var(--line);
            background: var(--panel); }
.iv-qtop { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.iv-qlabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
             color: var(--muted); font-weight: 700; }
.iv-linkbtn { margin-left: auto; border: none; background: transparent; color: var(--muted);
              font-size: 12px; cursor: pointer; padding: 2px 4px; }
.iv-linkbtn:hover { color: var(--green-600); }
.iv-qtext { font-size: 15px; line-height: 1.4; color: var(--ink); font-weight: 600; }
.iv-qactions { display: flex; gap: 8px; margin-top: 10px; }
.iv-qactions.hidden { display: none; }

/* the question rows live in the FILG flyout drawer (#q-drawer .drawer-body) */
.iv-irow { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
           border: none; background: transparent; border-radius: 7px; padding: 8px 10px;
           font-size: 13.5px; color: var(--ink); cursor: pointer; }
.iv-irow:hover { background: var(--panel); }
.iv-irow.cur { background: var(--panel); box-shadow: inset 0 0 0 1px var(--green-600); }
.iv-idot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
           background: var(--border-strong); }
.iv-irow.st-answered .iv-idot { background: var(--green-600); }
.iv-irow.st-skipped .iv-idot, .iv-irow.st-not_relevant .iv-idot { background: var(--muted); }
.iv-ilabel { flex: 1 1 auto; }
.iv-istate { font-size: 11px; color: var(--muted); }
.iv-irow.st-skipped .iv-ilabel, .iv-irow.st-not_relevant .iv-ilabel { color: var(--muted); }

.iv-form { align-items: flex-end; }
.iv-textarea { flex: 1; resize: none; max-height: 140px; overflow-y: auto; padding: 9px 12px;
               border: 1px solid var(--border-strong); border-radius: 8px; font: inherit;
               font-size: 14px; line-height: 1.4; background: var(--panel); color: var(--ink); }
/* the chat answer box starts at 3 lines (min-height keeps auto-grow from collapsing it) */
.iv-form .iv-textarea { min-height: 78px; }
.iv-textarea:focus { outline: none; border-color: var(--green-600); }
.msg.thinking { opacity: 0.6; font-style: italic; }

/* source pills + import overlay (owner map panel) */
.src-bar { position: absolute; top: 10px; left: 12px; right: 104px; z-index: 6; display: flex;
           flex-wrap: wrap; gap: 6px; align-items: center; pointer-events: none; }
.src-bar > * { pointer-events: auto; }
.src-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.src-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
            background: rgba(255,255,255,0.94); border-radius: 14px; padding: 4px 10px;
            font-size: 12px; color: var(--ink); cursor: pointer; }
.src-pill:hover { border-color: var(--green-600); }
.src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); flex: 0 0 auto; }
.src-pill.off { color: var(--muted); text-decoration: line-through; opacity: 0.8; }
.src-pill.off .src-dot { background: var(--border-strong); }
.src-n { background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
         padding: 0 6px; font-size: 10.5px; color: var(--muted); text-decoration: none; }
.modal-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(27,32,36,0.45);
              display: flex; align-items: center; justify-content: center; }
.modal-wrap.hidden { display: none; }

/* full-page intro → collapses into the chat sidebar (the FILG reveal) */
.intro-page { position: fixed; inset: 60px 0 0 0; z-index: 30; background: var(--bg);
              display: flex; align-items: center; justify-content: center;
              transition: transform 0.55s cubic-bezier(0.22,0.8,0.3,1), opacity 0.55s ease;
              transform-origin: left center; }
.intro-page.hidden { display: none; }
.intro-page.away { transform: translateX(-62%) scale(0.32); opacity: 0; pointer-events: none; }
.intro-card { width: min(520px, 92vw); }
.intro-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.intro-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600;
               color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.intro-label .iv-textarea { width: 100%; font-weight: 400; text-transform: none;
                            letter-spacing: normal; }
.intro-go { padding: 12px 16px; font-size: 15px; margin-top: 4px; }

/* snapshot history: read-only viewing banner */
.snap-banner { position: absolute; top: 48px; left: 50%; transform: translateX(-50%); z-index: 8;
               display: flex; gap: 10px; align-items: center; background: var(--ink); color: #fff;
               border-radius: 20px; padding: 7px 14px; font-size: 13px;
               box-shadow: 0 4px 14px rgba(27,32,36,0.25); }
.snap-banner.hidden { display: none; }

/* multi-select + the feedback iteration bar */
.gnode.sel { outline: 2px solid var(--green-600); outline-offset: 2px;
             box-shadow: 0 0 0 4px rgba(27,107,74,0.12); }
.sel-chip { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 7;
            display: flex; gap: 8px; align-items: center; background: var(--panel);
            border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px;
            box-shadow: 0 4px 14px rgba(27,32,36,0.14); font-size: 13px; }
.sel-chip.hidden { display: none; }
.fb-rail { flex: 0 0 320px; min-width: 280px; border-left: 1px solid var(--line);
           background: var(--panel); display: flex; flex-direction: column; }
.fb-rail.hidden { display: none; }
.fb-new { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.fb-new.hidden { display: none; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.fb-list { flex: 1 1 auto; overflow-y: auto; }
.fb-item { border-bottom: 1px solid var(--line); padding: 11px 14px; }
.fb-item .iv-textarea { width: 100%; margin-top: 6px; }
.fb-foot { padding: 12px 14px; border-top: 1px solid var(--line); }

/* the person tagged onto a seat (seats-first, people-second) */
.gnode .nperson { font-size: 11.5px; color: var(--green-600); font-weight: 600; margin-top: 2px; }

/* opportunity/candidate cells (the paid layer) */
.gnode.k-candidate { border-top-color: var(--candidate); }
.opp-tag { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
           background: var(--candidate); color: #fff; border-radius: 9px; padding: 1px 7px; }
.gnode .opp-saves { font-size: 11.5px; color: var(--candidate); font-weight: 700; margin-top: 2px; }
.opp-meta { display: flex; gap: 8px; align-items: center; margin: 4px 0 6px; }
.opp-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
            border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }
.opp-saves-in { font-size: 13px; font-weight: 700; color: var(--candidate); }
.opp-lock { text-align: center; padding: 14px 8px 6px; }
.opp-lock p { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* reconciliation inputs on nodes (owner-only): what other sources said */
.in-flag { margin-left: auto; font-size: 10.5px; color: var(--pain); font-weight: 700; }
.in-row { border: 1px solid var(--line); border-left: 3px solid var(--border-strong);
          border-radius: 6px; padding: 6px 9px; margin-top: 6px; font-size: 12px; line-height: 1.4; }
.in-row.in-dissent { border-left-color: var(--pain); background: rgba(196,64,50,0.05); }
.in-row.in-agree { border-left-color: var(--green-600); }
.in-stance { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
             color: var(--muted); margin: 0 4px; }
