:root {
    --bg: #f3f7fb;
    --panel: #ffffff;
    --panel-muted: #f9fbfd;
    --line: #d8e3ef;
    --text: #12263f;
    --muted: #63758b;
    --primary: #1a56db;
    --primary-strong: #173fae;
    --danger: #c81e1e;
    --success: #0e9f6e;
    --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 45%, #e8eef8 100%);
    color: var(--text);
}

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

.admin-body {
    min-height: 100vh;
}

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

.sidebar {
    padding: 28px 20px;
    background: rgba(9, 30, 66, 0.94);
    color: #f8fbff;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 32px;
}

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

.nav-link {
    padding: 12px 14px;
    border-radius: 14px;
    color: rgba(248, 251, 255, 0.84);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.admin-main {
    padding: 20px 28px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(216, 227, 239, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-content {
    display: grid;
    gap: 24px;
}

.page-header,
.hero-actions,
.header-actions,
.toolbar,
.form-actions,
.pagination,
.table-actions,
.inline-stack {
    display: flex;
    gap: 12px;
    align-items: center;
}

.page-header {
    justify-content: space-between;
}

.toolbar {
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.toolbar-actions {
    margin-left: auto;
}

.page-grid {
    display: grid;
    gap: 24px;
}

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

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(216, 227, 239, 0.9);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.hero-card {
    min-height: 260px;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 55%, #eef7ff 100%);
}

.stat-card {
    justify-content: center;
    display: grid;
    align-content: center;
}

.stat-label,
.muted,
.eyebrow {
    color: var(--muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 700;
}

.stat-value {
    font-size: 2rem;
    line-height: 1.1;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card,
.form-card {
    width: min(100%, 520px);
}

.auth-card {
    background: rgba(255, 255, 255, 0.96);
    padding: 32px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(216, 227, 239, 0.9);
}

.auth-card__header {
    margin-bottom: 24px;
}

.stack-md {
    display: grid;
    gap: 16px;
}

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

.field span {
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel-muted);
    color: var(--text);
}

input:focus,
select:focus {
    outline: 2px solid rgba(26, 86, 219, 0.18);
    border-color: var(--primary);
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e9f0fb;
    color: var(--text);
}

.btn:hover {
    filter: brightness(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-strong);
}

.btn-secondary {
    background: #eef4fb;
    color: var(--text);
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-sm {
    padding: 8px 12px;
}

.btn-block {
    width: 100%;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf2f7;
    color: #3d4b63;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.alert-error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.alert-success {
    background: #ecfdf3;
    border-color: #a7f3d0;
    color: #065f46;
}

.field-error {
    color: #be123c;
}

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

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid #ebf0f6;
}

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

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 32px 12px;
}

.table-primary {
    font-weight: 700;
}

.table-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.85rem;
    word-break: break-word;
}

.link-block {
    overflow-wrap: anywhere;
}

.compact-list {
    display: grid;
    gap: 12px;
}

.compact-list__item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--panel-muted);
    border: 1px solid #ebf0f6;
}

.analytics-shell {
    display: grid;
    gap: 20px;
}

.analytics-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 240px;
}

.chart-bar {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.chart-bar__fill {
    width: 100%;
    min-height: 4px;
    border-radius: 999px 999px 6px 6px;
    background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
}

.chart-bar__label,
.chart-bar__value {
    font-size: 0.72rem;
    color: var(--muted);
    text-align: center;
}

.analytics-summary {
    flex-wrap: wrap;
}

.pagination {
    justify-content: flex-end;
    margin-top: 16px;
}

.pagination a {
    color: var(--primary);
    font-weight: 600;
}

.definition-list {
    display: grid;
    gap: 16px;
}

.definition-list div {
    display: grid;
    gap: 4px;
}

.definition-list dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.definition-list dd {
    margin: 0;
    font-weight: 600;
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.modal-root.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    width: min(100%, 520px);
    margin: 8vh auto 0;
    background: white;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    cursor: pointer;
}

@media (max-width: 960px) {
    .admin-shell,
    .page-grid--stats,
    .grid-2 {
        grid-template-columns: 1fr;
    }

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

    .page-header,
    .topbar,
    .header-actions,
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions {
        margin-left: 0;
    }
}
