:root {
    --admin-sidebar-width: 260px;
    --admin-sidebar-bg: #1e293b;
    --admin-sidebar-hover: #334155;
    --admin-sidebar-active: #2563eb;
    --admin-topbar-height: 64px;
    --admin-body-bg: #f1f5f9;
    --admin-card-border: #e2e8f0;
    --admin-text-muted: #64748b;
}

body.admin-body {
    background-color: var(--admin-body-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

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

/* Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-sidebar-bg);
    color: #cbd5e1;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.admin-sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}

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

.admin-sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--admin-sidebar-active);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.admin-sidebar-brand .brand-text {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.admin-sidebar-brand .brand-sub {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

.admin-nav {
    padding: 1rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.admin-nav-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem;
    font-weight: 600;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.admin-nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.admin-nav-link:hover {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.admin-nav-link.active {
    background: var(--admin-sidebar-active);
    color: #fff;
}

.admin-nav-link.active i {
    opacity: 1;
}

/* Main content */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-topbar {
    height: var(--admin-topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--admin-card-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 1rem;
}

.admin-content {
    padding: 1.5rem;
    flex: 1;
}

.admin-page-header {
    margin-bottom: 1.5rem;
}

.admin-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.admin-page-header p {
    color: var(--admin-text-muted);
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid var(--admin-card-border);
    border-radius: 12px;
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--admin-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Cards */
.admin-card {
    background: #fff;
    border: 1px solid var(--admin-card-border);
    border-radius: 12px;
    overflow: hidden;
}

.admin-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--admin-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}

.admin-card-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.admin-card-body {
    padding: 1.25rem;
}

/* Tables */
.admin-table {
    margin: 0;
}

.admin-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--admin-card-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--admin-text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

/* Platform cards */
.platform-card {
    border: 1px solid var(--admin-card-border);
    border-radius: 12px;
    background: #fff;
    transition: box-shadow 0.2s, border-color 0.2s;
    height: 100%;
}

.platform-card:hover {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.platform-card.connected {
    border-color: #86efac;
}

.platform-card.disconnected {
    border-color: var(--admin-card-border);
}

.platform-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

/* Form enhancements */
.form-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--admin-text-muted);
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--admin-card-border);
}

.platform-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.platform-checkbox-item {
    border: 1px solid var(--admin-card-border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.platform-checkbox-item:has(input:checked) {
    border-color: var(--admin-sidebar-active);
    background: #eff6ff;
}

.platform-checkbox-item input {
    margin-right: 0.5rem;
}

/* Action bar */
.post-action-bar {
    background: #fff;
    border: 1px solid var(--admin-card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    position: sticky;
    bottom: 1rem;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 280px;
}

.chart-container-sm {
    height: 220px;
}

/* Auth guest */
.auth-guest-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-guest-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-guest-header {
    background: #1e293b;
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.auth-guest-body {
    padding: 2rem;
}

/* Mobile sidebar */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }
}

/* Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--admin-text-muted);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}
