:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #132238;
    --muted: #6b7a90;
    --line: #d9e2ef;
    --line-strong: #c8d5e6;
    --primary: #2563eb;
    --primary-soft: #eaf2ff;
    --success-bg: #ecfdf5;
    --success-line: #a7f3d0;
    --success-text: #065f46;
    --error-bg: #fef2f2;
    --error-line: #fecaca;
    --error-text: #991b1b;
    --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 16px 42px rgba(15, 23, 42, 0.08);
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
body {
    line-height: 1.42;
    overflow-x: hidden;
    font-size: 15px;
}
body.sidebar-open { overflow: hidden; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

html {
    scrollbar-color: #b7c8e5 #eef3fa;
    scrollbar-width: thin;
}

*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: #eef3fa;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: #b7c8e5;
    border: 3px solid #eef3fa;
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #9bb3d8;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow-md);
}
.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.login-logo {
    width: auto;
    max-width: 220px;
    max-height: 72px;
    object-fit: contain;
}
.login-brand-meta {
    text-align: center;
    margin-bottom: 18px;
}
.login-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
}
.muted { color: var(--muted); margin: 0 0 20px; }
.form-group { margin-bottom: 16px; }
.filter-panel .form-group,
.form-grid-adaptive .form-group { margin-bottom: 0; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}
.form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 14px;
    line-height: 1.35;
}
.form-control:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-light,
.btn-outline {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}
.btn-danger {
    background: #fff;
    color: #b91c1c;
    border-color: #fecaca;
}
.btn-sm {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 13px;
}
.btn-block { width: 100%; }
.btn-compact { min-height: 40px; padding: 8px 14px; }
.field-validation, .validation-summary { display: none !important; }
.input-validation-error,
.searchable-select.is-invalid .searchable-select-input { border-color: var(--error-line) !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, .08); }
.demo-cred {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
    font-size: 14px;
    color: var(--muted);
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    transition: grid-template-columns .24s ease, gap .24s ease;
}
.admin-shell-light { background: var(--bg); }
.sidebar { min-width: 0; overflow: hidden; }
.sidebar-light {
    position: sticky;
    top: 8px;
    align-self: start;
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform .24s ease, opacity .2s ease, max-width .24s ease, padding .24s ease, border-color .24s ease;
    scrollbar-gutter: stable both-edges;
}
.brand-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.brand-logo {
    width: auto;
    max-width: 148px;
    max-height: 54px;
    object-fit: contain;
}
.brand-meta { min-width: 0; flex: 1 1 auto; }
.brand-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.brand-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}
.sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    cursor: pointer;
}
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-link-single,
.nav-section summary,
.nav-section-links a {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
}
.nav-link-single,
.nav-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 14px;
    font-weight: 700;
}
.nav-link-single:hover,
.nav-section summary:hover,
.nav-section-links a:hover {
    border-color: #b7cae8;
    background: #f8fbff;
}
.nav-link-single.active,
.nav-section-links a.active {
    border-color: #8ab4ff;
    background: var(--primary-soft);
    color: #1849a9;
}
.nav-section {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    overflow: hidden;
}
.nav-section[open] {
    border-color: #c5d8fb;
    box-shadow: inset 0 0 0 1px #e1ecff;
}
.nav-section summary {
    list-style: none;
    cursor: pointer;
    border: none;
    border-radius: 0;
    background: transparent;
}
.nav-section summary::-webkit-details-marker { display: none; }
.nav-section summary::after {
    content: "▾";
    font-size: 12px;
    color: var(--muted);
    transition: transform .2s ease;
}
.nav-section[open] summary::after { transform: rotate(180deg); }
.nav-section-links {
    display: grid;
    gap: 6px;
    padding: 0 10px 10px;
}
.nav-section-links a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    font-weight: 600;
}
.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 14px;
}
.topbar {
    position: sticky;
    top: 18px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
}
.topbar-leading {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.topbar-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}
.topbar-subtitle {
    margin-top: 3px;
    font-size: 13px;
    color: var(--muted);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.topbar-actions > * {
    flex: 0 0 auto;
}
.topbar-actions form {
    margin: 0;
}
.topbar-compact {
    padding-top: 11px;
    padding-bottom: 11px;
}
.topbar-leading-compact {
    gap: 10px;
}
.topbar-leading-compact .sidebar-toggle,
.topbar-leading-compact .sidebar-desktop-toggle {
    flex: 0 0 auto;
}
.sidebar-toggle {
    display: none;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}
.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 999px;
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, .34);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
    z-index: 1100;
}
body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    max-width: 240px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.page-body { padding: 0; }
.page-header { margin-bottom: 10px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.page-header h1 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.2;
}
.page-header p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.card,
.form-card,
.table-wrap,
.compact-card,
.simple-page {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
}
.card,
.form-card,
.simple-page { padding: 16px; }
.compact-card { padding: 14px 16px; margin-bottom: 14px; }
form.form-card.compact-card { padding: 16px; }
.table-wrap { overflow: auto; scrollbar-gutter: stable both-edges; }
.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    font-size: 14px;
}
.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.table th {
    background: #f8fbff;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table tbody tr:hover { background: #f8fbff; }
.form-grid,
.form-grid-3 {
    display: grid;
    gap: 14px;
}
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-span-2 { grid-column: span 2; }

.form-grid-employee { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-employee .form-span-full { grid-column: 1 / -1; }
.form-grid-employee .form-span-half { grid-column: span 1; }

.form-grid-adaptive {
    --field-min: 240px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--field-min)), 1fr));
    gap: 12px;
}
.form-grid-adaptive--compact { --field-min: 220px; }
.form-grid-adaptive--wide { --field-min: 280px; }
.field-span-full { grid-column: 1 / -1; }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.field-min-xs { --field-min: 180px; }
.field-min-sm { --field-min: 220px; }
.field-min-md { --field-min: 260px; }
.field-min-lg { --field-min: 320px; }
.form-shell-clean { padding-bottom: 12px; }
.form-section-stack {
    display: grid;
    gap: 14px;
}
.form-note-box {
    padding: 12px 14px;
    border: 1px dashed #c7d2fe;
    border-radius: 14px;
    background: #f8fbff;
    color: var(--text);
}
.compact-card-muted {
    padding: 14px 18px;
    background: #f8fbff;
}
.filter-card .page-actions,
form.form-card.compact-card .page-actions {
    margin-top: 12px;
}
.filter-card .form-grid-measured,
form.form-card.compact-card .form-grid-measured {
    align-items: end;
}
.table td .inline-actions {
    gap: 6px;
}
.table-export-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}
.table-export-toolbar .btn {
    min-height: 38px;
}
.table-export-toolbar + .table-wrap,
.table-export-toolbar + .table-card {
    margin-top: 0;
}
.pager-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.form-note { margin-top: 6px; color: var(--muted); font-size: 13px; }
.form-section {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.form-section-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 2px;
    font-size: 14px;
    font-weight: 600;
}
.inline-check input {
    margin: 0;
    width: 16px;
    height: 16px;
}
.field-stack {
    display: grid;
    gap: 6px;
}
.field-stack-tight {
    gap: 4px;
}
.muted-text { color: var(--muted); font-size: 13px; }
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding-top: 14px;
    margin-top: 18px;
    background: linear-gradient(180deg, rgba(246,248,252,0) 0%, rgba(246,248,252,0.88) 18%, rgba(246,248,252,1) 100%);
}
.page-actions,
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.page-actions { margin-bottom: 12px; }
.page-actions .btn,
.inline-actions .btn { width: auto; flex: 0 0 auto; }
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.checkbox-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}
.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.alert-success {
    background: var(--success-bg);
    border-color: var(--success-line);
    color: var(--success-text);
}
.alert-error {
    background: var(--error-bg);
    border-color: var(--error-line);
    color: var(--error-text);
}
.ui-toast-stack {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(92vw, 480px);
    pointer-events: none;
}
.ui-toast {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 52px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    background: #fff;
    color: var(--text);
    opacity: 0;
    transform: translateY(10px) scale(.98);
    transition: opacity .18s ease, transform .18s ease;
}
.ui-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.ui-toast-success {
    background: var(--success-bg);
    border-color: var(--success-line);
    color: var(--success-text);
}
.ui-toast-error {
    background: #fff7f7;
    border-color: var(--error-line);
    color: #b91c1c;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 12px;
    background: #fff;
}
.badge-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge-warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.notification-card { border-width: 1px; }
.notification-unread { border-color: #93c5fd; box-shadow: 0 14px 34px rgba(37, 99, 235, .08); }
.notification-read { opacity: .92; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stats-grid-compact { margin: 16px 0; }
.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); }
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}
.kpi-box {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
}
.kpi-box h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.kpi-box .value { font-size: 30px; font-weight: 800; }
.muted-text,
small.help { color: var(--muted); font-size: 13px; }
small.help { display: block; margin-top: 6px; }

.settings-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.branding-preview-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: #fbfdff;
}
.branding-preview-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.branding-preview-box {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: #fff;
    padding: 16px;
}
.branding-preview-box-sm { min-height: 88px; }
.branding-preview-logo {
    max-width: 260px;
    max-height: 74px;
    object-fit: contain;
}
.branding-preview-favicon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}


.form-shell-compact {
    padding: 16px 18px;
}

.form-grid-measured {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: start;
    grid-auto-flow: row dense;
}

.form-grid-measured > .form-group,
.form-grid-measured > .form-section {
    min-width: 0;
    width: 100%;
    justify-self: start;
}

.col-2 { grid-column: span 2; max-width: 220px; }
.col-3 { grid-column: span 3; max-width: 300px; }
.col-4 { grid-column: span 4; max-width: 400px; }
.col-5 { grid-column: span 5; max-width: 500px; }
.col-6 { grid-column: span 6; max-width: 620px; }
.col-7 { grid-column: span 7; max-width: 740px; }
.col-8 { grid-column: span 8; max-width: 860px; }
.col-9 { grid-column: span 9; max-width: 980px; }
.col-10 { grid-column: span 10; max-width: 1100px; }
.col-11 { grid-column: span 11; max-width: 1220px; }
.col-12 { grid-column: 1 / -1; max-width: 100%; }

.form-group.form-group-tight label {
    margin-bottom: 4px;
}

.form-group.form-group-tight .field-stack {
    padding-top: 2px;
}

.form-grid-measured .form-control,
.form-grid-measured .searchable-select,
.form-grid-measured .searchable-select-input {
    max-width: 100%;
}

.form-grid-measured .form-control:not(textarea),
.form-grid-measured .searchable-select {
    min-height: 44px;
}

.form-grid-measured textarea.form-control {
    min-height: 104px;
}

.form-grid-measured .inline-check {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
}

.form-grid-measured .muted-text {
    margin-top: 8px;
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.searchable-select-input {
    padding-right: 38px;
}

.searchable-select-arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 12px;
    pointer-events: none;
}

.searchable-select-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    display: none;
    overflow: auto;
    max-height: 240px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.searchable-select.open .searchable-select-panel {
    display: block;
}

.searchable-select-hint,
.searchable-select-empty {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
}

.searchable-select-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: #fff;
    text-align: left;
    color: var(--text);
    cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option:focus {
    background: #eef4ff;
    outline: none;
}

.searchable-select-option.is-active {
    background: #eaf2ff;
    color: #1849a9;
}


@media (max-width: 1399px) {
    .admin-shell {
        grid-template-columns: 300px minmax(0, 1fr);
        gap: 18px;
        padding: 18px;
    }
    .topbar-title {
        font-size: 20px;
    }
    .topbar-actions .btn,
    .topbar-actions .user-chip {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 14px;
    }
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .admin-shell {
        display: block;
        padding: 14px;
    }
    .sidebar {
        min-width: 0;
    }
    .sidebar-light {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 88vw);
        max-width: none;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 16px;
        border-radius: 0 20px 20px 0;
        z-index: 1200;
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(calc(-100% - 20px));
        transition: transform .24s ease;
    }
    body.sidebar-open .sidebar-light {
        transform: translateX(0);
    }
    .sidebar-close,
    .sidebar-toggle {
        display: inline-flex;
    }
    .main-content {
        width: 100%;
        min-width: 0;
    }
    .topbar {
        position: sticky;
        top: 14px;
        z-index: 1000;
        margin-bottom: 16px;
        padding: 12px 14px;
    }
    .topbar-actions {
        justify-content: flex-start;
        width: 100%;
    }
    .user-chip {
        max-width: min(240px, 58vw);
    }
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
        border-radius: 18px;
    }
    .topbar-leading {
        width: 100%;
        align-items: flex-start;
    }
    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
    .user-chip {
        max-width: min(260px, 64vw);
    }
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .kpi-strip,
    .card-grid {
        grid-template-columns: 1fr;
    }
    .table th { position: static; }
    .form-grid,
    .form-grid-3,
    .settings-preview-grid,
    .form-grid-adaptive {
        grid-template-columns: 1fr;
    }
    .form-span-2,
    .field-span-2,
    .field-span-3,
    .field-span-full { grid-column: span 1; }
}

@media (max-width: 767px) {
    .admin-shell {
        padding: 10px;
    }
    .sidebar-light {
        width: min(300px, 90vw);
        padding: 14px;
    }
    .brand-panel {
        gap: 10px;
        align-items: flex-start;
        padding-bottom: 14px;
        margin-bottom: 14px;
    }
    .brand-logo {
        max-width: 108px;
        max-height: 42px;
    }
    .brand-title {
        font-size: 14px;
    }
    .brand-subtitle,
    .topbar-subtitle {
        font-size: 12px;
    }
    .topbar-title,
    .page-header h1 {
        font-size: 21px;
    }
    .topbar-actions {
        gap: 8px;
    }
    .topbar-actions .btn,
    .topbar-actions .user-chip {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 14px;
    }
    .stat-card,
    .kpi-box {
        padding: 14px;
        border-radius: 16px;
    }
    .stat-value,
    .kpi-box .value {
        font-size: 24px;
    }
    .page-body {
        padding-bottom: 12px;
    }
    .card,
    .form-card,
    .simple-page,
    .compact-card {
        padding: 14px;
        border-radius: 18px;
    }
    .nav-link-single,
    .nav-section summary {
        min-height: 50px;
        padding: 0 14px;
    }
    .nav-section-links a {
        min-height: 46px;
        padding: 0 12px;
    }
}


@media (max-width: 480px) {
    .admin-shell {
        padding: 8px;
    }
    .topbar {
        padding: 12px 14px;
    }
    .topbar-title {
        font-size: 17px;
    }
    .topbar-actions .btn,
    .topbar-actions .user-chip {
        font-size: 13px;
    }
    .user-chip {
        max-width: min(180px, 100%);
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .card-grid {
        gap: 12px;
    }
}

@media print {
    body,
    html {
        background: #fff;
    }
    .admin-shell,
    .main-content,
    .page-body {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .sidebar,
    .topbar,
    .page-actions,
    .pager-wrap,
    .table-export-toolbar,
    .alert,
    .form-card.filter-card,
    .filter-panel {
        display: none !important;
    }
    .table-wrap,
    .table-card,
    .compact-card,
    .simple-page,
    .card {
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 0 12px !important;
        background: #fff !important;
    }
    .table {
        min-width: 0 !important;
        font-size: 12px !important;
    }
    .table th,
    .table td {
        padding: 8px 10px !important;
        color: #000 !important;
    }
    a,
    .btn {
        color: #000 !important;
        text-decoration: none !important;
    }
}

@media (max-width: 1200px) {
    .admin-shell { grid-template-columns: 280px minmax(0, 1fr); }
}

@media (max-width: 992px) {
    .form-grid,
    .form-grid-3,
    .form-grid-employee,
    .form-grid-adaptive { grid-template-columns: 1fr; }
    .form-span-2,
    .field-span-2,
    .field-span-3,
    .field-span-full,
    .form-grid-employee .form-span-full { grid-column: span 1; }
}

@media (max-width: 640px) {
    .page-header h1 { font-size: 22px; }
    .form-section { padding: 16px; }
    .page-actions { gap: 8px; }
    .btn, .btn-compact { min-height: 42px; }
}


@media (min-width: 1280px) {
    .field-span-lg-2 { grid-column: span 2; }
}


.sidebar-desktop-toggle {
    display: inline-flex;
    min-height: 40px;
}
.admin-shell.sidebar-desktop-collapsed,
body.sidebar-desktop-collapsed .admin-shell,
html.sidebar-desktop-collapsed .admin-shell {
    grid-template-columns: 0 minmax(0, 1fr);
    gap: 0;
    padding-left: 12px;
}
.admin-shell.sidebar-desktop-collapsed .sidebar,
body.sidebar-desktop-collapsed .sidebar,
html.sidebar-desktop-collapsed .sidebar {
    width: 0;
    max-width: 0;
    min-width: 0;
    overflow: hidden;
}
.admin-shell.sidebar-desktop-collapsed .sidebar-light,
body.sidebar-desktop-collapsed .sidebar-light,
html.sidebar-desktop-collapsed .sidebar-light {
    max-width: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    border-width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    box-shadow: none;
    transform: translateX(calc(-100% - 32px));
    pointer-events: none;
}
.admin-shell.sidebar-desktop-collapsed .main-content,
body.sidebar-desktop-collapsed .main-content,
html.sidebar-desktop-collapsed .main-content {
    min-width: 0;
}
.filter-panel {
    overflow: hidden;
}
.filter-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    cursor: pointer;
    list-style: none;
    font-weight: 800;
    color: var(--text);
}
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary::after {
    content: "▾";
    font-size: 12px;
    color: var(--muted);
    transition: transform .2s ease;
}
.filter-panel[open] > summary::after {
    transform: rotate(180deg);
}
.filter-panel-body {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}
.filter-summary-note {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    text-align: right;
}
.filter-actions {
    margin-top: 2px;
}
.scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
.document-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f4f8ff;
    border: 1px solid #dbe8ff;
    color: #2b4b8c;
    font-size: 12px;
    font-weight: 700;
}
.document-reference {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    word-break: break-word;
}
@media (max-width: 1200px) {
    .sidebar-desktop-toggle {
        display: none;
    }
}


@media (min-width: 1201px) {
    body.sidebar-desktop-collapsed .topbar,
    html.sidebar-desktop-collapsed .topbar {
        margin-left: 0;
    }
}

@media (max-width: 1200px) {
    .sidebar-light {
        scrollbar-gutter: stable;
    }
}


.sidebar-light::-webkit-scrollbar,
.page-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.sidebar-light::-webkit-scrollbar-track,
.page-body::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: #e7eef8;
    border-radius: 999px;
}

.sidebar-light::-webkit-scrollbar-thumb,
.page-body::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: #93acd4;
    border: 3px solid #e7eef8;
    border-radius: 999px;
}

.sidebar-light::-webkit-scrollbar-thumb:hover,
.page-body::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #6f8fca;
}


@media (max-width: 1400px) {
    .form-grid-measured {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
    .col-9,
    .col-10,
    .col-11,
    .col-12 { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
    .form-grid-measured {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    .col-7,
    .col-8,
    .col-9,
    .col-10,
    .col-11,
    .col-12 { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .form-grid-measured {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
    }
    .form-grid-measured .col-2,
    .form-grid-measured .col-3,
    .form-grid-measured .col-4,
    .form-grid-measured .col-5 {
        grid-column: span 1;
        max-width: 100%;
    }
    .form-grid-measured .col-6,
    .form-grid-measured .col-7,
    .form-grid-measured .col-8,
    .form-grid-measured .col-9,
    .form-grid-measured .col-10,
    .form-grid-measured .col-11,
    .form-grid-measured .col-12 {
        grid-column: span 2;
        max-width: 100%;
    }
}

@media (max-width: 560px) {
    .form-grid-measured {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .form-grid-measured [class*="col-"] {
        grid-column: span 1;
        max-width: 100%;
    }
}

.inline-form{display:inline-flex;align-items:center;gap:8px;margin:0;}



.page-header-inline-tight { margin-bottom: 12px; }
.attendance-filter-grid { align-items: end; }
.attendance-filter-grid--report { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.attendance-filter-keyword { grid-column: 1 / -1; }
.attendance-filter-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}
.attendance-filter-actions-inline > .btn { min-width: 132px; }
.sync-progress-card {
    margin: 14px 0 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
}
.sync-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.sync-progress-badge {
    min-width: 64px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(52, 102, 226, .08);
    color: var(--brand);
    font-weight: 800;
    text-align: center;
}
.sync-progress-bar {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(52, 102, 226, .12);
    overflow: hidden;
}
.sync-progress-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--brand);
    transition: width .2s ease;
}
.sync-progress-current {
    margin-top: 12px;
    color: var(--muted);
    font-weight: 600;
}
form[data-busy-lock].is-busy { opacity: .92; }
.btn.is-busy,
button.is-busy { cursor: not-allowed; }
@media (max-width: 991px) {
    .sync-progress-head { align-items: flex-start; flex-direction: column; }
    .sync-progress-badge { min-width: 0; }
}

.shift-picker-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}
.shift-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}
.shift-picker-actions {
    margin-bottom: 0;
    justify-content: flex-end;
}
.shift-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}
.shift-picker-item {
    min-height: 52px;
}
.shift-picker-item strong {
    font-size: 14px;
}
.shift-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.field-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 14px;
}
.validation-summary {
    margin-bottom: 12px;
}
.validation-summary ul {
    margin: 0;
    padding-left: 18px;
}
.page-header-inline {
    gap: 14px;
}
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
@media (max-width: 991px) {
    .shift-picker-toolbar {
        grid-template-columns: 1fr;
    }
    .shift-picker-actions {
        justify-content: flex-start;
    }
}
@media (max-width: 640px) {
    .shift-picker-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }
    .form-actions-sticky {
        position: static;
        background: transparent;
        padding-top: 12px;
    }
    .page-actions .btn,
    .inline-actions .btn,
    .page-toolbar .btn {
        width: 100%;
        justify-content: center;
    }
}

.page-header-soft {
    margin-bottom: 18px;
}
.page-header-soft p {
    max-width: 920px;
}
.attendance-schedule-list-page .table-wrap {
    border-radius: 22px;
    overflow: hidden;
}
.table-schedule-grouped td {
    padding-top: 16px;
    padding-bottom: 16px;
}
.scope-stack {
    display: grid;
    gap: 4px;
}
.scope-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.scope-subtitle,
.scope-target,
.weekday-text {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.schedule-chip-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.schedule-chip-card {
    display: grid;
    gap: 2px;
    min-height: 54px;
    padding: 10px 12px;
    border: 1px solid #dbe8ff;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}
.note-chip-list,
.shift-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.note-chip,
.selected-shift-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dbe8ff;
    background: #f7fbff;
    color: #2b4b8c;
    font-size: 12px;
    font-weight: 700;
}
.action-stack-tight {
    gap: 6px;
}
.action-stack-tight .btn {
    min-height: 34px;
}
.shift-picker-footer {
    align-items: flex-start;
    flex-direction: column;
}
.form-card .text-danger {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
}
.validation-summary {
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 14px;
    background: #fff7f7;
    color: #b91c1c;
}
@media (max-width: 991px) {
    .table-schedule-grouped td {
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .schedule-chip-list {
        grid-template-columns: 1fr;
    }
    .note-chip-list,
    .shift-selected-list {
        gap: 6px;
    }
}

.employee-photo-panel {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--line, #dbe4f0);
    border-radius: 1rem;
    background: rgba(255,255,255,.55);
}

.employee-photo-preview-box {
    width: 180px;
    height: 180px;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px dashed #c8d5e6;
    background: #f8fbff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.employee-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.employee-photo-placeholder {
    color: #7a8ba3;
    font-size: .95rem;
    text-align: center;
    padding: 1rem;
}

.employee-photo-upload-fields {
    display: grid;
    gap: .5rem;
    align-content: start;
}

.employee-photo-current-name {
    color: #526581;
    font-size: .92rem;
}

.employee-photo-remove-check {
    margin-top: .125rem;
}

@media (max-width: 768px) {
    .employee-photo-panel {
        grid-template-columns: 1fr;
    }

    .employee-photo-preview-box {
        width: 140px;
        height: 140px;
    }
}
