.dash { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 20px 16px; background: var(--deep); border-right: 1px solid var(--line); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2); text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); }
.side-nav a:hover { background: var(--card); color: var(--text); }
.side-nav a.on { background: var(--raised); color: var(--text); }
.badge { font: 400 12px/1 var(--mono); min-width: 20px; text-align: center; padding: 4px 6px; border-radius: 10px; background: var(--accent-fill); color: #fff; }
.badge.zero { background: var(--raised); color: var(--muted); }
.side-user { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding-top: 16px; border-top: 1px solid var(--line); }
.avatar { grid-row: span 3; width: 32px; height: 32px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-size: 13px; text-transform: uppercase; }
.who { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out { font-size: 12px; color: var(--accent); text-decoration: none; }
.out:hover { text-decoration: underline; }

.main { padding: 32px; display: flex; flex-direction: column; gap: 20px; min-width: 0; width: 100%; max-width: 1600px; margin: 0 auto; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; }
.top h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0; }
.date { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.live-tag { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }

.brief { display: flex; gap: 8px; }
.brief input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font: inherit; font-size: 15px; }
.brief input::placeholder { color: var(--muted); }
.brief input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.picked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: -8px; }
.chip { font: 400 13px/1 var(--mono); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--raised); color: var(--text-2); }
button.chip { font-family: var(--mono); cursor: pointer; }
button.chip:hover { color: var(--text); border-color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .label { margin: 0; font-size: 12px; }
.kpi b { font-size: 30px; line-height: 1.1; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--muted); }

.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; }
.card h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; }
#activity .rows { padding: 4px 0; }
.row.new { animation: rise .4s var(--ease) both; }
.row .task b { white-space: normal; }
.row.flash { background: rgba(139, 92, 246, .06); }

.appr, .spec { list-style: none; margin: 0; padding: 0; }
.appr li, .spec li { padding: 12px 0; border-top: 1px solid var(--line); }
.appr li:first-child, .spec li:first-child { border-top: 0; padding-top: 0; }
.appr b, .spec b { font-weight: 500; font-size: 14px; display: block; }
.appr small, .spec small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.act { display: flex; gap: 8px; margin-top: 10px; }
.appr li.done .act { display: none; }
.appr li.done > div:first-child { opacity: .6; }
.res { font: 400 12px/1 var(--mono); color: var(--ok); margin-top: 8px; display: inline-block; }
.res.no { color: var(--muted); }
.spec li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.spec small { grid-column: 1 / -1; }

.ask-card .brief { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.answer { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.answer p { margin: 0 0 14px; font-size: 15px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 112px minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 13px; color: var(--text-2); }
.bar > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { height: 10px; background: var(--raised); border-radius: 5px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--accent-fill); border-radius: 5px; }
.bar em { font: 400 12px/1 var(--mono); font-style: normal; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.integ .label { margin: 0 0 12px; }
.integ ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.integ li { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 13px; }
.hl { outline: 1px solid var(--accent); outline-offset: 4px; border-radius: 16px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) {
  .dash { display: block; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-user { order: 2; grid-template-columns: auto; padding: 0; border: 0; gap: 0 10px; grid-auto-flow: column; }
  .side-user .avatar, .side-user .who { display: none; }
  .side-nav { order: 3; flex: 0 0 100%; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; scrollbar-width: none; }
  .side-nav a { white-space: nowrap; flex: none; }
  .main { padding: 20px 16px 32px; }
  .top h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .kpi { padding: 14px; }
  .kpi b { font-size: 24px; }
  .bar { grid-template-columns: 84px minmax(0, 1fr) 56px; gap: 8px; }
  .brief .btn { padding: 0 16px; }
}

/* site-wide section{padding;border} and [hidden] overrides */
.main section { padding: 0; border-bottom: 0; }
.main section.card { padding: 20px; }
.main section.kpis { gap: 12px; }
.picked[hidden], .answer[hidden] { display: none; }

/* Integrations head, dashboards, connection dialog */
.integ-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.integ-head .label { margin: 0; }
#dbText { text-overflow: ellipsis; }
#dashboards .brief { margin-bottom: 12px; }
.dlist { margin-bottom: 20px; }
.dlist .label { margin: 0 0 12px; }
#dcards { display: grid; gap: 12px; }
.dcard { border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; background: var(--bg); min-width: 0; }
.dcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dcard-head h3 { margin: 0; font-size: 15px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.wg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.w { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.w.kpi { display: flex; flex-direction: column; gap: 6px; }
.w.kpi .label { margin: 0; font-size: 12px; }
.w.kpi b { font-size: 26px; font-weight: 500; letter-spacing: -.02em; }
.w.kpi small { font-size: 12px; color: var(--muted); }
.w h4 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.tbl { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tbl li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text-2); }
.tbl li:first-child { border-top: 0; padding-top: 0; }
.tbl em { font: 400 12px/1.5 var(--mono); font-style: normal; color: var(--text); text-align: right; }
.build { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; font: 400 13px/1.4 var(--mono); color: var(--run); }
.build[hidden] { display: none; }
.build li { animation: rise .3s var(--ease) both; }

.conn { padding: 0; border: 1px solid var(--line-2); border-radius: 16px; background: var(--card); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
.conn[open] { display: flex; flex-direction: column; }
.conn::backdrop { background: rgba(7, 8, 13, .72); }
.conn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 12px; }
.conn-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.conn-head .mono { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 20px; }
.steps i { height: 3px; border-radius: 2px; background: var(--raised); }
.steps i.on { background: var(--accent-fill); }
.conn-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 240px; }
.conn-body [hidden] { display: none; }
.sub { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tool { text-align: left; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.tool:hover { border-color: var(--accent); }
.tool.on { border-color: var(--accent-fill); background: rgba(139, 92, 246, .1); }
.tool b { font-weight: 500; font-size: 14px; }
.tool small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.consent { border: 1px solid var(--line-2); border-radius: 12px; padding: 20px; background: var(--bg); }
.consent > b { font-weight: 500; font-size: 16px; display: block; margin-bottom: 12px; }
.consent p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); }
.consent ul { margin: 0 0 16px; padding-left: 18px; font-size: 14px; color: var(--text); }
.consent .wait { color: var(--run); margin: 0; }
.consent [hidden] { display: none; }
.tog { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.tog:first-of-type { border-top: 0; }
.tog input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent-fill); flex: none; }
.tog b { display: block; font-weight: 500; font-size: 14px; }
.tog small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tog input:disabled + span { opacity: .75; }
.testres { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: 14px; color: var(--ok); }
.testres[hidden] { display: none; }
.testres svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.conn-foot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 20px 20px; border-top: 1px solid var(--line); }
.conn-foot [hidden] { display: none; }
.conn-foot .btn { height: 44px; }
.conn-foot #next { margin-left: auto; }
.conn-foot .btn:disabled, #addConn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 599px) {
  .conn { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; border: 0; margin: 0; }
  .tools, .wg { grid-template-columns: minmax(0, 1fr); }
}

/* Competitors and workflows */
.sub { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
#competitors .brief { margin-bottom: 0; }
.co-title { margin: 20px 0 12px; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.cmp th, .cmp td { padding: 12px 14px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.cmp thead th { border-top: 0; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.cmp th:first-child { text-align: left; font-weight: 400; color: var(--text); white-space: normal; min-width: 150px; }
.cmp td.low { color: var(--teal); }
.cmp small.hi { display: block; font: 400 11px/1.4 var(--mono); color: var(--accent); }
.lowkey { color: var(--teal); } .hikey { color: var(--accent); }
.insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.w b { display: block; font-weight: 500; font-size: 14px; line-height: 1.4; }
.w > small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.suggest { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-top: 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(139, 92, 246, .06); }
.suggest b { font-weight: 500; font-size: 14px; display: block; }
.suggest small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 46ch; }
.suggest .act { margin: 0; }
.suggest .res { margin: 0; }

.wf-list { display: grid; gap: 12px; margin-bottom: 20px; }
.wf-list .dcard-head { margin-bottom: 8px; }
.wf-list .dcard small { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.flow-line { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.flow-line b { font: 400 12px/1 var(--mono); color: var(--teal); margin-right: 8px; }
.arr { font-style: normal; color: var(--muted); }
.mv { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sw { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/1 var(--mono); color: var(--text-2); cursor: pointer; }
.sw input { appearance: none; -webkit-appearance: none; position: relative; width: 36px; height: 20px; margin: 0; flex: none; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-2); cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.sw input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .15s var(--ease), background-color .15s var(--ease); }
.sw input:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
.sw input:checked::after { transform: translateX(16px); background: #fff; }
.sw input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wf-new { grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); padding-top: 20px; display: grid; gap: 16px; }
.wf-new .label { margin: 0; }
.wf-new .brief { margin: 0; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; }
.fld.grow { flex: 1 1 200px; }
.fld select, .fld input { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; min-width: 0; width: 100%; }
.fld select:focus-visible, .fld input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chain { list-style: none; margin: 0; padding: 0; }
.node { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); }
.node + .node { margin-top: 16px; }
.node + .node::before { content: ""; position: absolute; left: 24px; top: -17px; width: 2px; height: 16px; background: var(--line-2); }
.node.trig { border-color: var(--accent-fill); }
.node .label { margin: 0; font-size: 12px; flex: none; min-width: 52px; }
.node > b { font-weight: 500; font-size: 14px; flex: 1 1 140px; min-width: 0; }
.node .mv { margin-left: auto; }
.wf-save { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.wf-save .btn { height: 44px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.testlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.testlog li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; animation: rise .3s var(--ease) both; }
.testlog .st { flex: none; }
@media (max-width: 899px) { .insights { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .node .mv { margin-left: 0; } .wf-save .btn { flex: 1; } }

/* Round 4 */
.who.co { color: var(--text); font-size: 14px; }
.links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
button.out { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
button.out:hover { color: var(--text); text-decoration: underline; }
.hint { margin: -8px 0 0; font-size: 12px; color: var(--muted); }
.lnk { color: var(--accent); text-decoration: none; }
.lnk:hover { text-decoration: underline; }
@media (max-width: 899px) { .side-user .who.co { display: none; } }

/* Round 5 */
.nw { white-space: nowrap; }
.swipe { display: none; }
@media (max-width: 719px) {
  .swipe { display: block; margin: 0 0 8px; }
  .cmp { min-width: 440px; font-size: 13px; }
  .cmp th, .cmp td { padding: 10px; }
  .cmp th:first-child { position: sticky; left: 0; z-index: 1; min-width: 96px; max-width: 96px; background: var(--card); box-shadow: 1px 0 0 var(--line-2); }
}
@media (max-width: 480px) { #coForm { flex-wrap: wrap; } #coForm input { flex: 1 1 100%; } #coForm .btn { flex: 1 1 100%; } }

/* Round 6: branching workflows */
.wf-open { margin-top: 12px; }
.wf-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.wf-panel[hidden] { display: none; }
.fchain, .fchain ol { list-style: none; margin: 0; padding: 0; }
.fchain > li.s { position: relative; }
.fchain > li.s + li.s { margin-top: 16px; }
.fchain > li.s + li.s::before { content: ""; position: absolute; left: 24px; top: -17px; width: 2px; height: 16px; background: var(--line-2); }
.wf-panel > .fchain + .fchain > li:first-child::before { content: ""; position: absolute; left: 24px; top: -17px; width: 2px; height: 16px; background: var(--line-2); }
.nd { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.nd.trig { border-color: var(--accent-fill); }
.nd.check { border-style: dashed; }
.nd .label { margin: 0; font-size: 12px; min-width: 60px; flex: none; }
.nd.appr .label { color: var(--accent); }
.nd.wait .label { color: var(--run); }
.nd > b { font-weight: 400; font-size: 13px; flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.tc { font: 400 11px/1 var(--mono); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; }
.tc.ap { color: var(--accent); border-color: var(--accent-fill); }
.branches { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.branches::before { content: ""; position: absolute; left: 24px; top: -17px; width: 2px; height: 16px; background: var(--line-2); }
.br { min-width: 0; padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; transition: opacity .25s var(--ease), border-color .25s var(--ease); }
.blab { display: inline-block; font: 400 12px/1 var(--mono); color: var(--teal); margin-bottom: 12px; }
.br.off { opacity: .35; }
.br.take { border-color: var(--ok); border-style: solid; }
.s.run > .nd { border-color: var(--run); }
.s.done > .nd { border-color: var(--ok); }
.s.wait > .nd { border-color: var(--accent); background: rgba(139, 92, 246, .08); }
.scen h4 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.scen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.testlog li .btn { margin-left: 12px; flex: none; }
.testlog li { align-items: center; flex-wrap: wrap; }
.testlog li > span:first-child { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 719px) { .branches, .scen-grid { grid-template-columns: minmax(0, 1fr); } }
