:root {
    --ps-primary: #6c3fc5;
    --ps-primary-dark: #5a32a8;
    --ps-primary-light: #8b5fd9;
    --ps-sidebar-bg: #1e1b4b;
    --ps-sidebar-hover: #312e81;
    --ps-sidebar-active: #4c1d95;
    --ps-body-bg: #f4f6f9;
    --ps-card-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    --ps-topbar-height: 64px;
    --ps-sidebar-width: 260px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--ps-body-bg);
    color: #334155;
}

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #4c1d95 50%, #6c3fc5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.auth-brand-panel {
    background: linear-gradient(160deg, #312e81, #6c3fc5);
    color: #fff;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.auth-brand-panel .shield-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.auth-form-panel {
    padding: 2.5rem 2rem;
}

/* Admin Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--ps-sidebar-width);
    background: var(--ps-sidebar-bg);
    color: #e2e8f0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.admin-sidebar .brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.admin-sidebar .brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.admin-sidebar .brand-text small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.7;
}

.admin-sidebar .nav-section {
    padding: 1rem 0;
}

.admin-sidebar .nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 600;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

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

.admin-sidebar .nav-link.active {
    background: var(--ps-sidebar-active);
    color: #fff;
    border-left-color: var(--ps-primary-light);
}

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

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

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

.admin-topbar .sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #475569;
    cursor: pointer;
}

.admin-topbar .search-box {
    flex: 1;
    max-width: 400px;
}

.admin-topbar .search-box .form-control {
    border-radius: 2rem;
    padding-left: 2.5rem;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.admin-topbar .search-box .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

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

/* Cards & Stats */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--ps-card-shadow);
    border: none;
    height: 100%;
}

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

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

.stat-card .stat-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.content-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: var(--ps-card-shadow);
    border: none;
}

.content-card .card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

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

/* Buttons */
.btn-primary {
    background-color: var(--ps-primary);
    border-color: var(--ps-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--ps-primary-dark);
    border-color: var(--ps-primary-dark);
}

.btn-outline-primary {
    color: var(--ps-primary);
    border-color: var(--ps-primary);
}

.btn-outline-primary:hover {
    background-color: var(--ps-primary);
    border-color: var(--ps-primary);
}

/* Tables */
.table-admin thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table-admin tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Badges */
.badge-status-active { background: #dcfce7; color: #166534; }
.badge-status-locked { background: #fee2e2; color: #991b1b; }
.badge-status-overdue { background: #ffedd5; color: #9a3412; }
.badge-status-completed { background: #e0e7ff; color: #3730a3; }
.badge-status-pending { background: #f1f5f9; color: #475569; }
.badge-status-connected { background: #dcfce7; color: #166534; }

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.page-header .breadcrumb {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* Profile Cards */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ps-primary), var(--ps-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.device-preview {
    width: 80px;
    height: 120px;
    background: #1e293b;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}

.progress-installment {
    height: 10px;
    border-radius: 5px;
}

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.stepper .step {
    text-align: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.stepper .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.stepper .step.active .step-circle {
    background: var(--ps-primary);
    color: #fff;
}

.stepper .step.completed .step-circle {
    background: #22c55e;
    color: #fff;
}

.stepper .step-label {
    font-size: 0.8rem;
    color: #64748b;
}

.stepper .step.active .step-label {
    color: var(--ps-primary);
    font-weight: 600;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    color: #64748b;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-zone:hover {
    border-color: var(--ps-primary);
    color: var(--ps-primary);
}

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

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

/* Due payments list */
.due-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.due-item:last-child {
    border-bottom: none;
}

/* Quick actions */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    text-decoration: none;
    color: #475569;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.85rem;
}

.quick-action-btn:hover {
    border-color: var(--ps-primary);
    color: var(--ps-primary);
    box-shadow: var(--ps-card-shadow);
}

.quick-action-btn i {
    font-size: 1.5rem;
}

.quick-action-btn.danger:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.quick-action-btn.success:hover {
    border-color: #16a34a;
    color: #16a34a;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

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

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

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

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

    .admin-topbar .sidebar-toggle {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .admin-content {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}
