@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #0A1628;
    --secondary: #1E3A5F;
    --accent: #00D4FF;
    --accent2: #FF6B35;
    --gold: #F4B942;
    --success: #00C896;
    --danger: #FF3B5C;
    --warning: #FFB800;
    --light-bg: #F0F4FF;
    --card-bg: #FFFFFF;
    --border: #E2E8F4;
    --text-primary: #0A1628;
    --text-secondary: #4A5878;
    --text-muted: #8896B3;
    --shadow-sm: 0 2px 8px rgba(10,22,40,0.08);
    --shadow-md: 0 8px 32px rgba(10,22,40,0.12);
    --shadow-lg: 0 20px 60px rgba(10,22,40,0.16);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--light-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden; /* Prevents horizontal scrollbar */
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4, h5, h6 { font-family: 'DM Sans', sans-serif !important; }

/* ---- LAYOUT ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
    width: 268px; /* Desktop width */
    background: linear-gradient(180deg, #0D1B35 0%, #0A1628 60%, #071020 100%);
    min-height: 100vh;
    position: fixed; /* Fixed position for mobile overlay */
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100; /* High z-index to be on top */
    transition: transform 0.3s ease-in-out; /* Smooth transition for sliding */
    border-right: 1px solid rgba(255,255,255,0.05); /* Desktop border */
    box-shadow: 4px 0 24px rgba(0,0,0,0.25); /* Desktop shadow */
}

/* Logo */
.sidebar-logo {
    padding: 26px 22px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo .logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--accent), #0066CC);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0,212,255,0.3);
}

.sidebar-logo .logo-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.sidebar-logo .logo-sub {
    font-size: 10px;
    color: rgba(0,212,255,0.7);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 14px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section-label {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 18px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.18s ease;
    position: relative;
    margin: 2px 0;
}

.nav-item:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.07);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(0,212,255,0.18), rgba(0,132,255,0.12));
    box-shadow: inset 0 0 0 1px rgba(0,212,255,0.2);
}

.nav-item .nav-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: rgba(255,255,255,0.06);
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.nav-item:hover .nav-icon {
    background: rgba(255,255,255,0.1);
}

.nav-item.active .nav-icon {
    background: linear-gradient(135deg, rgba(0,212,255,0.3), rgba(0,132,255,0.2));
    box-shadow: 0 2px 8px rgba(0,212,255,0.2);
}

.nav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #FF6B35, #FF3B5C);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(255,59,92,0.4);
}

/* Footer */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 0 0 0 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
}

.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #0066CC);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,212,255,0.25);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-info .name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info .role {
    font-size: 10.5px;
    color: rgba(0,212,255,0.7);
    margin-top: 1px;
}

/* MAIN CONTENT */
.main-content {
    margin-left: 268px; /* Desktop margin */
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.topbar-left p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 1px;
}

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

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,59,92,0.08);
    color: var(--danger);
    border: 1px solid rgba(255,59,92,0.2);
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.page-content {
    padding: 32px;
    flex: 1;
}

/* CARDS */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.card-body { padding: 24px; }

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.blue::before { background: linear-gradient(90deg, var(--accent), #0084FF); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--accent2), #FF9A3C); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #00E5AA); }
.stat-card.gold::before { background: linear-gradient(90deg, var(--gold), #FFC94A); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-card.blue .stat-icon { background: rgba(0, 212, 255, 0.12); }
.stat-card.orange .stat-icon { background: rgba(255, 107, 53, 0.12); }
.stat-card.green .stat-icon { background: rgba(0, 200, 150, 0.12); }
.stat-card.gold .stat-icon { background: rgba(244, 185, 66, 0.12); }

.stat-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* TABLES */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

thead th {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 14px 18px;
    text-align: left;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:last-child { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--light-bg); }

tbody td {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active { background: rgba(0,200,150,0.12); color: #00A87A; }
.badge-pending { background: rgba(255,184,0,0.12); color: #CC8800; }
.badge-inactive { background: rgba(255,59,92,0.12); color: var(--danger); }
.badge-verified { background: rgba(0,200,150,0.12); color: #00A87A; }
.badge-rejected { background: rgba(255,59,92,0.12); color: var(--danger); }
.badge-generated { background: rgba(0,132,255,0.12); color: #0084FF; }
.badge-uploaded { background: rgba(244,185,66,0.12); color: #C08000; }
.badge-approved { background: rgba(0,200,150,0.12); color: #00A87A; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(10,22,40,0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(10,22,40,0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #0084FF);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,212,255,0.3);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,212,255,0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00A87A);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #CC1F3C);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #CC8800);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--light-bg);
    border-color: var(--text-muted);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius-sm); }

/* FORMS */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.12);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238896B3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.input-group {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group .form-control { padding-left: 28px; }

.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.file-upload:hover {
    border-color: var(--accent);
    background: rgba(0,212,255,0.03);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-upload-icon { font-size: 32px; margin-bottom: 8px; }
.file-upload-text { font-size: 14px; color: var(--text-secondary); }
.file-file-upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* AUTH PAGES */
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--primary);
}

.auth-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,255,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
}

.auth-left::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,107,53,0.1) 0%, transparent 70%);
    bottom: -50px; left: 50px;
}

.auth-logo-big {
    font-family: 'DM Sans', sans-serif;
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.auth-logo-big span { color: var(--accent); }

.auth-tagline {
    font-size: 16px;
    color: rgba(255,255,255,0.5);
    max-width: 320px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.auth-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}

.auth-feature-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.auth-right {
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.auth-box {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-box h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 6px;
}

.auth-box p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert-success { background: rgba(0,200,150,0.1); color: #007A5A; border: 1px solid rgba(0,200,150,0.3); }
.alert-danger { background: rgba(255,59,92,0.1); color: #CC1F3C; border: 1px solid rgba(255,59,92,0.3); }
.alert-warning { background: rgba(255,184,0,0.1); color: #CC8800; border: 1px solid rgba(255,184,0,0.3); }
.alert-info { background: rgba(0,132,255,0.08); color: #0059CC; border: 1px solid rgba(0,132,255,0.2); }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 22px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--light-bg);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.modal-close:hover { background: var(--danger); color: #fff; }

.modal-body { padding: 28px; }
.modal-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* DOCUMENT PREVIEW */
.doc-preview {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    font-size: 13px;
    line-height: 1.6;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--primary);
}

.doc-company-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.doc-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--secondary);
    text-align: right;
}

/* TABS */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    font-family: 'DM Sans', sans-serif;
    text-decoration:none;
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* TIMELINE */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    position: relative;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--light-bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    position: relative;
    z-index: 1;
}

.timeline-icon.done {
    background: rgba(0,200,150,0.12);
    border-color: var(--success);
}

.timeline-content {
    flex: 1;
    padding-top: 4px;
}

.timeline-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* DOCUMENT STEPS */
.doc-steps {
    display: flex;
    gap: 0;
    align-items: center;
    margin-bottom: 28px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.doc-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    position: relative;
}

.doc-step.done { color: var(--success); }
.doc-step.active { color: var(--primary); background: var(--light-bg); }

.doc-step-num {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
}

.doc-step.done .doc-step-num {
    background: var(--success);
    color: #fff;
}

.doc-step.active .doc-step-num {
    background: var(--primary);
    color: #fff;
}

.doc-step-arrow {
    color: var(--border);
    font-size: 16px;
    padding: 0 4px;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-muted); }

/* RESPONSIVE */
/* This media query is for general responsive adjustments */
@media (max-width: 768px) {
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-left { display: none; } /* Hide auth left image on mobile */
    .sidebar { transform: translateX(-100%); } /* Hide sidebar by default */
    .sidebar.open { transform: translateX(0); } /* Show sidebar when 'open' class is added */
    .main-content { margin-left: 0; } /* Main content takes full width */
    .form-row, .form-row-3 { grid-template-columns: 1fr; } /* Form elements stack */
    .stats-grid { grid-template-columns: repeat(2, 1fr); } /* Stats in two columns */
    .page-content { padding: 16px; } /* Reduced padding on mobile */
}

/* ANIMATIONS (used for content fade-in) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }

.page-content > * { /* Apply fade-in to direct children of page-content */
    animation: fadeIn 0.3s ease forwards;
}

/* PROGRESS STEPS */
.progress-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 32px;
}

.progress-step {
    display: flex;
    align-items: center;
    flex: 1;
}

.progress-step-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.3s;
}

.progress-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
}

.progress-step.done .progress-step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.progress-step.active .progress-step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(10,22,40,0.12);
}

.progress-step.done .progress-step-line { background: var(--success); }

/* #### MORE SPECIFIC RESPONSIVE STYLES FOR SIDEBAR & TOPBAR #### */

/* Display and style the sidebar toggle button only on small screens */
.sidebar-toggle-btn {
    display: none; /* Initially hidden on desktop */
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-primary); /* Color of the hamburger icon */
    margin-right: 16px; /* Space between icon and title */
    line-height: 0; /* Prevents extra vertical space */
    align-self: center; /* Center it vertically in topbar-left */
}

/* Apply responsive styles when screen width is 768px or less */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: block; /* Show the toggle button on mobile/tablet */
    }

    /* Sidebar mobile behavior */
    .sidebar {
        transform: translateX(-100%); /* Default: hidden off-screen */
        width: 268px; /* Or set your desired mobile sidebar width */
        position: fixed; /* Essential for overlaying content */
        z-index: 100;   /* Ensure it's above the backdrop and content */
        transition: transform 0.3s ease-in-out; /* Smooth sliding animation */
        border-right: none; /* Remove border on mobile */
        box-shadow: none; /* Remove shadow on mobile slide */
    }

    .sidebar.open {
        transform: translateX(0); /* Slide in */
    }

    /* Main content behavior on mobile */
    .main-content {
        margin-left: 0; /* Remove desktop margin-left */
        width: 100%; /* Take full width */
    }
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    display: none; /* Hidden by default */
    position: fixed;
    inset: 0; /* Cover the entire viewport */
    background: rgba(10, 22, 40, 0.5); /* Semi-transparent dark overlay */
    z-index: 99; /* Below sidebar (z-index 100), above main content */
    opacity: 0; /* Start with opacity 0 for fade-in animation */
    transition: opacity 0.3s ease; /* Transition for fade effect */
}

/* Show backdrop when sidebar is open */
/* This relies on the backdrop being placed right after the sidebar in HTML,
   OR the JS controlling its 'display' property */
.sidebar.open + .sidebar-backdrop,
.sidebar-backdrop.fade-in { /* Adding fade-in class for JS control */
    display: block; /* Make it visible */
    opacity: 1; /* Fade it in */
}
/* --- RESPONSIVE RULES FOR TOPBAR --- */

/* Styles for screens up to 768px wide (mobile, tablet) */
@media (max-width: 768px) {
    .topbar {
        padding: 12px 16px; /* Slightly reduced padding on mobile */
        flex-wrap: wrap; /* Allow items to wrap to the next line */
        gap: 10px; /* Gap between wrapped items */
    }

    .topbar-left {
        flex-basis: 100%; /* Make topbar-left take full width */
        justify-content: flex-start; /* Align items to start */
        gap: 8px; /* Slightly reduced gap */
        margin-bottom: 10px; /* Space below left content before right buttons */
    }

    .topbar-left h1 {
        font-size: 20px; /* Slightly smaller title */
        margin-right: 10px;
    }

    .topbar-left p {
       display: block;
    }

    .topbar-right {
        flex-basis: 100%; /* Make topbar-right take full width */
        justify-content: flex-start; /* Align buttons to start */
        gap: 8px; /* Reduced gap between buttons */
    }

    .btn-accent, .btn-logout {
        font-size: 12px; /* Smaller font size for buttons */
        padding: 6px 12px; /* Smaller padding for buttons */
    }

    /* Optionally, hide the submit button on very small screens if needed */
    /* .topbar-right .btn-accent {
        display: none;
    } */
}

/* Styles for very small screens (e.g., phones in portrait mode), if needed */
@media (max-width: 480px) {
    .topbar {
        padding: 10px 12px;
    }

    .topbar-left h1 {
        font-size: 18px;
    }

    .btn-accent, .btn-logout {
        padding: 5px 10px;
        font-size: 11px;
    }
}
/* --- RESPONIVE RULES FOR PMT-TOPBAR --- */

/* Styles for screens up to 768px wide (mobile, tablet) */
@media (max-width: 768px) {
    .pmt-topbar {
        padding: 16px 20px; /* Reduced padding */
        flex-wrap: wrap; /* Allow elements to wrap */
        gap: 15px; /* Space between wrapped sections */
        justify-content: center; /* Center items when wrapped */
        text-align: center; /* Center text within the elements */
    }

    .pmt-topbar > div:first-child { /* Styles for the left side (h1 and p) */
        flex-basis: 100%; /* Take full width */
        margin-bottom: 10px; /* Space before the buttons */
    }

    .pmt-topbar h1 {
        font-size: 20px; /* Smaller title */
    }

    .pmt-topbar p {
        font-size: 12px;
    }

    .pmt-topbar > div:last-child { /* Styles for the right side (buttons) */
        flex-basis: 100%; /* Take full width */
        justify-content: center; /* Center buttons */
    }

    .btn-primary.btn-sm,
    .btn-outline.btn-sm,
    .btn-logout {
        font-size: 12px; /* Smaller font for buttons */
        padding: 8px 12px; /* Smaller padding */
    }
}

/* Styles for very small screens (e.g., phones in portrait mode), if needed */
@media (max-width: 480px) {
    .pmt-topbar {
        padding: 12px 16px;
        gap: 10px;
    }

    .pmt-topbar h1 {
        font-size: 18px;
    }

    .pmt-topbar p {
        font-size: 11px;
    }

    .pmt-topbar > div:last-child {
        flex-direction: column; /* Stack buttons vertically */
        width: 100%;
    }

    .pmt-topbar > div:last-child .btn,
    .pmt-topbar > div:last-child .btn-logout {
        width: 100%; /* Make buttons take full width */
        text-align: center;
        margin-bottom: 8px; /* Space between stacked buttons */
    }

     .pmt-topbar > div:last-child .btn-logout {
        margin-bottom: 0; /* No margin on the last button */
    }
}

/* --- RESPONSIVE RULES FOR PH-TOPBAR --- */

/* Styles for screens up to 768px wide (mobile, tablet) */
@media (max-width: 768px) {
    .ph-topbar {
        padding: 16px 20px; /* Reduced padding */
        flex-wrap: wrap; /* Allow elements to wrap */
        gap: 15px; /* Space between wrapped sections */
        justify-content: center; /* Center items when wrapped */
        text-align: center; /* Center text within the elements */
    }

    .ph-topbar > div:first-child { /* Styles for the left side (h1 and p) */
        flex-basis: 100%; /* Take full width */
        margin-bottom: 10px; /* Space before the buttons */
    }

    .ph-topbar h1 {
        font-size: 20px; /* Smaller title */
    }

    .ph-topbar p {
        font-size: 12px;
    }

    .ph-topbar > div:last-child { /* Styles for the right side (buttons) */
        flex-basis: 100%; /* Take full width */
        justify-content: center; /* Center buttons */
    }

    .btn-primary.btn-sm,
    .btn-outline.btn-sm,
    .btn-logout {
        font-size: 12px; /* Smaller font for buttons */
        padding: 8px 12px; /* Smaller padding */
    }
}

/* Styles for very small screens (e.g., phones in portrait mode), if needed */
@media (max-width: 480px) {
    .ph-topbar {
        padding: 12px 16px;
        gap: 10px;
    }

    .ph-topbar h1 {
        font-size: 18px;
    }

    .ph-topbar p {
        font-size: 11px;
    }

    .ph-topbar > div:last-child { /* Style the button container */
        flex-direction: column; /* Stack buttons vertically */
        width: 100%;
    }

    .ph-topbar > div:last-child .btn,
    .ph-topbar > div:last-child .btn-logout {
        width: 100%; /* Make buttons take full width */
        text-align: center;
        margin-bottom: 8px; /* Space between stacked buttons */
    }

     .ph-topbar > div:last-child .btn-logout {
        margin-bottom: 0; /* No margin on the last button */
    }
}
/* ---------- RESPONSIVE ---------- */

/* Tablet & small desktop (≤768px) */
@media (max-width:768px) {
    .cts-topbar {
        padding:16px 20px;
        flex-wrap:wrap;               /* allow stacking */
        gap:15px;                     /* space between rows */
        justify-content:center;
        text-align:center;
    }
    .cts-topbar > div:first-child {
        flex-basis:100%;               /* full‑width title block */
        margin-bottom:10px;
    }
    .cts-topbar h1 {font-size:20px;}
    .cts-topbar p  {font-size:12px;}
    .cts-topbar > div:last-child {
        flex-basis:100%;               /* full‑width button block */
        justify-content:center;
    }
    .btn-outline.btn-sm,
    .btn-logout {
        font-size:12px;
        padding:8px 12px;
    }
}

/* Mobile portrait (≤480px) */
@media (max-width:480px) {
    .cts-topbar {
        padding:12px 16px;
        gap:10px;
    }
    .cts-topbar h1 {font-size:18px;}
    .cts-topbar p  {font-size:11px;}
    .cts-topbar > div:last-child {
        flex-direction:column;       /* stack buttons vertically */
        width:100%;
    }
    .cts-topbar > div:last-child .btn,
    .cts-topbar > div:last-child .btn-logout {
        width:100%;
        text-align:center;
        margin-bottom:8px;
        font-size:12px;
        padding:8px 12px;
    }
    .cts-topbar > div:last-child .btn-logout {margin-bottom:0;}
}
/* ------------------------------------------------------------------
   MEDIA QUERY – TABLETS / SMALL DESKTOPS (≤ 768px)
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
    /* Stack the two columns on top of each other */
    .page-content > div:first-child {
        grid-template-columns: 1fr !important;   /* override inline style */
    }

    /* Reduce the max‑width so the content fills more of the screen */
    .page-content > div:first-child {
        max-width: 100%;
        padding: 0 16px;
    }

    /* Slightly smaller heading / paragraph inside cards */
    .page-content .card-header h3 {
        font-size: 18px;
    }

    /* Make buttons a bit more touch‑friendly */
    .page-content .btn-primary {
        padding: 10px 16px;
        font-size: 15px;
        width: 100%;               /* full‑width on narrow screens */
    }
}

/* ------------------------------------------------------------------
   MEDIA QUERY – PHONES (≤ 480px)
   ------------------------------------------------------------------ */
@media (max-width: 480px) {
    .page-content > div:first-child {
        gap: 16px;                 /* tighter spacing */
        padding: 0 12px;
    }

    .page-content .card {
        margin-bottom: 16px;       /* give a little breathing room */
    }

    .page-content .card-header h3 {
        font-size: 16px;
    }

    .page-content .form-control {
        padding: 7px 10px;
        font-size: 13px;
    }

    .page-content .btn-primary {
        padding: 9px 14px;
        font-size: 14px;
    }
}
.sidebar-toggle-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    background: #111827;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: .3s;
}

.sidebar-toggle-btn:hover {
    background: #1f2937;
    border-color: rgba(255,255,255,0.2);
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
@media (max-width: 768px) {
    .topbar-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-basis: 100%;
    }

    .sidebar-toggle-btn {
        margin-right: 0;
        flex-shrink: 0;
    }

    .topbar-left h1 {
        margin: 0;
    }
}