/* Emperor Network and Pipeline, prototype v2. Tokens follow Rania's approved workspace direction. */
:root {
  color-scheme: light;
  --ink: #131e29;
  --ink-2: #2a3d4e;
  --muted: #4c5c6a;
  --line: #e1e4e9;
  --field: #7d8a97;
  --canvas: #fbfcfc;
  --surface: #fff;
  --soft: #f2f5f7;
  --rail: #f6f8f9;
  --active: #edf1f4;
  --yellow: #ffcd00;
  --focus: #235f97;
  --green: #1d6044;
  --red: #943b31;
  --amber: #724918;
  --radius: 8px;
  --side: 232px;
  --tabbar: 62px;
  --tap: 44px;
  font: 400 16px/1.5 "Asta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
::selection { background: var(--yellow); color: var(--ink); }
html { scrollbar-color: #b9c2cb transparent; }
body { margin: 0; background: var(--canvas); min-height: 100dvh; caret-color: var(--focus); }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1[tabindex]:focus { outline: none; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: 1.875rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; text-wrap: balance; }
h2 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.35; font-weight: 600; }
p { max-width: 68ch; }
.meta, .muted { color: var(--muted); font-size: .9375rem; }
.block { display: block; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--surface); padding: 12px 14px; border-radius: 6px; transform: translateY(-200%); }
.skip:focus { transform: none; }
[hidden] { display: none !important; }

/* spacing utilities */
.gap-below { margin-bottom: 16px; }
.spaced { margin-top: 16px; }
.spaced-sm { margin-top: 10px; }
.spaced-xs { margin-top: 4px; }
.min0 { min-width: 0; }
.measure { max-width: 820px; }
.auto-w { width: auto !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 12px 16px; overflow-y: auto; }
.brand { display: grid; padding: 0 12px 20px; }
.brand strong { font-size: 1.25rem; letter-spacing: -.03em; }
.brand span { color: var(--muted); font-size: .9375rem; }
.side-nav { display: grid; gap: 2px; }
.side-nav .group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; text-decoration: none; }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--ink); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; background: var(--yellow); }
.side-foot { margin-top: auto; padding: 12px; display: grid; gap: 10px; color: var(--muted); font-size: .9375rem; }
.frame { min-width: 0; display: flex; flex-direction: column; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 10px 28px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.top-search { flex: 1; max-width: 440px; position: relative; }
.top-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { padding-left: 42px; }
.context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-align: left; max-width: 100%; }
.who:hover { border-color: #b9c2cb; }
.who-text { display: grid; line-height: 1.2; min-width: 0; }
.who-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.who > svg { color: var(--muted); margin-right: 4px; }
.access-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.access-chip.open { background: #e5f3eb; color: #235a43; }
.access-chip.closed { background: var(--soft); color: #3d4d5d; }
.access-chip svg { width: 15px; height: 15px; }
.demo-tag { font-size: .8125rem; font-weight: 600; color: var(--amber); background: #fcf0da; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; min-width: var(--tap); min-height: var(--tap); border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); text-decoration: none; }
.icon-btn:hover { background: var(--soft); }

.main { width: 100%; max-width: 1640px; margin-inline: auto; padding: 28px 28px 56px; outline: none; }
.tabbar, .mobile-only, .m-meta { display: none; }

/* ---------- building blocks ---------- */
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head p { margin-top: 6px; color: var(--muted); }
.page-head .actions-row { flex: none; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); margin: -8px 0 6px -4px; padding: 0 4px; color: var(--muted); font-weight: 600; text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pad { padding: 18px; }
.search-box { margin-bottom: 16px; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.stack.tight { gap: 3px; }
.stack.end { justify-items: end; }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.row { display: grid; align-items: center; gap: 12px; padding: 13px 18px; min-height: 58px; border-bottom: 1px solid var(--line); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--rail); }
.row.one-col { grid-template-columns: minmax(0, 1fr); }
.row.link-row { grid-template-columns: minmax(0, 1fr) 20px; }
.row.icon-row { grid-template-columns: auto minmax(0, 1fr) 20px; }
.row.guide-row { grid-template-columns: minmax(0, 1fr) auto; }
.row.deal-row { grid-template-columns: minmax(0, 1fr) auto 20px; }
.row.act-row { grid-template-columns: minmax(0, 1fr) auto; }
.row-head { min-height: 42px; background: var(--rail); color: #445463; font-weight: 600; font-size: .9375rem; }
.co-row { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.1fr) minmax(0, .9fr) minmax(0, .8fr) minmax(0, .9fr) 20px; }
.pe-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, .9fr) 20px; }
.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.identity.top-align { align-items: flex-start; }
.identity > span { display: grid; min-width: 0; }
.identity strong { font-weight: 600; }
.avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 7px; background: #eaf0f4; color: #334858; font-weight: 700; font-size: .875rem; }
.avatar.round { border-radius: 50%; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; border-radius: 10px; }
.avatar.lg.round { border-radius: 50%; }
.chev { justify-self: end; color: #6a7b8a; }
.import-meta .file { overflow-wrap: anywhere; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 4px; font-size: .875rem; font-weight: 600; line-height: 1.3; background: var(--soft); color: #3d4d5d; white-space: nowrap; }
.tag svg { width: 14px; height: 14px; }
.tag.lead, .tag.lost { background: #edf0f2; color: #475560; }
.tag.qualified, .tag.shared, .tag.info { background: #e7f0fa; color: #234c78; }
.tag.proposal { background: #efeafb; color: #503680; }
.tag.negotiation, .tag.warn, .tag.repeat { background: #fcf0da; color: #724918; }
.tag.won, .tag.new, .tag.ok { background: #e5f3eb; color: #235a43; }
.tag.fix, .tag.bad { background: #f9e9e6; color: #893329; }
.tag.existing { background: #e7f0fa; color: #234c78; }
.tag.dark { background: var(--ink); color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 9px 15px; border: 1px solid #c9d0d7; border-radius: 7px; background: var(--surface); font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; transition: background-color 150ms ease, border-color 150ms ease; }
.btn:hover { background: var(--soft); border-color: #aab5bf; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--soft); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 36px; padding: 6px 11px; font-size: .9375rem; }
.btn.icon-only { min-width: var(--tap); padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.primary).busy::after { border-color: var(--ink) var(--ink) transparent transparent; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btns.nowrap { flex-wrap: nowrap; }
.btns.center { justify-content: center; }
.seg-links { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 12px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 2px 2px 0 0; background: var(--ink); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--soft); color: #3d4d5d; font-size: .8125rem; font-weight: 700; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.fact { padding: 14px 18px; border-right: 1px solid var(--line); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact dt { color: var(--muted); font-size: .9375rem; }
.fact dd { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; overflow-wrap: anywhere; }
.detail-list { display: grid; }
.detail-list > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 7px; background: #f0f4f7; }
.notice svg { margin-top: 2px; }
.notice.ok { background: #eaf5ee; border-color: #cee3d7; color: #20563e; }
.notice.warn { background: #fff5e5; border-color: #eddbc0; color: #5c3b13; }
.notice.bad { background: #faefed; border-color: #efd4cf; color: #84382e; }
.notice > div { display: grid; gap: 6px; }
.empty { display: grid; gap: 10px; justify-items: start; padding: 28px 20px; }
.empty p { color: var(--muted); }
.wall { max-width: 560px; margin: 8vh auto 0; display: grid; gap: 14px; justify-items: start; padding: 28px; }
.wall .seal { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); }

.money { font-weight: 700; white-space: nowrap; }
.money.private { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.money.private svg { width: 15px; height: 15px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span:first-child { font-weight: 600; }
.field small { color: var(--muted); font-size: .875rem; }
.field.tight-field { gap: 2px; }
.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
.legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
/* :where keeps this at zero specificity, so component rules (like the search icon inset) win. */
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) { width: 100%; min-width: 0; min-height: var(--tap); padding: 9px 11px; background: var(--surface); border: 1px solid var(--field); border-radius: 7px; font-size: 1rem; }
:where(input, select, textarea):hover { border-color: #5d6b78; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; flex: none; }
[aria-invalid="true"] { border-color: var(--red) !important; }
.form-error { color: var(--red); font-size: .9375rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 14px; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--rail); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice > span { display: grid; gap: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid #c9d0d7; border-radius: 999px; font-weight: 600; font-size: .9375rem; cursor: pointer; background: var(--surface); }
.seg label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.check-list { gap: 10px; }
.check-list label { gap: 10px; }
.dup-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- AI ---------- */
.ai { border: 1px solid #d6dde4; border-radius: 8px; background: linear-gradient(180deg, #f7f9fb, #fff); padding: 14px 16px; display: grid; gap: 10px; }
.ai-label { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600; color: #234c78; }
.ai-label svg { width: 16px; height: 16px; }
.thinking { display: grid; gap: 8px; }

/* ---------- skeleton ---------- */
.sk { display: block; height: 14px; border-radius: 4px; background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.sk.w40 { width: 40%; } .sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.h28 { height: 28px; width: 30%; margin-bottom: 18px; }
.sk-row { display: grid; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line); }

/* ---------- pipeline ---------- */
.stage-pick { display: none; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.lane { background: #f1f4f6; border: 1px solid var(--line); border-radius: 9px; padding: 10px; min-width: 0; }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 10px; }
.lane-head h2 { font-size: 1rem; }
.lane-sum { padding: 0 2px 10px; color: var(--muted); font-size: .875rem; }
.deal { display: grid; gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; text-decoration: none; overflow-wrap: anywhere; transition: border-color 150ms ease, box-shadow 200ms ease; }
.deal + .deal { margin-top: 8px; }
.deal:hover { border-color: #8a9cad; }
.deal .co { color: var(--muted); font-size: .9375rem; }
.deal .ttl { font-weight: 700; line-height: 1.3; }
.deal .next { font-size: .9375rem; line-height: 1.4; }
/* Value, close date and owner each get their own line, so tight lanes never wrap them mid-phrase. */
.deal-foot { display: grid; gap: 2px; padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line); font-size: .9375rem; }
.deal.lost-deal .money:not(.private) { text-decoration: line-through; color: var(--muted); }
.deal.flash { border-color: var(--ink); box-shadow: 0 0 0 3px #ffcd0080, 0 6px 16px -8px #131e2940; }
.lane-empty { padding: 14px 4px; color: var(--muted); font-size: .9375rem; }

/* ---------- import ---------- */
.steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 20px; color: var(--muted); font-size: .9375rem; }
.steps li { display: inline-flex; align-items: center; gap: 8px; }
.steps li .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #c9d0d7; font-size: .75rem; font-weight: 700; }
.steps li .dot svg { width: 13px; height: 13px; stroke-width: 2.4; }
.steps li.done .dot { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 700; }
.steps li[aria-current="step"] .dot { border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow); }
.drop { display: grid; justify-items: center; gap: 10px; padding: 34px 18px; border: 1.5px dashed #a9b4be; border-radius: 10px; text-align: center; background: var(--surface); }
.drop.over { border-color: var(--ink); background: var(--rail); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filters button { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid #c9d0d7; background: var(--surface); font-weight: 600; font-size: .9375rem; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters button[aria-pressed="true"] .count { background: #ffffff26; color: #fff; }
.chip-pad { padding-bottom: 4px; }
.irow { border-bottom: 1px solid var(--line); }
.irow:last-child { border-bottom: 0; }
.irow summary { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 16px; min-height: 56px; cursor: pointer; list-style: none; }
.irow summary::-webkit-details-marker { display: none; }
.irow summary:hover { background: var(--rail); }
.irow .num { color: var(--muted); font-size: .875rem; }
.irow .body { padding: 4px 16px 16px calc(2.4rem + 26px); display: grid; gap: 12px; }
.summary-line { font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em; }
.confirm-bar { position: sticky; bottom: 12px; z-index: 2; box-shadow: 0 10px 30px -18px #131e2966; }

/* ---------- lists in admin ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row > .stack { flex: 1 1 260px; }
.log { display: grid; }
.log li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 4px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); font-size: .9375rem; }
.provider { display: grid; gap: 10px; }
.provider .choice { padding: 18px; }
.provider .choice strong { font-size: 1.0625rem; }

/* ---------- sheet + toasts ---------- */
dialog.sheet { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid #b9c2cb; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px -20px #131e2959; overflow: auto; }
dialog.sheet::backdrop { background: #131e294d; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-body { padding: 18px 20px; display: grid; gap: 16px; }
.sheet-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; min-height: 52px; border-radius: 9px; background: var(--ink); color: #fff; box-shadow: 0 14px 30px -12px #131e2980; font-weight: 600; }
.toast.bad { background: #6e2a22; }
.toast .btn { min-height: var(--tap); padding: 6px 12px; color: #fff; background: transparent; border-color: #ffffff55; }
.toast .btn:hover { background: #ffffff1a; }

/* ---------- responsive ---------- */
/* Six lanes from 1420px: about 180px per lane, and a 1440 window with a 15px scrollbar still qualifies. */
@media (min-width: 1420px) {
  .board { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .board .lane { padding: 8px; }
  .board .deal { padding: 11px; }
}
@media (max-width: 1199px) {
  :root { --side: 204px; }
  .main, .top { padding-inline: 22px; }
  .co-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .9fr) 20px; }
  .co-row > :nth-child(3) { display: none; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .top { min-height: 60px; padding: 8px 10px 8px 14px; gap: 8px; }
  .top-search { display: none; }
  .context { flex: 1; gap: 6px; }
  .mobile-only { display: inline-grid; }
  .who { order: -1; margin-right: auto; padding: 3px 4px 3px 3px; gap: 8px; border-color: transparent; }
  .who .avatar { width: 34px; height: 34px; }
  .who > svg { display: none; }
  .who-name { max-width: 9.5rem; }
  .demo-tag { display: none; }
  .access-chip .label { display: none; }
  .access-chip { padding: 6px; }
  .main { padding: 20px 14px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.625rem; }
  .page-head { display: grid; justify-content: stretch; gap: 12px; margin-bottom: 18px; }
  .page-head .btns .btn { flex: 1 1 auto; }
  .tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 2px env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar .nav-item { flex-direction: column; justify-content: center; gap: 3px; min-height: var(--tabbar); padding: 7px 2px 6px; border-radius: 0; font-size: .8125rem; line-height: 1.1; text-align: center; }
  .tabbar .nav-item[aria-current="page"] { background: transparent; }
  .tabbar .nav-item[aria-current="page"]::before { left: 22%; right: 22%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 2px 2px; }
  .toasts { bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); }

  /* Every control a finger touches is at least 44px tall on a phone. */
  .btn.small, .seg label, .filters button { min-height: var(--tap); }

  /* Tabs wrap instead of scrolling sideways, so every section is visible. */
  .tabs { flex-wrap: wrap; overflow: visible; gap: 0 2px; }
  .tabs a { padding: 0 10px; }

  .row-head { display: none; }
  .co-row, .pe-row { grid-template-columns: minmax(0, 1fr) 18px; gap: 4px 8px; padding: 12px 14px; }
  .co-row > :not(:first-child):not(.chev):not(.m-meta), .pe-row > :not(:first-child):not(.chev):not(.m-meta) { display: none; }
  .co-row .chev, .pe-row .chev { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .m-meta { display: block; grid-column: 1; grid-row: 2; margin-left: 48px; color: var(--muted); font-size: .9375rem; }

  /* Action rows: full-width text, the button underneath. */
  .row.act-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px; }
  .row.act-row > .btn { justify-self: start; }
  .row.guide-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .row.guide-row > .btn { justify-self: start; }
  .row.deal-row, .row.link-row, .row.icon-row { padding: 12px 14px; }

  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .fact:nth-child(2n) { border-right: 0; }
  .fact dd { font-size: 1.125rem; }
  .detail-list > div { grid-template-columns: 1fr; gap: 2px; padding: 11px 14px; }
  .pad { padding: 14px; }
  .box-head { padding: 12px 14px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stage-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
  .stage-pick button { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: var(--tap); padding: 8px 12px; border: 1px solid #c9d0d7; border-radius: 8px; background: var(--surface); font-weight: 600; }
  .stage-pick button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
  .stage-pick button[aria-pressed="true"] .count { background: #ffffff26; color: #fff; }
  .board { display: block; }
  .lane { display: none; padding: 10px; }
  .lane.on { display: block; }
  .deal { padding: 14px; }
  .log li { grid-template-columns: 1fr; padding: 12px 14px; }
  .list-row { padding: 12px 14px; }
  .irow summary { padding: 12px 14px; grid-template-columns: 1.8rem minmax(0, 1fr); }
  .irow summary > .tag { grid-column: 2; justify-self: start; }
  .irow .body { padding: 4px 14px 16px; }
  /* The confirmation sits in the flow on phones, so it never covers the last rows. */
  .confirm-bar { position: static; box-shadow: none; }
  .summary-line { font-size: 1.125rem; }
  dialog.sheet { width: 100vw; max-width: none; margin: auto 0 0; max-height: 92dvh; border-radius: 14px 14px 0 0; border-bottom: 0; }
}
@media (max-width: 379px) {
  .who-name { max-width: 7.5rem; }
  .tabbar .nav-item { font-size: .75rem; }
  .fact dd { font-size: 1rem; }
  .fact { padding: 10px 12px; }
}

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 200ms cubic-bezier(.2, .8, .2, 1); }
  dialog.sheet[open] { animation: sheet-up 220ms cubic-bezier(.2, .8, .2, 1); }
  .ai .result { animation: rise 220ms cubic-bezier(.2, .8, .2, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
  * { scroll-behavior: auto !important; }
}

.page-head h1, .box-head .meta { overflow-wrap: anywhere; }

/* First visit and connection pools */
.guide-surface {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--ink);
  color: var(--surface);
  border-radius: 12px;
  overflow: hidden;
}
.guide-copy { padding: clamp(24px, 5vw, 64px); }
.guide-copy .guide-step { color: var(--yellow); font-weight: 700; margin-bottom: 20px; }
.guide-copy h2 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.12;
  letter-spacing: -.025em;
  margin-bottom: 16px;
  text-wrap: balance;
}
.guide-copy p:not(.guide-step) { color: #e0e9ef; max-width: 42ch; }
.guide-copy .btns { margin-top: 24px; }
.guide-copy .btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.guide-copy .btn:not(.primary) { color: var(--ink); }
.guide-copy .btn.primary:hover { background: #ffdb46; }
.guide-preview {
  color: var(--ink);
  background: var(--soft);
  margin: clamp(16px, 3vw, 40px);
  padding: clamp(16px, 3vw, 36px);
  border-radius: var(--radius);
  align-self: center;
}
.guide-preview p { font-weight: 700; margin-bottom: 12px; }
.guide-preview ol { padding: 0; margin: 0; list-style-position: inside; }
.guide-preview li { display: list-item; padding: 10px 12px; border-bottom: 1px solid #d5dce3; }
.guide-preview li.guide-target { background: #fff0ae; border-bottom-color: #fff0ae; font-weight: 700; }
.guide-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.guide-footer a { text-decoration: underline; text-underline-offset: .16em; }
.guide-player [hidden], .guide-footer [hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .guide-preview li { transition: background-color 200ms ease-out, border-bottom-color 200ms ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .guide-player { display: none; }
}
.pool-options legend { font-size: 16px; font-weight: 650; margin-bottom: 6px; }
.pool-options label { display: flex; align-items: center; min-height: 44px; gap: 10px; }
.pool-options input { width: 18px; height: 18px; accent-color: var(--ink); }
.team-entry + .team-entry, .pool-list + .pool-list { border-top: 1px solid var(--line); }
.team-entry .list-row { border-bottom: 0; }
.team-entry .identity { overflow-wrap: anywhere; }
.pool-grants { padding: 0 16px 12px; }
.pool-grants summary { color: var(--ink-2); cursor: pointer; min-height: 44px; line-height: 44px; }
.pool-grants .pad { padding: 4px 0; }
.pool-list summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.pool-list summary > span:first-child::before { content: '›'; display: inline-block; margin-right: 8px; font-weight: 700; }
.pool-list[open] summary > span:first-child::before { transform: rotate(90deg); }
.pool-list summary .meta { display: block; }
.pool-list .tag { flex-shrink: 0; }
@media (max-width: 720px) {
  .guide-surface { grid-template-columns: 1fr; }
  .guide-preview { margin-top: 0; }
}

/* Signed-out workspace */
.signed-out .shell { display: block; }
.signed-out .sidebar, .signed-out .top, .signed-out .tabbar { display: none; }
.signed-out .main {
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: clamp(42px, 10vh, 112px) clamp(16px, 5vw, 64px) 32px;
  background: #f1f4f6;
}
.access-layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  width: min(940px, 100%);
  border: 1px solid #d4dce4;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.access-intro {
  background: var(--ink);
  color: #fff;
  padding: clamp(24px, 5vw, 58px);
  display: grid;
  align-content: end;
  gap: 12px;
}
.access-intro h1 { font-size: clamp(29px, 5vw, 55px); line-height: 1; }
.access-intro p { color: #e0e9ef; }
.access-panel { display: grid; padding: clamp(24px, 5vw, 56px); gap: 16px; align-content: center; }
.access-panel h2 { font-size: clamp(24px, 3vw, 34px); line-height: 1.15; }
.access-panel form { margin-top: 8px; }
.access-panel .btn { min-height: 46px; white-space: normal; }
.access-panel .access-hint, .access-panel .access-status { color: var(--muted); font-size: 15px; }
.access-status:empty { display: none; }
@media (max-width: 690px) {
  .access-layout { grid-template-columns: 1fr; }
  .access-intro { padding: 26px; }
}
