:root {
  color-scheme: light;
  --bg: #f8faff;
  --ink: #0a1534;
  --muted: #495672;
  --soft: #5d6b8d;
  --line: #dce3f2;
  --line-soft: #e8edf8;
  --panel: #ffffff;
  --wash: #f2f6ff;
  --blue: #1739b9;
  --blue-mid: #3858c6;
  --blue-light: #6386ff;
  --blue-tint: #dae4ff;
  --ok: #17734f;
  --ok-bg: #e5f6ee;
  --warn: #8a5a0b;
  --warn-bg: #fff2d9;
  --danger: #b0262d;
  --shadow: 0 8px 22px #1d3d7d0d, inset 0 1px #fff;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--blue-mid); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: 12px; left: 12px; z-index: 5; padding: 10px 14px; background: #fff; transform: translateY(-200%); border-radius: 6px; }
.skip:focus { transform: translateY(0); }
.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100dvh; }

/* Sidebar: the dark ink of the website's product window */
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; padding: 22px 14px 16px; color: #fff; background: linear-gradient(170deg, #162a5c 0%, #0f2049 40%, #0a1534 100%); }
.sidebar :focus-visible { outline-color: #9db4ff; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 6px 30px; }
.brand img { border-radius: 9px; }
.brand strong, .brand small, .operator strong, .operator small { display: block; }
.brand strong { font-size: 18px; font-weight: 720; letter-spacing: -.04em; }
.brand small { margin-top: 2px; color: #a9b9e6; font: 650 10px/1.3 var(--mono); letter-spacing: .1em; }
.sidebar nav { display: grid; gap: 4px; }
.nav-current, .nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; }
.nav-current { color: #fff; border-color: #ffffff2e; background: #ffffff1a; box-shadow: inset 0 1px 0 #ffffff26; }
.nav-item { color: #c3d0f2; }
.nav-item:hover { color: #fff; background: #ffffff12; }
.icon-overview::before { content: ''; position: absolute; inset: 2px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-overview::after { content: ''; position: absolute; inset: 5px; border-left: 1px solid currentColor; border-top: 1px solid currentColor; }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.site-link { display: flex; align-items: center; justify-content: space-between; padding: 10px; border-radius: 8px; color: #a9b9e6; font-size: 13px; }
.site-link:hover { color: #fff; background: #ffffff12; }
.operator { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 14px 4px 1px; border-top: 1px solid #ffffff1f; }
.operator-copy { min-width: 0; }
.operator strong { font-size: 12px; }
.operator small { margin-top: 3px; overflow: hidden; color: #a9b9e6; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.operator-avatar { background: #ffffff24; color: #fff; }

/* Top bar */
main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 10px clamp(20px, 3.4vw, 54px); gap: 10px; border-bottom: 1px solid var(--line); background: #f8fafff2; backdrop-filter: blur(18px); }
.breadcrumb, .top-actions { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 13px; color: var(--soft); }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.connection { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid #f0d9a4; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font: 650 11px/1.3 var(--mono); letter-spacing: .04em; white-space: nowrap; }
.connection > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connection.live { color: var(--ok); border-color: #b5e3cd; background: var(--ok-bg); }
.content { max-width: 1480px; margin: 0 auto; padding: 40px clamp(20px, 3.4vw, 54px) 56px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 28px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(34px, 4.6vw, 54px); line-height: .99; letter-spacing: -.07em; font-weight: 760; }
.page-heading p { color: var(--muted); font-size: 15px; margin-top: 10px; line-height: 1.5; }

/* Buttons, shaped like the website's */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 680; white-space: nowrap; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: #aebfee; box-shadow: 0 4px 10px #1739b91b; }
.button:active:not(:disabled) { transform: none; }
.button:disabled { color: #8b96b3; background: var(--wash); border-color: var(--line-soft); }
.button-small { min-height: 34px; font-size: 12px; }
.button-primary { color: #fff; border-color: #102d9e; background: linear-gradient(135deg, #3659e8 0%, #183dbd 55%, #1233a8 100%); box-shadow: 0 4px 12px #193eaa40, inset 0 1px 0 #ffffff42; }
.button-primary:hover:not(:disabled) { border-color: #102d9e; background: linear-gradient(135deg, #4167f4, #1735a6); box-shadow: 0 6px 18px #193eaa52, inset 0 1px 0 #ffffff4c; }
.refresh-icon { font-size: 19px; line-height: 1; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { position: relative; min-width: 0; min-height: 160px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, #fff 0%, #fff 55%, #f5f8ff 100%); box-shadow: var(--shadow); }
.metric-primary { isolation: isolate; overflow: hidden; border-color: #102d9e; color: #fff; background: linear-gradient(150deg, #3659e8 0%, #183dbd 52%, #0f2a8c 100%); }
.metric-primary::before { content: ""; position: absolute; z-index: -1; right: -40%; top: -60%; width: 90%; height: 160%; background: radial-gradient(closest-side, #8eaaf7aa, transparent); }
.metric-top { display: flex; justify-content: space-between; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 620; }
.metric-icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 15px; font-weight: 640; }
.metric-icon.blue { background: #ffffff26; color: #fff; }
.metric-icon.lilac { background: #ece8ff; color: #5b3fc0; }
.metric-icon.green { background: var(--ok-bg); color: var(--ok); }
.metric-icon.amber { background: var(--warn-bg); color: var(--warn); }
.metric strong { display: block; width: fit-content; margin-top: 16px; font-size: 56px; line-height: 1; letter-spacing: -.07em; font-weight: 760; font-variant-numeric: tabular-nums; }
.metric-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; }
.metric-rate { padding: 2px 7px; border-radius: 6px; color: var(--ok); background: var(--ok-bg); font: 700 11px/1.5 var(--mono); }
.metric > small { display: block; margin-top: 10px; color: var(--soft); font-size: 12px; line-height: 1.4; }
.metric-primary :is(.metric-top, small) { color: #dbe5ff; }
.metric-meter { display: block; width: 100%; height: 6px; margin-top: 12px; appearance: none; border: 0; border-radius: 999px; background: #e3ebf8; }
.metric-meter::-webkit-meter-bar { height: 6px; border: 0; border-radius: 999px; background: #e3ebf8; }
.metric-meter::-webkit-meter-optimum-value { border-radius: 999px; background: var(--blue); }
.metric-meter::-moz-meter-bar { border-radius: 999px; background: var(--blue); }
[data-metrics="loading"] .metric strong { width: 2ch; border-radius: 8px; color: transparent; background: #e8edf8; }
[data-metrics="loading"] .metric-primary strong { background: #ffffff33; }

/* Onboarding overview as an editing timeline */
.overview-panel { margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, #fff 0%, #fff 55%, #f5f8ff 100%); box-shadow: var(--shadow); }
.overview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.overview-heading h2 { font-size: 22px; font-weight: 740; letter-spacing: -.05em; }
.overview-heading p { margin-top: 4px; color: var(--soft); font-size: 13px; }
.overview-link { color: var(--blue); font-size: 13px; font-weight: 680; white-space: nowrap; }
.overview-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.overview-content { margin-top: 22px; }
.overview-state { padding-block: 16px; color: var(--muted); font-size: 13px; }
.overview-bars { position: relative; display: grid; gap: 14px; padding-top: 28px; }
.overview-bars::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px; background: repeating-linear-gradient(90deg, #8ea3d8 0 1px, transparent 1px 10%) 0 100% / 100% 8px no-repeat, repeating-linear-gradient(90deg, #c3cfec 0 1px, transparent 1px 2%) 0 100% / 100% 4px no-repeat; }
.overview-bars::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--done, 0) * 1%); width: 2px; margin-left: -1px; background: var(--ink); pointer-events: none; }
.overview-row-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 560; }
.overview-row-label strong { position: relative; z-index: 1; padding-left: 6px; color: var(--ink); background: #fbfcff; font: 650 12px/1.5 var(--mono); }
.overview-track { height: 34px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); }
.overview-fill { display: block; width: 0; height: 100%; border-radius: 7px; background: linear-gradient(135deg, #3659e8 0%, #183dbd 60%, #1233a8 100%); box-shadow: inset 0 1px 0 #ffffff42; }
.overview-fill-muted { background: repeating-linear-gradient(135deg, #dae4ff 0 6px, #cbd9fb 6px 12px); box-shadow: inset 0 0 0 1px #aebfee; }

#directory-title, #dashboard { scroll-margin-top: 78px; }
.icon { position: relative; display: inline-block; width: 17px; height: 17px; color: inherit; flex: none; }
.icon-users::before, .icon-users::after, .icon-search::before, .icon-search::after { position: absolute; content: ""; }
.icon-users::before { inset: 0 5px auto; height: 6px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-users::after { inset: auto 2px 1px; height: 5px; border: 1.5px solid currentColor; border-radius: 7px 7px 3px 3px; }
.icon-search::before { top: 1px; left: 1px; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-search::after { right: 0; bottom: 2px; width: 6px; height: 1.5px; background: currentColor; transform: rotate(45deg); border-radius: 2px; }

/* Directory */
.directory { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.directory-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 22px 24px; }
.directory h2 { font-size: 22px; letter-spacing: -.05em; font-weight: 740; }
.directory-top p { margin-top: 4px; color: var(--soft); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search, .select { display: flex; align-items: center; min-height: 40px; padding: 0 12px; gap: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--soft); background: var(--bg); }
.search:focus-within, .select:focus-within { border-color: var(--blue-mid); outline: 3px solid #6386ff40; outline-offset: 0; }
.search input, .select select { min-height: 38px; outline: 0; border: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search input { width: min(210px, 100%); min-width: 0; }
.search input::placeholder { color: var(--soft); }
.select select { padding: 0 2px; }
.table-wrap { overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -2px; }
table { width: 100%; min-width: 625px; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-top: 1px solid var(--line-soft); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
thead { background: var(--wash); }
th { color: #405894; font: 650 10px/1.4 var(--mono); letter-spacing: .1em; }
td { height: 60px; color: var(--muted); font-size: 13px; }
tbody tr:is(:hover, :focus-within) { background: #f5f8ff; }
tbody tr:is(:hover, :focus-within) td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-email { overflow: hidden; max-width: clamp(155px, 23vw, 325px); color: var(--ink); font-size: 13px; font-weight: 640; text-overflow: ellipsis; }
.avatar { display: grid; flex: none; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 11px; font-weight: 760; letter-spacing: .03em; }
.tone-0 { background: linear-gradient(145deg, #f8faff, #dce6ff); color: #1c3cac; box-shadow: inset 0 0 0 1px #bccfff; }
.tone-1 { background: #ece8ff; color: #5b3fc0; box-shadow: inset 0 0 0 1px #d4cbff; }
.tone-2 { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px #b5e3cd; }
.tone-3 { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px #f0d9a4; }
.tone-4 { background: #fde8f0; color: #a02c5f; box-shadow: inset 0 0 0 1px #f6c4d8; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border: 1px solid #f0d9a4; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 680; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.complete { border-color: #b5e3cd; background: var(--ok-bg); color: var(--ok); }
.table-state { padding: 44px 20px; border-top: 1px solid var(--line-soft); color: var(--muted); background: var(--wash); text-align: center; font-size: 14px; }
.table-state .button { margin-top: 12px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 24px; border-top: 1px solid var(--line-soft); color: var(--soft); background: var(--wash); font-size: 12px; }
.paging { display: flex; gap: 7px; }


/* Account drawer */
.details { position: fixed; inset: 0 0 0 auto; width: min(100%, 480px); max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: -22px 0 60px #0c268533; }
.details::backdrop { background: #0a153473; backdrop-filter: blur(2px); }
.detail-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 21px 24px; border-bottom: 1px solid var(--line); background: #f8fafff2; backdrop-filter: blur(18px); }
.detail-header span { color: var(--blue); font: 650 10px/1.4 var(--mono); letter-spacing: .12em; }
.detail-header h2 { margin-top: 4px; font-size: 26px; letter-spacing: -.06em; font-weight: 750; }
.close { min-width: 38px; min-height: 38px; padding: 0; font-size: 23px; font-weight: 400; }
.detail-body { padding: 24px; overflow-wrap: anywhere; }
.detail-body > p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.detail-identity { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.detail-identity .avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 14px; }
.detail-identity strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.detail-identity small { color: var(--soft); font-size: 12px; }
.details dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 0; }
.details dl > div { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.details dt { color: var(--soft); font-size: 12px; }
.details dd { margin: 5px 0 0; font-size: 14px; font-weight: 680; }
.account-button { border: 0; border-radius: 4px; padding: 3px 0; color: inherit; background: transparent; text-align: left; }
.account-button:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.row-arrow { width: 33px; color: var(--soft); text-align: right; font-size: 21px; }
.grant-panel { margin: 0 24px 24px; padding: 20px; border: 1px solid #c9d8fb; border-radius: 16px; background: linear-gradient(110deg, #fff 0%, #f7f9ff 52%, #edf3ff 100%); box-shadow: 0 10px 28px #1a3c8510, inset 0 1px #fff; }
.grant-panel h3 { margin: 0; font-size: 17px; letter-spacing: -.03em; font-weight: 740; }
.grant-panel p { margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.grant-inputs { display: grid; grid-template-columns: minmax(100px, .85fr) minmax(0, 1.35fr); gap: 10px; margin: 14px 0; }
.grant-inputs label { color: var(--ink); font-size: 12px; font-weight: 680; }
.grant-inputs small { color: var(--soft); font-size: 11px; font-weight: 500; }
.grant-inputs input { display: block; width: 100%; min-height: 40px; margin-top: 5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 13px; }
.grant-inputs input:focus { border-color: var(--blue-mid); outline: 3px solid #6386ff40; outline-offset: 0; }
.grant-actions { display: flex; gap: 8px; margin-top: 12px; }
#grant-message { margin-top: 12px; color: var(--ok); font-weight: 650; }
#grant-message.error { color: var(--danger); }

/* Responsive */
@media (max-width: 1100px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .layout { grid-template-columns: 184px minmax(0, 1fr); } .sidebar { padding-inline: 12px; } }
@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar { position: static; flex-direction: row; align-items: center; justify-content: space-between; height: auto; padding: 10px 16px; }
  .brand { margin: 0; }
  .sidebar nav { display: flex; gap: 3px; }
  .nav-current, .nav-item { min-height: 35px; padding-inline: 9px; }
  .sidebar-bottom { display: none; }
  .topbar { min-height: 47px; padding-inline: 16px; }
  .content { padding: 22px 14px 28px; }
  .metrics { gap: 8px; }
  .metric { min-height: 126px; padding: 14px; border-radius: 14px; }
  .metric-top { font-size: 11px; }
  .metric-icon { display: none; }
  .metric strong { font-size: 38px; margin-top: 10px; }
  .metric > small { font-size: 11px; }
  .directory-top, .table-footer { padding-inline: 14px; }
  .overview-panel { padding: 16px; }
}
@media (max-width: 370px) {
  .page-heading { align-items: start; }
  .page-heading p { font-size: 12px; }
  .filters { width: 100%; }
  .search { flex: 1; min-width: 0; }
  .select { padding-inline: 5px; }
  .select select { max-width: 100px; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } .button:hover:not(:disabled) { transform: none; } }

/* ---------- Fluid pass ---------- */
:root { --ease: cubic-bezier(.22, .8, .24, 1); }
html { scroll-behavior: smooth; }
.content { padding: clamp(22px, 3vw, 44px) clamp(14px, 3.4vw, 54px) clamp(28px, 4vw, 56px); }
.metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: clamp(8px, 1.1vw, 14px); }
.metric { min-height: clamp(124px, 12vw, 160px); padding: clamp(14px, 1.6vw, 22px); }
.metric strong { font-size: clamp(36px, 4vw, 56px); margin-top: clamp(10px, 1.2vw, 16px); }
.metric, .overview-panel, .directory { transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.metric:not(.metric-primary):hover { border-color: #b5c8fa; box-shadow: 0 14px 30px #26499414, inset 0 1px #fff; }

/* Calmer labels: Inter instead of monospace in dense UI */
th { font: 620 12px/1.4 Inter, -apple-system, sans-serif; letter-spacing: 0; color: var(--soft); }
.connection { font: 650 12px/1.3 Inter, -apple-system, sans-serif; letter-spacing: 0; }
.brand small { font: 500 12px/1.3 Inter, -apple-system, sans-serif; letter-spacing: 0; }
.detail-header span { font: 600 12px/1.4 Inter, -apple-system, sans-serif; letter-spacing: 0; }
.overview-row-label strong { font: 650 12px/1.5 Inter, -apple-system, sans-serif; font-variant-numeric: tabular-nums; }

/* Timeline: bars and playhead glide to their value */
.overview-fill { transition: width .8s var(--ease); }
.overview-bars::after { transition: left .8s var(--ease); }
.metric-meter::-webkit-meter-optimum-value { transition: width .8s var(--ease); }

/* Rows feel clickable */
tbody tr { cursor: pointer; transition: background-color .15s ease; }
tbody tr td:first-child { transition: box-shadow .15s ease; }
.row-arrow { transition: transform .2s var(--ease), color .2s ease; }
tbody tr:is(:hover, :focus-within) .row-arrow { color: var(--blue); transform: translateX(3px); }
#rows tr { animation: row-in .35s var(--ease) both; }
#rows tr:nth-child(2) { animation-delay: .02s; } #rows tr:nth-child(3) { animation-delay: .04s; }
#rows tr:nth-child(4) { animation-delay: .06s; } #rows tr:nth-child(5) { animation-delay: .08s; }
#rows tr:nth-child(n + 6) { animation-delay: .1s; }
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } }

/* While fetching: soften instead of blanking */
.table-wrap, .table-footer { transition: opacity .2s ease; }
.is-busy .table-wrap, .is-busy .table-footer { opacity: .55; pointer-events: none; }
.is-busy .refresh-icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading skeleton shimmer */
[data-metrics="loading"] .metric strong { background: linear-gradient(90deg, #e8edf8 25%, #f4f7fd 50%, #e8edf8 75%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
[data-metrics="loading"] .metric-primary strong { background: linear-gradient(90deg, #ffffff26 25%, #ffffff47 50%, #ffffff26 75%) 0 0 / 200% 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Drawer slides in, backdrop fades */
.details[open] { animation: drawer-in .32s var(--ease); }
.details[open]::backdrop { animation: fade-in .25s ease; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.details dl > div { transition: border-color .2s ease; }
.grant-panel, #grant-review, #grant-message { animation: fade-in .25s ease; }

/* Mobile: table becomes stacked account cards, no sideways scrolling */
@media (max-width: 700px) {
  .directory-top { flex-direction: column; align-items: stretch; }
  .filters { width: 100%; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; }
  #table-wrap table, #table-wrap tbody { display: block; min-width: 0; }
  #table-wrap thead { display: none; }
  #rows tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 12px; padding: 14px; border-top: 1px solid var(--line-soft); }
  #rows td { height: auto; padding: 0; border: 0; white-space: normal; }
  #rows td:first-child { grid-column: 1 / -1; padding: 0; }
  #rows td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--soft); font-size: 11px; font-weight: 600; }
  #rows .row-arrow { grid-column: 3; grid-row: 1; align-self: center; }
  #rows td:first-child { grid-column: 1 / 3; }
  .user-email { max-width: 100%; }
  tbody tr:is(:hover, :focus-within) td:first-child { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Workspace navigation and account tools */
.topbar { min-height: 72px; background: linear-gradient(105deg, #fff, #f4f7ffeb); box-shadow: 0 4px 18px #193c7810; }
.topbar-context { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-label { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #d9e3fa; border-radius: 9px; color: #2144ad; background: #edf3ff; font-size: 11px; font-weight: 750; white-space: nowrap; }
.topbar-label::before { content: ''; width: 7px; height: 7px; border-radius: 3px; background: #355bea; box-shadow: 0 0 0 3px #d6e3ff; }
.breadcrumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection { box-shadow: inset 0 1px #fff9; }
.sidebar nav { gap: 5px; }
.sidebar nav a { transition: background .18s, border-color .18s, color .18s; }
.icon-codes::before, .icon-payments::before, .icon-activity::before { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 4px; font: 700 11px/1 sans-serif; }
.icon-codes::before { content: '#'; } .icon-payments::before { content: '$'; } .icon-activity::before { content: '↗'; }
.tabs { display: flex; gap: 4px; margin: 0 24px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #eaf0fc; }
.tabs button { flex: 1 0 auto; min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 650; }
.tabs button:hover { color: var(--blue); background: #ffffff80; }
.tabs button[aria-selected="true"] { color: var(--blue); background: #fff; box-shadow: 0 2px 6px #1c3d7918; }
.tabs + .detail-body, .tabs + .grant-panel, .tabs ~ .grant-panel { margin-top: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.field-grid .wide { grid-column: 1 / -1; }
.field-grid label, .inline-form label { display: block; color: var(--ink); font-size: 12px; font-weight: 680; }
.field-grid small, .inline-form small { color: var(--soft); font-weight: 500; }
.field-grid input, .field-grid select, .inline-form input, .codes-result textarea { display: block; width: 100%; min-width: 0; min-height: 42px; margin-top: 6px; padding: 8px 10px; border: 1px solid #d3def2; border-radius: 9px; color: var(--ink); background: #fff; font: inherit; font-size: 13px; }
.field-grid :is(input, select):focus, .inline-form input:focus, .codes-result textarea:focus { border-color: var(--blue-mid); outline: 3px solid #6386ff40; }
.segmented { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; color: var(--ink); font-size: 13px; }
.segmented label { display: flex; gap: 6px; align-items: center; }
.segmented input { accent-color: var(--blue); }
.inline-form { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(2, minmax(100px, 1fr)) auto; align-items: end; gap: 12px; padding: 0 24px 24px; }
.form-message { margin-top: 12px; color: var(--ok); font-size: 13px; font-weight: 650; }
.form-message.error { color: var(--danger); }
#codes-message { margin: 0 24px 18px; }
.codes-result, #batch-detail { margin: 0 24px 24px; padding: 18px; border: 1px solid #c9d8fb; border-radius: 12px; background: #f1f5ff; color: var(--muted); font-size: 13px; }
.codes-result textarea { margin-top: 12px; font-family: var(--mono); resize: vertical; }
#batch-detail { margin-top: 18px; } #batch-detail h3 { color: var(--ink); }
.grant-actions { flex-wrap: wrap; }
.button-danger { color: #a5222c; border-color: #efc6ca; background: #fff5f5; }
.button-danger:hover:not(:disabled) { border-color: #d58b92; background: #ffebed; }
.grant-panel.danger { margin: 20px 0 0; border-color: #efc6ca; background: #fff8f8; }
.history-group { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.history-group h3, #history-body > h3 { margin: 0 0 10px; font-size: 15px; }
.history-summary, .history-empty { color: var(--soft); font-size: 13px; }
.history-entry { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.history-entry strong, .history-entry small { display: block; overflow-wrap: anywhere; }
.history-entry small { color: var(--soft); margin-top: 3px; }
.metric-lines strong { font-size: clamp(24px, 2.7vw, 40px); }
#payments table, #codes table { min-width: 760px; }
#payments tbody tr { cursor: default; }
@media (max-width: 700px) {
 .sidebar { flex-wrap: wrap; gap: 10px; }
 .sidebar nav { width: 100%; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
 .sidebar nav a { flex: 0 0 auto; }
 .topbar { min-height: 58px; }
 .topbar-context { gap: 9px; }
 .topbar-label { font-size: 0; padding: 9px; }
 .topbar-label::before { width: 8px; height: 8px; }
 .breadcrumb { gap: 7px; }
 .inline-form { grid-template-columns: 1fr 1fr; padding: 0 14px 18px; }
 .inline-form label:first-child { grid-column: 1 / -1; }
 .inline-form button { grid-column: 1 / -1; }
 .codes-result, #batch-detail { margin-inline: 14px; }
}

/* Account history, plan badges and small tables inside the drawer */
.price-hint { margin: 0 0 10px; color: var(--soft); font-size: 12px; }
.muted { color: var(--soft); font-size: 12px; }
.strong-cell { color: var(--ink); font-weight: 650; }
.plus { color: var(--ok); }
.minus { color: var(--danger); }
.history-section { margin-top: 20px; }
.history-section h3 { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.history-empty { margin: 0; color: var(--soft); font-size: 13px; }
.mini-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
table.mini { min-width: 0; font-size: 12px; }
table.mini th:first-child, table.mini td:first-child { padding-left: 12px; }
table.mini th:last-child, table.mini td:last-child { padding-right: 12px; }
table.mini td { height: auto; white-space: normal; }
table.static tbody tr:is(:hover, :focus-within) { background: transparent; }
table.static tbody tr:is(:hover, :focus-within) td:first-child { box-shadow: none; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 680; background: var(--wash); color: var(--muted); }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-upcoming { background: var(--blue-tint); color: var(--blue); }
.badge-ended { background: var(--wash); color: var(--soft); }
.badge-revoked { background: #fde8e9; color: var(--danger); }

/* Roles: the server enforces them, the page just hides what a role cannot use */
body[data-role="viewer"] :is(#tab-credits, #tab-pro, #panel-credits, #grant-panel, #codes-form) { display: none !important; }
body[data-role="support"] :is(#codes-form, .button-small.button-danger, #revoke-panel) { display: none !important; }
body[data-role="viewer"] :is(.button-small.button-danger, #revoke-panel) { display: none !important; }

/* Login page: until you are signed in there is no sidebar, menu or page content, only the sign-in card */

/* Login page */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.gate-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: clamp(32px, 4.5vw, 64px); color: #fff; background: radial-gradient(ellipse 80% 60% at 100% 0%, #6386ff80, transparent 65%), radial-gradient(ellipse 70% 60% at 0% 100%, #1739b9, transparent 70%), linear-gradient(160deg, #0a1534 10%, #10226b 100%); }
.gate-art::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(#ffffff0d 1px, transparent 1px), linear-gradient(90deg, #ffffff0d 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse 90% 80% at 30% 40%, #000 20%, transparent 75%); pointer-events: none; }
.gate-art > * { position: relative; }
.gate-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.gate-brand img { border-radius: 11px; box-shadow: 0 6px 20px #0006; }
.gate-pitch h2 { margin: 0; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.02; letter-spacing: -.045em; font-weight: 800; }
.gate-pitch p { max-width: 36ch; margin: 18px 0 0; color: #c3d0f5; font-size: clamp(15px, 1.25vw, 17px); line-height: 1.55; }
.gate-preview { width: min(100%, 440px); padding: 14px 16px 18px; border: 1px solid #ffffff2e; border-radius: 18px; background: linear-gradient(180deg, #ffffff24, #ffffff0f); backdrop-filter: blur(10px); box-shadow: 0 30px 60px #00061f66, inset 0 1px #ffffff30; transform: rotate(-1.4deg); transform-origin: left bottom; animation: gate-float 7s ease-in-out infinite; }
.gp-bar { display: flex; gap: 6px; margin-bottom: 14px; }
.gp-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ffffff48; }
.gp-row { display: grid; grid-template-columns: 22px 1fr 44px; align-items: center; gap: 12px; padding: 8px 0; }
.gp-dot { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #8ea9ff, #3858c6); }
.gp-row b { height: 8px; width: var(--w); border-radius: 99px; background: #ffffff55; }
.gp-row em { height: 18px; border-radius: 99px; background: #6386ff66; border: 1px solid #8ea9ff66; }
.gp-chart { display: flex; align-items: flex-end; gap: 10px; height: 72px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #ffffff20; }
.gp-chart u { flex: 1; height: var(--h); border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #a8bcff, #4468e6); text-decoration: none; }
.gate-form { display: grid; place-items: center; padding: 28px; background: radial-gradient(ellipse 70% 50% at 50% 0%, #e6eeff, transparent 70%), #f8faff; overflow: auto; }
.gate-card { width: min(100%, 400px); text-align: left; }
.gate-mark { display: none; border-radius: 12px; margin-bottom: 22px; }
.gate-card h1 { margin: 0; font-size: clamp(32px, 3.2vw, 42px); letter-spacing: -.045em; line-height: 1.05; }
.gate-sub { margin: 12px 0 28px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.gate-message { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: 14px; line-height: 1.5; }
.google-button { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 20px; border: 1px solid #cfd9f0; border-radius: 14px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; text-decoration: none; box-shadow: 0 1px 2px #0a153414, 0 10px 24px #1739b914; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.google-button:hover { transform: translateY(-2px); border-color: #9db5f5; box-shadow: 0 2px 4px #0a15341a, 0 16px 34px #1739b92b; }
.google-button:active { transform: translateY(0); }
.google-button:focus-visible, #retry-session:focus-visible { outline: 3px solid #6386ff; outline-offset: 3px; }
#retry-session { width: 100%; min-height: 50px; justify-content: center; }
.gate-note { margin: 22px 0 0; color: var(--soft); font-size: 13px; line-height: 1.5; }
@keyframes gate-float { 0%, 100% { transform: rotate(-1.4deg) translateY(0); } 50% { transform: rotate(-1.4deg) translateY(-8px); } }
@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate-art { display: none; }
  .gate-mark { display: block; }
  .gate-form { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { .gate-preview { animation: none; } .google-button { transition: none; } }
