:root {
    --bg: #f7f9fc;
    --surface: #fff;
    --surface-soft: #f9fbff;
    --text: #243047;
    --muted: #718096;
    --line: #e7ebf2;
    --primary: #5b7cfa;
    --primary2: #4667df;
    --success: #22a06b;
    --danger: #dc5a68;
    --warning: #c58a20;
    --sidebar: #ffffff;
    --sidebar-hover: #f1f5ff;
    --sidebar-text: #536176;
    --sidebar-active: #4f6ff0;
    --shadow: 0 8px 28px rgba(41, 58, 92, .07);
    --radius: 14px;
    --topbar-height: 55px
}

* {
    box-sizing: border-box
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Georgia", serif;
    background: var(--bg);
    color: var(--text)
}

body.dark {
    --bg: #f7f9fc;
    --surface: #fff;
    --text: #243047;
    --muted: #718096;
    --line: #e7ebf2
}

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

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

.workspace {
    display: flex;
    min-height: calc(100vh - var(--topbar-height))
}

.topbar {
    height: var(--topbar-height);
    width: 100%;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 12px rgba(40, 55, 85, .04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 14px
}

.topbar-title .eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--primary);
    font-weight: 800;
    padding-right: 14px;
    border-right: 1px solid var(--line)
}

.topbar-title h1 {
    font-size: 19px;
    margin: 0;
    font-weight: 750
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

.mobile-menu {
    display: none
}

.icon-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 20px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer
}

.icon-btn:hover {
    background: var(--sidebar-hover)
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    overflow: hidden
}

.brand {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line)
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #edf2ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 20px
}

.brand strong {
    display: block;
    font-size: 14px;
    color: var(--text)
}

.brand small {
    display: block;
    color: var(--muted);
    margin-top: 2px
}

.sidebar-close {
    display: none;
    margin-left: auto
}

.nav {
    padding: 15px 12px;
    overflow: auto
}

.nav-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: none;
    color: var(--sidebar-text);
    padding: 10px 12px;
    border-radius: 10px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    margin-bottom: 3px
}

.nav-link:hover,
.nav-link.active {
    background: var(--sidebar-hover);
    color: var(--sidebar-active)
}

.nav-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    color: inherit
}

.chevron {
    margin-left: auto;
    transition: transform .2s
}

.nav-parent.open .chevron {
    transform: rotate(90deg)
}

.nav-sub {
    display: none;
    padding: 0 0 7px 47px
}

.nav-sub.open {
    display: block
}

.nav-sub a {
    display: block;
    padding: 8px 10px;
    color: #8490a3;
    font-size: 13px;
    border-left: 1px solid var(--line)
}

.nav-sub a:hover,
.nav-sub a.active {
    color: var(--sidebar-active);
    border-left-color: #9eb0ff
}

.main-shell {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-width: 0
}

.content {
    padding: 26px;
    max-width: 1600px;
    margin: auto
}

.profile-trigger {
    border: 0;
    background: none;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: inherit;
    padding: 5px
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #edf2ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800
}

.profile-copy {
    text-align: left;
    display: block
}

.profile-copy strong {
    display: block;
    font-size: 13px
}

.profile-copy small {
    display: block;
    color: var(--muted);
    font-size: 11px
}

.profile-menu {
    position: relative
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    width: 190px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 7px;
    z-index: 120
}

.profile-dropdown.open {
    display: block
}

.profile-dropdown a,
.profile-dropdown button {
    display: block;
    width: 100%;
    padding: 10px;
    border: 0;
    background: none;
    text-align: left;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    cursor: pointer
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
    background: var(--bg)
}

.dropdown-danger {
    color: var(--danger) !important
}

.grid {
    display: grid;
    gap: 18px
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr))
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr))
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr))
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

.card-body {
    padding: 20px
}

.stat {
    padding: 19px
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #edf2ff;
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 800
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 12px
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 3px
}

.stat-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0 0 15px
}

.section-head h2 {
    font-size: 16px;
    margin: 0
}

.section-head p {
    font-size: 12px;
    color: var(--muted);
    margin: 4px 0 0
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px
}

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

.btn-primary:hover {
    background: var(--primary2)
}

.btn-light {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--line)
}

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

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

.alert {
    padding: 12px 14px;
    border-radius: 11px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    border: 1px solid
}

.alert-success {
    background: #effbf5;
    color: #19744f;
    border-color: #ccefdc
}

.alert-error {
    background: #fff2f4;
    color: #a63343;
    border-color: #f3d0d5
}

.alert-warning {
    background: #fff9ed;
    color: #866016;
    border-color: #f0dfb9
}

.alert-info {
    background: #f0f5ff;
    color: #3658a7;
    border-color: #d5e0ff
}

.alert-close {
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px
}

.table-wrap {
    overflow: auto
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px
}

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

.table th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #f8faff
}

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

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700
}

.badge-success {
    background: #e8f8f1;
    color: #197451
}

.badge-danger {
    background: #fcecef;
    color: #a93645
}

.badge-warning {
    background: #fff5df;
    color: #886016
}

.badge-muted {
    background: #f1f4f8;
    color: var(--muted)
}

.quick {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px
}

.quick a {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    font-size: 12px
}

.quick a:hover {
    border-color: #b9c6f8;
    background: #fafbff
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.form-group.full {
    grid-column: 1/-1
}

.form-label {
    font-size: 12px;
    font-weight: 700
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    font: inherit
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 124, 250, .12)
}

.form-help {
    font-size: 11px;
    color: var(--muted)
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px
}

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

.search {
    max-width: 320px
}

.empty {
    padding: 38px;
    text-align: center;
    color: var(--muted)
}

.empty strong {
    display: block;
    color: var(--text);
    margin-bottom: 5px
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(33, 45, 70, .38);
    display: grid;
    place-items: center;
    z-index: 200;
    padding: 18px
}

.modal-backdrop[hidden] {
    display: none
}

.modal {
    width: min(460px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(40, 55, 85, .18);
    padding: 25px;
    position: relative
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 9px;
    border: 0;
    background: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer
}

.modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff5df;
    color: #8b5d08;
    display: grid;
    place-items: center;
    font-weight: 900;
    margin-bottom: 13px
}

.modal h2 {
    font-size: 18px;
    margin: 0 0 7px
}

.modal p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px
}

.center-page {
    display: grid;
    place-items: center;
    padding: 20px;
    min-height: 100vh
}

.login-wrap {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden
}

.login-hero {
    padding: 55px;
    background: linear-gradient(145deg, #edf2ff, #dfe7ff);
    color: #29385f;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.login-hero h1 {
    font-size: 36px;
    line-height: 1.1;
    margin: 20px 0 12px
}

.login-hero p {
    color: #617092;
    line-height: 1.7
}

.login-points {
    margin-top: 25px;
    display: grid;
    gap: 11px;
    font-size: 13px;
    color: #4e5e7d
}

.login-form {
    padding: 45px
}

.login-form h2 {
    font-size: 24px;
    margin: 0 0 7px
}

.login-form .subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 25px
}

.input-wrap {
    position: relative
}

.input-wrap .form-control {
    padding-right: 46px
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 5px;
    border: 0;
    background: none;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--muted)
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted)
}

.login-submit {
    width: 100%;
    margin-top: 18px;
    padding: 13px
}

.login-note {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    margin-top: 18px
}

.error-card {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 45px;
    box-shadow: var(--shadow)
}

.error-code {
    font-size: 56px;
    font-weight: 900;
    color: var(--primary)
}

.pagination {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    margin-top: 15px
}

.pagination a,
.pagination span {
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px
}

.pagination .current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary)
}

@media(max-width:1100px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:800px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(40, 55, 85, .12)
    }

    .sidebar.open {
        transform: none
    }

    .main-shell {
        margin-left: 0;
        width: 100%
    }

    .mobile-menu,
    .sidebar-close {
        display: block
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: var(--topbar-height) 0 0;
        background: rgba(30, 42, 65, .25);
        z-index: 40
    }

    .sidebar-overlay.open {
        display: block
    }

    .content {
        padding: 18px
    }

    .grid-3,
    .grid-2,
    .form-grid {
        grid-template-columns: 1fr
    }

    .login-wrap {
        grid-template-columns: 1fr
    }

    .login-hero {
        display: none
    }

    .login-form {
        padding: 30px 22px
    }

    .profile-copy {
        display: none
    }

    .topbar {
        padding: 0 15px
    }

    .topbar-title {
        gap: 8px
    }

    .topbar-title .eyebrow {
        display: none
    }
}

@media(max-width:520px) {
    .grid-4 {
        grid-template-columns: 1fr
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column
    }

    .search {
        max-width: none
    }

    .topbar-title h1 {
        font-size: 17px
    }
}
/* ==========================================================================
   Users page: bordered table, pagination and Material-style modal form
   ========================================================================== */
.page-section-head { margin-bottom: 18px; }
.page-section-head h2 { display:flex; align-items:center; gap:8px; }
.heading-icon { color: var(--primary); font-size: 22px; }
.users-card { overflow: hidden; }
.users-toolbar { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:18px; }
.users-search { width:min(380px,100%); display:flex; align-items:center; gap:9px; color:var(--muted); }
.underline-control { width:100%; border:0; border-bottom:1px solid #cfd6e3; background:transparent; outline:none; padding:10px 2px; color:var(--text); font:inherit; }
.underline-control:focus { border-bottom:2px solid var(--primary); }
.users-page-size { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; white-space:nowrap; }
.page-select { border:1px solid var(--line); border-radius:8px; padding:8px 30px 8px 10px; background:#fff; color:var(--text); font:inherit; outline:none; }
.page-select:focus { border-color:var(--primary); }
.users-table { border:1px solid #dfe4ec; border-radius:10px; overflow:hidden; border-collapse:separate; border-spacing:0; }
.users-table th, .users-table td { border-right:1px solid #e4e8ef; border-bottom:1px solid #e4e8ef; }
.users-table th:last-child, .users-table td:last-child { border-right:0; }
.users-table tbody tr:last-child td { border-bottom:0; }
.users-table tbody tr:hover { background:#fafbff; }
.user-cell { display:flex; align-items:center; gap:10px; }
.user-avatar { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:#edf2ff; color:var(--primary); font-weight:800; font-size:12px; flex:0 0 34px; }
.user-cell strong { display:block; }
.user-cell small { display:block; color:var(--muted); font-size:10px; margin-top:2px; }
.text-right { text-align:right !important; }
.row-actions { display:flex; justify-content:flex-end; gap:5px; }
.inline-form { display:inline; margin:0; }
.icon-action { width:34px; height:34px; border:1px solid var(--line); border-radius:9px; display:inline-grid; place-items:center; background:#fff; color:var(--primary); cursor:pointer; }
.icon-action:hover { background:#f4f6ff; border-color:#c8d1fa; }
.icon-action.danger { color:var(--danger); }
.icon-action.success { color:var(--success); }
.pagination-bar { display:flex; align-items:center; justify-content:space-between; gap:15px; padding-top:18px; }
.pagination-info { color:var(--muted); font-size:12px; }
.pagination-info strong { color:var(--text); }
.pagination { display:flex; align-items:center; gap:5px; }
.page-btn { min-width:34px; height:34px; padding:0 10px; border:1px solid var(--line); border-radius:8px; background:#fff; display:inline-flex; align-items:center; justify-content:center; color:var(--text); font-size:12px; font-weight:700; }
.page-btn:hover { border-color:#bcc8f7; color:var(--primary); background:#fafbff; }
.page-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.page-btn.disabled { opacity:.45; cursor:not-allowed; pointer-events:none; }
.page-ellipsis { min-width:22px; text-align:center; color:var(--muted); }
.last-btn { margin-left:2px; }

.user-modal-backdrop, .status-modal-backdrop { position:fixed; inset:0; background:rgba(25,35,58,.46); display:grid; place-items:center; z-index:300; padding:18px; backdrop-filter:blur(2px); }
.user-modal-backdrop[hidden], .status-modal-backdrop[hidden] { display:none; }
.user-form-modal { width:min(720px,100%); max-height:calc(100vh - 36px); overflow:auto; background:#fff; border-radius:18px; box-shadow:0 28px 80px rgba(24,35,62,.25); }
.user-modal-head { display:flex; align-items:center; gap:13px; padding:20px 22px; border-bottom:1px solid var(--line); position:relative; }
.user-modal-head h2 { margin:0; font-size:18px; }
.user-modal-head p { margin:3px 0 0; font-size:12px; color:var(--muted); }
.modal-title-icon { width:44px; height:44px; border-radius:13px; background:#edf2ff; color:var(--primary); display:grid; place-items:center; }
.modal-close-btn { margin-left:auto; border:0; background:transparent; color:var(--muted); width:36px; height:36px; border-radius:9px; cursor:pointer; display:grid; place-items:center; }
.modal-close-btn:hover { background:#f4f6fa; color:var(--text); }
#userForm { padding:22px; }
.material-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px 18px; }
.material-field { min-width:0; display:flex; align-items:flex-end; gap:9px; position:relative; }
.material-field > .material-symbols-rounded { color:#7d899c; font-size:21px; margin-bottom:8px; }
.material-field > div { flex:1; min-width:0; }
.material-field label { display:block; font-size:10px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px; }
.material-field input, .material-field select { width:100%; border:0; border-bottom:1px solid #cbd3df; border-radius:0; outline:0; background:transparent; color:var(--text); padding:8px 1px; font:inherit; }
.material-field input:focus, .material-field select:focus { border-bottom:2px solid var(--primary); padding-bottom:7px; }
.material-field input::placeholder { color:#aab2c0; }
.field-icon-button { border:0; background:transparent; color:#7d899c; cursor:pointer; padding:5px 0 7px; }
.user-form-note { margin-top:20px; padding:10px 12px; border-radius:9px; background:#f5f8ff; color:#5d6b86; display:flex; align-items:center; gap:8px; font-size:11px; }
.user-modal-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:22px; padding-top:18px; border-top:1px solid var(--line); }
.status-modal { width:min(400px,100%); background:#fff; border-radius:18px; box-shadow:0 28px 80px rgba(24,35,62,.25); padding:28px; text-align:center; }
.status-modal-icon { width:58px; height:58px; margin:0 auto 13px; border-radius:50%; display:grid; place-items:center; background:#e8f8f1; color:var(--success); }
.status-modal-icon.error { background:#fcecef; color:var(--danger); }
.status-modal-icon.warning { background:#fff5df; color:#9a6a0b; }
.status-modal-icon.info { background:#eef4ff; color:var(--primary); }
.status-modal h2 { margin:0 0 7px; font-size:19px; }
.status-modal p { margin:0; color:var(--muted); font-size:13px; line-height:1.6; }
.status-modal-actions { display:flex; justify-content:center; gap:8px; margin-top:22px; }
.empty-icon { display:block; font-size:38px; color:#b7c1d1; margin-bottom:8px; }
@media (max-width: 800px) {
  .users-toolbar, .pagination-bar { flex-direction:column; align-items:stretch; }
  .users-search { width:100%; }
  .pagination { justify-content:center; flex-wrap:wrap; }
  .material-form-grid { grid-template-columns:1fr; }
}


/* Global typography and breadcrumb treatment */
html, body, button, input, select, textarea { font-family: "Georgia", serif; }
.global-breadcrumb { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:0 0 20px; padding:12px 15px; background:var(--surface); border:1px solid var(--line); border-radius:11px; color:var(--muted); font-size:13px; box-shadow:0 3px 12px rgba(41,58,92,.035); }
.global-breadcrumb a { display:inline-flex; align-items:center; gap:6px; color:var(--primary2); font-weight:700; }
.global-breadcrumb a .material-symbols-rounded, .breadcrumb-separator { font-size:18px; line-height:1; }
.breadcrumb-separator { color:#a2acbc; }
.global-breadcrumb .breadcrumb-current { color:var(--text); font-weight:700; }
