:root {
    --bg: #f5f1e8;
    --surface: rgba(255, 252, 246, 0.86);
    --surface-strong: #fffdf8;
    --text: #1d2431;
    --muted: #657183;
    --line: rgba(18, 37, 61, 0.12);
    --navy: #12253d;
    --accent: #d66a3c;
    --accent-deep: #ad4721;
    --success: #1f8a63;
    --warning: #c9841c;
    --danger: #be4639;
    --shadow: 0 22px 55px rgba(18, 37, 61, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(214, 106, 60, 0.16), transparent 32%),
        radial-gradient(circle at right, rgba(18, 37, 61, 0.12), transparent 25%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    position: relative;
}

.app-shell__gradient {
    position: fixed;
    inset: auto auto 0 0;
    width: 26rem;
    height: 26rem;
    background: radial-gradient(circle, rgba(214, 106, 60, 0.18), transparent 72%);
    pointer-events: none;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 2rem 1.5rem;
    background: rgba(18, 37, 61, 0.94);
    color: #f8f3ea;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.brand {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.brand__mark {
    width: 3rem;
    height: 3rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #f0c26b, var(--accent));
    color: #1f140d;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.brand strong,
.page-header h1,
.auth-panel h1,
.auth-card h2,
.panel h2,
.stat-card strong {
    font-family: Georgia, "Times New Roman", serif;
}

.nav-list {
    display: grid;
    gap: 0.5rem;
}

.nav-list a {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    color: rgba(248, 243, 234, 0.82);
}

.nav-list a.is-active,
.nav-list a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar__footer {
    margin-top: auto;
    display: grid;
    gap: 1rem;
}

.sidebar__footer p {
    margin: 0;
    color: rgba(248, 243, 234, 0.72);
}

.content {
    padding: 2.3rem;
}

.page-header,
.panel__header,
.row-meta,
.table-actions,
.diagnostic-card__header,
.inline-actions,
.checkbox-row,
.form-actions,
.pagination-wrap {
    display: flex;
    align-items: center;
}

.page-header {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.page-header h1,
.auth-panel h1,
.auth-card h2,
.panel h2 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.74rem;
    color: var(--accent-deep);
    font-weight: 700;
}

.page-header__copy,
.auth-panel p,
.panel__header p,
.brand small,
.auth-card__copy,
.field small,
.empty-state p,
.timeline__item p,
.stat-card small {
    color: var(--muted);
}

.flash,
.panel,
.stat-card,
.auth-card,
.auth-panel--copy,
.list-table__row,
.diagnostic-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.flash,
.panel,
.auth-card,
.auth-panel--copy {
    border-radius: var(--radius-lg);
}

.flash {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.flash--success {
    border-color: rgba(31, 138, 99, 0.18);
}

.flash--danger {
    border-color: rgba(190, 70, 57, 0.18);
}

.button {
    border: 0;
    border-radius: 999px;
    padding: 0.78rem 1.15rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: linear-gradient(135deg, var(--accent), #ed9350);
    color: #fff9f2;
}

.button--ghost {
    background: rgba(18, 37, 61, 0.06);
    color: var(--text);
}

.button--danger {
    color: var(--danger);
}

.button--block {
    width: 100%;
}

.stats-grid,
.content-grid,
.detail-grid,
.form-grid {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.content-grid,
.detail-grid {
    grid-template-columns: 1.35fr 1fr;
    margin-bottom: 1rem;
}

.stat-card,
.panel {
    padding: 1.4rem;
}

.stat-card {
    border-radius: 22px;
    min-height: 10rem;
    display: grid;
    gap: 0.55rem;
}

.stat-card span {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    font-weight: 700;
}

.stat-card strong {
    font-size: clamp(2rem, 3.2vw, 2.7rem);
}

.panel__header {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.row-meta,
.inline-actions,
.table-actions,
.form-actions,
.page-header__actions {
    gap: 0.7rem;
}

.list-table {
    display: grid;
    gap: 0.8rem;
}

.list-table__row {
    border-radius: 18px;
    padding: 1rem 1.1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.timeline {
    display: grid;
    gap: 0.8rem;
}

.timeline__item {
    display: grid;
    gap: 0.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.timeline__item:last-child {
    border-bottom: 0;
}

.empty-state {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 0;
}

.empty-state--compact {
    padding: 0.6rem 0;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table thead th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.8rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.pill--healthy {
    background: rgba(31, 138, 99, 0.12);
    color: var(--success);
}

.pill--warning {
    background: rgba(201, 132, 28, 0.13);
    color: var(--warning);
}

.pill--error {
    background: rgba(190, 70, 57, 0.12);
    color: var(--danger);
}

.pill--unknown {
    background: rgba(18, 37, 61, 0.08);
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 1rem;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.feature-list,
.auth-card,
.diagnostic-list,
.detail-list {
    display: grid;
    gap: 0.5rem;
}

.field span,
.detail-list dt {
    font-size: 0.88rem;
    font-weight: 700;
}

.field input {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(18, 37, 61, 0.12);
    background: var(--surface-strong);
    padding: 0.95rem 1rem;
    font: inherit;
}

.field small {
    color: var(--danger);
}

.detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list div,
.diagnostic-card {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.52);
}

.detail-list dd {
    margin: 0;
    word-break: break-word;
}

.diagnostic-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-list {
    list-style: none;
    padding: 0;
    margin: 0.35rem 0 0;
    display: grid;
    gap: 0.35rem;
}

.meta-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.88rem;
}

.meta-list span {
    color: var(--muted);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

.auth-page__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(214, 106, 60, 0.2), transparent 30%),
        radial-gradient(circle at bottom right, rgba(18, 37, 61, 0.2), transparent 32%);
}

.auth-layout {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr minmax(18rem, 28rem);
    gap: 1rem;
    max-width: 72rem;
    width: 100%;
}

.auth-panel {
    padding: 1.8rem;
    border-radius: var(--radius-lg);
}

.auth-panel--copy h1 {
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    line-height: 1.02;
}

.feature-list article {
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.feature-list article:last-child {
    border-bottom: 0;
}

.auth-panel--form {
    display: flex;
    align-items: center;
}

.auth-card {
    width: 100%;
    padding: 1.6rem;
}

.auth-hint {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(18, 37, 61, 0.05);
}

.checkbox-row {
    gap: 0.65rem;
    color: var(--muted);
}

.pagination-wrap {
    justify-content: flex-end;
    margin-top: 1rem;
}

@media (max-width: 1080px) {
    .app-shell,
    .auth-layout,
    .content-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        position: relative;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .content,
    .sidebar,
    .auth-page,
    .auth-panel,
    .auth-card {
        padding: 1.2rem;
    }

    .page-header,
    .panel__header,
    .inline-actions,
    .form-actions,
    .page-header__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid,
    .form-grid,
    .detail-list,
    .diagnostic-list {
        grid-template-columns: 1fr;
    }

    .list-table__row,
    .meta-list li,
    .row-meta {
        display: grid;
    }

    .table-actions {
        justify-content: flex-start;
    }
}
