/* ── Staff & HR and Approvals (spec 120, UI redesign slice 9) ─────────────
   The page stylesheet of HR & Payroll: every rule that belongs to Staff & HR
   (its seven tabs, its four pop-ups) and to Approvals, and no colour of its
   own — every colour is a variable from tokens.css, so dark follows when the
   switch comes (#321). Loaded after setup.css and before frame.css.

   Parts, in order: the shared HR vocabulary (status pills, figures, notes);
   the Staff & HR fragment (forms, toolbars, the pop-ups, the key and value
   rows of Payroll Review); what staff.js draws up to the attendance pop-up
   (staff, salary, advances, comp plans and their graphic, shifts, the
   attendance grid and the Week Plan); what it draws from Payroll on (payroll,
   Quick Entry and its calendar, Daily Incentives); Approvals; motion off.

   Phone rules are at 640px and under, where the card tables of
   components.css take over and the grids are re-laid here: the attendance
   grid and Week Plan as a card per staff member, Quick Entry's calendar as a
   list of days. No th or td here is sticky (spec 059). */

/* ═══ Shared HR vocabulary ══════════════════════════════════════════════════ */

/* ── Shared by every HR lane (contract) ───────────────────────────────────
   Owned by the contract, not by a lane: a lane uses these and does not
   redefine them. */

/* Figures: mono, tabular, right, on one line. */
.hr-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

/* A row of things with a gap that wraps on a narrow screen. */
.hr-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* A small note under a field or a table. */
.hr-note { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* Text in a status colour. */
.hr-good { color: var(--good); }
.hr-caution { color: var(--caution); }
.hr-bad { color: var(--bad); }
.hr-info { color: var(--accent-2); }
.hr-strong { font-weight: 600; }

/* A status pill. data-tone picks the colour:
   neutral (no record, draft), good (present, paid), caution (half day,
   review, pending), bad (absent, voided, rejected), info (approved, leave). */
.hr-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
    background: var(--panel-raised);
    color: var(--text-muted);
}
.hr-pill[data-tone="good"]    { background: var(--good-soft);    color: var(--good); }
.hr-pill[data-tone="caution"] { background: var(--caution-soft); color: var(--caution); }
.hr-pill[data-tone="bad"]     { background: var(--bad-soft);     color: var(--bad); }
.hr-pill[data-tone="info"]    { background: var(--info-soft);    color: var(--accent-2); }
/* In a phone card a cell is a grid; a pill keeps its own width there. */
.cards-on-phone td > .hr-pill,
#staff .cards-on-phone td > .status-badge,
#hrapprovals .cards-on-phone td > .status-badge { justify-self: start; }

/* ═══ Staff & HR: the fragment ══════════════════════════════════════════════ */

/* ── Staff & HR: the page's own markup (staff.html, spec 120) ─────────────
   Every rule here is on a class only staff.html carries, so the sheet can
   load on every page. Colours are the tokens, so dark follows. */

/* Section titles: the mono label with a rule under it. */
.hr-section-title {
    margin: 22px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
form .hr-section-title:first-child { margin-top: 0; }

/* Payslip-style label and value rows. */
.kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.kv-label { min-width: 0; color: var(--text-muted); }
.kv-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
}
.kv-sub {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

/* The "?" beside a figure: how it is worked out. */
.calc-help-btn {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
}
.calc-help-btn:hover { border-color: var(--accent); color: var(--text); }

/* The editable fields of an otherwise read-only view. */
.hr-edit-block {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 12px;
    margin: 12px 0;
    padding: 12px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}
.hr-edit-block .form-group { margin-bottom: 0; }

/* ── Forms and toolbars ───────────────────────────────── */
.hr-staff-form-title,
.hr-shift-form-title,
.hr-plan-form-title {
    margin: 0 0 20px;
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
}

.hr-staff-field-note {
    display: block;
    margin-top: 5px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-muted);
}
:root .hr-plan-field-note,
:root .hr-qe-field-note {
    margin: 5px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.hr-staff-search {
    width: auto;
    flex: 1 1 180px;
    min-width: 160px;
    padding: 8px 12px;
    font-size: 13.5px;
}

/* A field in a card's toolbar sits on the toolbar's line. */
.hr-adv-staff-field,
.hr-week-month-field,
.hr-qe-month-field,
.hr-di-month-field,
.hr-pay-month-field { margin-bottom: 0; min-width: 160px; }
.hr-adv-staff-field { min-width: 220px; }
.hr-week-load-btn { align-self: flex-end; }

/* A table's first line while it loads, or when it has nothing. */
.hr-staff-empty,
.hr-adv-empty,
.hr-shift-empty,
.hr-qe-empty,
.hr-di-empty,
.hr-pay-empty,
.hr-plan-empty {
    padding: 28px 12px;
    text-align: center;
    color: var(--text-muted);
}
.hr-week-empty {
    margin: 0;
    padding: 28px 12px;
    text-align: center;
    color: var(--text-muted);
}

/* Figures' headings sit over the figures. */
.hr-qe-th-num,
.hr-di-th-num,
.hr-pay-th-num { text-align: right; }

/* ── Advances ─────────────────────────────────────────── */
.hr-adv-balance {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.hr-adv-balance strong {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
}
.hr-adv-ledger { margin-bottom: 22px; }
.hr-adv-add-title {
    margin: 0 0 12px;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
:root .hr-adv-add-hint { margin: -6px 0 12px; font-size: 12px; }
.hr-adv-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 12px;
    align-items: end;
}
.hr-adv-add-grid .form-group { margin-bottom: 0; }
.hr-adv-add-btn { align-self: end; }

/* ── Shifts ───────────────────────────────────────────── */
.hr-shift-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 16px;
}

/* ── Attendance & OT ──────────────────────────────────── */
.hr-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}
.hr-week-nav-btn {
    min-width: 44px;
    padding: 8px 14px;
    font-size: 16px;
    line-height: 1;
}
.hr-week-label {
    flex: 0 1 250px;
    min-width: 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
}
.hr-week-plan-wrap {
    margin: 16px 0;
    padding: 16px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}

/* ── Quick Entry's table: a heading of two rows ───────── */
.hr-qe-th-base { vertical-align: bottom; }
/* Ten columns: the figures' headings wrap so the table fits its box at a
   desktop width instead of scrolling sideways. */
.hr-qe-th-num { white-space: normal; vertical-align: bottom; }
.hr-qe-th-group {
    text-align: center;
    border-bottom: 1px solid var(--line);
    letter-spacing: 0.14em;
}

/* ── Comp Plans: the slabs graphic ────────────────────── */
.hr-plan-graphic {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}
.hr-plan-graphic-title {
    margin-bottom: 6px;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
:root .hr-plan-graphic-note { margin-bottom: 6px; font-size: 12px; }
.hr-plan-graphic-bars { max-width: 100%; overflow-x: auto; }
.hr-plan-try-grid { margin-top: 10px; }
.hr-plan-try-result {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text);
}

/* ── The four pop-ups ─────────────────────────────────── */
/* The overlay: scrim over the page, above the frame and the phone dock. */
.hr-qe-modal,
.hr-pay-modal,
.hr-pay-upi-modal,
.hr-att-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--scrim);
}
.hr-pay-upi-modal { z-index: 2100; }

.hr-qe-modal .modal-box,
.hr-pay-modal .modal-box,
.hr-pay-upi-modal .modal-box,
.hr-att-modal .modal-box {
    width: 100%;
    padding: 24px;
    box-shadow: var(--lift);
}
.hr-qe-modal .modal-box { max-width: 760px; max-height: 88vh; overflow-y: auto; }
.hr-pay-modal .modal-box { max-width: 560px; max-height: 88vh; overflow-y: auto; }
.hr-pay-upi-modal .modal-box { max-width: 380px; text-align: center; }
.hr-att-modal .modal-box { max-width: 420px; }

/* A pop-up's heading line: the title, then its buttons. */
.hr-qe-head,
.hr-pay-head,
.hr-pay-upi-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.hr-pay-upi-head { margin-bottom: 6px; }
.hr-qe-title,
.hr-pay-title,
.hr-pay-upi-title,
.hr-att-title {
    margin: 0;
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}
.hr-pay-title { flex: 1; }
.hr-pay-upi-title { font-size: 18px; }
.hr-att-title { margin-bottom: 16px; }

/* The round-cornered square buttons in a heading: close, download. */
.hr-qe-close,
.hr-pay-close,
.hr-pay-download,
.hr-pay-upi-close {
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.hr-qe-close:hover,
.hr-pay-close:hover,
.hr-pay-download:hover,
.hr-pay-upi-close:hover { border-color: var(--accent); color: var(--text); }

/* A checkbox with its words, the whole line pressable. */
.hr-qe-check,
.hr-pay-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

/* ── Quick Entry pop-up ───────────────────────────────── */
:root .hr-qe-intro { margin: 0 0 12px; font-size: 12px; line-height: 1.5; }
:root .hr-qe-loading { padding: 24px; text-align: center; }
.hr-qe-overrides {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.hr-qe-overrides-title {
    margin: 0 0 4px;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
:root .hr-qe-overrides-hint { margin: 0 0 12px; font-size: 12px; }
.hr-qe-overrides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 16px;
}
.hr-qe-overrides-grid .form-group { margin-bottom: 0; }
.hr-qe-unused-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line-strong);
}
.hr-qe-unused-reason { flex: 1 1 220px; min-width: 0; margin-bottom: 0; }
.hr-qe-foot { margin-top: 16px; text-align: right; }

/* ── Payroll Review pop-up ────────────────────────────── */
.hr-pay-explain {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: var(--panel-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}
.hr-pay-explain-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.hr-pay-explain-text {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.hr-pay-explain-close {
    flex-shrink: 0;
    padding: 2px 4px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.hr-pay-explain-close:hover { color: var(--text); }

.kv-label.hr-pay-kv-strong { color: var(--text); font-weight: 600; }
.hr-pay-adv-out {
    font-weight: 400;
    color: var(--text-muted);
}
.hr-edit-block.hr-pay-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 18px;
}
.hr-pay-edit-grow { flex: 1 1 200px; min-width: 0; }
.hr-edit-block.hr-pay-edit-flush { margin-top: 0; }
.hr-pay-status-field { padding-bottom: 6px; }
.hr-pay-status-label {
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
}

/* The Net Payable footer stays in view at the foot of the box while the
   figures scroll: `bottom` and the bottom margin cancel the box's bottom
   padding, so it sits on the box's edge (a sticky box keeps clear of its
   scroller's padding otherwise). */
.pay-modal-footer {
    position: sticky;
    bottom: -24px;
    z-index: 1;
    margin: 16px -24px -24px;
    padding: 14px 24px 20px;
    background: var(--panel);
    border-top: 1px dashed var(--line-strong);
}
.hr-pay-net-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}
.hr-pay-net-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.hr-pay-net-value {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--text);
    white-space: nowrap;
}
.btn-group.hr-pay-actions {
    margin: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

/* The three status buttons keep their own colours: approve in the second
   accent, the two that pay in the good colour. */
.btn.hr-pay-btn-approve { background: var(--accent-2); border-color: var(--accent-2); color: var(--panel); }
.btn.hr-pay-btn-pay,
.btn.hr-pay-btn-paid { background: var(--good); border-color: var(--good); color: var(--panel); }
.btn.hr-pay-btn-approve:hover:not(:disabled) { border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--info-soft); }
.btn.hr-pay-btn-pay:hover:not(:disabled),
.btn.hr-pay-btn-paid:hover:not(:disabled) { border-color: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.btn.hr-pay-btn-pay:hover { color: var(--panel); }

/* Payroll Review's three-column attendance count: stays a table on a phone.
   table-layout fixed and wrapping keep the day lists inside the box. */
.pay-att-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    margin-bottom: 4px;
    font-size: 13.5px;
}
.pay-att-table th {
    padding: 4px 6px;
    background: transparent;
    border-bottom: 0;
    text-align: center;
}
.pay-att-table th:first-child { width: 84px; text-align: left; }
.pay-att-table td {
    padding: 5px 6px;
    border-bottom: 0;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    text-align: center;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.pay-att-table td:first-child {
    font-family: var(--font-text);
    font-weight: 400;
    text-align: left;
    color: var(--text-muted);
}
.pay-att-table tr:hover td { background: none; }
.pay-att-table .kv-sub { white-space: normal; }

/* ── Pay via UPI pop-up ───────────────────────────────── */
.hr-pay-upi-payee {
    margin-bottom: 2px;
    font-size: 13px;
    color: var(--text-muted);
}
.hr-pay-upi-amount {
    margin-bottom: 14px;
    font-family: var(--font-head);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}
.hr-pay-upi-canvas {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    max-width: 100%;
}
.hr-pay-upi-vpa {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
}
.hr-pay-upi-hint {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
}
.btn-group.hr-pay-upi-actions { margin-top: 16px; justify-content: center; }

/* ── Attendance pop-up ────────────────────────────────── */
.hr-att-view .kv-row:last-child { border-bottom: 0; }
.kv-value.hr-att-notes {
    max-width: 60%;
    font-family: var(--font-text);
    font-weight: 400;
    white-space: normal;
    overflow-wrap: anywhere;
}
.hr-att-edit-grid { display: grid; gap: 12px; }
.hr-att-edit-grid .form-group { margin-bottom: 0; }

/* ── On a phone ───────────────────────────────────────── */
@media (max-width: 640px) {
    /* Toolbar fields take the line's width. */
    .hr-adv-staff-field,
    .hr-week-month-field,
    .hr-qe-month-field,
    .hr-di-month-field,
    .hr-pay-month-field { flex: 1 1 160px; min-width: 0; }
    .hr-staff-search { min-width: 0; }

    .hr-week-nav { gap: 8px; }
    .hr-week-label { font-size: 13px; }

    /* Every button in this markup is a finger's height. */
    .hr-qe-close,
    .hr-pay-close,
    .hr-pay-download,
    .hr-pay-upi-close { width: 44px; height: 44px; }
    .hr-pay-explain-close { min-width: 44px; min-height: 44px; }
    .hr-qe-check,
    .hr-pay-check {
        min-height: 44px;
        padding-bottom: 0;
        white-space: normal;
    }
    .hr-qe-check input,
    .hr-pay-check input { width: 20px; height: 20px; flex-shrink: 0; }
    /* The "?" stays a 20px ring, inside a 44px target: the transparent
       border is the target, the ring is drawn inside it. */
    .calc-help-btn {
        width: 44px;
        height: 44px;
        margin: -12px -10px -12px -8px;
        border: 12px solid transparent;
        background-clip: padding-box;
        box-shadow: inset 0 0 0 1px var(--line-strong);
    }
    .calc-help-btn:hover { border-color: transparent; box-shadow: inset 0 0 0 1px var(--accent); }

    /* The pop-ups are sheets from the foot of the screen. */
    .hr-qe-modal,
    .hr-pay-modal,
    .hr-pay-upi-modal,
    .hr-att-modal { align-items: flex-end; padding: 0; }
    .hr-qe-modal .modal-box,
    .hr-pay-modal .modal-box,
    .hr-pay-upi-modal .modal-box,
    .hr-att-modal .modal-box {
        max-width: 100%;
        max-height: 92dvh;
        overflow-y: auto;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
        border-radius: var(--r-lg) var(--r-lg) 0 0;
    }
    .hr-qe-title,
    .hr-pay-title,
    .hr-att-title { font-size: 20px; }

    /* Quick Entry: its Save stays at the foot of the sheet while the days
       scroll (the same cancelling of the box's bottom padding as Net
       Payable's footer). */
    .hr-qe-foot {
        position: sticky;
        bottom: calc(-16px - env(safe-area-inset-bottom));
        z-index: 1;
        margin: 16px -16px calc(-16px - env(safe-area-inset-bottom));
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
        background: var(--panel);
        border-top: 1px solid var(--line);
        text-align: center;
    }
    .hr-qe-foot .btn { width: 100%; }
    .hr-qe-overrides-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }


    .pay-modal-footer {
        bottom: calc(-16px - env(safe-area-inset-bottom));
        margin: 16px -16px calc(-16px - env(safe-area-inset-bottom));
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    }
    .hr-pay-net-value { font-size: 24px; }
    .btn-group.hr-pay-actions .btn { flex: 1 1 auto; }
    .btn-group.hr-pay-upi-actions .btn { flex: 1 1 auto; }
}

/* ═══ Staff & HR: staff, advances, comp plans, shifts, attendance ═══════════ */

/* ── Staff & HR, drawn by staff.js (lane jsA, spec 120) ─────────────────
   The markup staff.js builds from the top of the file through
   saveAttendanceRecord(): the Staff tab, Staff Salary, Advances, Comp Plans
   and its slab graphic, Shifts, the Attendance week grid, the Week Plan and
   the attendance pop-up's helpers. Every colour is a variable. */

/* ── Lines across an empty table ───────────────────────── */
.hr-staff-empty,
.hr-plan-empty,
.hr-shift-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

/* ── Staff ─────────────────────────────────────────────── */
.hr-staff-name { font-weight: 500; }
.hr-staff-sub {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
/* :root .muted sets 13px, so this names both classes to win. */
.muted.hr-staff-inactive { font-size: 11px; }
/* Reset PIN: a caution action beside Edit and Delete. */
.action-btn.hr-staff-pin-btn {
    background: var(--caution-soft);
    border-color: transparent;
    color: var(--caution);
}

/* Staff Salary's two figures. */
.hr-staff-money { width: 110px; max-width: 100%; }

/* ── Advances ──────────────────────────────────────────── */
.hr-adv-note {
    text-align: center;
    color: var(--text-muted);
    padding: 16px 12px;
}
.hr-adv-note.hr-bad { color: var(--bad); }

.hr-adv-date-cell { white-space: nowrap; }
.hr-adv-actions { white-space: nowrap; }

/* The small lines under a figure: approved for less, was / history, the
   reason a row was voided. */
.hr-adv-sub,
.hr-adv-was,
.hr-adv-void-reason {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}
.hr-adv-edited { font-weight: 600; color: var(--text); }
.hr-adv-history-link { color: var(--accent-2); }

/* A void entry's date and amount are struck through. */
.hr-adv-void .hr-adv-strike {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* The row opened under an entry: its edit form, void or restore prompt, or
   its history. */
.hr-adv-inline-cell { background: var(--panel-raised); }
.hr-adv-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    align-items: end;
}
.hr-adv-edit-grid .form-group,
.hr-adv-reason-bar .form-group { margin-bottom: 0; }
.hr-adv-inline-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}
.hr-adv-reason-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.hr-adv-reason-text { align-self: center; }
.hr-adv-reason-field { min-width: min(240px, 100%); }
.hr-adv-history {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Disburse: "₹3,000.00 via [mode] Confirm Cancel" in the actions cell. */
.hr-adv-disburse-amount {
    margin-right: 4px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
select.hr-adv-pay-mode {
    width: auto;
    padding: 4px 6px;
}

/* ── Comp Plans ────────────────────────────────────────── */
.hr-plan-name { font-weight: 500; }
.hr-plan-nowrap { white-space: nowrap; }

/* The slab graphic (spec 052): every fill and stroke from a class. */
.hr-plan-svg {
    display: block;
    width: 100%;
    min-width: 480px;
    font-family: var(--font-text);
}
.hr-plan-svg-head { fill: var(--text); font-family: var(--font-head); }
.hr-plan-svg-caption { fill: var(--text-muted); }
.hr-plan-svg-tick { fill: var(--text-muted); font-family: var(--font-mono); }
.hr-plan-svg-marker { stroke: var(--text); }
.hr-plan-svg-rev { stroke: var(--attention); }
.hr-plan-svg-rev-text { fill: var(--attention); font-family: var(--font-mono); }

/* The bands, by tone: a percentage plan's p1–p4 rise from the soft tints to
   the accent and the ink; a flat plan's steps f1–f3 likewise; the stretch
   below a flat plan's Target 1 is a hairline tint. Each label is inked to
   read on its band in both themes. */
.hr-plan-band { fill: var(--panel-raised); }
.hr-plan-band[data-tone="gap"] { fill: var(--line); }
.hr-plan-band[data-tone="p1"] { fill: var(--info-soft); }
.hr-plan-band[data-tone="p2"],
.hr-plan-band[data-tone="f1"] { fill: var(--good-soft); }
.hr-plan-band[data-tone="p3"],
.hr-plan-band[data-tone="f2"] { fill: var(--accent); }
.hr-plan-band[data-tone="p4"],
.hr-plan-band[data-tone="f3"] { fill: var(--text); }

.hr-plan-band-label { fill: var(--text); }
.hr-plan-band-label[data-tone="gap"] { fill: var(--text-muted); }
.hr-plan-band-label[data-tone="p1"] { fill: var(--accent-2); }
.hr-plan-band-label[data-tone="p2"],
.hr-plan-band-label[data-tone="f1"] { fill: var(--good); }
.hr-plan-band-label[data-tone="p3"],
.hr-plan-band-label[data-tone="f2"],
.hr-plan-band-label[data-tone="p4"],
.hr-plan-band-label[data-tone="f3"] { fill: var(--panel); }

/* ── Shifts ────────────────────────────────────────────── */
.hr-shift-name { font-weight: 500; }
.hr-shift-time {
    white-space: nowrap;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ── Attendance week grid and Week Plan ────────────────────
   Staff by the seven days of a week. Above 640px the table is sized to fit
   its box: fixed columns that share the width, so nothing scrolls sideways
   and the name column needs no freezing (no frozen cell: spec059). */
table.hr-week-grid {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}
.hr-week-grid th {
    padding: 10px 4px;
    text-align: center;
    white-space: normal;
    letter-spacing: 0.04em;
    line-height: 1.3;
}
.hr-week-grid td {
    padding: 8px 4px;
    text-align: center;
    vertical-align: middle;
}
.hr-week-grid th.hr-week-namehead,
.hr-week-grid td.hr-week-name {
    padding-left: 14px;
    text-align: left;
}
.hr-week-grid th.hr-week-we { color: var(--caution); }
.hr-week-name {
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* Column widths: the days share what the name, the shift and the totals
   leave. */
.hr-week-att .hr-week-namehead { width: 22%; }
.hr-week-att .hr-week-totalhead { width: 10%; }
.hr-week-plan .hr-week-namehead { width: 20%; }
.hr-week-plan .hr-week-shifthead { width: 24%; }

/* A day's status on the attendance grid: an .hr-pill whose data-tone
   (present good, absent bad, half day caution, other and no record
   neutral) colours it; this sizes it into a chip. */
.hr-week-att .hr-week-day { cursor: pointer; }
.hr-pill.hr-week-chip {
    display: inline-grid;
    place-items: center;
    width: 100%;
    max-width: 44px;
    height: 32px;
    padding: 0;
    border-radius: var(--r-sm);
    font-size: 13px;
    letter-spacing: 0;
}
.hr-pill.hr-week-chip[data-tone="neutral"] {
    background: transparent;
    border: 1px dashed var(--line-strong);
}
@media (hover: hover) {
    .hr-week-chip { transition: transform 0.15s var(--ease-out); }
    .hr-week-day:hover .hr-week-chip { transform: translateY(-1px); }
}
.hr-week-total {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

/* The Week Plan's head: the title, the message and Save. */
.hr-week-plan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.hr-week-plan-title {
    margin: 0;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}
.hr-week-plan-sub {
    font-family: var(--font-text);
    font-size: 12.5px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-muted);
}
.hr-week-plan-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.hr-week-msg { font-size: 13px; }

select.hr-week-shift-select {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    font-size: 13px;
}

/* A planned day: working in the good tone, off (data-off="1") in the bad. */
.hr-week-day-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    background: var(--good-soft);
    color: var(--good);
    transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.hr-week-day-btn[data-off="1"] {
    background: var(--bad-soft);
    color: var(--bad);
}
.hr-week-day-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Attendance pop-up ─────────────────────────────────── */
/* Clock In and Clock Out while the day is marked absent. */
input.hr-att-locked {
    background: var(--panel-raised);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ── On a phone ────────────────────────────────────────── */
@media (max-width: 640px) {
    /* The slab graphic fits the screen rather than scrolling its box. */
    .hr-plan-svg { min-width: 0; }

    /* An opened row under an advance reads left to right, not centred. */
    .cards-on-phone td.hr-adv-inline-cell { text-align: left !important; }

    /* The week grids as a card per staff member (answer 3): the name on top,
       the seven days in one row, each day's heading (stamped by
       tablecards.js) above its chip, then Days Off and OT — or, on the Week
       Plan, the name and the shift side by side above the days. Fourteen
       tracks so the days take two each and the totals half each. */
    .cards-on-phone .hr-week-grid tr {
        display: grid;
        grid-template-columns: repeat(14, minmax(0, 1fr));
        gap: 8px 4px;
        align-items: start;
        padding: 12px 14px;
    }
    .cards-on-phone .hr-week-grid td {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        min-width: 0;
        padding: 0;
        border-bottom: 0;
    }
    .cards-on-phone .hr-week-grid td::before {
        font-size: 10px;
        letter-spacing: 0;
        white-space: nowrap;
    }
    .cards-on-phone .hr-week-grid td.hr-week-we::before { color: var(--caution); }

    .cards-on-phone .hr-week-grid td.hr-week-name {
        grid-column: 1 / -1;
        align-items: flex-start;
        padding: 0;
        font-size: 15px;
        font-weight: 600;
    }
    .cards-on-phone .hr-week-grid td.hr-week-name::before { content: none; }
    .cards-on-phone .hr-week-grid td.hr-week-day { grid-column: span 2; }

    .cards-on-phone .hr-week-att td.hr-week-total {
        grid-column: span 7;
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        padding-top: 8px;
        border-top: 1px solid var(--line);
    }
    .cards-on-phone .hr-week-att td.hr-week-total + td.hr-week-total { padding-left: 10px; }

    .cards-on-phone .hr-week-plan td.hr-week-name {
        grid-column: 1 / span 6;
        align-self: center;
    }
    .cards-on-phone .hr-week-plan td.hr-week-shift {
        grid-column: 7 / -1;
        align-items: stretch;
    }
    .cards-on-phone .hr-week-plan td.hr-week-shift::before { content: none; }

    /* Chips and buttons a finger can hit. */
    .hr-pill.hr-week-chip {
        height: 44px;
        font-size: 14px;
    }
    .hr-week-day-btn {
        width: 100%;
        max-width: 44px;
        height: 44px;
        min-height: 44px;
    }
}

/* ═══ Staff & HR: payroll, Quick Entry, calendar, daily incentives ══════════ */

/* ── Staff & HR: payroll, Quick Entry, Daily Incentives (jsB lane) ───────
   What staff.js draws from loadPayrollForMonth() on: the payroll list and
   its status pills, the UPI pop-up's notes, Quick Entry's list and its month
   calendar (with the list of days a phone gets), and Daily Incentives with a
   daily plan's days. Every colour is a token. The payslip image is not here:
   it is drawn in fixed light values from Staff._PAYSLIP_PALETTE. */

/* ── Rows standing in for a table's content (loading, empty, failed) ───── */
.hr-pay-empty,
.hr-qe-empty,
.hr-di-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 12px;
}
.hr-pay-empty-bad,
.hr-qe-empty-bad,
.hr-di-empty-bad { color: var(--bad); }

/* ── Payroll list ───────────────────────────────────────────────────────── */
.hr-pay-name,
.hr-qe-name {
    font-weight: 500;
    white-space: nowrap;
}
.hr-pay-range,
.hr-qe-range {
    white-space: normal;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-muted);
}
.hr-pay-net { font-weight: 500; }

/* A payroll status pill (an .hr-pill, toned by data-tone) reads capitalised,
   as on the boards; the text itself stays the status word. */
.hr-pay-status { text-transform: capitalize; }

/* ── Pay via UPI: what shows in the QR box while it draws, or if it fails ─ */
.hr-pay-upi-note {
    font-size: 13px;
    color: var(--text-muted);
}
.hr-pay-upi-note.hr-pay-upi-error { color: var(--bad); }

/* ── Quick Entry list ───────────────────────────────────────────────────── */
.hr-qe-daily { font-family: var(--font-text); }
/* A standing note over the calendar: someone who joined after the month
   (neutral), or a frozen month (info). */
.hr-qe-note {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    background: var(--panel-raised);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}
.hr-qe-note[data-tone="info"] {
    background: var(--info-soft);
    border-color: transparent;
    color: var(--accent-2);
}
.hr-qe-frozen { margin-bottom: 12px; }

/* ── Quick Entry's month calendar ───────────────────────────────────────── */
.att-cal-dow-row,
.att-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.att-cal-dow-row { margin-bottom: 6px; }

.att-cal-dow {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 4px 0;
}
.att-cal-dow.weekend { color: var(--caution); }

.att-cal-day {
    min-width: 0;
    min-height: 64px;
    border-radius: var(--r-sm);
    padding: 6px;
    cursor: pointer;
    background: var(--panel);
    border: 1px solid var(--line);
    transition: transform 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.att-cal-day:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

/* Fri, Sat and Sun are ringed, as was asked for, in the caution colour the
   boards give weekends (spec 120). */
.att-cal-day.weekend {
    border-color: var(--caution);
    box-shadow: inset 0 0 0 1px var(--caution);
}

.att-cal-day.empty { visibility: hidden; cursor: default; }

/* The weekday's short name: the heading row says it on the calendar; the
   phone's list of days shows it (below). */
.att-cal-wd { display: none; }

.att-cal-daynum {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}

.att-cal-status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-muted);
}

.att-cal-ot {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
    color: var(--accent-2);
}

/* A day's colours follow its data-status: present good, absent bad,
   half-day caution, any other status neutral. An editable day that is
   present stays plain, as before; a clocked or frozen one reads good. */
.att-cal-day.locked { background: var(--panel-raised); }
.att-cal-day.locked[data-status="present"] { background: var(--good-soft); }
.att-cal-day[data-status="absent"]   { background: var(--bad-soft); }
.att-cal-day[data-status="half-day"] { background: var(--caution-soft); }
.att-cal-day[data-status="present"] .att-cal-status  { color: var(--good); }
.att-cal-day[data-status="absent"] .att-cal-status   { color: var(--bad); }
.att-cal-day[data-status="half-day"] .att-cal-status { color: var(--caution); }

.att-cal-day.locked { cursor: pointer; }
.att-cal-day.locked .att-cal-daynum::after { content: ' 🔒'; font-size: 9px; }

.att-cal-day.editable { cursor: default; }

/* Spec 099: a day before the Start date or after the End date. Grayed, with
   no controls and no click: payroll ignores whatever it holds. */
.att-cal-day.out-of-range {
    background: var(--ground) !important;
    opacity: 0.55;
    pointer-events: none;
    box-shadow: none;
}
.att-cal-day.out-of-range .attsum-status-select,
.att-cal-day.out-of-range .attsum-ot-input,
.att-cal-day.out-of-range .att-cal-status,
.att-cal-day.out-of-range .att-cal-ot { display: none; }
.att-cal-day.out-of-range .att-cal-daynum::after { content: ''; }

.attsum-status-select,
.attsum-ot-input {
    width: 100%;
    margin-top: 4px;
    font-size: 11px;
    padding: 2px 3px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
}
.attsum-ot-input { font-family: var(--font-mono); }
.attsum-ot-input:disabled {
    background: var(--panel-raised);
    color: var(--text-muted);
}

/* The counts above the calendar. */
.att-sum-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.att-sum-stat {
    padding: 8px 14px;
    border-radius: var(--r-sm);
    background: var(--panel-raised);
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.att-sum-stat[data-tone="bad"]  { color: var(--bad); }
.att-sum-stat[data-tone="info"] { color: var(--accent-2); }

/* ── Daily Incentives ───────────────────────────────────────────────────── */
.hr-di-staff { white-space: nowrap; }
.hr-di-name { font-weight: 500; }
.hr-di-row .hr-num .kv-sub { font-family: var(--font-text); }
.hr-di-total-label { text-align: right; font-weight: 600; }
.hr-di-total { font-weight: 700; }

/* A daily plan's days, opened under its row. */
.hr-di-days-cell {
    padding: 4px 0 14px 24px;
    background: var(--panel-raised);
}
.hr-di-days-table {
    width: auto;
    min-width: 560px;
}
.hr-di-th-num { text-align: right; }
.hr-di-d-date { font-family: var(--font-mono); font-size: 13px; }
.hr-di-d-tgt { white-space: nowrap; }
.hr-di-idle td { color: var(--text-muted); }

/* ── Phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {

    /* Quick Entry's calendar becomes a list of days: the heading row and the
       blank lead-in cells go, and each day is one row with its weekday and
       date, then its status, then its OT. A weekend is marked by a bar and
       its weekday's colour; a locked day shows its status and the lock. */
    .att-cal-dow-row { display: none; }
    .att-cal-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        overflow: hidden;
        background: var(--panel);
    }
    .att-cal-day.empty { display: none; }
    .att-cal-day {
        display: grid;
        grid-template-columns: 54px minmax(0, 1fr) 84px;
        grid-template-areas:
            "wd  st ot"
            "num st ot";
        column-gap: 10px;
        align-items: center;
        min-height: 60px;
        padding: 8px 12px;
        border: 0;
        border-bottom: 1px solid var(--line);
        border-radius: 0;
        box-shadow: none;
    }
    .att-cal-day:last-child { border-bottom: 0; }
    .att-cal-day:hover {
        transform: none;
        border-color: var(--line);
    }
    .att-cal-day.weekend {
        border-color: var(--line);
        box-shadow: inset 3px 0 0 var(--caution);
    }

    .att-cal-wd {
        display: block;
        grid-area: wd;
        align-self: end;
        font-family: var(--font-mono);
        font-size: 10.5px;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    .att-cal-day.weekend .att-cal-wd { color: var(--caution); }
    .att-cal-daynum {
        grid-area: num;
        align-self: start;
        font-size: 16px;
        line-height: 1.2;
    }
    .att-cal-status,
    .attsum-status-select { grid-area: st; margin-top: 0; }
    .att-cal-ot,
    .attsum-ot-input { grid-area: ot; margin-top: 0; }
    .att-cal-status { font-size: 13px; }
    .att-cal-ot { font-size: 12px; text-align: right; }

    /* The lock sits by the status in the list, not by the date. */
    .att-cal-day.locked .att-cal-daynum::after { content: ''; }
    .att-cal-day.locked .att-cal-status::after { content: ' 🔒'; font-size: 11px; }

    .attsum-status-select,
    .attsum-ot-input {
        min-height: 44px;
        font-size: 14px;
        padding: 0 10px;
        border-radius: 12px;
    }

    .att-sum-stats { gap: 8px; margin-bottom: 14px; }
    .att-sum-stat { flex: 1 1 auto; padding: 8px 10px; font-size: 12.5px; }

    /* A daily plan's days: each day two short lines, not a card of six.
       Line one: date, day, incentive. Line two, smaller: billed revenue, the
       targets, the slab. The days table's own head is hidden by the card
       rules; its cells lose their headings and borders here. */
    .cards-on-phone tr.hr-di-days {
        padding: 4px 12px;
        background: var(--panel-raised);
    }
    .cards-on-phone tr.hr-di-days > td[data-tc-span] {
        text-align: left !important;
        padding: 0;
        background: none;
    }
    .cards-on-phone .hr-di-days-table {
        width: 100%;
        min-width: 0;
    }
    .cards-on-phone .hr-di-days-table tr {
        margin: 0;
        padding: 8px 0;
        border: 0;
        border-bottom: 1px solid var(--line);
        border-radius: 0;
        box-shadow: none;
        background: none;
    }
    .cards-on-phone .hr-di-days-table tbody tr:last-child { border-bottom: 0; }
    .cards-on-phone .hr-di-days-table tr.hr-di-day {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        grid-template-areas:
            "date type inc"
            "rev  tgt  slab";
        column-gap: 10px;
        row-gap: 2px;
        align-items: baseline;
    }
    .cards-on-phone .hr-di-days-table tr.hr-di-day-total {
        border-top: 1px dashed var(--line-strong);
        border-bottom: 0;
    }
    .cards-on-phone .hr-di-days-table td {
        display: block;
        padding: 0;
        border: 0;
        font-size: 13px;
    }
    .cards-on-phone .hr-di-days-table td::before { content: none; }
    .cards-on-phone .hr-di-days-table .kv-sub { display: inline; margin: 0 0 0 4px; }
    .cards-on-phone .hr-di-days-table .hr-di-d-date { grid-area: date; }
    .cards-on-phone .hr-di-days-table .hr-di-d-type { grid-area: type; }
    .cards-on-phone .hr-di-days-table .hr-di-d-inc  { grid-area: inc; text-align: right !important; }
    .cards-on-phone .hr-di-days-table .hr-di-d-rev,
    .cards-on-phone .hr-di-days-table .hr-di-d-tgt,
    .cards-on-phone .hr-di-days-table .hr-di-d-slab {
        font-size: 12px;
        color: var(--text-muted);
    }
    .cards-on-phone .hr-di-days-table .hr-di-d-rev  { grid-area: rev; }
    .cards-on-phone .hr-di-days-table .hr-di-d-tgt  { grid-area: tgt; }
    .cards-on-phone .hr-di-days-table .hr-di-d-slab { grid-area: slab; text-align: right !important; }
}

/* ═══ Approvals ═════════════════════════════════════════════════════════════ */

/* ── HR Approvals (approvals lane, spec 120) ─────────────────────────────
   frontend/pages/hrapprovals.html and frontend/js/hrapprovals.js. Rewritten
   from setup.css's old .hra-* rules onto the variables, with the look of the
   HrApprovals and PhoneHrApprovals boards. Status and count chips are the
   shared .hr-pill[data-tone]; figures are the shared .hr-num. The four boxes
   are .table-container.cards-on-phone, so at 640px and under each row is a
   card (components.css), re-laid here: the name and status on the first line,
   then two fields to a line, the buttons across the foot. */

/* The date filter (Attendance) and the refresh bar (Advance Requests). */
.card.hra-toolbar { padding: 18px 22px; }
.hra-filter {
    display: flex;
    gap: 12px 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.hra-filter .form-group { margin-bottom: 0; min-width: 180px; }
.hra-filter label {
    margin-bottom: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.card.hra-refresh-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 22px;
}
.hra-refresh-hint { font-size: 14px; color: var(--text-muted); }

.hra-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

/* A section's heading with its count pill beside it. */
.hra-section-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 14px;
    font-family: var(--font-head);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}
.hr-pill.hra-count {
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    letter-spacing: 0;
}

/* The four tables. */
.hra-table { font-size: 13px; }
.hra-table th { white-space: nowrap; }
.hra-table td { padding: 10px 12px; vertical-align: middle; font-size: 13px; }
.hra-table input[type="time"],
.hra-table input[type="number"] {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.hra-approve-amt { width: 100px; }
.hra-shift-sel,
.hra-shift-sel-abs { min-width: 90px; }
.hra-pay-mode { min-width: 80px; }
.hra-date {
    font-family: var(--font-mono);
    font-size: 12.5px;
    white-space: nowrap;
}
.hra-notes { color: var(--text-muted); font-size: 12.5px; }
.hra-badge { text-transform: capitalize; }
.hra-done { color: var(--text-muted); font-size: 12px; }
.hra-empty {
    margin: 0;
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Fields in a row are a little tighter than a form's, on a desktop only:
   at 820px and under components.css makes every input and select 44px. */
@media (min-width: 821px) {
    .hra-table input:not([type="checkbox"]):not([type="radio"]),
    .hra-table select {
        min-height: 36px;
        padding: 6px 8px;
        font-size: 13px;
        border-radius: 10px;
    }
    .hra-table input[type="time"] { min-width: 110px; }
}

/* The row's buttons. Reject, Absent: an outline in the bad colour (the board),
   set in full here so it does not lean on any other sheet's .btn-danger. */
.hra-btn-group {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}
.hra-table .btn-danger {
    background: transparent;
    color: var(--bad);
    border: 1px solid var(--bad);
    border-radius: var(--r-sm);
}
.hra-table .btn-danger:hover:not(:disabled) {
    background: var(--bad-soft);
    color: var(--bad);
    border-color: var(--bad);
}
/* A button waiting on its request (_hraBtnLoading). */
.btn.hra-busy:disabled { opacity: 0.7; }

/* ── Phone: each row a card, two fields to a line ─────────────────────── */
@media (max-width: 640px) {
    .card.hra-toolbar { padding: 14px; }
    .hra-filter { flex-wrap: nowrap; gap: 10px; }
    .hra-filter .form-group { flex: 1 1 auto; min-width: 0; }
    .card.hra-refresh-bar { padding: 14px; }
    .hra-refresh-hint { flex: 1 1 160px; }

    /* The section is a heading over its cards, not a panel round them. */
    .card.hra-section {
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    .hra-section-title { font-size: 18px; margin-bottom: 10px; }
    .cards-on-phone > .hra-empty {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: var(--r-md);
    }

    .cards-on-phone .hra-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
        align-items: start;
        padding: 14px;
    }
    .cards-on-phone .hra-table td {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
        padding: 0;
        border-bottom: 0;
    }
    .cards-on-phone .hra-table td.hr-num { font-weight: 500; }
    /* First line: the name (across, or beside the status). */
    .cards-on-phone .hra-table .hra-name {
        grid-column: 1 / -1;
        order: -2;
        align-self: center;
        font-size: 15px;
    }
    .cards-on-phone .hra-has-status .hra-name { grid-column: 1; }
    .cards-on-phone .hra-table .hra-status {
        order: -1;
        align-self: center;
        align-items: flex-end;
    }
    .cards-on-phone .hra-table .hra-name::before,
    .cards-on-phone .hra-table .hra-status::before { content: none; }
    /* A field alone on its line (the shift, the payment mode) takes it all. */
    .cards-on-phone .hra-table .hra-wide { grid-column: 1 / -1; }
    .cards-on-phone .hra-table input,
    .cards-on-phone .hra-table select { width: 100%; min-width: 0; }
    /* The buttons: across the foot, sharing it equally. */
    .cards-on-phone .hra-table td[data-tc-foot] {
        grid-column: 1 / -1;
        display: block;
        padding-top: 2px;
    }
    .cards-on-phone .hra-table td[data-tc-foot] > .btn { width: 100%; }
    .cards-on-phone .hra-btn-group {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 10px;
        white-space: normal;
    }
    .cards-on-phone .hra-btn-group .btn { width: 100%; }
}

/* ═══ Motion off when asked ═════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .hr-week-chip,
    .hr-week-day-btn,
    .att-cal-day { transition: none; }
    .hr-week-day:hover .hr-week-chip,
    .att-cal-day:hover { transform: none; }
}
