/* Limitless CallFlow — brand tokens from nolimitwebs.com, lifted for legibility on dark. */
:root {
  --void: #080b14; --void-2: #0c1020; --panel: #141a2e; --panel-2: #1a2138; --panel-3: #212a47;
  --hairline: rgba(255,255,255,.13); --hairline-2: rgba(255,255,255,.22);
  --text: #f7f8fc; --muted: #ccd2e2; --muted-2: #98a1b8;
  --accent: #7545e8; --accent-soft: #b39cff; --accent-glow: rgba(117,69,232,.28); --accent-dim: rgba(117,69,232,.16);
  --good: #5fe0a0; --good-dim: rgba(95,224,160,.12); --warn: #ffc44d; --warn-dim: rgba(255,196,77,.12); --bad: #ff6b6b;
  --radius: 18px; --radius-sm: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --card-w: 380px; --gap-x: 64px; --gap-y: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.nav { flex: none; background: rgba(8,11,20,.94); border-bottom: 1px solid var(--hairline); padding-inline: 20px; }
.navIn { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 8px; }
.logo { display: inline-flex; flex-direction: column; line-height: 1; }
.logoWord { font-family: 'Archivo Black', 'Arial Black', sans-serif; font-size: 18px; letter-spacing: .04em; color: var(--text); }
.logoWord b { color: var(--accent-soft); font-weight: 400; }
.logoE { display: inline-block; width: .56em; height: .73em; margin-right: .045em; vertical-align: baseline; background: linear-gradient(to bottom, currentColor 0 20%, transparent 20% 40%, currentColor 40% 60%, transparent 60% 80%, currentColor 80% 100%); }
.logoSub { font-size: 7px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.navMid { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.crumbs { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { color: var(--text); font-weight: 600; letter-spacing: .04em; text-transform: none; font-family: var(--sans); font-size: 14px; }
.crumbs button { background: none; border: 0; padding: 0; color: var(--accent-soft); font: inherit; letter-spacing: inherit; text-transform: inherit; }
.crumbs button:hover { text-decoration: underline; }
.navBtns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--hairline-2); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: rgba(255,255,255,.11); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(117,69,232,.35); }
.btn.primary:hover { background: #8558f0; }
.btn.danger { border-color: rgba(255,107,107,.4); color: #ffb3b3; }
.btn.danger:hover { background: rgba(255,107,107,.1); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 7px 10px; }
.seg { display: inline-flex; border: 1px solid var(--hairline-2); border-radius: 999px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent-dim); color: var(--text); }
.zoomPct { font-family: var(--mono); font-size: 11px; color: var(--muted-2); min-width: 40px; text-align: center; }
.dirty { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--warn); }
.role { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 999px; }
.role.admin { color: var(--good); border-color: rgba(95,224,160,.35); }

/* ---------- Call sheet strip ---------- */
.sheet { flex: none; background: var(--void-2); border-bottom: 1px solid var(--hairline); padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; max-height: 30vh; overflow-y: auto; }
.sheetField { display: grid; gap: 4px; flex: 1 1 130px; min-width: 0; }
.sheetField span { font-size: 11px; color: var(--muted); }
.sheetField:has(input.s) { flex-basis: 74px; }
.sheetField:has(input.l) { flex-basis: 175px; }
.sheet .sheetField input { width: 100%; min-width: 0; }
.sheet .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); white-space: nowrap; margin-right: 6px; }
.sheet input { flex: none; background: var(--panel); border: 1px solid var(--hairline-2); border-radius: 9px; padding: 7px 10px; font-size: 13.5px; width: 130px; }
.sheet input.l { width: 175px; } .sheet input.s { width: 74px; }
.sheet input::placeholder { color: var(--muted-2); }
.sheet input.hot { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ---------- Canvas ---------- */
.stage { flex: 1; display: flex; min-height: 0; position: relative; }
.viewport { flex: 1; min-width: 0; overflow: auto; position: relative; cursor: grab; background: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 1.5px) 0 0 / 28px 28px; }
.viewport.dragging { cursor: grabbing; user-select: none; }
.canvas { position: relative; transform-origin: 0 0; padding: 40px 420px 420px 40px; width: max-content; }
svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wire { fill: none; stroke: var(--accent-soft); stroke-width: 2.5; opacity: .9; }
.wire.obj { stroke: var(--warn); } .wire.soft { stroke: var(--muted-2); }
.hint { position: absolute; left: 20px; bottom: 14px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); pointer-events: none; }

/* ---------- Tree cards ---------- */
.branch { display: flex; align-items: flex-start; gap: var(--gap-x); }
.kids { display: flex; flex-direction: column; gap: var(--gap-y); }
.card { flex: 0 0 var(--card-w); width: var(--card-w); background: var(--panel); border: 1px solid var(--hairline-2); border-radius: var(--radius); padding: 20px; box-shadow: 0 14px 40px rgba(0,0,0,.45); position: relative; overflow-wrap: anywhere; }
.card.live { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-glow), 0 14px 40px rgba(0,0,0,.5); }
.card.end { border-color: rgba(95,224,160,.5); }
.card.end.soft { border-color: var(--hairline-2); }
.card.orphan { border-style: dashed; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.stepLabel { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); }
.card.end .stepLabel { color: var(--good); } .card.end.soft .stepLabel { color: var(--muted); }
.goal { font-size: 12.5px; color: var(--muted-2); text-align: right; }
.editBtn { position: absolute; top: 12px; right: 12px; }
.card.editing .head { padding-right: 60px; }
.say { border-left: 3px solid var(--accent-soft); padding: 2px 0 2px 12px; font-size: 18px; line-height: 1.6; font-weight: 500; text-wrap: pretty; color: var(--text); }
.say + .say { margin-top: 10px; }
.var { color: var(--accent-soft); font-weight: 600; }
.var.empty { color: var(--muted-2); font-weight: 500; border-bottom: 1px dashed var(--muted-2); }
.note { margin-top: 10px; font-size: 13px; color: var(--accent-soft); font-style: italic; line-height: 1.45; padding-left: 15px; }
.note b { font-style: normal; color: var(--text); font-weight: 600; }
.capture { margin-top: 12px; padding: 10px 12px; background: var(--void-2); border: 1px dashed rgba(179,156,255,.5); border-radius: var(--radius-sm); display: grid; gap: 4px; }
.capture label { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-soft); }
.capture input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--hairline-2); padding: 4px 0; font-size: 15px; }
.capture input::placeholder { color: var(--muted-2); }
.capture .calc { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.capture .calc b { color: var(--text); }
.checklist { margin-top: 12px; display: grid; gap: 6px; }
.checklist label { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--muted); cursor: pointer; }
.checklist input { accent-color: var(--accent); }
.checklist input:checked + span { color: var(--text); text-decoration: line-through; text-decoration-color: var(--muted-2); }
.theySay { margin-top: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 6px; }
.opts { display: grid; gap: 6px; }
.opt { display: grid; grid-template-columns: 1fr auto 14px; gap: 10px; align-items: center; text-align: left; width: 100%; background: var(--panel-2); border: 1px solid var(--hairline-2); border-radius: 10px; padding: 8px 10px 8px 12px; font-size: 14px; transition: border-color .15s, background .15s; }
.opt .t::before { content: "“"; color: var(--muted-2); } .opt .t::after { content: "”"; color: var(--muted-2); }
.opt .tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.opt.obj .tag { color: var(--warn); } .opt.win .tag { color: var(--good); }
.opt .arrow { color: var(--muted-2); font-size: 12px; }
.opt:hover { border-color: var(--accent-soft); background: var(--accent-dim); }
.opt.obj:hover { border-color: var(--warn); background: var(--warn-dim); }
.opt.open { border-color: var(--accent-soft); background: var(--accent-dim); }
.opt.obj.open { border-color: var(--warn); background: var(--warn-dim); }
.opt.open .arrow { color: var(--text); }
.opt.broken { border-color: var(--bad); }
.addOpt { margin-top: 8px; width: 100%; border: 1px dashed var(--hairline-2); background: transparent; color: var(--muted); border-radius: 10px; padding: 7px; font-size: 13px; }
.addOpt:hover { border-color: var(--accent-soft); color: var(--text); }

/* ---------- Editor drawer ---------- */
.drawer { flex: none; width: 420px; max-width: 100%; background: var(--void-2); border-left: 1px solid var(--hairline); overflow-y: auto; padding: 18px 20px 60px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .drawer { position: absolute; inset: 0 0 0 auto; z-index: 20; box-shadow: -20px 0 60px rgba(0,0,0,.5); } }
.drawerHead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawerHead h2 { font-size: 15px; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-soft); font-weight: 400; }
.f { display: grid; gap: 5px; }
.f label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); display: flex; justify-content: space-between; }
.f label small { text-transform: none; letter-spacing: 0; font-family: var(--sans); color: var(--muted-2); }
.f input, .f textarea, .f select { width: 100%; background: var(--panel); border: 1px solid var(--hairline-2); border-radius: 10px; padding: 9px 11px; font-size: 14px; }
.f textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.f select { appearance: auto; }
.f input::placeholder, .f textarea::placeholder { color: var(--muted-2); }
.f .row { display: flex; gap: 8px; align-items: center; }
.f .row > * { flex: 1; min-width: 0; }
.f .row .fixed { flex: none; }
.f input[type=checkbox] { width: auto; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.chk input { accent-color: var(--accent); }
.sayList, .optList { display: grid; gap: 8px; }
.sayItem { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: start; }
.sayItem textarea { min-height: 60px; }
.optItem { background: var(--panel); border: 1px solid var(--hairline-2); border-radius: var(--radius-sm); padding: 10px; display: grid; gap: 8px; }
.optItem .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.optItem input, .optItem select { background: var(--void-2); }
.optItem .foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.optItem .foot .grp { display: flex; gap: 4px; }
.sub { font-size: 12.5px; color: var(--muted-2); line-height: 1.45; }
.sub code { font-family: var(--mono); color: var(--accent-soft); font-size: 12px; }
.hr { border-top: 1px solid var(--hairline); }
.drawer details { border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 8px 12px; }
.drawer summary { cursor: pointer; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.drawer details[open] summary { margin-bottom: 10px; }
.nodeList { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.nodeList button { display: grid; grid-template-columns: 1fr auto; gap: 8px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; font-size: 13px; color: var(--muted); }
.nodeList button:hover { background: var(--panel); color: var(--text); }
.nodeList button.on { border-color: var(--accent-soft); color: var(--text); }
.nodeList button small { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }
.nodeList button.orphan small { color: var(--warn); }
.varRow { display: grid; grid-template-columns: 90px 1fr 70px auto; gap: 6px; align-items: center; }
.varRow input, .varRow select { background: var(--void-2); border: 1px solid var(--hairline-2); border-radius: 8px; padding: 6px 8px; font-size: 13px; width: 100%; }

/* ---------- Library ---------- */
.library { flex: 1; overflow: auto; padding: 36px 20px 80px; }
.libIn { width: min(1000px, 100%); margin-inline: auto; }
.libHead { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.kicker { display: block; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-soft); margin-bottom: 10px; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.lede { color: var(--muted); font-size: 16px; max-width: 56ch; margin-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--hairline-2); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.tile:hover { border-color: var(--accent-soft); }
.tile h3 { font-size: 18px; letter-spacing: -.02em; line-height: 1.2; }
.tile p { color: var(--muted); font-size: 14px; flex: 1; }
.tile .meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.tile .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tile.new { border-style: dashed; align-items: center; justify-content: center; text-align: center; color: var(--muted); cursor: pointer; background: transparent; }
.tile.new:hover { color: var(--text); }
.tile.new b { font-size: 28px; color: var(--accent-soft); display: block; }
.grid > .empty { border: 1px dashed var(--hairline-2); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login { flex: 1; display: grid; place-items: center; padding: 20px; }
.loginBox { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--hairline-2); border-radius: var(--radius); padding: 32px 28px; display: grid; gap: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.loginBox h1 { font-size: 26px; }
.loginBox input { width: 100%; background: var(--void-2); border: 1px solid var(--hairline-2); border-radius: 10px; padding: 12px 14px; font-size: 16px; }
.loginBox .errMsg { color: #ffb3b3; font-size: 14px; }

/* ---------- Toast / modal ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-3); border: 1px solid var(--hairline-2); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.bad { border-color: rgba(255,107,107,.5); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modalBox { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--hairline-2); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px; }
.modalBox h2 { font-size: 18px; }
.modalBox .acts { display: flex; justify-content: flex-end; gap: 8px; }
.modalBox input, .modalBox textarea { width: 100%; background: var(--void-2); border: 1px solid var(--hairline-2); border-radius: 10px; padding: 10px 12px; font-size: 15px; }

@media (prefers-reduced-motion: reduce) { .opt, .btn, .toast { transition: none; } }
@media (max-width: 640px) { :root { --card-w: min(320px, calc(100vw - 32px)); --gap-x: 40px; } .canvas { padding: 20px 200px 300px 16px; } .navMid { order: 3; flex-basis: 100%; } .hint { left: 16px; right: 16px; font-size: 9px; letter-spacing: .04em; } }
