:root {
    --surface: #121826;
    --surface-muted: #1a2233;
    --ink: #f4f6fb;
    --muted: #9aa4b2;
    --border: #283246;
    --accent: #60a5fa;
    --accent-weak: rgba(96, 165, 250, 0.18);
    --shadow: 0 18px 40px rgba(3, 6, 15, 0.45);
    --max-width: 1200px;
}

body[data-theme="light"] {
    --surface: #ffffff;
    --surface-muted: #f6f8fb;
    --ink: #141b2d;
    --muted: #5b6374;
    --border: #e1e6ef;
    --accent: #2563eb;
    --accent-weak: rgba(37, 99, 235, 0.12);
    --shadow: 0 18px 40px rgba(12, 18, 34, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
    margin: 0;
    padding: 40px 20px 72px;
    line-height: 1.55;
    background: radial-gradient(circle at top, #0c1220, #0b111c 55%, #090f1a 100%);
    color: var(--ink);
    overflow-x: hidden;
    max-width: 100vw;
}

body[data-theme="light"] {
    background: radial-gradient(circle at top, #f8fafc, #eef2f7 55%, #e9eef5 100%);
}

.layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
    gap: 28px;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    align-items: start;
    width: 100%;
}

.page-header {
    max-width: var(--max-width);
    margin: 0 auto 26px;
    padding: 18px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.header-right {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.header-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.api-button {
    background: var(--accent-weak) !important;
}

.api-helper {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    padding-bottom: 5px;
}

@media (max-width: 768px) {
    .api-helper {
        display: none;
    }
}

.header-content {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.logo-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

h1 {
    font-size: 30px;
    letter-spacing: 0.01em;
    font-weight: 700;
    margin: 0;
}

.version {
    font-size: 11px;
    color: var(--muted);
    margin: 0;
    padding: 0;
    margin-top: -2px;
    font-weight: 400;
}

.subheader {
    font-size: 15px;
    color: var(--muted);
    margin: 0;
    font-weight: 400;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

#meta {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 14px;
}

.mobile-records-wrapper {
    display: none;
}

.mobile-records-button {
    display: none;
}

.sidebar {
    align-self: start;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.month-label {
    font-size: 18px;
    font-weight: 600;
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-month {
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

.report-month:first-child {
    border-top: none;
    padding-top: 0;
}

.report-month-title {
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.report-month-title::-webkit-details-marker {
    display: none;
}

.report-month-title::after {
    content: "▾";
    font-size: 12px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.report-month[open] .report-month-title::after {
    transform: rotate(180deg);
}

.card-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.card-info-toggle {
    font-size: 13px;
    font-weight: normal;
    font-style: italic;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.card-info-toggle::-webkit-details-marker {
    display: none;
}

.card-info-toggle::after {
    content: "▾";
    font-size: 12px;
    transition: transform 0.2s ease;
}

.card-info[open] .card-info-toggle::after {
    transform: rotate(180deg);
}

.card-info-toggle:hover {
    color: var(--accent);
}

.card-info-content {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.card-info-detail {
    margin-top: 14px;
    margin-left: 28px;
    margin-right: 10px;
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
    line-height: 1.5;
}

.card-info-detail ul {
    margin: 0;
    padding-left: 20px;
}

.card-info-detail li {
    margin-bottom: 4px;
}

.report-months {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.report-link {
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.report-link:hover {
    background: var(--surface-muted);
    color: var(--ink);
    transform: translateX(2px);
}

.report-link.active {
    background: var(--accent-weak);
    color: var(--ink);
    font-weight: 600;
}

.grid {
    display: grid;
    gap: 22px;
    grid-template-columns: 1fr;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 22px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 20px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
}

.card h3 {
    margin: 14px 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.kpi-row {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 10px;
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

.kpi-sub {
    font-size: 13px;
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.fg-red {
    color: #ef4444;
}

.fg-orange {
    color: #f97316;
}

.fg-yellow {
    color: #eab308;
}

.fg-lime {
    color: #84cc16;
}

.fg-green {
    color: #22c55e;
}

.fg-unknown {
    color: var(--muted);
}

.pos {
    color: #0f9d58;
}

.neg {
    color: #d14343;
}

.warning {
    color: #f59e0b;
}

.video-group {
    margin-bottom: 18px;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
}

.video img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.video-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.api-section {
    margin: 20px 0;
    max-width: 100%;
}

.api-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--ink);
}

.api-description {
    margin: 8px 0;
    color: var(--muted);
    font-size: 14px;
    max-width: 100%;
    word-wrap: break-word;
}

.code-block {
    display: block;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--ink);
    overflow-x: auto;
    margin: 8px 0;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}

pre.code-block {
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 640px) {
    .code-block {
        font-size: 11px;
        padding: 10px 12px;
        word-break: break-all;
    }
}

.api-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.api-link:hover {
    text-decoration: underline;
}

.page-footer {
    max-width: var(--max-width);
    margin: 40px auto 0;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    width: 100%;
}

.footer-content {
    color: var(--muted);
    font-size: 13px;
}

.footer-content p {
    margin: 8px 0;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-separator {
    color: var(--border);
}

@media (max-width: 720px) {
    body {
        padding: 36px 16px 64px;
    }

    h1 {
        font-size: 26px;
    }

    .card {
        padding: 18px 18px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .mobile-records-wrapper {
        display: block;
        max-width: var(--max-width);
        margin: 0 auto 16px;
    }

    .mobile-records-button {
        display: block;
        width: 100%;
        border: 1px solid var(--border);
        background: var(--surface);
        color: var(--ink);
        padding: 14px 18px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease;
        box-shadow: var(--shadow);
    }

    .mobile-records-button:hover {
        background: var(--surface-muted);
        border-color: var(--accent);
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 600px) {
    .video {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 24px 12px 60px;
    }

    h1 {
        font-size: 22px;
    }

    .subheader {
        font-size: 14px;
    }

    .theme-toggle {
        font-size: 12px;
        padding: 7px 12px;
    }

    .card {
        padding: 16px 14px;
    }

    .card h2 {
        font-size: 16px;
    }

    .api-section h3 {
        font-size: 15px;
    }
}