:root {
    color-scheme: light;
    --sk-navy: #0B2442;
    --sk-blue: #2563EB;
    --sk-teal: #14B8A6;
    --sk-deep-teal: #0F766E;
    --sk-cloud: #F7F9FC;
    --sk-text: #0F172A;
    --sk-muted: #64748B;
    --sk-border: #E2E8F0;
    --sk-success: #16A34A;
    --sk-warning: #D97706;
    --sk-danger: #DC2626;
    --sk-gradient: linear-gradient(135deg, #2563EB 0%, #14B8A6 100%);
    --sk-font-heading: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, sans-serif;
    --sk-font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg: #F7F9FC;
    --surface: #ffffff;
    --surface-soft: #F8FAFC;
    --surface-blue: #EFF6FF;
    --text: #0F172A;
    --muted: #64748B;
    --line: #e2e8f0;
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-soft: #EFF6FF;
    --success: #16A34A;
    --success-bg: #F0FDF4;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, .05);
    --shadow-md: 0 18px 55px rgba(15, 23, 42, .09);
    --topbar-height: 64px;
    --sidebar-width: 276px;
    --bottom-nav-height: 70px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(23, 71, 199, .08), transparent 28rem),
        var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

body.sidebar-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

img,
svg {
    display: block;
}

[hidden] {
    display: none !important;
}

.ui-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.skip-link {
    position: fixed;
    left: 12px;
    top: -60px;
    z-index: 1000;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.skip-link:focus {
    top: 10px;
}

.offline-banner {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 8px 16px;
    color: #7a2e0e;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    font-size: .8rem;
    font-weight: 750;
}

.offline-banner:not([hidden]) ~ .topbar {
    top: 42px;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding:
        8px max(14px, env(safe-area-inset-right))
        8px max(14px, env(safe-area-inset-left));
    background: #ffffff;
    border-bottom: 1px solid rgba(226, 232, 240, .95);
    backdrop-filter: none;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left,
.topbar-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #2563EB, #0B2442);
    box-shadow: 0 9px 22px rgba(23, 71, 199, .24);
    font-size: .93rem;
    font-weight: 900;
}

.brand-copy {
    min-width: 0;
    display: grid;
    line-height: 1.12;
}

.brand-copy strong,
.brand-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-copy strong {
    max-width: 145px;
    font-size: .92rem;
    font-weight: 850;
}

.brand-copy small {
    max-width: 145px;
    margin-top: 3px;
    color: var(--muted);
    font-size: .68rem;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
}

.icon-button:focus-visible,
.button:focus-visible,
.nav-item:focus-visible,
.mobile-bottom-nav a:focus-visible,
.company-switcher:focus-visible {
    outline: 3px solid rgba(23, 71, 199, .22);
    outline-offset: 2px;
}

.topbar-user {
    display: none;
}

.logout-form {
    margin: 0;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 0 16px;
    font-size: .88rem;
    font-weight: 820;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 9px 20px rgba(23, 71, 199, .16);
}

.button-primary:hover {
    background: var(--primary-hover);
}

.button-secondary {
    color: #0B2442;
    background: var(--primary-soft);
}

.button-ghost {
    color: var(--text);
    border: 1px solid var(--line);
    background: var(--surface);
}

.button-small {
    min-height: 38px;
    padding: 0 12px;
    font-size: .78rem;
}

.button-install {
    display: none;
    color: var(--primary);
    border: 1px solid #cddaff;
    background: var(--surface-blue);
}

.logout-button {
    width: 42px;
    padding: 0;
}

.logout-button span {
    display: none;
}

.app-shell {
    min-height: calc(100vh - var(--topbar-height));
    min-height: calc(100dvh - var(--topbar-height));
}

.sidebar {
    width: min(86vw, 320px);
    position: fixed;
    inset:
        var(--topbar-height) auto 0 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding:
        16px 14px
        calc(22px + env(safe-area-inset-bottom))
        max(14px, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
    border-right: 1px solid var(--line);
    box-shadow: 18px 0 54px rgba(15, 23, 42, .18);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s;
}

.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-head > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.sidebar-head strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-kicker,
.nav-section-label {
    color: #8490a3;
    font-size: .69rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sidebar-close {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
}

.company-switcher {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbe5fa;
    border-radius: 15px;
    color: var(--text);
    background: var(--surface-blue);
    text-decoration: none;
}

.company-switcher-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: #fff;
}

.company-switcher span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.company-switcher small {
    color: var(--muted);
    font-size: .7rem;
}

.company-switcher strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .86rem;
}

.company-switcher-arrow {
    color: var(--muted);
}

.sidebar-nav {
    display: grid;
    gap: 21px;
}

.nav-section {
    display: grid;
    gap: 6px;
}

.nav-section-label {
    padding: 0 10px 3px;
}

.nav-item {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 10px;
    border-radius: 13px;
    color: #344054;
    font-size: .9rem;
    font-weight: 760;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.nav-item:hover {
    color: var(--primary);
    background: var(--surface-soft);
}

.nav-item.is-active {
    color: #0B2442;
    background: var(--primary-soft);
}

.nav-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #52627a;
    background: #f3f6fa;
}

.nav-item.is-active .nav-icon {
    color: var(--primary);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.nav-icon .ui-icon {
    width: 18px;
    height: 18px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    grid-template-columns: 9px 1fr;
    align-items: center;
    gap: 10px;
    padding: 13px;
    border-radius: 14px;
    color: #344054;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 99px;
    background: #16A34A;
    box-shadow: 0 0 0 4px rgba(18, 183, 106, .12);
}

.sidebar-footer span:last-child {
    display: grid;
    gap: 2px;
}

.sidebar-footer strong {
    font-size: .78rem;
}

.sidebar-footer small {
    color: var(--muted);
    font-size: .68rem;
}

.sidebar-backdrop {
    position: fixed;
    inset: var(--topbar-height) 0 0;
    z-index: 40;
    display: none;
    border: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
}

.sidebar-open .sidebar-backdrop {
    display: block;
}

.page {
    min-width: 0;
}

.app-page,
.guest-page {
    width: 100%;
    margin: 0 auto;
}

.app-page {
    padding:
        22px 16px
        calc(var(--bottom-nav-height) + 28px + env(safe-area-inset-bottom));
}

.guest-page {
    max-width: 1180px;
    padding: 28px 16px;
}

.auth-shell {
    min-height: calc(100vh - var(--topbar-height) - 56px);
    min-height: calc(100dvh - var(--topbar-height) - 56px);
    display: grid;
    place-items: center;
}

.auth-card,
.content-card {
    background: var(--surface);
    border: 1px solid rgba(226, 232, 240, .96);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.auth-card,
.content-card {
    padding: 20px;
}

.auth-card {
    width: min(100%, 520px);
}

.content-card {
    width: 100%;
}

.narrow {
    max-width: 720px;
    margin: 0 auto;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 9px;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 880;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0 0 10px;
    line-height: 1.13;
    text-wrap: balance;
}

h1 {
    font-size: clamp(1.85rem, 9vw, 2.55rem);
    letter-spacing: -.045em;
}

h2 {
    font-size: clamp(1.3rem, 6vw, 1.8rem);
    letter-spacing: -.03em;
}

p {
    margin-top: 0;
}

.muted {
    color: var(--muted);
    line-height: 1.65;
}

.page-header {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header .muted {
    margin-bottom: 0;
}

.page-primary-action {
    width: 100%;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.section-heading.compact h2 {
    margin-bottom: 0;
}

.form-stack {
    display: grid;
    gap: 17px;
    margin-top: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 17px;
}

label {
    min-width: 0;
    display: grid;
    gap: 8px;
    color: #1f2937;
    font-size: .88rem;
    font-weight: 750;
}

label small {
    color: var(--muted);
    font-weight: 550;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid #d7dfeb;
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text);
    background: var(--surface-soft);
    font-size: 16px;
}

textarea {
    min-height: 112px;
    padding-top: 12px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(23, 71, 199, .14);
    border-color: var(--primary);
    background: #fff;
}

.text-link {
    color: var(--primary);
    font-size: .84rem;
    font-weight: 800;
    text-decoration: none;
}

.alert {
    margin: 0 0 18px;
    border-radius: 13px;
    padding: 13px 15px;
    line-height: 1.5;
}

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid #fecdca;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #abefc6;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    min-height: 112px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 17px;
    border-radius: 17px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: var(--primary-soft);
}

.stat-card > div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.stat-label {
    overflow: hidden;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-card strong {
    font-size: 1.8rem;
    letter-spacing: -.04em;
}

.quick-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.quick-card {
    min-height: 76px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    text-decoration: none;
}

.quick-card:hover {
    border-color: #b7c9f6;
    background: var(--surface-blue);
}

.quick-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.quick-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.quick-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-arrow {
    color: #98a2b3;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

.form-panel {
    position: static;
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 18px;
}

.search-bar .button {
    width: 100%;
}

.table-wrap {
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
}

.data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.data-table tbody,
.data-table tr,
.data-table td {
    display: block;
    width: 100%;
}

.data-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.data-table td {
    min-height: 48px;
    display: grid;
    grid-template-columns: minmax(88px, .45fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf1f7;
    text-align: left;
}

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

.data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .69rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.data-table td strong,
.data-table td span,
.data-table td small {
    min-width: 0;
}

.data-table td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.4;
}

td.table-actions {
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

td.table-actions::before {
    width: 100%;
}

td.table-actions form {
    flex: 1;
    margin: 0;
}

td.table-actions .button {
    width: 100%;
}

.badge {
    width: fit-content;
    display: inline-flex !important;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .73rem;
    font-weight: 820;
}

.badge-success {
    color: var(--success);
    background: var(--success-bg);
}

.badge-muted {
    color: #475467;
    background: #f2f4f7;
}

.empty-state {
    min-height: 200px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 28px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 15px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
    font-size: 1.05rem;
}

.empty-state .button {
    margin-top: 8px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 18px;
}

.pagination a {
    min-width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}

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

.form-card {
    max-width: 980px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column-reverse;
    gap: 9px;
    padding-top: 6px;
}

.form-actions .button {
    width: 100%;
}

.company-grid {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.company-choice {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 14px;
    background: var(--surface-soft);
    cursor: pointer;
}

.company-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: var(--primary);
    font-size: .75rem;
    font-weight: 900;
}

.mobile-bottom-nav {
    min-height: var(--bottom-nav-height);
    position: fixed;
    inset: auto 0 0;
    z-index: 38;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding:
        6px max(4px, env(safe-area-inset-right))
        calc(6px + env(safe-area-inset-bottom))
        max(4px, env(safe-area-inset-left));
    background: #ffffff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, .08);
    backdrop-filter: none;
}

.mobile-bottom-nav a {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-radius: 11px;
    color: #64748B;
    font-size: .61rem;
    font-weight: 750;
    text-decoration: none;
}

.mobile-bottom-nav a .ui-icon {
    width: 20px;
    height: 20px;
}

.mobile-bottom-nav a span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-bottom-nav a.is-active {
    color: var(--primary);
    background: var(--primary-soft);
}

.app-toast {
    position: fixed;
    z-index: 120;
    left: 50%;
    bottom: calc(var(--bottom-nav-height) + 18px + env(safe-area-inset-bottom));
    width: min(calc(100% - 32px), 420px);
    transform: translateX(-50%);
    border-radius: 13px;
    padding: 13px 15px;
    color: #fff;
    background: #0F172A;
    box-shadow: var(--shadow-md);
    font-size: .84rem;
    font-weight: 700;
    text-align: center;
}

/* Tablet */
@media (min-width: 640px) {
    .topbar {
        padding-inline: 22px;
    }

    .brand-copy strong,
    .brand-copy small {
        max-width: 210px;
    }

    .topbar-user {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 9px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        display: grid;
        place-items: center;
        border-radius: 11px;
        color: #fff;
        background: #344054;
        font-size: .82rem;
        font-weight: 850;
    }

    .topbar-user-copy {
        min-width: 0;
        display: grid;
        gap: 2px;
    }

    .topbar-user-copy strong,
    .topbar-user-copy small {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-user-copy strong {
        font-size: .8rem;
    }

    .topbar-user-copy small {
        color: var(--muted);
        font-size: .67rem;
    }

    .logout-button {
        width: auto;
        padding-inline: 14px;
    }

    .logout-button span {
        display: inline;
    }

    .app-page {
        padding-inline: 24px;
    }

    .guest-page {
        padding: 42px 24px;
    }

    .auth-card,
    .content-card {
        padding: 26px;
    }

    .page-header {
        align-items: flex-end;
        justify-content: space-between;
        flex-direction: row;
        gap: 24px;
    }

    .page-primary-action,
    .page-header > .button {
        width: auto;
    }

    .section-heading {
        flex-direction: row;
        justify-content: space-between;
        gap: 20px;
    }

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

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

    .search-bar {
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
    }

    .search-bar .button {
        width: auto;
    }

    .form-actions {
        align-items: center;
        justify-content: flex-end;
        flex-direction: row;
    }

    .form-actions .button {
        width: auto;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .topbar {
        height: 72px;
        padding-inline: 28px;
    }

    :root {
        --topbar-height: 72px;
    }

    body.sidebar-open {
        overflow: auto;
    }

    .sidebar-toggle,
    .sidebar-close {
        display: none;
    }

    .button-install:not([hidden]) {
        display: inline-flex;
    }

    .app-shell {
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .sidebar {
        width: auto;
        min-height: calc(100vh - var(--topbar-height));
        min-height: calc(100dvh - var(--topbar-height));
        position: sticky;
        inset: auto;
        top: var(--topbar-height);
        align-self: start;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 22px 16px 24px;
    }

    .sidebar-head {
        display: none;
    }

    .sidebar-backdrop,
    .sidebar-open .sidebar-backdrop {
        display: none;
    }

    .app-page {
        max-width: 1380px;
        padding: 32px 32px 54px;
    }

    .mobile-bottom-nav {
        display: none;
    }

    .app-toast {
        bottom: 28px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 15px;
    }

    .stat-card {
        min-height: 126px;
        padding: 20px;
    }

    .stat-card strong {
        font-size: 2.15rem;
    }

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

    .quick-card {
        min-height: 132px;
        grid-template-columns: 44px minmax(0, 1fr);
        align-content: center;
    }

    .quick-arrow {
        display: none;
    }

    .quick-copy small {
        white-space: normal;
        line-height: 1.45;
    }

    .split-layout {
        grid-template-columns: minmax(300px, .7fr) minmax(540px, 1.5fr);
        gap: 20px;
    }

    .form-panel {
        position: sticky;
        top: 96px;
    }

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

    .table-wrap {
        overflow-x: auto;
        border: 1px solid var(--line);
        border-radius: 14px;
    }

    .data-table {
        min-width: 680px;
        border-collapse: collapse;
        border-spacing: 0;
        background: var(--surface);
    }

    .data-table thead {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
        clip-path: none;
        white-space: normal;
    }

    .data-table tbody {
        display: table-row-group;
    }

    .data-table tr {
        display: table-row;
        width: auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .data-table td {
        width: auto;
        min-height: 0;
        display: table-cell;
        padding: 15px 16px;
        border-bottom: 1px solid #edf1f7;
        vertical-align: middle;
    }

    .data-table td::before {
        display: none;
    }

    .data-table th {
        padding: 13px 16px;
        color: var(--muted);
        background: var(--surface-soft);
        border-bottom: 1px solid var(--line);
        font-size: .7rem;
        font-weight: 850;
        letter-spacing: .07em;
        text-align: left;
        text-transform: uppercase;
    }

    td.table-actions {
        width: 1%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    td.table-actions form {
        flex: initial;
    }

    td.table-actions .button {
        width: auto;
    }
}

/* Large desktop */
@media (min-width: 1280px) {
    .topbar {
        padding-inline: 34px;
    }

    .app-page {
        padding-inline: 40px;
    }

    .stat-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* ------------------------------------------------------------------
   Phase 2B — Attendance, QR kiosk, geofencing
   ------------------------------------------------------------------ */

.page-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.page-actions .button {
    width: 100%;
}

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

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 22px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.filter-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 9px;
}

.filter-actions .button {
    width: 100%;
}

.empty-icon {
    width: 34px;
    height: 34px;
    color: var(--primary);
}

.location-helper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 13px;
    padding: 12px 13px;
    color: #344054;
    background: var(--surface-blue);
    font-size: .78rem;
    line-height: 1.55;
}

.location-helper .ui-icon {
    margin-top: 1px;
    color: var(--primary);
}

.location-list {
    display: grid;
    gap: 12px;
}

.location-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.location-card-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.location-card-copy {
    min-width: 0;
}

.location-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.location-card-head > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.location-card-head strong,
.location-card-head small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-card-head small {
    color: var(--muted);
}

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

.location-meta > div:last-child {
    grid-column: 1 / -1;
}

.location-meta dt {
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.location-meta dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    font-size: .78rem;
    font-weight: 730;
}

.location-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.location-actions form {
    margin: 0;
}

.qr-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.employee-qr-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.qr-canvas-wrap {
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at top left, rgba(23, 71, 199, .09), transparent 14rem),
        var(--surface-soft);
}

.qr-canvas-wrap canvas {
    width: min(100%, 260px);
    height: auto;
    padding: 8px;
    border-radius: 13px;
    background: #fff;
}

.qr-employee-copy {
    display: grid;
    gap: 4px;
    padding: 16px 16px 10px;
    text-align: center;
}

.qr-employee-copy strong {
    font-size: 1rem;
}

.qr-employee-copy span {
    color: var(--primary);
    font-size: .8rem;
    font-weight: 820;
}

.qr-employee-copy small {
    color: var(--muted);
    line-height: 1.45;
}

.qr-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 16px 16px;
}

.qr-card-actions form,
.qr-card-actions .button {
    width: 100%;
    margin: 0;
}

.kiosk-shell,
.confirm-shell {
    width: min(100%, 780px);
    margin: 0 auto;
}

.kiosk-shell {
    display: grid;
    gap: 18px;
}

.kiosk-hero {
    text-align: center;
}

.kiosk-hero p {
    max-width: 650px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.65;
}

.kiosk-icon,
.confirm-state-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 17px;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
}

.kiosk-icon .ui-icon,
.confirm-state-icon .ui-icon {
    width: 28px;
    height: 28px;
}

.kiosk-panel {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.scanner-stage {
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    color: #fff;
    background: #0b1220;
}

.scanner-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 24px;
    color: #cbd5e1;
    text-align: center;
}

.scanner-placeholder .ui-icon {
    width: 42px;
    height: 42px;
    color: #8aa8ff;
}

.scanner-placeholder span {
    max-width: 280px;
    font-size: .78rem;
    line-height: 1.5;
}

.scanner-frame {
    width: 66%;
    aspect-ratio: 1;
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, .96);
    border-radius: 20px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .26);
    pointer-events: none;
}

.scanner-status {
    margin: 14px 0 0;
    border-radius: 12px;
    padding: 11px 13px;
    color: #344054;
    background: var(--surface-soft);
    font-size: .8rem;
    font-weight: 720;
    text-align: center;
}

.scanner-status[data-type="success"] {
    color: var(--success);
    background: var(--success-bg);
}

.scanner-status[data-type="error"] {
    color: var(--danger);
    background: var(--danger-bg);
}

.kiosk-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 14px;
}

.scanner-fallback {
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    text-align: center;
}

.scanner-fallback strong {
    display: block;
    font-size: .86rem;
}

.scanner-fallback p {
    margin: 6px auto 12px;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.55;
}

.file-button {
    width: 100%;
}

.kiosk-back {
    display: inline-flex;
    justify-content: center;
    color: var(--primary);
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}

.confirm-card {
    min-height: 420px;
}

.employee-confirm-head {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.employee-confirm-avatar {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(135deg, #2563EB, #0B2442);
    font-size: 1.25rem;
    font-weight: 900;
}

.employee-confirm-head h1 {
    margin-bottom: 4px;
    font-size: clamp(1.55rem, 8vw, 2rem);
}

.employee-confirm-head .eyebrow {
    margin-bottom: 5px;
}

.employee-confirm-head p {
    margin-bottom: 0;
}

.gps-progress {
    display: flex;
    align-items: center;
    gap: 13px;
    border-radius: 15px;
    padding: 15px;
    background: var(--surface-blue);
}

.gps-progress > div {
    display: grid;
    gap: 4px;
}

.gps-progress small {
    color: var(--muted);
    line-height: 1.45;
}

.gps-spinner {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 3px solid #cbd8ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: gps-spin .8s linear infinite;
}

@keyframes gps-spin {
    to { transform: rotate(360deg); }
}

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

.preview-grid > div {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 13px;
    background: var(--surface-soft);
}

.preview-grid span {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.preview-grid strong {
    overflow-wrap: anywhere;
    font-size: .9rem;
}

.confirm-submit {
    width: 100%;
    min-height: 52px;
    margin-top: 14px;
}

.attendance-success {
    text-align: center;
}

.confirm-state-icon.is-success {
    color: var(--success);
    background: var(--success-bg);
}

.confirm-state-icon.is-error {
    color: var(--danger);
    background: var(--danger-bg);
}

.attendance-success p {
    color: var(--muted);
    line-height: 1.55;
}

.confirm-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.correction-employee {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-soft);
}

.correction-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: #fff;
}

.correction-employee > div {
    display: grid;
    gap: 3px;
}

.correction-employee span,
.correction-employee small {
    color: var(--muted);
}

.migration-card {
    text-align: center;
}

.migration-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 900;
}

.migration-list {
    margin: 20px 0;
    border-radius: 14px;
    padding: 15px;
    background: var(--surface-soft);
    text-align: left;
}

.migration-list ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.migration-list code {
    font-size: .78rem;
}

@media (min-width: 640px) {
    .page-actions {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .page-actions .button {
        width: auto;
    }

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

    .filter-actions {
        grid-column: 1 / -1;
        align-items: center;
        justify-content: flex-end;
        flex-direction: row;
    }

    .filter-actions .button {
        width: auto;
    }

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

    .kiosk-panel {
        padding: 22px;
    }

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

    .file-button {
        width: auto;
    }

    .confirm-footer {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .attendance-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

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

    .attendance-location-layout {
        grid-template-columns: minmax(340px, .72fr) minmax(560px, 1.28fr);
    }

    .scanner-stage {
        aspect-ratio: 16 / 10;
    }
}

@media (min-width: 1360px) {
    .qr-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


/* =========================================================
   Phase 2B.1 — Employee Self Attendance, Device & Selfie
   ========================================================= */

.button-danger {
    color: #fff;
    background: #DC2626;
}

.button-danger:hover {
    background: #912018;
}

.alert-warning {
    color: #854d0e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.badge-warning {
    color: #854d0e;
    background: #fef3c7;
}

.badge-danger {
    color: #DC2626;
    background: #FEF2F2;
}

.form-span-2 {
    grid-column: 1 / -1;
}

.content-subcard {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.account-employee-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.account-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #2563EB, #0B2442);
    font-size: 1.15rem;
    font-weight: 900;
}

.account-employee-summary > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.account-employee-summary strong,
.account-employee-summary span,
.account-employee-summary small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-employee-summary span,
.account-employee-summary small {
    color: var(--muted);
}

.account-state-grid,
.account-action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.account-state-grid {
    margin-bottom: 18px;
}

.account-state-grid article {
    display: grid;
    gap: 5px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.account-state-grid span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.self-attendance-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.device-card-head {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.device-card-head > .badge {
    grid-column: 1 / -1;
}

.device-hero-icon,
.security-card-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
}

.device-card-head h2 {
    margin-bottom: 0;
}

.device-detail-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0 0 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.device-detail-list > div {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(100px, .8fr) minmax(0, 1.2fr);
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.device-detail-list > div:last-child {
    border-bottom: 0;
}

.device-detail-list dt {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 750;
}

.device-detail-list dd {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: .8rem;
    font-weight: 750;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.camera-diagnostic-secret,
.selfie-secret-trigger {
    border: 0;
    color: #98a2b3;
    background: transparent;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.camera-diagnostic-secret {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 4px;
    padding: 0;
    font-size: .7rem;
    opacity: .52;
}

.camera-diagnostic-secret .ui-icon {
    width: 16px;
    height: 16px;
}

.camera-backup-panel,
.backup-upload-capture {
    margin-top: 14px;
    padding: 16px;
    border: 1px dashed #f59e0b;
    border-radius: 15px;
    background: #fffbeb;
}

.security-flow-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.security-flow-list li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: start;
    gap: 11px;
}

.security-flow-list li > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .78rem;
    font-weight: 900;
}

.security-flow-list li > div {
    display: grid;
    gap: 3px;
}

.security-flow-list small {
    color: var(--muted);
    line-height: 1.45;
}

.attempt-list {
    display: grid;
    gap: 10px;
}

.attempt-list article {
    min-width: 0;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.attempt-list article > .badge {
    grid-column: 1 / -1;
}

.attempt-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: #fff;
}

.attempt-list article > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.attempt-list small {
    overflow: hidden;
    color: var(--muted);
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.self-scan-card {
    max-width: 760px;
    margin-inline: auto;
}

.self-scan-card .scanner-frame {
    min-height: min(72vw, 520px);
}

.native-camera-fallback {
    margin-top: 18px;
    padding: 14px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.native-camera-fallback span {
    font-size: .82rem;
    font-weight: 800;
}

.native-camera-fallback p {
    margin: 5px 0 0;
    font-size: .78rem;
}

.selfie-capture-shell {
    max-width: 920px;
    margin-inline: auto;
}

.capture-progress {
    min-height: 96px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.capture-progress-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: var(--primary);
    background: var(--primary-soft);
    animation: capturePulse 1.4s ease-in-out infinite;
}

.capture-progress > div {
    display: grid;
    gap: 5px;
}

.capture-progress small {
    color: var(--muted);
}

@keyframes capturePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(.94); opacity: .68; }
}

.capture-workspace {
    display: grid;
    gap: 16px;
}

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

.capture-context-grid article {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.capture-context-grid span {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.capture-context-grid strong {
    overflow: hidden;
    font-size: .85rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selfie-challenge-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 13px;
    padding: 15px;
    border: 1px solid #cddaff;
    border-radius: 15px;
    background: var(--surface-blue);
}

.selfie-secret-trigger {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: #fff;
}

.selfie-challenge-card h2 {
    font-size: 1.18rem;
}

.selfie-challenge-card p {
    margin-bottom: 5px;
    font-weight: 720;
    line-height: 1.5;
}

.selfie-challenge-card small {
    color: var(--muted);
    line-height: 1.45;
}

.selfie-camera-frame {
    min-height: min(110vw, 620px);
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 20px;
    color: #fff;
    background: #0f172a;
}

.selfie-camera-frame video,
.selfie-camera-frame img {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    object-fit: cover;
}

.selfie-camera-frame video {
    transform: scaleX(-1);
}

.selfie-camera-placeholder {
    max-width: 270px;
    position: relative;
    z-index: 2;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
}

.selfie-camera-placeholder span {
    color: #cbd5e1;
    font-size: .8rem;
    line-height: 1.5;
}

.selfie-placeholder-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 4px;
    color: #93c5fd;
}

.selfie-countdown {
    width: 94px;
    height: 94px;
    position: absolute;
    z-index: 4;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, .76);
    backdrop-filter: blur(8px);
    font-size: 2.4rem;
    font-weight: 900;
}

.capture-actions,
.decision-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.capture-actions .button,
.decision-actions .button {
    width: 100%;
}

.backup-upload-label {
    margin: 12px 0;
}

.location-qr-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.location-choice-list {
    display: grid;
    gap: 8px;
}

.location-choice-list a {
    min-width: 0;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
    text-decoration: none;
}

.location-choice-list a.is-active {
    color: var(--primary);
    border-color: #b7c9f6;
    background: var(--primary-soft);
}

.location-choice-list a > span:first-child {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #fff;
}

.location-choice-list a > span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.location-choice-list strong,
.location-choice-list small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-choice-list small {
    color: var(--muted);
}

.location-qr-display {
    text-align: center;
}

.location-qr-display-head {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.location-qr-display-head p {
    margin: 0;
    color: var(--muted);
}

.location-qr-canvas-wrap {
    width: min(100%, 520px);
    margin: 0 auto 18px;
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
}

.location-qr-canvas-wrap canvas {
    width: min(100%, 420px) !important;
    height: auto !important;
}

.qr-refresh-indicator {
    display: grid;
    gap: 3px;
}

.qr-refresh-indicator span {
    color: var(--success);
    font-weight: 850;
}

.qr-refresh-indicator span[data-type="error"] {
    color: var(--danger);
}

.qr-refresh-indicator small {
    color: var(--muted);
}

.location-qr-instruction {
    width: min(100%, 580px);
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 15px;
    text-align: left;
    background: var(--surface-blue);
}

.location-qr-instruction > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: #fff;
}

.location-qr-instruction > div {
    display: grid;
    gap: 3px;
}

.location-qr-instruction small {
    color: var(--muted);
    line-height: 1.4;
}

.location-qr-display:fullscreen {
    width: 100vw;
    height: 100vh;
    display: grid;
    align-content: center;
    padding: 28px;
    border: 0;
    border-radius: 0;
    background: #fff;
}

.location-qr-display:fullscreen .location-qr-selector,
.location-qr-display:fullscreen form {
    display: none;
}

.security-tab-links {
    position: sticky;
    top: calc(var(--topbar-height) + 8px);
    z-index: 12;
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 7px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.security-tab-links a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.security-tab-links a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.security-tab-links span {
    min-width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .68rem;
}

.security-section {
    margin-bottom: 16px;
    scroll-margin-top: calc(var(--topbar-height) + 78px);
}

.security-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.security-review-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface-soft);
}

.security-review-card > header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
}

.security-review-card > header > .badge {
    grid-column: 1 / -1;
}

.security-review-card header > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.security-review-card header strong,
.security-review-card header small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-review-card header small {
    color: var(--muted);
}

.security-review-card blockquote {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-left: 3px solid #f59e0b;
    border-radius: 0 10px 10px 0;
    color: #713f12;
    background: #fffbeb;
    line-height: 1.5;
}

.security-meta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: hidden;
    background: #fff;
}

.security-meta-grid > div {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(90px, .75fr) minmax(0, 1.25fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.security-meta-grid > div:last-child {
    border-bottom: 0;
}

.security-meta-grid dt {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.security-meta-grid dd {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: .76rem;
    font-weight: 720;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.security-decision-form {
    display: grid;
    gap: 12px;
}

.evidence-preview-link {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--primary);
    background: #fff;
    font-size: .75rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.evidence-preview-link img {
    width: 100%;
    max-height: 420px;
    border-radius: 10px;
    object-fit: cover;
    background: #e2e8f0;
}

@media (min-width: 640px) {
    .account-state-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .device-card-head {
        grid-template-columns: 46px minmax(0, 1fr) auto;
    }

    .device-card-head > .badge,
    .attempt-list article > .badge,
    .security-review-card > header > .badge {
        grid-column: auto;
    }

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

    .device-detail-list > div {
        border-right: 1px solid var(--line);
    }

    .device-detail-list > div:nth-child(even) {
        border-right: 0;
    }

    .attempt-list article {
        grid-template-columns: 38px minmax(0, 1fr) auto;
    }

    .capture-actions,
    .decision-actions {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .capture-actions .button,
    .decision-actions .button {
        width: auto;
    }

    .location-qr-display-head {
        align-items: center;
        justify-content: space-between;
        flex-direction: row;
        text-align: left;
    }

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

    .security-meta-grid > div {
        border-right: 1px solid var(--line);
    }

    .security-meta-grid > div:nth-child(even) {
        border-right: 0;
    }
}

@media (min-width: 1024px) {
    .self-attendance-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    }

    .selfie-camera-frame {
        min-height: 560px;
    }

    .location-qr-layout {
        grid-template-columns: minmax(250px, .55fr) minmax(540px, 1.45fr);
        align-items: start;
    }

    .location-qr-selector {
        position: sticky;
        top: 96px;
    }

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

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


/* Phase 2B.2 employee QR print cards */
.alert-info {
    color: #2563EB;
    background: #EFF6FF;
    border: 1px solid #cddaff;
}

@media print {
    .topbar,
    .sidebar,
    .mobile-bottom-nav,
    .page-header .page-actions,
    .qr-card-actions,
    .sidebar-backdrop,
    .app-toast,
    .offline-banner {
        display: none !important;
    }

    .app-shell,
    .app-page {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .qr-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8mm !important;
    }

    .employee-qr-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #0F172A !important;
        box-shadow: none !important;
    }
}


/* =====================================================================
   Phase 2B.3 — Camera modal + emergency upload hotfix
   ===================================================================== */

body.camera-modal-open,
body.emergency-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.qr-open-button {
    width: 100%;
}

.qr-camera-modal,
.emergency-unlock-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    align-items: end;
    isolation: isolate;
}

.qr-camera-backdrop,
.emergency-unlock-backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    border: 0;
    background: rgba(15, 23, 42, .82);
}

.qr-camera-sheet,
.emergency-unlock-sheet {
    width: 100%;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -24px 70px rgba(15, 23, 42, .28);
}

.qr-camera-header,
.emergency-unlock-sheet > header {
    min-height: 72px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding:
        12px max(16px, env(safe-area-inset-right))
        12px max(16px, env(safe-area-inset-left));
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.qr-camera-header > div,
.emergency-unlock-sheet > header > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.qr-camera-header small,
.emergency-unlock-sheet > header small {
    color: var(--primary);
    font-size: .67rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.qr-camera-header strong,
.emergency-unlock-sheet > header strong {
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-camera-stage {
    min-height: 0;
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #020617;
}

.qr-camera-stage video {
    width: 100%;
    height: 100%;
    min-height: min(62dvh, 620px);
    max-height: calc(100dvh - 205px);
    object-fit: cover;
    background: #020617;
}

.qr-camera-placeholder {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 28px;
    color: #ffffff;
    background: #020617;
    text-align: center;
}

.qr-camera-placeholder span {
    max-width: 290px;
    color: #cbd5e1;
    font-size: .8rem;
    line-height: 1.55;
}

.qr-camera-placeholder-icon {
    width: 54px;
    height: 54px;
    color: #93c5fd;
}

.qr-scan-guide {
    width: min(68vw, 310px);
    aspect-ratio: 1;
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.qr-scan-guide span {
    width: 52px;
    height: 52px;
    position: absolute;
    border-color: #ffffff;
    border-style: solid;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .55));
}

.qr-scan-guide span:nth-child(1) {
    left: 0;
    top: 0;
    border-width: 4px 0 0 4px;
    border-radius: 14px 0 0;
}

.qr-scan-guide span:nth-child(2) {
    right: 0;
    top: 0;
    border-width: 4px 4px 0 0;
    border-radius: 0 14px 0 0;
}

.qr-scan-guide span:nth-child(3) {
    right: 0;
    bottom: 0;
    border-width: 0 4px 4px 0;
    border-radius: 0 0 14px;
}

.qr-scan-guide span:nth-child(4) {
    left: 0;
    bottom: 0;
    border-width: 0 0 4px 4px;
    border-radius: 0 0 0 14px;
}

.qr-camera-footer {
    flex: 0 0 auto;
    padding:
        12px max(16px, env(safe-area-inset-right))
        calc(14px + env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
    background: #ffffff;
    border-top: 1px solid var(--line);
}

.qr-camera-footer .scanner-status {
    margin: 0 0 10px;
}

.qr-camera-actions,
.emergency-unlock-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.emergency-unlock-sheet {
    max-height: min(92dvh, 580px);
}

.emergency-unlock-sheet form {
    overflow-y: auto;
    padding:
        20px max(18px, env(safe-area-inset-right))
        calc(22px + env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
}

.emergency-unlock-sheet form > .muted {
    margin-bottom: 18px;
}

.emergency-unlock-actions {
    margin-top: 18px;
}

.selfie-camera-frame {
    width: 100%;
    min-height: 0;
    aspect-ratio: 3 / 4;
    max-height: min(68dvh, 640px);
    background: #020617;
}

.selfie-camera-frame video,
.selfie-camera-frame img {
    background: #020617;
}

.selfie-secret-trigger {
    cursor: default;
    touch-action: manipulation;
}

.backup-upload-capture {
    border-style: solid;
    background: #fff8e7;
}

@media (min-width: 640px) {
    .qr-camera-actions,
    .emergency-unlock-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .qr-open-button {
        width: auto;
    }
}

@media (min-width: 768px) {
    .qr-camera-modal,
    .emergency-unlock-modal {
        align-items: center;
        justify-items: center;
        padding: 24px;
    }

    .qr-camera-sheet {
        width: min(100%, 560px);
        max-height: min(92dvh, 840px);
        border-radius: 24px;
    }

    .emergency-unlock-sheet {
        width: min(100%, 480px);
        border-radius: 22px;
    }

    .qr-camera-stage video {
        min-height: min(62dvh, 590px);
        max-height: min(68dvh, 620px);
    }

    .qr-scan-guide {
        width: min(46vw, 300px);
    }
}

@media (min-width: 1024px) {
    .selfie-camera-frame {
        min-height: 0;
        max-height: 620px;
        aspect-ratio: 4 / 3;
    }
}


/* =====================================================================
   Phase 2C — Finance, Overtime, Cash Advance, Payroll, Payslip
   ===================================================================== */

.finance-form-card {
    margin-bottom: 20px;
}

.finance-list {
    display: grid;
    gap: 14px;
}

.finance-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.finance-card > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.finance-card > header > div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.finance-card > header strong {
    font-size: 1rem;
}

.finance-card > header small {
    color: var(--muted);
    line-height: 1.45;
}

.finance-card > p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.finance-card-link {
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease;
}

.finance-card-link:hover {
    transform: translateY(-1px);
    border-color: #b8c9f3;
}

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

.finance-meta > div {
    min-width: 0;
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.finance-meta span,
.payslip-meta span,
.payslip-summary span {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 760;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.finance-meta strong {
    overflow: hidden;
    font-size: .84rem;
    text-overflow: ellipsis;
}

.decision-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.span-2 {
    grid-column: 1 / -1;
}

.payroll-toolbar {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.payroll-toolbar form {
    margin: 0;
}

.inline-pay-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.payslip-actions {
    max-width: 900px;
    margin: 0 auto 14px;
    display: flex;
    justify-content: flex-end;
}

.payslip-sheet {
    max-width: 900px;
    margin: 0 auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.payslip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 2px solid #0F172A;
}

.payslip-header > div:last-child {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.payslip-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 20px 0;
}

.payslip-meta > div {
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.payslip-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.payslip-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.payslip-panel h2 {
    margin: 0;
    padding: 12px 14px;
    font-size: .9rem;
    background: var(--surface-soft);
}

.payslip-panel > div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 14px;
    border-top: 1px solid var(--line);
    font-size: .84rem;
}

.payslip-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
}

.payslip-summary > div {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 13px;
    background: var(--surface-soft);
}

.payslip-summary strong {
    font-size: 1.08rem;
}

.payslip-net {
    color: #fff;
    background: #0F172A !important;
}

.payslip-net span {
    color: #cbd5e1;
}

.payslip-sheet footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #94a3b8;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .decision-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .payroll-toolbar {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .inline-pay-form {
        grid-template-columns: minmax(200px, 1fr) auto;
    }

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

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

@media (min-width: 1024px) {
    .finance-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-form-card {
        max-width: 980px;
    }

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

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

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

@media print {
    .topbar,
    .sidebar,
    .mobile-bottom-nav,
    .payslip-actions,
    .offline-banner,
    .app-toast {
        display: none !important;
    }

    .app-shell,
    .app-page {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .payslip-sheet {
        max-width: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 10mm;
    }
}


/* Phase 2C.1 payroll rules */
.finance-checkbox-card,
.employee-check {
    display: flex;
    align-items: flex-start;
    grid-template-columns: none;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.finance-checkbox-card input,
.employee-check input {
    width: 20px;
    min-height: 20px;
    height: 20px;
    margin-top: 2px;
    flex: 0 0 20px;
}

.finance-checkbox-card > span,
.employee-check > span {
    display: grid;
    gap: 3px;
}

.employee-picker {
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.employee-picker legend {
    padding: 0 8px;
    font-weight: 800;
}

.employee-picker-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.employee-picker-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.installment-approval-card {
    border: 1px solid #c7d7fe;
    border-radius: 14px;
    padding: 14px;
    background: #f1f5ff;
}

@media (min-width: 640px) {
    .employee-picker-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .employee-picker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .payroll-component-table {
        min-width: 1180px;
    }
}


/* =====================================================================
   Phase 2C.2 — Unified employee, notifications, scrollable sidebar
   ===================================================================== */

.sidebar {
    height: calc(100dvh - var(--topbar-height));
    max-height: calc(100dvh - var(--topbar-height));
    overflow: hidden;
}

.sidebar-nav {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 3px;
    padding-bottom: 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 7px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: #cbd5e1;
}

.sidebar-footer,
.sidebar-head,
.company-switcher {
    flex: 0 0 auto;
}

.notification-button {
    width: 44px;
    height: 44px;
    position: relative;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    text-decoration: none;
}

.notification-button .ui-icon {
    width: 20px;
    height: 20px;
}

.notification-badge {
    min-width: 19px;
    height: 19px;
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    color: #ffffff;
    background: #d92d20;
    border: 2px solid #ffffff;
    border-radius: 99px;
    font-size: .62rem;
    font-weight: 850;
}

.employee-section-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    padding: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.employee-section-nav a {
    min-height: 40px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    color: #344054;
    background: var(--surface-soft);
    border-radius: 11px;
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
}

.employee-unified-card {
    scroll-margin-top: calc(var(--topbar-height) + 16px);
}

.form-section-heading {
    margin: 8px 0 2px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.form-section-heading:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.form-section-heading h2 {
    margin: 0 0 5px;
}

#employee-account {
    scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.installment-input-wrap {
    transition: opacity .18s ease, filter .18s ease;
}

.installment-input-wrap.is-disabled {
    opacity: .52;
    filter: grayscale(.45);
}

.installment-input-wrap.is-disabled input {
    cursor: not-allowed;
    background: #e5e7eb;
    border-color: #d0d5dd;
}

.approval-stage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.approval-stage-grid > article {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.approval-stage-grid > article > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    font-size: .78rem;
    font-weight: 850;
    background: #e5e7eb;
}

.approval-stage-grid article.is-complete {
    color: #067647;
    background: #F0FDF4;
    border-color: #abefc6;
}

.approval-stage-grid article.is-complete > span {
    color: #ffffff;
    background: #16A34A;
}

.approval-stage-grid article.is-pending {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fed7aa;
}

.approval-stage-grid article.is-pending > span {
    color: #ffffff;
    background: #f79009;
}

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

.notification-list {
    display: grid;
    gap: 10px;
}

.notification-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
}

.notification-card.is-unread {
    background: #f1f5ff;
    border-color: #c7d7fe;
}

.notification-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: #ffffff;
    border-radius: 13px;
    box-shadow: var(--shadow-sm);
}

.notification-copy {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.notification-copy header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notification-copy p {
    margin: 0;
    color: #475467;
    line-height: 1.55;
}

.notification-card form {
    grid-column: 1 / -1;
}

.notification-card form .button {
    width: 100%;
}

.evidence-error-card {
    display: grid;
    justify-items: start;
    gap: 14px;
    margin-top: 24px;
}

.evidence-error-card h1,
.evidence-error-card p {
    margin: 0;
}

.evidence-help {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid #fed7aa;
    border-radius: 14px;
    color: #9a3412;
    background: #fff7ed;
}

@media (min-width: 520px) {
    .approval-stage-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .notification-card {
        grid-template-columns: 42px minmax(0, 1fr) auto;
        align-items: center;
    }

    .notification-card form {
        grid-column: auto;
    }

    .notification-card form .button {
        width: auto;
    }
}

@media (min-width: 768px) {
    .employee-section-nav {
        width: max-content;
        max-width: 100%;
    }

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

@media (min-width: 1024px) {
    .sidebar {
        height: calc(100dvh - var(--topbar-height));
        max-height: calc(100dvh - var(--topbar-height));
        min-height: 0;
        position: sticky;
        top: var(--topbar-height);
    }

    .employee-page-header {
        align-items: flex-end;
    }
}


/* ==========================================================================
   SatuKru brand layer — Concept 03 / 1K Forward
   ========================================================================== */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--sk-font-body);
    background: var(--sk-cloud);
    color: var(--sk-text);
}

h1,
h2,
h3,
h4,
h5,
h6,
.page-header h1,
.section-heading h2 {
    font-family: var(--sk-font-heading);
    color: var(--sk-navy);
    font-weight: 700;
}

h1 {
    font-weight: 800;
}

.eyebrow,
.sidebar-kicker,
.nav-section-label,
.data-table td::before {
    text-transform: none;
    letter-spacing: .02em;
    color: var(--sk-deep-teal);
}

.nav-section-label {
    font-size: .72rem;
    font-weight: 700;
}

.topbar {
    background: #fff;
    border-bottom-color: var(--sk-border);
    backdrop-filter: none;
}

.brand {
    gap: 9px;
}

.brand-logo-horizontal {
    width: 140px;
    height: 32px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-company-name {
    display: none;
    max-width: 150px;
    overflow: hidden;
    color: var(--sk-muted);
    font-size: .7rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button,
.notification-button {
    min-width: 44px;
    min-height: 44px;
    border-color: var(--sk-border);
    border-radius: 12px;
    color: var(--sk-navy);
    background: #fff;
}

.button {
    min-height: 44px;
    border-radius: 12px;
    font-weight: 650;
}

.button-primary {
    color: #fff;
    background: var(--sk-blue);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.button-primary:hover {
    background: #1D4ED8;
}

.page-primary-action,
.satukru-login-submit {
    background: var(--sk-gradient);
}

.page-primary-action:hover,
.satukru-login-submit:hover {
    filter: brightness(.96);
    background: var(--sk-gradient);
}

.button-secondary {
    color: #1D4ED8;
    background: #EFF6FF;
}

.button-ghost {
    color: var(--sk-navy);
    border-color: var(--sk-border);
    background: #fff;
}

.button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible,
input:focus,
select:focus,
textarea:focus {
    outline-color: rgba(37, 99, 235, .2);
}

.sidebar {
    background: #fff;
    border-right-color: var(--sk-border);
    box-shadow: 18px 0 46px rgba(15, 23, 42, .12);
}

.sidebar-nav {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: #CBD5E1;
}

.nav-item {
    min-height: 46px;
    color: #334155;
    font-weight: 600;
}

.nav-item:hover {
    color: var(--sk-blue);
    background: #F8FAFC;
}

.nav-item.is-active {
    color: #1D4ED8;
    background: #EFF6FF;
}

.nav-item.is-active .nav-icon,
.company-switcher-icon,
.quick-icon,
.stat-card-icon {
    color: var(--sk-blue);
}

.company-switcher {
    border-color: #DBEAFE;
    background: #F8FAFC;
}

.sidebar-footer {
    border-color: var(--sk-border);
    color: var(--sk-navy);
    background: #F8FAFC;
}

.status-dot {
    background: var(--sk-teal);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
}

.app-page,
.guest-page {
    background: transparent;
}

.auth-card,
.content-card,
.stat-card,
.quick-card,
.finance-card,
.notification-card {
    border: 1px solid var(--sk-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .04);
}

.page-header {
    margin-bottom: 22px;
}

.page-header h1 {
    max-width: 820px;
}

.dashboard-context {
    display: inline-flex;
    margin-top: 6px;
    color: var(--sk-muted);
    font-size: .78rem;
}

input,
select,
textarea {
    min-height: 48px;
    border-color: var(--sk-border);
    border-radius: 12px;
    color: var(--sk-text);
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--sk-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.alert {
    border-radius: 12px;
}

.alert-success,
.badge-success {
    color: #166534;
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.alert-warning,
.badge-warning {
    color: #92400E;
    background: #FFFBEB;
    border-color: #FDE68A;
}

.alert-error,
.badge-danger {
    color: #991B1B;
    background: #FEF2F2;
    border-color: #FECACA;
}

.badge {
    font-weight: 650;
}

.data-table tr {
    border-color: var(--sk-border);
    box-shadow: none;
}

.data-table td::before {
    font-weight: 650;
}

.mobile-bottom-nav {
    background: #fff;
    border-top-color: var(--sk-border);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
    backdrop-filter: none;
}

.mobile-bottom-nav a {
    min-height: 54px;
    color: var(--sk-muted);
}

.mobile-bottom-nav a.is-active {
    color: var(--sk-blue);
    background: #EFF6FF;
}

/* Login */
.satukru-login {
    min-height: calc(100dvh - var(--topbar-height));
    padding: 18px 0 28px;
    align-items: center;
}

.satukru-login-card {
    width: min(100%, 460px);
    padding: clamp(22px, 6vw, 34px);
    border-radius: 18px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, .08);
}

.satukru-login-brand {
    display: grid;
    justify-items: start;
    gap: 12px;
    margin-bottom: 28px;
}

.satukru-login-logo {
    width: min(100%, 280px);
    height: auto;
}

.satukru-slogan {
    margin: 0;
    color: var(--sk-deep-teal);
    font-size: .84rem;
    font-weight: 700;
}

.auth-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(1.8rem, 8vw, 2.45rem);
}

.auth-heading .muted {
    margin: 0;
}

.satukru-login-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--sk-border);
    color: var(--sk-muted);
    font-size: .78rem;
    text-align: center;
}

/* QR scanner: solid, mobile-first */
.qr-camera-backdrop,
.emergency-unlock-backdrop {
    background: rgba(11, 36, 66, .58);
    backdrop-filter: none;
}

.qr-camera-sheet,
.emergency-unlock-sheet {
    background: #fff;
    border: 1px solid var(--sk-border);
    box-shadow: 0 18px 55px rgba(15, 23, 42, .18);
}

.qr-camera-stage,
.selfie-camera-frame {
    overflow: hidden;
    background: #071B33;
}

.qr-camera-stage video,
.selfie-camera-frame video,
.selfie-camera-frame img {
    width: 100%;
    max-width: 100%;
    object-fit: cover;
}

.qr-camera-placeholder,
.selfie-camera-placeholder {
    color: #fff;
    background: #071B33;
}

.scanner-status,
.qr-camera-footer {
    background: #fff;
}

.qr-scan-guide {
    border-color: rgba(255,255,255,.3);
}

.qr-scan-guide span {
    border-color: var(--sk-teal);
}

.selfie-challenge-card {
    border-color: #BFDBFE;
    background: #EFF6FF;
}

.capture-progress {
    border-color: #99F6E4;
    background: #F0FDFA;
}

.capture-progress-icon {
    color: var(--sk-deep-teal);
}

.backup-upload-capture {
    border-color: #FDE68A;
    background: #FFFBEB;
}

/* Empty/error states */
.empty-state {
    border-color: #CBD5E1;
    background: #fff;
}

.confirm-state-icon.is-success {
    color: var(--sk-success);
    background: #F0FDF4;
}

.confirm-state-icon.is-error {
    color: var(--sk-danger);
    background: #FEF2F2;
}

/* PWA-only brief splash, no impact on browser navigation */
.satukru-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: #F7F9FC;
    opacity: 1;
    transition: opacity .2s ease;
}

.satukru-splash.is-hiding {
    opacity: 0;
    pointer-events: none;
}

.satukru-splash-inner {
    display: grid;
    justify-items: center;
    gap: 10px;
    color: var(--sk-navy);
    text-align: center;
}

.satukru-splash-inner img {
    width: 72px;
    height: 72px;
}

.satukru-splash-inner strong {
    font-family: var(--sk-font-heading);
    font-size: 1.45rem;
    font-weight: 800;
}

.satukru-splash-inner span {
    color: var(--sk-muted);
    font-size: .82rem;
}

/* Accessibility / reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Tablet */
@media (min-width: 640px) {
    .brand-company-name {
        display: inline;
    }

    .satukru-login {
        padding: 32px 16px 44px;
    }

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

/* Desktop */
@media (min-width: 1024px) {
    .brand-logo-horizontal {
        width: 154px;
        height: 35px;
    }

    .auth-card,
    .content-card {
        border-radius: 18px;
    }

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

    .sidebar {
        box-shadow: none;
    }
}

/* 360px safety */
@media (max-width: 380px) {
    .topbar {
        gap: 6px;
        padding-inline: 8px;
    }

    .topbar-left,
    .topbar-actions {
        gap: 6px;
    }

    .brand-logo-horizontal {
        width: 118px;
        height: auto;
    }

    .notification-button,
    .icon-button,
    .logout-button {
        width: 44px;
        min-width: 44px;
        padding: 0;
    }

    .app-page,
    .guest-page {
        padding-inline: 12px;
    }

    .auth-card,
    .content-card {
        padding: 18px;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .qr-camera-sheet,
    .emergency-unlock-sheet {
        max-width: 100vw;
    }
}

/* Solid operational surfaces — no glassmorphism */
.sidebar-backdrop {
    backdrop-filter: none;
}
.security-tab-links {
    background: #fff;
    backdrop-filter: none;
}
.selfie-countdown {
    backdrop-filter: none;
    background: rgba(11, 36, 66, .92);
}
