:root {
    --bg: #f3f6fb;
    --bg-accent: #e8eef9;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-muted: #f8fafc;
    --line: #d9e2ef;
    --line-strong: #bfd0e6;
    --text: #0f172a;
    --text-soft: #475569;
    --text-faint: #64748b;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: #e8f0ff;
    --success: #15803d;
    --success-soft: #eaf8ef;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --shadow-lg: 0 26px 60px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 18px 32px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.04);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font: 15px/1.6 "Manrope", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30rem),
        radial-gradient(circle at bottom right, rgba(148, 163, 184, 0.12), transparent 28rem),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 44%, #eef3f9 100%);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(148, 163, 184, 0.12) 0.8px, transparent 0.8px);
    background-size: 18px 18px;
    opacity: 0.24;
}

.layout-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    width: 100%;
}

.layout-shell--centered {
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    padding: 32px 18px;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px 22px;
    border-right: 1px solid rgba(191, 208, 230, 0.7);
    background: rgba(246, 249, 253, 0.92);
    backdrop-filter: blur(20px);
}

.brand-card {
    display: grid;
    gap: 12px;
    padding: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(191, 208, 230, 0.85);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.88)),
        var(--surface-strong);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.brand-card__eyebrow,
.topbar__eyebrow,
.side-panel__label,
.section-heading__eyebrow,
.metric-card__eyebrow,
.auth-panel__eyebrow {
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-faint);
}

.brand-card__title,
.topbar__title,
.section-heading__title,
.auth-panel__title {
    display: block;
    margin: 0;
    font-size: clamp(1.7rem, 2.8vw, 2.6rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text);
}

.brand-card__title {
    font-size: 2.2rem;
}

.brand-card__sub,
.metric-card__note,
.auth-panel__sub,
.helper-copy,
.empty-state,
.table-empty,
.side-panel__value {
    color: var(--text-soft);
}

.side-nav {
    display: grid;
    gap: 10px;
}

.side-nav__link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-soft);
    font-weight: 700;
    text-decoration: none;
    transition: 160ms ease;
}

.side-nav__link:hover {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(191, 208, 230, 0.8);
    color: var(--text);
}

.side-nav__link--active {
    background: var(--surface-strong);
    border-color: rgba(191, 208, 230, 0.9);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
}

.side-panel__footer {
    margin-top: auto;
    display: grid;
    gap: 6px;
    padding: 18px 16px;
    border-radius: 16px;
    border: 1px solid rgba(191, 208, 230, 0.8);
    background: rgba(255, 255, 255, 0.72);
}

.side-panel__value {
    font-size: 13px;
    font-weight: 700;
    word-break: break-all;
}

.main-panel {
    padding: 28px;
    width: 100%;
    min-width: 0;
}

.main-panel > section,
.main-panel > footer {
    width: 100%;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(191, 208, 230, 0.7);
}

.topbar__eyebrow {
    margin-bottom: 10px;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topbar__actions form {
    margin: 0;
}

.button,
.button-inline,
.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: 160ms ease;
}

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

.button--accent,
.copy-button {
    color: #ffffff;
    background: linear-gradient(180deg, #2f6fff, #1d4ed8);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.2);
}

.button--soft {
    color: #ffffff;
    background: linear-gradient(180deg, #ef4444, #dc2626);
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.16);
}

.button--ghost,
.button-inline {
    color: var(--text);
    border-color: rgba(191, 208, 230, 0.95);
    background: rgba(255, 255, 255, 0.9);
}

.button--ghost:hover,
.button-inline:hover {
    border-color: rgba(37, 99, 235, 0.28);
    color: var(--accent-strong);
}

.button--danger {
    color: #ffffff;
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(191, 208, 230, 0.85);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

.flash--success {
    border-color: rgba(21, 128, 61, 0.16);
    background: var(--success-soft);
}

.flash--error {
    border-color: rgba(220, 38, 38, 0.14);
    background: var(--danger-soft);
}

.auth-panel,
.surface-card,
.metric-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.92)),
        var(--surface);
    border: 1px solid rgba(191, 208, 230, 0.86);
    box-shadow: var(--shadow-lg);
}

.auth-panel {
    width: min(100%, 560px);
    padding: 30px;
    border-radius: var(--radius-xl);
}

.auth-panel__sub {
    margin-top: 12px;
    max-width: 42ch;
}

.surface-card {
    width: 100%;
    padding: 24px;
    border-radius: var(--radius-lg);
}

.surface-grid {
    display: grid;
    gap: 18px;
    width: 100%;
}

.surface-grid--two {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
    width: 100%;
}

.metric-card {
    display: grid;
    align-content: space-between;
    min-height: 170px;
    padding: 22px;
    border-radius: 20px;
}

.metric-card__value {
    display: block;
    margin-top: 14px;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text);
}

.metric-card__note {
    margin-top: auto;
    padding-top: 16px;
    font-size: 13px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading__title {
    margin-top: 6px;
    font-size: clamp(1.2rem, 2.2vw, 1.85rem);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field label,
.field__legend {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    outline: none;
    transition: 160ms ease;
}

.field textarea {
    min-height: 120px;
    padding: 14px;
    resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #94a3b8;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(37, 99, 235, 0.42);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.field--toggle {
    align-content: start;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle__track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: 160ms ease;
}

.toggle__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    transition: 160ms ease;
}

.toggle input:checked + .toggle__track {
    background: var(--accent);
}

.toggle input:checked + .toggle__track::after {
    transform: translateX(20px);
}

.toggle__label {
    font-weight: 700;
    color: var(--text-soft);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-chip,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.status-badge--active {
    color: var(--success);
    border-color: rgba(21, 128, 61, 0.18);
    background: var(--success-soft);
}

.status-badge--inactive {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.12);
    background: var(--danger-soft);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid rgba(191, 208, 230, 0.86);
    background: rgba(248, 250, 252, 0.86);
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

th,
td {
    padding: 16px;
    border-bottom: 1px solid rgba(217, 226, 239, 0.9);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: rgba(255, 255, 255, 0.78);
}

tr:last-child td {
    border-bottom: 0;
}

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-faint);
    word-break: break-all;
}

.link-title {
    display: grid;
    gap: 6px;
}

.link-title strong {
    color: var(--text);
    font-size: 15px;
}

.subtle-list {
    display: grid;
    gap: 10px;
}

.subtle-list__item {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-muted);
}

.subtle-list__item strong,
.detail-key {
    color: var(--text);
}

.detail-stack {
    display: grid;
    gap: 14px;
}

.detail-row {
    display: grid;
    gap: 6px;
}

.footer-note {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    color: var(--text-faint);
    font-size: 13px;
}

.empty-state,
.table-empty {
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed rgba(191, 208, 230, 0.95);
    background: rgba(255, 255, 255, 0.72);
}

.stack {
    display: grid;
    gap: 18px;
    width: 100%;
}

.split-text {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.table-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: max-content;
    white-space: nowrap;
}

.table-actions form {
    margin: 0;
    display: inline-flex;
}

.table-actions .button-inline,
.table-actions .copy-button {
    width: auto;
    min-width: 68px;
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
    white-space: nowrap;
}

.cell-actions {
    width: 1%;
    white-space: nowrap;
}

.filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.filter-row__actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

@media (max-width: 1180px) {
    .layout-shell {
        grid-template-columns: 1fr;
    }

    .side-panel {
        border-right: 0;
        border-bottom: 1px solid rgba(191, 208, 230, 0.7);
    }
}

@media (max-width: 900px) {
    .surface-grid--two,
    .metrics-grid,
    .form-grid--two {
        grid-template-columns: 1fr;
    }

    .topbar,
    .split-text,
    .footer-note {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-row__actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 720px) {
    .main-panel,
    .side-panel,
    .auth-panel,
    .surface-card,
    .metric-card {
        padding: 20px;
    }

    .topbar__actions,
    .form-actions,
    .inline-actions,
    .table-actions,
    .filter-row__actions {
        width: 100%;
    }

    .button,
    .button-inline,
    .copy-button {
        width: 100%;
    }

    .topbar__title {
        font-size: 2rem;
    }

    .brand-card__title {
        font-size: 1.9rem;
    }

    .table-actions {
        flex-wrap: wrap;
        min-width: 0;
    }
}
