:root {
    /* Refined Color Palette */
    --primary: #037b90;
    --primary-light: #f1f7f8;
    --primary-dark: #025a6a;
    --secondary: #ff7f50;
    --accent: #f59e0b;

    /* Neutrals & Backgrounds */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    /* Premium Effects */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.6);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* App Shell */
.app-shell {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid var(--glass-border);
    overflow-y: auto;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 3.5rem;
    text-align: center;
}

.logo span {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.nav-item {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 6px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-item i {
    font-size: 1.25rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 14px;
    color: inherit;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(3, 123, 144, 0.2);
    color: #037b90;
    font-weight: 700;
}

.nav-item.active i {
    color: #037b90;
}

/* Main Content Area */
.content-area {
    flex: 1;
    margin-left: 280px;
    padding: 0;
    transition: margin-left 0.3s ease;
    min-width: 0;
}

.page-container {
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Restored Original Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: white;
    padding: 0 2.5rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px -5px rgba(0, 0, 0, 0.05);
}

.mobile-header {
    display: none;
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 95;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-main);
    cursor: pointer;
}

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

/* Modern Stat Cards */
.grid-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-card h3 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 1.25rem;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.04em;
}

/* Modern Panels */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

/* Premium Badges */
.badge {
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.badge-success {
    background: hsl(150, 100%, 96%);
    color: hsl(150, 100%, 25%);
    border: 1px solid hsl(150, 100%, 90%);
}

.badge-warning {
    background: hsl(40, 100%, 96%);
    color: hsl(35, 100%, 35%);
    border: 1px solid hsl(40, 100%, 90%);
}

.badge-danger {
    background: hsl(0, 100%, 97%);
    color: hsl(0, 85%, 45%);
    border: 1px solid hsl(0, 100%, 92%);
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border);
}

/* Premium Buttons */
.btn {
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(3, 123, 144, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -8px rgba(3, 123, 144, 0.4);
}

/* User Menu Styles */
.user-menu-container {
    position: relative;
    cursor: pointer;
}

.user-avatar-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px;
    border-radius: 100px;
    transition: background 0.2s;
    background: white;
}

.user-avatar-trigger:hover {
    background: var(--bg-main);
}

.avatar-circle {
    width: 38px;
    height: 38px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info-text {
    line-height: 1.2;
}

.u-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.u-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-header {
    padding: 16px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Media Queries */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .topbar {
        display: none;
    }

    .mobile-toggle {
        display: block;
    }
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #f1f5f9;
    outline: none;
    background: #f8fafc;
    transition: all 0.2s;
    font-size: 1rem;
}

input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(3, 123, 144, 0.1);
}

/* Navigation Dot Badge */
.nav-item {
    position: relative;
}

.dot-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    border: 2px solid #f1f5f9;
}

/* Profile Specific Components */
.profile-id-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 24px;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    background: white;
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.read-only-field {
    background: #f1f5f9;
    cursor: not-allowed;
    color: var(--text-muted);
}

.completion-bar-container {
    height: 10px;
    background: rgba(255, b255, 255, 0.2);
    border-radius: 5px;
    margin-top: 10px;
    overflow: hidden;
}

.completion-bar-fill {
    height: 100%;
    background: white;
    transition: width 0.5s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Implementation */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }

    .content-area {
        margin-left: 240px;
    }
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        /* Above overlay */
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open+.content-area .nav-overlay {
        display: block;
    }

    .content-area {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-header {
        display: flex;
    }
}

@media (max-width: 768px) {
    .grid-stats-row {
        flex-direction: column;
    }

    .stat-card {
        min-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

.stepper::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    flex: 1;
    text-align: center;
}

.step-marker {
    width: 48px;
    height: 48px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all 0.3s;
}

.step-item.active .step-marker {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(3, 123, 144, 0.15);
}

.step-item.completed .step-marker {
    border-color: var(--primary);
    color: var(--primary);
}

.step-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.step-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Mobile adjustments for stepper */
@media (max-width: 768px) {
    .stepper {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
        padding-left: 20px;
    }

    .stepper::before {
        display: none;
    }

    .step-item {
        flex-direction: row;
        text-align: left;
        gap: 15px;
    }
}

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: white;
    border-radius: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    min-width: 600px;
}

.table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

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

.table tr:hover td {
    background: #fcfdfe;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}
/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    line-height:1;
}

.close-btn:hover {
    color: var(--danger);
}

.modal-body {
    padding: 2rem;
}
