:root {
    --esms-navy: #12263f;
    --esms-navy-2: #1b3554;
    --esms-blue: #0f6cbd;
    --esms-ink: #1c2430;
    --esms-muted: #5c6b7a;
    --esms-line: #e4e8ee;
    --esms-bg: #f3f5f8;
    --bs-primary: #0f6cbd;
    --bs-primary-rgb: 15, 108, 189;
    --bs-body-font-family: "Segoe UI", system-ui, sans-serif;
    --bs-body-color: var(--esms-ink);
}

body {
    background: var(--esms-bg);
    color: var(--esms-ink);
}

.btn-primary {
    --bs-btn-bg: var(--esms-blue);
    --bs-btn-border-color: var(--esms-blue);
    --bs-btn-hover-bg: #0b548f;
    --bs-btn-hover-border-color: #0b548f;
    --bs-btn-active-bg: #094472;
    --bs-btn-active-border-color: #094472;
    min-height: 44px;
}

.btn-outline-secondary {
    min-height: 40px;
}

h1, h2, .modal-title {
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.6rem;
    margin: 0;
}

h2 {
    font-size: 1.15rem;
}

.page-loader {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    background: rgba(243, 245, 248, 0.72);
}

.page-loader.is-active {
    display: flex;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    background: var(--esms-navy);
    color: #fff;
    flex-direction: column;
    padding: 1.25rem 1rem;
    z-index: 1030;
}

.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    padding: 0.35rem 0.75rem 1.25rem;
}

.brand:hover {
    color: #fff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #d5deea;
    text-decoration: none;
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    font-weight: 600;
}

.sidebar-link:hover,
.sidebar-link.is-current {
    background: var(--esms-navy-2);
    color: #fff;
}

.app-main {
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 68px;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--esms-line);
}

.topbar-title {
    font-weight: 700;
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-chip {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--esms-muted);
    font-size: 0.92rem;
}

.menu-button,
.logout-button {
    border: 1px solid var(--esms-line);
    background: #fff;
    border-radius: 10px;
    min-height: 40px;
    padding: 0.4rem 0.8rem;
}

.menu-button {
    width: 40px;
    padding: 0;
    font-size: 1.3rem;
    line-height: 1;
}

.logout-button:hover,
.menu-button:hover {
    background: #f4f7fb;
}

.content {
    padding: 1.5rem;
}

.content-solo {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 3rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--esms-muted);
}

.panel {
    background: #fff;
    border: 1px solid var(--esms-line);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 10px 30px rgba(18, 38, 63, 0.04);
}

.narrow-panel {
    max-width: 520px;
}

.table-wrap {
    overflow-x: auto;
}

.user-table {
    min-width: 760px;
    margin-bottom: 0;
}

.user-table thead th {
    color: var(--esms-muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
    border-bottom-color: var(--esms-line);
    white-space: nowrap;
}

.photo-button {
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: 999px;
}

.photo-button img,
.avatar-letter {
    width: 42px;
    height: 42px;
    border-radius: 999px;
}

.photo-button img {
    object-fit: cover;
    display: block;
}

.avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8eef5;
    color: var(--esms-navy);
    font-weight: 700;
}

.action-cell {
    display: flex;
    gap: 0.4rem;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #d8dee8;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-button.edit {
    color: var(--esms-blue);
}

.icon-button.delete {
    color: #b42318;
}

.icon-button:hover {
    background: #f4f7fb;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-pill.is-active {
    background: #e7f6ec;
    color: #067647;
}

.status-pill.is-inactive {
    background: #f2f4f7;
    color: #475467;
}

.pager-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.field-error {
    color: #b42318;
    font-size: 0.82rem;
    min-height: 1.1rem;
    margin-top: 0.25rem;
}

.field-error:empty {
    display: none;
}

.req {
    color: #b42318;
}

.photo-preview,
.zoom-image {
    display: block;
    margin: 0.75rem auto 0;
    max-width: 100%;
    object-fit: contain;
    background: #f4f7fb;
}

.photo-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
}

.zoom-image {
    max-height: 75vh;
    margin: 0 auto;
}

#mobileSidebar {
    background: var(--esms-navy);
    color: #fff;
    width: min(280px, 88vw);
}

#mobileSidebar .btn-close {
    filter: invert(1);
}

.login-body {
    background: #eef2f6;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 0.9fr);
}

.login-brand {
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(160deg, #173556, var(--esms-navy) 55%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
}

.brand-mark {
    font-weight: 800;
    letter-spacing: 0.14em;
    margin-bottom: 1rem;
}

.login-brand h1 {
    font-size: 2.4rem;
    max-width: 10ch;
}

.login-brand p {
    max-width: 28ch;
    color: #d5deea;
    margin: 0.75rem 0 0;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-panel form {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--esms-line);
    border-radius: 18px;
    padding: 2rem 1.5rem;
    box-shadow: 0 16px 40px rgba(18, 38, 63, 0.06);
}

.login-panel h2 {
    margin-bottom: 1.25rem;
}

.login-submit {
    width: 100%;
}

.form-control,
.form-select {
    min-height: 44px;
}

.validation-summary-valid {
    display: none;
}

.validation-summary-errors {
    background: #fdecec;
    color: #8a1f11;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.1rem;
}

.input-validation-error {
    border-color: #b42318;
}

.field-validation-error {
    color: #b42318;
    font-size: 0.82rem;
}

@media (min-width: 992px) {
    .app-main {
        margin-left: 260px;
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        align-content: start;
    }

    .login-brand {
        min-height: auto;
        justify-content: flex-start;
        padding: 1.5rem 1.25rem 1rem;
    }

    .login-brand h1 {
        font-size: 1.75rem;
    }

    .login-panel {
        padding: 1rem 1rem 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .content {
        padding: 1rem;
    }

    .page-head,
    .topbar-user {
        align-items: stretch;
    }

    .page-head {
        flex-direction: column;
    }

    .user-chip {
        display: none;
    }

    .login-panel form {
        padding: 1.5rem 1rem;
    }
}
