/* ── ATM Styles ──────────────────────────────────────────────────────────── */
/* Theme system mirroring KMS — Inter + Source Serif 4 fonts, dark/light toggle */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

:root {
    /* Light (default) */
    --bg: #fafaf9;
    --surface: #ffffff;
    --border: #e5e5e4;
    --text: #1c1917;
    --text-muted: #78716c;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --tag-bg: #f1f5f9;
    --tag-color: #475569;
    --code-bg: #f8fafc;
    --badge-high-bg: #dcfce7;
    --badge-high-color: #166534;
    --badge-med-bg: #fef9c3;
    --badge-med-color: #854d0e;
    --badge-low-bg: #fee2e2;
    --badge-low-color: #991b1b;
    --flash-bg: #dcfce7;
    --flash-border: #bbf7d0;
    --flash-color: #166534;
    --toggle-bg: #e5e5e4;
    --toggle-icon: #78716c;
    --btn-text: #ffffff;
    --success: #16a34a;
    --danger: #dc2626;
}

/* Dark */
[data-theme="dark"] {
    --bg: #0c0a09;
    --surface: #1c1917;
    --border: #292524;
    --text: #f5f5f4;
    --text-muted: #a8a29e;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --tag-bg: #292524;
    --tag-color: #d6d3d1;
    --code-bg: #1c1917;
    --badge-high-bg: #052e16;
    --badge-high-color: #86efac;
    --badge-med-bg: #422006;
    --badge-med-color: #fde68a;
    --badge-low-bg: #450a0a;
    --badge-low-color: #fca5a5;
    --flash-bg: #052e16;
    --flash-border: #166534;
    --flash-color: #86efac;
    --toggle-bg: #292524;
    --toggle-icon: #a8a29e;
    --btn-text: #0c0a09;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg: #0c0a09;
        --surface: #1c1917;
        --border: #292524;
        --text: #f5f5f4;
        --text-muted: #a8a29e;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --tag-bg: #292524;
        --tag-color: #d6d3d1;
        --code-bg: #1c1917;
        --badge-high-bg: #052e16;
        --badge-high-color: #86efac;
        --badge-med-bg: #422006;
        --badge-med-color: #fde68a;
        --badge-low-bg: #450a0a;
        --badge-low-color: #fca5a5;
        --flash-bg: #052e16;
        --flash-border: #166534;
        --flash-color: #86efac;
        --toggle-bg: #292524;
        --toggle-icon: #a8a29e;
        --btn-text: #0c0a09;
    }
}

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

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9375rem;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--toggle-icon);
    background: var(--toggle-bg);
    transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover {
    opacity: 0.8;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */

.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.2s, border-color 0.2s;
}
.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-brand {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text);
}
.nav-links {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    align-items: center;
    margin-left: auto;
}

/* ── Content ─────────────────────────────────────────────────────────────── */

.content {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}
h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: background 0.2s, border-color 0.2s;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Two column layout ───────────────────────────────────────────────────── */

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
@media (max-width: 640px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: var(--btn-text);
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.btn:hover {
    background: var(--accent-hover);
    text-decoration: none;
    color: var(--btn-text);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--tag-bg);
    color: var(--text);
}
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */

.badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--tag-bg);
    color: var(--tag-color);
}
.badge-success {
    background: var(--badge-high-bg);
    color: var(--badge-high-color);
}
.badge-warning {
    background: var(--badge-med-bg);
    color: var(--badge-med-color);
}
.badge-danger {
    background: var(--badge-low-bg);
    color: var(--badge-low-color);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
tr:hover {
    background: var(--tag-bg);
}

/* ── Code ────────────────────────────────────────────────────────────────── */

code {
    background: var(--code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875em;
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}
pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
}
pre code {
    background: none;
    padding: 0;
}

/* ── JSON viewer ─────────────────────────────────────────────────────────── */

.json-block {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.8125rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* ── Error list ──────────────────────────────────────────────────────────── */

.error-list {
    list-style: none;
}
.error-list li {
    font-size: 0.8125rem;
    color: var(--danger);
    padding: 0.25rem 0;
}

/* ── ID monospace ───────────────────────────────────────────────────────── */

.id-mono {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.8125rem;
}

/* ── Section spacing ─────────────────────────────────────────────────────── */

.section {
    margin-bottom: 2rem;
}
