* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f5f9;
    color: #192438;
    font: 14px Arial, sans-serif;
}

.top {
    height: 68px;
    background: #101b31;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
}

.brand {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 2px;
    color: white;
    text-decoration: none;
}

.brand small {
    display: block;
    font-size: 9px;
    letter-spacing: 3px;
}

.logout {
    color: #c7dcff;
    margin-left: 18px;
}

.layout {
    display: flex;
    min-height: calc(100vh - 108px);
}

nav {
    width: 245px;
    background: #172640;
    padding: 22px 13px;
}

.navtitle {
    color: #8ca5c9;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 8px 12px 15px;
}

nav a {
    display: block;
    padding: 12px 13px;
    margin: 3px 0;
    color: #dce6f4;
    text-decoration: none;
    border-radius: 7px;
}

nav a:hover {
    background: #2c4265;
}

main {
    padding: 28px;
    flex: 1;
    min-width: 0;
}

h1 {
    font-size: 26px;
    margin: 0 0 22px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 15px;
}

.card,
.box {
    background: white;
    border: 1px solid #e4e9f0;
    border-radius: 11px;
    padding: 18px;
    margin-bottom: 16px;
}

.big {
    font-size: 28px;
    font-weight: bold;
    margin-top: 9px;
}

.muted {
    color: #758198;
}

.btn {
    display: inline-block;
    background: #1769d2;
    color: #fff;
    border: 0;
    border-radius: 7px;
    padding: 10px 15px;
    text-decoration: none;
    cursor: pointer;
}

.field {
    margin: 12px 0;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccd5e2;
    border-radius: 6px;
    background: white;
}

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

.flash {
    background: #e5f5eb;
    padding: 12px;
    border-radius: 7px;
    margin-bottom: 15px;
}

.tablewrap {
    overflow: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 800px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #e7ecf2;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f0f4fa;
    font-size: 12px;
}

/* Login Page */
.login {
    max-width: 460px;
    width: calc(100% - 30px);
    margin: 8vh auto;
    background: white;
    padding: 30px;
    border-radius: 13px;
    box-shadow: 0 8px 35px #15233a18;
}

.login h1 {
    font-size: 28px;
    margin-bottom: 25px;
}

.login .field {
    margin: 18px 0;
}

.login .field input {
    width: 100%;
    height: 44px;
}

.login .btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
}

.login a {
    color: #1769d2;
}

footer {
    text-align: center;
    color: #8290a4;
    padding: 18px;
    font-size: 12px;
}

/* -------------------------------------------------
   SAPNA DASHBOARD: fixed header/sidebar, scroll main
   Requires page_start() classes:
   .sapna-dashboard, .sapna-fixed-header,
   .sapna-dashboard-layout, .sapna-fixed-sidebar,
   .sapna-scroll-content, .sapna-content-footer
-------------------------------------------------- */
html,
body.sapna-dashboard {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body.sapna-dashboard {
    min-height: 0;
}

.sapna-fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    z-index: 1000;
}

.sapna-dashboard-layout {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    min-height: 0;
    overflow: hidden;
}

.sapna-fixed-sidebar {
    position: fixed;
    top: 68px;
    left: 0;
    bottom: 0;
    width: 245px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 900;
    scrollbar-width: thin;
}

.sapna-scroll-content {
    position: absolute;
    top: 0;
    left: 245px;
    right: 0;
    bottom: 0;
    min-width: 0;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.sapna-content-footer {
    display: block;
    width: 100%;
    text-align: center;
    color: #8290a4;
    padding: 18px;
    font-size: 12px;
}

/* Mobile: header and compact horizontal menu stay fixed;
   only the page content below them scrolls. */
@media (max-width: 760px) {
    .sapna-fixed-header {
        height: 60px;
        padding: 0 14px;
    }

    .sapna-dashboard-layout {
        top: 60px;
    }

    .sapna-fixed-sidebar {
        top: 60px;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: 58px;
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 5px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }

    .sapna-fixed-sidebar .navtitle {
        display: none;
    }

    .sapna-fixed-sidebar a {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        padding: 10px 12px;
        margin: 0;
        font-size: 12px;
    }

    .sapna-scroll-content {
        top: 58px;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 16px;
    }

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

    .top {
        padding: 0 14px;
    }
}
