/* Anakai Funnel by Kyrylo */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #fafbfc; --ink: #15171c; --ink-2: #3a3f4b; --muted: #6b7280;
  --line: #e2e5ea; --line-2: #eef0f3; --focus: #2563eb;
  --red: #e5484d; --red-bg: #fff1f1; --yellow: #e59a00; --yellow-bg: #fff7e0; --green: #2b9a5e; --green-bg: #e9f7ef;
  --builder: #e8751a; --member: #8b5cf6; --holder: #0e9f8a;
  --deluxe: #64748b; --prestige: #b7791f; --executive: #1f2937;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: -12px 0 32px rgba(16, 24, 40, .14);
  --panel-w: 600px; --top-h: 56px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--ink); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-width: 1180px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.hint { color: var(--muted); font-size: 12.5px; }
.noscript, .error { padding: 24px; color: var(--red); }

/* ---------- top bar */
.top {
  position: fixed; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  height: var(--top-h); padding: 0 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -.5px;
}
.brand-text strong { font-size: 15px; }
.brand-text em, .brand em { font-style: normal; color: var(--muted); font-weight: 500; }
.brand-text small { display: block; color: var(--muted); font-size: 11.5px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: var(--ink-2);
}
.legend-btn b { font-weight: 700; color: var(--ink); }
.legend-btn:hover { border-color: #c9ced6; }
.legend-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.legend-btn.active b { color: #fff; }
.search-wrap { position: relative; flex: 1; max-width: 360px; margin-left: auto; }
.search-wrap input {
  width: 100%; padding: 7px 64px 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.search-wrap kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 5px; color: var(--muted); background: var(--surface-2); font-size: 11px;
}
.search-count { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: #c4c9d2; background: var(--surface-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2b2f38; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .pill { background: #fff; color: var(--ink); border-radius: 999px; padding: 0 6px; font-size: 11px; }
.btn.me { padding: 4px 10px 4px 4px; }
.link { border: 0; background: none; padding: 0; color: var(--focus); font-size: 12.5px; }
.link:hover { text-decoration: underline; }
.link.on { font-weight: 700; }
.link.danger { color: var(--red); }
.icon {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1;
  display: grid; place-items: center; color: var(--ink-2);
}
.icon:disabled { opacity: .35; cursor: default; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: #e7e9ee; color: var(--ink-2);
  font-size: 11.5px; font-weight: 700; flex: none;
}
.avatar.big { width: 40px; height: 40px; font-size: 16px; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.live.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }

/* ---------- review colours */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.red { background: var(--red); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); }
.rv-label { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.rv-label.red { color: var(--red); } .rv-label.yellow { color: #a86f00; } .rv-label.green { color: var(--green); }

/* ---------- canvas */
html, body { height: 100%; overflow: hidden; }
.top { position: fixed; left: 0; right: 0; }
.viewport {
  position: fixed; top: var(--top-h); left: 0; right: 0; bottom: 0; overflow: hidden; cursor: grab; touch-action: none;
  background-color: #eef0f3; background-image: radial-gradient(circle, #cdd2da 1.1px, transparent 1.3px); background-size: 24px 24px;
}
.viewport.panning { cursor: grabbing; }
.viewport.panning .step, .viewport.panning button { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; padding: 40px 60px 160px; width: max-content; user-select: none; -webkit-user-select: none; }
.world.moving { will-change: transform; }
.world.moving .step { transition: none; }
.board-title { max-width: 1200px; margin: 0 0 90px; }
.board-title h1 { margin: 0 0 6px; font-size: 40px; letter-spacing: -.6px; }
.board-title p { margin: 0 0 4px; font-size: 16px; color: var(--ink-2); }
.board-title .hint { font-size: 14px; }
.lane { display: flex; align-items: flex-start; }
.connector { flex: none; width: 110px; height: 3px; margin-top: 120px; background: #b9c0cb; position: relative; border-radius: 2px; }
.connector span { position: absolute; right: -2px; top: -6px; border-left: 12px solid #b9c0cb; border-top: 7.5px solid transparent; border-bottom: 7.5px solid transparent; }

.frame {
  position: relative; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06); padding: 22px 26px 26px;
}
.frame-label {
  position: absolute; left: 4px; bottom: 100%; margin-bottom: 10px; white-space: nowrap; font-weight: 700; font-size: 15px; color: var(--ink-2);
  transform-origin: left bottom; transform: scale(max(1, calc(0.6 / var(--k, 1))));
}
.stage-frame { --accent: #64748b; width: 1080px; border-top: 6px solid var(--accent); }
.stage-frame[data-stage="convert"] { --accent: #7c5cff; border-top-style: dashed; background: #eceef2; border-color: #d5d9e0; }  /* grey = nice to have, not vital for this review */
.stage-frame[data-stage="client"] { --accent: #2563eb; }
.stage-frame[data-stage="builder"] { --accent: #0e9f9e; }
.stage-frame[data-stage="leader"] { --accent: #d97706; }
.stage-frame[data-stage="global"] { --accent: #be185d; }
.stage-frame.selected { box-shadow: 0 0 0 3px var(--accent), 0 8px 24px rgba(16, 24, 40, .08); }
.stage-frame .frame-label { color: var(--accent); }
.rv-red { --rv: var(--red); } .rv-yellow { --rv: var(--yellow); } .rv-green { --rv: var(--green); }
.frame-head { position: relative; padding-left: 14px; }
.frame-head::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 5px; border-radius: 3px; background: var(--rv, var(--red)); }
.persona-frame .frame-head { padding-left: 0; }
.persona-frame .frame-head::before { display: none; }
.stage-top { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.grow-space { flex: 1; }
.stage-no { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.tag.proposal { background: #efeaff; color: #5b3fd6; }
.frame h2 { margin: 6px 0 4px; font-size: 32px; letter-spacing: -.5px; line-height: 1.15; }
.title-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; }
.title-btn:hover { color: var(--accent); }
.stage-summary { margin: 0 0 4px; color: var(--ink-2); font-size: 16px; }
.stage-meta { margin: 0; color: var(--muted); font-size: 13px; }

.rail { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.rank {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 72px; background: var(--surface);
  border: 1px solid var(--line); border-bottom: 4px solid var(--deluxe); border-radius: 8px; padding: 4px 6px; line-height: 1.2; cursor: default;
}
.rank b { font-size: 14px; }
.rank small { font-size: 11px; color: var(--muted); }
.rank small.rate { color: var(--ink-2); font-weight: 700; }
.rank.suite-prestige { border-bottom-color: var(--prestige); }
.rank.suite-executive { border-bottom-color: var(--executive); }
.rank.none { flex-direction: row; gap: 10px; border-style: dashed; border-bottom: 1px dashed #c9ced6; background: transparent; padding: 8px 12px; }

.frame-body { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 18px; align-items: start; }
.sec { margin: 0 0 16px; }
.sec h3 { margin: 0 0 5px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; }
.sec ul, .sec ol { margin: 0; padding-left: 20px; font-size: 14px; }
.sec li { margin: 2px 0; }
.text-col .sec h3 { color: var(--accent); }
.text-col .sec-rewards h3 { color: #a8660b; }
.text-col .sec-support h3 { color: #4b5563; }
.text-col .sec + .sec { padding-top: 14px; border-top: 1px solid var(--line-2); }
.box-col { display: flex; flex-direction: column; gap: 12px; }
.ibox { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px; background: var(--surface-2); }
.ibox h3 { margin: 0 0 6px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 800; }
.ibox ul, .ibox ol { margin: 0; padding-left: 20px; font-size: 14px; }
.ibox li { margin: 2px 0; }
.ibox-goal { background: color-mix(in srgb, var(--accent) 7%, white); border-color: color-mix(in srgb, var(--accent) 40%, white); border-width: 1.5px; }
.ibox-goal h3 { color: var(--accent); }
.ibox-done { background: #f3faf6; border-color: #cfe9da; }
.ibox-done h3 { color: var(--green); }
ul.check { list-style: none; padding-left: 0; }
ul.check li { position: relative; padding-left: 24px; }
ul.check li::before { content: ""; position: absolute; left: 2px; top: 4px; width: 13px; height: 13px; border: 1.5px solid #7fbf9a; border-radius: 3px; background: #fff; }
.profile-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
.pbox { background: var(--surface); border-top: 4px solid var(--pc); transition: opacity .15s; }
.pbox h3 { color: var(--pc); }
.pbox.p-builder, .persona.p-builder, .pnote.p-builder { --pc: var(--builder); }
.pbox.p-member, .persona.p-member, .pnote.p-member { --pc: var(--member); }
.pbox.p-holder, .persona.p-holder, .pnote.p-holder { --pc: var(--holder); }
.profile-boxes.focusing .pbox:not(.focus) { opacity: .35; }
.pbox.focus { box-shadow: 0 0 0 2px var(--pc); background: color-mix(in srgb, var(--pc) 6%, white); }
.pnote { border-left: 3px solid var(--pc); padding: 4px 8px; margin: 6px 0; background: var(--surface-2); border-radius: 0 6px 6px 0; }
.pnote b { font-size: 12px; color: var(--pc); }
.pnote ul { font-size: 12.5px; margin: 2px 0 0; padding-left: 16px; }
.pnote.focus { background: color-mix(in srgb, var(--pc) 8%, white); }

.frame-steps { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); }
.steps-head { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 800; }
.steps-head small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--rv); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; transition: box-shadow .12s, transform .12s, opacity .12s;
}
.step:hover { box-shadow: 0 4px 14px rgba(16, 24, 40, .1); transform: translateY(-1px); }
.step.selected { box-shadow: 0 0 0 3px var(--accent); }
.step.dim { opacity: .25; }
.step.kind-task { background: #fcfcfd; }
.step-top { display: flex; align-items: center; gap: 8px; }
.step-top .status { margin-left: auto; }
.step-no { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 11.5px; font-weight: 700; }
.kind { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent, var(--ink-2)); }
.kind-task .kind { color: var(--ink-2); }
.kind-live .kind { color: #c2410c; }
.status { font-size: 11px; padding: 0 8px; border-radius: 999px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.status.s-script_ready { background: #e8f0ff; color: #1d4ed8; }
.status.s-recorded { background: #fff1e0; color: #b45309; }
.status.s-needs_rerecord { background: #fdecec; color: #b42318; }
.status.s-published { background: var(--green-bg); color: var(--green); }
.step h4 { margin: 6px 0 3px; font-size: 15px; line-height: 1.3; }
.step-goal { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.step-foot { display: flex; align-items: center; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.badge { white-space: nowrap; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }
.badge.video { background: #ffe9ef; color: #be185d; }
.badge.edited { background: #fff3cd; color: #8a5a00; }
.badge.comments { background: #e8f0ff; color: #1d4ed8; }
.badge.has-note { background: #fdecec; color: #b42318; }

/* profiles frame */
.persona-frame { width: max-content; margin-bottom: 110px; }
.persona-row { display: flex; gap: 18px; align-items: stretch; margin-top: 16px; }
.persona-row .persona { width: 520px; flex: none; }
.persona { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; border-top: 4px solid var(--pc); }
.persona.focus { box-shadow: 0 0 0 2px var(--pc); }
.persona-head { display: flex; gap: 10px; align-items: flex-start; }
.persona-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); margin-top: 7px; flex: none; }
.persona h3 { margin: 0; font-size: 19px; }
.persona .tagline { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.persona-meta { display: flex; gap: 12px; align-items: center; margin: 10px 0 4px; flex-wrap: wrap; }
.persona-meta .btn { margin-left: auto; }
.chip { background: var(--line-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--ink-2); }
.meter { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.meter i { width: 16px; height: 7px; border-radius: 3px; background: var(--line); display: inline-block; }
.meter i.on { background: var(--pc); }
.persona-body { margin-top: 8px; border-top: 1px solid var(--line-2); padding-top: 4px; }
.persona-body h4 { margin: 10px 0 3px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--pc); }
.persona-body ul { margin: 0; padding-left: 18px; font-size: 13.5px; }

/* toolbar + minimap */
.canvas-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 35; display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 12px; padding: 5px; box-shadow: 0 6px 20px rgba(16, 24, 40, .12);
}
body.panel-open .canvas-bar { left: calc((100vw - var(--panel-w)) / 2); }
.bar-group { display: flex; align-items: center; gap: 2px; }
.bar-group + .bar-group { border-left: 1px solid var(--line); padding-left: 4px; margin-left: 2px; }
.bar-btn { border: 0; background: transparent; padding: 6px 9px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.bar-btn:hover { background: var(--line-2); color: var(--ink); }
.bar-btn.icon-btn { font-size: 17px; line-height: 1; padding: 4px 10px; }
.bar-btn.zoom { min-width: 52px; font-variant-numeric: tabular-nums; }
body.panel-open .bar-group.frames { display: none; }
.minimap {
  position: fixed; left: 16px; bottom: 16px; z-index: 35; padding: 8px; background: rgba(255, 255, 255, .94); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 6px 20px rgba(16, 24, 40, .1); cursor: pointer; touch-action: none;
}
.mm-inner { position: relative; }
.mm-frame { position: absolute; border-radius: 2px; background: #cbd2dc; }
.mm-profiles { background: #c9b8f5; }
.mm-convert { background: #b9a8ff; } .mm-client { background: #93b4f5; } .mm-builder { background: #8fd3d2; }
.mm-leader { background: #f2c27c; } .mm-global { background: #ec9cc0; }
.mm-frame.on { outline: 2px solid var(--ink); }
.mm-view { position: absolute; border: 2px solid var(--focus); background: rgba(37, 99, 235, .08); border-radius: 3px; pointer-events: none; }

/* ---------- side panel */
.panel {
  position: fixed; top: var(--top-h); right: 0; bottom: 0; width: var(--panel-w); border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lg);
  z-index: 40; transform: translateX(105%); transition: transform .18s ease; display: flex; flex-direction: column;
}
.panel.open { transform: none; }
.panel-inner { display: flex; flex-direction: column; height: 100%; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.crumb { font-size: 12px; color: var(--muted); }
.crumb .sep { margin: 0 6px; }
.panel-nav { display: flex; gap: 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 18px 40px; }
.title-block h2 { margin: 6px 0 6px; font-size: 20px; line-height: 1.25; letter-spacing: -.2px; }
.title-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.goal-line { margin: 0 0 6px; color: var(--ink-2); }
.review { margin: 14px 0 6px; border: 1px solid var(--line); border-left: 4px solid var(--rv); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.review-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.review-head small { color: var(--muted); font-size: 11.5px; }
.boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.box { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.box input { grid-row: 1 / span 2; width: 16px; height: 16px; accent-color: var(--ink); }
.box.approve input { accent-color: var(--green); }
.box-label { font-weight: 600; font-size: 12.5px; }
.box small { color: var(--muted); font-size: 11px; }
.box.on { border-color: #cdd3dc; }
.box.on.approve { border-color: var(--green); background: var(--green-bg); }
.box.locked { cursor: not-allowed; opacity: .78; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 12px; }
.tab { border: 0; background: none; padding: 8px 12px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row .label { width: 80px; color: var(--muted); font-size: 12.5px; }
.grow { flex: 1; min-width: 200px; }
input[type=url], input[type=search], input:not([type]), select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--surface); }
textarea { width: 100%; resize: vertical; }
.video { width: 100%; border-radius: 8px; background: #000; margin: 6px 0; max-height: 320px; }
.note { background: var(--red-bg); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 3px 10px; font-size: 12.5px; margin: 4px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.muted-sec { opacity: .75; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.warn-box { background: var(--yellow-bg); border: 1px solid #f3d27a; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.fields-form label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0; }
.fields-form input, .fields-form textarea { display: block; width: 100%; margin-top: 3px; color: var(--ink); font-size: 14px; }

/* script */
.script-bar { justify-content: flex-start; }
.count { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.script-editor { min-height: 60vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; padding: 12px; }
.md { font-size: 14.5px; line-height: 1.65; color: #23262d; max-width: 70ch; }
.md h3 { font-size: 18px; margin: 18px 0 6px; }
.md h4 { font-size: 15.5px; margin: 16px 0 4px; }
.md h5, .md h6 { font-size: 14px; margin: 14px 0 4px; }
.md p { margin: 0 0 10px; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.md mark.ph { background: #fff1b8; color: #6b4e00; border-radius: 3px; padding: 0 2px; }
.md code { background: var(--line-2); padding: 0 4px; border-radius: 4px; }

/* comments */
.thread { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--surface); }
.thread.resolved { opacity: .6; }
.reply { margin: 8px 0 0 30px; padding-top: 8px; border-top: 1px dashed var(--line); }
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-head small { color: var(--muted); font-size: 11.5px; }
.comment-text { white-space: pre-wrap; margin: 6px 0 4px 32px; font-size: 13.5px; }
.comment-actions { display: flex; gap: 14px; margin-left: 32px; }
.composer { margin-top: 12px; }
.composer.as-reply { margin: 8px 0 0 30px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-left: auto; }

/* history */
.audit { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.audit li { padding: 5px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 4px; flex-wrap: wrap; align-items: baseline; }
.audit small { margin-left: auto; color: var(--muted); }
.audit .detail { color: var(--muted); }
.revisions h3, .tab-body > div > h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0; }
.rev { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.rev summary { cursor: pointer; font-size: 12.5px; }
.rev pre { max-height: 300px; overflow: auto; }
.ranks { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ranks th, .ranks td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line-2); }
.ranks th { color: var(--muted); font-weight: 600; }
.step-links { list-style: none; padding: 0; margin: 0; }
.step-links li { display: flex; gap: 8px; align-items: center; padding: 2px 0; }

/* modal + toasts */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 18, 25, .38); z-index: 60; display: grid; place-items: center; }
.modal { background: var(--surface); border-radius: 14px; padding: 20px 22px; width: min(560px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.person { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; }
.person:hover, .person.on { border-color: var(--ink); }
.pending { font-size: 13px; padding-left: 18px; }
.toasts { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: opacity .4s, transform .4s; max-width: 640px; }
.toast.ok { background: #1f6f45; } .toast.error { background: #b42318; } .toast.warn { background: #8a5a00; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* login */
.login-body { min-width: 0; min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.login-card .brand { min-width: 0; margin-bottom: 8px; font-weight: 700; }
.login-card label { font-size: 12.5px; color: var(--muted); }
.login-card input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.login-card button { padding: 9px; border-radius: 8px; border: 0; background: var(--ink); color: #fff; font-weight: 600; }
.login-error { color: var(--red); margin: 0; font-size: 13px; }

.login-en { font-weight: 400; opacity: .6; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-btn { border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 10px; cursor: pointer; letter-spacing: .03em; }
.lang-btn + .lang-btn { border-left: 1px solid var(--line); }
.lang-btn.on { background: var(--ink); color: #fff; }
