* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    color: #172033;
    background: #f4f7fb;
}

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

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

.admin-sidebar {
    width: 260px;
    background: #0f1b33;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 8px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 18px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #2f80ed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
}

.brand span {
    display: block;
    color: #9fb0d0;
    font-size: 13px;
    margin-top: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    padding: 11px 12px;
    border-radius: 10px;
    color: #cbd5e8;
    font-size: 14px;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    color: #8fa3c5;
    font-size: 12px;
    padding: 16px 8px 0;
}

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

.admin-header {
    height: 82px;
    background: #fff;
    border-bottom: 1px solid #e6ebf2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
}

.admin-header h1 {
    margin: 0;
    font-size: 24px;
}

.admin-subtitle {
    color: #738198;
    margin-top: 4px;
    font-size: 13px;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    text-align: right;
    font-size: 13px;
}

.admin-user span {
    display: block;
    color: #738198;
    margin-top: 2px;
}

.god-badge {
    background: #111827;
    color: #facc15;
    border: 1px solid #facc15;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
}

.admin-content {
    padding: 28px;
    flex: 1;
}

.admin-footer {
    color: #738198;
    border-top: 1px solid #e6ebf2;
    padding: 14px 28px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
}

.card {
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 27, 51, .04);
}

.grid {
    display: grid;
    gap: 18px;
}

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

.metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    color: #738198;
    font-size: 13px;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

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

.table th {
    color: #738198;
    font-size: 12px;
    text-transform: uppercase;
    background: #f9fbfe;
}

.badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-active,
.badge-success {
    color: #087443;
    background: #dff8eb;
}

.badge-inactive,
.badge-warning {
    color: #946200;
    background: #fff3cd;
}

.badge-failed,
.badge-danger,
.badge-blocked {
    color: #b42318;
    background: #fee4e2;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.btn-primary {
    background: #2f80ed;
    color: #fff;
}

.btn-light {
    background: #eef3fb;
    color: #172033;
}

.btn-danger {
    background: #d92d20;
    color: #fff;
}

.form-card {
    max-width: 420px;
    margin: 80px auto;
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    border: 1px solid #d8e0ec;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-danger {
    background: #fee4e2;
    color: #b42318;
}

.alert-success {
    background: #dff8eb;
    color: #087443;
}

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-sidebar {
        width: 220px;
    }
}

/* =========================================================
   Token-B inspired admin theme v1
   Light / Dark dashboard skin
   ========================================================= */

:root {
    --tb-bg: #f4f7fb;
    --tb-bg-soft: #eef4fb;
    --tb-card: rgba(255, 255, 255, 0.92);
    --tb-card-solid: #ffffff;
    --tb-text: #111827;
    --tb-muted: #6f7f99;
    --tb-border: #dfe8f4;
    --tb-border-strong: #cad7e8;
    --tb-primary: #2f80ed;
    --tb-primary-2: #22d3ee;
    --tb-gold: #f5c451;
    --tb-danger: #ef4444;
    --tb-success: #10b981;
    --tb-warning: #f59e0b;
    --tb-sidebar: #071225;
    --tb-sidebar-2: #0b1f3f;
    --tb-sidebar-text: #dbe7ff;
    --tb-sidebar-muted: #8ea1c3;
    --tb-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --tb-shadow-soft: 0 8px 26px rgba(15, 23, 42, 0.06);
    --tb-radius: 22px;
    --tb-radius-sm: 14px;
}

html[data-theme="dark"] {
    --tb-bg: #08111f;
    --tb-bg-soft: #0c182b;
    --tb-card: rgba(13, 27, 48, 0.9);
    --tb-card-solid: #0d1b30;
    --tb-text: #eef6ff;
    --tb-muted: #96a8c4;
    --tb-border: rgba(148, 163, 184, 0.18);
    --tb-border-strong: rgba(148, 163, 184, 0.32);
    --tb-primary: #4f9cff;
    --tb-primary-2: #21d4fd;
    --tb-gold: #f6c85f;
    --tb-sidebar: #030817;
    --tb-sidebar-2: #07162c;
    --tb-sidebar-text: #eef6ff;
    --tb-sidebar-muted: #91a5c7;
    --tb-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    --tb-shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--tb-bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 24% 0%, rgba(47, 128, 237, 0.12), transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(34, 211, 238, 0.12), transparent 30%),
        var(--tb-bg) !important;
    color: var(--tb-text) !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* Common layout compatibility */
.admin-shell,
.app-shell,
.dashboard-shell,
.layout,
.admin-layout {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 292px;
    z-index: 50;
    background:
        linear-gradient(180deg, rgba(9, 22, 44, 0.98), rgba(3, 8, 23, 0.99)),
        radial-gradient(circle at 20% 0%, rgba(47, 128, 237, 0.3), transparent 34%);
    color: var(--tb-sidebar-text);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 18px 0 50px rgba(3, 8, 23, 0.2);
}

.admin-sidebar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 26px 20px 18px;
    overflow-y: auto;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 4px 24px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--tb-sidebar-text);
    text-decoration: none;
}

.admin-brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: #ffffff;
    background:
        linear-gradient(135deg, var(--tb-primary), #185adb),
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.8), transparent 24%);
    box-shadow: 0 14px 30px rgba(47, 128, 237, 0.34);
}

.admin-brand-title {
    font-size: 20px;
    font-weight: 900;
    line-height: 1.1;
}

.admin-brand-subtitle {
    color: var(--tb-sidebar-muted);
    font-size: 14px;
    font-weight: 700;
    margin-top: 3px;
    letter-spacing: 0.02em;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 18px;
}

.admin-nav-link {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 15px;
    color: rgba(238, 246, 255, 0.84);
    text-decoration: none;
    font-size: 15px;
    font-weight: 760;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.admin-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.admin-nav-link.active {
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(47, 128, 237, 0.94), rgba(33, 212, 253, 0.42));
    box-shadow: 0 14px 32px rgba(47, 128, 237, 0.2);
}

.admin-nav-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
}

.admin-nav-link.active .admin-nav-icon {
    background: rgba(255, 255, 255, 0.2);
}

.admin-nav-section {
    margin: 18px 10px 7px;
    color: var(--tb-gold);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.admin-sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-theme-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.admin-theme-title {
    font-size: 13px;
    color: #ffffff;
    font-weight: 900;
}

.admin-theme-subtitle {
    margin-top: 2px;
    font-size: 11px;
    color: var(--tb-sidebar-muted);
    font-weight: 700;
}

.admin-theme-switch {
    position: relative;
    width: 56px;
    height: 30px;
    display: inline-block;
    flex: 0 0 auto;
}

.admin-theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-theme-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    transition: .2s ease;
}

.admin-theme-slider:before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 4px;
    top: 3px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    transition: .2s ease;
}

.admin-theme-switch input:checked + .admin-theme-slider {
    background: linear-gradient(135deg, var(--tb-primary), var(--tb-primary-2));
}

.admin-theme-switch input:checked + .admin-theme-slider:before {
    transform: translateX(25px);
}

/* Main content compatibility */
.main,
.admin-main,
.content,
.main-content,
.page,
.admin-content {
    margin-left: 292px;
}

.admin-main,
.main-content,
.content,
.page-content {
    min-height: 100vh;
}

main,
.admin-main,
.main-content {
    color: var(--tb-text);
}

.header,
.admin-header,
.topbar,
.page-header {
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--tb-border) !important;
    color: var(--tb-text) !important;
}

html[data-theme="dark"] .header,
html[data-theme="dark"] .admin-header,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .page-header {
    background: rgba(8, 17, 31, 0.72) !important;
}

h1, h2, h3, h4 {
    color: var(--tb-text) !important;
    letter-spacing: -0.04em;
}

p,
td,
th,
label,
.form-label,
.metric-label {
    color: inherit;
}

.card {
    background: var(--tb-card) !important;
    color: var(--tb-text) !important;
    border: 1px solid var(--tb-border) !important;
    border-radius: var(--tb-radius) !important;
    box-shadow: var(--tb-shadow-soft) !important;
}

.metric-value {
    color: var(--tb-text) !important;
}

.metric-label,
.table th,
th {
    color: var(--tb-muted) !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--tb-text) !important;
}

.table td,
.table th {
    border-bottom: 1px solid var(--tb-border) !important;
}

.table td {
    color: var(--tb-text) !important;
}

.form-input,
input,
select,
textarea {
    background: var(--tb-card-solid) !important;
    color: var(--tb-text) !important;
    border: 1px solid var(--tb-border-strong) !important;
    border-radius: 14px !important;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: var(--tb-primary) !important;
    box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12) !important;
}

.btn,
button,
input[type="submit"] {
    border-radius: 14px !important;
    font-weight: 850 !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--tb-primary), #1d63d8) !important;
    color: #ffffff !important;
    border: 0 !important;
    box-shadow: 0 12px 26px rgba(47, 128, 237, 0.22);
}

.btn-light {
    background: rgba(47, 128, 237, 0.08) !important;
    color: var(--tb-text) !important;
    border: 1px solid var(--tb-border) !important;
}

.badge {
    border-radius: 999px !important;
    font-weight: 900 !important;
}

.alert {
    border-radius: 16px !important;
}

pre {
    background: var(--tb-bg-soft) !important;
    color: var(--tb-text) !important;
    border: 1px solid var(--tb-border) !important;
    border-radius: 16px !important;
}

/* Mobile */
@media (max-width: 980px) {
    .admin-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        min-height: unset;
    }

    .admin-sidebar-inner {
        height: auto;
    }

    .main,
    .admin-main,
    .content,
    .main-content,
    .page,
    .admin-content {
        margin-left: 0;
    }

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

    .admin-sidebar-bottom {
        margin-top: 14px;
    }
}
