:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #111923;
  --muted: #647184;
  --line: #dce3e9;
  --nav: #10171e;
  --nav-2: #18222c;
  --accent: #f5a524;
  --accent-2: #ffbe4d;
  --success: #0b8f68;
  --danger: #b73d35;
  --shadow: 0 16px 42px rgba(17, 25, 35, 0.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 70% 0%, #fff8e9 0, transparent 28rem), var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: #b66b00; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.14em; }

.screen-center, .login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loader { width: 38px; height: 38px; border-radius: 50%; border: 4px solid #d6dde4; border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page { background: linear-gradient(135deg, rgba(16,23,30,.97), rgba(23,34,44,.94)), radial-gradient(circle at 80% 20%, #6b4a17, transparent 40%); }
.login-card { width: min(440px, 100%); padding: 38px; border-radius: 24px; background: rgba(255,255,255,.98); box-shadow: 0 32px 90px rgba(0,0,0,.35); }
.login-card h1 { margin: 0; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, var(--accent-2), var(--accent)); color: #111; font-weight: 900; box-shadow: 0 10px 30px rgba(245,165,36,.35); margin-bottom: 22px; }
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 12px; }
.form-stack { display: grid; gap: 10px; margin-top: 28px; }
.form-stack label { font-weight: 700; font-size: .9rem; }
input, select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: #fff; color: var(--ink); }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(245,165,36,.32); outline-offset: 2px; border-color: var(--accent); }
.security-note { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: .8rem; }

.button { min-height: 44px; border-radius: 11px; border: 1px solid transparent; padding: 0 16px; font-weight: 800; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #15100a; box-shadow: 0 8px 22px rgba(245,165,36,.24); }
.button.secondary { background: var(--nav); color: #fff; }
.button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.button.full { width: 100%; }
.icon-button { border: 0; background: transparent; font-size: 1.5rem; padding: 8px; border-radius: 10px; display: none; }

.alert { margin: 16px 28px 0; padding: 13px 16px; border-radius: 12px; background: #eef6ff; border: 1px solid #c9e1fa; color: #174a77; }
.alert.error { margin: 8px 0 0; background: #fff1f0; border-color: #f0c2be; color: #8b2d27; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; background: linear-gradient(180deg, var(--nav), #0c1218); color: #fff; z-index: 10; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand strong { display: block; font-size: 1.05rem; }
.sidebar-brand span { color: #99a8b6; font-size: .8rem; }
.nav-list { display: grid; gap: 5px; padding: 20px 0; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 46px; border: 0; border-radius: 12px; padding: 0 14px; background: transparent; color: #c7d0d8; text-align: left; font-weight: 700; }
.nav-item:hover:not(:disabled), .nav-item.active { color: #fff; background: var(--nav-2); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.disabled { opacity: .45; cursor: default; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.09); }
.user-chip { margin-bottom: 12px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: .82rem; color: #cbd4dc; }

.workspace { min-width: 0; }
.topbar { height: 88px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 1.55rem; }
.connection-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 999px; background: #e8f8f2; color: #087252; font-weight: 800; font-size: .8rem; }
.connection-pill span { width: 8px; height: 8px; border-radius: 50%; background: #17b785; box-shadow: 0 0 0 5px rgba(23,183,133,.12); }
.content-panel { padding: 28px; max-width: 1600px; margin: 0 auto; }
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px; border-radius: var(--radius); color: #fff; background: linear-gradient(115deg, #101820 0%, #192631 60%, #51391a 100%); box-shadow: var(--shadow); }
.hero-card h2 { margin: 0 0 8px; font-size: clamp(1.7rem, 3vw, 2.6rem); }
.hero-card p:last-child { margin-bottom: 0; color: #c4ced7; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin: 20px 0 32px; }
.dashboard-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(17,25,35,.05); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { display: block; margin: 8px 0 2px; font-size: 2.35rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 26px 0 14px; }
.section-heading h2 { margin: 0; font-size: 1.45rem; }
.section-heading p { margin-bottom: 0; }
.applications-heading { align-items: center; margin-top: 0; }

.filters { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) auto auto; gap: 10px; margin-bottom: 14px; padding: 15px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.table-card { overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(17,25,35,.06); }
.table-wrap { overflow-x: auto; min-height: 150px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 15px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: #4d5d6c; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; }
td { font-size: .9rem; }
td strong { display: block; margin-bottom: 3px; }
.subtext { color: var(--muted); font-size: .78rem; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: #fff1d6; color: #8c5b00; font-size: .72rem; font-weight: 900; text-transform: capitalize; }
.status.hired, .status.qualified { background: #e4f7ef; color: #087252; }
.status.rejected { background: #fde9e7; color: #9a332c; }
.empty-state { display: grid; place-items: center; padding: 48px; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .icon-button { display: inline-grid; place-items: center; }
}

@media (max-width: 720px) {
  .content-panel, .topbar { padding-left: 16px; padding-right: 16px; }
  .connection-pill { display: none; }
  .hero-card, .section-heading { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
}

textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; color: var(--ink); font: inherit; resize: vertical; }
textarea:focus { outline: 3px solid rgba(245,165,36,.32); outline-offset: 2px; border-color: var(--accent); }
.alert.success { background: #e8f8f2; border-color: #b8e6d6; color: #087252; }
.button.small { min-height: 34px; padding: 0 12px; font-size: .78rem; }
.button.danger { background: var(--danger); color: #fff; }
.clickable-row { cursor: pointer; transition: background .15s ease; }
.clickable-row:hover, .clickable-row:focus { background: #fffaf0; outline: none; }
.status.screening, .status.interview { background: #e9efff; color: #3557a8; }
.status.documents_pending { background: #fff0df; color: #9a5700; }
.status.approved, .status.active { background: #e4f7ef; color: #087252; }
.status.archived { background: #edf0f3; color: #52606d; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(0, 1fr); }
.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(5, 10, 15, .68); backdrop-filter: blur(4px); }
.modal-panel { position: relative; justify-self: end; width: min(980px, 96vw); height: 100vh; overflow-y: auto; background: var(--bg); box-shadow: -24px 0 70px rgba(0,0,0,.28); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.modal-header h2 { margin: 0; font-size: 1.7rem; }
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.icon-button.visible { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 1.8rem; background: var(--surface-2); border: 1px solid var(--line); }
.modal-content { display: grid; gap: 16px; padding: 22px 28px 50px; }
.modal-section { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(17,25,35,.04); }
.modal-section h3 { margin: 0 0 16px; }
.section-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.info-item { min-height: 74px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid #e8edf1; }
.info-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.info-item strong { display: block; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 7px; font-weight: 700; font-size: .84rem; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.retention-box { padding: 14px; border-radius: 12px; background: #fff8e9; border: 1px solid #f0d69d; }
.checkbox-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 10px !important; }
.checkbox-row input { width: 18px; min-height: 18px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.note-form { display: grid; gap: 10px; margin-bottom: 16px; }
.timeline { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; }
.timeline-item { padding: 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid #e7ecf0; }
.timeline-item strong { display: inline-block; margin-right: 8px; }
.timeline-item time { color: var(--muted); font-size: .75rem; }
.timeline-item p { margin: 7px 0 0; white-space: pre-wrap; }
.timeline-item.compact p { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.details-card summary, .danger-zone summary { cursor: pointer; font-weight: 900; }
.conversion-form, .danger-zone form { margin-top: 18px; }
.linked-driver { display: grid; gap: 4px; margin-top: 14px; padding: 14px; border-radius: 12px; background: #e8f8f2; border: 1px solid #b8e6d6; }
.linked-driver span, .linked-driver small { color: #087252; }
.danger-zone { border-color: #efc4c0; background: #fff8f7; }
.modal-open { overflow: hidden; }

@media (max-width: 760px) {
  .modal-panel { width: 100vw; }
  .modal-header, .modal-content { padding-left: 16px; padding-right: 16px; }
  .info-grid, .form-grid, .two-column { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}


/* Active Drivers module */
.button-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.driver-metric-grid { margin-top: 18px; margin-bottom: 20px; }
.driver-modal-panel { width: min(1120px, 100%); }
.status.onboarding { background: #e9efff; color: #3557a8; }
.status.on_leave { background: #fff0df; color: #9a5700; }
.status.inactive, .status.pending { background: #edf0f3; color: #52606d; }
.status.terminated, .status.expired, .status.missing { background: #fde9e7; color: #9a332c; }
.status.expiring { background: #fff1d6; color: #8c5b00; }
.status.valid { background: #e4f7ef; color: #087252; }
.document-list { display: grid; gap: 10px; margin-bottom: 14px; }
.document-card { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(120px, .8fr) minmax(130px, .8fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.document-card strong, .document-card span, .document-card small { display: block; }
.document-card small { color: var(--muted); margin-top: 3px; }
.document-card .document-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.document-form-details { margin-top: 12px; }
.driver-alert { color: #9a332c; font-weight: 900; }
.driver-clear { color: #087252; font-weight: 900; }
@media (max-width: 860px) {
  .document-card { grid-template-columns: 1fr; }
  .document-card .document-actions { justify-content: flex-start; }
  .button-row { justify-content: flex-start; }
}


/* Inline document deletion confirmation (avoids blocked browser prompts) */
.document-delete-confirm {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}
.document-delete-reason {
  min-width: 220px;
  max-width: 320px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
@media (max-width: 720px) {
  .document-delete-confirm { justify-content: stretch; }
  .document-delete-reason { min-width: 100%; max-width: none; }
}


/* Global Documents module */
.documents-metric-grid { margin-top: 18px; margin-bottom: 20px; }
.documents-table { min-width: 1180px; }
.documents-table td:nth-child(3) { white-space: nowrap; }
.documents-table td:nth-child(5),
.documents-table td:nth-child(6) { white-space: nowrap; }
@media (min-width: 1280px) {
  .documents-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}


/* Employees module */
.employees-metric-grid { margin-top: 18px; margin-bottom: 20px; }
.employee-modal-panel { width: min(1120px, 100%); }
.employees-table { min-width: 1180px; }
.employee-filters { grid-template-columns: minmax(280px, 1.5fr) minmax(150px, .65fr) minmax(170px, .8fr) minmax(170px, .8fr) auto auto; }
.status.probation { background: #e9efff; color: #3557a8; }
.status.suspended { background: #fde9e7; color: #9a332c; }
@media (min-width: 1280px) {
  .employees-metric-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .employee-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .employee-filters { grid-template-columns: 1fr; }
}


/* Attendance V6 */
.attendance-metric-grid { margin-top: 18px; margin-bottom: 20px; }
.attendance-filters { grid-template-columns: minmax(135px,.55fr) minmax(135px,.55fr) minmax(260px,1.2fr) minmax(155px,.7fr) minmax(170px,.8fr) minmax(180px,.9fr) auto auto; align-items: end; }
.attendance-filters .filter-label { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.attendance-summary-bar { display: flex; gap: 24px; align-items: center; margin: -6px 2px 14px; color: var(--muted); font-size: 14px; }
.attendance-summary-bar strong { color: var(--text); }
.attendance-modal-panel { width: min(1120px, 100%); }
.attendance-table { min-width: 1280px; }
.status.present, .status.remote { background: #e4f7ef; color: #087252; }
.status.late, .status.half_day, .status.leave { background: #fff1d6; color: #8c5b00; }
.status.absent, .status.missing_punch { background: #fde9e7; color: #9a332c; }
.status.work_off, .status.holiday { background: #edf0f3; color: #52606d; }
@media (min-width: 1280px) { .attendance-metric-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (max-width: 1380px) { .attendance-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } .attendance-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dashboard-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .attendance-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .attendance-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .attendance-summary-bar { align-items: flex-start; flex-direction: column; gap: 6px; } }
@media (max-width: 520px) { .attendance-filters, .attendance-metric-grid { grid-template-columns: 1fr; } }


/* Payroll V7 */
.payroll-metric-grid { margin-top: 18px; margin-bottom: 20px; }
.payroll-filters { grid-template-columns: minmax(135px,.55fr) minmax(135px,.55fr) minmax(260px,1.2fr) minmax(150px,.65fr) minmax(170px,.75fr) minmax(190px,.9fr) auto auto; align-items: end; }
.payroll-filters .filter-label { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.payroll-modal-panel { width: min(1120px, 100%); }
.payroll-table { min-width: 1220px; }
.payroll-payment-cell { white-space: normal; }
.payroll-payment-cell strong,
.payroll-payment-cell .subtext { display: block; }
.payroll-payment-cell .subtext { margin-top: .2rem; overflow-wrap: anywhere; }
.status.draft { background: #edf0f3; color: #52606d; }
.status.paid { background: #e4f7ef; color: #087252; }
.status.void { background: #fde9e7; color: #9a332c; }
.payroll-calculation-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.payroll-calculation-bar div { min-width: 0; }
.payroll-calculation-bar span { display: block; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.payroll-calculation-bar strong { display: block; margin-top: 5px; font-size: 1.15rem; }
@media (min-width: 1280px) { .payroll-metric-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (max-width: 1380px) { .payroll-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } .payroll-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .payroll-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .payroll-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .payroll-calculation-bar { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .payroll-filters, .payroll-metric-grid { grid-template-columns: 1fr; } }

/* V9 Drive files and spreadsheet imports */
.driver-name-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.driver-avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.driver-avatar.placeholder { display: inline-grid; place-items: center; font-weight: 900; color: #8b5a00; background: #fff1d6; }
.driver-profile-photo-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.driver-profile-photo-wrap img { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line); background: #fff; }
.driver-profile-photo-wrap div { display: grid; gap: 6px; }
.driver-profile-photo-wrap a { color: #8b5a00; font-weight: 800; }
.driver-file-list { display: grid; gap: 10px; margin-bottom: 14px; }
.driver-file-card { display: grid; grid-template-columns: 48px minmax(180px, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.driver-file-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #fff1d6; color: #8b5a00; font-size: .72rem; font-weight: 900; border: 1px solid #f0d69d; }
.driver-file-main strong, .driver-file-main small { display: block; }
.driver-file-main small { margin-top: 3px; color: var(--muted); }
.driver-file-main p { margin: 6px 0 0; color: var(--muted); font-size: .82rem; }
.driver-file-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.import-modal-panel { width: min(1180px, 100%); }
.import-drop-zone { padding: 18px; border: 2px dashed #cfd8e2; border-radius: 14px; background: var(--surface-2); }
.import-drop-zone input { background: #fff; }
.import-drop-zone small { color: var(--muted); font-weight: 500; }
.import-template-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.import-mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.import-mapping-grid label { display: grid; gap: 6px; font-size: .8rem; font-weight: 800; }
.import-preview-table, .import-results-table { max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.import-preview-table table, .import-results-table table { min-width: 900px; }
.import-preview-table thead, .import-results-table thead { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
#import-attendance-defaults { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }

@media (max-width: 900px) {
  .driver-file-card { grid-template-columns: 44px 1fr; }
  .driver-file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .import-mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .import-mapping-grid { grid-template-columns: 1fr; }
  .driver-profile-photo-wrap { align-items: flex-start; }
}
.dashboard-link-card { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.dashboard-link-card:hover, .dashboard-link-card:focus { transform: translateY(-2px); border-color: #efc66f; box-shadow: 0 12px 28px rgba(17,25,35,.09); outline: none; }
.import-drop-zone.dragging { border-color: var(--accent); background: #fff8e9; box-shadow: inset 0 0 0 2px rgba(245,165,36,.18); }

/* Payroll bulk actions */
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17,25,35,.05);
}
.bulk-selection-summary { display: grid; gap: 3px; min-width: 220px; }
.bulk-selection-summary strong { font-size: .95rem; }
.bulk-selection-summary span { color: var(--muted); font-size: .8rem; }
.bulk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.payroll-select-cell { width: 42px; text-align: center; }
.payroll-row-checkbox, #payroll-select-page-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.payroll-table tr.is-selected td { background: #fff8e9; }
@media (max-width: 980px) {
  .bulk-toolbar { align-items: stretch; flex-direction: column; }
  .bulk-actions { justify-content: flex-start; }
}

/* V9.3 global bulk deletion */
.global-select-cell { width: 42px; text-align: center; }
.global-row-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.global-bulk-toolbar { margin-top: 0; }
tr.is-selected td { background: #fff8e9; }
.button.danger { background: #b93636; border-color: #b93636; color: #fff; }
.button.danger:hover { background: #982c2c; border-color: #982c2c; }

/* V9.3.2 reliable global bulk controls */
.table-wrap.global-bulk-container { overflow: visible; }
.global-table-scroll { overflow-x: auto; width: 100%; }
.global-bulk-toolbar { margin: 0; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; background: #fffdf8; }
.global-bulk-toolbar-top { border-top: 0; }
.global-bulk-toolbar-bottom { border-bottom: 0; }
.global-table-scroll .global-select-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}
.global-table-scroll thead .global-select-cell {
  z-index: 6;
  background: var(--surface-2);
}
.global-table-scroll tr.is-selected .global-select-cell { background: #fff8e9; }
@media (max-width: 980px) {
  .global-bulk-toolbar .bulk-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .global-bulk-toolbar .button { width: 100%; }
}
@media (max-width: 560px) {
  .global-bulk-toolbar .bulk-actions { grid-template-columns: 1fr; }
}

/* V9.3.3 visible deployment marker */
.build-version { display:inline-flex; align-items:center; padding:5px 9px; border:1px solid var(--line); border-radius:999px; background:#fff; color:var(--muted); font-size:.72rem; font-weight:800; letter-spacing:.03em; }


/* V10 Stability & Driver Compliance */
.topbar-status { display: flex; align-items: center; gap: 10px; }
.build-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; padding: 7px 10px; border-radius: 999px; background: #101923; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.system-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.system-columns { margin-top: 18px; }
.system-card { padding: 22px; }
.health-list { display: grid; gap: 10px; margin-top: 14px; }
.health-item { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #f4f7f9; border: 1px solid #e0e7ec; }
.health-item strong { font-size: 18px; }
.health-item.good { background: #ecf9f3; border-color: #ccebdd; }
.health-item.warning { background: #fff7e5; border-color: #f4dba4; }
.health-item.danger { background: #fff0ef; border-color: #f2c8c5; }
.backup-note { display: grid; gap: 5px; margin: 18px 0; padding: 16px; border-radius: 14px; background: #fff7e5; border: 1px solid #f4dba4; }
.compact-heading { margin-top: 24px; }
.compliance-cell { min-width: 150px; display: grid; gap: 5px; }
.compliance-bar { display: block; height: 7px; overflow: hidden; border-radius: 999px; background: #e5ebef; }
.compliance-bar i { display: block; height: 100%; border-radius: inherit; background: #20b486; }
.documents-table td strong + .subtext { margin-top: 4px; }
@media (max-width: 1100px) { .system-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .topbar-status { gap: 6px; } .build-badge { display: none; } .system-metric-grid { grid-template-columns: 1fr; } }


/* V10.1 Payroll display and account access control */
.payroll-metric-grid .metric-card { min-width: 0; overflow: hidden; }
.payroll-metric-grid .metric-card strong { max-width: 100%; font-size: clamp(1.25rem, 1.55vw, 1.9rem); line-height: 1.12; letter-spacing: -.025em; overflow-wrap: anywhere; word-break: break-word; }
.payroll-metric-grid .metric-card:nth-child(-n+4) strong { font-size: 2.15rem; }
.account-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.access-help-card { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin: 0 0 16px; padding: 14px 16px; border: 1px solid #efd49b; border-radius: 14px; background: #fff8e9; color: #60400c; font-size: .84rem; }
.access-help-card > strong { margin-right: 4px; }
.accounts-table { min-width: 900px; }
.account-modal-panel { width: min(980px, 100%); }
.permission-preset-card { display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.permissions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 180px); align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.permission-row span strong, .permission-row span small { display: block; }
.permission-row span small { margin-top: 3px; color: var(--muted); font-weight: 500; }
.permission-row select { min-height: 42px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) { .account-metric-grid, .permissions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .account-metric-grid, .permissions-grid { grid-template-columns: 1fr; } .permission-preset-card, .permission-row { grid-template-columns: 1fr; } }


/* V10.1.2 permission-aware controls */
.module-access-view .global-select-cell,
.module-access-edit .global-select-cell,
#payroll-view:not(.module-access-manage) .payroll-select-cell {
  display: none !important;
}

#payroll-view:not(.module-access-manage) #payroll-bulk-toolbar {
  display: none !important;
}

.permission-readonly-form input:disabled,
.permission-readonly-form select:disabled,
.permission-readonly-form textarea:disabled {
  opacity: 1;
  color: var(--ink);
  background: #f4f7f9;
  cursor: default;
}


/* V10.2 Payroll Engine & Holiday Tracker */
.holiday-metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.holiday-filters { grid-template-columns: minmax(150px, .8fr) minmax(150px, .8fr) minmax(180px, 1fr) auto auto; }
.holiday-modal-panel { width: min(960px, 96vw); }
#holiday-employees { min-height: 150px; }
.payroll-engine-card { border: 1px solid #d8e1e8; border-radius: 16px; padding: 18px; background: #f8fafb; }
.payroll-engine-heading { align-items: center; margin-bottom: 14px; }
.payroll-engine-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.payroll-engine-grid > div { border: 1px solid #e0e6eb; background: #fff; border-radius: 12px; padding: 12px; min-width: 0; }
.payroll-engine-grid span { display: block; color: #607085; font-size: .76rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.payroll-engine-grid strong { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.payroll-engine-warning { margin: 14px 0 0; padding: 11px 13px; border-radius: 10px; background: #e8f7f1; color: #0b6b4d; font-weight: 700; }
.payroll-engine-warning.warning { background: #fff3dc; color: #8b5200; }
@media (max-width: 1100px) {
  .holiday-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .payroll-engine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .holiday-metric-grid, .payroll-engine-grid { grid-template-columns: 1fr; }
  .holiday-filters { grid-template-columns: 1fr; }
}


/* V10.2.1 manual attendance-day payroll */
.payroll-manual-days {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(255, 178, 36, 0.08), rgba(255, 255, 255, 0.92));
}
.payroll-day-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.payroll-day-grid label { min-width: 0; }
.section-title.compact { margin-bottom: 6px; }
@media (max-width: 900px) {
  .payroll-day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .payroll-day-grid { grid-template-columns: 1fr; }
}
