:root {
    --color-shadow-alpha-0: transparent;
    --color-shadow-alpha-3: rgba(0, 0, 0, 0.03);
    --color-shadow-alpha-5: rgba(0, 0, 0, 0.05);
    --color-shadow-alpha-8: rgba(0, 0, 0, 0.08);
    --color-shadow-alpha-12: rgba(0, 0, 0, 0.12);
    --color-midnight-100: 246 248 251;
    --color-midnight-150: 232 237 243;
    --color-midnight-200: 228 235 255;
    --color-midnight-750: 35 44 73;
    --color-midnight-800: 28 35 56;
    --color-midnight-850: 21 26 40;
    --color-midnight-900: 14 17 27;
    --color-slate-100: 251 252 254;
    --color-slate-150: 241 245 255;
    --color-slate-600: 100 116 139;
    --color-slate-800: 30 41 59;
    --color-slate-900: 15 23 42;
    --color-emerald-main: 16 185 129;
    --color-emerald-hover: 5 150 105;
    --color-red-alert-bg: 254 242 242;
    --color-red-alert-text: 153 27 27;
    --color-red-alert-border: 252 165 165;
    --color-background-100: var(--color-midnight-100);
    --color-background-150: var(--color-midnight-150);
    --color-foreground-800: var(--color-slate-800);
    --color-foreground-muted: var(--color-slate-600);
    --color-card-surface: 245 247 250;
    --color-border-rgb: 226 232 240;
    --color-metric-alert-bg: var(--color-red-alert-bg);
    --color-metric-alert-txt: var(--color-red-alert-text);
    --color-metric-alert-brd: var(--color-red-alert-border);
    --bg: #e8edf3;
    --surface: #f5f7fa;
    --surface-soft: #eef3f8;
    --surface-strong: #eaf4ff;
    --border: #dbe8f5;
    --border-strong: #9fb8d3;
    --text: #10233d;
    --text-muted: #60748d;
    --text-soft: #7d8ea5;
    --primary: #075cb3;
    --primary-bright: #1cb2f8;
    --teal: #199d9a;
    --green: #63ba1a;
    --lime: #b8ea11;
    --danger: #d83a52;
    --warning: #d98324;
    --success: #1f9d63;
    --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 20px 50px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 28px 80px rgba(7, 92, 179, 0.14);
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --content-width: 1480px;
    --font-main: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

:root[data-theme="dark"] {
    --color-background-100: var(--color-midnight-900);
    --color-background-150: var(--color-midnight-850);
    --color-foreground-800: 241 245 249;
    --color-foreground-muted: 148 163 184;
    --color-card-surface: var(--color-midnight-800);
    --color-border-rgb: var(--color-midnight-750);
    --color-metric-alert-bg: 69 10 10;
    --color-metric-alert-txt: 254 226 226;
    --color-metric-alert-brd: 153 27 27;
    --bg: rgb(var(--color-background-150));
    --surface: rgb(var(--color-card-surface));
    --surface-soft: rgb(var(--color-midnight-850));
    --surface-strong: rgb(var(--color-midnight-750));
    --border: rgb(var(--color-border-rgb));
    --border-strong: #415678;
    --text: rgb(var(--color-foreground-800));
    --text-muted: rgb(var(--color-foreground-muted));
    --text-soft: #94a3b8;
    --primary: #56b9ff;
    --primary-bright: #6ee7ff;
    --teal: #4fd1c5;
    --green: #7bdc42;
    --danger: #ff6b81;
    --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 20px 50px rgba(0, 0, 0, 0.36);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
    color-scheme: dark;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    min-width: 320px;
    background:
        radial-gradient(circle at top left, rgba(28, 178, 248, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(99, 186, 26, 0.1), transparent 26%),
        linear-gradient(180deg, #f1f4f8 0%, var(--bg) 52%, #dfe6ee 100%);
    color: var(--text);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.6;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

td,
th,
.number,
.amount,
.money,
.metric-value,
.payroll-sheet-table,
.responsive-table {
    font-variant-numeric: tabular-nums;
}

code,
pre,
kbd,
samp,
.formula,
.formula-input {
    font-family: var(--font-mono);
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(86, 185, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(79, 209, 197, 0.12), transparent 26%),
        linear-gradient(180deg, #07111f 0%, #0a1524 52%, #08111d 100%);
}

/* Form controls: keep checkboxes consistent and not oversized. */
input[type="checkbox"] {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    accent-color: #075CB3;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: #0d72d6;
}

img {
    max-width: 100%;
    display: block;
}

button:not(.employee-icon-action),
.button-link,
.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.8rem 1.15rem;
    border-radius: 14px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.button-link,
.primary-action {
    background: linear-gradient(135deg, var(--primary), var(--primary-bright));
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(7, 92, 179, 0.18);
}

.button-link:hover,
.primary-action:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.button-link.ghost,
.ghost {
    background: var(--surface);
    color: var(--primary);
    border-color: rgba(7, 92, 179, 0.18);
    box-shadow: none;
}

.button-link.ghost:hover,
.ghost:hover {
    background: var(--surface-soft);
    color: var(--primary);
}

.app-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    display: grid;
    gap: 1.5rem;
    padding: clamp(0.85rem, 2vw, 1.2rem);
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: linear-gradient(180deg, rgba(8, 35, 78, 0.98), rgba(7, 92, 179, 0.96));
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.15rem;
    box-shadow: var(--shadow-lg);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.4rem 0.4rem 1.15rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
}

.sidebar-brand p {
    margin: 0.3rem 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
}

.sidebar .primary-action {
    width: 100%;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #1cb2f8, #63ba1a);
    color: #0a1d35;
    box-shadow: 0 18px 28px rgba(4, 17, 36, 0.22);
}

.side-nav {
    display: grid;
    gap: 0.45rem;
}

.side-nav a {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.84);
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.side-nav a:hover,
.side-nav a.active {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    transform: translateX(2px);
}

.page-shell {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.topbar {
    margin-bottom: 0.85rem;
    border-radius: 24px;
    padding: 0.68rem 0.95rem;
    background: rgb(var(--color-card-surface) / 0.92);
    border: 1px solid rgb(var(--color-border-rgb) / 0.78);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.topbar-main,
.topbar-side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-main {
    min-width: 0;
    flex: 1 1 520px;
    justify-content: flex-start;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-width: 0;
}

.welcome-block {
    min-width: 0;
}

.welcome-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.02rem;
}

.topbar-brand-wordmark {
    display: grid;
    gap: 0.08rem;
}

.topbar-home-link {
    text-decoration: none;
}

.topbar-home-link:hover strong,
.topbar-home-link:hover span {
    color: #0f65d9;
}

.topbar-brand-wordmark strong {
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
}

.topbar-brand-wordmark span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.topbar-logo-link {
    flex: 0 0 auto;
}

.topbar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
    border: 0;
}

.eyebrow {
    margin: 0 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}

.topbar h2 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.2;
}

.topbar p {
    margin: 0.08rem 0 0;
    color: var(--text-muted);
    font-size: 0.81rem;
}

.sidebar-toggle {
    width: 2.05rem;
    min-width: 2.05rem;
    height: 2.05rem;
    min-height: 2.05rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgb(var(--color-border-rgb) / 0.9);
    background: rgb(var(--color-card-surface));
    color: var(--primary);
    line-height: 1;
    font-size: 0.92rem;
}

.theme-toggle-panel {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem;
    border: 1px solid rgb(var(--color-border-rgb) / 0.9);
    border-radius: 12px;
    background: rgb(var(--color-card-surface) / 0.82);
}

.btn-toggle-ui {
    min-height: 34px;
    padding: 0.48rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    font-size: 0.79rem;
    font-weight: 800;
}

.btn-toggle-ui:hover,
.btn-toggle-ui.active {
    background: var(--surface-soft);
    color: var(--text);
    border-color: rgb(var(--color-border-rgb) / 0.85);
}

.btn-toggle-ui.active {
    box-shadow: 0 8px 18px rgba(7, 92, 179, 0.1);
}

.text-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.text-action {
    font-weight: 700;
    font-size: 0.9rem;
}

button.text-action {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
    line-height: inherit;
}

button.text-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.topbar-side {
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
}

.text-action.blue { color: var(--primary); }
.text-action.red { color: var(--danger); }
.text-action.green { color: var(--success); }
.text-action.teal { color: var(--teal); }
.text-action.orange { color: var(--warning); }
.text-action.slate { color: var(--text-muted); }

.page {
    display: grid;
    gap: 1.3rem;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.2rem;
    min-width: 0;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(7, 92, 179, 0.12);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.flash.error,
.flash.danger {
    border-color: rgba(216, 58, 82, 0.18);
    background: rgb(var(--color-metric-alert-bg) / 0.95);
    color: rgb(var(--color-metric-alert-txt));
}

.flash.success {
    border-color: rgba(31, 157, 99, 0.18);
    background: #f1fbf5;
    color: #176d46;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
    gap: 1.2rem;
    align-items: stretch;
}

.hero-card,
.card {
    background: rgb(var(--color-card-surface) / 0.96);
    border: 1px solid rgb(var(--color-border-rgb) / 0.68);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-card {
    padding: 1.45rem 1.55rem;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -8% -35% auto;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(28, 178, 248, 0.18), transparent 68%);
    pointer-events: none;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: rgba(7, 92, 179, 0.08);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-card h1 {
    margin: 0;
    max-width: 14ch;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.hero-card p {
    max-width: 62ch;
    margin: 0.95rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.3rem;
}

.hero-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.3rem;
}

.hero-point {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border: 1px solid rgb(var(--color-border-rgb) / 0.55);
}

.hero-point strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 1.05rem;
}

.hero-point span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.hero-side-panel {
    padding: 1.3rem;
    display: grid;
    gap: 1rem;
    background:
        linear-gradient(135deg, rgba(7, 92, 179, 0.96), rgba(28, 178, 248, 0.96));
    color: #ffffff;
}

.hero-side-panel h2,
.hero-side-panel h3 {
    margin: 0;
}

.hero-side-panel p {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
}

.hero-side-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.hero-side-stat {
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-side-stat span {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.hero-side-stat strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.35rem;
}

.hero-side-list {
    display: grid;
    gap: 0.7rem;
}

.hero-side-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.92rem;
}

.hero-side-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.25rem;
}

.dashboard-heading h1 {
    margin: 0;
    font-size: clamp(1.65rem, 2.6vw, 2.3rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.dashboard-heading p {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    max-width: 64ch;
}

.dashboard-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.stat {
    grid-column: span 3;
    padding: 1.15rem 1.2rem;
}

.stat.success {
    background: linear-gradient(180deg, var(--surface), rgba(31, 157, 99, 0.08));
}

.stat.warning {
    background: linear-gradient(180deg, var(--surface), rgba(217, 131, 36, 0.1));
}

.stat.emphasis {
    background: linear-gradient(180deg, var(--surface), rgba(7, 92, 179, 0.1));
}

.stat span {
    display: block;
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat strong {
    display: block;
    margin-top: 0.35rem;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    line-height: 1.1;
}

.stat small {
    display: block;
    margin-top: 0.45rem;
    color: var(--text-soft);
    font-size: 0.87rem;
}

.stat-link {
    color: inherit;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stat-link:hover,
.stat-link:focus {
    transform: translateY(-2px);
    border-color: rgba(7, 92, 179, 0.22);
    box-shadow: 0 18px 38px rgba(7, 92, 179, 0.12);
    outline: none;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.8rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 700;
}

.stat-trend.up {
    background: rgba(31, 157, 99, 0.1);
    color: #18754b;
}

.stat-trend.down {
    background: rgba(216, 58, 82, 0.1);
    color: #9c223a;
}

.stat-triangle {
    font-size: 0.78rem;
}

.dashboard-grid,
.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.leave-page-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    width: 100%;
}

.leave-page-stack > .card,
#leave-balances {
    width: 100%;
    min-width: 0;
}

.dashboard-bottom > .card,
.dashboard-grid > .card,
.two-col > .card,
.card {
    padding: 1.2rem;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-head h3 {
    margin: 0;
    font-size: 1.08rem;
}

.section-head p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(7, 92, 179, 0.08);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
}

.focus-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.focus-item {
    padding: 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border: 1px solid rgb(var(--color-border-rgb) / 0.55);
}

.focus-item strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.focus-item span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.action-grid {
    display: grid;
    gap: 0.75rem;
}

.action-grid.single-column {
    grid-template-columns: 1fr;
}

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

.action-tile {
    display: block;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border: 1px solid rgb(var(--color-border-rgb) / 0.55);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.action-tile:hover {
    border-color: rgba(7, 92, 179, 0.2);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.action-tile strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.action-tile span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
}

/* Desktop overflow guard for wide tables (keeps layout stable under zoom). */
.table-scroll {
    width: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    padding-bottom: 0.65rem;
    overscroll-behavior-x: contain;
    scrollbar-color: rgba(7, 92, 179, 0.62) rgba(226, 232, 240, 0.86);
    scrollbar-width: auto;
}

.table-scroll > .responsive-table {
    width: max-content;
    min-width: max(100%, 860px);
}

.table-scroll::-webkit-scrollbar,
.payroll-sheet-wrap::-webkit-scrollbar,
.employee-table-scroll::-webkit-scrollbar {
    height: 14px;
    width: 14px;
}

.table-scroll::-webkit-scrollbar-track,
.payroll-sheet-wrap::-webkit-scrollbar-track,
.employee-table-scroll::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.9);
}

.table-scroll::-webkit-scrollbar-thumb,
.payroll-sheet-wrap::-webkit-scrollbar-thumb,
.employee-table-scroll::-webkit-scrollbar-thumb {
    border: 3px solid rgba(226, 232, 240, 0.9);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-bright));
}

.table-scroll::-webkit-scrollbar-thumb:hover,
.payroll-sheet-wrap::-webkit-scrollbar-thumb:hover,
.employee-table-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #064a91, var(--primary-bright));
}

.responsive-table th,
.responsive-table td {
    padding: 0.95rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid rgb(var(--color-border-rgb) / 0.55);
    font-size: 0.94rem;
    vertical-align: top;
}

.responsive-table th {
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.responsive-table tbody tr:hover {
    background: rgba(7, 92, 179, 0.03);
}

.payroll-sheet-toolbar {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    padding: 0.9rem;
    border: 1px solid rgb(var(--color-border-rgb) / 0.65);
    border-radius: 18px;
    background: linear-gradient(135deg, rgb(var(--color-background-150) / 0.9), rgb(var(--color-card-surface) / 0.95));
}

.payroll-sheet-search {
    display: grid;
    gap: 0.3rem;
    min-width: min(100%, 22rem);
    font-weight: 800;
    color: var(--text);
}

.payroll-sheet-search span {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.payroll-sheet-search input,
.payroll-filter-row input {
    width: 100%;
    border: 1px solid rgba(7, 92, 179, 0.18);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

.payroll-column-panel {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid rgb(var(--color-border-rgb) / 0.65);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.payroll-column-panel-head {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.8rem;
}

.payroll-column-panel-head span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.payroll-column-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
}

.payroll-column-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgb(var(--color-border-rgb) / 0.6);
    border-radius: 12px;
    background: rgb(var(--color-background-150) / 0.78);
    font-size: 0.9rem;
}

.payroll-sheet-wrap {
    max-height: 70vh;
    overflow-x: scroll;
    overflow-y: auto;
    padding-bottom: 0.75rem;
    scrollbar-color: rgba(7, 92, 179, 0.68) rgba(226, 232, 240, 0.9);
    scrollbar-width: auto;
}

.payroll-sheet-wrap > .payroll-sheet-table {
    width: max-content;
    min-width: max(100%, 2200px);
}

.payroll-run-card {
    overflow: visible;
    min-width: 0;
}

.payroll-run-card #payrollRunItemsForm {
    min-width: 0;
}

.payroll-horizontal-hint {
    margin: 0.35rem 0 0.55rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.payroll-run-card .payroll-sheet-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: min(72vh, 760px);
    overflow-x: auto !important;
    overflow-y: auto;
    border: 1px solid rgb(var(--color-border-rgb) / 0.72);
    border-radius: 18px;
    background: var(--surface);
    padding: 0 0 1rem;
    scrollbar-gutter: stable both-edges;
}

.payroll-run-card .payroll-sheet-wrap > .payroll-sheet-table {
    width: max-content;
    min-width: max(100%, 2500px);
    table-layout: auto;
}

.payroll-run-card .payroll-sheet-table th,
.payroll-run-card .payroll-sheet-table td {
    min-width: 8.5rem;
    white-space: nowrap;
}

.payroll-run-card .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table td[data-col="employee_number"] {
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 10rem;
    background: var(--surface);
    box-shadow: 8px 0 16px rgba(15, 23, 42, 0.06);
}

.payroll-run-card .payroll-sheet-table th[data-col="employee_name"],
.payroll-run-card .payroll-sheet-table td[data-col="employee_name"] {
    position: sticky;
    left: 10rem;
    z-index: 5;
    min-width: 15rem;
    white-space: normal;
    background: var(--surface);
    box-shadow: 8px 0 16px rgba(15, 23, 42, 0.06);
}

.payroll-run-card .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table thead th[data-col="employee_name"] {
    z-index: 8;
    background: var(--surface);
}

.payroll-run-card .payroll-sheet-table .payroll-filter-row th[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table .payroll-filter-row th[data-col="employee_name"] {
    z-index: 7;
    background: var(--surface-soft);
}

.payroll-run-card .payroll-sheet-table tbody tr:hover td[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table tbody tr:hover td[data-col="employee_name"] {
    background: #f8fbff;
}

.payroll-run-card .payroll-sheet-table th[data-col="payslip_actions"],
.payroll-run-card .payroll-sheet-table td[data-col="payslip_actions"] {
    min-width: 16rem;
}

.payroll-sheet-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--surface);
}

.payroll-sheet-table .payroll-filter-row th {
    top: 2.75rem;
    background: var(--surface-soft);
    z-index: 2;
    padding-block: 0.4rem;
}

.sheet-sort {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
    padding: 0;
}

.sheet-sort::after {
    content: " ⇅";
    color: #7c8ba1;
    font-size: 0.72rem;
}

.payroll-sheet-table th[data-sort-direction="asc"] .sheet-sort::after {
    content: " ↑";
    color: var(--primary);
}

.payroll-sheet-table th[data-sort-direction="desc"] .sheet-sort::after {
    content: " ↓";
    color: var(--primary);
}

.payroll-sheet-table .sheet-col-hidden {
    display: none;
}

.payroll-custom-cell {
    min-width: 9rem;
    background: rgb(var(--color-metric-alert-bg) / 0.18);
    outline: 2px solid transparent;
}

.payroll-custom-cell:focus {
    outline-color: rgba(7, 92, 179, 0.32);
    background: var(--surface);
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #edf4fb;
    color: var(--text-muted);
}

.status.active,
.status.paid {
    background: rgba(31, 157, 99, 0.12);
    color: #18754b;
}

.status.pending_activation {
    background: rgba(7, 92, 179, 0.12);
    color: #075CB3;
}

.status.overdue {
    background: rgba(217, 131, 36, 0.12);
    color: #9d5f18;
}

.status.closed,
.status.completed {
    background: rgba(7, 92, 179, 0.1);
    color: var(--primary);
}

.status.soft {
    min-height: 24px;
    padding: 0.18rem 0.55rem;
    background: #f1f5f9;
    color: #64748b;
    letter-spacing: 0.03em;
}

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

.employee-workspace {
    grid-template-columns: minmax(380px, 0.9fr) minmax(620px, 1.35fr);
    align-items: start;
}

.employee-form-card,
.employee-table-card {
    padding: 1.35rem;
}

.employee-import-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.9rem;
    align-items: start;
    margin-bottom: 1.2rem;
    padding: 1rem;
    border: 1px solid rgba(7, 92, 179, 0.1);
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fbff, #f1f7fd);
}

.employee-import-panel h3 {
    margin: 0;
    font-size: 1rem;
}

.employee-import-panel p {
    margin: 0.18rem 0 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.employee-import-form {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: stretch;
}

.file-dropzone {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px dashed rgba(7, 92, 179, 0.38);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.file-dropzone:hover {
    background: #ffffff;
    border-color: rgba(7, 92, 179, 0.58);
}

.file-dropzone input[type="file"] {
    min-height: 0;
    padding: 0.35rem 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.84rem;
}

.file-dropzone input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(7, 92, 179, 0.24);
    border-radius: 10px;
    background: linear-gradient(135deg, #075fc2, #0aa8e8);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.file-dropzone-title {
    font-weight: 800;
    color: var(--primary);
}

.file-dropzone-help,
.employee-form-grid small,
.muted-inline {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.employee-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 0.9rem;
}

.employee-form-grid label {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.employee-form-grid .full {
    grid-column: 1 / -1;
}

.employee-form-grid input,
.employee-form-grid textarea,
.employee-form-grid select {
    min-height: 44px;
    border-radius: 10px;
}

.employee-form-grid textarea {
    min-height: 84px;
}

.employee-form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.25rem;
}

.employee-table-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.danger-button.subtle {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
    border-color: rgba(185, 28, 28, 0.22);
    background: #ffffff;
    color: #b91c1c;
    box-shadow: none;
}

.danger-button.subtle:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f8fafc;
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.28);
}

.employee-table-scroll > .employee-table {
    min-width: 980px;
}

.employee-table th,
.employee-table td {
    padding: 0.62rem 0.65rem;
    vertical-align: middle;
    line-height: 1.25;
}

.employee-table th {
    white-space: nowrap;
}

.employee-table .select-col {
    width: 72px;
}

.employee-table td {
    max-width: 210px;
}

.employee-table td[data-label="Created"],
.employee-table td[data-label="Employee Number"],
.employee-table td[data-label="ID Number"],
.employee-table td[data-label="Phone"] {
    white-space: nowrap;
}

.employee-table td[data-label="Created"] {
    max-width: 110px;
}

.employee-table td[data-label="Name"] {
    font-weight: 800;
}

.employee-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.employee-icon-action {
    display: inline-flex;
    width: 32px;
    height: 32px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #323130;
    box-shadow: none;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.employee-icon-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.employee-icon-action:hover,
.employee-icon-action:focus-visible {
    border-color: #e1dfdd;
    background: #f3f2f1;
    color: #201f1e;
}

.employee-icon-action:focus-visible {
    outline: 2px solid #605e5c;
    outline-offset: 1px;
}

.employee-icon-action.restore {
    border-color: transparent;
    background: transparent;
    color: #107c10;
}

.employee-icon-action[aria-expanded="true"] {
    border-color: #c8c6c4;
    background: #edebe9;
    color: #201f1e;
}

.employee-icon-action:disabled {
    border-color: transparent;
    background: transparent;
    color: #a19f9d;
    cursor: not-allowed;
    opacity: 0.6;
}

.text-button {
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.9rem;
    font-weight: 800;
}

.text-button.danger-text {
    color: #b91c1c;
}

.text-button.details-toggle {
    color: var(--employee-primary, #0284c7);
}

.text-button.details-toggle[aria-expanded="true"] {
    color: var(--employee-muted, #64748b);
}

@media (max-width: 1280px) {
    .employee-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .employee-import-panel,
    .employee-import-form,
    .employee-form-grid {
        grid-template-columns: 1fr;
    }

    .employee-form-actions {
        justify-content: stretch;
    }

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

.employee-page {
    display: grid;
    gap: 1rem;
}

.employee-page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(7, 92, 179, 0.1);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 246, 255, 0.9));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.employee-page-hero h1 {
    margin: 0;
    color: #041f45;
    font-size: clamp(1.55rem, 2vw, 1.9rem);
    letter-spacing: -0.03em;
}

.employee-page-hero p,
.employee-action-card p,
.employee-directory-head p {
    margin: 0.24rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.employee-page-actions,
.employee-form-actions,
.employee-table-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.employee-action-grid {
    display: grid;
    grid-template-columns: minmax(290px, 0.9fr) minmax(420px, 1.35fr) minmax(250px, 0.75fr);
    gap: 1rem;
    align-items: stretch;
}

.employee-action-card {
    display: grid;
    gap: 0.85rem;
    align-content: start;
    padding: 1.15rem;
}

.employee-action-card.compact-export {
    align-content: space-between;
}

.section-head.compact {
    margin-bottom: 0;
}

.section-head.compact h2,
.employee-action-card h2,
.employee-directory-head h2 {
    margin: 0;
    color: #041f45;
    font-size: 1.12rem;
    letter-spacing: -0.02em;
}

.employee-import-form.refined {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.file-dropzone.refined {
    gap: 0.32rem;
    min-height: 112px;
    place-content: center;
    padding: 1.05rem;
    border-color: rgba(7, 92, 179, 0.24);
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.file-dropzone.refined:hover {
    border-color: rgba(7, 92, 179, 0.58);
    background: #ffffff;
    transform: translateY(-1px);
}

.file-dropzone.refined input[type="file"] {
    width: 100%;
    padding-top: 0.55rem;
    color: #475569;
}

.employee-form-grid.refined {
    gap: 0.8rem 0.85rem;
}

.employee-form-grid.refined label {
    color: #0f172a;
    font-size: 0.86rem;
}

.payroll-field-repeater {
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid rgba(7, 92, 179, 0.14);
    border-radius: 16px;
    background: rgba(248, 251, 255, 0.9);
}

.payroll-field-repeater h3,
.payroll-field-repeater h4 {
    margin: 0;
}

.payroll-field-row {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(9rem, 0.55fr) minmax(7rem, 0.45fr) auto;
    gap: 0.55rem;
    align-items: center;
    margin-bottom: 0.55rem;
}

.payroll-field-row input,
.payroll-field-row select {
    width: 100%;
}

.employee-form-grid.refined input,
.employee-form-grid.refined textarea,
.employee-form-grid.refined select {
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.42) !important;
    border-radius: 9px;
    background: #ffffff !important;
    box-shadow: none;
}

.employee-form-grid.refined input:focus,
.employee-form-grid.refined textarea:focus,
.employee-form-grid.refined select:focus,
.employee-search input:focus,
.employee-filter select:focus {
    border-color: #075cb3 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(7, 92, 179, 0.12) !important;
}

.employee-directory-card {
    padding: 1.15rem;
}

.employee-directory-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.employee-table-toolbar {
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: #f8fafc;
}

.employee-search,
.employee-filter {
    display: grid;
    gap: 0.28rem;
    margin: 0;
    color: #475569;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

.employee-search {
    flex: 1 1 360px;
}

.employee-filter {
    flex: 0 1 220px;
}

.employee-search input,
.employee-filter select {
    min-height: 40px;
    border-radius: 11px;
    background: #ffffff !important;
}

.employee-table-scroll {
    max-height: 62vh;
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
}

.employee-table-scroll > .employee-table {
    min-width: 1060px;
}

.employee-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #ffffff;
    box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

.employee-table tbody tr {
    transition: background 0.16s ease;
}

.employee-table tbody tr:hover {
    background: #f8fbff;
}

.employee-table th,
.employee-table td {
    padding: 0.55rem 0.62rem;
    font-size: 0.86rem;
}

.employee-table td[data-label="Created"] {
    max-width: none;
    min-width: 112px;
}

.status.compact {
    min-height: 22px;
    padding: 0.13rem 0.48rem;
    border-radius: 999px;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status.compact.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.employee-row-actions {
    gap: 0.45rem;
}

.employee-empty-filter,
.employee-empty-row td {
    padding: 1.35rem;
    color: var(--text-muted);
    text-align: center;
}

.employee-empty-row strong,
.employee-empty-row span {
    display: block;
}

.employee-detail-row td {
    padding-top: 0;
    background: #f8fafc;
}

.employee-detail-strip {
    display: flex;
    gap: 0.45rem 0.8rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: #ffffff;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.4;
}

.employee-detail-strip span {
    white-space: nowrap;
}

.employee-detail-strip strong {
    color: #0f172a;
}

.employee-records-shell {
    --ease-cubic: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-speed: 0.25s;
    --employee-bg: var(--bg);
    --employee-surface: var(--surface);
    --employee-surface-soft: var(--surface-soft);
    --employee-border: var(--border);
    --employee-border-light: var(--border);
    --employee-text: var(--text);
    --employee-muted: var(--text-muted);
    --employee-primary: #0b84d8;
    --employee-primary-dark: #0769ad;
    --employee-danger: #dc2626;
    --employee-shadow: 0 10px 30px rgba(15, 39, 68, 0.06);
    gap: 1.5rem;
}

.employee-records-hero {
    align-items: center;
    padding: 1.5rem;
    border: 1px solid var(--employee-border);
    border-radius: 12px;
    background: var(--employee-surface);
    box-shadow: none;
}

.employee-records-hero h1 {
    font-size: 1.38rem;
    font-weight: 800;
    color: var(--employee-text);
}

.employee-records-hero p {
    font-size: 0.9rem;
}

.employee-records-hero .eyebrow {
    margin: 0 0 0.35rem;
    color: var(--employee-primary-dark);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.employee-records-panel {
    padding: 0;
    overflow: hidden;
    border-color: var(--employee-border-light);
    border-radius: 12px;
    box-shadow: none;
}

.employee-records-panel .employee-directory-head {
    margin: 0;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--employee-border-light);
}

.employee-records-panel .employee-directory-head h2 {
    font-size: 1.32rem;
}

.employee-records-panel .employee-table-toolbar {
    margin: 0;
    padding: 1rem;
    border: 0;
    border-bottom: 1px solid var(--employee-border);
    border-radius: 0;
    background: var(--employee-surface);
}

.employee-toolbar-left,
.employee-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.employee-toolbar-left {
    flex: 1 1 auto;
}

.employee-toolbar-right {
    justify-content: flex-end;
}

.employee-records-panel .employee-search {
    flex: 2 1 360px;
}

.employee-records-panel .employee-filter {
    flex: 0 1 220px;
}

.employee-records-panel .employee-table-scroll {
    max-height: 68vh;
    border: 0;
    border-radius: 0;
    background: var(--employee-surface);
}

.employee-records-panel .employee-table-scroll > .employee-table {
    min-width: 980px;
}

.employee-records-panel .employee-table th {
    padding: 1rem;
    background: rgb(var(--color-background-150) / 0.38);
    color: var(--employee-muted);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.employee-records-panel .employee-table td {
    padding: 1rem;
    color: var(--employee-text);
    vertical-align: middle;
}

.employee-records-panel .actions-col {
    text-align: right;
}

.employee-records-panel .employee-row-actions {
    justify-content: flex-end;
}

.employee-name {
    color: var(--employee-text);
    font-weight: 800;
}

.employee-meta {
    margin-top: 0.12rem;
    color: var(--employee-muted);
    font-size: 0.76rem;
}

.employee-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
}

.employee-pay {
    font-weight: 800;
}

.row-main {
    cursor: default;
    transition: background-color 0.15s var(--ease-cubic);
}

.row-main:hover {
    background: rgb(var(--color-background-150) / 0.5);
}

.status-badge {
    background: #e6f4ea;
    color: #137333;
    padding: 0.25rem 0.62rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 900;
}

.drawer-row td {
    padding: 0 !important;
}

.drawer-content {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
    border-top: 2px solid var(--employee-primary);
    border-radius: 0;
    background: var(--employee-surface-soft);
}

.meta-field {
    display: grid;
    gap: 0.25rem;
}

.meta-label {
    color: var(--employee-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.meta-value {
    color: var(--employee-text);
    font-size: 0.84rem;
    font-weight: 700;
}

.payslip-preview-card {
    max-width: 1100px;
    margin: 0 auto;
}

.payslip-sheet {
    background: rgb(var(--color-card-surface));
    border: 1px solid rgb(var(--color-border));
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.payslip-sheet-header,
.payslip-sheet-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgb(var(--color-border));
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.payslip-sheet-header div,
.payslip-sheet-footer {
    color: rgb(var(--color-foreground-muted));
}

.payslip-sheet-header strong {
    display: block;
    color: rgb(var(--color-foreground-800));
    font-size: 1.05rem;
}

.payslip-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.payslip-info-grid div {
    background: rgb(var(--color-background-150) / 0.65);
    border: 1px solid rgb(var(--color-border));
    border-radius: 12px;
    padding: 0.85rem;
}

.payslip-info-grid span {
    display: block;
    color: rgb(var(--color-foreground-muted));
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.payslip-info-grid strong {
    display: block;
    margin-top: 0.25rem;
}

.payslip-info-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 1rem;
}

.payslip-lines td:last-child,
.payslip-lines th:last-child {
    text-align: right;
}

.payslip-net-row td {
    background: rgba(16, 185, 129, 0.12);
    font-weight: 900;
}

.payslip-sheet-footer {
    border-top: 1px solid rgb(var(--color-border));
    border-bottom: 0;
    margin: 1rem 0 0;
    padding: 1rem 0 0;
    font-size: 0.8rem;
}

.ds-payslip {
    border-radius: 10px;
    box-shadow: none;
    padding: 1.25rem;
}

.ds-payslip-header {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid rgb(var(--color-border));
    margin-bottom: 0.95rem;
}

.ds-payslip-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.ds-payslip-company {
    display: block;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: rgb(var(--color-foreground-900));
}

.ds-payslip-address {
    margin-top: 0.2rem;
    color: rgb(var(--color-foreground-muted));
    font-size: 0.82rem;
    line-height: 1.15;
    max-width: 520px;
}

.ds-payslip-meta {
    text-align: right;
    display: grid;
    gap: 0.2rem;
    align-content: start;
}

.ds-payslip-title {
    font-weight: 950;
    letter-spacing: 0.12em;
    font-size: 0.92rem;
    color: rgb(var(--color-foreground-900));
}

.ds-payslip-period {
    font-weight: 800;
    color: rgb(var(--color-foreground-muted));
}

.ds-payslip-paydate span {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    font-weight: 800;
    color: rgb(var(--color-foreground-muted));
}

.ds-payslip-paydate strong {
    display: block;
}

.ds-payslip-employee {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.95rem;
}

.ds-payslip-employee div {
    border: 1px solid rgb(var(--color-border));
    border-radius: 8px;
    padding: 0.65rem 0.7rem;
    background: #ffffff;
}

.ds-payslip-employee span,
.ds-payslip-summary span {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
    font-weight: 900;
    color: rgb(var(--color-foreground-muted));
}

.ds-payslip-employee strong,
.ds-payslip-summary strong {
    display: block;
    margin-top: 0.22rem;
}

.ds-payslip-ledger thead tr:first-child th {
    background: rgb(var(--color-foreground-900));
    color: #ffffff;
    text-align: center;
    font-weight: 950;
    letter-spacing: 0.08em;
}

.ds-payslip-ledger thead tr:nth-child(2) th {
    background: rgb(var(--color-background-150) / 0.65);
    font-weight: 900;
}

.ds-payslip-ledger td,
.ds-payslip-ledger th {
    border-color: rgb(var(--color-border));
}

.ds-payslip-ledger .ds-amount {
    text-align: right;
    white-space: nowrap;
}

.ds-payslip-ledger .ds-units {
    text-align: right;
    color: rgb(var(--color-foreground-muted));
}

.ds-net-row td {
    background: rgba(16, 185, 129, 0.12);
    font-weight: 900;
}

.ds-net-label {
    text-align: right;
}

.ds-payslip-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.ds-payslip-summary div {
    border: 1px solid rgb(var(--color-border));
    border-radius: 8px;
    padding: 0.65rem 0.7rem;
    background: rgb(var(--color-background-150) / 0.4);
}

.ds-payslip-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid rgb(var(--color-border));
    margin-top: 1rem;
    padding-top: 0.75rem;
    font-size: 0.8rem;
    color: rgb(var(--color-foreground-muted));
}

.payroll-sheet-table .payroll-earning {
    background: rgba(16, 185, 129, 0.08);
}

.payroll-sheet-table .payroll-deduction {
    background: rgba(220, 38, 38, 0.08);
}

.payroll-sheet-table .payroll-total {
    font-weight: 900;
    box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.45);
}

.payroll-sheet-table [data-col="net_pay"] {
    background: rgba(7, 95, 194, 0.1);
    font-weight: 900;
}

.payroll-total-row th {
    position: sticky;
    bottom: 0;
    z-index: 2;
    border-top: 2px solid rgb(var(--color-border));
    background: rgb(var(--color-card-surface));
    color: rgb(var(--color-foreground-800));
    font-weight: 950;
    white-space: nowrap;
}

.payroll-total-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
}

.payroll-total-strip div {
    border: 1px solid rgb(var(--color-border));
    border-radius: 16px;
    background: rgb(var(--color-card-surface));
    padding: 0.9rem 1rem;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.payroll-total-strip span {
    display: block;
    color: rgb(var(--color-foreground-muted));
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.payroll-total-strip strong {
    display: block;
    margin-top: 0.35rem;
    color: rgb(var(--color-foreground-800));
    font-size: 1.15rem;
    font-weight: 950;
}

.payroll-sheet-table input {
    text-align: right;
}

@media (max-width: 980px) {
    .payroll-total-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .payroll-total-strip {
        grid-template-columns: 1fr;
    }
}

.employee-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 39, 68, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.employee-overlay.active {
    opacity: 1;
}

.employee-drawer {
    position: fixed;
    top: 0;
    right: -660px;
    z-index: 80;
    display: flex;
    width: min(660px, 100%);
    height: 100vh;
    flex-direction: column;
    background: var(--employee-surface);
    box-shadow: -20px 0 50px rgba(15, 39, 68, 0.15);
    transition: right 0.24s ease;
}

.employee-drawer.active {
    right: 0;
}

.employee-drawer-header,
.employee-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid var(--employee-border-light);
}

.employee-drawer-header h2,
.employee-modal-header h2 {
    margin: 0 0 0.3rem;
    color: var(--employee-text);
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.employee-drawer-header p,
.employee-modal-header p {
    margin: 0;
    color: var(--employee-muted);
    line-height: 1.45;
}

.employee-drawer-form {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.employee-drawer-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.employee-form-section {
    margin-bottom: 1.6rem;
}

.employee-form-section h3 {
    margin: 0 0 0.85rem;
    color: var(--employee-text);
    font-size: 0.95rem;
}

.employee-drawer-footer,
.employee-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 1.05rem 1.5rem;
    border-top: 1px solid var(--employee-border-light);
    background: var(--employee-surface-soft);
}

.employee-close-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--employee-muted);
    font-size: 1.45rem;
    line-height: 1;
}

.employee-close-button:hover {
    background: var(--employee-surface-soft);
}

.employee-import-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 90;
    width: min(540px, calc(100% - 2rem));
    overflow: hidden;
    border-radius: 20px;
    background: var(--employee-surface);
    box-shadow: 0 20px 60px rgba(15, 39, 68, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.employee-import-modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.employee-modal-body {
    display: grid;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
}

.employee-modal-upload {
    min-height: 150px;
}

:root[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, rgb(var(--color-midnight-900)), rgb(var(--color-midnight-850)));
    border: 1px solid rgb(var(--color-border-rgb) / 0.42);
}

:root[data-theme="dark"] .sidebar .primary-action {
    background: rgb(var(--color-emerald-main));
    color: #ffffff;
}

:root[data-theme="dark"] .side-nav a:hover,
:root[data-theme="dark"] .side-nav a.active {
    background: rgb(var(--color-midnight-800));
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .hero-card,
:root[data-theme="dark"] .employee-records-panel,
:root[data-theme="dark"] .employee-drawer,
:root[data-theme="dark"] .employee-import-modal {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] .hero-card::after {
    background: radial-gradient(circle, rgba(86, 185, 255, 0.14), transparent 68%);
}

:root[data-theme="dark"] .topbar-home-link:hover strong,
:root[data-theme="dark"] .topbar-home-link:hover span {
    color: var(--primary-bright);
}

:root[data-theme="dark"] .flash.success {
    border-color: rgba(31, 157, 99, 0.28);
    background: rgba(6, 78, 59, 0.64);
    color: #d1fae5;
}

:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .hero-kicker {
    background: rgba(86, 185, 255, 0.14);
}

:root[data-theme="dark"] .stat-link:hover,
:root[data-theme="dark"] .stat-link:focus,
:root[data-theme="dark"] .action-tile:hover {
    border-color: rgb(var(--color-border-rgb));
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .stat-trend.up {
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
}

:root[data-theme="dark"] .stat-trend.down {
    background: rgb(var(--color-metric-alert-bg) / 0.8);
    color: rgb(var(--color-metric-alert-txt));
}

:root[data-theme="dark"] .status,
:root[data-theme="dark"] .status.soft {
    background: rgb(var(--color-midnight-750) / 0.8);
    color: var(--text-muted);
}

:root[data-theme="dark"] .status-badge {
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
}

:root[data-theme="dark"] .status.active,
:root[data-theme="dark"] .status.paid {
    background: rgba(16, 185, 129, 0.16);
    color: #86efac;
}

:root[data-theme="dark"] .status.pending_activation,
:root[data-theme="dark"] .status.closed,
:root[data-theme="dark"] .status.completed {
    background: rgba(86, 185, 255, 0.15);
    color: var(--primary-bright);
}

:root[data-theme="dark"] .status.overdue,
:root[data-theme="dark"] .status.compact.danger {
    background: rgb(var(--color-metric-alert-bg) / 0.82);
    color: rgb(var(--color-metric-alert-txt));
}

:root[data-theme="dark"] .file-dropzone,
:root[data-theme="dark"] .file-dropzone.refined {
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
    border-color: rgb(var(--color-border-rgb));
}

:root[data-theme="dark"] .file-dropzone:hover,
:root[data-theme="dark"] .file-dropzone.refined:hover {
    background: var(--surface-soft);
}

:root[data-theme="dark"] .employee-page-hero,
:root[data-theme="dark"] .employee-table-toolbar,
:root[data-theme="dark"] .employee-detail-row td,
:root[data-theme="dark"] .employee-detail-strip {
    background: var(--surface-soft);
    border-color: rgb(var(--color-border-rgb) / 0.72);
}

:root[data-theme="dark"] .employee-records-hero,
:root[data-theme="dark"] .employee-records-panel,
:root[data-theme="dark"] .employee-records-panel .employee-table-toolbar,
:root[data-theme="dark"] .employee-records-panel .employee-table-scroll {
    background: var(--surface);
}

:root[data-theme="dark"] .drawer-content {
    background: var(--surface-soft);
}

:root[data-theme="dark"] .employee-page-hero h1,
:root[data-theme="dark"] .section-head.compact h2,
:root[data-theme="dark"] .employee-action-card h2,
:root[data-theme="dark"] .employee-directory-head h2,
:root[data-theme="dark"] .employee-records-panel .employee-table td,
:root[data-theme="dark"] .employee-name,
:root[data-theme="dark"] .employee-detail-strip strong,
:root[data-theme="dark"] .employee-form-grid.refined label {
    color: var(--text);
}

:root[data-theme="dark"] .employee-detail-strip,
:root[data-theme="dark"] .employee-search,
:root[data-theme="dark"] .employee-filter,
:root[data-theme="dark"] .employee-meta {
    color: var(--text-muted);
}

:root[data-theme="dark"] .employee-form-grid.refined input,
:root[data-theme="dark"] .employee-form-grid.refined textarea,
:root[data-theme="dark"] .employee-form-grid.refined select,
:root[data-theme="dark"] .employee-search input,
:root[data-theme="dark"] .employee-filter select {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: rgb(var(--color-border-rgb)) !important;
}

:root[data-theme="dark"] .employee-form-grid.refined input:focus,
:root[data-theme="dark"] .employee-form-grid.refined textarea:focus,
:root[data-theme="dark"] .employee-form-grid.refined select:focus,
:root[data-theme="dark"] .employee-search input:focus,
:root[data-theme="dark"] .employee-filter select:focus {
    background: var(--surface) !important;
    box-shadow: 0 0 0 4px rgba(86, 185, 255, 0.16) !important;
}

:root[data-theme="dark"] .employee-table thead th {
    background: var(--surface);
}

:root[data-theme="dark"] .employee-table tbody tr:hover,
:root[data-theme="dark"] .responsive-table tbody tr:hover {
    background: rgb(var(--color-midnight-750) / 0.24);
}

:root[data-theme="dark"] .danger-button.subtle {
    background: var(--surface);
    color: #fecaca;
    border-color: rgb(var(--color-metric-alert-brd) / 0.8);
}

:root[data-theme="dark"] .danger-button.subtle:disabled {
    background: var(--surface-soft);
    color: var(--text-soft);
    border-color: rgb(var(--color-border-rgb) / 0.65);
}

@media (max-width: 760px) {
    .employee-toolbar-left,
    .employee-toolbar-right,
    .employee-records-panel .employee-search,
    .employee-records-panel .employee-filter {
        width: 100%;
        flex: 1 1 100%;
    }

    .employee-toolbar-right .button-link,
    .employee-toolbar-right .danger-button {
        width: 100%;
    }

    .employee-drawer {
        right: -100%;
    }

    .drawer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .employee-action-grid {
        grid-template-columns: 1fr 1fr;
    }

    .employee-action-card.compact-export {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .employee-page-hero,
    .employee-directory-head {
        align-items: stretch;
        flex-direction: column;
    }

    .employee-action-grid,
    .employee-form-grid.refined {
        grid-template-columns: 1fr;
    }

    .employee-table-toolbar {
        align-items: stretch;
    }

    .employee-search,
    .employee-filter,
    .employee-table-toolbar .button-link,
    .employee-table-toolbar .danger-button {
        flex: 1 1 100%;
        width: 100%;
    }
}

.public-page {
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: 2rem 1.2rem 3rem;
}

label {
    display: inline-block;
    margin-bottom: 0.4rem;
    color: var(--text);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem 0.9rem;
    font: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input,
select,
textarea,
.form-control {
    border: 1.5px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
}

.feedback-fab {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.feedback-fab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 12px;
    background: rgba(31, 157, 99, 0.1);
    color: #15803d;
    line-height: 0;
}

.feedback-fab-icon svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.apps-menu-glyph,
.apps-trigger-badge {
    color: #ffffff;
}

.apps-menu-glyph svg {
    width: 1rem;
    height: 1rem;
    display: block;
    margin: 0 auto;
    stroke: #ffffff;
}

.login-shell {
    display: grid;
    gap: 1.2rem;
}

.login-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 1rem;
    padding: 1.4rem;
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(184, 234, 17, 0.22), transparent 20%),
        linear-gradient(135deg, rgba(7, 92, 179, 0.98), rgba(28, 178, 248, 0.92) 62%, rgba(25, 157, 154, 0.9));
    color: #ffffff;
    box-shadow: var(--shadow-lg);
}

.login-hero-content,
.login-plans {
    display: grid;
    gap: 0.9rem;
}

.login-brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    width: fit-content;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-brand-mark,
.login-auth-logo {
    width: 2.75rem;
    height: 2.75rem;
    object-fit: contain;
}

.login-eyebrow {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.86);
}

.login-hero h1 {
    margin: 0;
    max-width: 15ch;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
}

.login-hero-copy {
    margin: 0;
    max-width: 60ch;
    color: rgba(255, 255, 255, 0.92);
}

.login-auth-wrap {
    display: grid;
}

.login-card {
    padding: 1.4rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(7, 92, 179, 0.1);
    box-shadow: var(--shadow-md);
}

.login-auth-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.login-auth-title {
    margin: 0;
    font-size: 1.45rem;
}

.login-auth-subtitle,
.login-info-box p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
}

.login-plan {
    position: relative;
    padding: 1.15rem 1.2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
}

.login-plan-bar {
    width: 4rem;
    height: 0.35rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #b8ea11, #ffffff);
    margin-bottom: 0.9rem;
}

.login-plan h3,
.login-price strong {
    margin: 0;
    color: #ffffff;
}

.login-price {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.login-price span,
.login-plan li span:last-child {
    color: rgba(255, 255, 255, 0.88);
}

.login-plan ul {
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
}

.login-plan li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.login-plan-dot {
    width: 0.5rem;
    height: 0.5rem;
    min-width: 0.5rem;
    border-radius: 999px;
    margin-top: 0.45rem;
    background: #b8ea11;
}

.login-info-box {
    margin-top: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff, #eef6ff);
    border: 1px solid rgba(7, 92, 179, 0.12);
}

.login-submit {
    width: 100%;
}

label.inline-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

label.inline-check input {
    width: auto;
    min-width: auto;
}

.sidebar-collapsed .sidebar {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
}

.sidebar-collapsed .sidebar-brand h1,
.sidebar-collapsed .sidebar-brand p,
.sidebar-collapsed .side-nav a,
.sidebar-collapsed .primary-action {
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .stat {
        grid-column: span 4;
    }

    .login-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .dashboard-hero,
    .dashboard-grid,
    .two-col,
    .hero-points {
        grid-template-columns: 1fr;
    }

    .focus-list {
        grid-template-columns: 1fr;
    }

    .stat {
        grid-column: span 6;
    }

    .topbar-main,
    .topbar-side {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-grid.compact {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .app-shell,
    .sidebar-collapsed.app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .sidebar {
        position: relative;
        height: auto;
        border-radius: 24px;
        padding: 1rem;
    }

    .topbar {
        padding: 0.9rem;
        align-items: stretch;
        border-radius: 22px;
    }

    .page-shell,
    .page {
        overflow: visible;
    }

    .topbar-main,
    .topbar-side {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-brand,
    .welcome-row {
        flex-wrap: wrap;
    }

    .section-head {
        flex-direction: column;
        align-items: stretch;
    }

    .text-actions,
    .row-actions {
        gap: 0.55rem;
    }

    .login-hero h1 {
        max-width: none;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }

    .app-shell {
        padding: 0.6rem;
        gap: 0.75rem;
    }

    .login-hero,
    .login-card {
        padding: 1.05rem;
        border-radius: 22px;
    }

    .hero-card,
    .hero-side-panel,
    .card,
    .stat {
        padding: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat {
        grid-column: auto;
    }

    .hero-side-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 0.85rem;
        border-radius: 20px;
    }

    .sidebar-brand {
        padding: 0.2rem 0.2rem 0.85rem;
        margin-bottom: 0.75rem;
    }

    .topbar {
        padding: 0.78rem;
        gap: 0.6rem;
        border-radius: 18px;
    }

    .topbar-brand-wordmark strong {
        font-size: 0.95rem;
    }

    .topbar-brand-wordmark span,
    .topbar-action,
    .text-action {
        font-size: 0.84rem;
    }

    .apps-trigger,
    .feedback-fab {
        width: 100%;
        justify-content: center;
    }

    .apps-menu {
        left: 0;
        right: 0;
        min-width: 0;
        width: 100%;
    }

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

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: grid;
        gap: 0.85rem;
    }

    .responsive-table tr {
        padding: 0.85rem;
        border-radius: 16px;
        border: 1px solid rgba(7, 92, 179, 0.08);
        background: #ffffff;
    }

    .responsive-table td {
        padding: 0.35rem 0;
        border-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.12rem;
        color: var(--text-muted);
        font-size: 0.76rem;
        font-weight: 800;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .dashboard-grid,
    .two-col,
    .action-grid.compact,
    .focus-list {
        grid-template-columns: 1fr;
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table {
        display: table;
        width: max-content;
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table thead {
        display: table-header-group;
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table tbody {
        display: table-row-group;
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table tr {
        display: table-row;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table th,
    .payroll-run-card .payroll-sheet-wrap .responsive-table td {
        display: table-cell;
        width: auto;
        padding: 0.85rem 0.75rem;
        border-bottom: 1px solid rgb(var(--color-border-rgb) / 0.55);
    }

    .payroll-run-card .payroll-sheet-wrap .responsive-table td::before {
        display: none;
    }
}

.hr-landing {
    color: var(--text);
    background: #ffffff;
}

.hr-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.hr-header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(7, 92, 179, 0.12);
    position: sticky;
    top: 0;
    z-index: 70;
    backdrop-filter: blur(10px);
}

.hr-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 18px 0;
}

.hr-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--primary);
    font-size: 24px;
    font-weight: 800;
}

.hr-logo strong {
    color: var(--green);
}

.hr-logo-mark {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.hr-nav-links {
    display: flex;
    gap: 26px;
    align-items: center;
    font-size: 15px;
    color: var(--text);
}

.hr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 22px;
    border-radius: 10px;
    font-weight: 800;
    transition: 0.22s ease;
    cursor: pointer;
}

.hr-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-bright) 58%, var(--teal));
    color: #ffffff;
    box-shadow: 0 18px 36px rgba(7, 92, 179, 0.22);
}

.hr-btn-primary:hover {
    color: #ffffff;
    transform: translateY(-2px);
}

.hr-btn-outline {
    border: 1px solid rgba(7, 92, 179, 0.22);
    color: var(--primary);
    background: #ffffff;
}

.hr-btn-outline:hover {
    background: rgba(28, 178, 248, 0.08);
    color: var(--primary);
}

.hr-btn-light {
    background: #ffffff;
    color: var(--primary);
}

.hr-hero {
    background: linear-gradient(135deg, rgba(28, 178, 248, 0.08) 0%, #ffffff 55%, rgba(99, 186, 26, 0.08) 100%);
    padding: 90px 0;
}

.hr-hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 55px;
    align-items: center;
}

.hr-badge {
    display: inline-block;
    background: rgba(7, 92, 179, 0.08);
    color: var(--primary);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 18px;
}

.hr-hero h1 {
    font-size: 52px;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 20px;
}

.hr-hero p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 620px;
}

.hr-hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.hr-hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 25px;
}

.hr-stat {
    background: #ffffff;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid rgba(7, 92, 179, 0.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

.hr-stat h3 {
    color: var(--green);
    font-size: 26px;
    margin-bottom: 4px;
}

.hr-stat p {
    font-size: 13px;
    margin: 0;
}

.hr-dashboard-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(16, 42, 67, 0.12);
    padding: 28px;
    border: 1px solid rgba(7, 92, 179, 0.12);
}

.hr-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 24px;
}

.hr-dashboard-header h3 {
    color: var(--text);
}

.hr-status {
    background: rgba(99, 186, 26, 0.12);
    color: #4d8d12;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
}

.hr-dashboard-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 16px;
    border-radius: 12px;
    background: rgba(242, 248, 255, 0.92);
    margin-bottom: 12px;
    font-size: 14px;
}

.hr-dashboard-row strong {
    color: var(--text);
}

.hr-section {
    padding: 80px 0;
}

.hr-section-title {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 50px;
}

.hr-section-title h2 {
    font-size: 38px;
    color: var(--text);
    margin-bottom: 14px;
}

.hr-section-title p {
    color: var(--text-muted);
    font-size: 17px;
}

.hr-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.hr-feature-card {
    background: #ffffff;
    border: 1px solid rgba(7, 92, 179, 0.12);
    padding: 28px;
    border-radius: 18px;
    transition: 0.22s ease;
}

.hr-feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(16, 42, 67, 0.12);
}

.hr-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(7, 92, 179, 0.12), rgba(28, 178, 248, 0.12));
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 18px;
}

.hr-feature-card h3 {
    color: var(--text);
    margin-bottom: 10px;
    font-size: 21px;
}

.hr-feature-card p {
    color: var(--text-muted);
    font-size: 15px;
}

.hr-workflow {
    background: linear-gradient(180deg, rgba(246, 250, 255, 0.95), rgba(240, 249, 244, 0.9));
}

.hr-workflow-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.hr-step {
    background: #ffffff;
    padding: 26px;
    border-radius: 16px;
    border: 1px solid rgba(7, 92, 179, 0.12);
}

.hr-step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--green));
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    margin-bottom: 18px;
}

.hr-step h3 {
    color: var(--text);
    margin-bottom: 8px;
}

.hr-step p {
    color: var(--text-muted);
    font-size: 15px;
}

.hr-security-reporting {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
}

.hr-info-panel {
    background: linear-gradient(135deg, rgba(7, 92, 179, 0.98), rgba(16, 42, 67, 0.96));
    color: #ffffff;
    padding: 38px;
    border-radius: 22px;
}

.hr-info-panel h2 {
    font-size: 32px;
    margin-bottom: 18px;
}

.hr-info-panel p {
    color: #d9e2ec;
    margin-bottom: 20px;
}

.hr-check-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hr-check-list li {
    margin-bottom: 14px;
    padding-left: 28px;
    position: relative;
}

.hr-check-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--green), var(--lime));
}

.hr-pricing {
    background: #ffffff;
}

.hr-pricing-card {
    max-width: 520px;
    margin: auto;
    background: #ffffff;
    border: 1px solid rgba(7, 92, 179, 0.12);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(16, 42, 67, 0.12);
    padding: 38px;
    text-align: center;
}

.hr-pricing-card h3 {
    color: var(--text);
    font-size: 28px;
    margin-bottom: 10px;
}

.hr-price {
    font-size: 46px;
    color: var(--green);
    font-weight: 900;
    margin: 20px 0;
}

.hr-price span {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
}

.hr-pricing-list {
    text-align: left;
    color: var(--text);
    margin: 25px 0;
}

.hr-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-bright) 58%, var(--green));
    color: #ffffff;
    text-align: center;
    padding: 80px 20px;
}

.hr-cta h2 {
    font-size: 40px;
    margin-bottom: 15px;
}

.hr-cta p {
    max-width: 700px;
    margin: 0 auto 28px;
    color: #eaf8ef;
    font-size: 18px;
}

@media (max-width: 900px) {
    .hr-hero-grid,
    .hr-security-reporting {
        grid-template-columns: 1fr;
    }

    .hr-features-grid,
    .hr-workflow-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hr-hero h1 {
        font-size: 42px;
    }

    .hr-nav-links {
        display: none;
    }
}

@media (max-width: 600px) {
    .hr-features-grid,
    .hr-workflow-grid,
    .hr-hero-stats {
        grid-template-columns: 1fr;
    }

    .hr-hero {
        padding: 60px 0;
    }

    .hr-hero h1 {
        font-size: 34px;
    }

    .hr-section-title h2 {
        font-size: 30px;
    }
}

@media (max-width: 820px) {
    .payslip-info-grid,
    .payslip-info-grid.compact {
        grid-template-columns: 1fr;
    }

    .payslip-sheet-header,
    .payslip-sheet-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    @page {
        margin: 12mm;
    }

    .sidebar,
    .topbar,
    .payslip-preview-card > .section-head,
    .flash-messages {
        display: none !important;
    }

    body,
    .app-shell,
    .main-content {
        display: block !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .payslip-preview-card,
    .payslip-sheet,
    .ds-payslip {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .ds-payslip-header,
    .ds-payslip-employee,
    .ds-payslip-summary,
    .ds-payslip-footer,
    .ds-payslip-ledger {
        break-inside: avoid;
    }

    .ds-payslip-ledger thead tr:first-child th {
        background: #0f2744 !important;
        color: #ffffff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Payroll command-centre refresh.
   This layer standardises the app around the benchmark payroll workflow without
   changing calculation logic or existing route behaviour. */
:root {
    --payroll-ink: #101828;
    --payroll-muted: #667085;
    --payroll-bg: #f4f7fb;
    --payroll-panel: rgba(255, 255, 255, 0.96);
    --payroll-panel-soft: #f8fafc;
    --payroll-border: #e4e7ec;
    --payroll-border-strong: #cbd5e1;
    --payroll-blue: #2563eb;
    --payroll-blue-dark: #1d4ed8;
    --payroll-green: #16a34a;
    --payroll-amber: #d97706;
    --payroll-red: #dc2626;
    --payroll-sidebar: #101828;
    --payroll-shadow: 0 18px 45px rgba(16, 24, 40, 0.10);
}

body.app-body,
body {
    background:
        radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.12), transparent 30%),
        radial-gradient(circle at 88% 6%, rgba(22, 163, 74, 0.10), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, var(--payroll-bg) 52%, #edf2f8 100%);
    color: var(--payroll-ink);
}

.app-shell {
    gap: 1rem;
    padding: 0;
}

.sidebar {
    border-radius: 0;
    background:
        radial-gradient(circle at 30% 0%, rgba(28, 178, 248, 0.16), transparent 34%),
        linear-gradient(180deg, #101828 0%, #12213a 55%, #0b1220 100%);
    box-shadow: 18px 0 48px rgba(16, 24, 40, 0.18);
}

.sidebar-brand {
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

.sidebar .primary-action {
    background: linear-gradient(135deg, #ffffff, #dbeafe);
    color: #10233d;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.side-nav a,
.side-nav-group summary {
    border: 1px solid transparent;
    border-radius: 16px;
}

.side-nav a:hover,
.side-nav a.active,
.side-nav-group summary:hover,
.side-nav-group[open] summary,
.side-nav-group.active summary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 3px 0 0 #38bdf8;
}

.page-shell {
    background: transparent;
}

.topbar {
    min-height: 76px;
    padding: 0.9rem 1.4rem;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(226, 232, 240, 0.86);
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.page,
.main-content {
    max-width: none;
}

.page {
    padding: clamp(1rem, 2vw, 1.6rem);
}

.card,
.hero-card,
.dashboard-bottom > .card,
.dashboard-grid > .card,
.two-col > .card {
    background: var(--payroll-panel);
    border: 1px solid rgba(228, 231, 236, 0.9);
    border-radius: 26px;
    box-shadow: var(--payroll-shadow);
}

.section-head {
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(228, 231, 236, 0.88);
}

.section-head h2,
.section-head h3 {
    color: var(--payroll-ink);
    letter-spacing: -0.035em;
}

.section-head p,
.muted-text,
small {
    color: var(--payroll-muted);
}

.toolbar,
.import-toolbar,
.page-actions {
    gap: 0.55rem;
}

button:not(.employee-icon-action),
.button-link,
.primary-action {
    border-radius: 999px;
    min-height: 42px;
    padding: 0.68rem 1rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:not(.text-button):not(.text-action):not(.employee-icon-action),
.button-link:not(.ghost),
.primary-action {
    background: linear-gradient(135deg, var(--payroll-blue), #0ea5e9);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
}

button:not(.text-button):not(.text-action):not(.employee-icon-action):hover,
.button-link:not(.ghost):hover,
.primary-action:hover {
    transform: translateY(-1px);
    color: #ffffff;
}

.button-link.ghost,
.ghost {
    background: #ffffff;
    border-color: var(--payroll-border);
    color: #344054;
}

.button-link.ghost:hover,
.ghost:hover {
    background: #f8fafc;
    color: var(--payroll-blue);
}

input,
select,
textarea {
    border-color: var(--payroll-border-strong);
    border-radius: 14px;
    background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--payroll-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.payroll-total-strip {
    position: sticky;
    top: 77px;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgba(228, 231, 236, 0.92);
    border-radius: 22px;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
}

.payroll-command-strip {
    position: static;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    margin: 1rem 0;
}

.payroll-compliance-nudge {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(7, 92, 179, 0.16);
    background: linear-gradient(180deg, rgba(241, 248, 255, 0.98), rgba(232, 243, 255, 0.98));
}

.payroll-compliance-nudge strong {
    color: var(--text);
}

.payroll-compliance-nudge span {
    color: var(--text-muted);
    flex: 1 1 420px;
}

.payroll-total-strip div {
    min-height: 92px;
    padding: 1rem;
    border: 1px solid rgba(228, 231, 236, 0.9);
    border-radius: 18px;
    background: #ffffff;
}

.payroll-total-strip div:nth-child(4),
.payroll-command-strip div:first-child {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff;
    border-color: transparent;
}

.payroll-total-strip div:nth-child(4) span,
.payroll-command-strip div:first-child span {
    color: rgba(255, 255, 255, 0.78);
}

.payroll-total-strip span {
    color: var(--payroll-muted);
    font-size: 0.73rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.payroll-total-strip strong {
    display: block;
    margin-top: 0.35rem;
    color: inherit;
    font-size: clamp(1rem, 1.4vw, 1.34rem);
    letter-spacing: -0.035em;
}

.payroll-run-card {
    padding: clamp(1rem, 2vw, 1.35rem);
}

.payroll-run-card #payrollRunItemsForm {
    margin-top: 1rem;
}

.import-toolbar,
.payroll-sheet-toolbar {
    position: sticky;
    top: 195px;
    z-index: 30;
    align-items: end;
    border: 1px solid rgba(228, 231, 236, 0.95);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
    backdrop-filter: blur(14px);
}

.payroll-sheet-search span {
    color: #475467;
    font-weight: 800;
}

.payroll-column-panel {
    border: 1px solid rgba(228, 231, 236, 0.95);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

.payroll-column-toggle {
    border-radius: 999px;
    background: #f8fafc;
}

.payroll-horizontal-hint {
    display: inline-flex;
    align-items: center;
    margin: 0.8rem 0 0.65rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.86rem;
    font-weight: 700;
}

.table-scroll,
.payroll-sheet-wrap,
.employee-table-scroll {
    border: 1px solid rgba(203, 213, 225, 0.92);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: inset 0 -10px 18px rgba(15, 23, 42, 0.025);
}

.table-scroll::-webkit-scrollbar,
.payroll-sheet-wrap::-webkit-scrollbar,
.employee-table-scroll::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.table-scroll::-webkit-scrollbar-track,
.payroll-sheet-wrap::-webkit-scrollbar-track,
.employee-table-scroll::-webkit-scrollbar-track {
    background: #edf2f7;
    border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb,
.payroll-sheet-wrap::-webkit-scrollbar-thumb,
.employee-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
    border: 3px solid #edf2f7;
    border-radius: 999px;
}

.responsive-table,
.payroll-sheet-table {
    border-collapse: separate;
    border-spacing: 0;
}

.responsive-table thead th,
.payroll-sheet-table thead th {
    background: #f8fafc;
    color: #475467;
    border-bottom: 1px solid var(--payroll-border);
    font-size: 0.72rem;
    letter-spacing: 0.07em;
}

.responsive-table tbody td,
.payroll-sheet-table tbody td {
    border-bottom: 1px solid rgba(228, 231, 236, 0.88);
}

.responsive-table tbody tr:hover td,
.payroll-sheet-table tbody tr:hover td {
    background: #f8fbff;
}

.payroll-run-card .payroll-sheet-wrap {
    max-height: min(68vh, 760px);
}

.payroll-run-card .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table td[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table th[data-col="employee_name"],
.payroll-run-card .payroll-sheet-table td[data-col="employee_name"] {
    box-shadow: 8px 0 16px rgba(16, 24, 40, 0.045);
}

.payroll-run-card .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table th[data-col="employee_name"] {
    background: #eef4ff;
}

.payroll-run-card .payroll-sheet-table td[data-col="employee_number"],
.payroll-run-card .payroll-sheet-table td[data-col="employee_name"] {
    background: #ffffff;
}

.payroll-sheet-table input {
    border-radius: 12px;
    min-height: 38px;
    font-weight: 700;
}

.payroll-sheet-table .payroll-earning {
    color: #047857;
}

.payroll-sheet-table .payroll-deduction {
    color: #b42318;
}

.payroll-sheet-table [data-col="net_pay"] {
    background: #ecfdf3;
    color: #027a48;
    font-weight: 900;
}

.status {
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.status.published {
    background: #ecfdf3;
    color: #027a48;
}

.status.draft,
.status.pending {
    background: #fffaeb;
    color: #b54708;
}

.danger-button.subtle,
.text-button.danger-text {
    color: var(--payroll-red);
}

@media (max-width: 1180px) {
    .payroll-total-strip,
    .payroll-command-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        position: static;
    }

    .import-toolbar,
    .payroll-sheet-toolbar {
        position: static;
    }
}

@media (max-width: 720px) {
    .page {
        padding: 0.85rem;
    }

    .payroll-total-strip,
    .payroll-command-strip {
        grid-template-columns: 1fr;
    }

    .topbar {
        min-height: auto;
    }
}

/* Payroll run detail benchmark refresh */
.payroll-run-page {
    --run-bg: #f5f6f8;
    --run-surface: #ffffff;
    --run-soft: #f0f4f9;
    --run-border: #e2e8f0;
    --run-strong: #cbd5e1;
    --run-text: #0f172a;
    --run-muted: #64748b;
    --run-blue: #075cb3;
    --run-green: #16a34a;
    --run-red: #dc2626;
    --run-amber: #d97706;
    margin: 0 auto;
    max-width: 100%;
    padding: clamp(0.85rem, 2vw, 1.4rem);
    background:
        radial-gradient(circle at 8% 2%, rgba(7, 92, 179, 0.12), transparent 26rem),
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(245, 246, 248, 0.96));
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 24px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
}

.payroll-run-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.payroll-run-kicker {
    margin: 0 0 0.25rem;
    color: var(--run-blue);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.payroll-run-hero h2 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin: 0;
    color: var(--run-text);
    font-size: clamp(1.35rem, 2.4vw, 2.1rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.payroll-run-hero p:not(.payroll-run-kicker) {
    max-width: 780px;
    margin: 0.45rem 0 0;
    color: var(--run-muted);
    line-height: 1.55;
}

.payroll-run-actions {
    justify-content: flex-end;
    max-width: 920px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0.24rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-badge.draft,
.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals {
    position: static;
    z-index: auto;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 0;
    overflow-x: auto;
    padding: 0;
    margin: 0 0 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div {
    min-height: 74px;
    border: 0;
    border-right: 1px solid var(--run-border);
    border-radius: 0;
    box-shadow: none;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div:first-child {
    border-radius: 20px 0 0 20px;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div:last-child {
    border-right: 0;
    border-radius: 0 20px 20px 0;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div:nth-child(5) {
    background: linear-gradient(135deg, #1d4ed8, #075cb3);
    color: #ffffff;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div:nth-child(6) strong {
    color: var(--run-red);
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div:nth-child(7) strong {
    color: var(--run-green);
}

.payroll-workflow-card,
.payroll-column-panel,
.payroll-run-page #payrollRunItemsForm {
    border: 1px solid var(--run-border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.payroll-workflow-card {
    overflow: hidden;
    margin: 1rem 0;
}

.payroll-run-page #payrollRunItemsForm {
    overflow: hidden;
}

.payroll-import-bar {
    position: static;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--run-border);
    border-radius: 0;
    box-shadow: none;
    background: var(--run-soft);
}

.payroll-import-bar strong {
    color: var(--run-muted);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.payroll-file-picker {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 0.8rem;
    border: 1.5px dashed var(--run-strong);
    border-radius: 12px;
    background: #ffffff;
    color: var(--run-muted);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.payroll-file-picker input {
    display: none;
}

.payroll-publish-strip,
.payroll-save-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, #f0f7ff, #e8f0fb);
}

.payroll-publish-strip strong {
    display: block;
    color: var(--run-text);
}

.payroll-publish-strip span,
.payroll-save-strip small {
    display: block;
    margin-top: 0.2rem;
    color: var(--run-muted);
    font-size: 0.82rem;
}

.payroll-tax-toggle {
    margin: 0;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--run-border);
    background: #fff7ed;
    color: #9a3412;
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-toolbar {
    position: sticky;
    top: 82px;
    z-index: 34;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--run-border);
    border-radius: 0;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.96);
}

.payroll-run-page .payroll-column-panel {
    margin: 0.85rem 1rem 0;
}

.payroll-run-page .payroll-horizontal-hint {
    margin-left: 1rem;
}

.payroll-run-page .payroll-scroll-proxy {
    position: sticky;
    top: 0;
    z-index: 120;
    height: 22px;
    margin: 0 1rem 0.45rem;
    overflow-x: scroll;
    overflow-y: hidden;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #dbeafe;
    box-shadow: 0 10px 24px rgba(7, 92, 179, 0.16);
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
}

.payroll-run-page .payroll-scroll-proxy > div {
    height: 1px;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar {
    height: 18px;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #075cb3, #1cb2f8);
    border: 3px solid #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-sheet-wrap {
    margin: 0 1rem 1rem;
    max-height: min(70vh, 780px);
    border-radius: 18px;
}

.payroll-run-page .payroll-sheet-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #f8fafc;
    color: #475467;
}

.payroll-run-page .payroll-filter-row th {
    top: 38px;
    z-index: 5;
}

.payroll-run-page .payroll-sheet-table th button.sheet-sort {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}

.payroll-run-page .payroll-sheet-table tbody tr:hover td {
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table td[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    color: var(--run-text);
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-table input {
    font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
    font-size: 0.8rem;
}

.payroll-run-page .text-action,
.payroll-run-page .payslip-action {
    display: inline-flex;
    align-items: center;
    margin: 0.05rem;
    padding: 0.28rem 0.48rem;
    border-radius: 8px;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 900;
}

.payroll-save-strip {
    margin: 0;
    border-top: 1px solid var(--run-border);
}

@media (max-width: 1180px) {
    .payroll-run-page .payroll-total-strip.payroll-run-totals,
    .payroll-run-page .payroll-sheet-toolbar {
        position: static;
    }
}

@media (max-width: 760px) {
    .payroll-run-page {
        padding: 0.8rem;
        border-radius: 18px;
    }

    .payroll-run-actions {
        justify-content: flex-start;
    }

    .payroll-publish-strip,
    .payroll-save-strip {
        align-items: stretch;
    }
}

/* Payroll run compact sheet fix: reliable frozen columns and tighter cards */
.payroll-run-page .payroll-total-strip.payroll-run-totals {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals div {
    flex: 1 1 12.5rem;
    min-width: 10.5rem;
    max-width: 16rem;
    min-height: 68px;
    padding: 0.78rem 0.95rem;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals span {
    font-size: 0.68rem;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals strong {
    font-size: clamp(0.96rem, 1.15vw, 1.18rem);
}

.payroll-run-page .payroll-sheet-wrap > .payroll-sheet-table {
    min-width: max(100%, 1980px);
}

.payroll-run-page .payroll-sheet-table th,
.payroll-run-page .payroll-sheet-table td {
    min-width: 7.25rem;
    padding-left: 0.72rem;
    padding-right: 0.72rem;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_number"] {
    left: 0;
    width: 7.75rem;
    min-width: 7.75rem;
    max-width: 7.75rem;
    z-index: 18;
    background: #ffffff;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_name"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    left: 7.75rem;
    width: 13.75rem;
    min-width: 13.75rem;
    max-width: 13.75rem;
    z-index: 18;
    background: #ffffff;
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"] {
    z-index: 42;
    background: #eef4ff;
}

.payroll-run-page .payroll-sheet-table .payroll-filter-row th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table .payroll-filter-row th[data-col="employee_name"] {
    z-index: 41;
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    white-space: normal;
    line-height: 1.35;
}

.payroll-run-page .payroll-sheet-table td[data-col="custom_earnings"],
.payroll-run-page .payroll-sheet-table td[data-col="custom_deductions"] {
    min-width: 13rem;
}

.payroll-run-page .payroll-sheet-table td[data-col="custom_earnings"] input,
.payroll-run-page .payroll-sheet-table td[data-col="custom_deductions"] input {
    min-width: 0 !important;
}

.payroll-run-page .payroll-sheet-table input {
    min-width: 0 !important;
    width: 100%;
}

.payroll-run-page .payroll-sheet-table th[data-col="payslip_actions"],
.payroll-run-page .payroll-sheet-table td[data-col="payslip_actions"] {
    min-width: 11.5rem;
}

.payroll-run-page .payroll-sheet-table tbody tr:hover td[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table tbody tr:hover td[data-col="employee_name"] {
    background: #ffffff;
}

.payroll-run-page .payroll-horizontal-hint {
    width: fit-content;
    max-width: 100%;
}

/* Global header overflow fix: keep actions visible instead of clipping */
.app-shell .topbar {
    width: 100%;
    min-height: 72px;
    margin-bottom: 0.85rem;
    padding: 10px 20px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: nowrap;
    overflow: visible;
    box-sizing: border-box;
    background: linear-gradient(90deg, #f7faff, #eef8f5);
    border: 1px solid #dfe7f3;
}

.app-shell .topbar-main {
    flex: 1 1 auto;
    min-width: 0;
}

.app-shell .topbar-brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
}

.app-shell .topbar-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: contain;
}

.app-shell .topbar-brand-wordmark {
    min-width: 130px;
    flex: 0 1 170px;
    line-height: 1.1;
}

.app-shell .topbar-brand-wordmark strong {
    font-size: 15px;
}

.app-shell .topbar-brand-wordmark span {
    font-size: 11px;
}

.app-shell .sidebar-toggle {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: #1683e8;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(22, 131, 232, 0.22);
}

.app-shell .welcome-block {
    flex: 0 1 150px;
    min-width: 96px;
    line-height: 1.1;
}

.app-shell .welcome-block h2 {
    font-size: 14px;
    line-height: 1.1;
}

.app-shell .welcome-block p {
    font-size: 12px;
}

.app-shell .topbar-side {
    flex: 0 0 auto;
    min-width: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    white-space: nowrap;
    overflow: visible;
}

.app-shell .role-switcher {
    min-height: 42px;
    padding: 4px 8px;
    border: 1px solid #dce5f1;
    border-radius: 12px;
    background: #f8fbff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.app-shell .role-switcher span {
    font-size: 12px;
    color: #667085;
}

.app-shell .role-switcher select {
    height: 30px;
    border: 1px solid #8bb8f0;
    border-radius: 8px;
    padding: 0 10px;
    background: #ffffff;
}

.app-shell .topbar-feedback,
.app-shell .btn-toggle-ui,
.app-shell .apps-trigger {
    min-height: 40px;
    border-radius: 10px;
    flex: 0 0 auto;
}

.app-shell .theme-toggle-panel {
    flex: 0 0 auto;
}

.app-shell .topbar-signout {
    flex: 0 0 auto;
    margin-left: 4px;
    padding-right: 4px;
    color: #138333;
}

@media (max-width: 1180px) {
    .app-shell .topbar-brand-wordmark span,
    .app-shell .role-switcher span {
        display: none;
    }

    .app-shell .topbar-brand-wordmark {
        min-width: 112px;
        flex-basis: 130px;
    }

    .app-shell .btn-toggle-ui {
        padding-left: 10px;
        padding-right: 10px;
        font-size: 12px;
    }
}

@media (max-width: 980px) {
    .app-shell .topbar {
        align-items: flex-start;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .app-shell .topbar-main,
    .app-shell .topbar-side {
        width: 100%;
    }

    .app-shell .topbar-side {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: visible;
        padding-bottom: 6px;
        scrollbar-gutter: stable;
    }
}

@media (max-width: 640px) {
    .app-shell .topbar {
        padding: 10px 12px;
    }

    .app-shell .topbar-brand-wordmark {
        display: none;
    }

    .app-shell .welcome-block {
        flex-basis: auto;
        min-width: 0;
    }

    .app-shell .topbar-signout span {
        display: none;
    }
}

/* Payroll sheet density pass: smaller fields and wrapped headings */
.payroll-run-page .payroll-sheet-wrap > .payroll-sheet-table {
    min-width: max(100%, 1380px);
}

.payroll-run-page .payroll-sheet-table th,
.payroll-run-page .payroll-sheet-table td {
    min-width: 3.85rem;
    max-width: 7.2rem;
    padding: 0.45rem 0.42rem;
    white-space: normal;
}

.payroll-run-page .payroll-sheet-table thead th {
    vertical-align: middle;
    line-height: 1.15;
}

.payroll-run-page .payroll-sheet-table th button.sheet-sort,
.payroll-run-page .sheet-sort {
    display: block;
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.12;
    text-align: center;
}

.payroll-run-page .sheet-sort::after {
    display: inline;
    margin-left: 0.18rem;
}

.payroll-run-page .payroll-filter-row input {
    min-height: 30px;
    padding: 0.25rem 0.35rem;
    font-size: 0.68rem;
    text-align: center;
}

.payroll-run-page .payroll-sheet-table input {
    min-height: 32px;
    padding: 0.32rem 0.42rem;
    font-size: 0.74rem;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_number"] {
    width: 6.15rem;
    min-width: 6.15rem;
    max-width: 6.15rem;
    white-space: normal;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_name"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    left: 6.15rem;
    width: 11.85rem;
    min-width: 11.85rem;
    max-width: 11.85rem;
    white-space: normal;
}

.payroll-run-page .payroll-sheet-table td[data-col="custom_earnings"],
.payroll-run-page .payroll-sheet-table td[data-col="custom_deductions"] {
    min-width: 7.8rem;
    max-width: 8.8rem;
}

.payroll-run-page .payroll-sheet-table th[data-col="payslip_actions"],
.payroll-run-page .payroll-sheet-table td[data-col="payslip_actions"] {
    min-width: 8.8rem;
    max-width: 10rem;
}

/* Payroll frozen-pane header style */
.payroll-run-page .payroll-sheet-table thead th {
    padding: 0.36rem 0.35rem;
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table thead tr:first-child th {
    height: 48px;
}

.payroll-run-page .payroll-sheet-table th button.sheet-sort,
.payroll-run-page .sheet-sort {
    min-height: 38px;
    padding: 0.3rem 0.28rem;
    border-radius: 15px;
    background: linear-gradient(135deg, #1d70e8, #0ea5e9);
    color: #1f3b63;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.24);
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.payroll-run-page .sheet-sort::after {
    color: #31577e;
    font-size: 0.58rem;
}

.payroll-run-page .payroll-filter-row th {
    padding: 0.32rem 0.35rem;
    background: #f8fbff;
}

.payroll-run-page .payroll-filter-row input {
    min-height: 30px;
    border-color: #9fc5f4;
    border-radius: 10px;
    background: #f8fbff;
    color: #53657c;
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"],
.payroll-run-page .payroll-sheet-table .payroll-filter-row th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table .payroll-filter-row th[data-col="employee_name"] {
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"] {
    left: 0;
    width: 6.15rem;
    min-width: 6.15rem;
    max-width: 6.15rem;
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"] {
    left: 6.15rem;
    width: 11.85rem;
    min-width: 11.85rem;
    max-width: 11.85rem;
}

/* Compact fields across overtime prepare, bulk edit, and employee directory */
#overtimePrepareTable {
    min-width: max(100%, 960px);
}

#overtimePrepareTable th,
#overtimePrepareTable td {
    min-width: 4rem;
    max-width: 7rem;
    padding: 0.42rem 0.4rem;
    white-space: normal;
}

#overtimePrepareTable th {
    line-height: 1.12;
    overflow-wrap: anywhere;
}

#overtimePrepareTable input {
    width: 100%;
    min-width: 0 !important;
    min-height: 32px;
    padding: 0.3rem 0.4rem;
    font-size: 0.74rem;
}

#overtimePrepareTable td[data-label="Name"] {
    min-width: 9rem;
    max-width: 12rem;
}

.bulk-edit-shell {
    --bulk-sticky-employee-width: 190px;
}

.bulk-edit-shell .bulk-table-wrap {
    overflow-x: auto;
}

.bulk-edit-shell .bulk-employee-table {
    min-width: max(100%, 1320px);
}

.bulk-edit-shell .bulk-employee-table th,
.bulk-edit-shell .bulk-employee-table td {
    min-width: 4.2rem;
    max-width: 7.4rem;
    padding: 0.42rem 0.42rem;
    white-space: normal;
}

.bulk-edit-shell .bulk-employee-table th {
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.bulk-edit-shell .bulk-employee-table input,
.bulk-edit-shell .bulk-toolbar input,
.bulk-edit-shell .bulk-toolbar select,
.bulk-edit-shell .bulk-field-panel input,
.bulk-edit-shell .bulk-field-panel select {
    min-width: 0 !important;
    min-height: 32px;
    padding: 0.32rem 0.42rem;
    font-size: 0.74rem;
}

.bulk-edit-shell .bulk-employee-table td.sticky-col,
.bulk-edit-shell .bulk-employee-table th.sticky-col {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
}

.bulk-edit-shell .bulk-frozen-employee-rail {
    width: 190px;
    min-width: 190px;
}

.bulk-edit-shell .bulk-frozen-row {
    padding: 0.42rem 0.55rem;
}

.bulk-edit-shell .bulk-frozen-row strong,
.bulk-edit-shell .bulk-frozen-row span,
.bulk-edit-shell .bulk-frozen-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-records-panel .employee-table-scroll > .employee-table,
.employee-directory-card .employee-table-scroll > .employee-table {
    min-width: max(100%, 860px);
}

.employee-records-panel .employee-table th,
.employee-records-panel .employee-table td,
.employee-directory-card .employee-table th,
.employee-directory-card .employee-table td {
    min-width: 4.2rem;
    max-width: 8rem;
    padding: 0.48rem 0.48rem;
    white-space: normal;
}

.employee-records-panel .employee-table th,
.employee-directory-card .employee-table th {
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.employee-records-panel .employee-table td[data-label="Full Name / Cost Centre"],
.employee-directory-card .employee-table td[data-label="Full Name / Cost Centre"] {
    min-width: 12rem;
    max-width: 16rem;
}

.employee-records-panel .employee-table td[data-label="System Actions"],
.employee-directory-card .employee-table td[data-label="System Actions"] {
    min-width: 9rem;
    max-width: 11rem;
}

.employee-records-panel .employee-table-toolbar input,
.employee-records-panel .employee-table-toolbar select,
.employee-directory-card .employee-table-toolbar input,
.employee-directory-card .employee-table-toolbar select {
    min-height: 34px;
    padding: 0.36rem 0.55rem;
    font-size: 0.78rem;
}

/* Payroll run: keep field headings visible during long vertical scrolls */
.payroll-run-page {
    --payroll-sticky-head-top: 0px;
}

.payroll-run-page .payroll-sheet-wrap {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    position: relative;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
    border-right: 0;
}

.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar {
    width: 18px;
    height: 18px;
}

.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #075cb3, #1cb2f8);
    border: 3px solid #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar-thumb:hover {
    background: #064c95;
}

.payroll-run-page .payroll-sheet-table {
    border-collapse: separate;
    border-spacing: 0;
}

.payroll-run-page .payroll-sheet-table th,
.payroll-run-page .payroll-sheet-table td {
    padding: 0.36rem 0.42rem !important;
    line-height: 1.15;
    vertical-align: middle;
}

.payroll-run-page .payroll-sheet-table thead th {
    position: sticky !important;
    top: var(--payroll-sticky-head-top) !important;
    z-index: 70;
    background: #f8fbff;
    background-clip: padding-box;
}

.payroll-run-page .payroll-sheet-table thead th > input[data-filter-col] {
    width: 100%;
    min-height: 24px;
    margin-top: 0.2rem;
    padding: 0.12rem 0.26rem;
    border-color: #9fc5f4;
    border-radius: 9px;
    background: #f8fbff;
    color: #53657c;
    font-size: 0.66rem;
    text-align: center;
}

.payroll-run-page .payroll-sheet-table thead tr:first-child th {
    height: auto;
    min-height: 58px;
}

.payroll-run-page .payroll-sheet-table input,
.payroll-run-page .payroll-sheet-table select,
.payroll-run-page .payroll-sheet-table textarea {
    min-height: 30px !important;
    padding: 0.22rem 0.38rem !important;
    font-size: 0.75rem;
}

.payroll-run-page .payroll-sheet-table small {
    line-height: 1.1;
}

/* Payroll preview card: keep a visible vertical scrollbar inside the card */
.payroll-run-page #payrollRunItemsForm {
    max-height: clamp(460px, calc(100vh - 310px), 760px);
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar {
    width: 18px;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #075cb3, #1cb2f8);
    border: 3px solid #dbeafe;
    border-radius: 999px;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar-thumb:hover {
    background: #064c95;
}

.payroll-run-page .payroll-line-row td {
    height: 38px;
}

.payroll-run-page .payroll-line-row td[data-col="employee_name"] {
    line-height: 1.08;
}

.payroll-run-page .payroll-line-row td[data-col="employee_name"] small {
    display: inline-block;
    margin-top: 0.08rem;
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"] {
    z-index: 92;
}

@media (max-width: 1180px) {
    .payroll-run-page {
        --payroll-sticky-head-top: 0px;
    }

    .payroll-run-page .payroll-sheet-wrap {
        max-height: none;
    }
}

/* Full-width card layout: use all available workspace beside the sidebar */
body.app-body .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
}

body.app-body .page-shell,
body.app-body .page {
    width: 100%;
    max-width: none;
}

body.app-body .page-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - clamp(1.7rem, 4vw, 2.4rem));
    overflow: hidden;
}

body.app-body .topbar {
    flex: 0 0 auto;
}

body.app-body .page {
    flex: 1 1 auto;
    justify-items: stretch;
    align-content: start;
    min-height: 0;
    overflow-y: scroll;
    scrollbar-gutter: stable both-edges;
}

body.app-body .page > *,
body.app-body .card,
body.app-body .hero-card,
body.app-body .payroll-run-page,
body.app-body .payroll-workflow-card,
body.app-body .payroll-run-page #payrollRunItemsForm,
body.app-body .payroll-run-page .payroll-total-strip.payroll-run-totals {
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

body.app-body .payroll-run-page {
    margin-left: 0;
    margin-right: 0;
}

body.app-body .payroll-run-page .payroll-sheet-wrap {
    width: calc(100vw - 220px - clamp(2rem, 4vw, 3.2rem));
    max-width: 100%;
}

body.app-body .page {
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
}

body.app-body .page::-webkit-scrollbar {
    width: 18px;
    height: 18px;
}

body.app-body .page::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

body.app-body .page::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #075cb3, #1cb2f8);
    border: 3px solid #dbeafe;
    border-radius: 999px;
}

body.app-body .app-shell.sidebar-collapsed .page-shell,
body.app-body .app-shell.sidebar-collapsed .page {
    width: 100%;
}

body.app-body .app-shell.sidebar-collapsed .payroll-run-page .payroll-sheet-wrap {
    width: calc(100vw - 88px - clamp(2rem, 4vw, 3.2rem));
}

@media (max-width: 980px) {
    body.app-body .app-shell {
        grid-template-columns: 1fr;
    }

    body.app-body .payroll-run-page .payroll-sheet-wrap,
    body.app-body .app-shell.sidebar-collapsed .payroll-run-page .payroll-sheet-wrap {
        width: 100%;
    }
}

/* Payroll run detail UI polish: frozen headers/employee columns and compact review grid */
.payroll-run-page {
    --payroll-employee-number-width: 5rem;
    --payroll-employee-name-width: 11rem;
    --payroll-sticky-head-top: 0px;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 0;
    margin: 0 0 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(7, 92, 179, 0.12);
    border-radius: 16px;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div {
    min-width: 0;
    border: 0;
    border-right: 1px solid rgba(7, 92, 179, 0.12);
    border-radius: 0;
    padding: 0.62rem 0.75rem;
    box-shadow: none;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:last-child {
    border-right: 0;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) {
    background: linear-gradient(135deg, #075cb3, #1c7ed6);
    border-color: #075cb3;
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.16);
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) span,
.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) strong {
    color: #fff;
}

.payroll-run-page #payrollRunItemsForm {
    max-height: clamp(34rem, calc(100vh - 17rem), 56rem);
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar,
.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar {
    width: 18px;
    height: 18px;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar-track,
.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

.payroll-run-page #payrollRunItemsForm::-webkit-scrollbar-thumb,
.payroll-run-page .payroll-sheet-wrap::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #075cb3, #1cb2f8);
    border: 3px solid #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-scroll-proxy {
    height: 18px;
    margin: 0.25rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-color: rgba(7, 92, 179, 0.55) #dbeafe;
    scrollbar-width: auto;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar {
    height: 12px;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-track {
    background: #dbeafe;
    border-radius: 999px;
}

.payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #075cb3, #1cb2f8);
    border-radius: 999px;
}

.payroll-run-page .payroll-sheet-wrap {
    overflow-x: scroll;
    overflow-y: visible;
    max-height: none;
    border: 1px solid rgba(7, 92, 179, 0.13);
    border-radius: 16px;
    scrollbar-gutter: stable both-edges;
    scrollbar-color: #075cb3 #dbeafe;
    scrollbar-width: auto;
}

.payroll-run-page .payroll-sheet-table {
    border-collapse: separate;
    border-spacing: 0;
}

.payroll-run-page .payroll-sheet-table thead tr {
    position: sticky;
    top: var(--payroll-sticky-head-top);
    z-index: 80;
}

.payroll-run-page .payroll-sheet-table thead th {
    position: sticky !important;
    top: var(--payroll-sticky-head-top) !important;
    z-index: 81;
    min-width: 5.4rem;
    max-width: 7rem;
    padding: 0.38rem 0.34rem 0.3rem !important;
    background: #f8fbff;
    background-clip: padding-box;
    border-bottom: 2px solid #bfd7f5;
    color: #50627b;
    vertical-align: bottom;
}

.payroll-run-page .payroll-sheet-table th button.sheet-sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.05rem;
    padding: 0.18rem 0.24rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #2169e8, #11a5dc);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0.035em;
    text-align: center;
    text-transform: none;
    white-space: normal;
    word-break: normal;
}

.payroll-run-page .payroll-sheet-table th[data-sort-direction="asc"] .sheet-sort::after {
    content: " \2191";
}

.payroll-run-page .payroll-sheet-table th[data-sort-direction="desc"] .sheet-sort::after {
    content: " \2193";
}

.payroll-run-page .payroll-sheet-table thead th > input[data-filter-col] {
    display: block;
    width: 100%;
    min-height: 1.55rem !important;
    margin-top: 0.28rem;
    padding: 0.1rem 0.28rem !important;
    border: 1px solid #9fc5f4 !important;
    border-radius: 8px;
    background: #fff !important;
    box-shadow: none !important;
    color: #53657c;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_number"] {
    position: sticky;
    left: 0;
    z-index: 35;
    width: var(--payroll-employee-number-width);
    min-width: var(--payroll-employee-number-width);
    max-width: var(--payroll-employee-number-width);
    background: #fff;
    border-right: 1px solid #bfd7f5;
}

.payroll-run-page .payroll-sheet-table th[data-col="employee_name"],
.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    position: sticky;
    left: var(--payroll-employee-number-width);
    z-index: 35;
    width: var(--payroll-employee-name-width);
    min-width: var(--payroll-employee-name-width);
    max-width: var(--payroll-employee-name-width);
    background: #fff;
    border-right: 2px solid rgba(7, 92, 179, 0.22);
    box-shadow: 7px 0 12px -8px rgba(15, 23, 42, 0.4);
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"] {
    z-index: 120;
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:nth-child(even) td {
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:nth-child(even) td[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:nth-child(even) td[data-col="employee_name"] {
    background: #f8fbff;
}

.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:hover td {
    background: rgba(7, 92, 179, 0.055) !important;
}

.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:hover td[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table tbody .payroll-line-row:hover td[data-col="employee_name"] {
    background: rgba(7, 92, 179, 0.085) !important;
}

.payroll-run-page .payroll-sheet-table tbody td {
    min-width: 5.4rem;
    max-width: 7rem;
    height: 2.25rem;
    padding: 0.26rem 0.34rem !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    font-size: 0.75rem;
    line-height: 1.08;
    vertical-align: middle;
}

.payroll-run-page .payroll-sheet-table td[data-col="employee_number"] {
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] {
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-table td[data-col="employee_name"] small {
    display: block;
    margin-top: 0.08rem;
    color: #667085;
    font-size: 0.64rem;
    font-weight: 700;
}

.payroll-run-page .payroll-sheet-table td.payroll-static {
    color: #075cb3;
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-table td.payroll-total input {
    color: #0f172a;
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-table .net-pay-preview {
    color: #008a3d;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

.payroll-run-page .payroll-sheet-table tbody td input:not([readonly]),
.payroll-run-page .payroll-sheet-table tbody td input[readonly] {
    width: 100%;
    min-width: 0 !important;
    min-height: 1.68rem !important;
    padding: 0.12rem 0.28rem !important;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: right;
}

.payroll-run-page .payroll-sheet-table tbody td input:not([readonly]) {
    border: 1.4px solid #3b8df5 !important;
    background: #fff !important;
}

.payroll-run-page .payroll-sheet-table tbody td input[readonly] {
    border: 1.4px solid transparent !important;
    background: #f1f5f9 !important;
    color: #0f172a;
    cursor: default;
}

.payroll-run-page .payroll-sheet-table td[data-col="custom_earnings"],
.payroll-run-page .payroll-sheet-table td[data-col="custom_deductions"] {
    min-width: 7rem;
    max-width: 8.5rem;
}

.payroll-run-page .payroll-sheet-table td[data-col="payslip_actions"] {
    min-width: 4.8rem;
    max-width: 5.4rem;
    white-space: normal;
}

.payroll-run-page .payroll-sheet-table .payslip-action,
.payroll-run-page .payroll-sheet-table a.payslip-action,
.payroll-run-page .payroll-sheet-table button.payslip-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: 1.45rem !important;
    height: 1.45rem !important;
    min-width: 1.45rem !important;
    min-height: 1.45rem !important;
    max-width: 1.45rem !important;
    max-height: 1.45rem !important;
    aspect-ratio: 1 / 1;
    margin: 0.05rem !important;
    padding: 0 !important;
    border: 1.5px solid currentColor !important;
    border-radius: 8px !important;
    background: #fff;
    font-size: 0 !important;
    font-weight: 900;
    line-height: 1 !important;
    text-decoration: none;
    vertical-align: middle;
    appearance: none;
}

.payroll-run-page .payroll-sheet-table .payslip-action:hover {
    background: currentColor;
    color: #fff;
}

.payroll-run-page .payroll-sheet-table .payslip-action-svg {
    width: 0.82rem;
    height: 0.82rem;
    display: block;
    flex: 0 0 0.82rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.payroll-run-page .payroll-sheet-table .payslip-action.blue {
    color: #075cb3;
}

.payroll-run-page .payroll-sheet-table .payslip-action.teal {
    color: #0f766e;
}

.payroll-run-page .payroll-sheet-table .payslip-action.orange {
    color: #c75c00;
}

.payroll-run-page .payroll-sheet-table .payslip-action.payroll-row-save {
    color: #475467;
    border-color: #cbd5e1;
}
.payroll-run-page .payroll-sheet-table td[data-col="published"],
.payroll-run-page .payroll-sheet-table td[data-col="email_sent"] {
    color: #667085;
    font-size: 0.7rem;
    text-align: center;
}

.payroll-run-page .payroll-run-actions {
    flex-wrap: wrap;
    gap: 0.45rem;
}

.payroll-run-page .payroll-run-actions .button-link,
.payroll-run-page .payroll-run-actions .danger-button {
    min-height: 2.25rem;
    padding: 0.42rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

@media (max-width: 900px) {
    .payroll-run-page {
        --payroll-employee-number-width: 4.4rem;
        --payroll-employee-name-width: 9.5rem;
    }

    .payroll-run-page #payrollRunItemsForm {
        max-height: 34rem;
    }
}

/* Payroll workspace benchmark refresh */
.payroll-run-page.payroll-run-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.payroll-run-page .payroll-run-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 1.15rem 1.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.payroll-run-page .payroll-run-kicker {
    margin: 0 0 0.18rem;
    color: #0f65d9;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.payroll-run-page .payroll-run-hero h2 {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.25rem, 2vw, 1.62rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.payroll-run-page .payroll-run-hero p:not(.payroll-run-kicker) {
    max-width: 46rem;
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.45;
}

.payroll-run-page .status-badge {
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.payroll-run-page .status-badge.draft {
    background: #fef3c7;
    color: #b45309;
}

.payroll-run-page .status-badge.published {
    background: #dcfce7;
    color: #15803d;
}

.payroll-run-page .payroll-run-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.payroll-run-page .payroll-run-actions .button-link,
.payroll-run-page .payroll-run-actions .danger-button,
.payroll-run-page .payroll-run-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #0f172a;
    box-shadow: none;
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
}

.payroll-run-page .payroll-run-actions .button-link:not(.ghost) {
    border-color: #0f65d9;
    background: #0f65d9;
    color: #fff;
}

.payroll-run-page .payroll-run-actions .danger-button {
    border-color: #fca5a5;
    color: #dc2626;
}

.payroll-run-page .payroll-run-actions .danger-button:hover {
    background: #fef2f2;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals {
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div {
    min-height: 5.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div span {
    color: #64748b;
    font-size: 0.72rem;
    letter-spacing: 0.055em;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div strong {
    margin-top: 0.2rem;
    color: #1e293b;
    font-size: clamp(1rem, 1.4vw, 1.35rem);
    letter-spacing: -0.025em;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) {
    border-left: 4px solid #0f65d9;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) span {
    color: #64748b;
}

.payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) strong {
    color: #1e293b;
}

.payroll-run-page .payroll-workflow-card,
.payroll-run-page #payrollRunItemsForm {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.05);
}

.payroll-run-page .payroll-workflow-card {
    overflow: hidden;
}

.payroll-run-page .payroll-import-bar,
.payroll-run-page .payroll-publish-strip,
.payroll-run-page .payroll-sheet-toolbar,
.payroll-run-page .payroll-tax-toggle {
    margin: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.payroll-run-page .payroll-publish-strip {
    background: #f8fbff;
}

.payroll-run-page .payroll-publish-strip button,
.payroll-run-page .payroll-import-bar button,
.payroll-run-page .payroll-sheet-toolbar button {
    min-height: 2.2rem;
    padding: 0.45rem 0.75rem;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 800;
}

.payroll-run-page .payroll-sheet-toolbar {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.payroll-run-page .payroll-sheet-search {
    min-width: min(100%, 17rem);
}

.payroll-run-page .payroll-sheet-search input,
.payroll-run-page .payroll-sheet-search select {
    min-height: 2.25rem;
    border-color: #cbd5e1;
    border-radius: 9px;
    background: #fff;
    font-size: 0.82rem;
}

.payroll-run-page .payroll-horizontal-hint {
    margin: 0;
    padding: 0.7rem 1rem 0.2rem;
    color: #64748b;
    background: #fff;
    font-size: 0.78rem;
}

.payroll-run-page .payroll-column-panel {
    margin: 0;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
}

.payroll-run-page .payroll-save-strip {
    margin: 0;
    padding: 0.85rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fbff;
}

@media (max-width: 1100px) {
    .payroll-run-page .payroll-run-hero,
    .payroll-run-page .payroll-run-actions {
        justify-content: flex-start;
    }

    .payroll-run-page .payroll-run-actions {
        width: 100%;
    }
}

/* Payroll run: freeze field headers inside the scrolling sheet canvas */
.payroll-run-page #payrollRunItemsForm {
    max-height: none;
    overflow: visible;
}

.payroll-run-page .payroll-sheet-wrap {
    max-height: clamp(28rem, calc(100vh - 23rem), 48rem);
    overflow: auto;
    position: relative;
    scrollbar-gutter: stable both-edges;
}

.payroll-run-page .payroll-sheet-table thead,
.payroll-run-page .payroll-sheet-table thead tr,
.payroll-run-page .payroll-sheet-table thead th {
    position: sticky !important;
    top: 0 !important;
}

.payroll-run-page .payroll-sheet-table thead {
    z-index: 130;
}

.payroll-run-page .payroll-sheet-table thead tr {
    z-index: 131;
}

.payroll-run-page .payroll-sheet-table thead th {
    z-index: 132;
    background: #f8fbff;
    box-shadow: inset 0 -1px 0 #bfd7f5, 0 2px 6px rgba(15, 23, 42, 0.08);
}

.payroll-run-page .payroll-sheet-table thead th[data-col="employee_number"],
.payroll-run-page .payroll-sheet-table thead th[data-col="employee_name"] {
    z-index: 160;
}

/* Minimal spreadsheet system: shared by payroll and dense HR registers */
body.app-body .payroll-run-page.payroll-run-card {
    gap: 0.7rem;
    padding: 0.7rem;
    background: #fff;
}

body.app-body .payroll-run-page .payroll-run-hero,
body.app-body .payroll-run-page .payroll-workflow-card,
body.app-body .payroll-run-page #payrollRunItemsForm {
    border: 1px solid #cfd4dc;
    border-radius: 2px;
    box-shadow: none;
}

body.app-body .payroll-run-page .payroll-run-hero {
    padding: 0.75rem 0.85rem;
}

body.app-body .payroll-run-page .payroll-run-kicker {
    color: #5f6b7a;
}

body.app-body .payroll-run-page .payroll-total-strip.payroll-run-totals {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border: 1px solid #cfd4dc;
    background: #fff;
}

body.app-body .payroll-run-page .payroll-total-strip.payroll-run-totals > div,
body.app-body .payroll-run-page .payroll-total-strip.payroll-run-totals > div:nth-child(5) {
    min-width: 9.5rem;
    min-height: 3.7rem;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-right: 1px solid #d9dde3;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

body.app-body .payroll-run-page .payroll-total-strip.payroll-run-totals > div strong {
    font-size: 1rem;
}

body.app-body .payroll-run-page .payroll-sheet-toolbar,
body.app-body .payroll-run-page .payroll-tax-toggle,
body.app-body .payroll-run-page .payroll-import-bar,
body.app-body .payroll-run-page .payroll-publish-strip,
body.app-body .payroll-run-page .payroll-save-strip {
    padding: 0.55rem 0.7rem;
    background: #f8f9fa;
}

body.app-body .payroll-run-page .payroll-horizontal-hint {
    padding: 0.35rem 0.7rem;
    border-bottom: 1px solid #d9dde3;
    background: #fff;
    font-size: 0.7rem;
}

body.app-body .payroll-run-page .payroll-sheet-wrap,
body.app-body .bulk-edit-shell .bulk-table-wrap,
body.app-body .employee-table-scroll,
body.app-body .table-scroll {
    border: 1px solid #bfc5cd;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
}

body.app-body :is(
    #payrollSheetTable,
    .bulk-employee-table,
    #employeeDirectoryTable,
    #deductionRegister,
    #severanceBalancesTable,
    #leaveBalancesTable,
    .payroll-report-table,
    .table-scroll > table.responsive-table
) {
    border-collapse: separate;
    border-spacing: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: #202124;
    font-family: Arial, Calibri, sans-serif;
    font-size: 0.75rem;
}

body.app-body :is(
    #payrollSheetTable,
    .bulk-employee-table,
    #employeeDirectoryTable,
    #deductionRegister,
    #severanceBalancesTable,
    #leaveBalancesTable,
    .payroll-report-table,
    .table-scroll > table.responsive-table
) th {
    height: 2rem;
    padding: 0.3rem 0.42rem;
    border-right: 1px solid #cfd4dc;
    border-bottom: 1px solid #aeb4bd;
    border-radius: 0;
    background: #f1f3f4;
    color: #2f343a;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.15;
    text-align: left;
    text-transform: none;
}

body.app-body :is(
    #payrollSheetTable,
    .bulk-employee-table,
    #employeeDirectoryTable,
    #deductionRegister,
    #severanceBalancesTable,
    #leaveBalancesTable,
    .payroll-report-table,
    .table-scroll > table.responsive-table
) td {
    height: 2rem;
    padding: 0.28rem 0.42rem;
    border-right: 1px solid #e0e3e7;
    border-bottom: 1px solid #d9dde3;
    background: #fff;
    color: #202124;
    line-height: 1.2;
    vertical-align: middle;
}

body.app-body :is(
    #payrollSheetTable,
    .bulk-employee-table,
    #employeeDirectoryTable,
    #deductionRegister,
    #severanceBalancesTable,
    #leaveBalancesTable,
    .payroll-report-table,
    .table-scroll > table.responsive-table
) tbody tr:nth-child(even) td {
    background: #fff;
}

body.app-body :is(
    #payrollSheetTable,
    .bulk-employee-table,
    #employeeDirectoryTable,
    #deductionRegister,
    #severanceBalancesTable,
    #leaveBalancesTable,
    .payroll-report-table,
    .table-scroll > table.responsive-table
) tbody tr:hover td {
    background: #eef4fb;
}

body.app-body .payroll-run-page .payroll-sheet-table thead th,
body.app-body .payroll-run-page .payroll-sheet-table thead tr:first-child th {
    background: #f1f3f4 !important;
    box-shadow: none !important;
}

body.app-body .payroll-run-page .payroll-sheet-table th button.sheet-sort {
    width: 100%;
    min-height: 1.15rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #2f343a;
    box-shadow: none;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

body.app-body .payroll-run-page .payroll-sheet-table thead th > input[data-filter-col],
body.app-body .payroll-run-page .payroll-filter-row input {
    min-height: 1.45rem;
    margin-top: 0.22rem;
    padding: 0.12rem 0.28rem;
    border: 1px solid #c6cbd2;
    border-radius: 0;
    background: #fff;
    color: #30343b;
    font-size: 0.64rem;
    box-shadow: none;
}

body.app-body .payroll-run-page .payroll-sheet-table tbody td input,
body.app-body .payroll-run-page .payroll-sheet-table tbody td select,
body.app-body .bulk-edit-shell .bulk-employee-table input,
body.app-body .bulk-edit-shell .bulk-employee-table select,
body.app-body #deductionRegister input,
body.app-body #leaveBalancesTable input,
body.app-body #severanceBalancesTable input {
    min-height: 1.55rem;
    padding: 0.12rem 0.25rem;
    border: 1px solid transparent !important;
    border-radius: 0;
    background: transparent !important;
    color: #202124;
    box-shadow: none;
    font: inherit;
}

body.app-body .payroll-run-page .payroll-sheet-table tbody td input:hover,
body.app-body .bulk-edit-shell .bulk-employee-table input:hover,
body.app-body #deductionRegister input:hover,
body.app-body #leaveBalancesTable input:hover,
body.app-body #severanceBalancesTable input:hover {
    border-color: #b8bec7;
}

body.app-body .payroll-run-page .payroll-sheet-table tbody td input:focus,
body.app-body .payroll-run-page .payroll-sheet-table tbody td select:focus,
body.app-body .bulk-edit-shell .bulk-employee-table input:focus,
body.app-body .bulk-edit-shell .bulk-employee-table select:focus,
body.app-body #deductionRegister input:focus,
body.app-body #leaveBalancesTable input:focus,
body.app-body #severanceBalancesTable input:focus {
    position: relative;
    z-index: 2;
    border-color: #217346 !important;
    outline: 1px solid #217346;
    background: #fff !important;
}

body.app-body .payroll-run-page .payroll-sheet-table tbody td input[readonly] {
    background: #f7f8f9 !important;
    color: #4f5965;
}

body.app-body .payroll-run-page .payroll-sheet-table .payroll-earning,
body.app-body .payroll-run-page .payroll-sheet-table .payroll-deduction,
body.app-body .payroll-run-page .payroll-sheet-table .payroll-total,
body.app-body .payroll-run-page .payroll-sheet-table [data-col="net_pay"] {
    background: #fff;
    color: #202124;
}

body.app-body .payroll-run-page .payroll-sheet-table .payroll-total,
body.app-body .payroll-run-page .payroll-sheet-table [data-col="net_pay"] {
    font-weight: 700;
}

body.app-body .payroll-run-page .payroll-sheet-table th[data-col="employee_number"],
body.app-body .payroll-run-page .payroll-sheet-table th[data-col="employee_name"] {
    background: #e9ecef !important;
}

body.app-body .payroll-run-page .payroll-sheet-table td[data-col="employee_number"],
body.app-body .payroll-run-page .payroll-sheet-table td[data-col="employee_name"],
body.app-body .bulk-edit-shell .bulk-employee-table td.sticky-col {
    background: #f8f9fa !important;
}

body.app-body :is(.table-scroll, .payroll-sheet-wrap, .employee-table-scroll)::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

body.app-body :is(.table-scroll, .payroll-sheet-wrap, .employee-table-scroll),
body.app-body .payroll-run-page .payroll-scroll-proxy {
    scrollbar-color: #aab2bd #f1f3f4;
}

body.app-body .payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-track {
    border-radius: 0;
    background: #f1f3f4;
}

body.app-body .payroll-run-page .payroll-scroll-proxy::-webkit-scrollbar-thumb {
    border: 2px solid #f1f3f4;
    border-radius: 0;
    background: #aab2bd;
}

body.app-body :is(.table-scroll, .payroll-sheet-wrap, .employee-table-scroll)::-webkit-scrollbar-track {
    background: #f1f3f4;
}

body.app-body :is(.table-scroll, .payroll-sheet-wrap, .employee-table-scroll)::-webkit-scrollbar-thumb {
    border: 2px solid #f1f3f4;
    border-radius: 0;
    background: #aab2bd;
}

body.app-body :is(.table-scroll, .payroll-sheet-wrap, .employee-table-scroll)::-webkit-scrollbar-thumb:hover {
    background: #7f8996;
}
