* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.serif { font-family: var(--serif); font-weight: 300; }
.mono { font-family: var(--mono); font-size: 12px; }
.eyebrow { font: 500 11px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-subtle); }
.subtle { color: var(--text-subtle); }
.faint { color: var(--text-faint); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 0; }
.brand img { height: 16px; display: block; }
.brand .sep { width: 1px; height: 16px; background: var(--line-strong); }
.brand b { font-weight: 500; font-size: 15px; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { text-decoration: none; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text-subtle); font-weight: 500; font-size: 13px; }
.topnav a:hover { background: var(--canvas); color: var(--ink); }
.topnav a.on { color: var(--ink); background: var(--canvas); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-faint); font-size: 13px; width: 260px; background: var(--canvas); white-space: nowrap; overflow: hidden; }
.search kbd { margin-left: auto; font: 11px var(--mono); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; vertical-align: middle; place-items: center; font: 500 11px var(--sans); background: var(--ink); color: #fff; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.c1 { background: #c9d8f0; color: var(--ink); } .avatar.c2 { background: #ffd9bd; color: var(--ink); } .avatar.c3 { background: #e9e4ff; color: var(--ink); }

/* ---------- buttons, pills ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 500; font-size: 13px; text-decoration: none; transition: background .15s var(--ease), border-color .15s var(--ease); white-space: nowrap; }
.btn:hover { background: #000; }
.btn.orange { background: var(--accent); border-color: var(--accent); }
.btn.orange:hover { background: #e95a00; }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn .arrow { color: var(--accent); }
.btn.orange .arrow, .btn:not(.ghost) .arrow { color: inherit; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--accent-soft); color: #c84d00; }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.neutral { background: var(--canvas); color: var(--text-subtle); border: 1px solid var(--line); }
.pill.violet { background: var(--violet-wash); color: var(--violet); }
.pill.ink { background: var(--ink); color: #fff; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 17px; padding: 0 4px; margin: 0 1px; border-radius: 5px; border: 0; background: var(--violet-wash); color: var(--violet); font: 500 10.5px/1 var(--mono); vertical-align: 2px; transition: background .15s; }
.cite:hover, .cite.on { background: var(--violet-soft); color: #fff; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 56px); }
.rail { border-right: 1px solid var(--line); padding: 16px 12px; background: var(--canvas); position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
.rail h6 { margin: 18px 8px 6px; font: 500 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.rail a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); text-decoration: none; font-size: 13px; color: var(--ink); }
.rail a:hover { background: #efedeb; }
.rail a.on { background: var(--paper); box-shadow: 0 0 0 1px var(--line); font-weight: 500; }
.rail .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.rail .count { margin-left: auto; font: 11px var(--mono); color: var(--text-faint); }
.ws { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-weight: 500; }
.ws .logo-sq { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #ff683d, #ffb266); }
.main { min-width: 0; padding: 24px 32px 80px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font: 300 34px/1.15 var(--serif); margin: 4px 0 4px; letter-spacing: -.01em; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.meta-row { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-subtle); font-size: 13px; align-items: center; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 500; }
.card-b { padding: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; }
.kpi b { display: block; font: 300 28px/1.1 var(--serif); margin-top: 4px; }

.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--line); margin-bottom: 16px; }
.notice .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; font-weight: 600; }
.notice.done .ic { background: var(--green-soft); color: var(--green); }
.notice .grow { flex: 1; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 12px; font-weight: 500; font-size: 13px; color: var(--text-subtle); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .n { font: 11px var(--mono); color: var(--text-faint); }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--text-subtle); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fbfaf9; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fbfaf9; }
.type { font: 11px var(--mono); color: var(--text-faint); }
.docname { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.docicon { width: 22px; height: 26px; border-radius: 3px; border: 1px solid var(--line-strong); background: linear-gradient(#fff, #f7f6f5); position: relative; flex: none; }
.docicon::after { content: 'PDF'; position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font: 600 6px var(--sans); color: var(--red); }
.cell-scroll { overflow-x: auto; }
.empty { text-align: center; padding: 64px 16px; color: var(--text-subtle); }
.empty h3 { font: 300 24px var(--serif); color: var(--ink); margin: 0 0 6px; }

/* run panel */
.runpanel { position: fixed; inset: 0; background: rgba(23,23,23,.28); display: grid; place-items: center; z-index: 50; }
.runbox { width: min(620px, calc(100vw - 32px)); background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.runbox .hd { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.runbox .tile { width: 40px; height: 40px; border-radius: 10px; background: radial-gradient(120% 90% at 20% 20%, #ff683d, #ffb266 45%, #f3e6dc); flex: none; }
.steps { padding: 8px 20px 20px; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.step:last-child { border-bottom: 0; }
.step .st { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font: 600 11px var(--sans); color: var(--text-faint); margin-top: 1px; }
.step.active .st { border-color: var(--accent); color: var(--accent); animation: pulse 1s infinite; }
.step.done .st { background: var(--ink); border-color: var(--ink); color: #fff; }
.step .log { font: 12px/1.6 var(--mono); color: var(--text-subtle); margin-top: 4px; max-height: 120px; overflow: hidden; }
.step .log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }
.bar { height: 3px; background: var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s var(--ease); }

/* memo */
.memo { padding: 28px 36px 36px; }
.memo-title { font: 300 34px/1.15 var(--serif); margin: 6px 0 6px; }
.sec { border-top: 1px solid var(--line); padding: 20px 0 8px; }
.sec-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-h h2 { font: 400 22px/1.3 var(--serif); margin: 0; }
.sec-h .acts { margin-left: auto; display: flex; gap: 6px; }
.sec p { margin: 0 0 10px; max-width: 760px; }
.sec ul { margin: 0 0 10px; padding-left: 18px; max-width: 760px; }
.sec li { margin-bottom: 8px; }
.sec table.t { max-width: 760px; margin-bottom: 10px; }
.sec.refined { background: linear-gradient(90deg, rgba(255,99,0,.05), transparent 60%); margin: 0 -36px; padding-left: 36px; padding-right: 36px; }
.learned { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: #c84d00; background: var(--accent-soft); padding: 3px 9px; border-radius: var(--r-pill); }
.diff { font-size: 13px; line-height: 1.7; background: #fbfaf9; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: 10px 12px; margin: 6px 0 12px; max-width: 760px; white-space: pre-wrap; }
.diff ins { background: var(--green-soft); color: #11643d; text-decoration: none; border-radius: 3px; }
.diff del { background: var(--red-soft); color: var(--red); border-radius: 3px; }
.editor { border: 1px solid var(--ink); border-radius: var(--r-md); padding: 12px; margin: 6px 0 12px; background: var(--paper); max-width: 800px; }
.editor textarea { width: 100%; min-height: 150px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; font: 13px/1.6 var(--sans); color: var(--ink); resize: vertical; }
.editor input[type=text] { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; font: 13px var(--sans); }
.editor label { display: block; font-size: 12px; font-weight: 500; color: var(--text-subtle); margin: 10px 0 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--paper); border-radius: var(--r-pill); padding: 4px 10px; font-size: 12px; }
.chip-btn:hover, .chip-btn.on { border-color: var(--accent); color: #c84d00; background: var(--accent-soft); }
.editor .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.check { display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important; color: var(--ink) !important; font-weight: 400 !important; }

/* review rail */
.gate .item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.gate .item:last-child { border-bottom: 0; }
.gate .item a { text-decoration: none; flex: 1; }
.gate .item a:hover { text-decoration: underline; }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .3s var(--ease); }
.learning { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.learning:last-child { border-bottom: 0; }
.learning .src { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.learning.new { background: linear-gradient(90deg, var(--accent-soft), transparent); margin: 0 -16px; padding: 10px 16px; }
.toggle { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); border: 0; flex: none; transition: background .15s; padding: 0; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); }
.toggle.on { background: var(--ink); }
.toggle.on::after { transform: translateX(12px); }

/* graph */
.graph-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.graph svg { width: 100%; height: auto; display: block; }
.gnode { cursor: pointer; }
.gnode rect { stroke-width: 1; transition: stroke .15s; }
.gnode:hover rect, .gnode.on rect { stroke: var(--ink); stroke-width: 1.5; }
.gnode text { font: 500 11px var(--sans); fill: var(--ink); }
.gnode text.sub { font: 400 10px var(--sans); fill: var(--text-subtle); }
.gedge { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.gedge.on { stroke: var(--violet-soft); stroke-width: 2; }
.gedge.conflict { stroke: var(--red); stroke-dasharray: 3 3; opacity: .6; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-subtle); padding: 10px 16px; border-top: 1px solid var(--line); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* drawer */
.drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: var(--canvas); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(0,0,0,.06); z-index: 40; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s var(--ease); }
.drawer.open { transform: none; }
.drawer .hd { padding: 14px 16px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer .bd { overflow: auto; padding: 16px; flex: 1; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 28px 30px 36px; box-shadow: 0 1px 2px rgba(0,0,0,.04); margin-bottom: 14px; font-size: 13px; line-height: 1.7; }
.sheet h4 { font: 400 17px var(--serif); margin: 0 0 12px; }
.sheet .pg { font: 11px var(--mono); color: var(--text-faint); display: flex; justify-content: space-between; margin-bottom: 14px; }
.sheet span.hl { background: var(--violet-wash); box-shadow: 0 0 0 2px var(--violet-wash); border-radius: 2px; }
.sheet span.hl.flash { animation: flash 1.2s 2; }
@keyframes flash { 50% { background: rgba(168,154,254,.45); } }
.x { margin-left: auto; border: 0; background: none; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; color: var(--text-subtle); }
.x:hover { background: var(--canvas); }

/* audit */
.hash { font: 11px var(--mono); color: var(--text-faint); }
.act { font: 12px var(--mono); }

/* activity */
.feed .ev { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed .ev:last-child { border-bottom: 0; }
.feed .when { margin-left: auto; color: var(--text-faint); font-size: 12px; white-space: nowrap; padding-left: 8px; }

/* landing */
.landing { max-width: 1120px; margin: 0 auto; padding: 56px 32px 40px; }
.hero h1 { font: 300 64px/1.02 var(--serif); letter-spacing: -.025em; margin: 14px 0 18px; max-width: 880px; }
.hero h1 em { font-style: italic; }
.hero .lead { font-size: 17px; color: var(--text-subtle); max-width: 640px; margin: 0 0 26px; }
.sample { font-size: 12.5px; color: var(--text-subtle); margin-top: 14px; }
.sample b { color: var(--ink); font-weight: 500; }
.framing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 48px 0; }
.framing .card { padding: 22px; position: relative; overflow: hidden; }
.framing .num { font: 400 13px var(--mono); color: var(--accent); }
.framing p { font: 300 21px/1.35 var(--serif); margin: 10px 0 0; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 48px; }
.flow .card { padding: 16px; }
.flow .tile { height: 72px; border-radius: 10px; margin-bottom: 12px; }
.flow h4 { margin: 0 0 4px; font-size: 14px; font-weight: 500; }
.flow p { margin: 0; font-size: 13px; color: var(--text-subtle); }
.try { counter-reset: t; list-style: none; padding: 0; margin: 0; }
.try li { counter-increment: t; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.try li::before { content: counter(t); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font: 500 11px var(--sans); }
.footer { border-top: 1px solid var(--line); padding: 22px 32px; display: flex; gap: 16px; align-items: center; color: var(--text-faint); font-size: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-subtle); text-decoration: none; }

/* PM memo page */
.doc { max-width: 760px; margin: 0 auto; padding: 56px 32px 40px; }
.doc h1 { font: 300 48px/1.08 var(--serif); letter-spacing: -.02em; margin: 12px 0 14px; }
.doc h2 { font: 400 26px/1.25 var(--serif); margin: 44px 0 10px; }
.doc h3 { font-size: 15px; font-weight: 600; margin: 22px 0 6px; }
.doc p, .doc li { font-size: 15px; line-height: 1.65; }
.doc .bet { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px 24px; margin: 18px 0; }
.doc .bet .k { display: grid; grid-template-columns: 130px 1fr; gap: 6px 16px; font-size: 14px; margin-top: 12px; }
.doc .bet .k b { font-weight: 500; color: var(--text-subtle); }
.doc blockquote { margin: 18px 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent); font: 300 21px/1.4 var(--serif); }
.doc table.t { margin: 12px 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; transition: all .2s var(--ease); z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1100px) { .grid2, .graph-wrap { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; } .rail { display: none; } .main { padding: 16px 16px 64px; }
  .search, .topnav { display: none; } .framing, .flow { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; } .landing, .doc { padding: 32px 16px; } .memo { padding: 20px 16px; } .sec.refined { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .doc .bet .k { grid-template-columns: 1fr; }
}
