:root {
  color-scheme: dark;
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  color: #eaf3ff;
  background: #07101d;
  --bg: #07101d;
  --surface: #0b1a29;
  --surface-soft: #0a1725;
  --surface-raised: #0b1c2c;
  --border: #1d3a52;
  --border-soft: #163044;
  --border-strong: #24506e;
  --text: #eaf3ff;
  --text-soft: #a8c2d4;
  --muted: #7fa0b8;
  --muted-dark: #5f7f96;
  --accent: #38bdf8;
  --accent-soft: #71d7ff;
  --success: #45d39d;
  --warning: #d4ad48;
  --danger: #ff8299;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 12% -10%, #10314e 0, transparent 30rem), var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body, button, input, select { font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif; }
button, input, select { font: inherit; }
button { border: 0; border-radius: 9px; padding: 10px 14px; background: var(--accent); color: #052033; font-size: .82rem; font-weight: 700; cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease; }
button:hover:not(:disabled) { background: #5fcbfb; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .48; }
button.secondary { border: 1px solid var(--border-strong); background: #12314a; color: #cde5f6; }
button.secondary:hover:not(:disabled) { background: #19405e; }
button.ghost { border: 1px solid var(--border-strong); background: transparent; color: #8ba8bd; }
button.ghost:hover:not(:disabled) { color: var(--text); background: #0e2233; }
button.danger { border: 1px solid #5a2634; background: #2a1520; color: #ffc6d1; }
button.danger:hover:not(:disabled) { background: #3a1c27; }
.danger-zone { margin-top: 20px; border-color: #5a2634; }
.danger-zone h2 { color: #ffc6d1; }
.danger-zone form { max-width: 560px; margin-top: 18px; }
.subscription-plan-summary { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(250px, 1.3fr); gap: 1px; margin-top: 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--border-soft); }
.subscription-plan-summary > div { padding: 13px 15px; background: var(--surface-raised); }
.subscription-plan-summary span, .subscription-plan-summary strong, .subscription-plan-summary small { display: block; }
.subscription-plan-summary span { color: var(--muted); font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.subscription-plan-summary strong { margin-top: 5px; color: var(--text); font-size: .84rem; }
.subscription-plan-summary small { margin-top: 3px; color: var(--muted-dark); font-size: .66rem; }
button.compact { padding: 8px 12px; font-size: .76rem; }
a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: #a9e9ff; text-decoration: underline; }
p { color: var(--text-soft); line-height: 1.58; }
h1, h2, h3, p { overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border-radius: 8px; background: #1e3a4f; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }

/* Session gates */
#login, #session-loading { width: min(420px, calc(100% - 36px)); margin: 12vh auto; padding: 34px; border: 1px solid #264963; border-radius: 18px; background: #0b1928; box-shadow: 0 25px 80px #0008; }
#session-loading { text-align: center; }
#login h1, #session-loading h1 { margin: 10px 0 8px; font-size: 2rem; }
#login p, #session-loading p { margin-top: 0; }
#login form { margin-top: 24px; }
.session-alternative { margin: 24px 0 0 !important; padding-top: 18px; border-top: 1px solid var(--border-soft); font-size: .78rem; text-align: center; }
.session-spinner { width: 34px; height: 34px; margin: 28px auto 18px; border: 3px solid #264963; border-top-color: var(--accent-soft); border-radius: 50%; animation: session-spin .8s linear infinite; }
@keyframes session-spin { to { transform: rotate(360deg); } }
.brand { color: var(--accent-soft); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
label { display: block; color: #b4c9dc; font-size: .78rem; font-weight: 600; }
input, select { width: 100%; margin: 7px 0 16px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px; outline: 0; background: #081420; color: var(--text); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #38bdf81f; }

/* Public billing */
.billing-shell { width: min(1020px, calc(100% - 36px)); margin: 42px auto 70px; }
.billing-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.billing-heading h1 { margin: 9px 0 4px; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.03em; }
.billing-heading p { margin: 0; }
.billing-login-link { padding: 9px 13px; border: 1px solid var(--border-strong); border-radius: 9px; background: #0b1a29; font-size: .78rem; font-weight: 700; }
.billing-journey { margin-bottom: 18px; padding: 17px 19px 18px; border: 1px solid #24465f; border-radius: 14px; background: linear-gradient(145deg, #0c1d2c, #091722); box-shadow: 0 14px 36px #02060b29; }
.billing-journey-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.billing-journey-heading span { color: #7897ad; font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.billing-journey-heading strong { color: #cdeefe; font-size: .72rem; font-weight: 700; }
.billing-journey ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.billing-journey li { position: relative; display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 9px; min-width: 0; color: #68869b; }
.billing-journey li:not(:last-child)::after { position: absolute; z-index: 0; top: 14px; right: -8px; left: 31px; height: 2px; background: #24445a; content: ""; }
.billing-journey li.complete:not(:last-child)::after { background: #2f8f72; }
.billing-journey-marker { position: relative; z-index: 1; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #31546c; border-radius: 50%; background: #0a1824; color: #7898ae; font-size: .7rem; font-weight: 800; box-shadow: 0 0 0 4px #0b1a27; }
.billing-journey-copy { position: relative; z-index: 1; display: block; min-width: 0; padding: 2px 5px 2px 0; background: #0b1a27; }
.billing-journey-copy strong, .billing-journey-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-journey-copy strong { color: #7f9cb0; font-size: .73rem; }
.billing-journey-copy small { margin-top: 2px; color: #5c798e; font-size: .62rem; }
.billing-journey li.current .billing-journey-marker { border-color: var(--accent); background: #12334a; color: #e3f7ff; box-shadow: 0 0 0 4px #12334a80, 0 0 20px #38bdf83d; }
.billing-journey li.current .billing-journey-copy strong { color: #dff6ff; }
.billing-journey li.current .billing-journey-copy small { color: #90bad0; }
.billing-journey li.complete .billing-journey-marker { border-color: #3ba982; background: #123a31; color: #b9f6dc; }
.billing-journey li.complete .billing-journey-copy strong { color: #9edbc4; }
.billing-journey li.error .billing-journey-marker { border-color: #c86b68; background: #401f24; color: #ffd0cf; box-shadow: 0 0 0 4px #401f2466; }
.billing-test-banner { margin-bottom: 18px; padding: 11px 14px; border: 1px solid #6c5722; border-radius: 10px; background: #2d2514; color: #f5d47a; font-size: .77rem; line-height: 1.5; }
.billing-test-banner.production { border-color: #7c3f32; background: #2d1915; color: #ffc0ae; }
.billing-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.billing-card { padding: 24px; border: 1px solid var(--border); border-radius: 15px; background: #0b1a29; box-shadow: 0 18px 45px #02060b33; }
.billing-card h2 { margin: 7px 0 8px; font-size: 1.15rem; }
.billing-card > p { margin: 0 0 20px; font-size: .8rem; }
.billing-step { color: var(--accent-soft); font-size: .65rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.billing-consent { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; font-weight: 500; line-height: 1.5; }
.billing-consent input { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; }
.billing-consent span { color: var(--text-soft); }
.billing-identity-form button, #billing-identity-submit, #billing-password-submit { width: 100%; }
#billing-password-help { margin: -7px 0 15px !important; padding: 0; border: 0; }
.billing-verification { margin-top: 16px; padding: 16px; border: 1px solid #275b4c; border-radius: 10px; background: #0c231f; }
.billing-verification strong { color: #9ae8c8; }
.billing-verification p { margin: 5px 0 14px; font-size: .77rem; }
.billing-password-step { margin-top: 16px; padding: 16px; border: 1px solid #285774; border-radius: 10px; background: #0d2232; }
.billing-password-step h2 { margin-top: 7px; }
.billing-password-step > p { margin: 0 0 18px; font-size: .77rem; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.billing-plan-card { position: sticky; top: 22px; border-color: #285774; background: linear-gradient(155deg, #10283b, #0b1928 55%); }
.billing-price { display: flex; align-items: baseline; gap: 7px; margin: 18px 0; }
.billing-price strong { color: #dff6ff; font-size: 2rem; font-weight: 650; letter-spacing: -.04em; }
.billing-price span { color: var(--muted); font-size: .75rem; }
.billing-plan-card ul { display: grid; gap: 10px; margin: 20px 0; padding: 0; list-style: none; }
.billing-plan-card li { position: relative; padding-left: 22px; color: #b7cede; font-size: .78rem; line-height: 1.45; }
.billing-plan-card li::before { position: absolute; left: 0; color: var(--success); content: "✓"; font-weight: 800; }
.billing-renewal { margin: 18px 0 0 !important; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted) !important; font-size: .72rem !important; }
.billing-payment { margin-top: 18px; }
.billing-payment-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 8px; }
.billing-payment-header h2 { margin-bottom: 0; }
.billing-payment-provider { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-width: 226px; padding: 9px 13px 9px 10px; border: 1px solid #96dfff; border-radius: 12px; background: #f7fcff; box-shadow: 0 8px 24px #02060b2e; }
.billing-payment-provider img { display: block; flex: 0 0 auto; width: 42px; height: 42px; }
.billing-payment-provider div { display: grid; gap: 2px; }
.billing-payment-provider span { color: #42566b; font-size: .62rem; font-weight: 650; letter-spacing: .02em; }
.billing-payment-provider strong { color: #0a0080; font-size: .92rem; font-weight: 750; letter-spacing: -.02em; }
.billing-card-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; max-width: 720px; }
.billing-field-wide, .billing-progress { grid-column: 1 / -1; }
.mp-secure-field { width: 100%; height: 41px; margin: 7px 0 16px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; }
.mp-secure-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #38bdf81f; }
.billing-progress { width: 100%; height: 4px; margin: 2px 0 13px; border: 0; accent-color: var(--accent); }
.billing-status { display: flex; align-items: center; gap: 18px; margin-top: 18px; padding: 20px 24px; border: 1px solid #275b4c; border-radius: 14px; background: #0c231f; }
.billing-status .session-spinner { flex: 0 0 auto; width: 28px; height: 28px; margin: 0; }
.billing-status strong { color: #b9f6dc; }
.billing-status p { margin: 4px 0 0; font-size: .77rem; }
.billing-status button { margin-top: 10px; }

/* Global shell */
#app { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 60; border-bottom: 1px solid var(--border); background: #081522f5; box-shadow: 0 10px 30px #04080e66; backdrop-filter: blur(14px); }
.topbar-main { display: flex; align-items: center; gap: 18px; min-height: 52px; padding: 9px 24px; }
.product-lockup { display: flex; align-items: baseline; gap: 10px; min-width: 150px; }
.environment { color: var(--muted-dark); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.tenant-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 11px 4px 4px; border: 1px solid #21415a; border-radius: 999px; background: var(--surface-raised); }
.tenant-avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 23px; height: 23px; border-radius: 50%; background: #12314a; color: #7cdbff; font-size: .64rem; font-weight: 700; }
.tenant-copy { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.tenant-copy strong { max-width: 190px; overflow: hidden; color: var(--text); font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.tenant-copy small { max-width: 280px; overflow: hidden; color: #6d8ea6; font-family: var(--mono); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.account-meta { max-width: 300px; text-align: right; line-height: 1.28; }
.account-meta span, .account-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta span { color: var(--muted); font-size: .7rem; }
.account-meta small { color: var(--muted-dark); font-size: .68rem; }
.icon-button { display: none; margin-left: auto; border: 1px solid var(--border-strong); background: transparent; color: var(--text-soft); }
.healthbar { display: flex; align-items: center; gap: 8px; padding: 0 24px 8px; overflow-x: auto; }
.health-summary { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.health-summary.ok { background: #103b2d; color: #78efba; }
.health-summary.pending { background: #3b3016; color: #f5d47a; }
.health-summary.error { background: #3a1c27; color: #ffc0cd; }
.health-strip { display: flex; align-items: center; gap: 8px; min-width: max-content; }
.health-item { display: flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid #1e3d55; border-radius: 8px; background: var(--surface-raised); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.health-item b { padding: 3px 6px; border-radius: 999px; background: #3b3016; color: #f5d47a; font-size: .58rem; letter-spacing: .04em; }
.health-item.ok b { background: #103b2d; color: #78efba; }
.health-item.error b { background: #3a1c27; color: #ffc0cd; }
.health-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px #3b3016; }
.health-dot.ok { background: var(--success); box-shadow: 0 0 0 3px #103b2d; }
.health-dot.error { background: var(--danger); box-shadow: 0 0 0 3px #3a1c27; }
.health-detail { margin: -1px 24px 8px; color: var(--muted); font-size: .7rem; line-height: 1.45; }

.app-layout { display: grid; grid-template-columns: 214px minmax(0, 1fr); margin: 0 auto; }
.sidebar { position: sticky; top: 125px; align-self: start; min-height: calc(100vh - 125px); padding: 22px 14px 40px 18px; border-right: 1px solid #132c40; }
.nav-label { padding: 0 10px 9px; color: var(--muted-dark); font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border: 1px solid transparent; border-radius: 8px; color: #8ba8bd; font-size: .78rem; font-weight: 600; line-height: 1.25; text-decoration: none; }
#nav a:hover { background: #0e2233; color: var(--text); }
#nav a.active { border-color: #204660; background: #102a3e; color: #dff5ff; box-shadow: inset 3px 0 var(--accent); }
.nav-badge { min-width: 19px; padding: 2px 6px; border-radius: 999px; background: #3b3016; color: #f5d47a; font-size: .64rem; text-align: center; }
.role-card { margin-top: 22px; padding: 12px 13px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--surface-raised); }
.role-card > span { display: block; color: var(--accent-soft); font-size: .61rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.role-card strong { display: block; margin-top: 5px; font-size: .78rem; }
.role-card p { margin: 5px 0 0; color: #8ba8bd; font-size: .71rem; line-height: 1.5; }
.sidebar-note { margin: 16px 12px 0; color: var(--muted-dark); font-size: .69rem; line-height: 1.55; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sidebar-heading .nav-label { padding-bottom: 0; }
.shell-icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 7px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface-raised); color: var(--text-soft); }
.shell-icon-button:hover, .shell-icon-button.active { border-color: var(--accent); background: #102a3e; color: #dff5ff; }
.shell-icon-button svg, #nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#nav svg { flex: 0 0 20px; }
#nav a { position: relative; justify-content: flex-start; }
#nav a > span { flex: 1; }
.profile { position: relative; }
.profile-panel { position: absolute; top: calc(100% + 10px); right: 0; width: min(290px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--border-strong); border-radius: 12px; background: #0b1a29; box-shadow: 0 18px 45px #02060b99; }
.profile-heading { padding: 10px 12px 14px; border-bottom: 1px solid var(--border); }
.profile-heading strong, .profile-heading small { display: block; }
.profile-heading strong { font-size: .82rem; }
.profile-heading small { margin-top: 6px; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.profile-panel nav { display: grid; gap: 3px; padding: 8px 0; }
.profile-panel a, .profile-panel > button { display: block; width: 100%; padding: 11px 12px; border-radius: 7px; text-align: left; font-size: .79rem; }
.profile-panel a { color: var(--text-soft); text-decoration: none; }
.profile-panel a:hover, .profile-panel a.active { background: #102a3e; color: #dff5ff; }
.shell-icon-button:focus-visible, #nav a:focus-visible, .profile-panel a:focus-visible, .setup-block > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 881px) {
  #app.sidebar-collapsed .app-layout { grid-template-columns: 72px minmax(0, 1fr); }
  #app.sidebar-collapsed .sidebar { padding: 22px 10px 40px; }
  #app.sidebar-collapsed .sidebar-heading { justify-content: center; }
  #app.sidebar-collapsed .nav-label, #app.sidebar-collapsed #nav a > span, #app.sidebar-collapsed .role-card, #app.sidebar-collapsed .sidebar-note { display: none; }
  #app.sidebar-collapsed #nav a { justify-content: center; min-height: 44px; padding: 11px; }
  #app.sidebar-collapsed .nav-badge { position: absolute; top: -2px; right: -4px; padding: 1px 4px; }
  #app.sidebar-collapsed #sidebar-toggle svg { transform: rotate(180deg); }
}
#pages { min-width: 0; padding: 26px 30px 70px; }
.subscription-access-banner { position: sticky; top: 126px; z-index: 35; display: flex; align-items: center; gap: 12px; margin: -10px 0 20px; padding: 12px 14px; border: 1px solid #765c1e; border-radius: 11px; background: #302713f5; color: #f8dc88; box-shadow: 0 10px 24px #03070c66; text-decoration: none; backdrop-filter: blur(10px); }
.subscription-access-banner:hover { border-color: #a27e29; background: #3a2f16; color: #ffe9a9; text-decoration: none; }
.subscription-access-icon { display: grid; flex: 0 0 auto; place-items: center; width: 27px; height: 27px; border: 1px solid #a7832f; border-radius: 50%; font-size: .8rem; font-weight: 800; }
.subscription-access-copy { min-width: 0; }
.subscription-access-copy strong, .subscription-access-copy > span { display: block; }
.subscription-access-copy strong { font-size: .78rem; }
.subscription-access-copy > span { margin-top: 2px; color: #e0c87e; font-size: .72rem; line-height: 1.45; }
.subscription-access-copy time { color: #fff0b3; font-weight: 800; white-space: nowrap; }
.subscription-access-action { flex: 0 0 auto; margin-left: auto; color: #ffe9a9; font-size: .71rem; font-weight: 700; white-space: nowrap; }

/* Shared content */
.page { display: none; }
.page.active { display: block; animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: .35; transform: translateY(3px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-heading.split { align-items: center; }
.page-heading h1 { margin: 0; font-size: 1.48rem; font-weight: 600; letter-spacing: -.01em; }
.page-heading p { max-width: 800px; margin: 5px 0 0; color: #8ba8bd; font-size: .83rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.stat-card > span { display: block; color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.stat-card strong { display: inline-block; margin-top: 7px; font-size: 1.65rem; font-weight: 600; line-height: 1; }
.stat-card small { margin-left: 7px; color: #6d8ea6; font-size: .7rem; }
.card, .data-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.card { padding: 18px; }
.card > h2, .card-heading h2 { margin: 0; font-size: .93rem; font-weight: 600; }
.card > p, .card-heading p { margin: 7px 0 0; color: #8ba8bd; font-size: .78rem; }
.data-card { margin-top: 18px; overflow: hidden; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); }
.card-heading a { flex: 0 0 auto; font-size: .76rem; font-weight: 600; }
.table-scroll { overflow-x: auto; }
th { padding: 10px 12px; color: #6d8ea6; background: var(--surface-soft); font-size: .64rem; font-weight: 700; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
td { padding: 12px; border-top: 1px solid #16304a; color: #a8c2d4; font-size: .76rem; vertical-align: middle; }
tbody tr:hover td { background: #0e2233; }
.cell-title { color: var(--text); font-size: .82rem; font-weight: 600; }
.cell-meta { display: block; margin-top: 2px; color: #6d8ea6; font-family: var(--mono); font-size: .69rem; }
.cell-mono { color: #9ce7be; font-family: var(--mono); font-size: .68rem; overflow-wrap: anywhere; }
.empty-cell, .empty-state { padding: 28px 18px; color: #6d8ea6; font-size: .8rem; text-align: center; }
.card-footnote { padding: 10px 18px; border-top: 1px solid #16304a; background: var(--surface-soft); color: #8ba8bd; font-size: .7rem; line-height: 1.55; }
.card-footnote.inset { margin: 14px -18px -18px; }
.workspace-kicker { color: var(--accent-soft); font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.status, .home-status, .health-badge { display: inline-block; padding: 5px 8px; border-radius: 999px; font-size: .63rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.status.verified, .home-status.active, .health-badge.ok { background: #103b2d; color: #78efba; }
.status.pending, .home-status.in_review, .home-status.approved, .home-status.draft, .home-status.paused { background: #3b3016; color: #f5d47a; }
.home-status.archived, .home-status.completed { background: #1c2733; color: #8ba8bd; }
code { color: #9ce7be; font-family: var(--mono); font-size: .75rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.notice, #error, #site-error { margin: 14px 0; padding: 11px 13px; border: 1px solid #1c4a3f; border-radius: 9px; background: #0c231f; color: #9ae8c8; font-size: .76rem; line-height: 1.55; }
.notice.failure, #error, #site-error { border-color: #4a2331; background: #2a1520; color: #ffc0cd; }
.copy { margin: 10px 0 0; padding: 7px 10px; font-size: .72rem; }

/* Domain setup */
.domain-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.setup-rail { overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.setup-rail-title { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); color: #6d8ea6; font-size: .63rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.setup-rail ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 5px 0; list-style: none; }
.setup-rail li { display: grid; grid-template-columns: 25px 1fr; gap: 9px; padding: 9px 12px; border-left: 2px solid transparent; }
.setup-rail li.current { border-left-color: var(--accent); background: #0e2233; }
.setup-rail li > span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #31526b; border-radius: 50%; color: #7fa0b8; font-size: .65rem; font-weight: 700; }
.setup-rail li.current > span { border-color: var(--accent); background: #12314a; color: #7cdbff; }
.setup-rail b, .setup-rail small { display: block; }
.setup-rail b { color: #dbe9f5; font-size: .77rem; }
.setup-rail small { margin-top: 2px; color: #6d8ea6; font-size: .67rem; }
.domain-workspace { min-width: 0; }
.setup-domain-tabs { display: flex; gap: 6px; max-width: 100%; margin-bottom: 16px; padding: 4px 3px 10px; overflow-x: auto; scrollbar-width: thin; }
.setup-domain-tab { display: flex; flex: 0 0 auto; flex-direction: column; justify-content: center; gap: 4px; min-width: 150px; max-width: 260px; min-height: 60px; padding: 11px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-soft); text-align: left; }
.setup-domain-tab:hover:not(:disabled) { background: #102a3e; border-color: var(--border-strong); }
.setup-domain-tab[aria-selected="true"] { border-color: var(--accent); background: #102a3e; color: #dff5ff; box-shadow: inset 0 -3px var(--accent); }
.setup-domain-tab strong, .setup-domain-tab small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-domain-tab strong { font-size: .8rem; }
.setup-domain-tab small { color: var(--muted); font-size: .7rem; font-weight: 400; }
.setup-domain-new { flex-direction: row; align-items: center; gap: 8px; min-width: 145px; }
.setup-domain-new > span { font-size: 1.2rem; }
.setup-domain-tab:focus-visible, .domain-workspace [role="tabpanel"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.domain-workspace [role="tabpanel"][hidden] { display: none; }
#setup-panel-new > .setup-block { margin-top: 0; }
.setup-block { margin-top: 12px; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.domain-workspace > .setup-block:first-child { margin-top: 0; }
.setup-block > summary { display: flex; align-items: center; gap: 12px; margin: 0; padding: 15px 18px; list-style: none; cursor: pointer; }
.setup-block > summary::-webkit-details-marker { display: none; }
.setup-block > summary::after { content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.setup-block[open] > summary::after { transform: rotate(225deg); }
.setup-block > summary:hover { background: #10263a; }
.setup-block > summary > span:not(.setup-number) { min-width: 0; }
.setup-block > summary strong, .setup-block > summary small { display: block; overflow-wrap: anywhere; }
.setup-block > summary strong { color: var(--text); font-size: .86rem; }
.setup-block > summary small { margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.setup-number { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border: 1px solid #31526b; border-radius: 50%; background: #102a3e; color: var(--accent-soft); font-size: .75rem; font-weight: 700; }
.setup-body { padding: 18px; border-top: 1px solid var(--border-soft); }
.setup-body > :first-child { margin-top: 0; }
.setup-body > :last-child { margin-bottom: 0; }
.setup-body .ecosystem-grid { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.ga4-guide-block { margin-top: 20px; }
.ga4-guide-block > .guide-grid { margin-top: 0; }
.form-card { padding: 20px; }
.form-card h2 { margin-top: 4px; font-size: 1.02rem; }
.form-card > p { max-width: 680px; }
.site-form { display: grid; grid-template-columns: 1fr 1.35fr auto; gap: 14px; align-items: end; margin-top: 17px; }
.site-form input { margin-bottom: 0; }
.site-form button { min-height: 39px; white-space: nowrap; }
.form-help { margin: 17px 0 0 !important; padding-top: 14px; border-top: 1px solid var(--border-soft); color: #6d8ea6 !important; font-size: .73rem !important; }
.sites-card { margin-top: 16px; }
#sites > .site { padding: 18px; border-top: 1px solid var(--border-soft); }
#sites > .site:first-child { border-top: 0; }
#sites > .site > b { font-size: .92rem; }
#sites > .site > small { color: #6d8ea6; font-family: var(--mono); font-size: .72rem; }
.site-actions { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.guide-grid, .dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 18px; margin-top: 20px; }
.steps { display: grid; gap: 1px; margin: 16px 0 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--border-soft); list-style: none; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 12px 14px; background: var(--surface-soft); color: #c5d9e8; font-size: .76rem; line-height: 1.55; }
.steps li > b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #12314a; color: #7cdbff; font-size: .67rem; }
#ga4-guide code { display: inline; padding: 1px 5px; border-radius: 4px; background: #10263a; }

/* Operational ecosystem */
.ecosystem { margin: 16px 0; padding: 14px; border: 1px solid #294d66; border-radius: 11px; background: #091725; }
.ecosystem-heading, .integration-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ecosystem-heading span, .ecosystem-item span, .integration-summary p { display: block; margin: 3px 0 0; color: #8ba8bd; font-size: .7rem; }
.ecosystem-grid { display: grid; grid-template-columns: repeat(5, minmax(116px, 1fr)); gap: 8px; margin-top: 12px; }
.ecosystem-item { display: flex; gap: 8px; min-height: 63px; padding: 10px; border: 1px solid #243f54; border-radius: 9px; background: var(--surface); }
.ecosystem-item b { font-size: .72rem; }
.ecosystem-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px !important; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px #3b3016; }
.ecosystem-item.ok .ecosystem-dot { background: var(--success); box-shadow: 0 0 0 3px #103b2d; }
.ecosystem-item.error .ecosystem-dot { background: var(--danger); box-shadow: 0 0 0 3px #3a1c27; }
.gtm-integration { margin: 10px 0 14px; padding: 15px; border: 1px solid #2c506b; border-radius: 11px; background: var(--surface-soft); }
.gtm-integration > b { color: var(--accent-soft); }
.gtm-integration p { font-size: .76rem; }
.gtm-integration button { margin: 4px 8px 4px 0; }
.gtm-integration.complete { border-color: #25624d; background: #0b201d; }
.setup-details { margin-top: 15px; padding: 12px 15px; border: 1px solid #25455d; border-radius: 10px; }
details { margin: 12px 0; }
summary { color: #bfe7ff; font-size: .78rem; font-weight: 600; cursor: pointer; }

/* Experience management */
.dashboard-grid .card { min-width: 0; }
.dashboard-grid .card-heading { margin: -18px -18px 5px; }
.usage-card .card-heading p { margin: 4px 0 0; color: #8ba8bd; font-size: .72rem; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.usage-item { padding: 12px; border: 1px solid #22384a; border-radius: 10px; background: #101c27; }
.usage-item > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.usage-item span { color: #91aec3; font-size: .72rem; }
.usage-item b { color: #e6f3fb; font-size: .78rem; white-space: nowrap; }
.usage-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: #22384a; }
.usage-track i { display: block; height: 100%; border-radius: inherit; background: #3fc48d; }
.usage-item.at-limit .usage-track i { background: #efb84b; }
#active-tests .site, #active-personalizations .site, #manage-experiences .site { padding: 13px 0; border-top: 1px solid #203d54; }
#active-tests .site:first-child, #active-personalizations .site:first-child { border-top: 0; }
.manage-card { margin-top: 18px; }
#manage-experiences { padding: 0 18px 18px; }
#manage-experiences .site { display: grid; grid-template-columns: minmax(190px, 1fr) auto; gap: 6px 18px; }
#manage-experiences .site > small, #manage-experiences .site > code, #manage-experiences .site > .flow-error { grid-column: 1; }
#manage-experiences .manage-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.manage-actions button { margin: 0; padding: 8px 11px; font-size: .74rem; }

/* Onboarding */
.experience-workspace { margin-top: 0; padding: 0; overflow: hidden; }
.workspace-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 17px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(120deg, #102a42, var(--surface) 65%); }
.workspace-heading h2 { margin: 4px 0 0; font-size: 1rem; }
.workspace-heading p { margin: 4px 0 0; font-size: .76rem; }
.experience-list { padding: 0 20px 20px; }
.experience-card { margin-top: 18px; padding: 19px; border: 1px solid #2c506b; border-radius: 12px; background: var(--surface-soft); box-shadow: 0 14px 35px #0003; }
.experience-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.experience-card h3 { margin: 0 0 5px; font-size: 1rem; }
.experience-summary { color: #91aec3; font-size: .76rem; line-height: 1.5; }
.lifecycle-pill { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: #17314a; color: #bfe7ff; font-size: .65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.lifecycle-pill.live { background: #103b2d; color: #78efba; }
.lifecycle-pill.paused { background: #3b3016; color: #f5d47a; }
.approval-stepper { display: grid; grid-template-columns: repeat(5, minmax(105px, 1fr)); margin: 22px 0 18px; overflow-x: auto; }
.approval-step { position: relative; min-width: 105px; padding-right: 10px; color: #718da3; }
.approval-step:not(:last-child)::after { position: absolute; top: 12px; right: 0; left: 29px; height: 2px; background: #223f55; content: ""; }
.approval-step.complete:not(:last-child)::after { background: #35b989; }
.step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; margin-bottom: 8px; border: 2px solid #31526b; border-radius: 50%; background: var(--surface-soft); color: #718da3; font-size: .68rem; font-weight: 700; }
.approval-step.complete .step-dot { border-color: #35b989; background: #103b2d; color: #78efba; }
.approval-step.current .step-dot { border-color: var(--accent); box-shadow: 0 0 0 4px #123c554d; color: #7cdbff; }
.step-title { color: #abc3d5; font-size: .72rem; font-weight: 700; }
.approval-step.complete .step-title, .approval-step.current .step-title { color: var(--text); }
.step-detail { display: block; min-height: 32px; margin-top: 4px; padding-right: 7px; color: #718da3; font-size: .64rem; line-height: 1.38; }
.preview-block { margin: 0 0 17px; padding: 15px; border: 1px solid #1f4a63; border-radius: 10px; background: #0c2233; }
.preview-title { margin-bottom: 9px; color: var(--accent-soft); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.preview-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 9px; }
.preview-link { display: inline-block; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #17314a; color: #cde5f6; font-size: .74rem; font-weight: 600; }
.preview-meta { color: #8ba8bd; font-size: .71rem; }
.preview-regenerate, .preview-screenshots { margin: 10px 0 0 8px; padding: 7px 10px; font-size: .72rem; }
.preview-shots { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.preview-shot { max-width: 220px; margin: 0; }
.preview-shot img { display: block; width: 100%; border: 1px solid #2c506b; border-radius: 8px; }
.preview-shot small { display: block; margin-top: 5px; color: #8ba8bd; font-size: .68rem; }
.experience-action-row { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid #203d54; }
.experience-action { min-width: 190px; }
.experience-action-note { color: #8ba8bd; font-size: .73rem; }
.published-cta { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border-radius: 9px; background: #103b2d; color: #78efba; font-size: .78rem; font-weight: 700; }
.flow-error { margin-top: 11px; padding: 10px 12px; border-radius: 8px; background: #3a1c27; color: #ffc0cd; font-size: .75rem; }

/* Logs and tokens */
.logs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.logs-layout .data-card { margin-top: 0; }
.sticky-card { position: sticky; top: 145px; }
.governance-log { max-height: 610px; overflow-y: auto; padding: 0 18px 12px; }
.log-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 11px; align-items: start; padding: 13px 0; border-top: 1px solid #203d54; }
.log-row:first-child { border-top: 0; }
.log-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #123c55; }
.log-row b { display: block; font-size: .79rem; }
.log-context { display: block; margin-top: 3px; color: #8eabc0; font-size: .72rem; }
.log-row time { color: #718da3; font-family: var(--mono); font-size: .67rem; white-space: nowrap; }
#tokens-list { padding: 0 18px; }
.token-card { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(260px, 1.3fr) auto; gap: 8px 20px; padding: 15px 0; border-top: 1px solid #203d54; }
.token-card:first-child { border-top: 0; }
.token-card > code { grid-column: 2; grid-row: 1 / span 3; }
.token-card > .manage-actions { grid-column: 3; grid-row: 1 / span 3; align-self: center; }
.token-card > .notice { grid-column: 1 / -1; }
.token-meta { margin-top: 3px; color: #8ba8bd; font-size: .71rem; }

@media (max-width: 1180px) {
  .topbar-main { flex-wrap: wrap; }
  .tenant-copy small { max-width: 180px; }
  .app-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .ecosystem-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .site-form { grid-template-columns: 1fr 1fr; }
  .site-form button { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 880px) {
  .billing-grid { grid-template-columns: 1fr; }
  .billing-plan-card { position: static; }
  .topbar { position: relative; }
  .topbar-main { gap: 10px; padding: 10px 16px; }
  .product-lockup { min-width: 0; }
  .tenant-chip { order: 3; width: 100%; border-radius: 9px; }
  .tenant-copy small { max-width: none; }
  .icon-button { display: block; }
  .topbar-actions { margin-left: 0; }
  .account-meta, #header-validate { display: none; }
  .healthbar, .health-detail { padding-left: 16px; padding-right: 16px; }
  .health-detail { margin-left: 0; margin-right: 0; }
  .app-layout { display: block; }
  .sidebar { display: none; position: relative; top: 0; min-height: 0; padding: 14px 16px 18px; border-right: 0; border-bottom: 1px solid var(--border); background: #081522; }
  #app.nav-open .sidebar { display: block; }
  #sidebar-toggle { display: none; }
  #nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-card, .sidebar-note { display: none; }
  #pages { padding: 22px 18px 55px; }
  .subscription-access-banner { position: static; margin: 0 0 18px; }
  .domain-layout, .logs-layout { grid-template-columns: 1fr; }
  .setup-rail { position: static; }
  .setup-rail ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sticky-card { position: static; }
  .guide-grid, .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .billing-shell { width: min(100% - 24px, 1020px); margin-top: 24px; }
  .billing-heading { align-items: flex-start; flex-direction: column; }
  .billing-journey { padding: 14px 10px 15px; }
  .billing-journey-heading { align-items: flex-start; flex-direction: column; gap: 4px; margin-bottom: 13px; padding: 0 3px; }
  .billing-journey ol { gap: 3px; }
  .billing-journey li { display: flex; flex-direction: column; gap: 6px; text-align: center; }
  .billing-journey li:not(:last-child)::after { top: 13px; right: -5px; left: calc(50% + 15px); }
  .billing-journey-marker { width: 27px; height: 27px; box-shadow: 0 0 0 3px #0b1a27; }
  .billing-journey-copy { width: 100%; padding: 0 1px; background: transparent; }
  .billing-journey-copy strong { font-size: .61rem; }
  .billing-journey-copy small { display: none; }
  .billing-card { padding: 19px; }
  .billing-payment-header { align-items: flex-start; flex-direction: column; }
  .billing-payment-provider { width: 100%; min-width: 0; }
  .billing-card-form { grid-template-columns: 1fr; }
  .billing-field-wide, .billing-progress { grid-column: auto; }
  .environment, .tenant-copy small { display: none; }
  .topbar-actions { margin-left: auto; }
  .health-summary { display: none; }
  .healthbar { padding-top: 2px; }
  #pages { padding: 20px 14px 45px; }
  .subscription-access-banner { align-items: flex-start; flex-wrap: wrap; }
  .subscription-access-copy { flex: 1 1 calc(100% - 42px); }
  .subscription-access-action { width: 100%; margin-left: 39px; }
  .subscription-plan-summary { grid-template-columns: 1fr; }
  #nav { grid-template-columns: 1fr; }
  .page-heading, .page-heading.split, .card-heading, .experience-card-header, .experience-action-row, .ecosystem-heading, .integration-summary { align-items: flex-start; flex-direction: column; }
  .page-heading.split button { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 12px; }
  .stat-card small { display: block; margin: 4px 0 0; }
  .setup-rail ol { grid-template-columns: 1fr 1fr; }
  .site-form { grid-template-columns: 1fr; }
  .site-form button { grid-column: auto; width: 100%; }
  .ecosystem-grid { grid-template-columns: 1fr; }
  #manage-experiences .site { display: block; }
  .approval-stepper { grid-template-columns: 1fr; gap: 0; overflow: visible; }
  .approval-step { min-width: 0; min-height: 60px; padding-left: 40px; }
  .approval-step:not(:last-child)::after { top: 26px; right: auto; bottom: 0; left: 12px; width: 2px; height: auto; }
  .step-dot { position: absolute; top: 0; left: 0; }
  .experience-action, .experience-action-row > button { width: 100%; min-width: 0; margin-left: 0; }
  .log-row { grid-template-columns: 12px 1fr; }
  .log-row time { grid-column: 2; }
  .token-card { display: block; }
  .token-card > * { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .session-spinner { animation: none; border-top-color: #264963; background: var(--accent-soft); }
}
