:root {
  color-scheme: dark;
  --ink: #f4f7f5;
  --muted: #9aa9a4;
  --dim: #70807b;
  --line: rgba(178, 209, 199, 0.14);
  --panel: #101b1a;
  --panel-2: #142321;
  --bg: #07100f;
  --green: #66e0ad;
  --green-strong: #35c991;
  --amber: #efc66d;
  --red: #ff897d;
  --blue: #8cb8ff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); min-width: 320px; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .55; background: radial-gradient(circle at 12% 4%, rgba(41, 148, 111, .18), transparent 34rem), radial-gradient(circle at 88% 25%, rgba(53, 93, 126, .13), transparent 30rem); }
button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.app-only { display: none; }
body.authenticated .app-only { display: inline-flex; }
body.authenticated .public-only { display: none; }

.site-header { position: sticky; top: 0; z-index: 20; height: 76px; padding: 0 clamp(22px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7, 16, 15, .88); backdrop-filter: blur(18px); }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(102, 224, 173, .5); color: var(--green); font: 700 18px Georgia, serif; transform: rotate(-3deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
nav { display: flex; gap: 8px; align-items: center; }
.nav-link, .text-link { border: 0; background: transparent; cursor: pointer; }
.nav-link { padding: 10px 13px; color: var(--muted); font-size: 13px; }
.nav-link:hover, .text-link:hover { color: var(--green); }

.button { min-height: 42px; padding: 0 18px; border-radius: 4px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 13px; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--green); color: #062017; }
.button-primary:hover { background: #7aedbc; }
.button-secondary { background: rgba(102, 224, 173, .08); color: var(--green); border-color: rgba(102, 224, 173, .3); }
.button-danger { background: rgba(255, 137, 125, .06); color: var(--red); border-color: rgba(255, 137, 125, .28); }
.button-ghost { min-height: 36px; background: transparent; color: var(--muted); border-color: var(--line); }
.full { width: 100%; }
.text-link { padding: 0; color: var(--green); font-size: 13px; font-weight: 650; }

main { position: relative; z-index: 1; }
.hero { min-height: calc(100vh - 76px); padding: clamp(56px, 9vh, 110px) clamp(22px, 8vw, 130px); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 470px); gap: clamp(48px, 9vw, 150px); align-items: center; }
.eyebrow, .section-kicker { margin: 0 0 18px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow span { display: inline-block; width: 24px; height: 1px; background: var(--green); }
.hero h1, .app-hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.045em; line-height: .98; }
.hero h1 { max-width: 760px; font-size: clamp(49px, 6.1vw, 94px); }
.hero-lead { max-width: 650px; margin: 32px 0 24px; color: #b7c5c0; font-size: clamp(16px, 1.4vw, 19px); line-height: 1.85; }
.hero-points { display: flex; gap: 10px; margin: 0 0 34px; flex-wrap: wrap; }
.hero-points span { padding: 7px 11px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .08em; }

.auth-card { padding: 34px; background: rgba(16, 27, 26, .88); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .28); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.auth-tab { padding: 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tab.active { color: var(--green); border-color: var(--green); }
.auth-form { display: grid; gap: 18px; }
.form-heading h2 { margin: 0 0 8px; font: 500 28px Georgia, serif; }
.form-heading p, .section-heading-row p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
label { display: grid; gap: 8px; color: #c3cfcb; font-size: 12px; font-weight: 650; }
label small { color: var(--dim); font-weight: 400; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 3px; padding: 12px 13px; outline: 0; background: #0a1413; color: var(--ink); }
input:focus, textarea:focus { border-color: rgba(102, 224, 173, .65); box-shadow: 0 0 0 3px rgba(102, 224, 173, .08); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-status { min-height: 19px; margin: 16px 0 0; color: var(--red); font-size: 12px; }

.public-process { padding: 100px clamp(22px, 8vw, 130px); border-top: 1px solid var(--line); background: #091311; }
.public-process > h2, .docs-heading h2, .section-heading-row h2 { margin: 0; font: 500 clamp(32px, 4vw, 54px) Georgia, serif; }
.process-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 48px; border-top: 1px solid var(--line); }
.process-grid article { padding: 30px 40px 20px 0; border-right: 1px solid var(--line); }
.process-grid article:not(:first-child) { padding-left: 40px; }
.process-grid article:last-child { border-right: 0; }
.process-grid b { color: var(--green); font-size: 11px; }
.process-grid h3 { margin: 34px 0 12px; font: 500 24px Georgia, serif; }
.process-grid p { margin: 0; color: var(--muted); line-height: 1.75; font-size: 13px; }

.app-shell { max-width: 1500px; margin: 0 auto; padding: 52px clamp(22px, 5vw, 76px) 100px; }
.app-hero { min-height: 230px; display: flex; align-items: center; justify-content: space-between; gap: 30px; border-bottom: 1px solid var(--line); }
.app-hero h1 { font-size: clamp(42px, 5vw, 70px); }
.app-hero p:last-child { color: var(--muted); }
.portal-panel { padding-top: 42px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.metric-grid article { min-height: 142px; padding: 25px; border-right: 1px solid var(--line); background: rgba(16, 27, 26, .65); }
.metric-grid article:last-child { border-right: 0; }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); font-size: 11px; }
.metric-grid strong { display: block; margin: 17px 0 8px; font: 500 34px Georgia, serif; }
.metric-grid .status-metric { font: 700 15px ui-sans-serif, sans-serif; color: var(--green); margin-top: 28px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.card { padding: 28px; border: 1px solid var(--line); background: rgba(16, 27, 26, .7); }
.card-heading, .section-heading-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.card-heading { margin-bottom: 26px; }
.card-heading h2 { margin: 0; font: 500 25px Georgia, serif; }
.card-heading .section-kicker { margin-bottom: 8px; }
.badge { padding: 6px 9px; border-radius: 100px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 10px; white-space: nowrap; }
.badge.pending { color: var(--amber); border-color: rgba(239,198,109,.3); }
.badge.approved, .badge.active { color: var(--green); border-color: rgba(102,224,173,.3); }
.badge.rejected, .badge.revoked { color: var(--red); border-color: rgba(255,137,125,.3); }
.stack-form { display: grid; gap: 16px; }
.application-copy { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.application-meta { margin: 0 0 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.application-meta div { padding: 12px; background: rgba(255,255,255,.025); }
.application-meta span, .application-meta b { display: block; }
.application-meta span { color: var(--dim); font-size: 10px; }
.application-meta b { margin-top: 6px; font-size: 12px; }
.activity-list { display: grid; }
.activity-item { padding: 13px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item b, .activity-item span { font-size: 12px; }
.activity-item small { display: block; margin-top: 5px; color: var(--dim); }
.activity-item span { color: var(--green); }
.empty-state { color: var(--dim); font-size: 13px; }
.section-heading-row { margin-bottom: 30px; align-items: flex-end; }
.section-heading-row h2 { font-size: 44px; }
.section-heading-row .section-kicker { margin-bottom: 10px; }
.keys-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
.key-card { padding: 25px; border: 1px solid var(--line); background: rgba(16,27,26,.7); }
.key-card-top { display: flex; align-items: center; justify-content: space-between; }
.key-card h3 { margin: 0; font: 500 21px Georgia, serif; }
.key-prefix { margin: 16px 0; padding: 10px; display: block; background: #081211; color: var(--green); font-size: 12px; }
.quota-line { height: 5px; overflow: hidden; background: rgba(255,255,255,.06); }
.quota-line span { display: block; height: 100%; background: var(--green); }
.key-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 17px; }
.key-stats span, .key-stats b { display: block; }
.key-stats span { color: var(--dim); font-size: 10px; }
.key-stats b { margin-top: 5px; font-size: 12px; }
.key-revoke { width: 100%; margin-top: 20px; }
.usage-card { padding: 0; overflow: hidden; }
.usage-card .card-heading { padding: 26px 28px 0; }
.muted { color: var(--dim); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 13px 18px; text-align: left; border-top: 1px solid var(--line); font-size: 11px; }
th { color: var(--dim); font-weight: 600; letter-spacing: .05em; }
td { color: #bdc8c4; }
td code { color: var(--green); }

.docs-section { padding: 110px clamp(22px, 8vw, 130px); border-top: 1px solid var(--line); background: #0b1514; }
body.authenticated > main > .docs-section { display: none; }
.docs-heading { max-width: 780px; }
.docs-heading p:last-child { color: var(--muted); line-height: 1.7; }
code { font-family: "SFMono-Regular", Consolas, monospace; }
.docs-heading code, .doc-block p code { color: var(--green); }
.docs-layout { display: grid; grid-template-columns: 210px minmax(0, 900px); gap: clamp(35px, 7vw, 110px); margin-top: 65px; }
.docs-nav { position: sticky; top: 110px; align-self: start; display: grid; }
.docs-nav a { padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 12px; }
.docs-nav a:hover { color: var(--green); }
.docs-content { min-width: 0; }
.doc-block { position: relative; padding: 0 0 60px 62px; margin-bottom: 55px; border-bottom: 1px solid var(--line); scroll-margin-top: 110px; }
.doc-index { position: absolute; left: 0; top: 5px; color: var(--green); font-size: 11px; }
.doc-block h3 { margin: 0 0 22px; font: 500 30px Georgia, serif; }
.doc-block p { color: var(--muted); line-height: 1.8; font-size: 13px; }
pre { margin: 22px 0; padding: 22px; overflow-x: auto; border: 1px solid var(--line); background: #06100e; color: #c9f5df; line-height: 1.7; font-size: 12px; }
.endpoint-list { border-top: 1px solid var(--line); }
.endpoint-list > div { padding: 15px 0; display: grid; grid-template-columns: 48px minmax(260px, .9fr) 1fr; gap: 15px; align-items: center; border-bottom: 1px solid var(--line); }
.endpoint-list .method { color: var(--green); font-size: 10px; }
.endpoint-list code { font-size: 12px; }
.endpoint-list span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.doc-note { padding: 14px 16px; background: rgba(102,224,173,.05); border-left: 2px solid var(--green); }
.doc-note a { color: var(--green); }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.status-grid div { padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status-grid b, .status-grid span { display: block; }
.status-grid b { color: var(--green); }
.status-grid span { margin-top: 6px; color: var(--muted); font-size: 11px; }

.secret-dialog { width: min(620px, calc(100vw - 30px)); padding: 36px; border: 1px solid rgba(102,224,173,.35); background: #101b1a; color: var(--ink); box-shadow: 0 40px 100px #000; }
.secret-dialog::backdrop { background: rgba(2,7,6,.78); backdrop-filter: blur(6px); }
.secret-dialog h2 { margin: 0 0 15px; font: 500 32px Georgia, serif; }
.secret-dialog p { color: var(--muted); line-height: 1.7; font-size: 13px; }
.dialog-close { float: right; border: 0; background: transparent; color: var(--muted); font-size: 26px; cursor: pointer; }
.secret-box { margin: 24px 0; display: flex; gap: 10px; }
.secret-box code { flex: 1; min-width: 0; padding: 13px; overflow-x: auto; background: #07100f; color: var(--green); border: 1px solid var(--line); white-space: nowrap; }
.secret-dialog .warning-text { color: var(--amber); }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: 380px; padding: 14px 18px; border: 1px solid var(--line); background: #172623; color: var(--ink); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: none; }
.toast.error { border-color: rgba(255,137,125,.4); color: #ffc0ba; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 70px; }
  .hero-copy { max-width: 760px; }
  .auth-card { max-width: 620px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid article:nth-child(2) { border-right: 0; }
  .metric-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-grid { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .site-header { height: 68px; padding: 0 16px; }
  .brand small { display: none; }
  .nav-link { padding: 8px; font-size: 11px; }
  .site-header .button-ghost { padding: 0 10px; }
  .hero { min-height: auto; padding: 58px 18px 80px; gap: 52px; }
  .hero h1 { font-size: 49px; }
  .auth-card { padding: 24px 18px; }
  .form-grid, .process-grid, .metric-grid, .keys-list, .status-grid { grid-template-columns: 1fr; }
  .process-grid article, .process-grid article:not(:first-child) { padding: 25px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .app-shell { padding: 32px 16px 70px; }
  .app-hero { align-items: flex-start; flex-direction: column; justify-content: center; }
  .app-hero .button { width: 100%; }
  .card { padding: 22px 18px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .docs-section, .public-process { padding: 75px 18px; }
  .docs-nav { display: none; }
  .doc-block { padding-left: 0; }
  .doc-index { position: static; display: block; margin-bottom: 12px; }
  .endpoint-list > div { grid-template-columns: 42px 1fr; }
  .endpoint-list > div span { grid-column: 2; }
  .secret-box { flex-direction: column; }
}

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