:root {
    --bg-page: #f5f5f4;
    --bg-surface: #ffffff;
    --bg-subtle: #f0f0ee;
    --bg-dark: #111110;
    --text-primary: #171717;
    --text-secondary: #5e5e57;
    --text-muted: #7a7a73;
    --border: #ddddda;
    --border-strong: #b9b9b2;
    --accent-primary: #111110;
    --accent-inverse: #f9f9f8;
    --status-ok: #2f6b47;
    --status-ok-bg: #e6f3ea;
    --status-warn: #8a5a14;
    --status-warn-bg: #f8ecd8;
    --status-danger: #8e3a33;
    --status-danger-bg: #f9e2df;
    --shadow-soft: 0 10px 30px rgba(17, 17, 16, 0.04);
    --sidebar-width: 220px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: Poppins, "DM Mono", "IBM Plex Mono", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.page-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fbfbfa;
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand__eyebrow {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.brand__title {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.brand__meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.nav {
    display: grid;
    gap: 6px;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 3px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.nav__link:hover,
.nav__link.is-active {
    background: var(--bg-surface);
    border-color: var(--border);
    color: var(--text-primary);
    box-shadow: var(--shadow-soft);
}

.nav__icon {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
}

.sidebar__footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 22px 28px 28px;
}

.topbar {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar__title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topbar__eyebrow {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar__heading {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 600;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card,
.hero,
.metric,
.info-band,
.status-card,
.table-wrap,
.final-band,
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: var(--shadow-soft);
}

.hero {
    background: var(--bg-dark);
    color: #f8f8f7;
    padding: 28px;
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(220px, 0.8fr);
    gap: 24px;
    margin-bottom: 18px;
    animation: fadeUp 0.35s ease both;
}

.hero__eyebrow {
    font-size: 11px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.68);
    margin-bottom: 10px;
}

.hero__title {
    font-size: 34px;
    line-height: 1.1;
    margin: 0 0 12px;
    font-weight: 600;
}

.hero__text {
    margin: 0;
    max-width: 720px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.7;
}

.hero__actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.hero__score {
    align-self: stretch;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}

.hero__score-label {
    color: rgba(255, 255, 255, 0.64);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero__score-value {
    font-size: 52px;
    line-height: 1;
    font-weight: 600;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    padding: 18px;
    animation: fadeUp 0.35s ease both;
}

.metric__label {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.metric__value {
    margin-top: 8px;
    font-size: 32px;
    line-height: 1;
    font-weight: 600;
}

.metric__foot {
    margin-top: 14px;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid--status {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.status-card {
    padding: 20px;
    display: grid;
    gap: 14px;
    animation: fadeUp 0.35s ease both;
}

.status-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.status-card__icon {
    width: 34px;
    height: 34px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-weight: 600;
}

.status-card__title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.status-card__text {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.status-card__link {
    font-size: 13px;
    color: var(--text-primary);
}

.info-band {
    border-left: 3px solid var(--accent-primary);
    padding: 16px 18px;
    margin-bottom: 18px;
    background: var(--bg-subtle);
}

.info-band__wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.info-band__title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
}

.info-band__text {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.info-band__links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn--primary {
    background: var(--accent-primary);
    color: var(--accent-inverse);
    border: none;
}

.btn--primary:hover {
    opacity: 0.93;
}

.btn--secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    font-size: 11px;
    text-transform: uppercase;
}

.badge--ok {
    background: var(--status-ok-bg);
    color: var(--status-ok);
}

.badge--warn {
    background: var(--status-warn-bg);
    color: var(--status-warn);
}

.badge--danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
}

.badge--neutral {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input,
.select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-surface);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(17, 17, 16, 0.08);
}

.table-wrap {
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #fbfbfa;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: top;
}

tbody tr:hover {
    background: var(--bg-subtle);
}

.table-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

tbody tr:hover .table-actions {
    opacity: 1;
}

.final-band {
    margin-top: 18px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.final-band__title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.final-band__text {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.flash {
    padding: 12px 14px;
    border-radius: 3px;
    margin-bottom: 16px;
    font-size: 13px;
}

.flash--success {
    background: var(--status-ok-bg);
    color: var(--status-ok);
    border: 1px solid rgba(47, 107, 71, 0.14);
}

.flash--error {
    background: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid rgba(142, 58, 51, 0.14);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 420px);
    padding: 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: var(--shadow-soft);
}

.login-card__title {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 600;
}

.login-card__text {
    margin: 0 0 22px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.stack {
    display: grid;
    gap: 14px;
}

.code-block {
    background: #fbfbfa;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 14px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.7;
}

.inline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

.note-indicator {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.note-indicator:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.note-indicator.has-note {
    background: #fde8e8;
    border-color: #ef4444;
    color: #b91c1c;
}

.note-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.note-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 16, 0.58);
}

.note-modal__dialog {
    position: relative;
    max-width: 720px;
    margin: 8vh auto 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    border-radius: 6px;
    overflow: hidden;
}

.note-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.note-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.note-modal__close {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    cursor: pointer;
}

.note-modal__body {
    padding: 18px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
    line-height: 1.7;
    max-height: 60vh;
    overflow: auto;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (max-width: 1100px) {
    .metrics,
    .grid--status,
    .form-row,
    .hero {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 860px) {
    .sidebar {
        position: static;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .page-shell {
        display: block;
    }

    .main {
        margin-left: 0;
        padding: 18px;
    }

    .metrics,
    .grid--status,
    .form-row,
    .hero,
    .info-band__wrap,
    .final-band {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .hero__title,
    .topbar__heading,
    .login-card__title {
        font-size: 24px;
    }

    .metric__value,
    .hero__score-value {
        font-size: 36px;
    }

    thead th,
    tbody td {
        padding-left: 12px;
        padding-right: 12px;
    }
}
