:root {
  /* ---------- Ink (deep navy-tinted, not pure gray) ---------- */
  --ink: #0b1229;
  --ink-secondary: #4a5578;
  --ink-muted: #97a0bd;

  --surface: #ffffff;
  --surface-alt: #f6f7fb;
  --surface-raised: #ffffff;
  --border: #e2e5f0;
  --border-strong: #ccd1e6;

  /* ---------- Deep navy/indigo brand accent ---------- */
  --accent: #4338ca;
  --accent-hover: #362e9e;
  --accent-soft: #ecebfd;
  --accent-glow: rgba(67, 56, 202, 0.28);

  --success: #059669;
  --success-soft: #ecfdf5;
  --success-text: #047857;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;

  --warning: #d97706;
  --warning-soft: #fffbeb;

  /* ---------- Sidebar: true navy depth, not flat black ---------- */
  --sidebar-bg: #0a0f26;
  --sidebar-bg-raised: #10173a;
  --sidebar-text: rgba(226, 229, 245, 0.66);
  --sidebar-text-hover: rgba(255, 255, 255, 0.95);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.055);
  --sidebar-active-bg: rgba(99, 91, 255, 0.22);

  /* ---------- Density: tighter scale for data-rich desktop views ---------- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 18px;
  --space-xl: 24px;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-xs: 0 1px 2px rgba(11, 18, 41, 0.05);
  --shadow-sm: 0 2px 6px rgba(11, 18, 41, 0.08), 0 1px 2px rgba(11, 18, 41, 0.05);
  --shadow-lg: 0 16px 40px rgba(10, 15, 38, 0.22);
  --shadow-glow: 0 0 0 1px rgba(67, 56, 202, 0.08), 0 8px 24px rgba(67, 56, 202, 0.14);

--bottom-nav-height: 60px;

  /* ---------- Cohesive group-color family (payroll table sections) ---------- */
  --group-regular: var(--accent);
  --group-regular-2: #6d5ce8;
  --group-special: #b45309;
  --group-special-2: #d97706;
  --group-legal: #6d28d9;
  --group-legal-2: #8b5cf6;
  --group-benefits: #334155;
  --group-benefits-2: #475467;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', -apple-system, sans-serif; background: var(--surface-alt); color: var(--ink); font-size: 14px; line-height: 1.48; letter-spacing: -0.003em; }
* { transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease, color .15s ease; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Auth Screen: layered navy depth, not a flat gradient ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 15%, #171f4a 0%, var(--sidebar-bg) 45%),
              radial-gradient(circle at 85% 85%, #1a1450 0%, transparent 50%),
              var(--sidebar-bg);
  padding: 20px;
}
.auth-screen::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 70%);
}
.auth-card {
  position: relative; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 40px 32px; width: 100%; max-width: 380px; text-align: center;
  animation: authIn .4s cubic-bezier(.16,1,.3,1) backwards;
}
@keyframes authIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.auth-logo {
  width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), #6d5ce8); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 25px;
  box-shadow: var(--shadow-glow);
}
.auth-card h1 { font-size: 21px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.auth-sub { color: var(--ink-secondary); margin: 0 0 26px; font-size: 13.5px; }
.field-label { display: block; text-align: left; font-size: 12.5px; font-weight: 600; margin: 14px 0 6px; color: var(--ink-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.field-input { border-radius: var(--radius-sm) !important; padding: 11px 14px !important; border: 1.5px solid var(--border) !important; font-size: 14.5px !important; color: var(--ink) !important; }
.field-input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3.5px var(--accent-soft) !important; }
.btn { border: none; border-radius: var(--radius-sm); padding: 10px 17px; font-size: 13.5px; font-weight: 600; cursor: pointer; position: relative; overflow: hidden; letter-spacing: -0.005em; }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #372fb0 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(67, 56, 202, 0.15);
}
.btn-primary:hover { box-shadow: 0 6px 18px var(--accent-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--danger-soft); color: var(--danger-text); }
.btn-danger:hover { background: #fde2e1; box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15); }

.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn.is-loading { pointer-events: none; opacity: 0.75; transform: none !important; }
.btn.is-loading::after {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%;
  vertical-align: -1.5px; animation: spin .6s linear infinite;
}
.btn-secondary.is-loading::after, .btn-danger.is-loading::after { border-color: rgba(16,24,40,0.2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; text-align: left; }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert-success { background: var(--success-soft); color: var(--success-text); }

/* ---------- App Shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.icon-btn { background: none; border: none; font-size: 17px; cursor: pointer; color: var(--ink-secondary); width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { background: var(--surface-alt); color: var(--accent); }
.icon-btn:active { transform: scale(0.92); }
.topbar-title { font-weight: 700; font-size: 15px; flex: 1; letter-spacing: -0.015em; color: var(--ink); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-secondary); font-weight: 600; }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #6d5ce8 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
}

.layout { flex: 1; display: flex; position: relative; }

/* ---------- Sidebar: dark, structural ---------- */
.sidebar {
  width: 232px; padding: 16px 12px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(180deg, var(--sidebar-bg-raised) 0%, var(--sidebar-bg) 100%);
  border-right: 1px solid rgba(255,255,255,0.04);
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
}
.nav-item i { font-size: 16px; width: 18px; text-align: center; }
.nav-item::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: linear-gradient(180deg, var(--accent), #6d5ce8); border-radius: 0 3px 3px 0;
  transform: scaleY(0); transition: transform .18s ease;
}
.nav-item.active { box-shadow: inset 0 0 0 1px rgba(109, 92, 232, 0.15); }
.nav-item:hover:not(.active) { background: var(--sidebar-hover-bg); color: var(--sidebar-text-hover); }
.nav-item.active { background: var(--sidebar-active-bg); color: #fff; }
.nav-item.active::before { transform: scaleY(1); }
.sidebar-overlay { display: none; }

.content { flex: 1; padding: 22px 28px; max-width: none; min-width: 0; }
.content > * { animation: contentIn .3s ease backwards; }
.content > *:nth-child(1) { animation-delay: 0s; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
@keyframes contentIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.view-header .view-title { margin-bottom: 0; }

/* ---------- Stat cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-xs); cursor: default; position: relative; overflow: hidden; }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; opacity: 0;
  background: linear-gradient(90deg, var(--accent), #6d5ce8); transition: opacity .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); border-color: var(--border-strong); }
.stat-card:hover::before { opacity: 1; }
.stat-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 12px; }
.stat-icon-accent { background: var(--accent-soft); color: var(--accent); }
.stat-icon-amber { background: #fdf3e7; color: var(--group-special); }
.stat-icon-danger { background: var(--danger-soft); color: var(--danger); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-label { color: var(--ink-secondary); font-size: 12px; margin-top: 3px; font-weight: 500; }

.placeholder-note {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px 24px; color: var(--ink-secondary); font-size: 13.5px; text-align: center;
  position: relative;
}
.placeholder-note::before {
  content: '\f64d'; /* bi-inbox */
  font-family: 'bootstrap-icons'; display: block; font-size: 26px;
  color: var(--ink-muted); margin-bottom: 10px; opacity: 0.55;
}
.placeholder-note:hover { border-color: var(--border-strong); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar-search { flex: 2; min-width: 180px; }
.toolbar-select { flex: 1; min-width: 130px; }
.list-meta { font-size: 12.5px; color: var(--ink-muted); margin-bottom: 12px; font-weight: 500; }

/* ---------- Employee list ---------- */
.emp-list { display: flex; flex-direction: column; gap: 8px; }
.emp-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px;
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
  animation: rowIn .25s ease backwards; animation-delay: calc(var(--i, 0) * 0.03s);
}
.emp-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); border-color: var(--accent); color: inherit; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.emp-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px;
  color: #fff; letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--group-regular) 0%, var(--group-regular-2) 100%);
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.18);
}
/* Client cards get a distinct hue — visually signals "different entity type" from employees */
.client-avatar { background: linear-gradient(135deg, var(--group-legal) 0%, var(--group-legal-2) 100%) !important; box-shadow: 0 2px 6px rgba(109, 40, 217, 0.18) !important; }
.emp-info { flex: 1; min-width: 0; }
.emp-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.emp-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.emp-meta { text-align: right; flex-shrink: 0; }
.emp-rate { font-weight: 600; font-size: 13.5px; color: var(--ink); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; margin-top: 4px; letter-spacing: 0.02em; text-transform: uppercase; }
.badge-active { background: var(--success-soft); color: var(--success-text); }
.badge-inactive { background: var(--danger-soft); color: var(--danger-text); }
.badge-draft { background: #fdf3e7; color: var(--group-special); }

/* ---------- Forms ---------- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-xs); max-width: 580px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 15px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.form-group small { display: block; margin-top: 5px; color: var(--ink-muted); font-size: 12px; }

/* ---------- Refined input chrome, used app-wide ---------- */
input.field-input, select.field-input, textarea.field-input {
  background: var(--surface-alt);
  box-shadow: inset 0 1px 2px rgba(11, 18, 41, 0.03);
}
input.field-input:hover:not(:focus):not([readonly]):not(:disabled),
select.field-input:hover:not(:focus):not(:disabled) {
  background: var(--surface); border-color: var(--border-strong) !important;
}
input.field-input:focus, select.field-input:focus, textarea.field-input:focus {
  background: var(--surface);
}
input.field-input:disabled, select.field-input:disabled {
  background: var(--surface-alt); color: var(--ink-muted); cursor: not-allowed; opacity: 0.7;
}
input.field-input::placeholder { color: var(--ink-muted); opacity: 0.7; }

/* Required-field marker, applied via a small span in markup — subtle, not shouty */
.required-mark { color: var(--danger); margin-left: 2px; }

.rate-history-item { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.rate-history-item:last-child { border-bottom: none; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.att-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.att-table th, .att-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.att-table th { font-weight: 600; color: var(--ink-secondary); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-alt); white-space: nowrap; }
.att-table tr:last-child td { border-bottom: none; }
.att-table tbody tr { animation: rowIn .25s ease backwards; animation-delay: calc(var(--i, 0) * 0.03s); }
.att-table tbody tr:hover { background: var(--surface-alt); }
.att-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.att-sub { font-size: 11.5px; color: var(--ink-muted); }
/* ---------- Custom select chrome — matches the rest of the design language ---------- */
select.field-input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a5578' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px !important;
  cursor: pointer;
}
select.field-input:hover { border-color: var(--accent) !important; }
select.field-input optgroup { font-weight: 700; color: var(--accent); font-style: normal; }

.att-select { min-width: 100px; padding: 6px 26px 6px 8px !important; font-size: 13px !important; }
.att-time { min-width: 110px; padding: 6px 8px !important; font-size: 13px !important; }
.att-remarks { min-width: 130px; padding: 6px 8px !important; font-size: 13px !important; }
.att-hours { white-space: nowrap; font-weight: 600; color: var(--ink); }

.date-picker-form { display: flex; align-items: center; gap: 8px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 74px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast {
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 12px 16px 12px 14px;
  font-size: 13px; font-weight: 500; border-left: 3px solid var(--accent); opacity: 0; transform: translateX(20px);
  animation: toastIn .25s ease forwards;
  display: flex; align-items: flex-start; gap: 10px;
}
.toast::before {
  font-family: 'bootstrap-icons'; font-size: 15px; line-height: 1.4; flex-shrink: 0;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-success::before { content: '\f26a'; color: var(--success); } /* bi-check-circle-fill */
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-error::before { content: '\f622'; color: var(--danger); } /* bi-x-circle-fill */
.toast.toast-out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Mobile: bottom tab bar replaces the off-canvas sidebar ---------- */
@media (min-width: 769px) {
  #menuToggle, .bottom-tab-bar, .more-sheet-overlay { display: none; }
}

@media (max-width: 768px) {
  .sidebar, .sidebar-overlay, #menuToggle { display: none; }
  .content { padding: 16px; padding-bottom: calc(var(--bottom-nav-height) + 20px); }
  .topbar-user span { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }

  .bottom-tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: var(--bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--sidebar-bg-raised);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: stretch;
    box-shadow: 0 -8px 24px rgba(10, 15, 38, 0.25);
  }
  .bottom-tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--sidebar-text); text-decoration: none; font-size: 10.5px; font-weight: 600;
    position: relative; border: none; background: none; font-family: inherit; cursor: pointer;
  }
  .bottom-tab-item i { font-size: 19px; }
  .bottom-tab-item.active { color: #fff; }
  .bottom-tab-item.active::before {
    content: ''; position: absolute; top: 2px; width: 28px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #6d5ce8);
  }
  .bottom-tab-item:active { transform: scale(0.94); }

  .more-sheet-overlay {
    position: fixed; inset: 0; z-index: 45; background: rgba(10,15,38,0.5);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .more-sheet-overlay.show { opacity: 1; pointer-events: auto; }
  .more-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    background: var(--surface); border-radius: 20px 20px 0 0;
    padding: 8px 8px calc(20px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%); transition: transform .25s cubic-bezier(.16,1,.3,1);
    box-shadow: 0 -12px 32px rgba(10,15,38,0.2);
    max-height: 70vh; overflow-y: auto;
  }
  .more-sheet-overlay.show .more-sheet { transform: translateY(0); }
  .more-sheet-handle { width: 36px; height: 4px; background: var(--border-strong); border-radius: 3px; margin: 8px auto 12px; }
  .more-sheet-item {
    display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 12px;
    color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500;
  }
  .more-sheet-item:active { background: var(--surface-alt); }
  .more-sheet-item i { font-size: 17px; color: var(--accent); width: 20px; text-align: center; }
}

.view-sub { color: var(--ink-secondary); font-size: 13.5px; margin: 6px 0 20px; }
.rates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; max-width: none; }
.rates-grid .form-card { max-width: none; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.card-title i { color: var(--accent); }
.section-title { font-size: 15px; font-weight: 600; margin: 28px 0 14px; color: var(--ink); }
.hint-text { font-size: 12px; color: var(--ink-muted); margin: 4px 0 0; }
.calc-card { max-width: 420px; }
.calc-result { margin-top: 14px; }

.loan-card { align-items: flex-start; }
.loan-progress-track { height: 5px; background: var(--border); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.loan-progress-fill { height: 100%; background: linear-gradient(90deg, var(--group-regular), var(--group-regular-2)); border-radius: 4px; transition: width .3s ease; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.report-grid .form-card { max-width: none; }

.type-split-bar { height: 22px; border-radius: 6px; overflow: hidden; background: #fdf3e7; display: flex; }
.type-split-salary { background: linear-gradient(90deg, var(--group-regular), var(--group-regular-2)); height: 100%; }
.type-split-legend { display: flex; gap: 20px; margin-top: 10px; font-size: 13px; color: var(--ink-secondary); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.legend-salary { background: var(--group-regular); }
.legend-hourly { background: var(--group-special); }

.export-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.export-btn { display: inline-flex; align-items: center; gap: 8px; }

.deployment-banner { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.deployment-banner a { color: var(--accent); font-weight: 600; }

.checkbox-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-secondary); white-space: nowrap; }
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer;
}

.print-area { background: #fff; padding: 20px; }
.print-header { text-align: center; margin-bottom: 20px; }
.print-header h2 { margin: 0 0 4px; font-size: 18px; }
.print-header p { margin: 2px 0; font-size: 13px; color: var(--ink-secondary); }
.print-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.print-table th, .print-table td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
.print-table th { background: #f2f2f2; font-weight: 600; }
.print-total-row { font-weight: 700; background: #fafafa; }
.print-signatures { display: flex; justify-content: space-between; margin-top: 60px; }
.print-sig-line { width: 44%; border-top: 1px solid #000; text-align: center; padding-top: 6px; font-size: 12px; }

@media print {
  .no-print, .topbar, .sidebar, .sidebar-overlay { display: none !important; }
  .content { padding: 0 !important; max-width: none !important; }
  body { background: #fff !important; }
  .print-area { padding: 0; }
}

.att-time { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.att-time.time-invalid { border-color: var(--danger) !important; background: var(--danger-soft); }

.schedule-select {
  min-width: 190px;
  border-left: 3px solid var(--border-strong) !important;
  padding-left: 10px !important;
  font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease;
}
.schedule-select.status-present { border-left-color: var(--group-regular) !important; background-color: var(--accent-soft); }
.schedule-select.status-absent  { border-left-color: var(--danger) !important; background-color: var(--danger-soft); color: var(--danger-text); }
.schedule-select.status-leave   { border-left-color: var(--group-special) !important; background-color: #fdf3e7; color: var(--group-special); }
.schedule-select.status-holiday { border-left-color: var(--group-legal) !important; background-color: #f2ecfd; color: var(--group-legal); }
.schedule-select.status-restday { border-left-color: var(--group-benefits) !important; background-color: #eef1f5; color: var(--group-benefits); }
.schedule-select.status-custom  { border-left-color: var(--ink-muted) !important; }
.schedule-select.status-empty   { border-left-color: var(--border-strong) !important; font-weight: 500; color: var(--ink-muted); }

.custom-status-select { border-left: 3px solid var(--ink-muted) !important; padding-left: 10px !important; }

.att-time[readonly] { background: var(--surface-alt); color: var(--ink-muted); cursor: default; }
.att-time:not([readonly]):focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3.5px var(--accent-soft) !important; }

/* ==================================================================
   Grouped Payroll Table — rebuilt for correct stacking + consistent widths
   ================================================================== */
.grouped-table {
  min-width: 1750px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Kill the universal transition on table cells — it was causing flicker
   during scroll as background-color kept re-triggering mid-transition. */
.grouped-table th, .grouped-table td { transition: none; }

/* ---------- Column widths: fixed, so every column in a group matches ---------- */
.grouped-table col.col-num       { width: 40px; }
.grouped-table col.col-account   { width: 128px; }
.grouped-table col.col-employee  { width: 150px; }
.grouped-table col.col-rate      { width: 130px; }
.grouped-table col.col-hrs       { width: 76px; }
.grouped-table col.col-gross     { width: 118px; }
.grouped-table col.col-benefit   { width: 100px; }
.grouped-table col.col-loan      { width: 90px; }
.grouped-table col.col-net       { width: 118px; }
.grouped-table col.col-action    { width: 110px; }

.grouped-table th, .grouped-table td {
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grouped-table td { padding: 10px; }
.grouped-table td:last-child { overflow: visible; text-overflow: clip; }

/* Center every data column from Daily Rate through Net Pay — excludes the
   sticky #/Account No./Employee columns and the trailing action button column. */
.grouped-table td:not(.sticky-col-1):not(.sticky-col-2):not(.sticky-col-3):not(:last-child) {
  text-align: center;
}
.grouped-table th { text-align: center; }

/* ---------- Sticky header rows (stay visible on vertical scroll) ----------
   Fixed, exact heights on both rows (instead of guessed padding) so the
   second row's sticky "top" offset lines up perfectly with the first
   row's real rendered height — no seam, no gap. */
.grouped-table thead th {
  position: sticky;
  z-index: 4;
  background: var(--surface-alt);
  border-bottom: none; /* the generic .att-table th border-bottom was creating a second, misaligned line */
  box-sizing: border-box;
}
.grouped-table thead tr:first-child th {
  height: 42px;
  top: 0;
}
.grouped-table thead tr:last-child th {
  height: 38px;
  text-align: center;
  font-size: 10.5px;
  top: 42px;
  border-top: 1px solid rgba(16, 24, 40, 0.06);
}

/* ---------- Group header bars: solid color, own z-index layer ---------- */
.grouped-table th.group-header {
  text-align: center; color: #fff !important; font-weight: 700; letter-spacing: 0.04em;
}
.grouped-table th.group-regular-ot { background: linear-gradient(135deg, var(--group-regular) 0%, var(--group-regular-2) 100%) !important; }
.grouped-table th.group-special { background: linear-gradient(135deg, var(--group-special) 0%, var(--group-special-2) 100%) !important; }
.grouped-table th.group-legal { background: linear-gradient(135deg, var(--group-legal) 0%, var(--group-legal-2) 100%) !important; }
.grouped-table th.group-benefits { background: linear-gradient(135deg, var(--group-benefits) 0%, var(--group-benefits-2) 100%) !important; }

.grouped-table thead tr:last-child th.sub-regular-ot { background: var(--accent-soft); color: var(--group-regular); }
.grouped-table thead tr:last-child th.sub-special { background: #fdf3e7; color: var(--group-special); }
.grouped-table thead tr:last-child th.sub-legal { background: #f2ecfd; color: var(--group-legal); }
.grouped-table thead tr:last-child th.sub-benefits { background: #eef1f5; color: var(--group-benefits); }

/* ---------- Data cell tints, matching each group ---------- */
.grouped-table td.col-regular-ot { background: rgba(67, 56, 202, 0.035); }
.grouped-table td.col-special { background: rgba(180, 83, 9, 0.04); }
.grouped-table td.col-legal { background: rgba(109, 40, 217, 0.035); }
.grouped-table td.col-benefits { background: rgba(51, 65, 85, 0.03); }

/* Single, consistent 1px divider at each group boundary — no more double-line effect */
.grouped-table td.group-start { border-left: 1px solid var(--border-strong); }
.grouped-table thead tr:last-child th.group-start { border-left: 1px solid var(--border-strong); }

.grouped-table td.col-gross { font-weight: 700; color: var(--ink); background: var(--surface-alt); border-left: 1px solid var(--border-strong); font-size: 14.5px; }
.grouped-table th.col-gross-header { background: var(--surface-alt); }
.grouped-table .att-hours { font-weight: 700; color: var(--accent); font-size: 14.5px; }

/* ---------- Row hover ---------- */
.grouped-table tbody tr:hover td { background: var(--surface-alt) !important; }

/* ---------- Sticky identity columns: explicit classes, not nth-child ----------
   nth-child breaks here because the rowspan="2" cells (#, Account No., Employee)
   only exist as real DOM elements in the FIRST header row — in the second header
   row, "REG HRS" etc. become nth-child(1)/(2)/(3) instead. Using explicit
   .sticky-col-N classes avoids that entirely. */
.grouped-table .sticky-col-1,
.grouped-table .sticky-col-2,
.grouped-table .sticky-col-3 {
  position: sticky;
}
.grouped-table td.sticky-col-1,
.grouped-table td.sticky-col-2,
.grouped-table td.sticky-col-3 {
  z-index: 2; background: var(--surface);
}
.grouped-table th.sticky-col-1,
.grouped-table th.sticky-col-2,
.grouped-table th.sticky-col-3 {
  z-index: 5; /* corner cells: above both the sticky column body AND the plain sticky header */
}
.grouped-table .sticky-col-1 { left: 0; }
.grouped-table .sticky-col-2 { left: 40px; }
.grouped-table .sticky-col-3 {
  left: 168px;
  box-shadow: 2px 0 6px rgba(16, 24, 40, 0.08);
}
.grouped-table tbody tr:hover td.sticky-col-1,
.grouped-table tbody tr:hover td.sticky-col-2,
.grouped-table tbody tr:hover td.sticky-col-3 { background: var(--surface-alt) !important; }

.grouped-table .att-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Tablet / mobile: tighten up rather than break layout ---------- */
@media (max-width: 1024px) {
  .grouped-table { min-width: 1500px; }
  .grouped-table th, .grouped-table td { padding: 8px 7px; font-size: 12.5px; }
  .grouped-table thead tr:last-child th { font-size: 9.5px; }
  .grouped-table col.col-hrs { width: 62px; }
  .grouped-table col.col-benefit { width: 84px; }
}

.prev-gross-hint { font-size: 10.5px; font-style: italic; color: var(--ink-muted); font-weight: 400; margin-top: 2px; white-space: nowrap; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 28px; }
.quick-action-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--ink); font-size: 13.5px; font-weight: 600;
  text-decoration: none; box-shadow: var(--shadow-xs);
}
.quick-action-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.quick-action-btn i { color: var(--accent); font-size: 15px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.dashboard-grid .form-card { max-width: none; }

.dash-list-item {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 4px;
  border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { background: var(--surface-alt); margin: 0 -4px; padding: 11px 8px; border-radius: 6px; }
.dash-list-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.dash-list-value { font-weight: 600; font-size: 13.5px; color: var(--ink); }

@media (max-width: 768px) {
  .quick-actions { flex-direction: column; }
  .quick-action-btn { justify-content: center; }
}

.dashboard-greeting .view-sub { margin-top: 8px; }

/* ---------- Field-level error state — for future use where a single input needs flagging ---------- */
.field-input.field-error { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.field-error-msg { color: var(--danger-text); font-size: 11.5px; margin-top: 4px; font-weight: 500; }

/* ---------- Custom scrollbars (WebKit + Firefox) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid var(--surface-alt); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); background-clip: padding-box; }

.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.flash-msg { position: absolute; left: -9999px; }

/* ---------- SweetAlert2 theming to match the app's design language ---------- */
.swal-app-popup { border-radius: 16px !important; font-family: 'Inter', -apple-system, sans-serif !important; }
.swal-app-title { font-size: 18px !important; font-weight: 700 !important; color: var(--ink) !important; letter-spacing: -0.01em; }
.swal2-html-container { font-size: 13.5px !important; color: var(--ink-secondary) !important; }
.swal-app-confirm-btn {
  border-radius: 8px !important; font-weight: 600 !important; font-size: 13.5px !important;
  padding: 10px 20px !important; box-shadow: none !important;
}
.swal-app-cancel-btn {
  border-radius: 8px !important; font-weight: 600 !important; font-size: 13.5px !important;
  padding: 10px 20px !important; color: var(--ink) !important; box-shadow: none !important;
}
.swal2-icon.swal2-warning { border-color: var(--danger) !important; color: var(--danger) !important; }
.swal2-icon.swal2-question { border-color: var(--accent) !important; color: var(--accent) !important; }