/* Signed-in surfaces: auth, onboarding, dashboard. Requires site.css first. */

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { color: var(--haze); font-size: 14px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--night); color: var(--moon); font-size: 16px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input::placeholder { color: #6c6f76; }
.input:focus { outline: none; border-color: var(--lamp); box-shadow: 0 0 0 3px rgba(74, 159, 245, .25); }
.form-error { background: rgba(255, 122, 107, .12); border: 1px solid rgba(255, 122, 107, .45); color: #ffc2ba; padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 15px; }
.form-ok { background: rgba(70, 201, 139, .12); border: 1px solid rgba(70, 201, 139, .4); color: #b7f0d3; padding: 14px 16px; border-radius: var(--r-md); font-size: 15px; }
.btn-block { width: 100%; }
.text-link { color: var(--lamp); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
.text-link:hover { text-decoration: underline; }

/* ---------- Auth pages ---------- */
.auth { position: relative; overflow: hidden; min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.auth::before { content: ""; position: absolute; width: 900px; aspect-ratio: 1; top: -560px; left: 50%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(74, 159, 245, .16), transparent); pointer-events: none; }
.auth > * { position: relative; }
.auth-top { padding: 22px 0; }
.auth-main { display: grid; place-items: center; padding: 24px 20px 56px; }
.auth-card { position: relative; width: min(440px, 100%); }
.auth-card h1 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(32px, 6vw, 42px); line-height: 1.04; letter-spacing: -0.015em; margin: 0 0 10px; }
.auth-card .sub { color: var(--soft); margin: 0 0 28px; }
.auth-card .switch { margin-top: 22px; color: var(--haze); text-align: center; }
.auth-foot { padding: 20px 0 28px; color: var(--haze); font-size: 14px; text-align: center; }
.auth-foot a { color: var(--haze); }

/* ---------- Onboarding ---------- */
.onb-progress { display: flex; gap: 6px; margin-bottom: 28px; }
.onb-progress span { flex: 1; height: 5px; border-radius: 99px; background: var(--line); transition: background-color .2s ease; }
.onb-progress span.on { background: var(--speed); }
.onb-step { display: none; }
.onb-step.active { display: block; }
.onb-step legend { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(28px, 5.2vw, 38px); line-height: 1.06; letter-spacing: -0.015em; margin: 0 0 10px; padding: 0; }
.onb-step fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.onb-step .sub { color: var(--soft); margin: 0 0 24px; }
.choices { display: grid; gap: 10px; margin-bottom: 24px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice > span { display: grid; grid-template-columns: 18px 1fr; column-gap: 12px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); font-weight: 600; cursor: pointer; }
.choice > span::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--haze); grid-row: 1 / span 2; }
.choice small { grid-column: 2; display: block; font-weight: 400; color: var(--haze); font-size: 14px; }
.choice input:checked + span { border-color: var(--lamp); background: rgba(74, 159, 245, .08); }
.choice input:checked + span::before { border-color: var(--lamp); background: radial-gradient(circle, var(--lamp) 45%, transparent 50%); }
.choice input:focus-visible + span { outline: 3px solid var(--lamp); outline-offset: 2px; }
.onb-nav { display: flex; gap: 12px; align-items: center; }
.onb-nav .btn-lamp { flex: 1; }

/* ---------- Dashboard shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 16px; border-right: 1px solid var(--line); background: #080a0e; }
.side .logo { padding: 4px 8px 22px; }
.side .biz { padding: 0 10px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.side .biz strong { display: block; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.side .biz small { color: var(--haze); font-size: 13px; }
.tab { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--haze); font-weight: 600; font-size: 16px; }
.tab svg { width: 20px; height: 20px; flex: none; }
.tab:hover { color: var(--moon); background: var(--panel); }
.tab[aria-current="page"] { color: var(--moon); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--cyan); }
.tab[aria-current="page"] svg { color: var(--lamp); }
.side .spacer { flex: 1; }
.side .signout { background: none; border: 0; text-align: left; cursor: pointer; width: 100%; }

.main { min-width: 0; padding: 28px clamp(18px, 4vw, 48px) 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-head h1 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(28px, 4vw, 40px); line-height: 1.05; letter-spacing: -0.015em; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--haze); }
.page-head .btn { min-height: 44px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 18px; }
.panel h2 { font-size: 19px; margin: 0 0 4px; }
.panel .panel-sub { color: var(--haze); font-size: 15px; margin: 0 0 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.panel-head a, .panel-head button { font-size: 15px; }

.figures-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.stat b { display: block; font-size: clamp(26px, 3vw, 34px); line-height: 1.1; font-weight: 800; }
.stat small { color: var(--haze); font-size: 14px; }
.stat.owed b { color: var(--owed); }
.stat.paid b { color: var(--paid); }
.stat.zero b { color: var(--moon); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); }
.checklist .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--haze); flex: none; display: grid; place-items: center; }
.checklist li.done .tick { background: var(--paid); border-color: var(--paid); color: var(--night); }
.checklist li.done .label { color: var(--haze); text-decoration: line-through; }
.checklist .label { flex: 1; font-weight: 600; }
.checklist .btn { min-height: 38px; padding: 0 16px; font-size: 14px; }

/* Rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 14px 2px; border-top: 1px solid var(--line); }
.rows > .row:first-child { border-top: 0; }
.row .title { font-weight: 700; overflow-wrap: anywhere; }
.row .meta { color: var(--haze); font-size: 14px; overflow-wrap: anywhere; }
.row .meta a { color: var(--haze); }
.row .right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.amt.in { color: var(--paid); }
.amt.out { color: var(--owed); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn { background: none; border: 0; color: var(--haze); cursor: pointer; padding: 6px; border-radius: var(--r-sm); line-height: 0; }
.icon-btn:hover { color: var(--owed); background: rgba(255, 122, 107, .1); }
.icon-btn svg { width: 18px; height: 18px; }

.empty { text-align: center; padding: 28px 12px; color: var(--haze); }
.empty strong { display: block; color: var(--moon); font-size: 17px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters button { border: 1px solid var(--line); background: transparent; color: var(--haze); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--moon); color: var(--night); border-color: var(--moon); }

/* Dialog */
dialog.sheet { width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--moon); padding: 0; }
dialog.sheet::backdrop { background: rgba(6, 6, 8, .72); }
.sheet form { padding: 24px; }
.sheet h2 { font-size: 22px; margin: 0 0 18px; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--night); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 16px; }
.seg label { position: relative; text-align: center; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 10px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--haze); }
.seg input:checked + span { background: var(--moon); color: var(--night); }
.seg input:focus-visible + span { outline: 3px solid var(--lamp); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--moon); color: var(--night); padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 60; transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--owed); }

.notice { border: 1px solid rgba(74, 159, 245, .45); background: rgba(74, 159, 245, .08); color: var(--soft); padding: 14px 16px; border-radius: var(--r-md); margin-bottom: 18px; font-size: 15px; }
.loading { color: var(--haze); padding: 40px 0; }

/* Mobile: sidebar becomes a top bar + bottom tabs */
.mobile-top { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 30; gap: 0; }
  .side .logo, .side .biz, .side .spacer, .side .signout { display: none; }
  .tab { flex-direction: column; gap: 3px; font-size: 12px; padding: 8px 6px; flex: 1; text-align: center; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
  .mobile-top .biz-name { font-weight: 700; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding-bottom: 110px; }
  .grid-2 { grid-template-columns: 1fr; }
  .figures-row { gap: 8px; }
  .stat { padding: 14px; }
  .stat b { font-size: 22px; }
  .stat small { font-size: 12px; }
  .page-head .btn { width: 100%; }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; }
  .row .right { justify-content: flex-start; }
  .row .right .icons { margin-left: auto; }
}
@media (max-width: 420px) {
  .sheet .two { grid-template-columns: 1fr; }
}

/* Onboarding: welcome + review */
.onb-title { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(30px, 5.6vw, 42px); line-height: 1.04; letter-spacing: -0.015em; margin: 0 0 12px; }
.onb-list { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 10px; }
.onb-list li { display: flex; align-items: center; gap: 10px; color: var(--soft); }
.onb-list li::before { content: "\2713"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(74, 159, 245, .14); color: var(--lamp); font-size: 13px; font-weight: 800; }
.review { margin: 18px 0 20px; border: 1px solid var(--line); border-radius: var(--r-md); }
.review > div { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: baseline; padding: 13px 16px; }
.review > div + div { border-top: 1px solid var(--line); }
.review dt { color: var(--haze); font-size: 14px; }
.review dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.review .text-link { font-size: 14px; }
.ai-note { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; margin-bottom: 24px; }
.ai-note strong { display: block; margin-bottom: 4px; }
.ai-note p { margin: 0; color: var(--haze); font-size: 15px; }
@media (max-width: 420px) { .review > div { grid-template-columns: 1fr auto; } .review dt { grid-column: 1 / -1; } }

/* Dashboard: first-action banner, settings, skeleton */
.first-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(74, 159, 245, .45); background: linear-gradient(180deg, rgba(74, 159, 245, .10), rgba(74, 159, 245, .03)); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 18px; }
.first-action h2 { margin: 0 0 4px; font-size: 19px; }
.first-action p { margin: 0; color: var(--soft); }
.first-action .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-grid { display: grid; gap: 18px; max-width: 760px; }
.settings-grid .panel { margin: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--haze); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.skeleton { display: grid; gap: 14px; }
.skeleton div { height: 92px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton .short { height: 44px; width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }
.icon-btn.edit:hover { color: var(--lamp); background: rgba(74, 159, 245, .1); }

/* Checkout */
.plan-card { border-radius: var(--r-xl); box-shadow: var(--glow); background: var(--panel); padding: 28px; margin-bottom: 18px; }
.plan-card .plan { color: var(--cyan); font-weight: 700; margin: 0 0 6px; }
.plan-card .amount { font-family: var(--display); font-style: italic; font-weight: 900; font-size: 64px; line-height: 1; letter-spacing: -0.04em; }
.plan-card .amount small { font-family: var(--text); font-style: normal; font-size: 18px; font-weight: 600; color: var(--haze); letter-spacing: 0; }
.plan-card .then { color: var(--soft); margin: 8px 0 18px; }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plan-card li { display: flex; gap: 10px; color: var(--soft); font-size: 15px; }
.plan-card li::before { content: "\2713"; color: var(--cyan); font-weight: 800; }
.secure { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--haze); font-size: 13px; margin-top: 14px; }
@media (max-width: 860px) { .tab[aria-current="page"] { box-shadow: inset 0 2px 0 var(--cyan); } }

/* ===== Workspace (master-context structure) ===== */
.app-main { min-width: 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.head-actions .btn { min-height: 44px; }
.state-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat em { display: block; font-style: normal; font-size: 11px; font-weight: 700; color: var(--haze); margin-top: 6px; text-transform: none; }
.pill-lead { background: rgba(110, 233, 251, .12); color: var(--cyan); }
.pill-quoted { background: rgba(255, 196, 92, .14); color: #ffc45c; }
.niko-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--speed); box-shadow: 0 0 14px var(--blue); flex: none; display: inline-block; }
.niko-dot.big { width: 44px; height: 44px; box-shadow: 0 0 40px -4px var(--blue); }

/* Ask bar */
.ask { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 16px; background: var(--panel); box-shadow: var(--glow); margin-bottom: 18px; }
.ask input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--moon); font-size: 16px; padding: 10px 0; }
.ask input::placeholder { color: var(--haze); }
.ask input:focus { outline: none; }
.ask .btn { min-height: 42px; }
.ask .btn svg { width: 18px; height: 18px; }

/* Notice card (operator application) */
.notice-card { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 20px 22px; background: var(--panel); margin-bottom: 18px; }
.notice-card h2 { margin: 0 0 4px; font-size: 18px; }
.notice-card p { margin: 0; color: var(--soft); font-size: 15px; }

/* Attention + approvals */
.attention { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.attention li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); }
.attention li span:nth-child(2) { flex: 1; }
.dot-sm { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-sm.owed { background: var(--owed); } .dot-sm.warn { background: #ffc45c; } .dot-sm.info { background: var(--cyan); }
.approvals { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.approvals h3 { margin: 0 0 4px; font-size: 15px; }
.approvals p { margin: 0; color: var(--haze); font-size: 14px; }

/* NIKO */
.niko { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.niko-status { display: flex; flex-wrap: wrap; gap: 8px; }
.thread { display: flex; flex-direction: column; gap: 14px; min-height: 280px; max-height: 58vh; overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
.niko-intro { margin: auto; text-align: center; max-width: 44ch; display: grid; justify-items: center; gap: 10px; padding: 24px 0; }
.niko-intro h2 { margin: 6px 0 0; font-size: 20px; }
.niko-intro p { margin: 0; color: var(--haze); }
.msg.me { align-self: flex-end; max-width: 80%; background: var(--line-strong); padding: 10px 14px; border-radius: 14px 14px 4px 14px; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; display: flex; gap: 12px; max-width: 92%; }
.msg.bot > .niko-dot { margin-top: 12px; }
.msg.bot > div { background: rgba(74, 159, 245, .08); border: 1px solid rgba(74, 159, 245, .28); padding: 12px 16px; border-radius: 14px 14px 14px 4px; color: var(--soft); }
.msg.bot p { margin: 0 0 8px; }
.msg.bot ul, .msg.bot ol { margin: 0 0 8px; padding-left: 20px; }
.msg.bot li { margin: 3px 0; }
.msg.bot b { color: var(--moon); }
.msg.bot .note { color: var(--haze); font-size: 14px; }
.msg.bot .src { margin: 6px 0 0; color: var(--haze); font-size: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--panel); color: var(--soft); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: rgba(74, 166, 245, .6); color: var(--moon); }

/* Connections */
.conn { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.conn li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); background: var(--panel-2); }
.conn b { display: block; }
.conn span:not(.pill) { color: var(--haze); font-size: 14px; }
.icon-link { color: var(--haze); line-height: 0; padding: 6px; border-radius: 8px; }
.icon-link svg { width: 22px; height: 22px; }

@media (max-width: 1200px) { .state-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
  .tab-settings { display: none; }
  .state-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .thread { max-height: 52vh; padding: 16px; }
  .notice-card { flex-direction: column; }
}

.icons { display: inline-flex; gap: 2px; }

/* ===== Browser tab ===== */
.badge-n { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--speed); color: var(--lamp-ink); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: rgba(255, 196, 92, .16); color: #ffc45c; font-size: 12px; font-weight: 800; vertical-align: middle; }
.b-admin { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.b-admin label { color: var(--haze); font-weight: 600; font-size: 14px; }
.b-admin .input { width: auto; min-height: 40px; padding: 6px 12px; }
.browser { border-radius: var(--r-xl); background: var(--panel); box-shadow: var(--glow); overflow: hidden; }
.browser.is-live { box-shadow: 0 0 0 1px rgba(61, 220, 151, .55), 0 0 50px -10px rgba(61, 220, 151, .35); }
.b-tabs { display: flex; gap: 4px; padding: 10px 10px 0; background: #07090d; overflow-x: auto; scrollbar-width: none; }
.b-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 9px 14px; border-radius: 10px 10px 0 0; border: 0; background: transparent; color: var(--haze); font-size: 13px; font-weight: 600; cursor: pointer; flex: none; }
.b-tab.on { background: var(--panel); color: var(--moon); }
.b-tab:hover:not(.on) { background: rgba(255, 255, 255, .04); }
.b-tab-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-owner { font-size: 11px; color: var(--cyan); background: rgba(110, 233, 251, .1); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.b-fav { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--haze); }
.b-fav.live { background: var(--paid); box-shadow: 0 0 8px var(--paid); }
.b-fav.wait { background: #ffc45c; } .b-fav.err { background: var(--owed); } .b-fav.off { background: #3a4357; }
.b-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.b-nav { display: flex; gap: 2px; color: #4b566b; }
.b-nav i { font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; font-size: 18px; }
.b-url { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #07090d; border: 1px solid var(--line); color: var(--soft); font-size: 14px; }
.b-url svg { width: 14px; height: 14px; flex: none; color: var(--haze); }
.b-url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--haze); }
.b-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.b-status.live { color: var(--paid); } .b-status.live .b-dot { animation: pulse 1.6s ease-in-out infinite; }
.b-status.wait { color: #ffc45c; } .b-status.err { color: var(--owed); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); } 50% { box-shadow: 0 0 0 6px rgba(61, 220, 151, 0); } }
.b-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 520px; }
.b-view { position: relative; background: #0a0d12; display: grid; place-items: center; overflow: hidden; }
.b-shot { width: 100%; height: 100%; object-fit: contain; object-position: top center; background: #fff; }
.b-live { position: absolute; left: 14px; bottom: 14px; padding: 6px 12px; border-radius: 999px; background: rgba(5, 7, 10, .82); backdrop-filter: blur(6px); font-size: 12px; font-weight: 700; color: var(--soft); border: 1px solid var(--line-strong); }
.b-live.live { color: var(--paid); }
.b-empty { text-align: center; max-width: 520px; padding: 40px 24px; }
.b-empty h2 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: 26px; letter-spacing: -0.02em; margin: 18px 0 8px; }
.b-empty p { color: var(--haze); margin: 0 0 22px; }
.b-empty-mark { width: 64px; height: 64px; margin: 0 auto; opacity: .9; filter: drop-shadow(0 0 22px rgba(74, 159, 245, .5)); }
.b-will { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.b-will li { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); }
.b-will b { font-size: 15px; } .b-will span { color: var(--haze); font-size: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--cyan); display: inline-block; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.b-side { border-left: 1px solid var(--line); padding: 18px; overflow-y: auto; max-height: 640px; background: var(--panel); }
.b-side h3 { font-size: 14px; margin: 18px 0 10px; color: var(--soft); }
.b-side h3:first-child { margin-top: 0; }
.b-task { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); margin-bottom: 4px; }
.b-task span { color: var(--haze); font-size: 12px; } .b-task b { font-size: 15px; }
.b-none { color: var(--haze); font-size: 14px; margin: 0; }
.b-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.b-feed li { display: flex; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.b-feed li:last-child { border-bottom: 0; }
.b-feed svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--haze); }
.b-feed li.ev-navigate svg { color: var(--cyan); } .b-feed li.ev-approval_request svg { color: #ffc45c; } .b-feed li.ev-error svg { color: var(--owed); }
.b-feed li.st-approved svg { color: var(--paid); }
.b-feed p { margin: 0; font-size: 14px; color: var(--soft); }
.b-feed span { font-size: 12px; color: var(--haze); }
.b-feed li:first-child { animation: feedIn .4s ease both; }
@keyframes feedIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.approvals-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.approval { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-md); border: 1px solid rgba(255, 196, 92, .4); background: rgba(255, 196, 92, .06); }
.approval > div:first-child { display: grid; gap: 2px; }
.approval b { font-size: 14px; color: var(--moon); }
.approval span { font-size: 12px; color: var(--haze); }
.approval-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* View transitions */
.main.enter > * { animation: viewIn .32s cubic-bezier(.2, .8, .2, 1) both; }
.main.enter > *:nth-child(2) { animation-delay: .04s; } .main.enter > *:nth-child(3) { animation-delay: .08s; } .main.enter > *:nth-child(4) { animation-delay: .12s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) { .b-body { grid-template-columns: 1fr; } .b-side { border-left: 0; border-top: 1px solid var(--line); max-height: none; } .b-view { min-height: 300px; } }
@media (max-width: 860px) { .b-nav { display: none; } .b-body { min-height: 0; } .b-view { aspect-ratio: 16 / 10; min-height: 0; } .b-status { font-size: 12px; } .badge-n { position: absolute; top: 4px; right: 18%; margin: 0; min-width: 16px; height: 16px; font-size: 10px; } .tab { position: relative; } .b-empty { padding: 24px 16px; } .b-empty h2 { font-size: 20px; } .b-will { display: none; } }

/* ===== Overlay auth/onboarding ===== */
.ghost { position: fixed; inset: 0; display: grid; grid-template-columns: 240px 1fr; gap: 0; filter: blur(7px) saturate(120%); opacity: .55; pointer-events: none; z-index: 0; }
.ghost i { display: block; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.g-side { border-right: 1px solid var(--line); padding: 28px 18px; display: grid; align-content: start; gap: 14px; background: #07090d; }
.g-side i { height: 34px; }
.g-side i:first-child { height: 40px; width: 70%; background: rgba(74, 159, 245, .25); }
.g-main { padding: 34px 48px; display: grid; align-content: start; gap: 18px; }
.g-h { height: 42px; width: 40%; }
.g-ask { height: 58px; box-shadow: var(--glow); }
.g-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; } .g-row i { height: 110px; }
.g-row i:nth-child(4), .g-row i:nth-child(5) { background: rgba(61, 220, 151, .12); }
.g-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .g-row2 i { height: 300px; }
.auth.overlay { position: relative; z-index: 1; background: radial-gradient(ellipse at 50% 30%, rgba(5, 7, 10, .55), rgba(5, 7, 10, .92) 70%); }
.auth.overlay::before { display: none; }
.auth.overlay .auth-card { background: rgba(12, 15, 20, .86); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border-radius: var(--r-xl); box-shadow: var(--glow), 0 40px 120px -30px rgba(0, 0, 0, .9); padding: 36px; width: min(520px, 100%); animation: cardIn .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.onb-step.active { animation: stepIn .38s cubic-bezier(.2, .8, .2, 1) both; }
#onb.back .onb-step.active { animation-name: stepBack; }
@keyframes stepIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.choice > span { transition: border-color .15s ease, background-color .15s ease, transform .12s ease; }
.choice:hover > span { border-color: var(--line-strong); }
.choice input:checked + span { transform: scale(1.01); box-shadow: 0 0 24px -10px rgba(74, 159, 245, .9); }

/* Build sequence */
.build { text-align: center; padding: 8px 0 4px; }
.build-mark { width: 72px; height: 72px; margin: 0 auto 18px; animation: markPulse 1.6s ease-in-out infinite; }
.build-mark img { width: 100%; height: 100%; }
@keyframes markPulse { 0%, 100% { filter: drop-shadow(0 0 10px rgba(74, 159, 245, .4)); transform: scale(1); } 50% { filter: drop-shadow(0 0 26px rgba(110, 233, 251, .9)); transform: scale(1.04); } }
.build-steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.build-steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); color: var(--haze); font-weight: 600; opacity: .45; transition: opacity .3s ease, color .3s ease; }
.build-steps li::before { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.build-steps li.doing { opacity: 1; color: var(--moon); }
.build-steps li.doing::before { border-color: var(--line-strong); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
.build-steps li.done { opacity: 1; color: var(--soft); }
.build-steps li.done::before { border: 0; background: var(--paid) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2305070a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 14px no-repeat; }
.build.finished .build-mark { animation: none; filter: drop-shadow(0 0 30px rgba(61, 220, 151, .7)); }

@media (max-width: 860px) { .ghost { grid-template-columns: 1fr; } .g-side { display: none; } .g-main { padding: 20px; } .g-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .auth.overlay .auth-card { padding: 24px 20px; border-radius: 22px; } .auth-main { padding: 12px 12px 40px; } }
@media (prefers-reduced-motion: reduce) { .ghost { filter: blur(7px); } }

/* ===== Onboarding inputs ===== */
textarea.input.tall { min-height: 132px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--soft); font-weight: 600; margin: -4px 0 18px; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.group-label { font-weight: 600; font-size: 15px; margin: 6px 0 10px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chips-select label { position: relative; }
.chips-select input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chips-select span { display: inline-block; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); font-weight: 600; font-size: 14px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.chips-select input:checked + span { border-color: var(--blue); background: rgba(74, 159, 245, .16); color: var(--moon); box-shadow: 0 0 18px -8px rgba(74, 159, 245, .9); }
.chips-select input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ===== Plan view ===== */
.plan-hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 26px; background: linear-gradient(135deg, rgba(74, 159, 245, .14), rgba(12, 15, 20, .9) 60%); box-shadow: var(--glow); margin-bottom: 18px; }
.plan-hero.done { box-shadow: 0 0 0 1px rgba(61, 220, 151, .5), 0 0 40px -12px rgba(61, 220, 151, .5); background: linear-gradient(135deg, rgba(61, 220, 151, .12), rgba(12, 15, 20, .9) 60%); }
.plan-hero .ph-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-hero h2 { font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.02em; margin: 0; }
.plan-hero p { margin: 0; color: var(--soft); }
.plan-hero .idea-quote { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--cyan); background: rgba(5, 7, 10, .5); border-radius: 0 10px 10px 0; color: var(--moon); font-size: 15px; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 18px 0 8px; }
.progress span { display: block; height: 100%; background: var(--speed); border-radius: 99px; transition: width .6s ease; }
.progress.queued span { width: 30% !important; animation: indeterminate 1.6s ease-in-out infinite; opacity: .6; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(360%); } }
.ph-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--haze); font-size: 14px; }
.task-pill { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.task-pill.queued { background: rgba(138, 148, 166, .16); color: var(--soft); }
.task-pill.running { background: rgba(110, 233, 251, .14); color: var(--cyan); }
.task-pill.needs_input { background: rgba(255, 196, 92, .16); color: #ffc45c; }
.task-pill.done { background: rgba(61, 220, 151, .16); color: var(--paid); }
.task-pill.failed, .task-pill.canceled { background: rgba(255, 123, 114, .14); color: var(--owed); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--panel); position: relative; z-index: 1; }
.timeline li.st-done .dot { border-color: var(--paid); background: var(--paid) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2305070a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
.timeline li.st-started .dot { border-color: var(--line-strong); border-top-color: var(--cyan); animation: spin .9s linear infinite; }
.timeline li.st-error .dot { border-color: var(--owed); background: rgba(255, 123, 114, .2); }
.timeline b { display: block; font-size: 15px; }
.timeline span { color: var(--haze); font-size: 14px; }
.timeline li:first-child { animation: feedIn .4s ease both; }
.plan-doc { display: grid; gap: 14px; }
.plan-sec { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: 22px; }
.plan-sec h3 { margin: 0 0 10px; font-size: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-sec p, .plan-sec li { color: var(--soft); }
.plan-sec p { margin: 0 0 10px; }
.plan-sec ul { margin: 0 0 10px; padding-left: 20px; }
.conf { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.conf.verified { background: rgba(61, 220, 151, .14); color: var(--paid); }
.conf.estimate { background: rgba(255, 196, 92, .14); color: #ffc45c; }
.conf.assumption { background: rgba(138, 148, 166, .16); color: var(--soft); }
.sources { margin: 0; padding-left: 20px; }
.sources a { color: var(--cyan); overflow-wrap: anywhere; }
.plan-outline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-outline li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--panel-2); color: var(--haze); font-weight: 600; }
.plan-outline li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--line-strong); }
.overview-plan { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.overview-plan .progress { flex-basis: 100%; margin: 4px 0 0; }
@media (max-width: 860px) {
  .side { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .tab { flex: 0 0 auto; min-width: 74px; }
}
