:root {
    --sc-bg-0: #0b1220;
    --sc-bg-1: #0f172a;
    --sc-ink: #0b1220;
    --sc-muted: rgba(15, 23, 42, 0.72);
    --sc-muted-2: rgba(15, 23, 42, 0.55);

    --sc-primary: #1d4ed8;
    --sc-primary-2: #0ea5e9;
    --sc-focus: rgba(37, 99, 235, 0.15);
    --sc-focus-strong: rgba(16, 185, 129, 0.18);
    --sc-warn-focus: rgba(245, 158, 11, 0.22);
    --sc-danger: rgba(185, 28, 28, 0.95);
    --sc-danger-focus: rgba(220, 38, 38, 0.12);

    --sc-radius-lg: 22px;
    --sc-radius-md: 16px;
    --sc-radius-sm: 14px;

    /* Native <select> dropdown items (options) are OS-rendered and often appear smaller than inputs.
       These variables let us tune readability platform-wide. */
    --sc-select-font: 16px;
    --sc-select-option-line: 2.6;
}

body {
    /* Local-first stack so the UI no longer depends on a remote webfont request at runtime. */
    font-family: "Space Grotesk", "Aptos", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* Admin shell */
.sc-admin {
    min-height: 100vh;
    background:
        radial-gradient(1100px 600px at 15% 10%, rgba(37, 99, 235, 0.22), transparent 55%),
        radial-gradient(900px 560px at 85% 25%, rgba(16, 185, 129, 0.16), transparent 55%),
        radial-gradient(1000px 620px at 40% 95%, rgba(245, 158, 11, 0.10), transparent 58%),
        linear-gradient(180deg, var(--sc-bg-0) 0%, var(--sc-bg-1) 55%, var(--sc-bg-0) 100%);
}

.sc-shell {
    min-height: 100vh;
    display: flex;
    gap: 18px;
    padding: 18px;
    box-sizing: border-box;
}

.sc-sidebar,
.sc-main-inner {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--sc-radius-lg);
    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.32),
        0 2px 0 rgba(255, 255, 255, 0.25) inset;
    backdrop-filter: blur(12px);
}

.sc-sidebar {
    width: 272px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 36px);
}

.sc-sidebar-header {
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.sc-sidebar-headrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sc-brand {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--sc-ink);
}

.sc-mobile-menu-close,
.sc-mobile-nav-toggle {
    display: none;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.92);
    color: rgba(15, 23, 42, 0.86);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.sc-mobile-topbar {
    display: none;
}

.sc-mobile-topbar-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: rgba(15, 23, 42, 0.86);
}

.sc-mobile-backdrop {
    display: none;
}

.sc-mobile-menu-close {
    width: 34px;
    height: 34px;
    padding: 0;
}

.sc-mobile-nav-toggle {
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    margin: 0 0 10px;
}

.sc-mobile-nav-fab {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 55;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.2);
}

.sc-nav {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sc-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sc-nav-divider {
    height: 1px;
    margin: 8px 4px;
    background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.18), transparent);
}

.sc-navlink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--sc-radius-sm);
    color: rgba(15, 23, 42, 0.78);
    font-weight: 650;
    text-decoration: none;
    transition: background-color 140ms ease, transform 120ms ease, box-shadow 140ms ease;
}

button.sc-navlink {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.sc-nav-caret {
    margin-left: auto;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(15, 23, 42, 0.42);
    border-bottom: 2px solid rgba(15, 23, 42, 0.42);
    transform: rotate(-45deg);
    transition: transform 140ms ease, border-color 140ms ease;
    flex: 0 0 auto;
}

.sc-navlink.is-open .sc-nav-caret {
    transform: rotate(45deg);
    border-color: rgba(15, 23, 42, 0.55);
}

.sc-navlink.is-active .sc-nav-caret {
    transform: rotate(45deg);
    border-color: rgba(255, 255, 255, 0.70);
}

.sc-navlink:hover {
    background: rgba(15, 23, 42, 0.06);
}

.sc-navlink:active {
    transform: translateY(1px);
}

.sc-navlink.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-primary-2) 100%);
    box-shadow: 0 14px 30px rgba(29, 78, 216, 0.26);
}

.sc-navlink.is-open {
    background: rgba(15, 23, 42, 0.06);
}

.sc-subnav {
    margin: 4px 0 10px 0;
    padding-left: 8px;
    display: grid;
    gap: 4px;
}

.sc-subnav.is-collapsed {
    display: none;
}

.sc-sublink {
    padding: 9px 12px 9px 18px;
    border-radius: 14px;
    color: rgba(15, 23, 42, 0.70);
    font-weight: 650;
    font-size: 13px;
    text-decoration: none;
    position: relative;
    transition: background-color 140ms ease, transform 120ms ease;
}

.sc-sublink::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: rgba(15, 23, 42, 0.18);
    transform: translate(-12px, -50%);
}

.sc-sublink:hover {
    background: rgba(15, 23, 42, 0.05);
}

.sc-sublink:active {
    transform: translateY(1px);
}

.sc-sublink.is-active {
    color: rgba(15, 23, 42, 0.92);
    background: rgba(29, 78, 216, 0.10);
}

.sc-sublink.is-active::before {
    background: rgba(29, 78, 216, 0.70);
}

.sc-sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.10);
    margin-top: auto;
}

.sc-usercard {
    position: relative;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.78);
    padding: 12px 12px 10px;
    color: rgba(15, 23, 42, 0.80);
}

.sc-usercard-action {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.60);
    color: rgba(15, 23, 42, 0.58);
    cursor: pointer;
    transition: background-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 120ms ease;
}

.sc-usercard-action svg {
    width: 18px;
    height: 18px;
    display: block;
}

.sc-usercard-action:hover {
    background: rgba(15, 23, 42, 0.06);
    color: rgba(15, 23, 42, 0.78);
}

.sc-usercard-action:active {
    transform: translateY(1px);
}

.sc-usercard-action:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus);
}

.sc-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sc-modal.is-hidden {
    display: none;
}

.sc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(6px);
}

.sc-modal-card {
    position: relative;
    width: min(520px, calc(100% - 32px));
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.40);
}

.sc-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

.sc-modal-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--sc-ink);
    font-size: 16px;
}

.sc-modal-desc {
    margin-top: 6px;
    font-size: 13px;
    color: rgba(15, 23, 42, 0.70);
}

.sc-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
}

body.sc-modal-open {
    overflow: hidden;
}

body.sc-modal-open .sc-main {
    overflow: hidden;
}

.sc-employee-modal {
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sc-employee-modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sc-employee-modal-panel {
    width: min(100%, 56rem);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin: auto;
}

@media (max-height: 760px) {
    .sc-employee-modal {
        align-items: flex-start;
    }

    .sc-employee-modal-panel {
        margin-top: 12px;
        margin-bottom: 12px;
    }
}

.sc-usercard-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.55);
}

.sc-usercard-name {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 750;
    color: var(--sc-ink);
}

.sc-usercard-meta {
    font-size: 11px;
    color: rgba(15, 23, 42, 0.62);
}

.sc-main {
    flex: 1;
    overflow: auto;
    height: calc(100vh - 36px);
}

.sc-main-inner {
    position: relative;
    min-height: 100%;
    padding: 28px;
    box-sizing: border-box;
}

@media (max-width: 920px) {
    .sc-shell {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .sc-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: auto;
        max-height: 100vh;
        max-height: 100dvh;
        width: min(320px, 86vw);
        z-index: 60;
        transform: translateX(-105%);
        transition: transform 180ms ease;
        will-change: transform;
        border-radius: 0;
        box-sizing: border-box;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sc-shell.sc-sidebar-open .sc-sidebar {
        transform: translateX(0);
    }

    .sc-mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.52);
        opacity: 0;
        pointer-events: none;
        transition: opacity 160ms ease;
        z-index: 50;
    }

    .sc-shell.sc-sidebar-open ~ .sc-mobile-backdrop,
    .sc-shell.sc-sidebar-open + .sc-mobile-backdrop,
    .sc-shell.sc-sidebar-open .sc-mobile-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.sc-mobile-nav-open {
        overflow: hidden;
    }

    .sc-main {
        height: auto;
    }

    .sc-main-inner {
        padding: 16px;
    }

    .sc-sidebar-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .sc-mobile-menu-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sc-mobile-nav-toggle {
        display: inline-flex;
    }

    .sc-mobile-nav-fab {
        position: absolute;
        top: calc(16px + env(safe-area-inset-top));
        right: calc(28px + env(safe-area-inset-right));
        z-index: 3;
    }

    .sc-pagehead {
        padding-right: calc(88px + env(safe-area-inset-right));
        min-height: 44px;
    }
}

/* Standard content blocks */
.sc-pagehead {
    margin-bottom: 18px;
}

.sc-page-title {
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 800;
    color: var(--sc-ink);
}

.sc-page-desc {
    margin-top: 6px;
    font-size: 13px;
    color: rgba(15, 23, 42, 0.70);
}

.sc-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
}

.sc-panel-pad {
    padding: 18px;
}

.sc-panel-pad-lg {
    padding: 22px;
}

@media (min-width: 921px) {
    .sc-readable-pagehead .sc-page-title {
        font-size: 32px;
        line-height: 1.04;
    }

    .sc-readable-pagehead .sc-page-desc {
        max-width: 60ch;
        font-size: 15px;
        line-height: 1.55;
    }

    .sc-readable-filters {
        padding: 22px;
    }

    .sc-readable-filters label {
        font-size: 14px;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

    .sc-readable-filters .sc-input {
        font-size: 16px;
        min-height: 48px;
    }

    .sc-readable-table-panel thead th {
        font-size: 12px;
        letter-spacing: 0.08em;
    }

    .sc-readable-table-panel #resultsMeta,
    .sc-readable-table-panel #employeesListState,
    .sc-readable-table-panel #historyListState {
        font-size: 14px;
        line-height: 1.5;
    }

    #employeeTableBody td {
        padding-top: 18px !important;
        padding-bottom: 18px !important;
    }

    #employeeTableBody .sc-employee-primary,
    #employeeTableBody .sc-employee-secondary,
    #employeeTableBody .sc-employee-contact-primary {
        font-size: 15px;
        line-height: 1.45;
    }

    #employeeTableBody .sc-employee-meta,
    #employeeTableBody .sc-employee-contact-secondary {
        font-size: 13px;
        line-height: 1.55;
    }

    #employeeTableBody .sc-employee-status-badge {
        padding: 7px 12px;
        font-size: 12px;
        line-height: 1.35;
        border-radius: 999px;
    }

    .sc-history-table .history-col-time > div:first-child,
    .sc-history-table .history-col-employee > div:first-child {
        font-size: 15px;
        line-height: 1.4;
    }

    .sc-history-table .history-col-time > div + div,
    .sc-history-table .history-col-employee > div:not(:first-child),
    .sc-history-table .history-photo-meta {
        font-size: 13px;
        line-height: 1.5;
    }

    .sc-history-table .history-validation-btn,
    .sc-history-table .history-photo-status,
    .history-validate-picker-btn {
        font-size: 12px;
        line-height: 1.35;
    }
}

/* Tabs */
.sc-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(15, 23, 42, 0.03);
    overflow: auto;
}

.sc-tab-btn {
    border: 0;
    background: transparent;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 750;
    color: rgba(15, 23, 42, 0.65);
    transition: background-color 140ms ease, box-shadow 140ms ease, transform 120ms ease, color 140ms ease;
    white-space: nowrap;
}

.sc-tab-btn:hover {
    background: rgba(15, 23, 42, 0.05);
    color: rgba(15, 23, 42, 0.80);
}

.sc-tab-btn:active {
    transform: translateY(1px);
}

.sc-tab-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus);
}

.sc-tab-btn.is-active {
    background: rgba(255, 255, 255, 0.92);
    color: var(--sc-ink);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.08);
}

@media (max-width: 920px) {
    .sc-responsive-table thead {
        display: none;
    }

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

    .sc-responsive-table tbody {
        padding: 12px;
    }

    .sc-responsive-table tr {
        border: 1px solid rgba(15, 23, 42, 0.10);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.88);
        margin-bottom: 14px;
        overflow: hidden;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
    }

    .sc-responsive-table td {
        padding: 14px 16px !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        white-space: normal !important;
    }

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

    .sc-responsive-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(15, 23, 42, 0.52);
        margin-bottom: 8px;
    }

    .sc-responsive-table td[colspan]::before {
        content: none;
    }

    .sc-responsive-table .sc-table-actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        align-items: center;
    }

    /* Audit mobile cards: each row should be visually independent. */
    .sc-audit-table .sc-audit-table-body {
        background: transparent;
        display: grid;
        gap: 12px;
        padding: 10px;
    }

    .sc-audit-table.sc-responsive-table .sc-audit-table-body tr {
        margin-bottom: 0;
        border: 1px solid rgba(15, 23, 42, 0.12);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 18px rgba(2, 6, 23, 0.06);
    }

    .sc-audit-table.sc-responsive-table .sc-audit-table-body tr + tr {
        border-top-width: 0;
    }
}

/* History table responsiveness */
.sc-history-table {
    width: 100%;
    table-layout: fixed;
}

.sc-history-table-wrap {
    overflow-x: hidden;
}

.sc-history-table td {
    vertical-align: top;
}

.sc-history-table .history-col-time { width: 126px; }
.sc-history-table .history-col-employee { width: 29%; }
.sc-history-table .history-col-status { width: auto; }
.sc-history-table .history-col-photo { width: 154px; }
.sc-history-table .history-col-action { width: 78px; }
.sc-history-table .history-time-type {
    display: inline-flex;
    margin-top: 8px;
}
.sc-history-table .history-detail-meta {
    margin-top: 10px;
    display: grid;
    gap: 7px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(15, 23, 42, 0.72);
}
.sc-history-table .history-device-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.84);
    overflow-wrap: anywhere;
}
.sc-history-table .history-device-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sc-history-table .history-device-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.72);
    color: rgba(15, 23, 42, 0.78);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
}
.sc-history-table .history-compact-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}
.sc-history-table .history-compact-label {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.52);
}
.sc-history-table .history-compact-value {
    font-size: 12px;
    font-weight: 400;
    color: rgba(15, 23, 42, 0.78);
    overflow-wrap: anywhere;
}
.sc-history-table .history-validation-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
    gap: 6px;
}
.sc-history-table .history-validation-btn {
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.9);
    color: rgba(15, 23, 42, 0.8);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    padding: 4px 8px;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.sc-history-table .history-validation-btn:hover {
    background: rgba(15, 23, 42, 0.06);
}
.sc-history-table .history-validation-btn-approve {
    border-color: rgba(22, 163, 74, 0.35);
    color: rgba(21, 128, 61, 1);
    background: rgba(240, 253, 244, 0.95);
}
.sc-history-table .history-validation-btn-approve:hover {
    background: rgba(220, 252, 231, 0.95);
}
.sc-history-table .history-validation-btn-reject {
    border-color: rgba(220, 38, 38, 0.28);
    color: rgba(153, 27, 27, 1);
    background: rgba(254, 242, 242, 0.95);
}
.sc-history-table .history-validation-btn-reject:hover {
    background: rgba(254, 226, 226, 0.95);
}
.sc-history-table .history-validation-btn-edit {
    border-color: rgba(37, 99, 235, 0.28);
    color: rgba(29, 78, 216, 0.96);
    background: rgba(239, 246, 255, 0.95);
}
.sc-history-table .history-validation-btn-edit:hover {
    background: rgba(219, 234, 254, 0.95);
}

.history-validate-picker {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.history-validate-picker-btn {
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.95);
    color: rgba(15, 23, 42, 0.82);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 6px 12px;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.history-validate-picker-btn:hover {
    background: rgba(15, 23, 42, 0.06);
}
.history-validate-picker-btn-approve.is-active {
    border-color: rgba(22, 163, 74, 0.42);
    color: rgba(21, 128, 61, 1);
    background: rgba(220, 252, 231, 0.92);
}
.history-validate-picker-btn-reject.is-active {
    border-color: rgba(220, 38, 38, 0.36);
    color: rgba(153, 27, 27, 1);
    background: rgba(254, 226, 226, 0.95);
}
/* Image comparison */
.history-photo-compare-modal {
    max-height: min(92vh, 980px);
    overflow: auto;
}

.history-photo-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.history-photo-compare-figure {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.history-photo-compare-role {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #334155;
    text-align: center;
}

.history-photo-compare-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height:47.4vh;
    min-height: 420px;
    max-height:47.4vh;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 14px 28px rgba(15, 23, 42, 0.08);
}

.history-photo-compare-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: min(56vh, 560px);
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    background: #e5e7eb;
}

.history-photo-compare-caption {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

@media (max-width: 1360px) {
    .sc-history-table-wrap {
        overflow-x: hidden;
    }

    .sc-history-table thead {
        display: none;
    }

    .sc-history-table,
    .sc-history-table tbody,
    .sc-history-table .sc-history-row,
    .sc-history-table td {
        display: block;
        width: 100%;
    }

    .sc-history-table tbody {
        padding: 12px;
        background: transparent;
    }

    .sc-history-table tbody > :not([hidden]) ~ :not([hidden]) {
        border-top-width: 0 !important;
    }

    .sc-history-table .sc-history-row {
        border: 1px solid rgba(15, 23, 42, 0.10);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
        margin-bottom: 14px;
        overflow: hidden;
        display: grid;
        grid-template-columns: minmax(320px, 1.7fr) minmax(220px, 1fr);
        grid-template-areas:
            "time photo"
            "employee photo"
            "status photo"
            "action photo";
        align-items: start;
    }

    .sc-history-table .sc-history-row:last-child {
        margin-bottom: 0;
    }

    .sc-history-table .sc-history-row:hover {
        background: #ffffff;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    }

    .sc-history-table .sc-history-message-row {
        display: block;
        width: 100%;
        margin: 0;
    }

    .sc-history-table .sc-history-message-cell {
        display: block;
        width: 100%;
        border-right: 0;
        border-bottom: 0;
        text-align: center;
        white-space: normal !important;
    }

    .sc-history-table td {
        padding: 12px 16px !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        border-right: 1px solid rgba(15, 23, 42, 0.08);
        white-space: normal !important;
        width: auto !important;
        min-width: 0;
    }

    .sc-history-table .history-col-time { grid-area: time; }
    .sc-history-table .history-col-employee { grid-area: employee; }
    .sc-history-table .history-col-status { grid-area: status; }
    .sc-history-table .history-col-photo {
        grid-area: photo;
        border-right: 0;
        border-bottom: 0;
        display: flex;
        align-items: stretch;
    }
    .sc-history-table .history-col-action {
        grid-area: action;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
    }

    .sc-history-table .history-col-action {
        border-bottom: 0;
    }

    .sc-history-table .history-col-time .text-sm {
        font-size: 24px;
        font-weight: 700;
        line-height: 1.1;
    }

    .sc-history-table .history-col-time .text-xs {
        font-size: 14px;
        margin-top: 4px;
    }

    .sc-history-table .history-col-status {
        font-size: 14px;
    }

    .sc-history-table .history-detail-meta {
        display: grid;
        gap: 8px;
        font-size: 13px;
        line-height: 1.4;
        font-weight: 400;
        color: rgba(15, 23, 42, 0.78);
    }

    .sc-history-table .history-device-title {
        font-size: 16px;
        font-weight: 600;
        color: rgba(15, 23, 42, 0.92);
        overflow-wrap: anywhere;
    }

    .sc-history-table .history-device-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .sc-history-table .history-device-badge {
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(226, 232, 240, 0.72);
        color: rgba(15, 23, 42, 0.8);
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
    }

    .sc-history-table .history-compact-row {
        display: flex;
        align-items: baseline;
        gap: 6px;
        flex-wrap: wrap;
    }

    .sc-history-table .history-compact-label {
        font-size: 12px;
        font-weight: 400;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: rgba(15, 23, 42, 0.52);
        margin-right: 4px;
    }

    .sc-history-table .history-compact-value {
        font-size: 14px;
        font-weight: 400;
        color: rgba(15, 23, 42, 0.82);
        overflow-wrap: anywhere;
    }

    .sc-history-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(15, 23, 42, 0.52);
        margin-bottom: 8px;
    }

    .sc-history-table td[colspan] {
        text-align: center;
        border-bottom: 0;
    }

    .sc-history-table td[colspan]::before {
        content: none;
    }

    .sc-history-table .history-photo-wrap {
        width: 100%;
        min-height: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .sc-history-table .history-photo-status {
        font-size: 13px;
        font-weight: 700;
        align-self: flex-start;
    }

    .sc-history-table .history-photo-thumb-btn {
        width: 100%;
        min-width: 0;
        border-radius: 12px;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
        cursor: zoom-in;
        transition: transform 120ms ease, box-shadow 140ms ease;
        flex: 1 1 auto;
        min-height: 240px;
        padding: 0;
        overflow: hidden;
    }

    .sc-history-table .history-photo-thumb {
        width: 100% !important;
        height: 100% !important;
        min-height: 240px;
        border-radius: 10px;
        object-fit: cover;
        display: block;
    }

    .sc-history-table .history-photo-thumb-btn:hover {
        transform: translateY(-1px) scale(1.01);
        box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
    }

.sc-history-table .history-photo-meta {
    font-size: 12px;
    line-height: 1.25;
}

.history-photo-compare-modal {
    max-height: min(92vh, 980px);
    overflow: auto;
}

.history-photo-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.history-photo-compare-figure {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.history-photo-compare-role {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #334155;
    text-align: center;
}

.history-photo-compare-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 47.4vh;
    min-height: 420px;
    max-height: 47.4vh;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 14px 28px rgba(15, 23, 42, 0.08);
}

.history-photo-compare-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: min(56vh, 560px);
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    background: #e5e7eb;
}

.history-photo-compare-caption {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

@media (min-width: 768px) {
    .history-photo-compare-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
    }

    .history-photo-compare-frame {
        min-height: 500px;
        max-height: 70vh;
        padding: 22px;
    }

    .history-photo-compare-image {
        max-height: min(64vh, 640px);
    }
}

    .sc-history-table .history-card-delete-btn {
        min-width: 120px;
        justify-content: center;
        border: 1px solid rgba(239, 68, 68, 0.25);
        background: rgba(254, 242, 242, 0.72);
        color: #991b1b;
        box-shadow: none;
    }

    .sc-history-table .history-card-delete-btn:hover {
        background: rgba(254, 226, 226, 0.92);
    }

    .sc-history-table .history-col-action .text-xs {
        margin-left: auto;
    }
}

@media (max-width: 1180px) {
    .sc-history-table .sc-history-row {
        grid-template-columns: minmax(220px, 1fr) minmax(170px, 1fr);
        grid-template-areas:
            "time photo"
            "employee photo"
            "status photo"
            "action photo";
    }

    .sc-history-table .history-col-employee {
        border-right: 0;
    }

    .sc-history-table .history-col-photo {
        border-right: 1px solid rgba(15, 23, 42, 0.08);
        border-bottom: 0;
    }

    .sc-history-table .history-col-status {
        border-right: 0;
    }

    .sc-history-table .history-col-action {
        border-right: 0;
        border-bottom: 0;
        justify-content: flex-start;
    }

    .sc-history-table .history-photo-thumb-btn {
        width: 100%;
        min-width: 0;
        min-height: 210px;
    }

    .sc-history-table .history-photo-thumb {
        width: 100% !important;
        height: 100% !important;
        min-height: 210px;
    }

    .sc-history-table .history-col-time .text-sm {
        font-size: 23px;
    }

    .sc-history-table .history-col-time .text-xs {
        font-size: 14px;
    }
}

@media (max-width: 980px) {
    .sc-history-table .sc-history-row {
        grid-template-columns: minmax(220px, 1fr) minmax(150px, 1fr);
        grid-template-areas:
            "time status"
            "employee employee"
            "photo photo"
            "action action";
    }

    .sc-history-table .history-col-photo {
        border-right: 0;
    }

    .sc-history-table .history-photo-thumb-btn {
        min-height: 180px;
    }

    .sc-history-table .history-photo-thumb {
        min-height: 180px;
    }

    .sc-history-table .history-col-action {
        justify-content: flex-end;
    }

    .sc-history-table .history-col-time .text-sm {
        font-size: 22px;
    }

    .sc-history-table .history-col-time .text-xs {
        font-size: 13px;
    }
}

@media (max-width: 880px) {
    .sc-history-table .sc-history-row {
        grid-template-columns: 1fr;
        grid-template-areas:
            "time"
            "employee"
            "status"
            "photo"
            "action";
    }

    .sc-history-table .sc-history-row td {
        border-right: 0;
    }
}

/* Auth / Login */
.sc-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(24px, 4vw, 56px);
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 500px at 20% 15%, rgba(37, 99, 235, 0.18), transparent 55%),
        radial-gradient(700px 480px at 80% 30%, rgba(16, 185, 129, 0.14), transparent 55%),
        radial-gradient(900px 520px at 40% 90%, rgba(245, 158, 11, 0.10), transparent 55%),
        linear-gradient(180deg, var(--sc-bg-0) 0%, var(--sc-bg-1) 55%, var(--sc-bg-0) 100%);
}

/* Clock Station split layout */
.sc-clock-split {
    width: min(1060px, 100%);
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(320px, 420px);
    gap: 18px;
    align-items: start;
}

@media (max-width: 920px) {
    .sc-clock-split {
        grid-template-columns: 1fr;
    }
}

.sc-clock-panel {
    padding: 26px;
}

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

.sc-clock-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.sc-clock-statusline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.sc-clock-tool-status {
    width: 40px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.72);
    color: rgba(15, 23, 42, 0.78);
    padding: 0;
}

.sc-clock-tool-status svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.sc-clock-tool-status.is-disconnected {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(254, 226, 226, 0.85);
    color: rgba(153, 27, 27, 0.95);
}

.sc-clock-tool-status.is-connected {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(220, 252, 231, 0.85);
    color: rgba(21, 128, 61, 0.95);
}

.sc-clock-settings-card {
    width: min(460px, calc(100% - 32px));
}

.sc-clock-settings-actions {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.sc-clock-settings-row {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.70);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sc-clock-settings-label {
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.72);
}

.sc-camera-preview {
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.90);
    min-height: 300px;
    overflow: hidden;
}

.sc-camera-preview video {
    width: 100%;
    min-height: 300px;
    max-height: min(52vh, 420px);
    object-fit: cover;
    display: block;
}

.sc-clock-confirm-card {
    width: min(760px, calc(100% - 32px));
}

.sc-clock-confirm-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sc-clock-confirm-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sc-clock-confirm-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.68);
}

.sc-clock-confirm-frame {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    overflow: hidden;
    min-height: 260px;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.98), rgba(226, 232, 240, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.sc-clock-confirm-image {
    width: 100%;
    height: 100%;
    min-height: 260px;
    object-fit: cover;
    display: block;
    background: rgba(226, 232, 240, 0.95);
}

.sc-clock-queue-state {
    border: 1px dashed rgba(15, 23, 42, 0.20);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
    color: rgba(15, 23, 42, 0.74);
    font-size: 12px;
    font-weight: 650;
    padding: 10px 12px;
}


/* Clock Station: left welcome + right punch card */
.sc-clock-layout {
    width: min(1260px, 100%);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
    align-items: start;
}

@media (max-width: 980px) {
    .sc-clock-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .sc-camera-preview {
        min-height: 240px;
    }

    .sc-camera-preview video {
        min-height: 240px;
        max-height: min(44vh, 320px);
    }

    .sc-clock-confirm-grid {
        grid-template-columns: 1fr;
    }

    .sc-clock-confirm-frame,
    .sc-clock-confirm-image {
        min-height: 220px;
    }
}

.sc-welcome-card {
    border-radius: var(--sc-radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    padding: 26px 22px;
    color: rgba(255, 255, 255, 0.92);
    background:
        radial-gradient(520px 340px at 25% 15%, rgba(255, 255, 255, 0.22), transparent 60%),
        radial-gradient(520px 340px at 85% 30%, rgba(255, 255, 255, 0.10), transparent 60%),
        linear-gradient(135deg, rgba(29, 78, 216, 0.62) 0%, rgba(14, 165, 233, 0.52) 100%);
    backdrop-filter: blur(14px);
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sc-welcome-card.is-idle {
    background:
        radial-gradient(520px 340px at 25% 15%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.32) 0%, rgba(29, 78, 216, 0.22) 100%);
    opacity: 0.95;
}

.sc-welcome-card.is-idle .sc-welcome-avatar {
    display: none;
}

.sc-welcome-card.is-idle .sc-welcome-time {
    font-size: clamp(64px, 7.2vw, 88px);
}

.sc-welcome-card.is-idle .sc-welcome-date {
    margin-top: 14px;
    font-size: clamp(16px, 1.6vw, 22px);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.sc-welcome-card.is-in {
    background:
        radial-gradient(520px 340px at 25% 15%, rgba(255, 255, 255, 0.20), transparent 60%),
        linear-gradient(135deg, rgba(16, 185, 129, 0.52) 0%, rgba(14, 165, 233, 0.50) 100%);
}

.sc-welcome-card.is-out {
    background:
        radial-gradient(520px 340px at 25% 15%, rgba(255, 255, 255, 0.20), transparent 60%),
        linear-gradient(135deg, rgba(29, 78, 216, 0.56) 0%, rgba(99, 102, 241, 0.44) 100%);
}

.sc-welcome-card.is-error {
    background:
        radial-gradient(520px 340px at 25% 15%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(135deg, rgba(185, 28, 28, 0.62) 0%, rgba(220, 38, 38, 0.52) 100%);
}

.sc-welcome-card.is-error .sc-welcome-name {
    font-size: 24px;
    line-height: 1.24;
    max-width: 24ch;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.sc-welcome-card.is-error .sc-welcome-greet {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.sc-welcome-avatar {
    width: 168px;
    height: 168px;
    border-radius: 999px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 4px solid rgba(255, 255, 255, 0.20);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
    margin-top: 8px;
}

.sc-welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sc-welcome-initials {
    font-weight: 950;
    font-size: 46px;
    letter-spacing: -0.04em;
    color: rgba(255, 255, 255, 0.92);
    user-select: none;
}

.sc-welcome-greet {
    margin-top: 18px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.80);
}

.sc-welcome-name {
    margin-top: 6px;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 950;
    letter-spacing: -0.04em;
    color: rgba(255, 255, 255, 0.95);
}

.sc-welcome-sub {
    margin-top: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    max-width: 22ch;
}

.sc-welcome-bottom {
    margin-top: auto;
    padding-top: 18px;
    width: 100%;
}

.sc-welcome-time {
    font-size: 56px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.05em;
    color: rgba(255, 255, 255, 0.92);
}

.sc-welcome-date {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
}

.sc-profile-card {
    width: min(980px, 100%);
    margin-inline: auto;
}

.sc-emp {
    display: flex;
    flex-direction: column;
    min-height: 420px;
}

.sc-emp-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sc-emp-avatar {
    width: 88px;
    height: 88px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.95) 0%, rgba(14, 165, 233, 0.95) 100%);
    box-shadow: 0 16px 40px rgba(29, 78, 216, 0.22);
    overflow: hidden;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.sc-emp-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sc-emp-initials {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 850;
    font-size: 26px;
    letter-spacing: -0.03em;
    user-select: none;
}

.sc-emp-title {
    font-size: 13px;
    font-weight: 750;
    color: rgba(15, 23, 42, 0.62);
    letter-spacing: 0.01em;
}

.sc-emp-name {
    margin-top: 2px;
    font-size: 24px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: rgba(15, 23, 42, 0.92);
}

.sc-emp-sub {
    margin-top: 6px;
    font-size: 13px;
    color: rgba(15, 23, 42, 0.66);
}

.sc-emp-meta {
    margin-top: 18px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.72);
    padding: 14px 14px;
    display: grid;
    gap: 10px;
}

.sc-emp-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.70);
}

.sc-emp-row span:first-child {
    letter-spacing: 0.10em;
    text-transform: uppercase;
    font-size: 10px;
    color: rgba(15, 23, 42, 0.50);
}

.sc-emp-row span:last-child {
    font-weight: 750;
    color: rgba(15, 23, 42, 0.82);
    text-align: right;
}

.sc-emp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(15, 23, 42, 0.04);
    color: rgba(15, 23, 42, 0.78);
}

.sc-emp-badge.is-in {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.10);
    color: rgba(6, 95, 70, 0.95);
}

.sc-emp-badge.is-out {
    border-color: rgba(37, 99, 235, 0.22);
    background: rgba(37, 99, 235, 0.10);
    color: rgba(30, 58, 138, 0.95);
}

.sc-emp-bottom {
    margin-top: auto;
    padding-top: 16px;
}

.sc-emp-time {
    font-size: 54px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -0.04em;
    color: rgba(15, 23, 42, 0.90);
}

.sc-emp-date {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.62);
}

.sc-emp-inline {
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255, 255, 255, 0.62);
    padding: 14px 14px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
}

.sc-emp-inline.is-hidden {
    display: none;
}

.sc-emp-inline.is-error {
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.05);
}

.sc-clock-inline-error {
    margin-top: 10px;
    border-radius: 16px;
    border: 1px solid rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.08);
    padding: 12px 12px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
}

.sc-clock-inline-error-title {
    font-size: 16px;
    font-weight: 950;
    letter-spacing: -0.02em;
    color: rgba(185, 28, 28, 0.98);
}

.sc-clock-inline-error-msg {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    color: rgba(127, 29, 29, 0.92);
}

.sc-login::before {
    content: "";
    position: absolute;
    inset: -2px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.35;
    pointer-events: none;
    mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
}

.sc-card {
    width: min(440px, 100%);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--sc-radius-lg);
    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.35),
        0 2px 0 rgba(255, 255, 255, 0.25) inset;
    backdrop-filter: blur(12px);
    padding: 28px 26px;
    position: relative;
    isolation: isolate;
    animation: sc-rise 420ms ease-out both;
}

.sc-card-wide {
    width: min(720px, 100%);
}

.sc-input-lg {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 18px;
}

.sc-btn-lg {
    padding: 14px 18px;
    font-size: 15px;
    border-radius: 18px;
}

.sc-choice {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.78);
    padding: 16px 14px;
    font-size: 16px;
    font-weight: 750;
    color: rgba(15, 23, 42, 0.82);
    transition: transform 120ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.sc-choice:hover {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.22);
}

.sc-choice:active {
    transform: translateY(1px);
}

.sc-choice:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sc-choice:disabled:hover {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(15, 23, 42, 0.16);
}

.sc-choice:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus);
}

.sc-choice.is-selected {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.14);
    background: rgba(255, 255, 255, 0.96);
}

@keyframes sc-rise {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .sc-card { animation: none; }
}

.sc-title {
    font-size: 32px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-weight: 700;
    color: var(--sc-ink);
    text-align: center;
    margin: 10px 0 0;
}

.sc-form {
    margin-top: 20px;
    display: grid;
    gap: 14px;
}

.sc-field-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 2px;
}

.sc-field-actions > .sc-input {
    flex: 1 1 420px;
}

/* Settings: role-permission matrix */
.sc-perm-matrix-head {
    margin-bottom: 12px;
}

.sc-perm-matrix-title {
    font-size: 20px;
    font-weight: 750;
    color: rgba(15, 23, 42, 0.92);
    margin: 0 0 4px;
}

.sc-perm-matrix-desc {
    font-size: 13px;
    color: rgba(15, 23, 42, 0.62);
    margin: 0;
}

.sc-perm-matrix-wrap {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.8);
}

.sc-perm-matrix-table {
    width: 100%;
    min-width: 780px;
    border-collapse: separate;
    border-spacing: 0;
}

.sc-perm-matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(248, 250, 252, 0.98);
    border-bottom: 1px solid rgba(15, 23, 42, 0.14);
    color: rgba(15, 23, 42, 0.84);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 760;
    padding: 12px 14px;
    text-align: center;
}

.sc-perm-matrix-table .sc-perm-matrix-perm-col {
    text-align: left;
    min-width: 280px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: rgba(248, 250, 252, 0.98);
}

.sc-perm-matrix-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.55);
}

.sc-perm-matrix-table tbody tr:hover {
    background: rgba(239, 246, 255, 0.72);
}

.sc-perm-matrix-perm-name {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.86);
    padding: 10px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: inherit;
    white-space: nowrap;
}

.sc-perm-matrix-checkbox-cell {
    text-align: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.sc-perm-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2563eb;
}

.sc-perm-matrix-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

/* Responsive tweaks for permission matrix */
.sc-perm-role-label {
    display: none;
}



@media (max-width: 1024px) {
    /* stack permission rows into cards for very narrow screens */
    .sc-perm-matrix-table,
    .sc-perm-matrix-table thead,
    .sc-perm-matrix-table tbody,
    .sc-perm-matrix-table th,
    .sc-perm-matrix-table td,
    .sc-perm-matrix-table tr {
        display: block;
    }
    .sc-perm-matrix-table {
        min-width: 0;          /* let the columns wrap */
        table-layout: fixed;
    }
    .sc-perm-matrix-wrap {
         overflow-x: hidden;    /* hide the horizontal scrollbar */
    }

    .sc-perm-matrix-table thead {
        position: relative;
        /* hide header row visually but keep for assistive tech */
        height: 0;
        overflow: hidden;
    }
    .sc-perm-matrix-table tr {
        margin-bottom: 12px;
        padding: 6px 0;
    }
    .sc-perm-matrix-perm-name {
        position: static;
        left: auto;
        background: transparent;
        font-size: 14px;
        margin: 0 0 4px;
        padding: 0 12px;
    }
    .sc-perm-matrix-checkbox-cell {
        display: inline-block;
        width: fit-content;
        padding: 4px;
        white-space: nowrap;
    }
    .sc-perm-matrix-checkbox-cell input {
        margin: 0;
    }
    .sc-perm-role-label {
        display: inline-block;
        margin-left: 4px;
        font-size: 13px;
        vertical-align: middle;
    }
}

/* Reports: employee daily matrix + absence heatmap */
.sc-reports-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sc-reports-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.78);
}

.sc-reports-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.sc-reports-legend-dot-present {
    background: #10b981;
}

.sc-reports-legend-dot-partial {
    background: #f59e0b;
}

.sc-reports-legend-dot-absent {
    background: #ef4444;
}

.sc-report-matrix-table {
    width: 100%;
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    overflow: hidden;
}

.sc-report-matrix-desktop {
    display: block;
}

.sc-report-matrix-mobile {
    display: none;
}

.sc-report-matrix-table thead th {
    background: rgba(248, 250, 252, 0.95);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    color: rgba(15, 23, 42, 0.7);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 10px 8px;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
}

.sc-report-matrix-table thead th:first-child {
    text-align: left;
    min-width: 190px;
    position: sticky;
    left: 0;
    z-index: 3;
}

.sc-report-matrix-table tbody td {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    border-right: 1px solid rgba(15, 23, 42, 0.06);
    padding: 8px;
    text-align: center;
    font-size: 12px;
    background: #ffffff;
}

.sc-report-matrix-table tbody tr:last-child td {
    border-bottom: 0;
}

.sc-report-matrix-table tbody td:last-child {
    border-right: 0;
}

.sc-report-matrix-employee {
    text-align: left !important;
    min-width: 190px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8fafc !important;
}

.sc-report-matrix-employee-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.92);
}

.sc-report-matrix-employee-shift {
    font-size: 11px;
    color: rgba(15, 23, 42, 0.62);
    margin-top: 2px;
}

.sc-report-matrix-day {
    min-width: 72px;
    vertical-align: middle;
}

.sc-report-matrix-bar {
    height: 6px;
    border-radius: 999px;
    margin-bottom: 6px;
    opacity: 0.95;
}

.sc-report-matrix-bar-present {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.sc-report-matrix-bar-partial {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.sc-report-matrix-bar-absent {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

.sc-report-matrix-value {
    color: rgba(15, 23, 42, 0.8);
    font-size: 11px;
    font-weight: 600;
}

.sc-report-matrix-day-present {
    background: rgba(16, 185, 129, 0.08) !important;
}

.sc-report-matrix-day-partial {
    background: rgba(245, 158, 11, 0.10) !important;
}

.sc-report-matrix-day-absent {
    background: rgba(239, 68, 68, 0.08) !important;
}

.sc-report-matrix-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #ffffff;
    padding: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.sc-report-matrix-card + .sc-report-matrix-card {
    margin-top: 14px;
}

.sc-report-matrix-card-header {
    margin-bottom: 12px;
}

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

.sc-report-matrix-card-day {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 10px 12px;
}

.sc-report-matrix-card-date {
    font-size: 11px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.72);
    margin-bottom: 4px;
}

.sc-report-matrix-card-status {
    font-size: 12px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.84);
    margin-bottom: 8px;
}

.sc-report-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.sc-report-heatmap-cell {
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 10px;
}

.sc-report-heatmap-date {
    font-size: 11px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.72);
    margin-bottom: 8px;
}

.sc-report-heatmap-meta {
    font-size: 11px;
    color: rgba(15, 23, 42, 0.78);
}

.sc-report-heatmap-low {
    background: rgba(16, 185, 129, 0.08);
}

.sc-report-heatmap-medium {
    background: rgba(245, 158, 11, 0.12);
}

.sc-report-heatmap-high {
    background: rgba(239, 68, 68, 0.14);
}

.sc-report-heatmap-critical {
    background: rgba(185, 28, 28, 0.2);
}

@media (max-width: 900px) {
    .sc-report-matrix-desktop {
        display: none;
    }

    .sc-report-matrix-mobile {
        display: block;
    }

    .sc-report-matrix-card-grid {
        grid-template-columns: 1fr;
    }

    .sc-perm-matrix-title {
        font-size: 18px;
    }

    .sc-perm-matrix-table {
        min-width: 680px;
    }

    .sc-perm-matrix-table .sc-perm-matrix-perm-col {
        min-width: 230px;
    }
}

@media (max-width: 640px) {
    .sc-field-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .sc-field-actions > .sc-input {
        /* In column layout, the desktop flex-basis must be removed to avoid oversized controls. */
        flex: 0 1 auto;
        width: 100%;
        min-width: 0;
    }

    .sc-field-actions > .sc-btn {
        width: 100%;
    }
}

.sc-field label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sc-muted);
    margin: 0 2px 7px;
}

.sc-field-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 2px 7px;
}

.sc-field-row label {
    margin: 0;
}

.sc-iconbtn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 0;
    background: rgba(15, 23, 42, 0.04);
    color: rgba(15, 23, 42, 0.70);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 140ms ease, transform 120ms ease, box-shadow 140ms ease, color 140ms ease;
}

.sc-iconbtn:hover {
    background: rgba(15, 23, 42, 0.07);
    color: rgba(15, 23, 42, 0.82);
}

.sc-iconbtn:active {
    transform: translateY(1px);
}

.sc-iconbtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus);
}

.sc-iconbtn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.sc-collapsible.is-collapsed {
    display: none;
}

.sc-collapsible {
    display: block;
}

.sc-hint {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sc-muted-2);
}

.sc-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--sc-radius-md);
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.85);
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.25;
    min-height: 46px;
    color: var(--sc-ink);
    transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease;
}

/* Native <select> dropdown items often render smaller than inputs; increase readability. */
select.sc-input {
    font-size: var(--sc-select-font);
}

select.sc-input option {
    font-size: inherit;
    line-height: var(--sc-select-option-line);
}

.sc-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 5px var(--sc-focus);
    background: rgba(255, 255, 255, 0.98);
}

.sc-input.sc-invalid {
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: 0 0 0 5px var(--sc-danger-focus);
    background: rgba(255, 255, 255, 0.98);
}

.sc-error {
    margin: 8px 2px 0;
    font-size: 12px;
    color: var(--sc-danger);
    display: none;
}

.sc-error.sc-visible { display: block; }

.sc-passwrap { position: relative; }
.sc-input.sc-password { padding-right: 54px; }

.sc-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: var(--sc-radius-sm);
    padding: 9px 10px;
    border: 0;
    background: transparent;
    color: rgba(15, 23, 42, 0.72);
    transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.sc-toggle:hover {
    background: rgba(15, 23, 42, 0.06);
    color: rgba(15, 23, 42, 0.85);
}

.sc-toggle:active { transform: translateY(-50%) scale(0.98); }

.sc-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus-strong);
    background: rgba(255, 255, 255, 0.92);
}

.sc-caps {
    display: none;
    font-size: 12px;
    color: rgba(180, 83, 9, 0.95);
    margin: 6px 2px 0;
}

.sc-actions { margin-top: 4px; }

.sc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    user-select: none;
    white-space: nowrap;
    border-radius: var(--sc-radius-md);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-primary-2) 100%);
    box-shadow: 0 16px 36px rgba(29, 78, 216, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.sc-btn:hover {
    filter: brightness(1.03);
    box-shadow: 0 18px 44px rgba(29, 78, 216, 0.34);
}

.sc-btn:active { transform: translateY(1px); }

.sc-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-warn-focus), 0 18px 44px rgba(29, 78, 216, 0.30);
}

.sc-btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.sc-btn-loading {
    position: relative;
    padding-left: 36px;
}

.sc-btn-loading::before {
    content: "";
    position: absolute;
    left: 14px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: sc-btn-spin 700ms linear infinite;
}

@keyframes sc-btn-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sc-btn-block {
    width: 100%;
}

.sc-btn-sm {
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 14px;
}

.sc-btn-outline {
    background: rgba(255, 255, 255, 0.92);
    color: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.14);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
}

.sc-btn-outline:hover {
    filter: none;
    background: rgba(15, 23, 42, 0.04);
}

.sc-btn-outline:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus), 0 10px 24px rgba(2, 6, 23, 0.06);
}

.sc-btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: rgba(127, 29, 29, 0.32);
    box-shadow: 0 16px 36px rgba(220, 38, 38, 0.28);
}

.sc-btn-danger:hover {
    box-shadow: 0 18px 44px rgba(220, 38, 38, 0.32);
}

.sc-iconbtn.sc-iconbtn-sm {
    width: 30px;
    height: 30px;
}

.sc-iconbtn.sc-iconbtn-danger {
    background: rgba(220, 38, 38, 0.10);
    color: rgba(185, 28, 28, 0.95);
}

.sc-iconbtn.sc-iconbtn-danger:hover {
    background: rgba(220, 38, 38, 0.17);
    color: rgba(153, 27, 27, 0.98);
}

:root {
    --sc-toast-right: calc(16px + env(safe-area-inset-right));
    --sc-toast-bottom: calc(16px + env(safe-area-inset-bottom));
    --sc-toast-avoid-bottom: 0px;
}

.sc-toast-stack {
    position: fixed;
    right: var(--sc-toast-right);
    bottom: calc(var(--sc-toast-bottom) + var(--sc-toast-avoid-bottom));
    z-index: 60;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    width: min(calc(100vw - 24px), 24rem);
    pointer-events: none;
}

.sc-toast {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    padding: 14px 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
    transform: translateY(10px);
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    pointer-events: auto;
    backdrop-filter: blur(16px);
    cursor: pointer;
}

.sc-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.sc-toast.is-success {
    background: rgba(240, 253, 244, 0.97);
    border-color: rgba(134, 239, 172, 0.92);
    color: rgb(22, 101, 52);
}

.sc-toast.is-error {
    background: rgba(254, 242, 242, 0.98);
    border-color: rgba(252, 165, 165, 0.95);
    color: rgb(153, 27, 27);
}

.sc-toast.is-warning {
    background: rgba(255, 251, 235, 0.98);
    border-color: rgba(253, 224, 71, 0.92);
    color: rgb(146, 64, 14);
}

.sc-toast.is-info {
    background: rgba(239, 246, 255, 0.98);
    border-color: rgba(147, 197, 253, 0.92);
    color: rgb(30, 64, 175);
}

/* Subtle corner navigation (used for "Back to Dashboard" on Clock Station) */
.sc-cornerlink {
    appearance: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 140ms ease, transform 120ms ease, background-color 140ms ease, box-shadow 140ms ease;
    backdrop-filter: blur(10px);
}

.sc-cornerlink:hover {
    opacity: 0.95;
    background: rgba(255, 255, 255, 0.12);
}

.sc-cornerlink:active {
    transform: translateY(1px);
}

.sc-cornerlink:focus-visible {
    outline: none;
    opacity: 1;
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.20);
}

/* Back-to-top button (appears after scrolling). */
.sc-topbtn {
    position: fixed;
    right: 16px;
    bottom: 28px;
    z-index: 45;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(255, 255, 255, 0.92);
    color: rgba(15, 23, 42, 0.85);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.10);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 160ms ease, transform 160ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.sc-topbtn.is-visible {
    opacity: 0.92;
    pointer-events: auto;
    transform: translateY(0);
}

.sc-topbtn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.14);
}

.sc-topbtn:active {
    transform: translateY(1px);
}

.sc-topbtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 5px var(--sc-focus), 0 14px 34px rgba(2, 6, 23, 0.14);
}

@media (max-width: 640px) {
    :root {
        --sc-toast-right: calc(12px + env(safe-area-inset-right));
        --sc-toast-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .sc-toast-stack {
        width: min(calc(100vw - 20px), 22rem);
        gap: 10px;
    }

    .sc-toast {
        border-radius: 14px;
        padding: 12px 14px;
        font-size: 0.92rem;
    }

    .sc-topbtn {
        right: 12px;
        bottom: 20px;
    }

    .sc-cornerlink {
        right: 12px;
        bottom: 12px;
        padding: 9px 10px;
        border-radius: 14px;
        font-size: 12px;
    }

    .sc-topbtn {
        right: 12px;
        bottom: 12px;
        padding: 9px 10px;
        border-radius: 14px;
        font-size: 12px;
    }
}

/* Profile image uploader */
.sc-profile-upload {
    border: 1px dashed rgba(15, 23, 42, 0.22);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.7);
    padding: 12px;
}

.sc-profile-upload.is-dragover {
    border-color: rgba(37, 99, 235, 0.7);
    background: rgba(219, 234, 254, 0.45);
}

.sc-profile-dropzone {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: white;
    padding: 14px;
    text-align: center;
    cursor: pointer;
}

.sc-profile-dropzone:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.sc-profile-drop-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.9);
}

.sc-profile-drop-sub {
    font-size: 12px;
    margin-top: 6px;
    color: rgba(71, 85, 105, 0.9);
}

.sc-profile-preview-wrap {
    margin-top: 10px;
}

.sc-profile-preview-wrap.is-hidden {
    display: none;
}

.sc-profile-preview {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(241, 245, 249, 0.9);
}

.sc-profile-preview-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.sc-profile-preview-meta {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(71, 85, 105, 0.95);
}

.sc-profile-upload-error {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(185, 28, 28, 1);
    display: none;
}

.sc-bio-slots-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.sc-bio-enroll-modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sc-bio-enroll-panel {
    width: min(100%, 72rem);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin: auto;
}

@media (min-width: 900px) {
    .sc-bio-slots-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (min-width: 1280px) {
    .sc-bio-slots-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (max-height: 760px) {
    .sc-bio-enroll-modal {
        align-items: flex-start;
    }

    .sc-bio-enroll-panel {
        margin-top: 12px;
        margin-bottom: 12px;
    }
}

.sc-bio-slot {
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.75);
    padding: 10px;
}

.sc-bio-dropzone {
    border: 1px dashed rgba(15, 23, 42, 0.22);
    border-radius: 10px;
    min-height: 112px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.sc-bio-slot.is-dragover .sc-bio-dropzone {
    border-color: rgba(37, 99, 235, 0.75);
    background: rgba(219, 234, 254, 0.42);
}

.sc-bio-slot.is-error .sc-bio-dropzone {
    border-color: rgba(220, 38, 38, 0.72);
    background: rgba(254, 226, 226, 0.45);
}

.sc-bio-dropzone:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.sc-bio-drop-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.9);
}

.sc-bio-drop-sub {
    font-size: 12px;
    color: rgba(71, 85, 105, 0.9);
    margin-top: 4px;
}

.sc-bio-placeholder.is-hidden {
    display: none;
}

.sc-bio-preview {
    width: 100%;
    max-height: 220px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(15, 23, 42, 0.14);
    background: rgba(241, 245, 249, 0.95);
}

.sc-bio-preview.is-hidden {
    display: none;
}

.sc-bio-slot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sc-bio-meta {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(71, 85, 105, 0.95);
    word-break: break-word;
}

.sc-bio-error {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(185, 28, 28, 0.95);
    word-break: break-word;
}

.sc-bio-error.sc-visible {
    display: block;
}

.sc-bio-error.sc-success {
    color: rgba(21, 128, 61, 0.95);
}

.sc-card-request-modal-panel {
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.sc-card-request-form {
    gap: 18px;
}

.sc-card-request-employee-section {
    display: grid;
    gap: 10px;
}

.sc-card-request-picker-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.sc-card-request-browser-column,
.sc-card-request-selected-column {
    min-width: 0;
}

.sc-card-request-browser {
    overflow-y: auto;
    max-height: min(36vh, 18rem);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.sc-card-request-browser-state {
    margin-bottom: 0;
}

.sc-card-request-selected-list {
    max-height: min(30vh, 14rem);
    overflow-y: auto;
    background: rgba(248, 250, 252, 0.72);
}

.sc-card-request-actions {
    margin-top: 2px;
}

@media (min-width: 960px) {
    .sc-card-request-modal-panel {
        max-width: 58rem;
    }

    .sc-card-request-picker-grid {
        grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.9fr);
        gap: 14px;
    }

    .sc-card-request-browser,
    .sc-card-request-selected-list {
        max-height: min(42vh, 22rem);
    }
}

@media (max-height: 760px) {
    .sc-card-request-modal-panel {
        margin-top: 12px;
        margin-bottom: 12px;
    }

    .sc-card-request-browser {
        max-height: min(32vh, 14rem);
    }

    .sc-card-request-selected-list {
        max-height: min(24vh, 11rem);
    }
}

.sc-employee-photo-cell {
    width: 96px;
}

.sc-employee-photo-box {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(248, 250, 252, 0.92);
    display: grid;
    place-items: center;
}

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

.sc-employee-photo-placeholder {
    font-size: 14px;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.45);
}

@media (max-width: 920px) {
    #employeeTableBody .sc-employee-photo-cell {
        width: auto;
    }

    #employeeTableBody .sc-employee-photo-box {
        width: 72px;
        height: 72px;
        border-radius: 14px;
    }

    #employeeTableBody .sc-employee-primary,
    #employeeTableBody .sc-employee-secondary,
    #employeeTableBody .sc-employee-contact-primary {
        font-size: 15px;
        line-height: 1.4;
    }

    #employeeTableBody .sc-employee-meta,
    #employeeTableBody .sc-employee-contact-secondary {
        font-size: 14px;
        line-height: 1.45;
    }

    #employeeTableBody .sc-employee-badge,
    #employeeTableBody .sc-employee-status-badge {
        font-size: 12px;
        line-height: 1.35;
        padding: 6px 10px;
    }
}

/* Cropper modal */
.sc-image-cropper-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sc-image-cropper-modal.is-hidden {
    display: none;
}

.sc-image-cropper-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
}

.sc-image-cropper-panel {
    position: relative;
    width: min(560px, 100%);
    border-radius: 18px;
    background: white;
    box-shadow: 0 30px 90px rgba(2, 6, 23, 0.35);
    padding: 16px;
}

.sc-image-cropper-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.sc-image-cropper-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.sc-image-cropper-hint {
    margin: 8px 0 0;
    color: rgba(71, 85, 105, 0.95);
    font-size: 13px;
}

.sc-image-cropper-stage {
    margin-top: 14px;
    background: rgba(15, 23, 42, 0.92);
    border-radius: 14px;
    padding: 10px;
    display: flex;
    justify-content: center;
}

.sc-image-cropper-stage canvas {
    width: min(320px, 100%);
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    touch-action: none;
    cursor: grab;
}

.sc-image-cropper-stage canvas:active {
    cursor: grabbing;
}

.sc-image-cropper-controls {
    margin-top: 12px;
}

.sc-image-cropper-controls label {
    display: block;
    font-size: 12px;
    color: rgba(71, 85, 105, 0.95);
}

.sc-image-cropper-controls input[type="range"] {
    width: 100%;
    margin-top: 6px;
}

.sc-image-cropper-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
