/* Payroll360 v2 - components that extend app.css (uses its colour variables). */

html, body { max-width: 100%; }
body { overflow-x: hidden; overflow-x: clip; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.78rem; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; vertical-align: -3px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- money ---------------------------------------------------------------------------------------- */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money .cur { font-size: 0.68em; font-weight: 400; color: var(--ink-muted); margin-right: 4px; letter-spacing: 0.03em; }
td.num, th.num { text-align: right; }

/* ---- badges --------------------------------------------------------------------------------------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 400; white-space: nowrap; line-height: 1.6; }
.badge-gray { background: #EEF1F0; color: #475569; }
.badge-blue { background: #E0F2FE; color: #0369A1; }
.badge-amber { background: #FEF3C7; color: #B45309; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-teal { background: #CCFBF1; color: #0F766E; }
.badge-red { background: #FEE2E2; color: #B91C1C; }

/* ---- buttons / spinner ---------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:hover { filter: brightness(0.92); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-subtle); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.spinner { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 400; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---- toasts --------------------------------------------------------------------------------------- */
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warning); }
.toast.leaving { opacity: 0; transition: opacity 300ms; }

/* ---- page structure ------------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.page-sub { font-size: 0.83rem; color: var(--ink-soft); margin-top: 3px; max-width: 680px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: 0.75rem; margin-bottom: 4px; color: var(--ink-muted); }
.crumbs a { text-decoration: none; }
.crumbs .sep { margin: 0 6px; }
.view { max-width: 1320px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 0.98rem; font-weight: 700; color: var(--ink); }
.card-head p { font-size: 0.76rem; color: var(--ink-soft); margin-top: 2px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.two-col-wide { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 0.75rem; font-weight: 400; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); }
.kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value .cur { font-size: 0.55em; }
.kpi-sub { font-size: 0.75rem; color: var(--ink-soft); margin-top: 3px; }
.kpi.warn { border-color: #FCD34D; background: #FFFBEB; }
.kpi.bad { border-color: #FCA5A5; background: #FEF2F2; }
.kpi.good { border-color: #86EFAC; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 22px; }
.kv dt { font-size: 0.75rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.kv dd { font-size: 0.9rem; font-weight: 400; color: var(--ink); margin-top: 2px; word-break: break-word; }

/* ---- alerts ---------------------------------------------------------------------------------------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 14px; font-size: 0.85rem; flex-wrap: wrap; }
.banner .grow { flex: 1; min-width: 200px; }
.banner-warn { background: #FFFBEB; border: 1px solid #FCD34D; color: #92400E; }
.banner-bad { background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; }
.banner-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.banner-good { background: #F0FDF4; border: 1px solid #86EFAC; color: #166534; }
.form-alert { background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.83rem; margin-bottom: 12px; }
.field-error { color: var(--danger); font-size: 0.75rem; min-height: 0; margin-top: 3px; }
.field-error:empty { display: none; }
.field-help { color: var(--ink-muted); font-size: 0.75rem; margin-top: 3px; }
.has-error .form-control, .has-error .form-select { border-color: var(--danger); }
.req { color: var(--danger); }

/* ---- forms ------------------------------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.p-check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.p-check input { width: 16px; height: 16px; }
.section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* ---- toolbar / filters ------------------------------------------------------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 140px; height: 36px; padding: 0 10px; font-size: 0.83rem; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .form-control { width: 100%; padding-left: 32px; }
.toolbar .search .ico { position: absolute; left: 10px; top: 10px; color: var(--ink-muted); }
.toolbar .spacer { flex: 1; }
.filters-toggle { display: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: 0.8rem; color: var(--ink-soft); border-top: 1px solid var(--line); }
.th-sort { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--accent); }

/* ---- tables ------------------------------------------------------------------------------------------ */
/* Scroll affordance: on a tablet or narrow desktop a wide table (more columns than fit) scrolls
   sideways; this inward shadow shows there is more to see, matching .sp-table-wrap in app.css. */
.p-table-wrap {
  overflow-x: auto;
  box-shadow: inset 10px 0 8px -8px rgba(20, 30, 24, 0.28), inset -10px 0 8px -8px rgba(20, 30, 24, 0.28);
}
.p-table td, .p-table th { vertical-align: middle; }
.p-table tr[data-href], .p-table tr.clickable { cursor: pointer; }
.p-table tbody tr:hover td { background: var(--surface-subtle); }
.p-table tr.row-muted td { opacity: 0.55; }
.p-table tr.row-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.p-table tfoot td { font-weight: 400; background: var(--surface-subtle); }
.cell-main { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: 0.75rem; color: var(--ink-muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions .btn { padding: 3px 9px; font-size: 0.75rem; }

/* ---- tabs --------------------------------------------------------------------------------------------- */
/* When there are more tabs than fit (for example a payroll's Employees/Review/Exceptions/Activity/Payslips
   on a phone), the bar scrolls sideways. A fixed edge-fade overlay (out of flow, so it never moves or
   blocks clicks) shows there is another tab to find. Always on, even at the scroll ends: simple and reliable. */
.p-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin;
  position: relative;
}
.p-tabs::before, .p-tabs::after {
  content: ''; position: absolute; top: 0; bottom: 1px; width: 20px; pointer-events: none; z-index: 1;
}
.p-tabs::before { left: 0; background: linear-gradient(to right, var(--surface), rgba(255, 255, 255, 0)); }
.p-tabs::after { right: 0; background: linear-gradient(to left, var(--surface), rgba(255, 255, 255, 0)); }
.p-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-size: 0.85rem; font-weight: 400; color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.p-tab:hover { color: var(--ink); }
.p-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.p-tab-count { background: var(--line); color: var(--ink-soft); border-radius: 999px; padding: 0 7px; font-size: 0.75rem; margin-left: 4px; }

/* ---- stepper (payroll stages / wizard) ---------------------------------------------------------------- */
.stepper { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 18px; overflow-x: auto; counter-reset: s; }
.step { flex: 1; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; font-size: 0.75rem; color: var(--ink-muted); text-align: center; padding: 0 4px; }
.step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step-dot { width: 27px; height: 27px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-weight: 400; font-size: 0.75rem; z-index: 1; position: relative; }
.step-name { font-weight: 400; }
.step-done { color: var(--accent); }
.step-done::before { background: var(--accent); }
.step-done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-current { color: var(--ink); }
.step-current .step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-light); }
.step-current::before { background: var(--accent); }
.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.wizard-steps .ws { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 400; color: var(--ink-muted); padding: 4px 10px; border-radius: 999px; background: var(--surface-subtle); border: 1px solid var(--line); }
.wizard-steps .ws.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.wizard-steps .ws.done { color: var(--ink-soft); }
.wizard-steps .ws b { width: 18px; height: 18px; border-radius: 50%; background: var(--line); color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.wizard-steps .ws.active b { background: var(--accent); color: #fff; }

/* ---- states --------------------------------------------------------------------------------------------- */
.empty-state, .error-state { text-align: center; padding: 46px 20px; color: var(--ink-soft); }
.empty-state .ico, .error-state .ico { color: var(--ink-muted); margin-bottom: 10px; }
.empty-state h3, .error-state h3 { font-size: 1rem; color: var(--ink); margin-bottom: 6px; }
.empty-state p, .error-state p { font-size: 0.85rem; max-width: 460px; margin: 0 auto 14px; }
.error-state .ico { color: var(--danger); }
.skeleton { padding: 18px 20px; }
.sk-row { height: 14px; border-radius: 6px; margin-bottom: 14px; background: linear-gradient(90deg, var(--line) 25%, var(--surface-subtle) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-block { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 40px; color: var(--ink-soft); }

/* ---- dialogs / drawers ----------------------------------------------------------------------------------- */
.p-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.p-overlay-drawer { justify-content: flex-end; padding: 0; }
.p-layer { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 32px); width: 100%; }
.p-modal { border-radius: var(--radius-lg); }
.p-modal.p-sm { max-width: 460px; }
.p-modal.p-md { max-width: 640px; }
.p-modal.p-lg { max-width: 860px; }
.p-modal.p-xl { max-width: 1040px; }
.p-drawer { height: 100vh; max-height: 100vh; border-radius: 0; max-width: 720px; animation: drawerIn 200ms ease; }
.p-drawer.p-xl { max-width: 900px; }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.p-layer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.p-layer-head h3 { font-size: 1.05rem; font-weight: 700; }
.p-layer-sub { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.p-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 0 4px; }
.p-layer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.p-layer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.p-confirm p { font-size: 0.9rem; margin-bottom: 12px; line-height: 1.5; }
.summary-list { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 10px 0; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 0.86rem; border-bottom: 1px solid var(--line); }
.summary-list div:last-child { border-bottom: 0; font-weight: 400; background: var(--surface-subtle); }

/* ---- lists ------------------------------------------------------------------------------------------------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.85rem; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--accent); }
.checklist .bad { color: var(--danger); }
.exception-list { list-style: none; padding: 0; margin: 0; }
.exception-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 0.84rem; }
.exception-list .sev-error { color: var(--danger); }
.exception-list .sev-warning { color: #B45309; }
.line-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.line-table th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.line-table td { padding: 7px 8px; font-size: 0.84rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.line-table .calc { color: var(--ink-muted); font-size: 0.75rem; }
.line-table .num { text-align: right; }
.line-table tr.total td { font-weight: 700; background: var(--surface-subtle); }
.net-banner { background: var(--ink); color: #fff; border-radius: var(--radius-md); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.net-banner .label { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.net-banner .amount { font-size: 1.5rem; font-weight: 700; color: #6EF0A0; }
.net-banner .money .cur { color: #A7E8C0; }
.tag-unverified { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; border-radius: 4px; padding: 0 6px; font-size: 0.75rem; font-weight: 400; margin-left: 6px; }

/* ---- charts ------------------------------------------------------------------------------------------------- */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-tick { fill: var(--ink-muted); font-size: 0.75rem; }
.ch-label { fill: var(--ink-soft); }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.76rem; color: var(--ink-soft); margin-top: 6px; }
.ch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ---- auth: a rectangular two-column box - marketing panel on the left, the form on the right ------------------ */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--bg); position: relative; overflow: hidden; }
/* The same "Our Home Planet" video as the appz360.com prefooter (its own baked-in caption removed), muted and
   looping across the whole page behind the box, under a dark overlay so the box keeps strong contrast. */
.auth-shell .av-bg { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-shell .av-shell-overlay { position: absolute; inset: 0; z-index: 1; background: linear-gradient(135deg, rgba(1,68,45,.80) 0%, rgba(1,30,20,.88) 100%); }
@media (prefers-reduced-motion: reduce) {
  .auth-shell .av-bg { display: none; }
}
.auth-card { position: relative; z-index: 2; width: 100%; max-width: 980px; min-height: 580px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 20px 50px -10px rgba(0,0,0,.45); overflow: hidden; display: flex; }

.auth-visual { flex: 0 0 42%; background: linear-gradient(135deg, var(--accent) 0%, #01442D 100%); color: #fff; padding: 44px 36px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-visual::before { content: ''; position: absolute; z-index: 1; top: -70px; right: -70px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-visual::after { content: ''; position: absolute; z-index: 1; left: -60px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.06); }
.auth-visual > * { position: relative; z-index: 2; }
.auth-visual .av-logo-wrap { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; background: #fff; padding: 8px 12px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.auth-visual .av-logo { height: 56px; width: 56px; display: block; object-fit: contain; }
.auth-visual h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.28; margin: 28px 0 10px; color: #fff; }
.auth-visual .av-sub { font-size: .88rem; line-height: 1.6; color: rgba(255,255,255,.85); margin: 0 0 22px; }
.auth-visual .av-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-visual .av-features li { display: flex; align-items: flex-start; gap: 10px; font-size: .85rem; color: #fff; }
.auth-visual .av-features svg { flex: none; margin-top: 1px; background: rgba(255,255,255,.18); border-radius: 50%; padding: 3px; width: 18px; height: 18px; box-sizing: border-box; }
.auth-visual .av-foot { font-size: .76rem; color: rgba(255,255,255,.65); margin: 0; }

.auth-form-panel { flex: 1 1 58%; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.auth-form-panel h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
.auth-form-panel p.lead { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 18px; }

@media (max-width: 760px) {
  .auth-card { flex-direction: column; max-width: 460px; min-height: 0; }
  .auth-visual { padding: 28px 24px; }
  .auth-visual h2 { font-size: 1.2rem; margin: 18px 0 8px; }
  .auth-visual .av-features { display: none; }
  .auth-form-panel { padding: 28px 24px; }
}

/* ---- payslip sheet (reuses app.css .payslip-sheet look) ------------------------------------------------------------- */
.sheet-wrap { max-width: 860px; margin: 0 auto; }
.payslip-sheet .ps-table-row small { color: var(--ink-muted); display: block; font-size: 0.75rem; }
.payslip-sheet .ps-note { color: #C2410C; font-size: 0.75rem; margin-top: 8px; }
.payslip-sheet .ps-logo-wrap img { max-width: 64px; max-height: 64px; object-fit: contain; }

/* ---- app shell tweaks --------------------------------------------------------------------------------------------- */
.nav-search-input:disabled { opacity: 0.5; }
.user-menu { position: relative; }
.user-menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); min-width: 220px; z-index: 60; padding: 6px; }
.user-menu-pop .who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu-pop .who b { display: block; font-size: 0.86rem; }
.user-menu-pop .who span { font-size: 0.75rem; color: var(--ink-muted); }
.user-menu-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; color: var(--ink); }
.user-menu-pop button:hover { background: var(--surface-subtle); }
.notice-bar { background: #FFFBEB; border-bottom: 1px solid #FCD34D; color: #92400E; font-size: 0.78rem; padding: 6px 16px; text-align: center; }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }

/* ---- responsive ------------------------------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .two-col, .two-col-wide { grid-template-columns: minmax(0, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-toggle { display: inline-flex; }
  .toolbar.collapsed .filter-item { display: none; }
}
@media (max-width: 720px) {
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .p-drawer { max-width: 100%; }
  .p-overlay { padding: 0; align-items: flex-end; }
  .p-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .step { min-width: 74px; }
  .step-name { font-size: 0.75rem; }
  /* tables become stacked cards */
  .p-table thead { display: none; }
  .p-table, .p-table tbody, .p-table tr, .p-table td { display: block; width: 100%; }
  .p-table tr { border: 1px solid var(--line); border-radius: var(--radius-md); margin: 0 0 10px; padding: 6px 0; background: var(--surface); }
  .p-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 12px; border: 0; text-align: right; }
  .p-table td::before { content: attr(data-label); font-size: 0.75rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); text-align: left; flex: none; }
  .p-table td.num { text-align: right; }
  .p-table td .actions { justify-content: flex-end; }
  .p-table-wrap { overflow: visible; padding: 0 12px; box-shadow: none; }
  .toolbar .form-control, .toolbar .form-select { width: 100%; }
  .toolbar .filter-item { flex: 1 1 100%; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}

/* ---- print: only the payslip ----------------------------------------------------------------------------------------- */
@media print {
  .top-nav-bar, .app-sidebar, .page-head, .p-overlay, .toast-container, .no-print, .view-switch { display: none !important; }
  .main-viewport { padding: 0 !important; background: #fff !important; }
  .sheet-wrap { max-width: none; }
  .payslip-sheet { box-shadow: none !important; border: 0 !important; }
}

/* sub-menu links are anchors now; keep them plain */
a.nav-subitem, a.nav-item { text-decoration: none; }

/* Internal marketing box (left menu, above the footer). Content lives in app/promos.js */
#promo-slot:empty { display: none; }
#promo-slot { padding: 0 12px 10px; }
.promo-box { position: relative; padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(160deg, var(--accent-light, #e8f7ee) 0%, #fff 75%); }
.promo-tag { display: inline-block; font-size: 0.75rem; font-weight: 400; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.promo-title { font-size: .86rem; font-weight: 700; color: var(--ink); margin: 3px 18px 2px 0; line-height: 1.25; }
.promo-text { font-size: .76rem; line-height: 1.4; color: var(--ink-muted, #557); margin: 0 0 8px; }
.promo-cta { display: inline-block; font-size: .76rem; font-weight: 400; color: #fff; background: var(--accent); border-radius: 8px; padding: 5px 10px; text-decoration: none; }
.promo-cta:hover { filter: brightness(.95); }
.promo-cta:focus-visible, .promo-x:focus-visible, .promo-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.promo-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; font-size: 1.05rem; line-height: 1; color: var(--ink-muted, #557); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.promo-x:hover { background: var(--surface-subtle); color: var(--ink); }
.promo-dots { display: flex; gap: 5px; margin-top: 8px; }
.promo-dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; background: var(--line-strong, #c9d8cf); cursor: pointer; }
.promo-dot.on { background: var(--accent); }
/* Short screens: keep the menu itself reachable */
@media (max-height: 700px) { #promo-slot { display: none; } }
@media print { #promo-slot { display: none; } }
/* Medium-height screens: compact box (title + button) so a long menu still fits */
@media (max-height: 960px) {
  .promo-text, .promo-tag { display: none; }
  .promo-box { padding: 8px 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .promo-title { font-size: .78rem; margin: 0 16px 0 0; flex: 1 1 100%; }
  .promo-cta { font-size: 0.75rem; padding: 4px 9px; }
  .promo-dots { margin-top: 0; }
}

/* Phones: comfortable tap targets (about 40px+) */
@media (max-width: 720px) {
  .mobile-menu-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 38px; padding-left: 12px; padding-right: 12px; }
  .crumbs a { display: inline-block; padding: 10px 4px; }
  #view td a:not(.btn), #view li a:not(.btn), .card-head a:not(.btn) { display: inline-block; padding: 9px 0; }
  .actions { gap: 8px; }
  .p-tab { min-height: 44px; }
  .th-sort { min-height: 40px; }
  .promo-x { min-width: 32px; min-height: 32px; }
}

/* Small phones: the payslip sheet must never clip its amounts */
@media (max-width: 480px) {
  .payslip-sheet .ps-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .payslip-sheet .ps-title-block { text-align: left; align-self: stretch; }
  .payslip-sheet .ps-title-block h1 { font-size: 1.35rem; }
  .payslip-sheet .ps-net-pay-banner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .payslip-sheet .ps-net-amount { font-size: 1.9rem; max-width: 100%; overflow-wrap: anywhere; }
  .payslip-sheet .ps-footer-grid { grid-template-columns: 1fr; gap: 14px; }
  .payslip-sheet .ps-table-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
}
/* Long emails, names and money values wrap instead of overflowing */
@media (max-width: 480px) {
  .cell-sub, .cell-main { overflow-wrap: anywhere; }
  .kpi-value, .kpi-value .money { overflow-wrap: anywhere; }
  #view td .money, #view td.num { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .payslip-sheet .ps-net-amount { font-size: 1.5rem; }
  .payslip-sheet .ps-net-pay-banner { padding-left: 14px; padding-right: 14px; }
}

/* ---- Global typography: Arial everywhere. Weight is left to each element's own rule
   (headings/buttons/etc. above) so Arial Bold still renders instead of flattening to regular. ---- */
*, *::before, *::after {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Employee search sits at the right end of the header, just before the user menu. */
.nav-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.nav-right .nav-search-wrap { margin-left: 0; }
