: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: 0 18px 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 - 26px);
    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: 0;
    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: fixed;
    z-index: 1000;
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: min(320px, 46dvh);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.searchable-select-panel.is-open {
    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: 0;
        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: 24px;
    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-bar > strong {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    pointer-events: none;
}
.sync-progress-bar.is-indeterminate > span {
    width: 35% !important;
    animation: attendance-sync-progress-indeterminate 1.1s ease-in-out infinite;
}
@keyframes attendance-sync-progress-indeterminate {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(320%); }
}
.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;
    }
}


.attendance-realtime-board {
    display: grid;
    gap: 14px;
}

.attendance-realtime-board__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.attendance-realtime-board__header h3 {
    margin: 0 0 6px;
}

.attendance-realtime-board__status {
    min-width: 220px;
    text-align: right;
}

.realtime-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.realtime-kpi-grid--employee {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.attendance-realtime-board__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    color: #475569;
    font-size: 13px;
}

.realtime-feed-table td .muted-text {
    margin-top: 4px;
}

.login-card-wide {
    max-width: 560px;
}

.otp-login-helper {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
}

.auth-action-stack {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.auth-tabs {
    margin-top: 6px;
}

.auth-tab-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.auth-tab-button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}

.auth-tab-button.is-active {
    border-color: #93c5fd;
    background: var(--primary-soft);
    color: var(--primary);
}

.auth-tab-pane {
    display: none;
}

.auth-tab-pane.is-active {
    display: block;
}

.auth-tab-hint {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
}

.auth-summary {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--error-line);
    background: var(--error-bg);
    color: var(--error-text);
    display: grid;
    gap: 4px;
}

.auth-inline-info {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
}

.auth-field-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--error-text);
}

.page-actions-center {
    justify-content: center;
}

@media (max-width: 767px) {
    .attendance-realtime-board__header {
        flex-direction: column;
    }

    .attendance-realtime-board__status {
        min-width: 0;
        text-align: left;
    }
}

.otp-login-actions {
    margin-top: 12px;
}


.realtime-kpi-card {
    width: 100%;
    border: 1px solid #d6e0ef;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.realtime-kpi-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.realtime-kpi-card.is-active {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
}

.attendance-realtime-board__detail-header h4 {
    margin: 0;
    font-size: 18px;
}


.auth-card-compact {
    padding: 24px 24px 22px;
}

.auth-brand-meta-tight {
    margin-bottom: 14px;
}

.auth-subtitle {
    margin-bottom: 0;
}

.auth-form-stack {
    display: grid;
    gap: 14px;
}


.employee-portal-dashboard .page-header h1,
.attendance-module-portal .page-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.employee-portal-dashboard .page-header p,
.attendance-module-portal .page-header p {
    font-size: 13px;
}

.portal-summary-grid .portal-summary-card,
.employee-portal-dashboard .compact-card,
.employee-portal-dashboard .attendance-realtime-board,
.attendance-module-portal .attendance-realtime-board,
.attendance-module-portal .stat-card,
.attendance-module-portal .form-card {
    border-radius: 18px;
}

.portal-summary-card h3,
.employee-portal-dashboard .attendance-realtime-board__header h3,
.attendance-module-portal .attendance-realtime-board__header h3,
.attendance-module-portal .card h3,
.attendance-module-portal .stat-label,
.employee-portal-dashboard .stat-label {
    font-size: 14px;
    font-weight: 500;
}

.portal-summary-card .summary-value,
.employee-portal-dashboard .stat-value,
.attendance-module-portal .stat-value {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 0;
}

.portal-summary-card .summary-note,
.employee-portal-dashboard .muted-text,
.attendance-module-portal .muted-text,
.attendance-module-portal .muted-text,
.attendance-module-portal .attendance-realtime-board__meta,
.employee-portal-dashboard .attendance-realtime-board__meta {
    font-size: 12px;
}

.employee-portal-dashboard .attendance-realtime-board__meta strong,
.attendance-module-portal .attendance-realtime-board__meta strong,
.attendance-module-portal .table td strong {
    font-weight: 600;
}

.employee-portal-dashboard .portal-summary-grid,
.attendance-module-portal .stats-grid-compact {
    gap: 12px;
}

.attendance-module-portal .quick-range-bar {
    gap: 8px;
}

.attendance-module-portal .quick-range-link {
    font-size: 13px;
    font-weight: 500;
}

.attendance-module-portal .table,
.attendance-module-portal .table th,
.attendance-module-portal .table td {
    font-size: 13px;
}

.auth-form-grid {
    display: grid;
    gap: 14px;
}

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

.auth-link-grid {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

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

.auth-pane-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.auth-form-divider {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.auth-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.auth-meta-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
    display: grid;
    gap: 4px;
}

.auth-meta-item-full {
    grid-column: 1 / -1;
}

.auth-meta-label {
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 767px) {
    .auth-form-grid-2,
    .auth-link-grid-2,
    .auth-meta-grid {
        grid-template-columns: 1fr;
    }

    .auth-card-compact {
        padding: 22px 18px 18px;
    }
}

/* Work request + site-wide responsive tightening */
.table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
    overflow: auto;
    margin-bottom: 14px;
}
.table-card > h2,
.table-wrap > h2 {
    margin: 0;
    padding: 16px 18px 0;
    font-size: 20px;
}
.form-control-static {
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f8fbff;
    display: flex;
    align-items: center;
    overflow-wrap: anywhere;
}
.preserve-line { white-space: pre-wrap; }
.mt-2 { margin-top: 12px; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.action-stack { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-control-inline { width: min(220px, 100%); min-height: 36px; padding: 7px 10px; }
.work-tabs { align-items: stretch; }
.work-row-overdue { background: #fff7f7; }
.work-status-card { border-left: 5px solid #bfdbfe; }
.work-status-card-danger { border-left-color: #fecaca; background: #fffafa; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.form-group-actions-bottom { align-self: end; }

@media (min-width: 1600px) {
    .admin-shell { grid-template-columns: 280px minmax(0, 1fr); max-width: 1920px; margin: 0 auto; width: 100%; }
    .page-header h1 { font-size: clamp(26px, 1.7vw, 34px); }
    .form-grid-adaptive { --field-min: 260px; }
    .form-grid-measured { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (max-width: 1366px) {
    .admin-shell { grid-template-columns: 260px minmax(0, 1fr); gap: 12px; padding: 12px; }
    .sidebar-light { padding: 12px; border-radius: 20px; }
    .nav-link-single, .nav-section summary { min-height: 44px; padding: 0 12px; font-size: 14px; }
    .page-header h1 { font-size: 24px; }
    .form-card, .card, .simple-page, .compact-card { padding: 14px; }
    .table th, .table td { padding: 10px 12px; }
}

@media (max-width: 1024px) {
    .topbar { align-items: stretch; }
    .topbar-actions { overflow-x: auto; padding-bottom: 2px; }
    .form-grid-measured { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11 { grid-column: span 3; max-width: 100%; }
    .col-12 { grid-column: 1 / -1; }
    .field-span-2, .field-span-3 { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    html, body { font-size: 14px; }
    .admin-shell { padding: 8px; }
    .topbar { gap: 10px; margin-bottom: 10px; }
    .topbar-actions .btn, .topbar-actions .user-chip { flex: 1 1 auto; min-width: max-content; }
    .page-actions { align-items: stretch; }
    .page-actions .btn, .page-actions form, .page-actions form .btn { width: 100%; }
    .inline-form { width: 100%; }
    .inline-form .form-control-inline { width: 100%; }
    .form-grid-measured { grid-template-columns: 1fr; }
    .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { grid-column: 1 / -1; max-width: 100%; }
    .form-control, .form-control-static { min-height: 42px; }
    textarea.form-control { min-height: 110px; }
    .table { min-width: 0; }
    .responsive-card-list.table-wrap,
    .responsive-card-list.table-card,
    .responsive-card-list { overflow: visible; }
    .responsive-card-list table,
    .responsive-card-list thead,
    .responsive-card-list tbody,
    .responsive-card-list th,
    .responsive-card-list td,
    .responsive-card-list tr { display: block; width: 100%; }
    .responsive-card-list thead { display: none; }
    .responsive-card-list tr { border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin: 10px; background: #fff; box-shadow: var(--shadow-sm); }
    .responsive-card-list td { border-bottom: 0; padding: 7px 4px; display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 8px; align-items: start; }
    .responsive-card-list td::before { content: attr(data-label); color: var(--muted); font-weight: 700; }
    .responsive-card-list td.text-right { text-align: left; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
    .admin-shell { padding: 6px; }
    .card, .form-card, .simple-page, .compact-card, .table-card { border-radius: 16px; }
    .page-header h1 { font-size: 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .responsive-card-list td { grid-template-columns: 1fr; gap: 2px; }
    .responsive-card-list td::before { font-size: 12px; }
    .btn { white-space: normal; }
}
.logout-inline-form {
    display: inline-flex;
    margin: 0;
}

.ui-confirm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .35);
}
.ui-confirm-backdrop.is-visible {
    display: flex;
}
.ui-confirm-card {
    width: min(94vw, 460px);
    border-radius: 20px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
    padding: 22px;
}
.ui-confirm-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}
.ui-confirm-message {
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 18px;
}
.ui-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.ui-confirm-actions .btn {
    min-width: 116px;
}


/* Attendance device sync - UI responsive layout */
.attendance-sync-page-head {
    align-items: center;
    gap: 14px;
}
.attendance-sync-page-head h1 {
    margin: 0;
}
.attendance-sync-toolbar {
    justify-content: flex-end;
}
.attendance-sync-form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 14px;
    align-items: flex-end;
}
.attendance-sync-form-grid > .form-group {
    margin: 0;
    min-width: 0;
}
.attendance-sync-device-field {
    flex: 0 1 340px;
    width: min(100%, 340px);
}
.attendance-sync-date-field {
    flex: 0 0 180px;
    width: 180px;
}
.attendance-sync-mode-field {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
}
.attendance-sync-mode-control {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}
.attendance-sync-mode-control:hover {
    border-color: #b8c9e8;
    background: #f8fbff;
}
.attendance-sync-mode-control input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
}
.attendance-sync-mode-control span {
    min-width: 0;
    line-height: 1.35;
    white-space: nowrap;
}
.attendance-sync-actions {
    flex: 0 0 auto;
}
.attendance-sync-actions .btn {
    min-width: 132px;
    min-height: 44px;
    white-space: nowrap;
}
.attendance-sync-table-card {
    min-width: 0;
}
.attendance-sync-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: stable;
    overscroll-behavior-inline: contain;
}
.attendance-sync-table {
    min-width: 820px;
}
.attendance-sync-table th:nth-child(1),
.attendance-sync-table td:nth-child(1) { width: 82px; }
.attendance-sync-table th:nth-child(2),
.attendance-sync-table td:nth-child(2),
.attendance-sync-table th:nth-child(3),
.attendance-sync-table td:nth-child(3),
.attendance-sync-table th:nth-child(4),
.attendance-sync-table td:nth-child(4),
.attendance-sync-table th:nth-child(5),
.attendance-sync-table td:nth-child(5) { width: 76px; }
.attendance-sync-table th:nth-child(6),
.attendance-sync-table td:nth-child(6) { width: 176px; }
.attendance-sync-message {
    min-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.attendance-sync-empty {
    color: var(--muted);
    text-align: center !important;
    padding: 20px !important;
}
.sync-progress-heading {
    min-width: 0;
}

@media (max-width: 980px) {
    .attendance-sync-device-field {
        flex-basis: 300px;
        width: min(100%, 300px);
    }
    .attendance-sync-mode-control span {
        white-space: normal;
    }
}

@media (max-width: 700px) {
    .attendance-sync-page-head {
        align-items: stretch;
    }
    .attendance-sync-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .attendance-sync-toolbar .btn {
        width: 100%;
    }
    .attendance-sync-form-grid {
        gap: 10px;
    }
    .attendance-sync-device-field,
    .attendance-sync-date-field,
    .attendance-sync-mode-field,
    .attendance-sync-actions {
        flex: 1 1 100%;
        width: 100%;
    }
    .attendance-sync-mode-control,
    .attendance-sync-actions .btn {
        width: 100%;
    }
    .sync-progress-card {
        padding: 14px;
        border-radius: 16px;
    }
    .sync-progress-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }
    .sync-progress-badge {
        padding: 6px 10px;
        font-size: 13px;
    }
    .sync-progress-current {
        font-size: 13px;
        line-height: 1.5;
    }
    .attendance-sync-table-wrap {
        overflow: visible;
    }
    .attendance-sync-table {
        display: block;
        min-width: 0;
        width: 100%;
    }
    .attendance-sync-table thead {
        display: none;
    }
    .attendance-sync-table tbody {
        display: grid;
        gap: 10px;
    }
    .attendance-sync-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #fff;
    }
    .attendance-sync-table tbody tr:hover {
        background: #fff;
    }
    .attendance-sync-table tbody td {
        display: grid;
        grid-template-columns: minmax(82px, .8fr) minmax(0, 1.2fr);
        gap: 8px;
        align-items: start;
        padding: 7px 6px;
        border: 0;
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .attendance-sync-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }
    .attendance-sync-table tbody td.attendance-sync-message,
    .attendance-sync-table tbody td:nth-child(6) {
        grid-column: 1 / -1;
        min-width: 0;
    }
    .attendance-sync-table tbody td.attendance-sync-empty {
        display: block;
        grid-column: 1 / -1;
        text-align: center !important;
    }
    .attendance-sync-table tbody td.attendance-sync-empty::before {
        content: none;
    }
}

@media (max-width: 420px) {
    .attendance-sync-table tbody tr {
        grid-template-columns: 1fr;
    }
    .attendance-sync-table tbody td,
    .attendance-sync-table tbody td:nth-child(6),
    .attendance-sync-table tbody td.attendance-sync-message {
        grid-column: 1;
    }
}

/* Thanh cuộn ngang dùng chung: dùng scrollbar native để luôn kéo được ổn định. */
.global-horizontal-scroll{
    position:fixed;
    right:auto;
    bottom:8px;
    z-index:1980;
    display:block;
    height:18px;
    overflow-x:auto;
    overflow-y:hidden;
    border:1px solid rgba(148,163,184,.32);
    border-radius:10px;
    background:rgba(255,255,255,.98);
    box-shadow:0 5px 16px rgba(15,23,42,.12);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transform:translateY(3px);
    transition:opacity .14s ease,transform .14s ease,visibility .14s ease;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    scrollbar-gutter:stable;
}
.global-horizontal-scroll.is-visible{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    transform:translateY(0);
}
.global-horizontal-scroll:focus-visible{
    outline:2px solid rgba(37,99,235,.28);
    outline-offset:2px;
}
.global-horizontal-scroll-spacer{
    height:1px;
    min-width:1px;
    pointer-events:none;
}
.global-horizontal-scroll::-webkit-scrollbar{height:12px}
.global-horizontal-scroll::-webkit-scrollbar-track{background:#eef3fa;border-radius:999px}
.global-horizontal-scroll::-webkit-scrollbar-thumb{background:#8fa3bb;border-radius:999px;border:2px solid #eef3fa}
.global-horizontal-scroll::-webkit-scrollbar-thumb:hover{background:#7289a4}
body.actual-shift-modal-open .global-horizontal-scroll{display:none!important}

@media print{
    .global-horizontal-scroll{display:none!important}
}

.work-office-source-card { border-color: #bfdbfe; }
.work-office-source-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.work-office-source-head h2 { margin:0; }
@media (max-width:720px) { .work-office-source-head { display:grid; grid-template-columns:1fr; } .work-office-source-head .btn { width:100%; justify-content:center; } }
