:root {
    font-family: Inter, Segoe UI, Arial, sans-serif;
    color: #152033;
    background: #f4f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

a {
    color: #1765c1;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

/* =========================
   TOP BAR
   ========================= */

.topbar {
    min-height: 72px;
    background: #fff;
    border-bottom: 1px solid #e4e9f1;
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 3;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
}

.brand-mark {
    background: #153d74;
    color: #fff;
    padding: 9px 10px;
    border-radius: 8px;
    font-weight: 800;
}

.brand small {
    display: block;
    color: #76839a;
    margin-top: 2px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
    min-width: 0;
}

.topbar nav a {
    color: #35435a;
    font-weight: 600;
    white-space: nowrap;
}

.topbar nav a:hover {
    color: #1765c1;
}

/* =========================
   GLOBAL DOCUMENT SEARCH
   ========================= */

.global-search {
    display: flex;
    align-items: center;
    width: 280px;
    min-width: 220px;
    position: relative;
}

.global-search input {
    width: 100%;
    height: 40px;
    padding: 9px 42px 9px 13px;
    border: 1px solid #cfd7e4;
    border-radius: 10px;
    background: #f9fbfd;
    color: #152033;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.global-search input::placeholder {
    color: #8a96a9;
}

.global-search input:focus {
    border-color: #1765c1;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(23, 101, 193, .10);
}

.global-search button {
    position: absolute;
    right: 5px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1765c1;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 17px;
    padding: 0;
}

.global-search button:hover {
    background: #edf3fa;
}

/* =========================
   USER BOX
   ========================= */

.userbox {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 13px;
    white-space: nowrap;
}

/* =========================
   MAIN LAYOUT
   ========================= */

.container {
    max-width: 1280px;
    margin: 30px auto;
    padding: 0 24px;
    min-height: calc(100vh - 150px);
}

footer {
    text-align: center;
    color: #7a8494;
    padding: 24px;
}

/* =========================
   PAGE HEADERS
   ========================= */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.page-head p,
.muted {
    margin: 0;
    color: #748096;
}

/* =========================
   DASHBOARD CARDS
   ========================= */

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat {
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 3px 12px rgba(26, 45, 75, .04);
}

.stat span {
    display: block;
    color: #748096;
    margin-bottom: 10px;
}

.stat strong {
    font-size: 32px;
}

.stat.warning strong {
    color: #bb7417;
}

/* =========================
   PANELS
   ========================= */

.panel {
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 3px 12px rgba(26, 45, 75, .04);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-head h2 {
    margin: 0 0 16px;
}

/* =========================
   BUTTONS
   ========================= */

.btn {
    display: inline-block;
    border: 1px solid #cfd7e4;
    background: #fff;
    border-radius: 9px;
    padding: 10px 15px;
    color: #26364d;
    cursor: pointer;
}

.btn.primary {
    background: #1765c1;
    border-color: #1765c1;
    color: #fff;
    font-weight: 700;
}

/* =========================
   FILTERS
   ========================= */

.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.filters input {
    flex: 1;
}

.filters select {
    min-width: 220px;
}

/* =========================
   FORM CONTROLS
   ========================= */

input,
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #cfd7e4;
    border-radius: 8px;
    background: #fff;
}

label {
    display: block;
    font-weight: 650;
    margin: 14px 0 6px;
}

.form-panel {
    max-width: 920px;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 22px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.validation {
    color: #b42318;
    margin: 8px 0;
}

/* =========================
   ALERTS
   ========================= */

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.alert.success {
    background: #eaf8ef;
    color: #1e6a39;
}

.alert.danger {
    background: #fdecec;
    color: #9f1f16;
}

/* =========================
   TABLES
   ========================= */

.table-wrap {
    overflow: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

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

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #748096;
}

td small {
    display: block;
    color: #8792a5;
    margin-top: 4px;
}

.badge {
    display: inline-block;
    background: #edf3fa;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 12px;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
}

.link-button {
    border: 0;
    background: none;
    color: #1765c1;
    padding: 0;
    cursor: pointer;
}

.link-button.danger {
    color: #b42318;
}

/* =========================
   AUTHENTICATION
   ========================= */

.auth-shell {
    min-height: 70vh;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid #e4e9f1;
    border-radius: 16px;
    padding: 34px;
    box-shadow: 0 12px 40px rgba(30, 54, 84, .1);
}

.auth-card h1 {
    margin: 10px 0;
}

.auth-card p {
    color: #748096;
    line-height: 1.55;
}

.auth-icon {
    font-size: 34px;
}

.auth-card .btn {
    width: 100%;
    margin-top: 20px;
}

.otp {
    text-align: center;
    font-size: 28px;
    letter-spacing: 10px;
}

.secondary-form {
    text-align: center;
    margin-top: 18px;
}

/* =========================
   PERMISSIONS
   ========================= */

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 500;
}

.check input {
    width: auto;
}

.permission-box,
.permissions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin: 15px 0;
    padding: 15px;
    background: #f7f9fc;
    border-radius: 10px;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1100px) {
    .topbar {
        gap: 14px;
        padding: 0 18px;
    }

    .brand {
        min-width: 220px;
    }

    .topbar nav {
        gap: 12px;
    }

    .global-search {
        width: 220px;
    }
}

@media (max-width: 900px) {
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 16px;
    }

    .brand {
        min-width: 0;
    }

    .topbar nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .global-search {
        order: 4;
        width: 100%;
    }

    .userbox {
        margin-left: auto;
    }

    .userbox span {
        display: none;
    }

    .cards,
    .grid2 {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 14px;
    }

    .page-head {
        align-items: flex-start;
        gap: 12px;
    }

    .filters {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .topbar nav {
        gap: 10px;
    }

    .topbar nav a {
        font-size: 13px;
    }

    .page-head {
        flex-direction: column;
    }

    .actions {
        flex-wrap: wrap;
    }
}