:root {
  --bg: #040d0b;
  --bg2: #071612;
  --panel: rgba(9, 24, 20, 0.84);
  --panel-solid: #0a1a16;
  --card: #0c1f1a;
  --card-hi: #11291f;
  --line: rgba(150, 214, 190, 0.12);
  --line2: rgba(150, 214, 190, 0.22);
  --ink: #e9f4ef;
  --ink2: #c2d6cf;
  --muted: #8ba69d;
  --faint: #58736b;
  --accent: #2fd39b;
  --accent-deep: #0c7a5b;
  --people: #f2b65a;
  --apps: #2fd39b;
  --ai: #4cc8e6;
  --services: #c9d46c;
  --data: #8fb3da;
  --external: #ff8c6e;
  --live: #2fd39b;
  --partial: #f2b65a;
  --pending: #b6a0ff;
  --sample: #ff7d7d;
  --notbuilt: #6f8580;
  --i-idea: #b6a0ff;
  --i-planned: #4cc8e6;
  --i-building: #f2b65a;
  --i-parked: #6f8580;
  --danger: #ff7d6e;
  --display: 'Bricolage Grotesque', 'Hanken Grotesk', sans-serif;
  --body: 'Hanken Grotesk', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --chat-w: 410px;
  --top-h: 64px;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(150, 214, 190, .22) transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
::selection { background: rgba(47, 211, 155, 0.3); }

/* ---------------- atmosphere ---------------- */
.atmos {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 8%, rgba(12, 122, 91, 0.32), transparent 70%),
    radial-gradient(50% 45% at 92% 96%, rgba(40, 140, 170, 0.18), transparent 70%),
    radial-gradient(40% 40% at 55% 50%, rgba(18, 60, 50, 0.35), transparent 75%),
    var(--bg);
}
.atmos::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(150, 214, 190, 0.09) 1px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: radial-gradient(80% 80% at 50% 45%, #000 40%, transparent 100%);
}
.atmos::after {
  content: ""; position: absolute; inset: 0; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------------- top bar ---------------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: linear-gradient(180deg, rgba(4, 13, 11, 0.95), rgba(4, 13, 11, 0.6));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand svg { width: 34px; height: 34px; flex: 0 0 auto; filter: drop-shadow(0 0 14px rgba(47, 211, 155, 0.35)); }
.brand .t1 { font: 800 19px/1 var(--display); letter-spacing: -0.02em; white-space: nowrap; }
.brand .t1 em { font-style: normal; color: var(--accent); }
@media (max-width: 1500px) { .brand .t2 { display: none; } }
.brand .t2 { font: 500 9.5px/1 var(--mono); letter-spacing: .18em; color: var(--muted); margin-top: 5px; white-space: nowrap; }
.spacer { flex: 1; }
.search {
  position: relative; width: min(300px, 26vw);
}
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line2); outline: none;
  transition: border-color .2s, background .2s;
}
.search input:focus { border-color: rgba(47, 211, 155, 0.6); background: rgba(47, 211, 155, 0.06); }
.search svg { position: absolute; left: 11px; top: 10px; width: 15px; height: 15px; color: var(--muted); }
.search kbd { position: absolute; right: 9px; top: 9px; font: 500 10px/16px var(--mono); color: var(--faint); border: 1px solid var(--line2); border-radius: 5px; padding: 0 5px; }
.btn {
  height: 36px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line2);
  background: rgba(255, 255, 255, 0.03); display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px; transition: background .2s, border-color .2s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: rgba(47, 211, 155, 0.08); border-color: rgba(47, 211, 155, 0.45); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: linear-gradient(135deg, #10a77a, #0c7a5b); border-color: transparent; color: #fff; box-shadow: 0 6px 20px -8px rgba(47, 211, 155, 0.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }

/* flow menu */
.menu { position: relative; }
.menu-pop {
  position: absolute; top: 44px; right: 0; width: 360px; max-height: 70vh; overflow: auto;
  background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 14px; padding: 8px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8); display: none; z-index: 40;
}
.menu-pop.open { display: block; animation: pop .18s ease-out; }
.menu-pop .mh { font: 600 10px/1 var(--mono); letter-spacing: .16em; color: var(--muted); padding: 10px 10px 8px; }
.flow-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 11px; border-radius: 10px; }
.flow-item:hover, .flow-item:focus-visible { background: rgba(47, 211, 155, 0.08); outline: none; }
.flow-item b { display: block; font-weight: 700; font-size: 13.5px; }
.flow-item span { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.flow-item .pill { margin-left: 6px; vertical-align: 1px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------- stage ---------------- */
.stage { position: fixed; top: var(--top-h); left: 0; bottom: 0; right: var(--chat-w); z-index: 1; transition: right .3s ease; }
body.chat-closed .stage { right: 0; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none; }
.map { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.map.dragging { cursor: grabbing; }

.lane-bg { fill: rgba(255, 255, 255, 0.012); stroke: var(--line); stroke-dasharray: 2 6; }
.lane-title { font: 600 10.5px var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.lane-count { font: 500 10px var(--mono); fill: var(--faint); }

.edge { fill: none; stroke-width: 1.4; opacity: .38; transition: opacity .25s, stroke-width .25s; }
.edge.dashed { stroke-dasharray: 5 5; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: help; }
.edge.on { opacity: .95; stroke-width: 2.2; }
.edge.on.flowing { stroke-dasharray: 7 7; animation: dash 1.1s linear infinite; }
.edge.dim { opacity: .05; }
@keyframes dash { to { stroke-dashoffset: -28; } }

.node { cursor: pointer; outline: none; }
.node .card { fill: var(--card); stroke-width: 1; transition: fill .2s, stroke .2s; }
.node .bar { opacity: .95; }
.node .label { font: 700 13px var(--body); fill: var(--ink); }
.node .sub { font: 500 9.5px var(--mono); letter-spacing: .08em; fill: var(--muted); text-transform: uppercase; }
.node .dot { stroke: rgba(0, 0, 0, .4); stroke-width: 1; }
.node .halo { opacity: 0; transition: opacity .25s; }
.node:hover .card, .node:focus-visible .card { fill: var(--card-hi); }
.node:focus-visible .card { stroke: #fff; }
.node.sel .halo, .node.hl .halo { opacity: 1; }
.node.sel .card { fill: #133328; }
.node.dim { opacity: .18; }
.node.hit-search .card { stroke: #fff; stroke-width: 2; }
.node .badge circle { fill: #fff; }
.node .badge text { font: 800 11px var(--body); fill: #062018; text-anchor: middle; dominant-baseline: central; }
.node .mention { opacity: 0; }
.node.mentioned .mention { opacity: 1; animation: ping 1.6s ease-out 2; }
@keyframes ping { 0% { stroke-opacity: .9; r: 0; } 100% { stroke-opacity: 0; } }

.node-in { animation: nodein .6s ease-out backwards; }
@keyframes nodein { from { opacity: 0; } to { opacity: 1; } }
.reveal { animation: reveal .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.edge.draw { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.6s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.flow-path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-dasharray: 8 7; animation: dash .9s linear infinite; filter: url(#glow); }
.flow-path.past { stroke-width: 1.6; opacity: .45; animation: none; stroke-dasharray: 3 5; }
.particle { fill: #fff; filter: url(#glow); }

/* zoom + legend */
.zoom { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.zoom button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); backdrop-filter: blur(8px); display: grid; place-items: center; }
.zoom button:hover { border-color: rgba(47, 211, 155, .5); }
.zoom svg { width: 15px; height: 15px; }
.legend {
  position: absolute; left: 64px; bottom: 16px; z-index: 5; display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 9px 13px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px);
  font: 500 11px var(--mono); color: var(--muted); max-width: calc(100% - 90px);
}
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 10px currentColor; }
.hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5;
  padding: 8px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; white-space: nowrap; backdrop-filter: blur(8px);
  transition: opacity .4s;
}
.hint b { color: var(--ink); font-weight: 600; }
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 300px; padding: 8px 11px; border-radius: 10px;
  background: #0d211b; border: 1px solid var(--line2); font-size: 12.5px; line-height: 1.4; color: var(--ink2);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .7); opacity: 0; transition: opacity .12s;
}
.tooltip.show { opacity: 1; }
.tooltip b { color: var(--ink); }
.tooltip .mono { font: 500 10px var(--mono); color: var(--muted); letter-spacing: .06em; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.st-live { color: var(--live); } .st-partial { color: var(--partial); } .st-pending { color: var(--pending); } .st-sample { color: var(--sample); } .st-not-built { color: var(--notbuilt); }

/* ---------------- detail drawer ---------------- */
.detail {
  position: fixed; top: calc(var(--top-h) + 12px); left: 12px; bottom: 12px; width: 380px; z-index: 20;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; backdrop-filter: blur(16px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9); display: flex; flex-direction: column;
  transform: translateX(-110%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.detail.open { transform: none; }
.detail .dh { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); position: relative; }
.detail .grp { font: 600 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.detail h2 { font: 800 24px/1.1 var(--display); letter-spacing: -0.02em; margin: 8px 0 10px; }
.detail .close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); background: transparent; display: grid; place-items: center; }
.detail .close svg { width: 14px; height: 14px; }
.detail .db { overflow: auto; padding: 16px 18px 18px; flex: 1; }
.detail .sum { color: var(--ink2); font-size: 14px; margin: 0 0 12px; }
.detail .note { font-size: 12.5px; color: var(--muted); border-left: 2px solid currentColor; padding: 2px 0 2px 10px; margin: 0 0 14px; }
.detail h3 { font: 600 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.detail ul.dl { margin: 0; padding-left: 17px; color: var(--ink2); font-size: 13px; }
.detail ul.dl li { margin-bottom: 6px; }
.conn { display: flex; flex-direction: column; gap: 6px; }
.conn button {
  text-align: left; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 11px; padding: 9px 11px;
  display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: start; transition: border-color .2s, background .2s;
}
.conn button:hover { border-color: rgba(47, 211, 155, .45); background: rgba(47, 211, 155, .05); }
.conn .arr { font: 600 13px var(--mono); color: var(--muted); grid-row: span 2; }
.conn b { font-size: 13px; }
.conn span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); border-radius: 999px; padding: 6px 11px; font-size: 12.5px; transition: border-color .2s, background .2s; text-align: left; }
.chip:hover { border-color: rgba(47, 211, 155, .5); background: rgba(47, 211, 155, .07); }
.detail .ask { margin-top: 18px; width: 100%; justify-content: center; }

/* ---------------- flow bar ---------------- */
.flowbar {
  position: fixed; left: 50%; bottom: 18px; z-index: 25; width: min(720px, calc(100vw - var(--chat-w) - 40px));
  transform: translate(calc(-50% - var(--chat-w) / 2), 140%); transition: transform .4s cubic-bezier(.2, .8, .2, 1);
  background: linear-gradient(180deg, rgba(14, 38, 31, .96), rgba(8, 22, 18, .96)); border: 1px solid rgba(47, 211, 155, .35);
  border-radius: 18px; padding: 14px 16px 14px 18px; box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .9), 0 0 0 1px rgba(47, 211, 155, .06) inset;
}
body.chat-closed .flowbar { width: min(720px, calc(100vw - 40px)); transform: translate(-50%, 140%); }
.flowbar.open { transform: translate(calc(-50% - var(--chat-w) / 2), 0); }
body.chat-closed .flowbar.open { transform: translate(-50%, 0); }
.flowbar .fb-top { display: flex; align-items: center; gap: 10px; }
.flowbar .fb-t { font: 800 15px var(--display); letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flowbar .fb-n { font: 600 11px var(--mono); color: var(--accent); letter-spacing: .1em; }
.flowbar .fb-x { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line2); background: transparent; display: grid; place-items: center; }
.flowbar .fb-x svg { width: 13px; height: 13px; }
.flowbar .fb-step { margin: 8px 0 10px; font-size: 14.5px; color: var(--ink); min-height: 42px; }
.flowbar .fb-step b { color: var(--accent); font-weight: 700; }
.flowbar .fb-note { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.flowbar .fb-ctl { display: flex; align-items: center; gap: 8px; }
.flowbar .dots { display: flex; gap: 5px; flex: 1; }
.flowbar .dots i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); transition: background .3s; }
.flowbar .dots i.done { background: rgba(47, 211, 155, .45); }
.flowbar .dots i.cur { background: var(--accent); box-shadow: 0 0 10px rgba(47, 211, 155, .7); }

/* ---------------- chat ---------------- */
.chat {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: var(--chat-w); z-index: 15;
  background: linear-gradient(180deg, rgba(8, 22, 18, .94), rgba(5, 15, 12, .97)); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transition: transform .3s ease; backdrop-filter: blur(12px);
}
body.chat-closed .chat { transform: translateX(100%); }
.chat .ch { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.chat .ch h2 { font: 800 18px var(--display); letter-spacing: -.01em; margin: 0; display: flex; align-items: center; gap: 9px; }
.chat .ch h2 .live { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(47, 211, 155, .15), 0 0 12px var(--accent); }
.chat .ch p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.chat .focus { margin-top: 10px; display: none; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); background: rgba(47, 211, 155, .06); border: 1px solid rgba(47, 211, 155, .25); border-radius: 10px; padding: 6px 8px 6px 10px; }
.chat .focus.on { display: flex; }
.chat .focus b { flex: 1; font-weight: 600; }
.chat .focus button { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.msgs { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.welcome { color: var(--ink2); font-size: 13.5px; }
.welcome .chips { margin-top: 12px; flex-direction: column; align-items: stretch; }
.msg { max-width: 100%; animation: reveal .35s ease both; }
.msg.user { align-self: flex-end; max-width: 88%; background: linear-gradient(135deg, #12644d, #0c4b3a); border: 1px solid rgba(47, 211, 155, .3); padding: 9px 13px; border-radius: 14px 14px 4px 14px; font-size: 13.5px; white-space: pre-wrap; }
.msg.bot { font-size: 13.6px; color: var(--ink2); line-height: 1.6; }
.msg.bot .who { font: 600 10px var(--mono); letter-spacing: .16em; color: var(--accent); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.msg.bot p { margin: 0 0 9px; }
.msg.bot ul, .msg.bot ol { margin: 0 0 9px; padding-left: 19px; }
.msg.bot li { margin-bottom: 4px; }
.msg.bot strong { color: var(--ink); }
.msg.bot code { font: 500 12px var(--mono); background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 5px; }
.msg.bot .err { color: #ff9d8a; }
.nref { display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(47, 211, 155, .45); background: rgba(47, 211, 155, .08); color: var(--ink); border-radius: 7px; padding: 0 6px 0 5px; font-size: 12.5px; line-height: 20px; vertical-align: 1px; transition: background .15s; }
.nref::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 6px var(--c, var(--accent)); }
.nref:hover { background: rgba(47, 211, 155, .2); }
.sources { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.sources .lbl { font: 600 9.5px var(--mono); letter-spacing: .14em; color: var(--faint); width: 100%; margin-bottom: 2px; }
.src { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 7px; padding: 3px 7px; background: transparent; text-align: left; }
.src:hover { color: var(--ink); border-color: var(--line2); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.composer { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.composer .box { display: flex; gap: 8px; align-items: flex-end; background: rgba(255, 255, 255, .035); border: 1px solid var(--line2); border-radius: 14px; padding: 8px 8px 8px 12px; transition: border-color .2s; }
.composer .box:focus-within { border-color: rgba(47, 211, 155, .55); }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: transparent; max-height: 140px; min-height: 22px; line-height: 1.45; padding: 3px 0; }
.composer .send { width: 36px; height: 36px; border-radius: 10px; border: 0; background: linear-gradient(135deg, #10a77a, #0c7a5b); display: grid; place-items: center; flex: 0 0 auto; }
.composer .send:disabled { opacity: .4; cursor: default; }
.composer .send svg { width: 16px; height: 16px; color: #fff; }
.composer .meta { display: flex; justify-content: space-between; margin-top: 7px; font-size: 11px; color: var(--faint); }
.composer .meta button { border: 0; background: transparent; color: var(--faint); font-size: 11px; padding: 0; }
.composer .meta button:hover { color: var(--ink2); }

/* ---------------- gate ---------------- */
body.gate { display: grid; place-items: center; min-height: 100%; overflow: auto; padding: 24px 16px;
  background: radial-gradient(70% 60% at 20% 10%, rgba(12, 122, 91, .35), transparent 70%), radial-gradient(60% 50% at 90% 100%, rgba(40, 140, 170, .18), transparent 70%), var(--bg); }
.gate-glow { position: fixed; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(150, 214, 190, .08) 1px, transparent 1.2px); background-size: 26px 26px; mask-image: radial-gradient(60% 60% at 50% 50%, #000, transparent); }
.gate-card { position: relative; width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; padding: 30px 28px 26px; backdrop-filter: blur(14px); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9); animation: reveal .6s ease both; }
.gate-card .mark svg { width: 48px; height: 48px; filter: drop-shadow(0 0 18px rgba(47, 211, 155, .4)); }
.gate-card .eyebrow { font: 600 10px var(--mono); letter-spacing: .2em; color: var(--accent); margin: 18px 0 6px; }
.gate-card h1 { font: 800 30px/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 10px; }
.gate-card p { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.gate-card input + label { margin-top: 14px; }
.gate-card label { display: block; font: 600 10px var(--mono); letter-spacing: .16em; color: var(--muted); text-transform: uppercase; margin-bottom: 7px; }
.gate-card input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); padding: 0 14px; outline: none; font-size: 15px; }
.gate-card input:focus { border-color: rgba(47, 211, 155, .6); }
.gate-card button { margin-top: 14px; width: 100%; height: 44px; border-radius: 12px; border: 0; color: #fff; font-weight: 700; font-size: 14.5px; background: linear-gradient(135deg, #10a77a, #0c7a5b); box-shadow: 0 10px 30px -10px rgba(47, 211, 155, .7); }
.gate-card button:disabled { opacity: .6; }
.gate-error { min-height: 20px; margin-top: 10px; color: #ff9d8a; font-size: 13px; }

/* ---------------- small screens ---------------- */
@media (max-width: 900px) {
  :root { --chat-w: 0px; --top-h: 56px; }
  .brand .t2, .search kbd, .btn .lbl { display: none; }
  .search { width: auto; flex: 1; }
  .top { gap: 8px; padding: 0 10px; }
  .chat { width: 100%; top: auto; height: 78vh; border-left: 0; border-top: 1px solid var(--line2); border-radius: 18px 18px 0 0; }
  body.chat-closed .chat { transform: translateY(100%); }
  body:not(.chat-closed) .stage { right: 0; }
  .detail { left: 8px; right: 8px; width: auto; top: auto; height: 62vh; bottom: 8px; transform: translateY(110%); }
  .detail.open { transform: none; }
  .flowbar, body.chat-closed .flowbar { width: calc(100vw - 20px); transform: translate(-50%, 140%); }
  .flowbar.open, body.chat-closed .flowbar.open { transform: translate(-50%, 0); }
  .legend { display: none; }
  .hint { display: none; }
  .menu-pop { right: -60px; width: min(360px, calc(100vw - 20px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* chat header + quick questions (v4) */
.chat .ch-row { display: flex; align-items: center; gap: 10px; }
.chat .ch-row h2 { flex: 1; }
.btn.newchat { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn.newchat svg { width: 13px; height: 13px; }
.suggest { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 2px; border-top: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: rgba(150, 214, 190, .22) transparent; }
.suggest.hidden { display: none; }
.suggest .chip { white-space: nowrap; font-size: 12px; padding: 5px 10px; flex: 0 0 auto; }
.msg.bot .err { color: #ff9d8a; }
.chip.retry { margin-top: 4px; }

/* map-pin reference after a system's name (v5) */
.nref { gap: 0; padding: 0; width: 18px; height: 18px; justify-content: center; border-radius: 6px; margin: 0 2px 0 3px; vertical-align: -3px; color: var(--c, var(--accent)); border-color: color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
.nref::before { display: none; }
.nref svg { width: 11px; height: 11px; }
.nref:hover { background: color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); }

/* =====================================================================
   AVA Hub (v10): tabs, brainstorm board, knowledge base, FAQ
   ===================================================================== */
.gate-note { font-size: 12px !important; margin: 16px 0 0 !important; color: var(--faint) !important; }
.tabs { display: flex; gap: 2px; padding: 3px; margin-left: 18px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; transition: background .2s, color .2s; white-space: nowrap; }
.tabs button svg { width: 15px; height: 15px; }
.tabs button:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.tabs button[aria-selected=true] { color: var(--ink); background: linear-gradient(135deg, rgba(16, 167, 122, .35), rgba(12, 122, 91, .25)); box-shadow: 0 0 0 1px rgba(47, 211, 155, .35) inset; }
.tabs .count { font: 600 10px/16px var(--mono); font-style: normal; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--i-idea); color: #1a1230; text-align: center; }
.tabs .count:empty { display: none; }

body:not([data-view=live]):not([data-view=brainstorm]) .map-only { display: none !important; }
body:not([data-view=live]) .live-only { display: none !important; }
body:not(.admin) .admin-only { display: none !important; }
.menu-pop .loading { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }

.who-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: 99px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); }
.who-btn:hover { border-color: rgba(47, 211, 155, .45); }
.who-btn .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--body); background: linear-gradient(135deg, #10a77a, #0c4b3a); color: #fff; }
.who-btn .who-name { font-weight: 600; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-btn .role { font: 600 9px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line2); border-radius: 99px; padding: 3px 6px; }
body.admin .who-btn .role { color: #ffd36e; border-color: rgba(255, 211, 110, .5); }
.who-pop { width: 380px; }
.activity { max-height: 50vh; overflow: auto; padding: 0 4px; }
.act { font-size: 12.5px; color: var(--ink2); padding: 7px 8px; border-bottom: 1px solid var(--line); line-height: 1.4; }
.act b { color: var(--ink); }
.act .d { color: var(--muted); }
.act .t { display: block; font: 500 10px var(--mono); color: var(--faint); margin-top: 2px; }
.signout { margin: 8px 4px 4px; width: calc(100% - 8px); justify-content: center; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.hist-row:hover { background: rgba(255, 255, 255, .03); }
.hist-row > div { flex: 1; min-width: 0; }
.hist-row b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row span { font: 500 10.5px var(--mono); color: var(--muted); }
.hist-row .cur { color: var(--accent); }
#hist-menu { width: 400px; }

.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn.danger { background: linear-gradient(135deg, #c8483a, #8e2d24); border-color: transparent; color: #fff; }
.btn.danger:hover { filter: brightness(1.1); }
.danger-text { color: var(--danger) !important; }
.btn:disabled { opacity: .5; cursor: default; }
.link { border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(150, 214, 190, .3); }
.link:hover { color: var(--ink); }
.muted { color: var(--muted); font-size: 12.5px; }
.small { font-size: 12px; }
.legend .ver { font-size: 10px; color: var(--faint); }
.legend .star { width: 10px; height: 10px; color: #ffd36e; margin-right: 6px; vertical-align: -1px; }
.legend i.dash { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed var(--i-idea); box-shadow: none; background: none !important; vertical-align: 3px; }

/* map: proposed and added systems */
.node.proposed .card { fill: #0b1814; stroke-dasharray: 5 4; stroke-width: 1.5; }
.node .tint { opacity: .09; pointer-events: none; }
.node.draft .card { stroke-width: 2; animation: draftpulse 1.8s ease-in-out infinite; }
@keyframes draftpulse { 50% { stroke-opacity: .35; } }
.node .newtag path { filter: drop-shadow(0 0 4px currentColor); }
.node.from-idea .newtag path { fill: #ffd36e; }
.edge.proposed { stroke-dasharray: 6 5; stroke-width: 1.6; opacity: .8; }
.edge.proposed.draft { animation: dash 1.4s linear infinite; opacity: .95; }
.edge.proposed.dim { opacity: .08; }
.edge.fade-in { animation: nodein .6s ease-out; }
.view-brainstorm .node:not(.proposed):not(.hl):not(.sel) .card { fill: #0a1915; }
.view-brainstorm .node:not(.proposed):not(.hl):not(.sel) .label { fill: #b9cdc6; }

/* stage chrome placement per view */
:root { --bs-w: 350px; }
body[data-view=brainstorm] .zoom { left: calc(var(--bs-w) + 28px); }
.bs-legend { left: calc(var(--bs-w) + 76px) !important; }

/* brainstorm panel */
.bs-panel {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: var(--bs-w); z-index: 10;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; backdrop-filter: blur(16px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9); display: flex; flex-direction: column; overflow: hidden;
}
.bp-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.bp-head > div:first-child, .bp-head .grow { flex: 1; min-width: 0; }
.bp-head h2 { font: 800 20px/1.15 var(--display); letter-spacing: -.02em; margin: 5px 0 0; }
.bp-head h2.title { cursor: text; }
.bp-head h2.title:hover { text-decoration: underline dotted rgba(150, 214, 190, .4); text-underline-offset: 4px; }
.eyebrow { font: 600 10px var(--mono); letter-spacing: .18em; color: var(--accent); text-transform: uppercase; }
.bp-head .back { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--line2); background: transparent; display: grid; place-items: center; margin-top: 2px; }
.bp-head .back svg { width: 14px; height: 14px; }
.bp-toggle { display: none; }
.bp-body { flex: 1; overflow: auto; padding: 12px 16px 18px; }
.bp-body h3 { font: 600 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.bp-body .sum { color: var(--ink2); font-size: 13.5px; margin: 10px 0 4px; }
.bp-body .note { font-size: 12.5px; color: var(--muted); border-left: 2px solid currentColor; padding: 2px 0 2px 10px; margin: 8px 0; }
.bp-body ul.dl { margin: 0; padding-left: 17px; color: var(--ink2); font-size: 13px; }
.bp-body ul.dl li { margin-bottom: 5px; }
.bp-body .meta { margin-top: 16px; font: 500 10.5px var(--mono); color: var(--faint); }
.seg { display: flex; gap: 2px; padding: 3px; margin: 10px 16px 0; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.bp-body .seg { margin: 4px 0 0; }
.seg button { flex: 1; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: rgba(47, 211, 155, .14); color: var(--ink); box-shadow: 0 0 0 1px rgba(47, 211, 155, .35) inset; }
.seg.status button[aria-pressed=true] { background: color-mix(in srgb, var(--sc) 18%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--sc) 60%, transparent) inset; color: var(--sc); }
.grp-h { display: flex; align-items: center; gap: 8px; margin: 14px 2px 7px; font: 600 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.grp-h:first-child { margin-top: 2px; }
.grp-h i { font-style: normal; color: var(--faint); }
.idea-card { display: block; width: 100%; text-align: left; margin-bottom: 7px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); border-left: 3px solid var(--c); background: rgba(255, 255, 255, .02); transition: border-color .2s, background .2s, transform .15s; }
.idea-card:hover { background: rgba(255, 255, 255, .045); border-color: var(--line2); border-left-color: var(--c); transform: translateX(2px); }
.idea-card .ic-top { display: flex; align-items: center; gap: 8px; }
.idea-card .ic-top b { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-card .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: 0 0 auto; }
.idea-card .ic-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; margin: 5px 0 8px; }
.idea-card .ic-meta { display: flex; align-items: center; gap: 9px; font: 500 10.5px var(--mono); color: var(--faint); }
.idea-card .ic-meta .bar { flex: 1; }
.bar { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #10a77a, var(--accent)); transition: width .4s ease; }
.bar.big { height: 6px; margin-bottom: 8px; }
.empty { text-align: center; padding: 28px 14px; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 6px; }
.empty p { margin: 0 0 14px; line-height: 1.5; }
.chk-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 8px; }
.chk-head h3 { margin: 0 !important; }
.chk-head span { font: 600 11px var(--mono); color: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: flex-start; gap: 4px; padding: 5px 4px 5px 2px; border-radius: 8px; }
.checklist li:hover { background: rgba(255, 255, 255, .03); }
.checklist label { flex: 1; display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-size: 13px; color: var(--ink2); line-height: 1.4; }
.checklist input { appearance: none; flex: 0 0 auto; width: 17px; height: 17px; margin: 1px 0 0; border-radius: 5px; border: 1.5px solid var(--line2); background: rgba(255, 255, 255, .03); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s; }
.checklist input:checked { background: var(--accent); border-color: var(--accent); }
.checklist input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #04201a; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.checklist input:focus-visible { outline: 2px solid rgba(47, 211, 155, .6); outline-offset: 2px; }
.checklist li.done span { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(150, 214, 190, .35); }
.checklist .x { border: 0; background: transparent; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 4px; opacity: 0; transition: opacity .15s; }
.checklist li:hover .x, .checklist .x:focus-visible { opacity: 1; }
.checklist .x:hover { color: var(--danger); }
.add-task { display: flex; gap: 6px; margin-top: 6px; }
.add-task input { flex: 1; height: 30px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); padding: 0 10px; outline: none; font-size: 12.5px; }
.add-task input:focus { border-color: rgba(47, 211, 155, .55); }
.ready { margin-top: 10px; font-size: 12.5px; color: var(--accent); background: rgba(47, 211, 155, .08); border: 1px solid rgba(47, 211, 155, .3); border-radius: 10px; padding: 8px 10px; }
.live-note, .draft-note { margin: 4px 0 8px; font-size: 12.5px; color: var(--ink2); border-radius: 10px; padding: 9px 11px; line-height: 1.45; }
.live-note { background: rgba(47, 211, 155, .08); border: 1px solid rgba(47, 211, 155, .3); }
.live-note b { color: var(--accent); }
.draft-note { background: rgba(255, 255, 255, .05); border: 1px dashed rgba(255, 255, 255, .45); }
.draft-note .btn { margin-top: 7px; }
.idea-chip { border-color: color-mix(in srgb, var(--c) 55%, transparent) !important; }
.idea-chip::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
.d-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; align-items: center; }
.d-btns.admin { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.golive { background: linear-gradient(135deg, #f2b65a, #c98a2a) !important; color: #2a1a03 !important; box-shadow: 0 6px 20px -8px rgba(242, 182, 90, .8) !important; }
.detail .d-btns .btn.primary { flex: 1; justify-content: center; }
.origin { display: flex; gap: 9px; align-items: flex-start; width: 100%; text-align: left; margin: 4px 0 8px; padding: 9px 11px; border-radius: 10px; border: 1px solid rgba(255, 211, 110, .35); background: rgba(255, 211, 110, .07); font-size: 12.5px; color: var(--ink2); }
.origin svg { width: 12px; height: 12px; color: #ffd36e; flex: 0 0 auto; margin-top: 3px; }
.origin b { color: var(--ink); }
.origin:hover { background: rgba(255, 211, 110, .12); }

/* brainstorm chat */
.chat-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-pane[hidden] { display: none; }
.chat .ch h2 .live.bulb { background: var(--i-idea); box-shadow: 0 0 0 4px rgba(182, 160, 255, .15), 0 0 12px var(--i-idea); }
.chat-pane.bs .msg.user { background: linear-gradient(135deg, #3a2f66, #2a2250); border-color: rgba(182, 160, 255, .35); }
.chat-pane.bs .msg.bot .who { color: var(--i-idea); }
#bs-focus { background: rgba(182, 160, 255, .07); border-color: rgba(182, 160, 255, .3); }
.msg.bot p.h { font-weight: 700; color: var(--ink); margin-top: 4px; }
.drawing { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; }
.proposal { margin-top: 10px; border-radius: 14px; padding: 12px 13px; border: 1px dashed rgba(255, 255, 255, .45); background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02)); }
.proposal .p-h { font: 600 9.5px var(--mono); letter-spacing: .16em; color: var(--muted); margin-bottom: 5px; }
.proposal b { font-size: 14px; color: var(--ink); }
.proposal p { margin: 4px 0 6px; font-size: 12.5px; color: var(--ink2); }
.proposal .p-stats { font: 500 10.5px var(--mono); color: var(--muted); }
.proposal .p-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.proposal .saved { font: 600 10px var(--mono); letter-spacing: .1em; color: var(--accent); text-transform: uppercase; }
.extra:empty { display: none; }
.ans-act { margin-top: 7px; }
.src.file::before, .src.faq::before { font: 600 8.5px var(--mono); letter-spacing: .08em; margin-right: 5px; padding: 1px 4px; border-radius: 4px; }
.src.file::before { content: "FILE"; color: #4cc8e6; border: 1px solid rgba(76, 200, 230, .45); }
.src.faq::before { content: "FAQ"; color: #ffd36e; border: 1px solid rgba(255, 211, 110, .45); }

/* knowledge + faq pages */
.view-page { overflow: auto; }
.page { max-width: 980px; margin: 0 auto; padding: 30px 28px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.page-head > div { flex: 1; }
.page-head h1 { font: 800 34px/1.05 var(--display); letter-spacing: -.03em; margin: 8px 0 10px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; max-width: 680px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.stat b { display: block; font: 800 26px/1 var(--display); letter-spacing: -.02em; }
.stat b.sm { font: 600 14px/1.3 var(--mono); color: var(--accent); }
.stat span { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.stat.wide { grid-column: 1 / -1; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 20px; border-radius: 18px; border: 1.5px dashed rgba(47, 211, 155, .4); background: rgba(47, 211, 155, .04); cursor: pointer; text-align: center; transition: background .2s, border-color .2s, transform .2s; }
.drop:hover, .drop.over { background: rgba(47, 211, 155, .09); border-color: var(--accent); }
.drop.over { transform: scale(1.01); }
.drop svg { width: 30px; height: 30px; color: var(--accent); }
.drop b { font-size: 15px; }
.drop > span { font-size: 12.5px; color: var(--muted); }
.drop-row { display: flex; gap: 14px; align-items: flex-start; margin: 12px 0 26px; }
.drop-row .field { width: 260px; flex: 0 0 auto; }
.uploads { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.up { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); font-size: 12.5px; }
.up b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up .um { color: var(--muted); font-size: 12px; }
.up .bar { grid-column: 1 / -1; }
.up.good .um { color: var(--accent); }
.up.bad { border-color: rgba(255, 125, 110, .4); }
.up.bad .um { color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font: 600 10px var(--mono); letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.field input, .field textarea, .field select { width: 100%; border-radius: 10px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); padding: 9px 11px; outline: none; font-size: 13.5px; line-height: 1.45; resize: vertical; }
.field select { height: 38px; background-color: #0c1f1a; }
.field input { height: 38px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(47, 211, 155, .6); }
.list-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.list-head h2 { flex: 1; font: 800 18px var(--display); margin: 0; }
.mini-search { position: relative; width: 240px; }
.mini-search svg { position: absolute; left: 10px; top: 9px; width: 14px; height: 14px; color: var(--muted); }
.mini-search input { width: 100%; height: 32px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); padding: 0 10px 0 30px; outline: none; font-size: 12.5px; }
.files { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); }
.file-row { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: rgba(255, 255, 255, .02); }
.file-row .ext { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 600 10px var(--mono); color: var(--accent); background: rgba(47, 211, 155, .08); border: 1px solid rgba(47, 211, 155, .25); }
.fname { min-width: 0; }
.fname a { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname a:hover { text-decoration: underline; }
.fname > span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.fname .folder { font-style: normal; font: 600 9.5px var(--mono); letter-spacing: .06em; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--line2); margin-right: 6px; }
.fname .ferr { color: var(--danger); }
.fstat { display: inline-flex; align-items: center; gap: 6px; font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 8px; border-radius: 99px; border: 1px solid currentColor; }
.fstat.s-ready { color: var(--live); }
.fstat.s-failed { color: var(--danger); }
.fstat.s-queued, .fstat.s-reading, .fstat.s-embedding { color: var(--partial); }
.spin { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fact { display: flex; gap: 6px; }
.faqs { display: flex; flex-direction: column; gap: 10px; }
.faq { padding: 15px 17px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); transition: box-shadow .3s, border-color .3s; }
.faq.flash { border-color: #ffd36e; box-shadow: 0 0 0 3px rgba(255, 211, 110, .2); }
.faq h3 { font: 700 15px/1.35 var(--body); margin: 0 0 8px; color: var(--ink); }
.faq .fa { color: var(--ink2); font-size: 13.5px; line-height: 1.6; }
.faq .fa p { margin: 0 0 8px; }
.faq .fa ul, .faq .fa ol { margin: 0 0 8px; padding-left: 19px; }
.fmeta { display: flex; align-items: center; gap: 14px; margin-top: 8px; font: 500 10.5px var(--mono); color: var(--faint); }
.fmeta span { flex: 1; }

/* dialog + toast */
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line2); border-radius: 18px; background: var(--panel-solid); color: var(--ink); box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .95); }
.modal::backdrop { background: rgba(2, 8, 7, .7); backdrop-filter: blur(3px); }
.modal form { padding: 22px 22px 18px; }
.modal h2 { font: 800 21px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 8px; }
.modal .intro { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.modal .warn { margin: 10px 0 0; color: var(--partial); }
.m-err { min-height: 18px; color: var(--danger); font-size: 13px; }
.m-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 80; transform: translate(-50%, 160%); display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100vw - 24px)); padding: 11px 14px 11px 16px; border-radius: 14px; background: #0f2a22; border: 1px solid rgba(47, 211, 155, .4); box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .9); font-size: 13.5px; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.toast:not(.show) { visibility: hidden; transition: transform .35s, visibility 0s .35s; }
.toast.show { transform: translate(-50%, 0); }
.toast button { border: 0; border-radius: 8px; padding: 6px 10px; background: var(--accent); color: #04201a; font-weight: 700; font-size: 12.5px; }

.flowbar:not(.open) { visibility: hidden; transition: transform .4s, visibility 0s .4s; }
@media (max-width: 1440px) { .search { width: min(220px, 18vw); } }
@media (max-width: 1180px) {
  .tabs button span { display: none; }
  .tabs button { padding: 0 10px; }
  .search { width: min(220px, 20vw); }
  .who-btn .who-name { display: none; }
}
@media (max-width: 900px) {
  :root { --bs-w: 0px; }
  .brand > div { display: none; }
  .brand { flex: 0 0 auto; }
  .top .menu .btn .lbl { display: none; }
  * { scrollbar-width: none; }
  .tabs { margin-left: 4px; }
  .who-btn .role { display: none; }
  .search { display: none; }
  .bs-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 58vh; transition: height .3s ease; }
  .bs-panel.collapsed { height: 64px; }
  .bp-toggle { display: block; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; border: 1px solid var(--line2); background: transparent; position: relative; }
  .bp-toggle::before { content: ""; position: absolute; left: 10px; top: 9px; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .bs-panel.collapsed .bp-toggle::before { transform: rotate(-135deg); top: 12px; }
  body[data-view=brainstorm] .zoom { left: 16px; bottom: auto; top: 16px; }
  .bs-legend { display: none; }
  .page { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h1 { font-size: 27px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .drop-row { flex-direction: column; }
  .drop-row .field { width: 100%; }
  .uploads { width: 100%; }
  .file-row { grid-template-columns: 36px 1fr; }
  .file-row .ext { width: 34px; height: 34px; }
  .file-row .fstat, .file-row .fact { grid-column: 2; justify-self: start; }
  .mini-search { width: 150px; }
  .who-pop, #hist-menu { width: min(380px, calc(100vw - 20px)); right: -10px; }
}

/* PDF brief buttons (v13) */
a.btn { text-decoration: none; color: inherit; }
.bp-head .btn.pdf { margin-top: 2px; }
.btn.pdf svg { width: 13px; height: 13px; }

/* done-when checks (v14) */
.checklist .when, .dl .when { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
button.btn.pdf[disabled] { opacity: .6; cursor: progress; }

/* add-task with a done-when check (v15) */
.add-task { flex-wrap: wrap; }
.add-task input[name=t] { flex: 1 1 100%; }
.add-task input[name=w] { flex: 1; font-size: 12px; }

/* Delivery from Jira (v16) */
.page.wide { max-width: 1120px; }
.tabs .count.late { background: var(--danger); color: #2a0d08; }
.dl-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sync-note { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font: 600 11px var(--mono); color: var(--ink2); margin-right: 4px; }
.sync-note span { font-weight: 500; color: var(--faint); }
.sync-note .spin { display: inline-block; margin-right: 6px; vertical-align: -1px; color: var(--accent); }
.dl-warn { padding: 10px 14px; margin-bottom: 14px; border-radius: 12px; border: 1px solid rgba(255, 125, 110, .4); background: rgba(255, 125, 110, .08); color: var(--ink2); font-size: 13px; }
.dl-warn b { color: var(--danger); }
.dl-empty { text-align: center; padding: 34px 18px; border: 1px dashed var(--line2); border-radius: 16px; color: var(--muted); font-size: 13.5px; }
.dl-empty b { display: block; color: var(--ink); font-size: 15px; margin: 6px 0; }
.dl-empty p { margin: 0 auto; max-width: 520px; line-height: 1.5; }
.dl-empty .spin { display: inline-block; color: var(--accent); }
.dl-empty.sm { padding: 16px; font-size: 12.5px; }
.stat.late b { color: var(--danger); }
.dl-sec { margin: 26px 0 0; }
.dl-sec .list-head .muted { font: 500 11px var(--mono); }
.seg.mini { margin: 0; flex: 0 0 auto; }
.seg.mini button { flex: 0 0 auto; padding: 0 10px; font-size: 11.5px; height: 26px; }
.seg-bar { display: flex; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: 10px 0 12px; }
.seg-bar i { display: block; height: 100%; }
.seg-bar i.done { background: linear-gradient(90deg, #10a77a, var(--accent)); }
.seg-bar i.doing { background: var(--i-building); opacity: .85; }
.seg-bar.sm { height: 5px; margin: 0; flex: 1; min-width: 60px; }

.sprint { padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 12px; }
.sp-head { display: flex; align-items: flex-start; gap: 16px; }
.sp-head > div:first-child { flex: 1; min-width: 0; }
.sp-head b { display: block; font: 800 20px/1.2 var(--display); letter-spacing: -.01em; }
.sp-head span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.sp-head em { font-style: normal; color: var(--ink2); font-weight: 600; }
.sp-head em.soon { color: var(--partial); }
.sp-head em.late { color: var(--danger); }
.sp-num { text-align: right; flex: 0 0 auto; }
.sp-num b { font: 800 26px/1 var(--display); }
.sp-num b i { font-style: normal; color: var(--faint); font-size: 18px; }
.sp-num span { font: 500 11px var(--mono); color: var(--muted); }
.goal { margin: 10px 0 0; font-size: 13px; color: var(--ink2); }
.goal b { font: 600 9.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.col h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.col h4 i { font-style: normal; color: var(--faint); }
.col.c-indeterminate h4 { color: var(--i-building); }
.col.c-done h4 { color: var(--live); }
.col .none, .ds-body .none { margin: 4px 0; font-size: 12px; color: var(--faint); }
.iss { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--ink2); text-decoration: none; font-size: 12.5px; transition: border-color .15s, background .15s; }
.iss:hover { border-color: var(--line2); background: rgba(255, 255, 255, .05); color: var(--ink); }
.iss .k, .dl-row .k, .epic .k, .jr .k { font: 600 10.5px var(--mono); color: var(--muted); flex: 0 0 auto; }
.iss .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iss.c-done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(150, 214, 190, .35); }
.iss .pt { font: 600 10px var(--mono); color: var(--faint); border: 1px solid var(--line2); border-radius: 6px; padding: 0 4px; }
.iss .av { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font: 700 9px var(--body); background: rgba(76, 200, 230, .16); color: #bfefff; }
.iss .av[data-none] { background: transparent; border: 1px dashed var(--line2); color: var(--faint); }
.link.more { display: block; margin: 4px 0 0 2px; }

.dl-list { margin-top: 2px; }
.dl-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 190px; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dl-row:last-child { border-bottom: 0; }
.dl-row .when b { display: block; font-size: 13.5px; }
.dl-row .when span { font: 500 10.5px var(--mono); color: var(--muted); }
.dl-row.soon .when span { color: var(--partial); }
.dl-row.late { background: rgba(255, 125, 110, .05); }
.dl-row.late .when b, .dl-row.late .when span { color: var(--danger); }
.dl-row .what { min-width: 0; }
.dl-row .what a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.dl-row .what a:hover { text-decoration: underline; }
.dl-row .what .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind { font: 600 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; margin-right: 7px; vertical-align: 1px; }
.kind.rel { color: var(--ai); border-color: rgba(76, 200, 230, .45); }
.dl-row .state { justify-self: end; }
.rel-state { display: flex; align-items: center; gap: 8px; width: 190px; font: 500 10.5px var(--mono); color: var(--muted); white-space: nowrap; }
.jstat { font: 600 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; color: var(--muted); }
.jstat.c-indeterminate { color: var(--i-building); }
.jstat.c-done { color: var(--live); }
.jstat.c-new { color: var(--i-planned); }
.jstat.c-missing { color: var(--danger); }

.epics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.epic { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.ep-top { display: flex; align-items: flex-start; gap: 10px; }
.ep-top a { flex: 1; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.ep-top a:hover { text-decoration: underline; }
.ep-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; font: 500 10.5px var(--mono); color: var(--muted); flex-wrap: wrap; }
.ep-meta .late { color: var(--danger); }
.ep-ideas { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.ep-ideas .chip { font-size: 11.5px; padding: 4px 9px; }
.dl-more { margin-top: 10px; }
.dl-more summary, .done-sprint summary { cursor: pointer; list-style: none; }
.dl-more summary::-webkit-details-marker, .done-sprint summary::-webkit-details-marker { display: none; }
.dl-more > summary { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.dl-more > summary::before, .done-sprint > summary::before { content: "\25B8"; display: inline-block; width: 14px; color: var(--faint); transition: transform .2s; }
.dl-more[open] > summary::before, .done-sprint[open] > summary::before { transform: rotate(90deg); }

.done-sprint { border-bottom: 1px solid var(--line); }
.done-sprint:last-child { border-bottom: 0; }
.done-sprint > summary { display: grid; grid-template-columns: 14px minmax(0, 1fr) minmax(80px, 220px) auto; gap: 12px; align-items: center; padding: 11px 14px; }
.done-sprint > summary:hover { background: rgba(255, 255, 255, .02); }
.ds-name b { display: block; font-size: 13.5px; }
.ds-name span { font-size: 11.5px; color: var(--muted); }
.ds-bar { display: flex; height: 8px; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, .05); }
.ds-bar i.done { background: var(--accent); }
.ds-bar i.carry { background: rgba(242, 182, 90, .7); }
.ds-num { display: flex; gap: 10px; font: 500 11px var(--mono); color: var(--muted); white-space: nowrap; }
.ds-num .ok { color: var(--live); }
.ds-num .carry { color: var(--partial); }
.ds-body { padding: 2px 14px 14px 40px; }
.ds-body h4 { margin: 12px 0 6px; font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-row { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mini-row:last-child { border-bottom: 0; }
.mini-row b { display: block; font-size: 13px; }
.mini-row b i { font: 500 10px var(--mono); font-style: normal; color: var(--faint); margin-left: 4px; }
.mini-row span { font-size: 11.5px; color: var(--muted); }

.connect { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; padding: 22px; border-radius: 18px; border: 1px solid var(--line2); background: var(--panel); }
.cn-text h2 { font: 800 24px var(--display); margin: 8px 0 8px; }
.cn-text p { color: var(--ink2); font-size: 13.5px; margin: 0 0 12px; }
.cn-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.cn-steps li { margin-bottom: 6px; }
.cn-steps a { color: var(--accent); }
.cn-form .m-err { color: var(--danger); font-size: 12.5px; margin-bottom: 8px; }
.m-side { margin: 4px 0 0; }

/* an idea's Jira block */
.btn.jira-add { margin: 0 0 12px; }
.btn.jira-add svg, .jira-link svg { width: 13px; height: 13px; }
.jira-link { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(76, 200, 230, .3); background: rgba(76, 200, 230, .05); }
.jira-link.warn { border-color: rgba(255, 125, 110, .4); background: rgba(255, 125, 110, .06); }
.jl-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.jl-top svg { color: var(--ai); flex: 0 0 auto; }
.jl-top .jk { font: 700 12px var(--mono); color: var(--ink); text-decoration: none; }
.jl-top .jk:hover { text-decoration: underline; }
.jl-top .link { margin-left: auto; }
.jl-sum { font-size: 13px; color: var(--ink2); margin: 5px 0 8px; }
.jl-meta { font: 500 10.5px var(--mono); color: var(--muted); margin-top: 5px; }
.jchip { font: 600 9.5px var(--mono); padding: 1px 6px; border-radius: 99px; border: 1px solid currentColor; color: var(--i-planned); }
.jchip.c-indeterminate { color: var(--i-building); }
.jchip.c-done { color: var(--live); }
.jchip.c-missing { color: var(--danger); }
.jira-results { display: flex; flex-direction: column; gap: 5px; max-height: 300px; overflow: auto; margin: -2px 0 6px; }
.jr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); font-size: 12.5px; color: var(--ink2); }
.jr:hover { border-color: var(--line2); }
.jr.on { border-color: rgba(47, 211, 155, .6); background: rgba(47, 211, 155, .08); color: var(--ink); }
.jr .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-note { margin: 0 0 2px; font: 600 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.src.jira::before { content: "JIRA"; font: 600 8.5px var(--mono); letter-spacing: .08em; margin-right: 5px; padding: 1px 4px; border-radius: 4px; color: #4cc8e6; border: 1px solid rgba(76, 200, 230, .45); }

@media (max-width: 900px) {
  .dl-actions { justify-content: flex-start; }
  .sync-note { align-items: flex-start; width: 100%; }
  .cols, .epics, .dl-two, .connect { grid-template-columns: minmax(0, 1fr); }
  .dl-row { grid-template-columns: 82px minmax(0, 1fr); }
  .dl-row .state { grid-column: 2; justify-self: start; }
  .rel-state { width: 170px; }
  .done-sprint > summary { grid-template-columns: 14px minmax(0, 1fr); }
  .ds-bar, .ds-num { grid-column: 2; }
  .ds-body { padding-left: 16px; }
  .sp-head { flex-direction: column; gap: 8px; }
  .sp-num { text-align: left; }
}

/* five tabs on a phone (v16) */
@media (max-width: 480px) {
  .top { gap: 6px; }
  .tabs { margin-left: 2px; }
  .tabs button { padding: 0 7px; gap: 4px; }
  .tabs .count { min-width: 15px; padding: 0 4px; }
}
