/* BillMaster Developers — design system (matches the partner deck: dark/light, teal/mint, glass cards)
   Safari notes: every backdrop-filter has -webkit- prefix and a translucent, non-black background
   underneath; no backdrop-filter on any element that is (or sits inside) an animated/transitioned box. */
/* Inter (SIL OFL 1.1), self-hosted — same typeface as the BillMaster deck; no third-party font CDN. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 900; font-display: swap; src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 900; font-display: swap; src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bm-teal: #00E3D1; --bm-teal-dark: #00B8AB; --bm-mint: #80F5E8;
  --bm-coral: #E86B54; --bm-gold: #CCA34D; --bm-success: #33C759;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --radius: 18px; --radius-sm: 12px; --header-h: 64px; --sidebar-w: 272px;
}
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0F0F11; --bg-2: #18181B; --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1f2a2b 0%, #141518 55%, #0F0F11 100%);
  --text: #F4F5F7; --text-2: #B4B4BD; --text-3: #8A8A94;
  --accent: #00E3D1; --accent-ink: #00E3D1; --accent-soft: rgba(0, 227, 209, 0.12); --accent-line: rgba(0, 227, 209, 0.35);
  --card: rgba(36, 38, 44, 0.72); --card-solid: #24262C; --card-strong: rgba(44, 46, 54, 0.92);
  --border: rgba(255, 255, 255, 0.09); --border-2: rgba(255, 255, 255, 0.16);
  --header-bg: rgba(24, 25, 30, 0.78); --header-bg-solid: rgba(28, 29, 34, 0.97);
  --input: rgba(255, 255, 255, 0.05); --code-bg: #15171B; --code-text: #E6EDF3;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28); --scrim: rgba(12, 13, 16, 0.55);
  --ok: #4ADE80; --ok-soft: rgba(74, 222, 128, 0.14); --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, 0.14);
  --err: #F87171; --err-soft: rgba(248, 113, 113, 0.14); --info: #7DD3FC; --info-soft: rgba(125, 211, 252, 0.14);
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #F3F6F6; --bg-2: #FFFFFF; --bg-grad: radial-gradient(1200px 600px at 50% -10%, #DDF6F3 0%, #EEF3F3 55%, #F3F6F6 100%);
  --text: #16181D; --text-2: #4A505B; --text-3: #6B7280;
  --accent: #00B8AB; --accent-ink: #007A71; --accent-soft: rgba(0, 184, 171, 0.12); --accent-line: rgba(0, 150, 140, 0.35);
  --card: rgba(255, 255, 255, 0.74); --card-solid: #FFFFFF; --card-strong: rgba(255, 255, 255, 0.95);
  --border: rgba(20, 30, 40, 0.10); --border-2: rgba(20, 30, 40, 0.18);
  --header-bg: rgba(255, 255, 255, 0.78); --header-bg-solid: rgba(255, 255, 255, 0.97);
  --input: rgba(255, 255, 255, 0.9); --code-bg: #12161C; --code-text: #E6EDF3;
  --shadow: 0 10px 30px rgba(20, 40, 50, 0.10); --scrim: rgba(30, 40, 50, 0.35);
  --ok: #15803D; --ok-soft: rgba(21, 128, 61, 0.10); --warn: #A16207; --warn-soft: rgba(202, 138, 4, 0.12);
  --err: #B91C1C; --err-soft: rgba(185, 28, 28, 0.10); --info: #0369A1; --info-soft: rgba(3, 105, 161, 0.10);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.6;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.01em; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); font-weight: 750; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); font-weight: 700; margin-top: 1.6em; }
h3 { font-size: 1.12rem; font-weight: 650; margin-top: 1.2em; }
p, li { overflow-wrap: anywhere; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); color: var(--text); padding: .1em .38em; border-radius: 6px; overflow-wrap: anywhere; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.xs { font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* ---------- Header (static, blurred) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 clamp(12px, 3vw, 28px);
  background: var(--header-bg-solid); border-bottom: 1px solid var(--border);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { background: var(--header-bg); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none !important; }
.brand img { height: 26px; width: auto; display: block; }
.brand .logo-light { display: none; }
html[data-theme='light'] .brand .logo-dark { display: none; }
html[data-theme='light'] .brand .logo-light { display: block; }
.brand-tag { font-size: .8rem; font-weight: 650; color: var(--accent-ink); border: 1px solid var(--accent-line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.header-spacer { flex: 1; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 999px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--text-2); font: 600 .78rem var(--font); padding: 6px 10px; cursor: pointer; min-height: 32px; }
.seg button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-2); background: transparent; color: var(--text); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 999px; padding: 3px 10px 3px 3px; background: transparent; color: var(--text); font: 600 .82rem var(--font); cursor: pointer; max-width: 240px; }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: .75rem; flex: none; }
.user-chip .uc-text { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; text-align: left; }
.user-menu { position: absolute; right: 12px; top: calc(var(--header-h) - 4px); z-index: 60; min-width: 240px; background: var(--card-solid); border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px; }
.user-menu .um-head { padding: 6px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu button, .user-menu a { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px; border-radius: 8px; font: 500 .9rem var(--font); cursor: pointer; }
.user-menu button:hover, .user-menu a:hover { background: var(--accent-soft); text-decoration: none; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; border-right: 1px solid var(--border); padding: 18px 14px 28px; background: transparent; }
.main { min-width: 0; padding: clamp(18px, 3vw, 40px) clamp(16px, 3.5vw, 48px) 64px; }
.content { max-width: 920px; margin: 0 auto; }
.content.wide { max-width: 1120px; }
.nav-group { margin-bottom: 18px; }
.nav-group h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 0 8px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-size: .92rem; font-weight: 550; text-decoration: none !important; line-height: 1.3; }
.nav-link:hover { background: var(--accent-soft); color: var(--text); }
.nav-link[aria-current='page'] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav-link .lock { margin-left: auto; font-size: .7rem; color: var(--text-3); }
.search { position: relative; margin: 0 0 16px; }
.search input[type=search] { width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--input); color: var(--text); font: 500 .9rem var(--font); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search-results { margin-top: 8px; }
.search-results a { display: block; padding: 7px 10px; border-radius: 8px; font-size: .86rem; color: var(--text); line-height: 1.3; }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .sr-page { display: block; color: var(--text-3); font-size: .72rem; }
.scrim { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  /* Drawer is transformed/animated: solid translucent background, NO backdrop-filter inside it. */
  .sidebar { position: fixed; z-index: 70; top: 0; left: 0; bottom: 0; height: 100%; width: min(86vw, 320px); background: var(--header-bg-solid); border-right: 1px solid var(--border-2); transform: translateX(-102%); transition: transform .25s ease, visibility 0s linear .25s; visibility: hidden; padding-top: 16px; box-shadow: var(--shadow); }
  body.drawer-open .sidebar { transform: none; visibility: visible; transition: transform .25s ease; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .drawer-head { display: flex !important; }
}
.drawer-head { display: none; align-items: center; justify-content: space-between; margin: 0 4px 14px; }
.drawer-head img { height: 22px; width: auto; }
.drawer-head .logo-light { display: none; }
html[data-theme='light'] .drawer-head .logo-dark { display: none; }
html[data-theme='light'] .drawer-head .logo-light { display: block; }

/* ---------- Cards / glass ---------- */
.card { background: var(--card-strong); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(18px, 2.4vw, 28px); box-shadow: var(--shadow); min-width: 0; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card.glass { background: var(--card); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); }
}
.card + .card { margin-top: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .g2, .g4 { grid-template-columns: minmax(0, 1fr); } }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
.page-head { margin-bottom: 22px; }
.page-head p { color: var(--text-2); font-size: 1.04rem; max-width: 760px; }
.stat { font-size: 1.6rem; font-weight: 750; line-height: 1.1; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }

/* ---------- Buttons / badges ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border-2); background: transparent; color: var(--text); font: 650 .94rem var(--font); cursor: pointer; text-decoration: none !important; text-align: center; line-height: 1.2; max-width: 100%; }
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--bm-teal); border-color: var(--bm-teal); color: #062523; }
.btn.primary:hover { background: var(--bm-mint); }
.btn.danger { color: var(--err); border-color: var(--err-soft); }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: .82rem; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.err { color: var(--err); background: var(--err-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.teal { color: var(--accent-ink); background: var(--accent-soft); }
.badge.neutral { color: var(--text-2); background: var(--input); border-color: var(--border); }
.tbc { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 1px 7px; white-space: normal; line-height: 1.5; }
.draft { display: inline-block; font-size: .74rem; font-weight: 700; color: var(--info); background: var(--info-soft); border-radius: 6px; padding: 1px 7px; }
.nda { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.nda.yes { color: var(--warn); background: var(--warn-soft); }
.nda.no { color: var(--ok); background: var(--ok-soft); }
.proto { display: inline-flex; gap: 6px; align-items: center; font-size: .74rem; font-weight: 700; color: var(--bm-gold); border: 1px dashed var(--bm-gold); border-radius: 8px; padding: 2px 8px; }

/* ---------- Callouts ---------- */
.callout { border-radius: var(--radius-sm); padding: 14px 16px; border: 1px solid var(--border); background: var(--input); margin: 14px 0; }
.callout strong:first-child { display: block; margin-bottom: 4px; }
.callout.teal { border-color: var(--accent-line); background: var(--accent-soft); }
.callout.warn { border-color: var(--warn-soft); background: var(--warn-soft); }
.callout.err { border-color: var(--err-soft); background: var(--err-soft); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; background: var(--input); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
.table-wrap.min table { min-width: 640px; }

/* ---------- Code ---------- */
.code { position: relative; margin: 14px 0; border-radius: var(--radius-sm); background: var(--code-bg); border: 1px solid rgba(255,255,255,.08); min-width: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.code-lang { font: 700 .72rem var(--mono); color: #8FE9DF; text-transform: uppercase; letter-spacing: .06em; }
.copy-btn { background: rgba(255,255,255,.06); color: #E6EDF3; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; font: 600 .76rem var(--font); padding: 4px 10px; cursor: pointer; min-height: 28px; }
.copy-btn:hover { background: rgba(0,227,209,.18); }
.code pre { margin: 0; padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; color: var(--code-text); font: 13px/1.6 var(--mono); tab-size: 2; }
.code pre code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.tab { border: 1px solid var(--border-2); background: transparent; color: var(--text-2); border-radius: 999px; padding: 6px 14px; font: 600 .84rem var(--font); cursor: pointer; min-height: 34px; }
.tab[aria-selected='true'] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-size: .86rem; font-weight: 650; color: var(--text); }
.field .hint { font-size: .78rem; color: var(--text-3); }
.field .err-msg { font-size: .8rem; color: var(--err); font-weight: 600; }
input[type=text], input[type=email], input[type=url], input[type=search], input[type=date], select, textarea {
  width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--input); color: var(--text); font: 500 .94rem var(--font); min-height: 42px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav-link:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--err); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--input); cursor: pointer; min-width: 0; }
.check input { margin-top: 4px; accent-color: var(--bm-teal-dark); flex: none; }
.check span { min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr) minmax(0, .9fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.rep-row.c3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
@media (max-width: 1240px) { .rep-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .rep-row > .btn { justify-self: end; align-self: end; } }
@media (max-width: 720px) { .rep-row, .rep-row.c3 { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- Diagram (HTML, responsive) ---------- */
.diagram { display: grid; gap: 16px; }
.lane { border: 1px dashed var(--accent-line); border-radius: var(--radius); padding: 18px; position: relative; }
.lane.p2 { border-color: var(--border-2); }
.lane-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 750; margin-bottom: 14px; }
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1.15fr) 96px minmax(0, 1fr); align-items: stretch; gap: 0; }
.node { background: var(--card-solid); border: 1px solid var(--border-2); border-radius: 14px; padding: 14px; min-width: 0; }
.node.bm { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.node h4 { margin: 0 0 4px; font-size: .98rem; }
.node p { margin: 0; font-size: .82rem; color: var(--text-2); }
.node ul { margin: 6px 0 0; padding-left: 18px; font-size: .82rem; color: var(--text-2); }
.arrows { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 0 6px; min-width: 0; }
.arrow { position: relative; font-size: .7rem; line-height: 1.25; color: var(--text-2); text-align: center; padding-bottom: 8px; overflow-wrap: anywhere; }
.arrow::after { content: ''; position: absolute; left: 4px; right: 10px; bottom: 0; height: 2px; background: var(--accent); }
.arrow::before { content: ''; position: absolute; right: 2px; bottom: -4px; border-left: 9px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.arrow.left::before { right: auto; left: 2px; border-left: 0; border-right: 9px solid var(--accent); }
.arrow.left::after { left: 10px; right: 4px; }
.arrow.pay::after { background: var(--bm-gold); } .arrow.pay::before { border-left-color: var(--bm-gold); }
.arrow.left.pay::before { border-right-color: var(--bm-gold); border-left-color: transparent; }
.sub-nodes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 860px) {
  .flow { grid-template-columns: minmax(0, 1fr); }
  .arrows { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 10px 0; gap: 8px 14px; }
  .arrow { padding-bottom: 0; padding-right: 0; padding-left: 18px; text-align: left; flex: 1 1 140px; }
  .arrow::after { left: 6px; right: auto; top: 0; bottom: 4px; width: 2px; height: auto; }
  .arrow::before { left: 1px; right: auto; bottom: -4px; top: auto; border-top: 9px solid var(--accent); border-left: 6px solid transparent !important; border-right: 6px solid transparent !important; border-bottom: 0; }
  .arrow.left::after { left: 6px; top: 4px; bottom: 0; }
  .arrow.left::before { top: -4px; bottom: auto; border-top: 0; border-bottom: 9px solid var(--accent); }
  .arrow.pay::before { border-top-color: var(--bm-gold); } .arrow.left.pay::before { border-bottom-color: var(--bm-gold); }
  .sub-nodes { grid-template-columns: minmax(0, 1fr); }
}
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin-right: 6px; background: var(--accent); }
.legend i.pay { background: var(--bm-gold); }

/* ---------- Steps / lifecycle ---------- */
.lifecycle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: lc; }
.lifecycle.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lc-step { position: relative; padding: 16px; border-radius: 14px; background: var(--card-solid); border: 1px solid var(--border); min-width: 0; }
.lc-step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: .86rem; margin-bottom: 8px; }
.lc-step.done .n { background: var(--bm-teal); color: #062523; }
.lc-step.current { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.lc-step h4 { margin: 0 0 4px; font-size: .96rem; }
.lc-step p { margin: 0; font-size: .82rem; color: var(--text-2); }
@media (max-width: 1100px) { .lifecycle.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .lifecycle, .lifecycle.five { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 420px) { .lifecycle, .lifecycle.five { grid-template-columns: minmax(0, 1fr); } }
ol.guide { list-style: none; padding: 0; margin: 0; counter-reset: g; }
ol.guide > li { position: relative; padding: 0 0 22px 52px; counter-increment: g; }
ol.guide > li::before { content: counter(g); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; border: 1px solid var(--accent-line); }
ol.guide > li::after { content: ''; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 1px; background: var(--border-2); }
ol.guide > li:last-child::after { display: none; }
ol.guide h3 { margin-top: 4px; }
.progress { height: 10px; border-radius: 999px; background: var(--input); border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--bm-teal-dark), var(--bm-mint)); border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ci { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; border: 1px solid var(--border-2); color: var(--text-3); margin-top: 1px; }
.checklist .ci.ok { background: var(--bm-teal); border-color: var(--bm-teal); color: #062523; }
.checklist .cl-body { min-width: 0; flex: 1; }

/* ---------- Landing ---------- */
.hero { padding: clamp(36px, 7vw, 88px) 0 clamp(24px, 4vw, 40px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.3rem); }
.hero .lead { font-size: clamp(1.02rem, .95rem + .4vw, 1.2rem); color: var(--text-2); max-width: 640px; }
.pill-private { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .84rem; margin-bottom: 18px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; }
.feature-list .fi { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.feature-list .fi svg { width: 18px; height: 18px; }
.feature-list strong { display: block; }
.section { padding: clamp(24px, 4vw, 44px) 0; }
.footer { border-top: 1px solid var(--border); padding: 26px 0 40px; color: var(--text-3); font-size: .86rem; }
.auth-card { max-width: 520px; margin: clamp(28px, 6vw, 72px) auto; }
.auth-card.wide { max-width: 760px; }

/* ---------- Modal / toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card-solid); border: 1px solid var(--border-2); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--card-solid); color: var(--text); border: 1px solid var(--accent-line); border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; max-width: calc(100vw - 32px); }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 8px 16px; font-size: .92rem; }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 6px; } }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 12px 0; }
.empty { text-align: center; color: var(--text-3); padding: 24px; }
.mono { font-family: var(--mono); font-size: .86em; overflow-wrap: anywhere; }
.secret { font-family: var(--mono); font-size: .9rem; padding: 8px 12px; border-radius: 10px; background: var(--input); border: 1px solid var(--border); overflow-wrap: anywhere; }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 600px) {
  .brand img { height: 22px; }
  .brand-tag { display: none; }
  .user-chip .uc-text { display: none; }
  .user-chip { padding: 3px; }
  .hide-sm { display: none !important; }
  .seg button { padding: 6px 8px; }
  .header-actions { gap: 6px; }
}
@media (max-width: 380px) { .site-header { gap: 6px; padding: 0 8px; } .icon-btn { width: 32px; height: 32px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* waiting-for-access screen */
.card.inset { background: var(--input); border: 1px solid var(--border); box-shadow: none; padding: 16px 18px; }
ol.steps { margin: 14px 0 0; padding-left: 1.4em; display: grid; gap: 6px; }
ol.steps li::marker { color: var(--accent-ink); font-weight: 800; }
#waiting .btn svg { vertical-align: -3px; margin-right: 6px; }

/* ---------- Mutual NDA gate ---------- */
.nda-tabs { margin: 4px 0 16px; }
.nda-doc { margin-top: 14px; max-height: min(62vh, 640px); overflow: auto; padding: clamp(14px, 2.4vw, 26px); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input); font-size: .93rem; line-height: 1.62; overflow-wrap: anywhere; -webkit-overflow-scrolling: touch; }
.nda-doc .nda-title { text-align: center; font-size: 1.12rem; letter-spacing: .02em; margin: 0 0 16px; }
.nda-doc h3 { color: var(--accent-ink); font-size: .98rem; margin: 20px 0 8px; }
.nda-doc p { margin: 0 0 10px; color: var(--text); }
.nda-doc ul { margin: 0 0 12px; padding-left: 1.2em; }
.nda-doc li { margin: 0 0 6px; }
.nda-fill { background: var(--accent-soft); color: var(--accent-ink); border-radius: 4px; padding: 0 3px; font-weight: 650; }
.nda-fill.empty { background: var(--warn-soft); color: var(--warn); }
.nda-hash { overflow-wrap: anywhere; margin-top: 4px; }
.sig-input { font-size: 1.15rem !important; font-style: italic; letter-spacing: .01em; }
.nda-gate .callout .row { margin-top: 10px; }
.nda-gate form.card { margin-top: 18px; }

.table-wrap.nda-events table { min-width: 960px; }
.nda-events td:nth-child(5) { min-width: 200px; } .nda-events td:nth-child(6) { min-width: 240px; }
.nda-nowrap { white-space: nowrap; }
.nda-ip { display: inline-block; min-width: 9.5em; overflow-wrap: anywhere; }
.nda-files td .mono, .nda-files td { overflow-wrap: anywhere; word-break: break-word; }
.nda-files table { table-layout: fixed; } .nda-files th:nth-child(1), .nda-files td:nth-child(1) { width: 32%; } .nda-files th:nth-child(3), .nda-files td:nth-child(3) { width: 18%; } .nda-files td { overflow-wrap: anywhere; }

/* ---------- Loading skeleton (static in the HTML, replaced on first render) ---------- */
.skel { padding-top: 8px; }
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--input) 0%, var(--border) 50%, var(--input) 100%); background-size: 200% 100%; animation: skpulse 1.4s ease-in-out infinite; }
.sk-kicker { width: 160px; height: 12px; margin: 6px 0 14px; }
.sk-h1 { width: min(420px, 80%); height: 34px; margin-bottom: 16px; }
.sk-p { width: min(640px, 95%); height: 14px; margin-bottom: 10px; } .sk-p.short { width: min(380px, 70%); }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 22px 0 16px; }
.sk-card { height: 140px; border-radius: var(--radius, 16px); } .sk-card.tall { height: 220px; }
@keyframes skpulse { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------- PDF preview ---------- */
.pdfv { margin-top: 14px; }
.pdfv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.pdfv-bar .pdfv-name { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.pdfv-pages { max-height: min(78vh, 980px); overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #52555c; display: flex; flex-direction: column; align-items: center; gap: 12px; }
html[data-theme=light] .pdfv-pages { background: #d9dde2; }
.pdfv-pages canvas { display: block; max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); border-radius: 2px; }
.pdfv-pages .pdfv-ph { width: 100%; max-width: 820px; aspect-ratio: 8.5 / 11; background: rgba(255,255,255,.75); border-radius: 2px; }
.pdfv-meta { margin-top: 8px; overflow-wrap: anywhere; }
.pdfv-msg { color: #fff; padding: 30px 10px; text-align: center; }
html[data-theme=light] .pdfv-msg { color: var(--text); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--accent-soft); } tr.is-active td { background: var(--accent-soft); }

/* ---------- Audit tables (global log, org log, NDA trail) ---------- */
.audit-wrap { max-height: 72vh; overflow: auto; }
.audit-wrap table { font-size: .84rem; }
.audit-wrap th { position: sticky; top: 0; z-index: 1; }
.audit-wrap th, .audit-wrap td { padding: 7px 10px; }
.audit-wrap td { vertical-align: middle; }
.aud-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.aud-actor { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.aud-target { display: inline-block; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.aud-ua, .aud-ip { white-space: nowrap; }
.aud-det { min-width: 14ch; max-width: 46ch; }
.aud-det details summary { cursor: pointer; list-style: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-det details summary::-webkit-details-marker { display: none; }
.aud-det details[open] summary { white-space: normal; color: var(--text-3); }
.aud-det details > div { margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.badge.aud { white-space: nowrap; font-size: .74rem; }
.aud-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-start; }
.aud-filters .field > label, .aud-filters .field > span { display: block; }
.aud-filters .field { flex: 1 1 150px; min-width: 0; margin: 0; }
.aud-filters .field.sm { flex: 0 1 150px; }
.aud-filters .check { flex: 1 1 100%; margin: 0; }
.aud-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 10px; }
.modal.wide { max-width: 920px; }
a.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.nda-preview-card { margin-top: 18px; }
.nda-preview-card .row { gap: 8px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
