:root {
  color-scheme: dark;
  --bg: #14110e;
  --bg-raised: #1b1713;
  --panel: #211b16;
  --panel-hover: #282019;
  --line: #3a2e24;
  --line-soft: #2d251e;
  --text: #f5eddf;
  --muted: #aa9b89;
  --faint: #776b5e;
  --ember: #f06a38;
  --ember-bright: #ff8050;
  --ember-dark: #a83c1d;
  --gold: #e6b85e;
  --teal: #69b9a6;
  --violet: #a88bd4;
  --danger: #ef6b63;
  --success: #73c796;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 14% 4%, rgba(240,106,56,.10), transparent 27rem), radial-gradient(circle at 88% 30%, rgba(230,184,94,.045), transparent 24rem); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid rgba(255,128,80,.7); outline-offset: 3px; }
[hidden] { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 14px; }
.login-card { width: min(490px, 100%); border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 10px; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.session-loading { text-align: center; padding: 80px 24px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; transform: translateY(-150%); padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--bg); text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

.site-header { height: 74px; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(20px, 4vw, 64px); background: rgba(20,17,14,.92); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; font-weight: 760; font-size: 18px; letter-spacing: -.03em; text-decoration: none; }
.brand > span:last-child > span { color: var(--ember-bright); }
.brand-mark { width: 29px; height: 29px; position: relative; display: inline-block; transform: rotate(-10deg); }
.brand-mark i { display: block; position: absolute; left: 3px; width: 23px; height: 7px; border-radius: 2px 6px; background: var(--ember); box-shadow: inset 0 1px rgba(255,255,255,.22); }
.brand-mark i:nth-child(1) { top: 2px; width: 16px; left: 9px; }
.brand-mark i:nth-child(2) { top: 11px; }
.brand-mark i:nth-child(3) { top: 20px; width: 18px; }
.primary-nav { display: flex; align-items: center; gap: 7px; }
.primary-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; padding: 9px 13px; border-radius: 8px; transition: .2s ease; }
.primary-nav a:hover { color: var(--text); background: var(--panel); }
.primary-nav a.active { color: var(--text); background: #2b231c; box-shadow: inset 0 0 0 1px var(--line); }
.account-slot { justify-self: end; display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(115,199,150,.1); }

.page-shell { width: min(1420px, calc(100% - 48px)); margin: 0 auto; padding: 60px 0 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 60px; padding: 12px 6px 54px; }
.eyebrow, .kicker { color: var(--ember-bright); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 13px; }
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow span { width: 21px; height: 1px; background: currentColor; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.045em; }
.hero h1, .page-title h1, .docs-hero h1 { max-width: 820px; margin-bottom: 18px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(42px, 5.7vw, 76px); }
h1 em { color: var(--ember-bright); font-weight: inherit; }
.hero-copy { color: var(--muted); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.65; max-width: 700px; margin: 0; }
.hero-stat { min-width: 220px; padding: 20px 24px; border-left: 1px solid var(--line); display: grid; }
.hero-stat span, .hero-stat small { color: var(--muted); font-size: 12px; }
.hero-stat strong { font-family: Georgia, serif; font-size: 44px; font-weight: 500; color: var(--gold); margin: 3px 0; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .75fr); gap: 20px; align-items: stretch; }
.panel { background: linear-gradient(145deg, rgba(255,255,255,.012), transparent 46%), var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: 0 1px rgba(255,255,255,.025) inset; }
.forge-panel, .batch-panel, .keys-panel, .queue-panel, .stock-panel, .users-panel { padding: clamp(22px, 3vw, 34px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
.section-heading.compact { margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: 28px; }
.section-description { color: var(--muted); margin: 8px 0 0; font-size: 14px; }

.button { border: 0; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 0 16px; font-weight: 750; font-size: 13px; text-decoration: none; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .48; cursor: wait; transform: none; }
.button-primary { color: #fff8ef; background: linear-gradient(180deg, var(--ember-bright), var(--ember)); box-shadow: 0 8px 20px rgba(240,106,56,.18), inset 0 1px rgba(255,255,255,.24); }
.button-primary:hover { background: linear-gradient(180deg, #ff916a, var(--ember-bright)); }
.button-secondary { color: var(--text); background: #2a221b; border: 1px solid var(--line); }
.button-secondary:hover, .button-ghost:hover { background: #342920; border-color: #594332; }
.button-ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.button-danger { background: #9b3933; color: white; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.button-full { width: 100%; }

.template-grid { display: grid; grid-template-columns: repeat(5, minmax(118px, 1fr)); gap: 11px; }
.template-card { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; min-height: 156px; padding: 18px 15px 15px; color: var(--text); text-align: left; background: #1a1612; border: 1px solid var(--line-soft); border-radius: 12px; cursor: pointer; transition: .2s ease; }
.template-card:hover { transform: translateY(-3px); border-color: #594332; background: #241d17; }
.template-card[aria-pressed="true"] { background: linear-gradient(150deg, rgba(240,106,56,.13), transparent 60%), #281e17; border-color: var(--ember); box-shadow: inset 0 0 0 1px rgba(240,106,56,.2), 0 10px 25px rgba(0,0,0,.16); }
.template-card .template-art { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; margin-bottom: auto; font-family: Georgia, serif; font-size: 24px; color: var(--template-color, var(--gold)); background: color-mix(in srgb, var(--template-color, var(--gold)) 12%, transparent); border: 1px solid color-mix(in srgb, var(--template-color, var(--gold)) 25%, transparent); }
.template-card[data-template-id="chess"] { --template-color: #e6b85e; }
.template-card[data-template-id="marble-track"] { --template-color: #69b9a6; }
.template-card[data-template-id="pegboard"] { --template-color: #a88bd4; }
.template-card[data-template-id="tile-breaker"] { --template-color: #f06a38; }
.template-card[data-template-id="orbit-drawing"] { --template-color: #d77f9d; }
.template-card strong { display: block; margin: 15px 0 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.template-card small { color: var(--muted); font-size: 11px; }
.template-skeleton { height: 156px; border-radius: 12px; background: linear-gradient(90deg, #1a1612 25%, #2a221b 45%, #1a1612 65%); background-size: 240% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.batch-composer { display: grid; grid-template-columns: minmax(170px, 1fr) auto auto; gap: 16px; align-items: end; border-top: 1px solid var(--line-soft); margin-top: 26px; padding-top: 24px; }
.composer-copy { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.composer-copy div { display: grid; gap: 3px; }
.composer-copy small, .count-field > span:first-child { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.composer-copy strong { font-size: 14px; }
.template-mini { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--gold); font-family: Georgia, serif; font-size: 20px; background: rgba(230,184,94,.09); border: 1px solid rgba(230,184,94,.18); }
.count-field { display: grid; gap: 7px; }
.stepper { display: grid; grid-template-columns: 34px 44px 34px; height: 42px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #181411; }
.stepper button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 19px; }
.stepper button:hover { color: var(--text); background: #2b231c; }
.stepper input { width: 100%; min-width: 0; border: 0; border-inline: 1px solid var(--line-soft); outline: 0; text-align: center; color: var(--text); background: transparent; font-weight: 800; appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.forge-button { min-height: 42px; min-width: 142px; }
.form-hint { grid-column: 1 / -1; margin: -6px 0 0; color: var(--faint); font-size: 11px; }

.pill { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: #191511; border: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pill[data-state="processing"] { color: var(--gold); border-color: rgba(230,184,94,.3); background: rgba(230,184,94,.07); }
.pill[data-state="ready"] { color: var(--success); border-color: rgba(115,199,150,.3); background: rgba(115,199,150,.07); }
.pill[data-state="failed"] { color: var(--danger); }
.batch-history { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin: -4px 0 14px; color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.batch-history select { width: 100%; height: 34px; padding: 0 9px; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.empty-batch { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.empty-batch .anvil { width: 70px; height: 60px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 50% 50% 36% 36%; color: var(--ember); font-size: 23px; background: radial-gradient(circle at 50% 35%, rgba(240,106,56,.13), transparent 60%); border-bottom: 5px solid #3a2d24; }
.empty-batch strong { font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.empty-batch p { max-width: 250px; color: var(--muted); font-size: 13px; line-height: 1.55; margin: 9px 0 0; }
.active-batch { min-height: 320px; padding-top: 12px; }
.batch-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.batch-title-row div { display: grid; gap: 4px; min-width: 0; }
.batch-title-row strong { font-size: 14px; }
.batch-title-row small { color: var(--faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-title-row b { margin-left: auto; font-size: 18px; color: var(--gold); }
.progress-track { display: block; width: 100%; height: 7px; overflow: hidden; border: 0; background: #15110e; border-radius: 999px; appearance: none; }
.progress-track::-webkit-progress-bar { background: #15110e; border-radius: 999px; }
.progress-track::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--ember), var(--gold)); transition: width .35s ease; }
.progress-track::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--ember), var(--gold)); }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; margin-top: 8px; }
.batch-items { list-style: none; padding: 0; margin: 23px 0; display: grid; gap: 7px; max-height: 160px; overflow: auto; }
.batch-items li { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.batch-items i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.batch-items li.ready i { background: var(--success); }
.batch-items li.processing i { background: var(--gold); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.download-note { color: var(--faint); text-align: center; font-size: 10px; line-height: 1.45; margin: 9px auto 0; max-width: 280px; }

.keys-panel { margin-top: 20px; scroll-margin-top: 95px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; padding: 0 14px 11px; border-bottom: 1px solid var(--line); }
td { padding: 14px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line-soft); }
td:first-child { color: var(--text); font-weight: 650; }
td code { color: var(--gold); background: #17130f; padding: 4px 6px; border-radius: 5px; }
.table-empty { text-align: center; padding: 35px; color: var(--faint) !important; font-weight: 500 !important; }
.row-actions { text-align: right; white-space: nowrap; }
.icon-button { border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; min-height: 30px; padding: 0 9px; cursor: pointer; font-size: 11px; }
.icon-button:hover { border-color: var(--line); color: var(--text); background: #2a221b; }
.icon-button.danger:hover { color: var(--danger); border-color: rgba(239,107,99,.25); }
.docs-callout { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-top: 22px; padding: 16px; border: 1px solid var(--line-soft); background: #1a1612; border-radius: 11px; }
.code-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: rgba(168,139,212,.1); color: var(--violet); font-weight: 800; }
.docs-callout strong { font-size: 13px; }
.docs-callout p { color: var(--muted); margin: 3px 0 0; font-size: 11px; }
.docs-callout a { color: var(--ember-bright); font-size: 12px; font-weight: 750; text-decoration: none; }

/* Admin */
.admin-shell { padding-top: 45px; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 0 6px 38px; }
.page-title h1 { font-size: clamp(38px, 4.4vw, 62px); margin-bottom: 10px; }
.page-title > div > p:last-child { color: var(--muted); margin: 0; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 20px; }
.metric-card { display: flex; align-items: center; gap: 15px; min-width: 0; padding: 21px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; }
.metric-icon { flex: 0 0 auto; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; background: rgba(240,106,56,.1); color: var(--ember); }
.metric-icon.gold { color: var(--gold); background: rgba(230,184,94,.1); }
.metric-icon.teal { color: var(--teal); background: rgba(105,185,166,.1); }
.metric-icon.violet { color: var(--violet); background: rgba(168,139,212,.1); }
.metric-card div { display: grid; gap: 3px; min-width: 0; }
.metric-card small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.metric-card strong { font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.metric-card p { color: var(--faint); font-size: 10px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.live-label { color: var(--success); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.live-label i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 4px; animation: pulse 1.5s infinite; }
.queue-summary { display: flex; align-items: center; gap: 20px; border-bottom: 1px solid var(--line-soft); padding-bottom: 20px; }
.queue-gauge { width: 74px; height: 74px; flex: 0 0 auto; border: 5px solid rgba(230,184,94,.17); border-top-color: var(--gold); border-radius: 50%; display: grid; place-content: center; text-align: center; }
.queue-gauge strong { font-family: Georgia, serif; font-size: 23px; line-height: 1; }
.queue-gauge span { color: var(--faint); font-size: 9px; margin-top: 3px; }
.queue-summary > div:last-child strong { font-size: 14px; }
.queue-summary p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.worker-list, .stock-list { display: grid; gap: 0; }
.worker-row, .stock-row { display: flex; align-items: center; gap: 11px; min-height: 48px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.worker-row:last-child, .stock-row:last-child { border: 0; }
.worker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.worker-row strong, .stock-row strong { color: var(--text); font-size: 12px; }
.worker-row span:nth-last-child(2), .stock-row span:nth-last-child(2) { margin-left: auto; }
.worker-row b, .stock-row b { min-width: 35px; text-align: right; color: var(--gold); font-size: 11px; }
.stock-bar { width: 90px; height: 5px; border: 0; border-radius: 99px; background: #15110e; overflow: hidden; appearance: none; }
.stock-bar::-webkit-progress-bar { background: #15110e; }
.stock-bar::-webkit-progress-value { background: var(--ember); border-radius: 99px; }
.stock-bar::-moz-progress-bar { background: var(--ember); border-radius: 99px; }
.skeleton-line { display: block; width: 100%; height: 12px; border-radius: 5px; background: #2d251e; }
.search-field { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; background: #17130f; border: 1px solid var(--line); border-radius: 8px; color: var(--faint); }
.search-field input { width: 180px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.avatar { width: 32px; height: 32px; display: inline-grid; place-items: center; margin-right: 9px; border-radius: 8px; color: var(--gold); background: rgba(230,184,94,.09); font-size: 10px; vertical-align: middle; }
.member-cell small { display: block; margin: -7px 0 0 44px; color: var(--faint); font-size: 10px; font-weight: 400; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--success); }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.disabled { color: var(--faint); }

/* Documentation */
.docs-layout { width: min(1280px, calc(100% - 48px)); margin: 0 auto; display: grid; grid-template-columns: 210px minmax(0, 830px); gap: clamp(40px, 8vw, 110px); padding: 62px 0 100px; }
.docs-nav { align-self: start; position: sticky; top: 116px; display: grid; gap: 4px; }
.docs-nav p { color: var(--faint); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; margin: 0 0 13px 12px; }
.docs-nav a { text-decoration: none; color: var(--muted); padding: 9px 12px; border-left: 1px solid var(--line); font-size: 12px; transition: .16s; }
.docs-nav a:hover { color: var(--text); border-color: var(--ember); background: linear-gradient(90deg, rgba(240,106,56,.08), transparent); }
.docs-content { min-width: 0; }
.docs-hero { padding-bottom: 62px; }
.docs-hero h1 { font-size: clamp(43px, 6vw, 70px); margin-bottom: 17px; }
.docs-hero > p:last-of-type { max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.base-url { margin-top: 30px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 11px 12px; }
.base-url span { color: var(--faint); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.base-url code { color: var(--gold); overflow: hidden; text-overflow: ellipsis; }
.base-url button, .code-block button, .secret-box button, .credential-list button { color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 11px; }
.base-url button:hover, .code-block button:hover, .secret-box button:hover { color: var(--text); }
.docs-section { scroll-margin-top: 100px; padding: 56px 0; border-top: 1px solid var(--line-soft); }
.docs-heading { display: grid; grid-template-columns: 38px 1fr; gap: 14px; margin-bottom: 26px; }
.docs-heading > span { color: var(--ember); font-family: Georgia, serif; font-size: 14px; }
.docs-heading h2 { font-family: Georgia, serif; font-weight: 500; font-size: 31px; margin-bottom: 10px; }
.docs-heading p { color: var(--muted); line-height: 1.6; margin: 0; }
.docs-content code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .9em; }
.docs-heading p code, .parameter-table p code { color: var(--gold); }
.callout { margin: 0 0 20px 52px; padding: 15px 18px; border-radius: 9px; border: 1px solid rgba(230,184,94,.2); border-left: 3px solid var(--gold); background: rgba(230,184,94,.055); }
.callout strong { font-size: 12px; color: var(--gold); }
.callout p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.endpoint { display: flex; align-items: center; gap: 13px; min-height: 50px; margin-bottom: 18px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.endpoint > span:last-child { margin-left: auto; color: var(--faint); font-size: 11px; }
.method { width: 46px; padding: 4px 0; border-radius: 5px; text-align: center; font-size: 9px; font-weight: 900; letter-spacing: .06em; }
.method.post { color: var(--ember-bright); background: rgba(240,106,56,.12); }
.method.get { color: var(--teal); background: rgba(105,185,166,.12); }
.code-tabs { display: flex; gap: 4px; margin-bottom: 7px; }
.code-tabs button { border: 0; border-radius: 6px; background: transparent; color: var(--faint); padding: 7px 10px; font-size: 11px; cursor: pointer; }
.code-tabs button.active { color: var(--text); background: var(--panel); }
.code-block { overflow: hidden; margin-bottom: 25px; background: #0e0c0a; border: 1px solid var(--line-soft); border-radius: 11px; }
.code-block header { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 14px; color: var(--faint); background: #181411; border-bottom: 1px solid var(--line-soft); font-size: 10px; }
.code-block.response header span { color: var(--success); }
.code-block pre { margin: 0; padding: 18px; overflow-x: auto; color: #d8cdbf; font-size: 12px; line-height: 1.65; }
.docs-section h3 { margin: 30px 0 13px; font-size: 14px; letter-spacing: -.01em; }
.parameter-table { display: grid; margin-bottom: 25px; border-block: 1px solid var(--line-soft); }
.parameter-table > div { display: grid; grid-template-columns: 150px 130px 1fr; align-items: baseline; gap: 10px; padding: 14px 10px; border-bottom: 1px solid var(--line-soft); }
.parameter-table > div:last-child { border: 0; }
.parameter-table > div > code { color: var(--ember-bright); }
.parameter-table > div > span { color: var(--faint); font-size: 10px; }
.parameter-table p { color: var(--muted); font-size: 11px; margin: 0; line-height: 1.5; }
.template-reference { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.template-reference div { display: grid; justify-items: start; gap: 8px; min-width: 0; padding: 15px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; }
.template-reference span { color: var(--gold); font-size: 22px; }
.template-reference code { width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 10px; }
.template-reference p { margin: 0; color: var(--faint); font-size: 9px; }
.limits-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.limits-grid div { padding: 18px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel); display: grid; gap: 5px; }
.limits-grid strong { color: var(--gold); font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.limits-grid span { color: var(--muted); font-size: 10px; }

/* Modals and feedback */
.modal { width: min(490px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--line); border-radius: 17px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(7,6,5,.76); backdrop-filter: blur(5px); }
.modal-card { display: grid; padding: clamp(24px, 5vw, 38px); }
.modal-card.compact-card { text-align: center; justify-items: center; }
.modal-card h2 { margin-bottom: 10px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.modal-card > p:not(.kicker):not(.form-error) { color: var(--muted); line-height: 1.55; font-size: 13px; }
.modal-card label { display: grid; gap: 7px; margin-top: 16px; color: var(--muted); font-size: 11px; font-weight: 700; }
input, select { min-width: 0; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--text); background: #17130f; }
input:focus, select:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(240,106,56,.1); }
.modal-card > .button-full { margin-top: 22px; }
.login-brand { margin-bottom: 30px; transform: scale(1.3) rotate(-10deg); transform-origin: left center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); font-size: 11px; margin: 12px 0 0; }
.modal-actions { width: 100%; display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.modal-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 50%; color: var(--gold); background: rgba(230,184,94,.1); border: 1px solid rgba(230,184,94,.22); font-weight: 800; }
.modal-icon.success { color: var(--success); background: rgba(115,199,150,.1); border-color: rgba(115,199,150,.22); }
.modal-icon.warning { color: var(--danger); background: rgba(239,107,99,.1); border-color: rgba(239,107,99,.22); }
.secret-box { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px 10px 10px 13px; background: #100d0b; border: 1px dashed #5b4432; border-radius: 8px; text-align: left; }
.secret-box code { color: var(--gold); overflow-wrap: anywhere; font-size: 11px; }
.credential-list { width: 100%; display: grid; gap: 1px; overflow: hidden; margin: 12px 0 0; border: 1px solid var(--line); border-radius: 9px; background: var(--line); text-align: left; }
.credential-list div { padding: 12px; background: #17130f; }
.credential-list dt { color: var(--faint); text-transform: uppercase; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.credential-list dd { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 5px 0 0; font-size: 12px; }
.credential-list code { color: var(--gold); overflow-wrap: anywhere; }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px, calc(100% - 36px)); pointer-events: none; }
.toast { padding: 13px 15px; border: 1px solid var(--line); border-left: 3px solid var(--success); border-radius: 9px; color: var(--text); background: #241e18; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .25s ease; }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }

@media (max-width: 1050px) {
  .template-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .batch-panel { min-height: auto; }
  .empty-batch { min-height: 220px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .docs-layout { grid-template-columns: 170px minmax(0, 1fr); gap: 40px; }
  .template-reference { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .site-header { height: auto; min-height: 68px; grid-template-columns: 1fr auto; padding: 14px 18px; }
  .primary-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; overflow-x: auto; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
  .account-slot .account-name, .account-slot .status-dot { display: none; }
  .page-shell { width: min(100% - 28px, 1420px); padding-top: 36px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-bottom: 38px; }
  .hero-stat { border-left: 0; border-top: 1px solid var(--line); padding: 18px 0 0; grid-template-columns: auto auto; align-items: baseline; justify-content: start; gap: 0 12px; }
  .hero-stat strong { grid-row: 1 / 3; grid-column: 1; }
  .hero-stat span, .hero-stat small { grid-column: 2; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .batch-composer { grid-template-columns: 1fr auto; }
  .forge-button { grid-column: 1 / -1; }
  .docs-callout { grid-template-columns: auto 1fr; }
  .docs-callout a { grid-column: 2; }
  .page-title { align-items: start; flex-direction: column; }
  .admin-grid, .metrics-grid { grid-template-columns: 1fr; }
  .docs-layout { width: min(100% - 28px, 830px); display: block; padding-top: 42px; }
  .docs-nav { display: none; }
  .parameter-table > div { grid-template-columns: 1fr 1fr; }
  .parameter-table p { grid-column: 1 / -1; }
  .template-reference { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 470px) {
  .brand { font-size: 16px; }
  .template-grid { grid-template-columns: 1fr; }
  .template-card { min-height: 120px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .random-button, .section-heading > .button { width: 100%; }
  .batch-composer { grid-template-columns: 1fr; }
  .count-field { width: 100%; }
  .stepper { grid-template-columns: 1fr 60px 1fr; }
  .docs-callout { grid-template-columns: 1fr; }
  .docs-callout a { grid-column: 1; }
  .form-grid, .limits-grid { grid-template-columns: 1fr; }
  .template-reference { grid-template-columns: 1fr; }
  .endpoint { flex-wrap: wrap; }
  .endpoint > span:last-child { width: 100%; margin-left: 59px; }
  .base-url { grid-template-columns: auto 1fr; }
  .base-url button { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
