* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}


/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button[type="submit"],
.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

/* Prevent full-width override inside modal action buttons */
.modal-actions button[type="submit"] {
    width: auto;
}

button[type="submit"]:hover,
.btn-primary:hover {
    transform: translateY(-2px);
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border: 1px solid #fcc;
}

.login-info {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
    color: #666;
}

/* Header Styles */
header {
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    position: relative;
}


.header-logo-section {
    width: 220px;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #fff;
}

.header-main-section {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 100%;
}

.header-title-wrapper h1 {
    font-size: 1.25rem;
    font-weight: 600;
}


.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}


/* Page Layout — Sidebar + Main */
.page-layout {
    display: flex;
    height: calc(100vh - 70px);
    background: #f5f7fa;
    overflow: hidden;
}


/* Sidebar */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #eef0f5;
    padding: 1.5rem 1rem;
    height: 100%;
    overflow-y: hidden; /* Changed from auto to hidden as requested */
}


.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #bbb;
    margin: 0 0 0.75rem 0.5rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    text-decoration: none;
    color: #555;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.18s, color 0.18s;
}

.sidebar-link:hover {
    background: #f0f2ff;
    color: #667eea;
}

.sidebar-link.active {
    background: #eef0fd;
    color: #667eea;
    font-weight: 600;
}

.sidebar-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: transparent;
    transition: background 0.18s;
    flex-shrink: 0;
}

.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon {
    background: #667eea;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* Dashboard container */
.dashboard-container {
    max-width: 1400px;
    margin: 1.75rem 0 1.75rem 1.5rem;
    padding: 0 1.5rem;
}

/* Content Panels */
.tab-content.active:not(#dashboard-tab) {
    display: block;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    overflow: hidden;
    padding: 1.75rem;
}

#dashboard-tab.active {
    display: block;
    padding: 0;
}

.tab-content {
    display: none;
}



/* Panel header inside each tab */
.panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f1f5;
}

.panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}

.panel-header h3 i {
    color: #667eea;
    font-size: 1rem;
}

/* Stats Grid — Premium Redesign */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    padding: 1.4rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    border-top: 3px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -18px;
    bottom: -18px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #667eea;
    opacity: 0.04;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.12);
}

/* Icon bubble — single brand color for all cards */
.stat-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    color: #667eea;
    background: #eef0fd;
}

/* Stat body */
.stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.stat-number {
    font-size: 1.9rem;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-card h3 {
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.stat-hint {
    font-size: 0.76rem;
    color: #bbb;
    margin-top: 0.1rem;
}

.tier-bronze {
    color: #CD7F32;
}

.tier-silver {
    color: #C0C0C0;
}

.tier-gold {
    color: #FFD700;
}

.tier-diamond {
    color: #B9F2FF;
}

/* Tier Benefits — Premium Redesign */
.tier-benefits {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    margin-bottom: 2rem;
}

.tier-benefits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tier-benefits-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.25rem;
}

.tier-subtitle {
    color: #888;
    font-size: 0.88rem;
    margin: 0;
}

/* User Tier Badge */
.user-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.badge-icon { font-size: 1.3rem; }
.badge-label { white-space: nowrap; }

/* Progress Bar */
#tier-progress-bar-wrap {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    border: 1px solid #eef0ff;
}

.tier-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
}

.tier-progress-track {
    width: 100%;
    height: 10px;
    background: #e4e8ef;
    border-radius: 999px;
    overflow: hidden;
}

.tier-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease;
    min-width: 4px;
}

.tier-progress-hint {
    font-size: 0.8rem;
    color: #888;
    margin: 0.5rem 0 0;
    text-align: right;
}

/* Benefits Grid */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

/* Tier Cards */
.benefit-tier-card {
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #f0f1f5;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.benefit-tier-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.13);
}

.benefit-tier-card.tier-card--current {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.18), 0 6px 20px rgba(102,126,234,0.12);
}

.benefit-tier-card.tier-card--locked {
    opacity: 0.5;
    filter: grayscale(60%);
}

/* Card Header — unified dark slate for all tiers */
.tier-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    color: white;
    position: relative;
    background: linear-gradient(135deg, #2d3561 0%, #1a1a2e 100%);
    box-shadow: none;
}

.tier-card-icon {
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: white;
}

.tier-card-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.tier-card-pts {
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 500;
}

.tier-card-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.tier-card-lock {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    font-size: 1rem;
    opacity: 0.8;
}

/* Perks List */
.tier-card-perks {
    list-style: none;
    padding: 1rem 1.1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.tier-card-perks li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.87rem;
    color: #444;
}

.perk-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #eef0fd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #667eea;
    font-size: 0.82rem;
}

/* Action Tabs */
.actions-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.action-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-actions button {
    width: auto !important;
    margin: 0;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

table tbody tr:hover {
    background: #f8f9ff;
}

/* Status Styles */
.status-pending {
    color: #ffc107;
    font-weight: bold;
}

.status-approved {
    color: #17a2b8;
    font-weight: bold;
}

.status-converted {
    color: #28a745;
    font-weight: bold;
}

.status-rejected {
    color: #dc3545;
    font-weight: bold;
}

/* CSV Upload Styles */
.csv-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.csv-info p {
    margin-bottom: 0.5rem;
}

.csv-info a {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #ced4da;
    transition: all 0.2s;
}

.csv-info a:hover {
    background-color: #dee2e6;
    text-decoration: none;
    border-color: #adb5bd;
}

#csv-results {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 5px;
    display: none;
}

#csv-results.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#csv-results.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-content {
    background-color: white;
    margin: 0 auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h4 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.modal-actions button[type="button"] {
    background: #6c757d;
    color: white;
}

.modal-actions button[type="submit"] {
    background: #667eea;
    color: white;
}

/* Reports Section */
.reports-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.report-card {
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
    text-align: center;
}

.report-card h4 {
    margin-bottom: 0.5rem;
    color: #333;
}

.report-card p {
    color: #666;
    margin-bottom: 1rem;
}

/* Logs Container */
.logs-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 1rem;
}

.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    font-size: 0.85rem;
    color: #666;
}

.log-action {
    margin-top: 0.25rem;
}

/* Action Buttons */
.action-btn {
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-edit {
    background: #ffc107;
    color: #212529;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-reset-password {
    background: #17a2b8;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .action-tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: 1px solid #eee;
    }

    .tab-btn.active {
        border-bottom: 3px solid #667eea;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    table {
        font-size: 0.85rem;
    }

    .modal-content {
        width: 95%;
        max-height: calc(100vh - 2rem);
    }
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '...';
    animation: loading 1s infinite;
}

@keyframes loading {
    0% {
        content: '';
    }

    25% {
        content: '.';
    }

    50% {
        content: '..';
    }

    75% {
        content: '...';
    }

    100% {
        content: '';
    }
}

/* Responsive — sidebar collapses on mobile */
@media (max-width: 768px) {
    .page-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid #eef0f5;
        padding: 0.75rem 1rem;
    }

    .sidebar-section-label {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0.5rem;
    }

    .sidebar-link {
        flex: 1;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .sidebar-icon {
        width: 26px;
        height: 26px;
        font-size: 0.78rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}