:root {
  color-scheme: light;
  --ink: #0b0f14;
  --ink-2: #06090d;
  --ink-3: #1c2530;
  --mint: #72f1b8;
  --sage: #a9b4c0;
  --sage-dim: #6f7b88;
  --accent: #0b7a55;
  --accent-contrast: #ffffff;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-elev-2: #f6f7f9;
  --bg-code: #f1f3f6;
  --border: #e6e8ec;
  --border-strong: #d5d9e0;
  --text: #0b0f14;
  --text-body: #2a313b;
  --text-muted: #5f6b7a;
  --text-dim: #98a2ae;
  --ring: rgba(11, 122, 85, 0.25);
  --warning: #94600c;
  --danger: #a23127;
  --nav-h: 80px;
  --content-w: 1120px;
  --gutter: max(24px, calc((100% - var(--content-w)) / 2));
  --radius: 16px;
  --font: "Google Sans Flex", "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; }
p { color: var(--text-muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(114, 241, 184, 0.35); }
[hidden] { display: none !important; }

/* Polign chrome */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 var(--gutter);
  background: var(--ink);
  color: #fff;
}
.topnav .brand, .footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.topnav .brand:hover, .footer-brand:hover { text-decoration: none; }
.topnav .brand svg, .footer-brand svg { width: 28px; height: 28px; display: block; }
.account-label {
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 450;
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-nav-link, .staff-action {
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 450;
}
.account-nav-link { padding: 8px 10px; }
.account-nav-link:hover { color: #fff; text-decoration: none; }
.environment {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(114, 241, 184, 0.35);
  border-radius: 999px;
  color: var(--mint);
  font: 500 0.7rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.session-action {
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font: 500 0.9rem/1 var(--font);
  white-space: nowrap;
}
.session-action:hover { background: rgba(255, 255, 255, 0.82); }
.staff-action { padding: 0 10px; border-color: transparent; background: transparent; color: var(--sage); }
.staff-action:hover { background: transparent; color: #fff; }

/* Account hero */
.account-main { min-height: 70vh; }
.account-hero {
  position: relative;
  overflow: hidden;
  padding: 86px var(--gutter) 96px;
  background: var(--ink);
  color: #fff;
}
.hero-inner { position: relative; z-index: 1; width: 100%; max-width: var(--content-w); margin: 0 auto; }
.hero-mark {
  position: absolute;
  top: 50%;
  right: max(-40px, calc((100% - var(--content-w)) / 2));
  width: min(430px, 42vw);
  color: var(--mint);
  opacity: 0.09;
  transform: translateY(-48%);
  pointer-events: none;
}
.kicker-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: var(--mint);
  font-size: 0.9rem;
  font-weight: 450;
}
.kicker-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.account-hero h1 {
  max-width: 780px;
  margin-bottom: 26px;
  font-size: clamp(2.5rem, 5.2vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.account-hero h1 span { color: var(--sage); }
.account-hero .lede { max-width: min(660px, 100%); margin: 0; color: var(--sage); font-size: 1.125rem; line-height: 1.55; }

/* Main account surface */
.account-content { width: min(var(--content-w), calc(100% - 48px)); margin: 0 auto; padding: 64px 0 96px; }
.eyebrow, .step {
  margin: 0 0 8px;
  color: var(--accent);
  font: 500 0.75rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h2 { font-size: clamp(1.6rem, 3vw, 2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1rem; font-weight: 500; }
.notice {
  margin: 0 0 20px;
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elev-2);
  color: var(--text-body);
  font-size: 0.9rem;
}
.notice.error { border-color: rgba(162, 49, 39, 0.45); background: rgba(162, 49, 39, 0.08); color: var(--danger); }

.identity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
}
.identity-bar .eyebrow { margin-bottom: 3px; }
.identity-bar h2 { font-size: 1.25rem; }
.detail { max-width: 52%; color: var(--text-muted); font: 400 0.8rem/1.5 var(--mono); overflow-wrap: anywhere; }

.panel, .organization-card, .operation-card {
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--bg-elev);
}
.panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(360px, 1.2fr);
  gap: clamp(32px, 5vw, 64px);
  margin-bottom: 56px;
  padding: clamp(28px, 4vw, 42px);
}
.panel > * { min-width: 0; }
.panel > div > p:not(.step) { margin: 12px 0 0; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading p:not(.step) { margin: 8px 0 0; }
.organizations { display: grid; gap: 22px; }
.organization-card { padding: clamp(26px, 4vw, 40px); }
.organization-title { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.organization-id { margin: 6px 0 0; color: var(--text-dim); font: 400 0.75rem/1.5 var(--mono); }

/* Forms and actions */
form { display: grid; gap: 10px; }
fieldset { min-width: 0; margin: 0 0 10px; padding: 0; border: 0; }
legend, label { font-size: 0.86rem; font-weight: 500; }
legend { margin-bottom: 10px; }
label { display: grid; gap: 5px; }
label span { color: var(--text-dim); font-weight: 400; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 112px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 46px;
  margin-top: 8px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: 500 0.95rem/1 var(--font);
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { opacity: 0.8; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button.secondary { border-color: var(--accent); background: transparent; color: var(--accent); }
button.secondary:hover { background: rgba(11, 122, 85, 0.06); opacity: 1; }
#purchase-submit { width: 100%; }
.inline-action { min-height: 38px; margin: 0; padding: 0 15px; font-size: 0.84rem; }

/* Plan choice */
.terms-version, .role, .billing-badge, .unsigned-badge, .grant-badge, .staging-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font: 500 0.7rem/1.2 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.terms-version { margin: 14px 0 0; background: rgba(11, 122, 85, 0.09); color: var(--accent); text-transform: none; letter-spacing: 0; }
.agreement-documents { display: grid; gap: 7px; margin-top: 12px; }
.agreement-document { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; }
.agreement-document a { font-weight: 500; overflow-wrap: anywhere; }
.agreement-document span { color: var(--text-dim); font: 400 0.65rem/1.45 var(--mono); overflow-wrap: anywhere; }
.purchase-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.purchase-plan { min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elev-2); }
.purchase-plan h3 { font-size: 1.1rem; font-weight: 500; }
.purchase-plan-capacity { margin: 6px 0 0; color: var(--text); font-weight: 500; }
.purchase-plan-promise { min-height: 40px; margin: 3px 0 13px; font-size: 0.78rem; line-height: 1.45; }
.billing-choices { display: grid; gap: 7px; }
.purchase-option { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 9px; min-width: 0; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); cursor: pointer; }
.purchase-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.purchase-option input { grid-row: 1 / 3; margin: 0; accent-color: var(--accent); }
.purchase-option span { color: var(--text-muted); font-size: 0.74rem; font-weight: 400; }
.purchase-option strong { min-width: 0; overflow-wrap: anywhere; font-size: 0.82rem; }
.agreement-check { display: flex; align-items: start; gap: 10px; margin-top: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev-2); }
.agreement-check input { flex: 0 0 auto; margin: 4px 0 0; accent-color: var(--accent); }
.agreement-check span { color: var(--text-body); font-weight: 400; line-height: 1.5; }
.purchase-availability { min-height: 22px; margin: 2px 0 0; font-size: 0.82rem; }

/* Billing, grants, and artifacts */
.role { background: rgba(11, 122, 85, 0.09); color: var(--accent); }
.billing-box, .grants-box, .licenses-box { margin-top: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elev-2); }
.billing-heading, .grants-heading, .grant-heading, .licenses-heading, .license-item { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.billing-badge, .unsigned-badge, .grant-badge { background: var(--bg-code); color: var(--text-muted); }
.billing-badge[data-tone="ok"], .grant-badge[data-tone="ok"] { background: rgba(11, 122, 85, 0.1); color: var(--accent); }
.billing-badge[data-tone="warning"], .grant-badge[data-tone="warning"], .staging-badge { background: rgba(148, 96, 12, 0.1); color: var(--warning); }
.billing-summary { margin: 8px 0 0; }
.billing-subscriptions { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.billing-subscriptions:empty { display: none; }
.billing-subscriptions li { display: grid; gap: 3px; padding-top: 11px; border-top: 1px solid var(--border); }
.billing-subscriptions span { color: var(--text-muted); font: 400 0.75rem/1.45 var(--mono); overflow-wrap: anywhere; }
.grants-heading p, .licenses-heading p { margin: 5px 0 0; font-size: 0.84rem; }
.commercial-grants, .license-artifacts { display: grid; gap: 13px; margin-top: 15px; }
.grant-item, .license-item { padding-top: 14px; border-top: 1px solid var(--border); }
.grant-item > p, .license-item p { margin: 6px 0; font-size: 0.84rem; }
.grant-reference, .license-item code { color: var(--text-muted); font: 400 0.7rem/1.5 var(--mono); overflow-wrap: anywhere; }
.grant-validity, .grant-boundary, .grant-empty, .license-empty { font-size: 0.8rem; }
.license-item code { display: block; max-width: 560px; }
.license-download, .grant-history-action { flex: 0 0 auto; min-height: 36px; margin: 0; padding: 0 13px; font-size: 0.78rem; }
.grant-history-action { margin-top: 7px; }
.grant-history { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 22px; }
.grant-history strong, .grant-history span { display: block; }
.grant-history span { margin-top: 2px; color: var(--text-muted); font-size: 0.75rem; }

/* Staff operations */
.capabilities { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.compact-panel, .record-panel { align-items: start; }
.operations-heading { margin: 54px 0 20px; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 760px); gap: 18px; }
.operation-card { padding: clamp(24px, 4vw, 34px); }
.operation-card > p { margin: 8px 0 20px; font-size: 0.84rem; }
.advanced-operator-toggle { justify-self: start; display: inline-flex; gap: 8px; min-height: 32px; margin: 0; padding: 0 2px; border: 0; background: transparent; color: var(--text-muted); font-size: 0.82rem; }
.advanced-operator-toggle::before { content: "›"; font-size: 1.25rem; font-weight: 400; transform: rotate(0deg); transition: transform 140ms ease; }
.advanced-operator-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.advanced-operator-toggle:hover { background: transparent; color: var(--text); opacity: 1; }
.advanced-operator-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.staff-customer-queue { display: grid; gap: 8px; }
.staff-customer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 0; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); color: var(--text); text-align: left; }
.staff-customer-row:hover { border-color: var(--accent); background: rgba(11, 122, 85, 0.035); opacity: 1; }
.staff-customer-copy { display: grid; gap: 3px; }
.staff-customer-status, .muted-copy { color: var(--text-muted); font-size: 0.8rem; }
.staff-customer-action { flex: 0 0 auto; color: var(--accent); font-size: 0.75rem; font-weight: 500; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.operation-records { display: grid; gap: 10px; }
.operation-records + .operation-records { margin-top: 24px; }
.record-title { font-size: 1.05rem; }
.operation-record { padding-top: 12px; border-top: 1px solid var(--border); }
.operation-record p { margin: 4px 0; font-size: 0.75rem; }
.operation-record code { display: block; color: var(--text-muted); font: 400 0.68rem/1.5 var(--mono); overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.small-action { min-height: 34px; margin: 0; padding: 0 12px; font-size: 0.75rem; }

/* Shared Polign footer */
.site-footer { border-top: 1px solid var(--border); padding: 64px var(--gutter) 40px; color: var(--text-muted); font-size: 0.875rem; }
.footer-inner { max-width: var(--content-w); margin: 0 auto; }
.footer-top { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; }
.footer-brand { align-self: flex-start; color: var(--text); }
.footer-links { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 32px 58px; }
.footer-links > div { display: grid; align-content: start; }
.footer-links span { margin-bottom: 14px; color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.footer-links a { margin-bottom: 10px; color: var(--text); font-size: 0.875rem; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); }
.footer-bottom a { color: var(--text-muted); }

@media (max-width: 860px) {
  :root { --nav-h: 64px; }
  .topnav { gap: 12px; }
  .account-nav-link { display: none; }
  .account-hero { padding-top: 70px; padding-bottom: 76px; }
  .hero-mark { width: 58vw; right: -10vw; }
  .account-content { padding-top: 44px; }
  .panel { grid-template-columns: 1fr; gap: 24px; }
  .purchase-options { grid-template-columns: 1fr; }
  .identity-bar { align-items: start; flex-direction: column; }
  .detail { max-width: 100%; }
  .section-heading, .grants-heading, .grant-heading, .licenses-heading, .license-item { align-items: stretch; flex-direction: column; }
  .organization-title { align-items: start; }
  .form-pair { grid-template-columns: 1fr; }
  .footer-links { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 600px) {
  .topnav { padding: 0 16px; }
  .topnav .brand span, .account-label { display: none; }
  .session-controls { gap: 7px; }
  .environment { height: 29px; padding: 0 8px; font-size: 0.62rem; }
  .session-action { min-height: 36px; padding: 0 14px; }
  .staff-action { padding: 0 5px; font-size: 0; }
  .staff-action::after { content: "Staff"; font-size: 0.8rem; }
  .environment-only { display: none; }
  .account-hero { padding-left: 20px; padding-right: 20px; }
  .account-hero h1 { font-size: 2.35rem; }
  .account-hero .lede { font-size: 1rem; }
  .account-content { width: calc(100% - 32px); padding-bottom: 72px; }
  .panel, .organization-card, .operation-card { border-radius: 16px; }
  .panel { padding: 24px; }
  .identity-bar { padding: 18px; }
  .billing-box, .grants-box, .licenses-box { padding: 16px; }
  .billing-heading, .organization-title { flex-direction: column; }
  .footer-links { grid-template-columns: 1fr; }
  .site-footer { padding: 48px 20px 32px; }
}
