:root{
    --primary:#336898;
    --primary-dark:#254f73;
    --accent:#5d94c4;
    --bg:#f4f7fb;
    --dark:#142033;
    --muted:#6b7280;
    --white:#ffffff;
    --danger:#b91c1c;
    --success:#15803d;
    --warning:#b45309;
    --border:#d9e2ec;
    --soft:#eef6fb;
    --shadow:0 18px 45px rgba(15,23,42,.08);
}

*{box-sizing:border-box}

html,body{
    margin:0;
    min-height:100%;
}

body{
    font-family:Inter,Arial,sans-serif;
    background:var(--bg);
    color:var(--dark);
}

a{
    text-decoration:none;
    color:inherit;
}

img{
    max-width:100%;
    display:block;
}

.muted{
    color:var(--muted);
}

/* TEXT BRANDING */
.text-brand,
.sidebar-text-brand{
    color:#fff;
    font-size:21px;
    font-weight:900;
    letter-spacing:.04em;
    line-height:1;
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    white-space:nowrap;
}

.sidebar-text-brand{
    min-height:42px;
    font-size:22px;
}

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

.auth-text-brand{
    color:#fff;
    font-size:21px;
    font-weight:900;
    letter-spacing:.04em;
    text-decoration:none;
}


/* MAIN LAYOUT */
.layout{
    display:grid;
    grid-template-columns:270px 1fr;
    min-height:100vh;
}

/* SIDEBAR */
.sidebar{
    background:var(--primary);
    color:#fff;
    padding:22px;
    position:sticky;
    top:0;
    height:100vh;
    z-index:60;
    box-shadow:12px 0 40px rgba(15,23,42,.08);
    border-right:none;
}

.sidebar-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:26px;
    min-height:42px;
}





.role-label{
    font-size:12px;
    letter-spacing:.08em;
    color:rgba(255,255,255,.72);
    margin:8px 0 12px;
    font-weight:800;
}

.nav a{
    display:block;
    padding:13px 14px;
    border-radius:14px;
    margin:7px 0;
    color:rgba(255,255,255,.88);
    transition:.22s ease;
    font-weight:600;
}

.nav a:hover,
.nav a.active{
    background:rgba(255,255,255,.16);
    color:#fff;
    font-weight:800;
}

.sidebar-close{
    display:none;
    border:0;
    background:rgba(255,255,255,.14);
    color:#fff;
    width:38px;
    height:38px;
    border-radius:12px;
    font-size:24px;
    line-height:1;
}

/* MOBILE TOP HEADER */
.mobile-header{
    display:none !important;
}

/* MAIN CONTENT */
.main{
    padding:28px;
    min-width:0;
}

.desktop-topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:24px;
    gap:18px;
}

.desktop-topbar h2{
    margin:0 0 5px;
    font-size:24px;
}

.topbar-actions{
    display:flex;
    gap:10px;
}

.top-link{
    background:#fff;
    border:1px solid var(--border);
    color:var(--primary);
    padding:10px 14px;
    border-radius:12px;
    font-weight:800;
}

/* GENERAL UI */
.card,
.form-shell,
.tile,
.search-card{
    background:#fff;
    border:1px solid var(--border);
    border-radius:22px;
    box-shadow:var(--shadow);
}

.card{
    padding:26px;
}

.grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:16px;
}

.tile{
    padding:22px;
}

.tile h3{
    margin:0 0 8px;
    font-size:30px;
}

.btn{
    border:none;
    border-radius:14px;
    padding:12px 17px;
    font-weight:800;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    transition:.2s ease;
}

.btn:hover{
    transform:translateY(-1px);
}

.btn-primary{
    background:var(--primary);
    color:#fff;
}

.btn-light{
    background:#eef6fb;
    color:var(--primary);
}

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

.btn-outline{
    background:#fff;
    border:1px solid var(--border);
    color:var(--primary);
}

label{
    font-weight:800;
    font-size:14px;
    margin:14px 0 7px;
    display:block;
}

input,
select,
textarea{
    width:100%;
    padding:13px 14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:#fff;
    font-size:15px;
    outline:none;
    transition:border .2s ease, box-shadow .2s ease;
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 4px rgba(51,104,152,.10);
}

textarea{
    min-height:105px;
    resize:vertical;
}

.notice{
    padding:13px 15px;
    border-radius:14px;
    margin:12px 0;
    background:#eff6ff;
    color:#1d4ed8;
    border:1px solid #dbeafe;
}

.notice.error,
.error{
    background:#fef2f2;
    color:#991b1b;
    border-color:#fecaca;
}

.notice.success,
.success{
    background:#f0fdf4;
    color:#166534;
    border-color:#bbf7d0;
}

.table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
    border-radius:18px;
    overflow:hidden;
}

.table th,
.table td{
    padding:14px;
    border-bottom:1px solid var(--border);
    text-align:left;
}

.badge{
    display:inline-block;
    padding:6px 11px;
    border-radius:999px;
    font-size:12px;
    font-weight:900;
    background:#eef2ff;
    color:#3730a3;
}

/* SEARCH + LIST */
.search-card{
    padding:18px;
    margin-top:20px;
}

.search-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:15px;
    margin-bottom:15px;
}

.search-input{
    max-width:420px;
}

.application-list{
    display:grid;
    gap:12px;
}

.application-item{
    border:1px solid var(--border);
    border-radius:18px;
    padding:16px;
    background:#fbfdff;
    display:grid;
    grid-template-columns:1.1fr 1.8fr 1fr auto;
    gap:15px;
    align-items:center;
}

.application-item h4{
    margin:0 0 6px;
    font-size:15px;
}

.application-item p{
    margin:0;
    color:var(--muted);
    font-size:14px;
}

.empty-state{
    padding:22px;
    border:1px dashed var(--border);
    border-radius:18px;
    color:var(--muted);
    text-align:center;
}

/* FORM */
.form-shell{
    padding:0;
    overflow:hidden;
}

.form-hero{
    padding:28px;
    background:linear-gradient(135deg,rgba(51,104,152,.10),rgba(79,142,199,.04));
    border-bottom:1px solid var(--border);
}

.form-hero-row{
    display:flex;
    justify-content:space-between;
    gap:20px;
    align-items:flex-start;
}

.form-hero h3{
    margin:0 0 6px;
    font-size:25px;
}

.progress-card{
    min-width:260px;
    background:#fff;
    border:1px solid var(--border);
    border-radius:18px;
    padding:16px;
    box-shadow:0 10px 25px rgba(15,23,42,.06);
}

.progress-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    font-weight:900;
    margin-bottom:10px;
}

.progress-bar{
    height:9px;
    background:#e6edf5;
    border-radius:999px;
    overflow:hidden;
}

.progress-fill{
    height:100%;
    width:0%;
    background:linear-gradient(90deg,var(--primary),var(--accent));
    border-radius:999px;
    transition:.3s ease;
}

.steps{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:18px;
}

.step-pill{
    padding:9px 13px;
    border-radius:999px;
    background:#edf2f7;
    font-size:13px;
    font-weight:900;
    color:#475569;
    border:1px solid transparent;
}

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

.step-pill.done{
    background:#e7f8ef;
    color:var(--success);
    border-color:#b7ebc6;
}

.form-body{
    padding:28px;
}

.form-step{
    display:none;
    animation:fadeSlide .25s ease;
}

.form-step.active{
    display:block;
}

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

.section-title{
    margin:0 0 14px;
    font-size:20px;
}

.two{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:15px;
}

.three{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:15px;
}

.investigator-row{
    border:1px solid var(--border);
    border-radius:18px;
    padding:16px;
    margin:14px 0;
    background:#fbfdff;
}

.investigator-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-bottom:10px;
}

.file-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:15px;
}

.file-box{
    border:1px dashed #b8c7d9;
    background:#fbfdff;
    border-radius:18px;
    padding:16px;
}

.uploaded-list{
    display:grid;
    gap:8px;
}

.review-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
}

.review-box{
    border:1px solid var(--border);
    border-radius:18px;
    padding:16px;
    background:#fbfdff;
}

.review-box h4{
    margin:0 0 10px;
    color:var(--primary);
}

.review-line{
    display:grid;
    grid-template-columns:160px 1fr;
    gap:10px;
    padding:7px 0;
    border-bottom:1px solid #edf2f7;
}

.review-line:last-child{
    border-bottom:0;
}

.confirm-box{
    margin-top:18px;
    padding:15px;
    border-radius:16px;
    background:#fff8e8;
    border:1px solid #fde68a;
}

.actions{
    position:sticky;
    bottom:0;
    background:rgba(255,255,255,.95);
    backdrop-filter:blur(12px);
    border-top:1px solid var(--border);
    padding:16px 28px;
    display:flex;
    justify-content:space-between;
    gap:12px;
    z-index:20;
}

.actions-right{
    display:flex;
    gap:10px;
}

/* AUTH PAGES */
.auth-page{
    min-height:100vh;
    background:var(--bg);
}

.auth-header{
    background:var(--primary);
    padding:12px 18px;
    display:flex;
    align-items:center;
    min-height:64px;
}





.auth-wrap{
    min-height:calc(100vh - 64px);
    display:grid;
    place-items:center;
    padding:22px;
}

.auth-card{
    width:100%;
    max-width:430px;
    background:#fff;
    border-radius:22px;
    padding:30px;
    box-shadow:var(--shadow);
    border:1px solid var(--border);
}



.auth-header .text-brand,
.auth-header .auth-text-brand{
    color:#fff;
    font-size:21px;
    font-weight:900;
    letter-spacing:.04em;
}

/* MOBILE */
.mobile-overlay{
    display:none;
}

@media(max-width:980px){
    .layout{
        display:block;
        min-height:auto;
    }

    .mobile-header{
        display:flex !important;
        align-items:center;
        justify-content:space-between;
        background:var(--primary);
        padding:10px 14px;
        position:sticky;
        top:0;
        z-index:70;
        min-height:62px;
        box-shadow:0 2px 14px rgba(0,0,0,.08);
    }

    

    

    .mobile-menu-btn{
        width:46px;
        height:46px;
        border:1px solid rgba(255,255,255,.25);
        background:rgba(255,255,255,.12);
        border-radius:14px;
        display:flex;
        flex-direction:column;
        justify-content:center;
        align-items:center;
        gap:5px;
        padding:0;
        cursor:pointer;
    }

    .mobile-menu-btn span{
        width:22px;
        height:2px;
        background:#fff;
        display:block;
        border-radius:5px;
    }

    .desktop-topbar{
        display:none;
    }

    .sidebar{
        position:fixed;
        left:-310px;
        top:0;
        height:100vh;
        width:290px;
        transition:.25s ease;
        box-shadow:20px 0 45px rgba(0,0,0,.20);
        z-index:80;
        overflow-y:auto;
    }

    .sidebar.open{
        left:0;
    }

    .sidebar-close{
        display:grid;
        place-items:center;
    }

    .mobile-overlay.show{
        display:block;
        position:fixed;
        inset:0;
        background:rgba(15,23,42,.45);
        z-index:75;
    }

    body.menu-open{
        overflow:hidden;
    }

    .main{
        padding:16px;
    }

    .grid,
    .two,
    .three,
    .file-grid,
    .review-grid{
        grid-template-columns:1fr;
    }

    .card,
    .tile,
    .search-card,
    .form-shell{
        border-radius:18px;
    }

    .form-hero-row{
        display:block;
    }

    .progress-card{
        min-width:auto;
        margin-top:16px;
    }

    .steps{
        overflow-x:auto;
        flex-wrap:nowrap;
        padding-bottom:5px;
    }

    .step-pill{
        white-space:nowrap;
    }

    .application-item{
        grid-template-columns:1fr;
        gap:10px;
    }

    .search-row{
        display:block;
    }

    .search-input{
        max-width:none;
        margin-top:12px;
    }
}

@media(max-width:640px){
    .main{
        padding:12px;
    }

    .mobile-header{
        min-height:62px;
    }

    .mobile-header .text-brand{
        font-size:19px;
    }

    .auth-header{
        justify-content:center;
        min-height:64px;
    }

    .auth-wrap{
        min-height:calc(100vh - 64px);
        align-items:start;
        padding-top:45px;
    }

    .auth-card{
        padding:24px;
    }

    .form-hero,
    .form-body{
        padding:18px;
    }

    .form-hero h3{
        font-size:20px;
    }

    .actions{
        padding:12px;
        display:grid;
        grid-template-columns:1fr;
    }

    .actions-right{
        display:grid;
        grid-template-columns:1fr 1fr;
    }

    .actions-right .btn{
        width:100%;
    }

    .review-line{
        grid-template-columns:1fr;
        gap:4px;
    }

    .table{
        display:block;
        overflow-x:auto;
        white-space:nowrap;
    }

    .tile h3{
        font-size:24px;
    }

    .btn{
        width:100%;
        margin-bottom:6px;
    }
}

/* FINAL RESPONSIVE HEADER + SIDEBAR FIX */

/* Hide mobile header on desktop and tablet */
.mobile-header{
    display:none !important;
}

/* Desktop and tablet sidebar */
.sidebar{
    background:#336898 !important;
    color:#ffffff !important;
    border-right:none !important;
    box-shadow:12px 0 40px rgba(15,23,42,.08) !important;
}

.sidebar-head{
    background:transparent !important;
    margin-bottom:18px !important;
}

.sidebar-text-brand{
    color:#ffffff !important;
    font-size:28px !important;
    font-weight:900 !important;
    letter-spacing:.06em !important;
    line-height:1 !important;
    min-height:auto !important;
}

.role-label{
    color:rgba(255,255,255,.78) !important;
    font-size:12px !important;
    font-weight:800 !important;
    margin:0 0 18px !important;
    letter-spacing:.08em !important;
}

.nav a{
    color:rgba(255,255,255,.92) !important;
    background:transparent !important;
}

.nav a:hover,
.nav a.active{
    background:rgba(255,255,255,.18) !important;
    color:#ffffff !important;
}

.sidebar-close{
    display:none !important;
}

.desktop-topbar{
    display:flex !important;
}

/* Phone only */
@media(max-width:768px){

    .mobile-header{
        display:flex !important;
        align-items:center !important;
        justify-content:space-between !important;
        background:#336898 !important;
        padding:10px 14px !important;
        position:sticky !important;
        top:0 !important;
        z-index:70 !important;
        min-height:62px !important;
        box-shadow:0 2px 14px rgba(0,0,0,.08) !important;
    }

    .mobile-header .text-brand{
        color:#ffffff !important;
        font-size:20px !important;
        font-weight:900 !important;
        letter-spacing:.04em !important;
    }

    .desktop-topbar{
        display:none !important;
    }

    .layout{
        display:block !important;
        min-height:auto !important;
    }

    .sidebar{
        background:#336898 !important;
        position:fixed !important;
        left:-310px !important;
        top:0 !important;
        width:290px !important;
        height:100vh !important;
        z-index:80 !important;
        overflow-y:auto !important;
        transition:.25s ease !important;
        box-shadow:20px 0 45px rgba(0,0,0,.20) !important;
    }

    .sidebar.open{
        left:0 !important;
    }

    .sidebar-close{
        display:grid !important;
        place-items:center !important;
        background:rgba(255,255,255,.16) !important;
        color:#fff !important;
    }

    .sidebar-text-brand{
        font-size:27px !important;
    }

    .mobile-overlay.show{
        display:block !important;
        position:fixed !important;
        inset:0 !important;
        background:rgba(15,23,42,.45) !important;
        z-index:75 !important;
    }

    body.menu-open{
        overflow:hidden !important;
    }
}

/* Tablet only: keep normal sidebar and hide mobile header */
@media(min-width:769px) and (max-width:980px){

    .mobile-header{
        display:none !important;
    }

    .layout{
        display:grid !important;
        grid-template-columns:270px 1fr !important;
        min-height:100vh !important;
    }

    .sidebar{
        position:sticky !important;
        left:auto !important;
        top:0 !important;
        height:100vh !important;
        width:auto !important;
        z-index:60 !important;
        overflow:visible !important;
    }

    .desktop-topbar{
        display:flex !important;
    }
}


/* BRAND STYLE LIKE SAMPLE */
.portal-brand,
.mobile-brand{
    display:flex !important;
    align-items:center !important;
    gap:12px !important;
    text-decoration:none !important;
    color:#142033 !important;
}

.brand-mark{
    width:54px !important;
    height:54px !important;
    border-radius:16px !important;
    background:linear-gradient(135deg,#0b5f8f,#14a7d8) !important;
    color:#ffffff !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    font-size:21px !important;
    font-weight:900 !important;
    letter-spacing:.02em !important;
    flex:0 0 54px !important;
}

.brand-copy{
    display:flex !important;
    flex-direction:column !important;
    line-height:1.08 !important;
}

.brand-copy strong{
    color:#142033 !important;
    font-size:18px !important;
    font-weight:900 !important;
    white-space:nowrap !important;
}

.brand-copy small{
    color:#6b7280 !important;
    font-size:16px !important;
    margin-top:3px !important;
    white-space:nowrap !important;
}

.sidebar{
    background:#ffffff !important;
    color:#142033 !important;
    border-right:1px solid #d9e2ec !important;
}

.nav a{
    color:#334155 !important;
}

.nav a:hover,
.nav a.active{
    background:#eaf6fc !important;
    color:#0b5f8f !important;
}

.role-label{
    color:#6b7280 !important;
}

.sidebar-close{
    display:none !important;
}

@media(max-width:768px){
    .mobile-brand .brand-mark{
        width:42px !important;
        height:42px !important;
        border-radius:12px !important;
        font-size:17px !important;
        flex-basis:42px !important;
    }

    .mobile-brand .brand-copy strong{
        color:#ffffff !important;
        font-size:16px !important;
    }

    .mobile-brand .brand-copy small{
        color:rgba(255,255,255,.82) !important;
        font-size:13px !important;
    }

    .mobile-header{
        background:#336898 !important;
    }

    .sidebar .brand-copy strong{
        color:#142033 !important;
    }

    .sidebar .brand-copy small{
        color:#6b7280 !important;
    }

    .sidebar-close{
        display:grid !important;
        place-items:center !important;
        color:#142033 !important;
        background:#f1f5f9 !important;
    }
}


/* ===== SPACING + ALIGNMENT IMPROVEMENTS ===== */

/* Main page content */
.main{
    padding:40px !important;
}

/* Top header area */
.desktop-topbar{
    margin-bottom:34px !important;
    align-items:flex-start !important;
}

.desktop-topbar h2{
    margin:0 0 14px !important;
    font-size:42px !important;
    line-height:1.15 !important;
    font-weight:800 !important;
}

.desktop-topbar .muted{
    display:block !important;
    margin-top:8px !important;
    font-size:17px !important;
    color:#64748b !important;
}

/* Notifications/Profile spacing */
.topbar-actions{
    display:flex !important;
    gap:14px !important;
    align-items:center !important;
    padding-top:8px !important;
}

/* Stats cards spacing */
.grid{
    gap:24px !important;
    margin-bottom:34px !important;
}

.tile{
    padding:28px !important;
    border-radius:22px !important;
}

.tile h3{
    margin:0 0 14px !important;
    font-size:34px !important;
    font-weight:800 !important;
}

.tile .muted{
    font-size:16px !important;
}

/* Main dashboard card */
.card{
    padding:34px !important;
    border-radius:24px !important;
    margin-bottom:34px !important;
}

.card h3{
    margin:0 0 18px !important;
    font-size:32px !important;
    line-height:1.2 !important;
}

.card p{
    margin:0 0 26px !important;
    line-height:1.8 !important;
    color:#64748b !important;
    font-size:16px !important;
}

/* Buttons spacing */
.btn{
    padding:14px 22px !important;
    border-radius:14px !important;
    font-size:15px !important;
    font-weight:700 !important;
}

.card .btn{
    margin-right:12px !important;
    margin-bottom:12px !important;
}

/* Recent submissions area */
.search-card{
    padding:28px !important;
    border-radius:22px !important;
}

.search-card h3{
    margin:0 0 12px !important;
    font-size:28px !important;
}

.search-card p{
    margin-bottom:22px !important;
    color:#64748b !important;
    line-height:1.7 !important;
}

.search-input,
input[type="text"],
input[type="search"]{
    height:56px !important;
    border-radius:14px !important;
    padding:0 18px !important;
    font-size:15px !important;
}

/* Empty state */
.empty-state{
    margin-top:24px !important;
    padding:30px !important;
    border-radius:18px !important;
    font-size:16px !important;
}

/* Sidebar spacing */
.nav{
    margin-top:24px !important;
}

.nav a{
    padding:15px 16px !important;
    margin-bottom:10px !important;
    border-radius:14px !important;
    font-size:15px !important;
}

/* Responsive */
@media(max-width:768px){

    .main{
        padding:20px !important;
    }

    .desktop-topbar h2{
        font-size:30px !important;
    }

    .tile{
        padding:22px !important;
    }

    .card{
        padding:24px !important;
    }

    .card h3{
        font-size:25px !important;
    }

    .grid{
        gap:18px !important;
    }

    .btn{
        width:100% !important;
    }
}
