/* Dashboard styles: the landing page's warm palette (landing/styles.css), dark only */

/* Inter, served from the binary (OFL, assets/fonts/inter-LICENSE.txt) */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/static/inter-5.3.0-latin-wght.woff2") format("woff2");
}

:root {
    --bg-primary: #0e0b08;
    --bg-secondary: #15110d;
    --bg-tertiary: #1b1611;
    --bg-card: #1d1812;
    --bg-raised: #262017;
    --border-color: #2e261c;
    --border-soft: rgba(246, 239, 228, 0.06);
    --border-hover: #4a3d2c;
    --text-primary: #f6efe4;
    --text-secondary: #c4b7a2;
    /* Lighter than the landing page's #847763, for AA on cards */
    --text-muted: #9d8f79;
    --accent: #e3ad62;
    --accent-hover: #f0bf78;
    --accent-strong: #cf963f;
    --accent-muted: rgba(227, 173, 98, 0.12);
    --accent-line: rgba(227, 173, 98, 0.35);
    --success: #7fcf95;
    --danger: #f08a76;
    --danger-muted: rgba(240, 138, 118, 0.1);
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 14px;
    --shadow-card: 0 1px 0 rgba(246, 239, 228, 0.04) inset, 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 70% 420px at 75% -80px, rgba(227, 173, 98, 0.09), transparent 70%),
        var(--bg-primary);
    color: var(--text-primary);
    font: 15px/1.5 var(--font-sans);
    font-feature-settings: "cv11", "ss01"; /* Inter's single-storey a, open digits */
    -webkit-font-smoothing: antialiased;
}

/* The landing page's film grain */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(rgba(227, 173, 98, 0.04) 1px, transparent 1px),
        radial-gradient(rgba(246, 239, 228, 0.025) 1px, transparent 1px);
    background-size: 3px 3px, 7px 7px;
    background-position: 0 0, 1px 2px;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection { background: rgba(227, 173, 98, 0.3); color: var(--text-primary); }

code, pre { font-family: var(--font-mono); font-size: 0.85em; }
p code, .card-sub code {
    padding: 0.05rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.icon {
    width: 1em;
    height: 1em;
    flex: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 20;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
    text-decoration: none;
}
.skip:focus { top: 0.75rem; }

/* ---------------------------------------------------------------- Top bar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(14, 11, 8, 0.72);
    backdrop-filter: blur(14px) saturate(1.2);
}

.topbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.brand:hover { color: var(--text-primary); }
.brand .tld { color: var(--text-muted); font-weight: 500; }

.logo-mark { width: 22px; height: 22px; flex: none; }
.logo-mark path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3.2;
    stroke-linecap: round;
}
.logo-mark circle { fill: var(--bg-primary); }

.crumb-sep { color: var(--border-hover); font-size: 1.25rem; font-weight: 300; }
.crumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 500;
}

.topbar-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-raised); }

.account {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    padding-left: 0.75rem;
    margin-left: 0.25rem;
    border-left: 1px solid var(--border-color);
}

.avatar {
    width: 28px;
    height: 28px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(140deg, #f0c27f, #b9792f);
    color: #1a1209;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(246, 239, 228, 0.12) inset;
}

.account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.account form { display: contents; }

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 36px;
    padding: 0 0.9rem;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 550;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
.btn:hover { border-color: #66543c; background: #2e2619; color: var(--text-primary); }
.btn:active { transform: translateY(1px); }
.btn .icon { font-size: 1rem; }

.btn.primary {
    border-color: transparent;
    background: linear-gradient(180deg, #ecbb74, var(--accent));
    color: #1a1209;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 18px -8px rgba(227, 173, 98, 0.7);
}
.btn.primary:hover {
    background: linear-gradient(180deg, #f5c886, var(--accent-hover));
    color: #1a1209;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 8px 24px -8px rgba(227, 173, 98, 0.85);
}

.btn.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--bg-raised); color: var(--text-primary); }
.btn.icon-only { width: 34px; height: 34px; padding: 0; }
.btn.icon-only .icon { font-size: 1.05rem; }
.logout-text { display: none; }

.btn.danger { background: transparent; border-color: var(--border-color); color: var(--danger); }
.btn.danger:hover { border-color: rgba(240, 138, 118, 0.5); background: var(--danger-muted); color: var(--danger); }

.btn.sm { height: 30px; padding: 0 0.7rem; font-size: 0.82rem; }
.btn.lg { height: 46px; padding: 0 1.25rem; font-size: 0.95rem; border-radius: var(--radius-md); }
.btn.block { display: flex; width: 100%; }

/* A copy button swaps its icon for a tick once copied (app.js adds .is-copied) */
.btn.copy { height: 30px; padding: 0 0.65rem; font-size: 0.8rem; }
.btn.copy .check-icon { display: none; }
.btn.copy.is-copied { border-color: rgba(127, 207, 149, 0.45); color: var(--success); }
.btn.copy.is-copied .copy-icon { display: none; }
.btn.copy.is-copied .check-icon { display: inline-flex; animation: pop 0.3s var(--ease); }
.copy-icon, .check-icon { display: inline-flex; }

/* ---------------------------------------------------------------- Page */

main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Overview: the org's name and its usage, over the landing page's ripples */
.overview {
    position: relative;
    margin-bottom: 1.5rem;
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(34, 28, 21, 0.9), rgba(21, 17, 13, 0.9));
    box-shadow: var(--shadow-card);
    overflow: hidden;
    isolation: isolate;
}
.overview::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: url("/static/ripples.svg") center bottom / cover no-repeat;
    opacity: 0.55;
    mask-image: linear-gradient(90deg, transparent 10%, #000 70%);
}
.overview::after {
    content: "";
    position: absolute;
    top: 0;
    left: 1.75rem;
    right: 1.75rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
}

.overview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

h1, h2 { margin: 0; letter-spacing: -0.02em; }

h1 {
    font-size: 2.1rem;
    font-weight: 680;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

h2 { font-size: 1.05rem; font-weight: 620; }

.plan {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
}
.plan-name { display: inline-block; }
.plan-name::first-letter { text-transform: uppercase; }
.plan-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.period {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(14, 11, 8, 0.5);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(14, 11, 8, 0.55);
    backdrop-filter: blur(2px);
}

.metric {
    padding: 1.1rem 1.25rem 1.2rem;
    min-width: 0;
}
.metric + .metric { border-left: 1px solid var(--border-color); }

.metric dt {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 0.95rem;
}

.metric-value {
    margin: 0.7rem 0 0.2rem;
    font-size: 2rem;
    font-weight: 640;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.unit {
    margin-left: 0.15em;
    color: var(--text-muted);
    font-size: 0.6em;
    font-weight: 500;
    letter-spacing: 0;
}

.metric-note { margin: 0; color: var(--text-muted); font-size: 0.8rem; }

/* Keys and quick start on the left, limits in a side column */
.columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}

.main-col { display: grid; gap: 1.5rem; min-width: 0; }
.side-col { display: grid; gap: 1.5rem; min-width: 0; }

.card {
    padding: 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    min-width: 0;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.card-sub { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.875rem; }

.card-foot {
    margin: 1rem 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------- Keys */

.key-count {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: none;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.key-count progress {
    appearance: none;
    width: 64px;
    height: 5px;
    border: 0;
    border-radius: 999px;
    background: var(--bg-raised);
    overflow: hidden;
}
.key-count progress::-webkit-progress-bar { background: var(--bg-raised); border-radius: 999px; }
.key-count progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.key-count progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.create {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.field {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}
.field .icon {
    position: absolute;
    font-size: 1rem;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.field input {
    width: 100%;
    height: 36px;
    padding: 0 0.75rem 0 2.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--text-muted); }
.field input:hover { border-color: var(--border-hover); }
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(227, 173, 98, 0.2);
}
.field:focus-within .icon { color: var(--accent); }

.notice {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 0 0 1.25rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.notice .icon { margin-top: 0.15rem; color: var(--accent); font-size: 1rem; }

/* The one-time new key */
.new-key {
    position: relative;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    background:
        radial-gradient(ellipse 60% 120% at 0% 0%, rgba(227, 173, 98, 0.16), transparent 70%),
        var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(227, 173, 98, 0.05), 0 10px 40px -20px rgba(227, 173, 98, 0.6);
    animation: rise 0.45s var(--ease);
}

.new-key-head { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.85rem; }

.new-key-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--accent);
    color: #1a1209;
    font-size: 1.05rem;
}
.new-key-icon .icon { stroke-width: 2.5; }

.new-key-title { margin: 0; font-weight: 620; }
.new-key-sub { margin: 0.1rem 0 0; color: var(--text-secondary); font-size: 0.875rem; }

.secret {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.4rem 0.4rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}
.secret code {
    flex: 1;
    min-width: 0;
    color: var(--accent-hover);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
    user-select: all;
}

/* The keys table */
.key-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.key-table th {
    padding: 0 0.75rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 550;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.key-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
    vertical-align: middle;
}
.key-table th:first-child, .key-table td:first-child { padding-left: 0.25rem; }
.key-table th:last-child, .key-table td:last-child { padding-right: 0.25rem; text-align: right; }
.key-table tbody tr { transition: background 0.15s; }
.key-table tbody tr:hover { background: rgba(246, 239, 228, 0.02); }
.key-table tbody tr:last-child td { border-bottom: 0; }

.key-name { font-weight: 550; }
.key-name > span:last-child { overflow-wrap: anywhere; }

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 0.6rem;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(127, 207, 149, 0.15);
    vertical-align: 0.08em;
}
.status-dot.off { background: var(--text-muted); box-shadow: none; opacity: 0.6; }

.unnamed { color: var(--text-muted); font-style: italic; font-weight: 450; }

.key-prefix code {
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.key-created, .key-used { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.never { color: var(--text-muted); }

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

tr.revoked td { color: var(--text-muted); }
tr.revoked .key-name > span:last-child { text-decoration: line-through; text-decoration-color: rgba(157, 143, 121, 0.5); }
tr.revoked .key-prefix code { color: var(--text-muted); }

.key-action form { display: inline; }

/* The environments page */
.page-head { margin-bottom: 1.5rem; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.data-table th {
    padding: 0 0.75rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 550;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}
.data-table td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { padding-left: 0.25rem; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0.25rem; text-align: right; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .list-cell { max-width: 16rem; white-space: normal; overflow-wrap: anywhere; color: var(--text-secondary); }

.tag.status-building { border-color: var(--accent-line); color: var(--accent); }
.tag.status-ready { border-color: rgba(127, 207, 149, 0.45); color: var(--success); }
.tag.status-failed { border-color: rgba(240, 138, 118, 0.5); color: var(--danger); }

.data-table .error-row td { padding-top: 0; text-align: left; white-space: normal; }
.error-row summary { color: var(--danger); cursor: pointer; font-size: 0.8rem; }
.build-error {
    max-height: 24rem;
    margin: 0.5rem 0 0;
    padding: 0.85rem;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    white-space: pre;
}

.upload { margin-bottom: 1.25rem; }
.upload-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.upload-field { display: grid; gap: 0.3rem; color: var(--text-muted); font-size: 0.75rem; font-weight: 550; }
.upload-field input {
    min-width: 0;
    height: 36px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
}
.upload-field input[type="file"] { padding: 0.35rem 0.5rem; }
.upload-field input:focus { outline: none; border-color: var(--accent); }
.upload-foot { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.upload-foot .card-sub { margin: 0; }

/* No keys yet */
.empty {
    display: grid;
    justify-items: center;
    padding: 1.75rem 1rem 1.25rem;
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    background: radial-gradient(ellipse 50% 80% at 50% 0%, rgba(227, 173, 98, 0.07), transparent 70%);
    text-align: center;
}

.empty-art {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 0.9rem;
    border: 1px solid var(--accent-line);
    border-radius: 16px;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 1.6rem;
    box-shadow: 0 0 0 8px rgba(227, 173, 98, 0.04), 0 0 0 16px rgba(227, 173, 98, 0.02);
}

.empty-title { margin: 0; font-weight: 620; font-size: 1rem; }
.empty-sub { max-width: 34ch; margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.875rem; }

/* ---------------------------------------------------------------- Code windows */

.window {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #0b0906;
    overflow: hidden;
}

.window-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.5rem 0.45rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.window-bar .btn { margin-left: auto; }

.window-dots { display: inline-flex; gap: 6px; }
.window-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-hover);
}
.window-dots i:first-child { background: #5a4530; }

.window-title { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }

.code {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.7;
}
.code code { font-size: inherit; }

.window-out {
    border-top: 1px dashed var(--border-color);
    background: rgba(21, 17, 13, 0.6);
}
.window-out .code { padding-top: 0.2rem; color: var(--text-secondary); white-space: pre-wrap; }

.out-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.7rem 1.1rem 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Syntax colours, all AA on the window background */
.tok-comment { color: #8a7d68; font-style: italic; }
.tok-fn { color: #f0c27f; }
.tok-kw { color: #e79a7b; }
.tok-flag { color: #d6a3e0; }
.tok-str { color: #a9d39a; }
.tok-var { color: #f0c27f; font-weight: 600; }
.tok-url { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-hover); text-underline-offset: 3px; }
.tok-key { color: #9cc3e6; }
.tok-num { color: #e0b36c; }
.tok-op { color: var(--text-muted); }

/* ---------------------------------------------------------------- Limits */

.limit-list { margin: 0; display: grid; }

.limit-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-top: 1px solid var(--border-soft);
}
.limit-list div:first-child { border-top: 0; padding-top: 0.2rem; }

.limit-list dt {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.limit-list dt .icon { color: var(--accent); font-size: 1rem; }

.limit-list dd {
    margin: 0;
    font-weight: 620;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.limit-list .unit { font-size: 0.8em; }

.limits .card-foot { padding-top: 1rem; border-top: 1px solid var(--border-soft); line-height: 1.55; }

/* Callbacks, the feature to try next */
.callbacks {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 90% 70% at 100% 0%, rgba(227, 173, 98, 0.12), transparent 70%),
        var(--bg-card);
}

.callbacks-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 0.9rem;
    border: 1px solid var(--accent-line);
    border-radius: 10px;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 1.1rem;
}

.callbacks .card-sub { line-height: 1.6; }

.flow {
    margin: 1rem 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #0b0906;
    font-size: 0.75rem;
    line-height: 1.8;
}
.flow-in { color: var(--accent); }
.flow-out { color: var(--success); }

/* Coming soon */
.soon-list { margin: 0.6rem 0 0; padding: 0; list-style: none; }

.soon-list li {
    padding: 0.8rem 0;
    border-top: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.55;
}
.soon-list li:first-child { border-top: 0; }
.soon-list strong { display: block; color: var(--text-secondary); font-weight: 620; }

/* ---------------------------------------------------------------- Sign in */

.signin {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-areas: "card pitch";
    gap: 4rem;
    align-items: center;
    /* Near the top rather than centred in the viewport, so the CTA is above the fold */
    padding-top: clamp(0.5rem, 6vh, 4rem);
}

.signin-card {
    grid-area: card;
    position: relative;
    padding: 2.25rem 2rem 1.75rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(180deg, #221c15, #18130e);
    box-shadow: var(--shadow-card), 0 30px 80px -40px rgba(227, 173, 98, 0.35);
    text-align: center;
}
.signin-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
}

.signin-mark {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin: 0 auto 1.25rem;
    border: 1px solid var(--border-hover);
    border-radius: 16px;
    background: var(--bg-secondary);
    box-shadow: 0 0 0 8px rgba(227, 173, 98, 0.04), 0 0 30px -6px rgba(227, 173, 98, 0.4);
}
.signin-mark .logo-mark { width: 32px; height: 32px; }
.signin-mark .logo-mark circle { fill: var(--bg-secondary); }

.signin-card h1 { font-size: 1.5rem; }
.signin-sub { margin: 0.5rem 0 1.5rem; color: var(--text-secondary); }
.github-mark { width: 18px; height: 18px; }
.signin-fine { margin: 1rem 0 0; color: var(--text-muted); font-size: 0.8rem; }

.signin-pitch { grid-area: pitch; min-width: 0; }

.pitch {
    margin: 0 0 1rem;
    font-size: 2.6rem;
    font-weight: 680;
    line-height: 1.1;
    letter-spacing: -0.035em;
}
.pitch-accent {
    background: linear-gradient(90deg, #f4cd8f, var(--accent) 60%, #d08b3c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.pitch-sub {
    max-width: 46ch;
    margin: 0 0 1.75rem;
    color: var(--text-secondary);
    font-size: 1.02rem;
}

.signin-pitch .window { max-width: 520px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8); }

/* ---------------------------------------------------------------- Motion */

@keyframes rise {
    from { opacity: 0; transform: translateY(6px) scale(0.99); }
    to { opacity: 1; transform: none; }
}

@keyframes pop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* htmx marks swapped-in content; fade the keys card in */
#keys.htmx-added { opacity: 0; }
#keys { transition: opacity 0.2s; }

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

/* ---------------------------------------------------------------- Narrow screens */

@media (max-width: 1000px) {
    .columns { grid-template-columns: minmax(0, 1fr); }
    .side-col { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
    .signin {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "card" "pitch";
        justify-items: center;
        gap: 3rem;
        min-height: 0;
    }
    .signin-card { width: 100%; max-width: 420px; }
    .signin-pitch { max-width: 520px; width: 100%; }
}

@media (max-width: 720px) {
    .metrics { grid-template-columns: minmax(0, 1fr); }
    .metric + .metric { border-left: 0; border-top: 1px solid var(--border-color); }
    .metric {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.2rem 1rem;
        padding: 0.9rem 1rem;
    }
    .metric-value { margin: 0; font-size: 1.35rem; text-align: right; }
    .metric-note { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .topbar-inner { padding: 0 1rem; gap: 0.5rem; }
    .brand .tld { display: none; }
    .account-name { display: none; }
    .nav-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .account { padding-left: 0.5rem; margin-left: 0; }
    main { padding: 1.25rem 1rem 3rem; }
    .overview { padding: 1.25rem; }
    .overview-head { margin-bottom: 1.25rem; }
    h1 { font-size: 1.65rem; }
    .card { padding: 1.1rem; }
    .card-head { flex-direction: column; gap: 0.6rem; }
    .create { flex-direction: column; }
    .create .btn { width: 100%; }
    .upload-fields { grid-template-columns: minmax(0, 1fr); }
    .upload-foot { flex-direction: column; align-items: stretch; }
    /* Wide tables scroll sideways rather than widen the page */
    .data-table { display: block; overflow-x: auto; }

    /* The table becomes a list of cards, so Revoke stays on screen */
    .key-table, .key-table tbody { display: block; }
    .key-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .key-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "name action" "prefix action" "created used";
        gap: 0.35rem 1rem;
        padding: 0.85rem 0;
        border-bottom: 1px solid var(--border-soft);
    }
    .key-table tbody tr:last-child { border-bottom: 0; }
    .key-table td, .key-table td:first-child, .key-table td:last-child { padding: 0; border: 0; text-align: left; }
    .key-name { grid-area: name; white-space: normal; }
    .key-prefix { grid-area: prefix; }
    .key-created { grid-area: created; }
    .key-used { grid-area: used; }
    .key-action { grid-area: action; align-self: center; justify-self: end; }
    .key-created, .key-used { font-size: 0.8rem; }
    .key-created::before, .key-used::before {
        content: attr(data-label) " ";
        color: var(--text-muted);
    }
    .key-used { text-align: right; }

    .pitch { font-size: 2rem; }
    .signin-card { padding: 1.75rem 1.25rem 1.5rem; }
    .code { font-size: 0.75rem; padding: 0.85rem; }
}

/* A "read more" link at the end of a card */
.more {
    display: inline-block;
    margin-top: 0.9rem;
    font-size: 0.875rem;
    font-weight: 550;
    text-decoration: none;
}

.more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------- Docs */

.docs {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}

.docs-nav {
    position: sticky;
    top: 5rem;
    font-size: 0.875rem;
}

.docs-nav-title {
    margin: 0 0 0.6rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.docs-nav ul {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    border-left: 1px solid var(--border-color);
}

.docs-nav li a {
    display: block;
    padding: 0.3rem 0 0.3rem 0.9rem;
    margin-left: -1px;
    border-left: 1px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
}

.docs-nav li a:hover {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.docs-raw {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.prose {
    max-width: 760px;
    min-width: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.prose h1 {
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 2.1rem;
    letter-spacing: -0.025em;
}

.prose h2 {
    margin: 3rem 0 0.9rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.45rem;
    scroll-margin-top: 5rem;
}

.prose h3 {
    margin: 2rem 0 0.6rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    scroll-margin-top: 5rem;
}

.prose p,
.prose ul,
.prose ol { margin: 0 0 1rem; }

.prose li { margin: 0.3rem 0; }
.prose strong { color: var(--text-primary); }

.prose a {
    color: var(--accent);
    text-underline-offset: 3px;
}

.prose :not(pre) > code {
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

.prose pre {
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.prose pre code { font-family: var(--font-mono); }

/* Wide tables scroll on their own rather than widening the page */
.prose table {
    display: block;
    max-width: 100%;
    margin: 0 0 1.25rem;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.prose th,
.prose td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.prose th {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.prose td:first-child { white-space: nowrap; }

/* Codes and field names stay whole in tables; the table scrolls instead */
.prose td code { overflow-wrap: normal; white-space: nowrap; }
.prose td:last-child { min-width: 16rem; }

@media (max-width: 600px) {
    /* Each row becomes a stack: name and type on one line, then the meaning */
    .prose table, .prose tbody, .prose tr { display: block; }
    .prose thead { display: none; }
    .prose tr { padding: 0.7rem 0; border-bottom: 1px solid var(--border-color); }
    .prose td { display: inline; padding: 0 0.5rem 0 0; border: 0; }
    .prose td:last-child { display: block; min-width: 0; margin-top: 0.35rem; }
    .prose td code { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 900px) {
    .docs { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .docs-nav { position: static; }
    .docs-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; border-left: 0; }
    .docs-nav li a { padding: 0.15rem 0; border-left: 0; }
}
