:root {
    --app-bg: #f4f6f8;
    --app-surface: #ffffff;
    --app-surface-soft: #f9fafb;
    --app-border: #d8dee8;
    --app-border-strong: #c4cedb;
    --app-text: #17202c;
    --app-muted: #66768a;
    --app-primary: #2555d7;
    --app-primary-dark: #1f45ad;
    --app-success: #15805f;
    --app-warning: #a15c00;
    --app-danger: #b4233c;
    --app-sidebar: #111827;
    --app-sidebar-soft: #1f2937;
    --app-sidebar-text: #d9e2ef;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
}

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

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-size: 0.95rem;
}

a {
    color: var(--app-primary);
}

.login-body {
    background: #eef2f7;
}

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

.login-panel {
    width: min(100%, 430px);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 34px;
    box-shadow: var(--shadow-md);
}

.admin-body {
    background: var(--app-bg);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
}

.admin-sidebar {
    width: 264px;
    flex: 0 0 264px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 16px;
    background: var(--app-sidebar);
    color: var(--app-sidebar-text);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    color: #fff;
    text-decoration: none;
}

.admin-brand:hover {
    color: #fff;
}

.admin-brand strong,
.admin-brand small {
    display: block;
    line-height: 1.2;
}

.admin-brand small {
    color: #aebbd0;
    font-size: 0.78rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #2f64e8;
    color: #fff;
    font-weight: 800;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--app-sidebar-text);
    text-decoration: none;
    font-weight: 600;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    color: #98a7bc;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--app-sidebar-soft);
    color: #fff;
}

.sidebar-link.active i {
    color: #7dd3fc;
}

.sidebar-status {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #c7d2e4;
    font-size: 0.86rem;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-topbar {
    min-height: 68px;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--app-border);
    backdrop-filter: blur(10px);
}

.topbar-kicker {
    display: block;
    color: var(--app-muted);
    font-size: 0.8rem;
}

.topbar-user,
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface-soft);
    color: var(--app-text);
    font-weight: 600;
}

.admin-main > main.container-fluid {
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 7px;
    font-weight: 600;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
}

.btn-outline-secondary {
    --bs-btn-color: #465569;
    --bs-btn-border-color: #cdd6e3;
    --bs-btn-hover-bg: #eef2f7;
    --bs-btn-hover-border-color: #b8c4d3;
    --bs-btn-hover-color: #17202c;
}

.alert {
    border-radius: 8px;
}

.badge {
    border-radius: 999px;
    padding: 0.45em 0.72em;
    font-weight: 700;
}

.metric-card,
.panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.metric-card {
    min-height: 126px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

.metric-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eef2ff;
    color: var(--app-primary);
}

.metric-card.tone-green .metric-icon {
    background: #e9f8f1;
    color: var(--app-success);
}

.metric-card.tone-amber .metric-icon {
    background: #fff4df;
    color: var(--app-warning);
}

.metric-card.tone-rose .metric-icon {
    background: #fff0f3;
    color: var(--app-danger);
}

.metric-card.tone-slate .metric-icon {
    background: #eef2f7;
    color: #475569;
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.metric-value {
    margin-top: 20px;
    font-size: 2.35rem;
    line-height: 1;
}

.panel {
    overflow: hidden;
}

.panel-header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--app-border);
    background: #fbfcfe;
}

.panel-body,
.form-panel,
.panel > .table-responsive,
.panel > dl {
    padding: 20px;
}

.panel > .table-responsive {
    padding: 0;
}

.form-label {
    color: #344256;
    font-weight: 700;
}

.form-control,
.form-select {
    border-color: #ccd6e3;
    border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
    border-color: #7aa2f7;
    box-shadow: 0 0 0 0.2rem rgba(37, 85, 215, 0.14);
}

.table {
    --bs-table-color: var(--app-text);
    --bs-table-hover-bg: #f7f9fc;
}

.table thead th {
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid var(--app-border);
    background: #f8fafc;
    color: #526174;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 0.75rem;
    border-bottom-color: #e8edf4;
    vertical-align: middle;
}

.table th,
.table td {
    white-space: nowrap;
}

.table td:first-child,
.table th:first-child {
    padding-left: 20px;
}

.table td:last-child,
.table th:last-child {
    padding-right: 20px;
}

.table .text-wrap {
    white-space: normal;
    min-width: 260px;
}

.source-link {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-text);
    text-decoration: none;
    background: var(--app-surface);
    box-shadow: var(--shadow-sm);
}

.source-link:hover {
    border-color: var(--app-border-strong);
    background: #fbfcff;
}

.source-link span {
    color: var(--app-muted);
    font-weight: 700;
}

.source-link strong {
    font-size: 2rem;
    line-height: 1;
}

.pagination {
    gap: 4px;
}

.page-link {
    border-radius: 7px;
    border-color: var(--app-border);
    color: var(--app-primary);
}

@media (max-width: 991.98px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
        position: static;
        padding: 16px;
        gap: 14px;
    }

    .sidebar-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sidebar-link {
        flex: 0 0 auto;
    }

    .sidebar-status {
        display: none;
    }

    .admin-topbar {
        position: static;
        padding: 14px 18px;
    }

    .admin-main > main.container-fluid {
        padding: 20px !important;
    }
}

@media (max-width: 575.98px) {
    .login-panel {
        padding: 26px;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
    }

    .user-chip {
        max-width: 62%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .metric-value,
    .source-link strong {
        font-size: 2rem;
    }
}
