/* Developer portal (step 4.4). Dondoo colours (D-119); system fonts until the Gilroy web licence is checked (D-112). */
:root {
  --dark-blue: #466CCC; --royal: #4281E5; --light-green: #AAE3AE; --lime: #CFE682; --red: #FA5F6C;
  --purple: #AE88E3; --green: #07B99B; --light-blue: #73B2C8; --yellow: #FCF2B4; --base: #343855;
  --muted: #6B6F8A; --line: #E3E6F0; --bg: #FFFFFF; --soft: #F5F7FC; --code-bg: #232642; --code-fg: #E8EAF6;
}
@media (prefers-color-scheme: dark) {
  :root { --base: #E9EBF5; --muted: #A3A8C3; --line: #2E3250; --bg: #171a2e; --soft: #1F2340; --code-bg: #0F1124; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--base); background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--royal); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
:not(pre) > code { background: var(--soft); border: 1px solid var(--line); padding: .05em .35em; border-radius: 4px; }
pre { background: var(--code-bg); color: var(--code-fg); padding: 16px 18px; border-radius: 10px; overflow-x: auto; line-height: 1.45; margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

header.top { background: linear-gradient(120deg, #6A97D8 0%, #7FC6C2 55%, #A6E0B2 100%); color: #fff; }
header.top .bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 800; font-size: 22px; letter-spacing: .2px; }
.brand span { font-weight: 500; opacity: .9; font-size: 15px; margin-left: 6px; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a { color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 15px; }
nav.main a.on, nav.main a:hover { background: rgba(255,255,255,.2); text-decoration: none; }
.hero { padding: 44px 0 56px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; margin: 0 0 14px; font-weight: 800; }
.hero p { font-size: 19px; max-width: 640px; margin: 0 0 24px; opacity: .97; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 999px; font-weight: 700; margin: 0 8px 8px 0; }
.btn.primary { background: #fff; color: var(--dark-blue); }
.btn.ghost { border: 2px solid rgba(255,255,255,.8); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

main { padding: 36px 0 60px; }
h2 { font-size: 26px; margin: 40px 0 12px; }
h3 { font-size: 18px; margin: 26px 0 8px; }
.lead { font-size: 18px; color: var(--muted); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--bg); }
.card h3 { margin-top: 0; }
.steps { counter-reset: step; display: grid; gap: 16px; }
.step { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.step::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 50%; background: var(--royal); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step h3 { margin: 4px 0 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--soft); font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
td p { margin: 0 0 6px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 15px; }
.plan-name { font-weight: 800; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); }

.layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; }
.side { position: sticky; top: 16px; align-self: start; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.side a { padding: 6px 10px; border-radius: 8px; color: var(--base); }
.side a:hover { background: var(--soft); text-decoration: none; }
.verb { display: inline-block; font-size: 12px; font-weight: 800; color: #fff; background: var(--green); border-radius: 6px; padding: 1px 6px; margin-right: 4px; vertical-align: middle; }
.op { border-top: 1px solid var(--line); padding-top: 8px; }
.op h2 { font-size: 22px; }
.req { color: var(--red); font-size: 12px; font-weight: 700; }
.ex { color: var(--muted); font-size: 14px; }
.status { font-weight: 700; }
.status.s2 { color: var(--green); } .status.s4 { color: #D9822B; } .status.s5 { color: var(--red); }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } .side { position: static; flex-direction: row; flex-wrap: wrap; } }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: -1px; }
.tabs button { font: inherit; font-weight: 700; font-size: 14px; border: 1px solid var(--line); border-bottom: 0; background: var(--soft); color: var(--muted); padding: 8px 14px; border-radius: 10px 10px 0 0; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--code-bg); color: #fff; border-color: var(--code-bg); }
.panel[hidden] { display: none; }
.panel pre { border-top-left-radius: 0; }

form.try { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
form.try label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
form.try select, form.try input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--base); min-height: 44px; }
form.try button { font: inherit; font-weight: 800; padding: 12px 18px; border-radius: 999px; border: 0; background: var(--royal); color: #fff; cursor: pointer; min-height: 44px; }
form.try button:disabled { opacity: .6; cursor: wait; }
.result { margin-top: 22px; }
.result .meta { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.result iframe { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.result pre { max-height: 70vh; }
.dont-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.dont-list li { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.dont-list .rank { width: 30px; height: 30px; border-radius: 50%; background: var(--royal); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.dont-list .where { color: var(--muted); font-size: 14px; }

footer { background: #343855; color: #C9CCE0; padding: 40px 0 28px; font-size: 14px; }
footer a { color: #fff; }
footer .cols { display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr 1fr; }
footer h4 { color: #fff; font-size: 14px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .6px; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
footer p { margin: 0 0 8px; }
footer .foot-brand { font-weight: 800; font-size: 22px; display: inline-block; margin-bottom: 8px; }
footer .legal { border-top: 1px solid rgba(255,255,255,.15); margin-top: 28px; padding-top: 16px; font-size: 13px; }
@media (max-width: 820px) { footer .cols { grid-template-columns: 1fr 1fr; } footer .cols > :first-child { grid-column: 1 / -1; } }
footer .cols > * { min-width: 0; }
/* Grid children may shrink, so wide tables and code scroll inside their box instead of the page. */
.layout > *, .step > *, .grid > * { min-width: 0; }

/* My account (step 4.5) */
.btn.solid { background: var(--royal); color: #fff; border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.btn.ghost.dark { border: 2px solid var(--royal); color: var(--royal); background: transparent; cursor: pointer; font: inherit; font-weight: 700; }
.btn.small { padding: 6px 14px; font-size: 14px; margin: 0; }
.account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.account-head p { margin: 0; }
#account .card { margin: 18px 0; }
.key-once { border-color: var(--green); background: var(--soft); }
.key-once code.key { display: block; font-size: 15px; padding: 10px 12px; margin: 8px 0 12px; word-break: break-all; user-select: all; }
.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 8px 0; }
.meter span { display: block; height: 100%; background: var(--green); }
form.new-key { margin-top: 18px; max-width: 560px; }
nav.main a.account { border: 2px solid rgba(255,255,255,.8); }
td.actions { white-space: nowrap; }
td.actions .btn { margin: 0 6px 4px 0; }
.btn.ghost.dark.danger { border-color: var(--red); color: #C93542; }
tr.off td { color: var(--muted); }
td.when { white-space: nowrap; }

/* Usage (FR-092): one series, thin bars with a 2px gap, rounded data-ends on the baseline, hover tooltip. */
.usage .chart-box { margin: 8px 0 12px; }
.usage figcaption { margin-bottom: 8px; }
.usage .chart { position: relative; display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 140px; align-items: end; border-bottom: 1px solid var(--line); }
.usage .col { height: 100%; display: flex; align-items: flex-end; outline: none; cursor: default; }
.usage .col:hover .bar, .usage .col:focus .bar { filter: brightness(1.15); }
.usage .col:focus-visible { box-shadow: 0 0 0 2px var(--royal); border-radius: 4px; }
.usage .bar { display: block; width: 100%; background: var(--royal); border-radius: 4px 4px 0 0; }
.usage .tip { position: absolute; top: -8px; transform: translate(-50%, -100%); background: var(--code-bg); color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.usage .axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.usage details { margin: 6px 0 4px; }
.usage summary { cursor: pointer; color: var(--royal); font-weight: 600; }
.usage details .table-wrap { margin-top: 10px; }

/* Admin page (D-130) */
body.admin header.top .bar { padding: 12px 0; }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-nav[hidden] { display: none; }
.admin-nav a { padding: 6px 12px; border-radius: 999px; font-weight: 600; color: var(--base); }
.admin-nav a.on, .admin-nav a:hover { background: var(--soft); text-decoration: none; }
.admin-nav button { margin-left: auto; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 12px 0 18px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-weight: 600; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
.form-grid > * { min-width: 0; }
#admin label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
#admin label.inline { display: inline-flex; flex-direction: row; align-items: center; margin: 0 12px 0 0; font-weight: 600; }
#admin input:not([type=checkbox]), #admin select, #admin textarea { font: inherit; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--base); min-height: 42px; width: 100%; }
#admin td input[type=number], #admin td select { min-width: 90px; }
#admin textarea { min-height: 80px; resize: vertical; }
#admin .card { margin: 16px 0; }
#admin h4 { margin: 16px 0 8px; }
#admin .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#admin .problem { color: #C93542; }
.admin-search { max-width: 420px; }
.chart.mini { position: relative; display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 80px; align-items: end; border-bottom: 1px solid var(--line); }
#admin textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; min-height: 260px; margin: 10px 0; }
#admin pre.report, #admin td pre { white-space: pre-wrap; max-height: 60vh; overflow: auto; font-size: 13px; }
#admin td input[type=text], #admin td input:not([type]) { min-width: 110px; }
#admin .checks { display: inline-flex; flex-wrap: wrap; gap: 4px 0; }

/* Individual plan and "Request an offer" (D-131) */
tr.highlight td { background: var(--soft); }
.tag.best { background: var(--lime); color: #2C3A12; border-color: transparent; margin-left: 6px; }
.offer-card { border-color: var(--green); margin: 8px 0 18px; }
.offer-card p { margin: 0 0 12px; }
form.offer { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
form.offer .wide { grid-column: 1 / -1; }
form.offer textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--base); }
form.offer fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
form.offer legend { font-weight: 700; font-size: 14px; padding: 0 4px; }
form.offer label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin-right: 14px; font-weight: 600; }
form.offer .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.card.sent { border-color: var(--green); font-weight: 600; }
.note.problem { color: #C93542; }
.card.alert { border-color: var(--red); background: var(--soft); }
.card.alert h3 { color: #C93542; }
