/* Design tokens. Dark is the designed default. Light applies when the visitor picks it
   (data-theme="light" on <html>, set by theme.js) or, with no choice saved, when the OS is light. */
:root {
    color-scheme: dark;
    --bg: #0A0B10;
    --bg-alt: #0D0E14;
    --surface: #10121A;
    --surface-2: #11131A;
    --surface-3: #1A1D27;
    --row-hover: #171A23;
    --row-active: #181B25;
    --code-bg: #0B0C12;
    --input-bg: #0A0B10;
    --nav-bg: rgba(10, 11, 16, 0.86);
    --border: #1E212C;
    --border-strong: #262A36;
    --border-hover: #353A4A;
    --text: #ECEEF3;
    --text-2: #D7D9E0;
    --text-3: #C9CDD8;
    --muted: #A3A9B9;
    --subtle: #8A91A3;
    --faint: #7F8698;
    --accent: #5457E5;
    --accent-text: #FFFFFF;
    --accent-soft: #9EA1F9;
    --accent-glow: rgba(91, 94, 234, 0.55);
    --link: #B4B6FB;
    --link-hover: #D4D5FD;
    --live: #4ADE80;
    --live-text: #4ADE80;
    --live-ring: rgba(74, 222, 128, 0.18);
    --danger: #F87171;
    --warn-bg: rgba(251, 191, 36, 0.10);
    --warn-border: rgba(251, 191, 36, 0.35);
    --grid-line: #1A1D27;
    --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
    --badge-text: #0A0B10;
    --m-get: #7DB4FF;
    --m-post: #4ADE80;
    --m-put: #FBBF24;
    --m-patch: #C4B5FD;
    --m-delete: #F87171;
    --m-other: #A3A9B9;
    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg: #FFFFFF;
        --bg-alt: #F7F8FA;
        --surface: #FFFFFF;
        --surface-2: #F7F8FA;
        --surface-3: #F1F2F6;
        --row-hover: #F4F5F8;
        --row-active: #EEEFFD;
        --code-bg: #F7F8FA;
        --input-bg: #F7F8FA;
        --nav-bg: rgba(255, 255, 255, 0.86);
        --border: #E4E6EC;
        --border-strong: #D9DCE4;
        --border-hover: #C3C7D2;
        --text: #0F1117;
        --text-2: #1F2330;
        --text-3: #2C3140;
        --muted: #4F5666;
        --subtle: #5B6273;
        --faint: #646B7C;
        --accent-soft: #4346D0;
        --accent-glow: rgba(84, 87, 229, 0.35);
        --link: #4346D0;
        --link-hover: #2F32B0;
        --live-text: #15803D;
        --live-ring: rgba(22, 163, 74, 0.18);
        --danger: #B91C1C;
        --warn-bg: #FFF7E6;
        --warn-border: #F5D08A;
        --grid-line: #ECEEF3;
        --shadow-lg: 0 30px 60px -30px rgba(15, 17, 23, 0.25);
    }
}

/* Same light tokens, for an explicit choice regardless of the OS setting. */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #FFFFFF;
    --bg-alt: #F7F8FA;
    --surface: #FFFFFF;
    --surface-2: #F7F8FA;
    --surface-3: #F1F2F6;
    --row-hover: #F4F5F8;
    --row-active: #EEEFFD;
    --code-bg: #F7F8FA;
    --input-bg: #F7F8FA;
    --nav-bg: rgba(255, 255, 255, 0.86);
    --border: #E4E6EC;
    --border-strong: #D9DCE4;
    --border-hover: #C3C7D2;
    --text: #0F1117;
    --text-2: #1F2330;
    --text-3: #2C3140;
    --muted: #4F5666;
    --subtle: #5B6273;
    --faint: #646B7C;
    --accent-soft: #4346D0;
    --accent-glow: rgba(84, 87, 229, 0.35);
    --link: #4346D0;
    --link-hover: #2F32B0;
    --live-text: #15803D;
    --live-ring: rgba(22, 163, 74, 0.18);
    --danger: #B91C1C;
    --warn-bg: #FFF7E6;
    --warn-border: #F5D08A;
    --grid-line: #ECEEF3;
    --shadow-lg: 0 30px 60px -30px rgba(15, 17, 23, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1:focus { outline: none; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
code, pre, kbd { font-family: var(--mono); }
pre { margin: 0; }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.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;
}

.muted { color: var(--muted); }
.container { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn:hover { background: var(--row-hover); border-color: var(--border-hover); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-text); filter: brightness(1.12); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--subtle); }
.btn-quiet:hover { background: var(--surface-3); border-color: transparent; }
.btn-lg { height: 52px; padding: 0 24px; border-radius: 10px; font-size: 16px; font-weight: 600; }
.btn-lg.btn-ghost { font-weight: 500; color: var(--text); }
.btn-glow { box-shadow: 0 8px 24px -8px var(--accent-glow); }
.btn svg { flex-shrink: 0; }
form.inline { display: inline-flex; margin: 0; }

/* Brand + top navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-nav { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 14px; padding: 10px 4px; }
.nav-link:hover { color: var(--text); }

/* Theme switcher (System / Light / Dark). The active option follows the <html> attribute,
   so it stays correct across Blazor re-renders without any per-button state. */
.theme-toggle {
    display: inline-flex;
    padding: 2px;
    gap: 2px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface-2);
}
.theme-toggle button {
    width: 30px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--subtle);
    cursor: pointer;
}
.theme-toggle button:hover { color: var(--text); }
:root:not([data-theme]) .theme-toggle [data-theme-choice="system"],
:root[data-theme="light"] .theme-toggle [data-theme-choice="light"],
:root[data-theme="dark"] .theme-toggle [data-theme-choice="dark"] {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--border-strong);
}

/* Live indicator */
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--live-text); font-size: 12px; font-weight: 500; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.check-icon { color: var(--live-text); flex-shrink: 0; }

/* Method badges */
.method {
    display: inline-block;
    min-width: 46px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--badge-text);
    background: var(--m-other);
    flex-shrink: 0;
}
.m-get { background: var(--m-get); }
.m-post { background: var(--m-post); }
.m-put { background: var(--m-put); }
.m-patch { background: var(--m-patch); }
.m-delete { background: var(--m-delete); }

/* Labels, code, key/value lists */
.label {
    font-size: 11px;
    font-weight: 600;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.eyebrow {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-soft);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.code-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--code-bg);
    padding: 12px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-3);
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}
.kv {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--code-bg);
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--mono);
    font-size: 12px;
}
.kv-row { display: flex; gap: 8px; min-width: 0; }
.kv-key { color: var(--accent-soft); flex-shrink: 0; }
.kv-val { color: var(--text-3); word-break: break-all; }

.url-field {
    flex: 1 1 220px;
    min-width: 0;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-2);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Request rows (landing preview + dashboard) */
.req-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    min-height: 56px;
    border: 0;
    border-left: 2px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.req-row:hover { background: var(--row-hover); }
.req-row.active { background: var(--row-active); border-left-color: var(--accent); }
.req-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.req-row-title { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-row-meta { font-size: 12px; color: var(--faint); font-family: var(--mono); }

/* Simple centred pages (404, expired bin) */
.center-page {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    padding: 64px 24px;
}
.center-page h1 { margin: 0; font-size: clamp(32px, 5vw, 44px); letter-spacing: -0.03em; line-height: 1.1; }
.center-page p { margin: 0 0 8px; color: var(--muted); font-size: 17px; max-width: 34rem; }

/* Blazor error UI */
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }
