:root {
  --brand: #046bab;
  --brand-strong: #075f9d;
  --brand-soft: #eaf4fb;
  --navy: #0d1b2a;
  --navy-2: #132943;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --text: #172033;
  --muted: #718096;
  --line: #e8edf4;
  --success: #18a66a;
  --warning: #ed9b24;
  --danger: #e05252;
  --purple: #7c5ce6;
  --shadow: 0 10px 30px rgba(22, 35, 58, 0.06);
  --sidebar-width: 248px;
  --radius: 8px;
}

html { background: var(--canvas); }
body { display: block; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 13px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, input, select, textarea { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 3px rgba(4, 107, 171, 0.18); }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: var(--sidebar-width); padding: 22px 14px 16px; flex-direction: column; background: var(--navy); border: 0; box-shadow: none; color: #fff; overflow-y: auto; }
.brand-lockup { display: flex; min-height: 58px; padding: 2px 10px 20px; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-lockup .logo { width: 42px; height: 42px; padding: 5px; border-radius: 8px; background: #fff; object-fit: contain; }
.brand-lockup h1 { margin: 0; color: #fff; font-size: 15px; font-weight: 800; }
.brand-lockup p { margin: 3px 0 0; color: #9db0c3; font-size: 10px; }
.nav-label { margin: 21px 12px 8px; color: #60788f; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.nav-label-system { margin-top: 18px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav button { position: relative; display: flex; min-height: 42px; width: 100%; padding: 0 12px 0 43px; align-items: center; border: 0; border-radius: 8px; background: transparent; color: #9db0c3; cursor: pointer; font-size: 12px; font-weight: 650; text-align: left; transition: background .15s ease, color .15s ease; }
.sidebar nav button::before { position: absolute; left: 13px; display: grid; width: 20px; height: 20px; place-items: center; color: currentColor; font-size: 15px; font-weight: 500; }
.sidebar nav button[data-icon="dashboard"]::before { content: "▦"; }
.sidebar nav button[data-icon="tools"]::before { content: "⚙"; }
.sidebar nav button[data-icon="users"]::before { content: "♙"; }
.sidebar nav button[data-icon="location"]::before { content: "⌖"; }
.sidebar nav button[data-icon="calendar-check"]::before { content: "▣"; }
.sidebar nav button[data-icon="hard-hat"]::before { content: "◇"; }
.sidebar nav button[data-icon="clipboard"]::before { content: "✓"; }
.sidebar nav button[data-icon="calendar"]::before { content: "□"; }
.sidebar nav button[data-icon="bell"]::before { content: "◉"; }
.sidebar nav button[data-icon="settings"]::before { content: "⚙"; }
.sidebar nav button:hover { background: rgba(255,255,255,.055); color: #fff; }
.sidebar nav button.active { background: var(--brand); color: #fff; box-shadow: 0 7px 18px rgba(4,107,171,.22); }
.sidebar-meta.sidebar-user { display: flex; width: 100%; max-width: 100%; min-width: 0; margin-top: auto; padding: 10px; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; background: rgba(255,255,255,.025); overflow: hidden; }
.sidebar-meta.sidebar-user .sidebar-avatar { display: grid; width: 34px; height: 34px; margin: 0; padding: 0; flex: 0 0 34px; place-items: center; overflow: hidden; color: var(--brand-strong); line-height: 1; }
.sidebar-avatar, .profile-avatar { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #dceefa; color: var(--brand-strong); font-size: 10px; font-weight: 800; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong, .sidebar-user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { color: #fff; font-size: 11px; }
.sidebar-user-copy small { margin-top: 3px; color: #7f96aa; font-size: 9px; }

.page { display: block; min-height: 100vh; margin-left: var(--sidebar-width); padding: 0; background: var(--canvas); }
.logged-out .sidebar { display: none; }
.logged-out .page { margin-left: 0; }
.app-shell { display: block; width: 100%; max-width: none; padding: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 74px; padding: 11px clamp(20px, 2.5vw, 38px); align-items: center; justify-content: space-between; gap: 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.96); box-shadow: none; }
.page-heading { min-width: 0; }
.page-heading .eyebrow { display: flex; margin: 0 0 4px; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 600; text-transform: none; }
.page-heading .eyebrow i { color: #c4ceda; font-style: normal; }
.page-heading .eyebrow b { color: var(--brand); }
.topbar h2 { margin: 0; color: var(--text); font-size: clamp(17px, 1.5vw, 22px); line-height: 1.2; }
.api-status { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.scope-pill { max-width: 260px; padding: 8px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: grid; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #526174; cursor: pointer; }
.icon-button:hover { border-color: #cbd8e5; background: var(--canvas); color: var(--brand); }
.notification-button { position: relative; color: var(--brand); font-size: 8px; }
.topbar-profile { display: flex; min-width: 154px; padding: 0 6px; align-items: center; gap: 9px; }
.topbar-profile strong, .topbar-profile small { display: block; }
.topbar-profile strong { max-width: 116px; overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-profile small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.logout-button { color: var(--danger); }
.mobile-menu-button { display: none; }

.view-section { margin: 0 clamp(20px, 2.5vw, 38px) 22px; }
.metrics.view-section { margin-top: 24px; }
.dashboard-intro { display: flex; margin-top: 28px; align-items: center; justify-content: space-between; gap: 18px; }
.dashboard-intro h2 { margin: 0; color: var(--text); font-size: 24px; }
.dashboard-intro p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.date-pill { padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #415169; font-size: 10px; font-weight: 700; }
.panel, .metric-card, .settings-grid article, .module-banner { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel { padding: 18px; }
.panel-head { display: flex; min-height: 34px; margin-bottom: 15px; align-items: flex-start; justify-content: space-between; gap: 14px; }
.panel-head h3 { margin: 0; color: var(--text); font-size: 14px; }
.panel-head span { color: var(--muted); font-size: 10px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.dashboard-secondary-metric { display: none; }
.metric-card { position: relative; min-height: 112px; padding: 17px; overflow: hidden; border-top: 3px solid var(--brand); color: var(--text); text-align: left; cursor: pointer; }
.metric-card:nth-child(2) { border-top-color: var(--success); }
.metric-card:nth-child(3) { border-top-color: var(--warning); }
.metric-card:nth-child(4), .metric-card:nth-child(6) { border-top-color: var(--danger); }
.metric-card:nth-child(5) { border-top-color: var(--purple); }
.metric-card:hover { transform: translateY(-1px); border-color: #d8e2ee; box-shadow: 0 12px 30px rgba(22,35,58,.09); }
.metric-card[data-action="focus-dashboard-list"]::after { content: "↓"; position: absolute; right: 16px; bottom: 14px; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid #dce7f1; border-radius: 50%; background: #f7fafc; color: var(--muted); font-size: 12px; transition: transform .18s ease, color .18s ease, background .18s ease; }
.metric-card[data-action="focus-dashboard-list"].active { border-color: #9fc8de; background: #f8fcff; box-shadow: 0 14px 34px rgba(8,118,216,.12); }
.metric-card[data-action="focus-dashboard-list"].active::after { content: "↑"; transform: translateY(-2px); background: var(--brand); color: #fff; }
.metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.metrics strong { display: block; margin-top: 15px; color: var(--text); font-size: 27px; line-height: 1; }

.dashboard-metric-details { margin-top: -8px; padding: 0; overflow: hidden; animation: dashboard-detail-reveal .2s ease-out; }
.dashboard-metric-detail-head { display: flex; padding: 18px 20px 14px; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: #f8fbfe; }
.dashboard-metric-detail-head > div:last-child { display: flex; align-items: center; gap: 12px; }
.dashboard-metric-detail-head span { display: block; margin-bottom: 4px; color: var(--brand); font-size: 9px; font-weight: 800; }
.dashboard-metric-detail-head h3 { margin: 0; color: var(--text); font-size: 15px; }
.dashboard-metric-detail-head strong { color: #526174; font-size: 10px; }
.dashboard-metric-list { display: grid; max-height: 310px; padding: 16px 20px 20px; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; overflow-y: auto; }
.dashboard-metric-list .person-row { min-width: 0; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.dashboard-metric-list .person-row:hover { transform: translateY(-1px); border-color: #b9d5e5; box-shadow: 0 8px 20px rgba(23,47,75,.07); }
.dashboard-metric-empty { grid-column: 1 / -1; margin: 0; padding: 26px; color: var(--muted); text-align: center; font-size: 11px; }
@keyframes dashboard-detail-reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.dashboard-grid { display: grid; grid-template-columns: minmax(360px,.9fr) minmax(420px,1.1fr); gap: 14px; align-items: stretch; }
.dashboard-data-store { display: none; }
.status-chart-panel, .department-attendance-panel { min-height: 340px; }
.recent-activity-panel { grid-column: 1 / -1; }
.people-columns { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.people-column { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfd; }
.people-column h4 { margin: 0 0 10px; color: #526174; font-size: 10px; text-transform: uppercase; }
.people-list { display: grid; gap: 7px; max-height: 260px; overflow-y: auto; }
.person-row, .log-item, .risk-row, .tenant-card, .location-card, .contractor-card, .worker-row, .day-detail-row { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.attendance-chart-panel .panel-head > div span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.dashboard-month { width: 148px; min-height: 36px; }
.monthly-attendance { display: grid; min-height: 400px; grid-template-rows: auto minmax(0,1fr); gap: 18px; }
.monthly-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.monthly-summary > div { padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfe; }
.monthly-summary span, .monthly-summary strong, .monthly-summary small { display: block; }
.monthly-summary span { color: var(--muted); font-size: 9px; font-weight: 700; }
.monthly-summary strong { margin-top: 5px; color: var(--text); font-size: 21px; }
.monthly-summary small { margin-top: 3px; color: var(--brand); font-size: 8px; }
.monthly-chart-wrap { display: grid; min-width: 0; grid-template-rows: auto minmax(200px,1fr) auto; }
.chart-legend { display: flex; padding: 0 2px 8px; justify-content: flex-end; gap: 14px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.monthly-line-chart { width: 100%; height: 100%; min-height: 200px; overflow: visible; }
.chart-grid-line { stroke: #e6edf4; stroke-width: .45; stroke-dasharray: 2 2; }
.attendance-area { fill: #e5f2ff; }
.attendance-line { fill: none; stroke: #0876d8; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.late-line, .absent-line { fill: none; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.late-line { stroke: #ed9b24; }
.absent-line { stroke: #ef5b61; }
.monthly-axis { display: flex; padding: 4px 2px 0; justify-content: space-between; color: var(--muted); font-size: 8px; }
.status-chart { display: flex; min-height: 268px; align-items: center; justify-content: center; gap: 32px; }
.donut-chart { position: relative; display: grid; width: 210px; height: 210px; flex: 0 0 210px; place-items: center; }
.donut-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track, .donut-segment { fill: none; stroke-width: 16; }
.donut-track { stroke: #edf2f7; }
.donut-segment { stroke-linecap: butt; }
.donut-segment.on-time { stroke: #0876d8; }
.donut-segment.late { stroke: #ed9b24; }
.donut-segment.leave { stroke: #8b5cf6; }
.donut-segment.absent { stroke: #ef5b61; }
.donut-chart > span { position: relative; z-index: 1; text-align: center; }
.donut-chart strong, .donut-chart small { display: block; }
.donut-chart strong { font-size: 25px; }
.donut-chart small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.donut-legend { display: grid; gap: 11px; min-width: 120px; }
.donut-legend > span { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 7px; color: #526174; font-size: 10px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #0870db; }
.legend-dot.on-time { background: #0876d8; }
.legend-dot.leave { background: #8b5cf6; }
.legend-dot.late { background: var(--warning); }
.legend-dot.absent { background: #ef5b61; }
.department-attendance { display: grid; max-height: 268px; gap: 11px; overflow-y: auto; }
.department-progress { display: grid; gap: 5px; }
.department-progress > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.department-progress strong { overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.department-progress span { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.department-progress progress { width: 100%; height: 7px; border: 0; border-radius: 999px; overflow: hidden; accent-color: var(--brand); }
.department-progress progress::-webkit-progress-bar { background: #eaf0f6; }
.department-progress progress::-webkit-progress-value { border-radius: 999px; background: var(--brand); }
.department-progress progress::-moz-progress-bar { border-radius: 999px; background: var(--brand); }

.screen-head { display: flex; margin: 28px 0 18px; align-items: flex-end; justify-content: space-between; gap: 18px; }
.screen-head h2 { margin: 0; color: var(--text); font-size: 24px; }
.screen-head p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.screen-actions { display: flex; gap: 9px; }
.personnel-table-panel { padding: 0; overflow: hidden; }
.payroll-tools-screen > .screen-head { grid-column: 1 / -1; margin-left: 0; margin-right: 0; }
.personnel-toolbar { display: flex; padding: 14px; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); }
.personnel-toolbar input { max-width: 260px; }
.personnel-toolbar select { max-width: 180px; }
.record-count { margin-left: auto; color: var(--muted); font-size: 10px; }
.personnel-table-wrap { border: 0; border-radius: 0; }
.table-person { display: flex; align-items: center; gap: 9px; }
.table-person > span:last-child { min-width: 0; }
.table-person strong, .table-person small { display: block; }
.table-person small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.table-avatar { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #e2efff; color: #0869d8; font-size: 9px; font-weight: 800; }
.soft-badge { padding: 4px 7px; border-radius: 999px; background: #eef4f9; color: #4c6076; font-size: 9px; font-weight: 700; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #c7d0da; }
.status-dot.active { background: var(--success); }
.table-action { min-height: 29px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #526174; cursor: pointer; font-size: 9px; }
.table-action:hover { border-color: #b9c9da; color: var(--brand); }
.table-action.danger { color: var(--danger); }

.drawer-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(13,27,42,.38); opacity: 0; transition: opacity .2s ease; }
.drawer-overlay.open { opacity: 1; }
.side-drawer { position: fixed; inset: 0 0 0 auto; z-index: 71; width: min(520px, 100vw); padding: 22px; overflow-y: auto; background: #fff; box-shadow: -18px 0 50px rgba(13,27,42,.16); transform: translateX(100%); transition: transform .22s ease; }
.side-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; padding-bottom: 16px; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.drawer-header span { color: var(--brand); font-size: 9px; font-weight: 800; }
.drawer-header h3 { margin: 5px 0 0; font-size: 19px; }
.drawer-help { margin: 16px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.drawer-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; margin-top: 18px; }
.drawer-form label { display: grid; gap: 6px; }
.drawer-form .toggle-field { display: flex; min-height: 44px; padding: 0 12px; align-items: center; justify-content: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; cursor: pointer; }
.drawer-form .toggle-field input { width: 16px; height: 16px; min-height: 16px; margin: 0; flex: 0 0 16px; accent-color: var(--brand); }
.drawer-form .full-field { grid-column: 1 / -1; }
.department-card-list { display: grid; gap: 9px; margin-top: 18px; }
.department-card { display: grid; grid-template-columns: 38px 1fr auto; padding: 11px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.department-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 7px; background: var(--brand-soft); color: var(--brand); font-size: 9px; font-weight: 800; }
.department-card strong, .department-card small { display: block; }
.department-card small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.department-card div { display: flex; gap: 5px; }
.department-card button { padding: 6px; border: 0; background: transparent; color: var(--brand); cursor: pointer; font-size: 9px; }
.department-card button.danger { color: var(--danger); }
body.drawer-open { overflow: hidden; }

.payroll-screen-head, .payroll-kpis, .payroll-matrix-card, .payroll-tools-heading { grid-column: 1 / -1; }
.payroll-screen-head { margin-bottom: 0; }
.payroll-month-actions { display: flex; align-items: flex-end; gap: 8px; }
.payroll-month-actions label { display: grid; width: 168px; gap: 5px; }
.payroll-month-actions label span { color: var(--muted); font-size: 9px; }
.payroll-month-actions button { white-space: nowrap; }
.payroll-kpis { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; }
.payroll-kpis article { padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.payroll-kpis article:nth-child(2) { border-top-color: var(--success); }
.payroll-kpis article:nth-child(3) { border-top-color: var(--warning); }
.payroll-kpis article:nth-child(4), .payroll-kpis article:nth-child(6) { border-top-color: var(--danger); }
.payroll-kpis article:nth-child(5) { border-top-color: var(--purple); }
.payroll-kpis span, .payroll-kpis strong { display: block; }
.payroll-kpis span { color: var(--muted); font-size: 9px; font-weight: 700; }
.payroll-kpis strong { margin-top: 9px; color: var(--text); font-size: 23px; }
.payroll-matrix-card { padding: 0; overflow: hidden; }
.matrix-toolbar { display: flex; padding: 16px 18px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.matrix-toolbar h3 { margin: 0; }
.matrix-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.matrix-filters { display: flex; gap: 8px; }
.matrix-filters input, .matrix-filters select { width: 180px; }
.attendance-matrix-wrap { max-height: 580px; overflow: auto; }
.attendance-matrix { width: max-content; min-width: 100%; table-layout: fixed; }
.attendance-matrix th, .attendance-matrix td { min-width: 43px; padding: 7px 5px; text-align: center; }
.attendance-matrix th:first-child, .attendance-matrix td:first-child { position: sticky; left: 0; z-index: 3; min-width: 210px; width: 210px; background: #fff; text-align: left; box-shadow: 1px 0 0 var(--line); }
.attendance-matrix thead th { top: 0; z-index: 4; background: #f8fafc; }
.attendance-matrix thead th:first-child { z-index: 5; background: #f8fafc; }
.attendance-matrix th span, .attendance-matrix th small { display: block; }
.attendance-matrix th small { margin-top: 2px; color: #9aa9b8; font-size: 8px; text-transform: none; }
.matrix-cell { display: grid; width: 28px; height: 28px; margin: auto; place-items: center; border-radius: 6px; background: #f1f4f7; color: #8a98a8; font-size: 10px; font-weight: 800; }
.matrix-cell.status-present { background: #e4f7ef; color: #12845a; }
.matrix-cell.status-late { background: #fff0d7; color: #b8780a; }
.matrix-cell.status-absent { background: #fde7e7; color: #bc4242; }
.matrix-cell.status-leave { background: #e4f1ff; color: #176dc3; }
.matrix-cell.status-missing_checkout { background: #f0eaff; color: #7454d6; }
.matrix-cell.status-week_rest, .matrix-cell.status-official_holiday, .matrix-cell.status-upcoming { background: #f2f4f7; color: #aab4bf; }
.matrix-legend { display: flex; padding: 12px 18px; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.matrix-legend .matrix-cell { display: inline-grid; width: 23px; height: 23px; margin: 0 1px 0 7px; }
.payroll-tools-heading { margin-top: 6px; }
.payroll-tools-heading h3 { margin: 0; font-size: 16px; }
.payroll-tools-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.tools-smtp-status { display: inline-flex; min-height: 32px; padding: 7px 11px; align-items: center; gap: 7px; border: 1px solid #d7e0e9; border-radius: 999px; background: #f5f7fa; font-size: 9px; font-weight: 800; }
.tools-smtp-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #a7b1bd; }
.tools-smtp-status.status-ok { border-color: #bce8d4; background: #eefaf5; color: #117a50; }
.tools-smtp-status.status-ok::before { background: var(--success); box-shadow: 0 0 0 3px rgba(23,164,111,.12); }
.tools-smtp-status.status-off { color: #7b8795; }
.tools-primary-card { display: flex; min-height: 100%; flex-direction: column; }
.tools-primary-card .form-grid { flex: 1; }
.tools-primary-card .stack { margin-bottom: 14px; }
.tools-email-card { grid-column: 1 / -1; }
.tools-email-card .panel-head > div p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.tools-email-card .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.tools-email-card .toggle-field { display: flex; min-height: 42px; padding: 10px 12px; align-items: center; justify-content: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.tools-email-card .toggle-field input { width: 16px; height: 16px; min-height: 16px; margin: 0; flex: 0 0 16px; accent-color: var(--brand); }
.tools-email-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tools-email-actions button { width: auto; }
.email-matrix-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.email-matrix-toolbar strong, .email-matrix-toolbar span { display: block; }
.email-matrix-toolbar strong { color: var(--text); font-size: 12px; }
.email-matrix-toolbar span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.email-matrix-toolbar button { width: auto; white-space: nowrap; }
.email-matrix-wrap { max-height: 360px; }
.email-matrix-table { min-width: 900px; }
.email-matrix-table th:not(:first-child), .email-matrix-table td:not(:first-child) { text-align: center; }
.email-check-cell input { width: 16px; height: 16px; min-height: 16px; margin: 0; accent-color: var(--brand); }
.settings-dialog { width: min(580px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(13,27,42,.24); }
.settings-dialog::backdrop { background: rgba(13,27,42,.48); }
.dialog-form { display: grid; padding: 22px; gap: 15px; }
.dialog-form > label { display: grid; gap: 6px; }
.dialog-head { display: flex; padding-bottom: 15px; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.dialog-head span { color: var(--brand); font-size: 9px; font-weight: 800; }
.dialog-head h3 { margin: 5px 0 0; font-size: 18px; }
.email-permission-grid { display: grid; margin: 0; padding: 13px; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; border: 1px solid var(--line); border-radius: 8px; }
.email-permission-grid legend { padding: 0 5px; color: #526174; font-size: 10px; font-weight: 800; }
.email-permission-grid label { display: flex; min-height: 40px; padding: 9px 10px; align-items: center; gap: 9px; border: 1px solid #e4eaf0; border-radius: 7px; background: #f8fafc; }
.email-permission-grid input { width: 16px; height: 16px; min-height: 16px; margin: 0; accent-color: var(--brand); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button { width: auto; }
.tools-detail-card { min-width: 0; }
.tools-scroll-table { max-height: 390px; }
.tools-risk-list { max-height: 390px; overflow-y: auto; }

.leave-table-panel { padding: 0; overflow: hidden; }
.leave-tabs { display: flex; min-height: 56px; padding: 0 14px; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.leave-tabs button { align-self: stretch; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.leave-tabs button.active { border-bottom-color: var(--brand); color: var(--brand); }
.leave-tabs button b { min-width: 20px; margin-left: 4px; padding: 3px 6px; border-radius: 999px; background: #eef3f7; color: #62758a; font-size: 8px; }
.leave-tabs input { width: 165px; margin-left: auto; }
.leave-table-wrap { border: 0; border-radius: 0; }
.table-empty { display: grid; min-height: 150px; place-content: center; text-align: center; }
.table-empty strong, .table-empty span { display: block; }
.table-empty strong { color: var(--text); }
.table-empty span { margin-top: 5px; color: var(--muted); font-size: 10px; }

.calendar-panel { padding: 0; overflow: hidden; }
.calendar-toolbar { display: flex; min-height: 66px; padding: 12px 16px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.calendar-toolbar > div { display: flex; align-items: center; gap: 7px; }
.calendar-toolbar h3 { margin: 0 0 0 7px; font-size: 17px; text-transform: capitalize; }
.calendar-toolbar > span { color: var(--muted); font-size: 10px; }
.calendar-week-header { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border-bottom: 1px solid var(--line); background: #f8fafc; }
.calendar-week-header span { padding: 9px; color: #718096; font-size: 9px; font-weight: 800; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 0; }
.calendar-day { min-height: 112px; padding: 9px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--text); text-align: left; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.blank { background: #fafbfd; pointer-events: none; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--brand); }
.calendar-day strong { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; font-size: 10px; }
.calendar-day.today strong { background: var(--brand); color: #fff; }
.calendar-day-events { display: grid; gap: 4px; margin-top: 6px; }
.calendar-day-events i { display: block; padding: 4px 5px; overflow: hidden; border-radius: 4px; background: #e6f1ff; color: #176dc3; font-size: 8px; font-style: normal; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.calendar-day-events .event-custom_workday { background: #e6f7ef; color: #117a50; }
.calendar-day-events .event-official_holiday { background: #fdeaea; color: #b83e3e; }
.calendar-day-events .event-reminder { background: #f0eaff; color: #7253d3; }
.calendar-events-list { padding: 17px; }
.calendar-events-list .tenant-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }

input, select, textarea { min-height: 40px; width: 100%; padding: 9px 11px; border: 1px solid #dce4ee; border-radius: 8px; background: #fff; color: var(--text); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(4,107,171,.1); }
label { color: #526174; font-size: 10px; font-weight: 700; }
.primary, .secondary, .danger, .form-button, .logout-button:not(.icon-button) { min-height: 38px; padding: 9px 13px; border-radius: 8px; font-size: 10px; font-weight: 750; cursor: pointer; }
.primary { border: 1px solid var(--brand); background: var(--brand); color: #fff; }
.primary:hover { border-color: var(--brand-strong); background: var(--brand-strong); }
.secondary { border: 1px solid #dce4ee; background: #fff; color: #415169; }
.secondary:hover { border-color: #b9c9da; background: #f9fbfd; }
.danger { border: 1px solid #f2cccc; background: #fff5f5; color: var(--danger); }

.content-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid { gap: 12px; }
.employee-form { gap: 10px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
th { position: sticky; top: 0; z-index: 2; padding: 11px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; color: #718096; font-size: 9px; font-weight: 800; text-align: left; text-transform: uppercase; }
td { padding: 11px 12px; border-bottom: 1px solid #edf1f6; color: #42526a; vertical-align: middle; }
tbody tr:hover td { background: #f9fbfd; }
tbody tr:last-child td { border-bottom: 0; }
.badge, .leave-status-badge { padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.badge.ok, .leave-status-approved { background: #e7f7f0; color: #117a50; }
.badge.warn, .leave-status-pending { background: #fff4df; color: #a76908; }
.leave-status-rejected, .badge.danger { background: #feebeb; color: #b43d3d; }

.module-banner { padding: 18px 20px; border: 0; background: var(--navy-2); color: #fff; }
.module-banner h3 { color: #fff; }
.module-tabs { border-color: var(--line); border-radius: var(--radius); }
.module-tabs button.active { background: var(--brand); box-shadow: none; }
.schedule-table th, .calendar-weekdays { background: var(--navy-2); }
.contractor-day { min-height: 118px; }
.contractor-day:hover, .contractor-day.active { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.calendar-grid { gap: 6px; }
.calendar-day { min-height: 92px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.calendar-day:hover { border-color: #b9d8ed; background: var(--brand-soft); }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.settings-grid article { padding: 18px; }

.login-panel { width: min(420px, calc(100vw - 40px)); margin: clamp(40px, 12vh, 120px) auto; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 20px 55px rgba(22,35,58,.12); }
.login-logo { width: 62px; height: 62px; padding: 8px; border-radius: 8px; background: #f6fafc; object-fit: contain; }
.login-panel h2 { margin: 18px 0 5px; color: var(--text); }
.login-panel > p { color: var(--muted); }
.login-form { margin-top: 24px; gap: 15px; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .metrics .metric-card:not(.dashboard-secondary-metric) { min-width: 0; }
  .payroll-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .people-columns { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .topbar-profile, .scope-pill { display: none; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { z-index: 40; transform: translateX(0); }
  body.sidebar-open::after { content: ""; position: fixed; inset: 0; z-index: 35; background: rgba(13,27,42,.42); }
  .page { margin-left: 0; }
  .mobile-menu-button { display: grid; }
  .topbar { padding-inline: 16px; justify-content: flex-start; }
  .topbar-actions { width: auto; margin-left: auto; justify-content: flex-end; }
  .content-grid, .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .dashboard-people-panel { grid-column: auto; }
  .view-section { margin-inline: 16px; }
  .status-chart-panel, .department-attendance-panel, .recent-activity-panel { grid-column: auto; grid-row: auto; }
  .dashboard-metric-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .topbar { min-height: 64px; align-items: center; flex-direction: row; gap: 10px; }
  .mobile-menu-button { flex-basis: 34px; width: 34px; height: 34px; }
  .page-heading { flex: 1; }
  .topbar h2 { font-size: 15px; }
  .page-heading .eyebrow { display: none; }
  .notification-button { display: none; }
  .topbar-actions { flex: 0 0 auto; }
  .refresh-button { display: none; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .metric-card { min-height: 96px; padding: 13px; }
  .metrics strong { margin-top: 11px; font-size: 23px; }
  .dashboard-metric-detail-head { padding: 15px; align-items: flex-start; }
  .dashboard-metric-list { max-height: 360px; padding: 12px 15px 15px; grid-template-columns: 1fr; }
  .status-chart { flex-direction: column; gap: 18px; }
  .people-columns { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .module-actions { flex-direction: column; }
  .module-actions > * { width: 100%; }
  .employee-form, .form-grid { grid-template-columns: 1fr; }
  .view-section[data-section="employees"] { max-width: calc(100vw - 32px); overflow-x: auto; }
  .dashboard-intro, .screen-head, .matrix-toolbar { align-items: flex-start; flex-direction: column; }
  .payroll-month-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .payroll-month-actions label { width: 100%; }
  .tools-email-card .form-grid { grid-template-columns: 1fr; }
  .tools-email-actions { align-items: stretch; flex-direction: column-reverse; }
  .tools-email-actions button { width: 100%; }
  .email-matrix-toolbar { align-items: stretch; flex-direction: column; }
  .email-matrix-toolbar button { width: 100%; }
  .email-permission-grid { grid-template-columns: 1fr; }
  .dashboard-intro h2, .screen-head h2 { font-size: 20px; }
  .date-pill, .screen-actions, .screen-actions button { width: 100%; }
  .screen-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .personnel-toolbar { align-items: stretch; flex-direction: column; }
  .personnel-toolbar input, .personnel-toolbar select { max-width: none; }
  .record-count { margin-left: 0; }
  .drawer-form { grid-template-columns: 1fr; }
  .drawer-form .full-field { grid-column: auto; }
  .payroll-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .matrix-filters { width: 100%; flex-direction: column; }
  .matrix-filters input, .matrix-filters select { width: 100%; }
  .leave-tabs { padding: 8px; flex-wrap: wrap; overflow: visible; }
  .leave-tabs button { min-width: max-content; min-height: 40px; }
  .leave-tabs input { width: 100%; min-width: 0; margin: 0; }
  .calendar-grid, .calendar-week-header { min-width: 720px; }
  .calendar-panel { overflow-x: auto; }
  .calendar-toolbar { position: sticky; left: 0; min-width: 358px; }
  .calendar-events-list { min-width: 720px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* Personnel leave ledger and reviewed workbook import. */
.leave-account-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:16px 0; border-block:1px solid #dce5ed; }
.leave-account-summary > div { display:flex; flex-direction:column; gap:6px; min-width:0; }
.leave-account-summary span { font-size:12px; color:#607084; }
.leave-account-summary strong { font-size:23px; color:#173a50; }
.leave-account-summary > div:last-of-type strong { color:#087d65; }
.leave-account-summary small { font-size:12px; font-weight:400; }
.leave-account-summary p { grid-column:1/-1; margin:0; font-size:12px; color:#607084; }
.leave-opening-details { padding:10px 0; }
.leave-opening-details summary { cursor:pointer; font-weight:600; }
.leave-opening-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding-top:16px; }
.leave-opening-fields label { min-width:0; }
.leave-opening-fields input { width:100%; box-sizing:border-box; }
.leave-opening-fields .full-field { grid-column:1/-1; }
.personnel-import-dialog { width:min(1200px,calc(100vw - 40px)); max-height:90vh; padding:24px; border:1px solid #dce5ed; border-radius:8px; color:#173a50; background:#fff; }
.personnel-import-dialog::backdrop { background:rgba(20,35,45,.4); }
.import-controls { display:flex; align-items:end; flex-wrap:wrap; gap:16px; margin:18px 0; }
.import-controls label,.import-departments label { display:flex; flex-direction:column; gap:8px; font-size:13px; }
.import-departments { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; }
.import-table-wrap { max-height:45vh; overflow:auto; }
.import-table-wrap table { width:100%; min-width:850px; border-collapse:collapse; }
.import-table-wrap th,.import-table-wrap td { text-align:left; padding:10px; border-bottom:1px solid #e4eaf0; font-size:12px; }
.import-table-wrap th { position:sticky; top:0; background:#f1f6fa; }
.import-excluded { background:#fff0f0; color:#854949; }
.import-id { display:block; color:#687786; margin-top:4px; }
.import-table-wrap input[type=checkbox] { width:18px; height:18px; }
.import-action-bar { position:sticky; bottom:-24px; z-index:3; display:flex; align-items:end; justify-content:space-between; gap:18px; margin:18px -24px -24px; padding:14px 24px 18px; border-top:1px solid #dce5ed; background:#fff; box-shadow:0 -8px 20px rgba(23,58,80,.08); }
.import-action-bar>label { display:flex; flex-direction:column; gap:8px; min-width:min(340px,100%); font-size:13px; }
.import-action-submit { display:flex; align-items:center; justify-content:flex-end; gap:14px; min-width:0; }
.import-action-submit .form-message { max-width:440px; color:#4f6473; font-size:12px; text-align:right; }
.import-action-submit .primary { min-width:172px; }
@media(max-width:540px) { .leave-opening-fields { grid-template-columns:1fr; } .leave-account-summary { gap:8px; } .personnel-import-dialog { padding:12px; width:calc(100vw - 24px); } }
@media(max-width:720px) { .import-action-bar { position:static; flex-direction:column; align-items:stretch; margin:18px -12px -12px; padding:14px 12px; } .import-action-submit { flex-direction:column; align-items:stretch; } .import-action-submit .form-message { max-width:none; text-align:left; } .import-action-submit .primary { width:100%; } }

/* Legal compliance overview follows the restrained settings-panel language. */
.compliance-section { margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.compliance-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.compliance-heading { min-width:0; }
.compliance-eyebrow { display:block; margin-bottom:6px; color:var(--brand); font-size:9px; font-weight:800; letter-spacing:.08em; }
.compliance-heading h3 { margin:0; color:var(--text); font-size:17px; }
.compliance-heading p { margin:5px 0 0; color:var(--muted); font-size:10px; }
.compliance-version { flex:0 0 auto; padding:7px 9px; border:1px solid var(--line); border-radius:7px; background:var(--canvas); color:var(--muted); font-size:9px; font-weight:700; }
.compliance-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:20px 0; border-block:1px solid var(--line); }
.compliance-summary>div { display:flex; min-height:76px; padding:15px 18px; align-items:center; justify-content:space-between; gap:12px; }
.compliance-summary>div+div { border-left:1px solid var(--line); }
.compliance-summary span { color:var(--muted); font-size:10px; font-weight:700; }
.compliance-summary strong { color:var(--text); font-size:24px; line-height:1; }
.compliance-summary .requires-action strong { color:#b66b16; }
.compliance-summary .complete strong { color:var(--ok); }
.compliance-documents { display:grid; gap:10px; }
.compliance-document { display:grid; grid-template-columns:38px minmax(0,1fr); gap:12px; padding:15px 16px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.compliance-document-icon { display:grid; width:34px; height:34px; place-items:center; border-radius:8px; background:#fff4df; color:#a96212; font-size:15px; font-weight:900; }
.compliance-document.is-complete .compliance-document-icon { background:#e5f6ed; color:var(--ok); }
.compliance-document-body { min-width:0; }
.compliance-document-title { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.compliance-document-title strong { display:block; overflow:hidden; color:var(--text); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.compliance-document-title small { display:block; margin-top:4px; color:var(--muted); font-size:9px; }
.compliance-document-title>span { flex:0 0 auto; padding:5px 7px; border-radius:6px; background:#fff4df; color:#955a13; font-size:8px; font-weight:800; }
.compliance-document.is-complete .compliance-document-title>span { background:#e5f6ed; color:#16784a; }
.compliance-progress { height:5px; margin-top:12px; overflow:hidden; border-radius:999px; background:#e8eef2; }
.compliance-progress i { display:block; height:100%; border-radius:inherit; background:#db902c; }
.compliance-document.is-complete .compliance-progress i { background:var(--ok); }
.compliance-missing { margin-top:9px; }
.compliance-missing summary { width:max-content; color:var(--brand); font-size:9px; font-weight:700; cursor:pointer; }
.compliance-missing p,.compliance-complete-copy { margin:8px 0 0; color:var(--muted); font-size:9px; line-height:1.6; }
.compliance-retention { display:flex; margin-top:12px; padding:11px 13px; align-items:center; gap:9px; border-radius:7px; background:#eef6fa; color:#557183; }
.compliance-retention-icon { display:grid; width:20px; height:20px; flex:0 0 20px; place-items:center; border-radius:50%; background:#d8edf7; color:var(--brand); font-size:10px; font-weight:900; }
.compliance-retention p { margin:0; font-size:9px; font-weight:700; }
@media(max-width:720px) {
  .compliance-header,.compliance-document-title { align-items:flex-start; flex-direction:column; }
  .compliance-summary { grid-template-columns:1fr; }
  .compliance-summary>div+div { border-top:1px solid var(--line); border-left:0; }
  .compliance-document-title strong { white-space:normal; }
}
