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

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

body{
    font-family:Arial,Helvetica,sans-serif;
    background:#eef3f8;
    color:#263646;
}

body.nav-open{
    overflow:hidden;
}

a{
    text-decoration:none;
}

button,
input,
select,
textarea{
    font:inherit;
}

.app-shell{
    display:flex;
    min-height:100vh;
}

/* ==========================
   Sidebar
========================== */

.sidebar{
    width:260px;
    background:#12314b;
    color:white;
    display:flex;
    flex-direction:column;
    box-shadow:3px 0 18px rgba(0,0,0,.15);
    flex-shrink:0;
    z-index:1001;
}

.brand{
    display:flex;
    align-items:center;
    gap:14px;
    padding:25px;
    border-bottom:1px solid rgba(255,255,255,.12);
}

.brand-mark{
    width:52px;
    height:52px;
    border-radius:14px;
    background:#2b6ca3;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    font-weight:bold;
    flex:0 0 auto;
}

.brand-title{
    font-size:20px;
    font-weight:bold;
}

.brand-subtitle{
    color:#b9c7d4;
    font-size:13px;
}

/* ==========================
Navigation
========================== */

.nav-menu{
    padding:18px;
    display:flex;
    flex-direction:column;
    gap:8px;
}

.nav-menu a{
    color:white;
    padding:12px 16px;
    border-radius:10px;
    transition:.25s;
    display:block;
}

.nav-menu a:hover{
    background:#2b6ca3;
}

.nav-menu a.active{
    background:#f4c542;
    color:#222;
    font-weight:bold;
}

.nav-section{
    margin-top:18px;
    margin-bottom:6px;
    color:#7fa4c3;
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:1px;
}

.sidebar-footer{
    margin-top:auto;
    padding:20px;
    border-top:1px solid rgba(255,255,255,.10);
}

.sidebar-footer a{
    color:white;
    display:block;
    padding:10px 12px;
    border-radius:10px;
}

.sidebar-footer a:hover{
    background:#2b6ca3;
}

/* ==========================
Main Content
========================== */

.main-content{
    flex:1;
    min-width:0;
    display:flex;
    flex-direction:column;
}

.topbar{
    min-height:78px;
    background:white;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    padding:0 30px;
    border-bottom:1px solid #d9e2ec;
    position:sticky;
    top:0;
    z-index:900;
}

.topbar-left{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:0;
}

.topbar h1{
    color:#174466;
    font-size:28px;
    line-height:1.15;
    overflow-wrap:anywhere;
}

.mobile-menu-button{
    display:none;
    width:44px;
    height:44px;
    border:0;
    border-radius:10px;
    background:#174466;
    color:white;
    font-size:24px;
    cursor:pointer;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
}

.mobile-menu-button:hover{
    background:#2b6ca3;
}

.user-pill{
    background:#eef6ff;
    padding:10px 16px;
    border-radius:999px;
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    flex:0 0 auto;
}

.user-pill span{
    color:#64748b;
    font-size:12px;
}

.content-wrap{
    padding:30px;
    width:100%;
}

.sidebar-overlay{
    display:none;
}

/* ==========================
Cards
========================== */

.card{
    background:white;
    border-radius:16px;
    padding:24px;
    box-shadow:0 8px 18px rgba(0,0,0,.08);
}

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

.stat-card{
    background:white;
    border-radius:16px;
    padding:24px;
    box-shadow:0 8px 18px rgba(0,0,0,.08);
}

.stat-card h3{
    color:#6b7c8d;
    font-size:14px;
    margin-bottom:12px;
}

.stat-card .number{
    font-size:34px;
    color:#174466;
    font-weight:bold;
}

/* ==========================
Forms, actions, tables
========================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea{
    max-width:100%;
}

button,
.button,
.btn{
    min-height:44px;
}

table{
    width:100%;
}

.table-wrap{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
}

.actions,
.button-row,
.top-actions,
.form-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

/* ==========================
Responsive
========================== */

@media(max-width:1000px){
    .stats{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
}

@media(max-width:760px){
    .app-shell{
        display:block;
    }

    .sidebar{
        position:fixed;
        inset:0 auto 0 0;
        width:min(86vw,320px);
        transform:translateX(-105%);
        transition:transform .24s ease;
        box-shadow:8px 0 28px rgba(0,0,0,.28);
        overflow-y:auto;
    }

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

    .sidebar-overlay{
        display:block;
        position:fixed;
        inset:0;
        background:rgba(10,25,40,.48);
        opacity:0;
        visibility:hidden;
        transition:.2s ease;
        z-index:1000;
    }

    body.nav-open .sidebar-overlay{
        opacity:1;
        visibility:visible;
    }

    .mobile-menu-button{
        display:inline-flex;
    }

    .topbar{
        min-height:68px;
        padding:10px 14px;
        align-items:center;
    }

    .topbar h1{
        font-size:22px;
    }

    .user-pill{
        padding:8px 11px;
        border-radius:14px;
        max-width:42%;
    }

    .user-pill strong,
    .user-pill span{
        max-width:100%;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    .content-wrap{
        padding:16px;
    }

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

    .card,
    .stat-card{
        padding:18px;
        border-radius:14px;
    }

    .actions,
    .button-row,
    .top-actions,
    .form-actions{
        flex-direction:column;
    }

    .actions > *,
    .button-row > *,
    .top-actions > *,
    .form-actions > *,
    .button,
    .btn,
    button{
        width:100%;
        text-align:center;
    }

    form{
        width:100%;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="url"],
    select,
    textarea{
        width:100%;
    }

    table.responsive-table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table th,
    .responsive-table td,
    .responsive-table tr{
        display:block;
        width:100%;
    }

    .responsive-table thead{
        position:absolute;
        width:1px;
        height:1px;
        overflow:hidden;
        clip:rect(0 0 0 0);
        white-space:nowrap;
    }

    .responsive-table tr{
        background:#fff;
        border:1px solid #d9e2ec;
        border-radius:14px;
        padding:14px;
        margin-bottom:14px;
        box-shadow:0 5px 14px rgba(0,0,0,.06);
    }

    .responsive-table td{
        display:grid;
        grid-template-columns:minmax(110px,42%) 1fr;
        gap:12px;
        align-items:start;
        padding:9px 0;
        border-bottom:1px solid #edf2f7;
        text-align:left !important;
    }

    .responsive-table td:last-child{
        border-bottom:0;
    }

    .responsive-table td::before{
        content:attr(data-label);
        font-weight:bold;
        color:#174466;
    }

    .responsive-table td .actions,
    .responsive-table td .action-links{
        width:100%;
    }
}

@media(max-width:420px){
    .brand{
        padding:18px;
    }

    .brand-mark{
        width:46px;
        height:46px;
        font-size:20px;
    }

    .topbar h1{
        font-size:20px;
    }

    .user-pill{
        max-width:38%;
        font-size:13px;
    }

    .content-wrap{
        padding:12px;
    }

    .responsive-table td{
        grid-template-columns:1fr;
        gap:4px;
    }
}
