/* ==========================================================================
   IronFit HR — additions on top of the shared console design system.

   public/css/redesign.css is a byte-for-byte copy of ironfit-crm's file and
   owns the shell, buttons, forms, tables, pills and cards. Keep it identical
   to the CRM's so the two apps cannot drift; everything HR needs that the
   CRM does not have lives here, under the same `.rd-body` scope and `rd-`
   prefix, using only the tokens redesign.css defines.
   ========================================================================== */

/* --- browser surfaces --------------------------------------------------- */
.rd-body ::selection { background: rgba(0,185,220,.24); color: var(--rd-ink); }
.rd-body input, .rd-body textarea { caret-color: var(--rd-accent-ink); }
.rd-body { scrollbar-color: var(--rd-line-2) transparent; }
.rd-body :where(p) { margin: 0; }

/* --- command-bar utilities (the CRM keeps these inline in its layout) ---- */
.rd-userchip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 3px 10px 3px 4px; border-radius: 999px;
    border: 1px solid var(--rd-line-2); background: var(--rd-surface); color: var(--rd-text);
    transition: border-color .14s, background .14s;
}
.rd-userchip:hover { border-color: var(--rd-faint); background: var(--rd-surface-2); }
.rd-userchip .rd-avatar {
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, var(--rd-accent), var(--rd-accent-deep));
    color: #fff; font-weight: 700; font-size: 12px;
}
.rd-userchip-id { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.rd-userchip-name { font-size: 12px; font-weight: 600; color: var(--rd-ink); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-userchip-role { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rd-faint); }
.rd-util-divider { width: 1px; height: 22px; background: var(--rd-line); margin: 0 2px; flex-shrink: 0; }
/* no page actions in front of it -> nothing for the divider to divide */
.rd-cmdbar-util:first-child .rd-util-divider { display: none; }

/* --- buttons: states and sizes the CRM set does not define -------------- */
.rd-btn:disabled, .rd-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.rd-btn.is-dark { background: var(--rd-ink); border-color: var(--rd-ink); color: #fff; }
.rd-btn.is-dark:hover { background: #1d2a3a; border-color: #1d2a3a; }
.rd-btn.is-lg { height: 40px; padding: 0 20px; font-size: 13px; }
.rd-btn.is-block { width: 100%; justify-content: center; }

/* text link inside content (table names, empty states, hints) */
.rd-body a.rd-link { color: var(--rd-accent-ink); font-weight: 600; text-underline-offset: 3px; }
.rd-body a.rd-link:hover { text-decoration: underline; }

/* inline row actions in a table's last cell */
.rd-rowacts { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.rd-rowacts form { display: inline-flex; margin: 0; }

/* --- pills: a fourth, informational tone -------------------------------- */
.rd-pill.is-info { background: var(--rd-accent-soft); color: var(--rd-accent-ink); }
.rd-dot.is-info { background: var(--rd-accent); }

/* --- segmented control built from links (report switcher) --------------- */
.rd-seg a {
    display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 4px;
    font-size: 11.5px; font-weight: 600; color: var(--rd-muted);
    transition: background .14s, color .14s, box-shadow .14s;
}
.rd-seg a:hover { color: var(--rd-ink); }
.rd-seg a.is-on { background: var(--rd-surface); color: var(--rd-ink); box-shadow: 0 1px 2px rgba(15,23,34,.12); }

/* --- toolbar: labelled inline controls ---------------------------------- */
.rd-toolbar { flex-wrap: wrap; }
.rd-toolbar .rd-input, .rd-toolbar .rd-select { width: auto; }
.rd-toolbar .rd-input[type="number"] { width: 92px; }
.rd-toolbar-field { display: inline-flex; align-items: center; gap: 8px; }
.rd-toolbar-field > label { font-size: 11.5px; font-weight: 600; color: var(--rd-muted); white-space: nowrap; }

/* --- forms -------------------------------------------------------------- */
.rd-input.is-invalid, .rd-select.is-invalid { border-color: var(--rd-bad); }
.rd-input.is-invalid:focus, .rd-select.is-invalid:focus { box-shadow: 0 0 0 3px rgba(217,45,32,.14); }
.rd-field-err { font-size: 11px; color: var(--rd-bad-ink); margin-top: 4px; line-height: 1.45; }
.rd-input::placeholder { color: var(--rd-faint); }
.rd-input:disabled { background: var(--rd-canvas); color: var(--rd-faint); cursor: not-allowed; }
.rd-fields.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rd-field[hidden] { display: none; }
/* on a centred form page the banners line up with the form column */
.rd-main.is-narrow > .rd-flash, .rd-main.is-narrow > form > .rd-flash { width: min(100%, var(--rd-form-w)); margin-inline: auto; }
.rd-flash ul { margin: 6px 0 0; padding-left: 18px; }
.rd-flash ul:first-child { margin-top: 0; }
.rd-section + .rd-section, .rd-stack > * + * { margin-top: 14px; }
.rd-form-col > .rd-section + .rd-section { margin-top: 0; } /* the column already gaps */
.rd-section.is-warn { border-color: #ecd3a6; }
.rd-section.is-warn .rd-section-head { background: var(--rd-warn-soft); }
.rd-section.is-warn .rd-section-head h3 { color: var(--rd-warn-ink); }
.rd-lede { margin: 0 2px 14px; font-size: 12.5px; color: var(--rd-muted); max-width: 72ch; }

/* weekday / option chips: a checkbox that reads as a toggle button */
.rd-daychips { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-daychip { position: relative; cursor: pointer; }
.rd-daychip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.rd-daychip span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 46px; height: 32px; padding: 0 10px; border-radius: var(--rd-r-ctl);
    border: 1px solid var(--rd-line-2); background: var(--rd-surface);
    font-size: 12px; font-weight: 600; color: var(--rd-muted);
    transition: background .14s, border-color .14s, color .14s;
}
.rd-daychip:hover span { border-color: var(--rd-faint); }
.rd-daychip input:checked + span { background: var(--rd-accent-soft); border-color: var(--rd-accent); color: var(--rd-accent-ink); }
.rd-daychip input:focus-visible + span { outline: 2px solid var(--rd-accent-ink); outline-offset: 2px; }

.rd-switch { position: relative; }
.rd-switches { display: flex; flex-direction: column; gap: 14px; }

/* main + rail pages where the rail is the thing you came to use (leave form) */
@media (max-width: 1080px) {
    .rd-formgrid.is-rail-first > .rd-rail { order: -1; }
}

/* --- stat strip that takes any number of tiles -------------------------- */
/* redesign.css draws the dividers with per-child borders tuned for exactly
   four tiles in a grid. This variant is a wrapping flex row whose 1px gaps
   show the wrapper's line colour: tiles always grow to fill their row, so
   five tiles, or a short last row on a phone, need no nth-child bookkeeping. */
.rd-stats.is-flow { display: flex; flex-wrap: wrap; gap: 1px; background: var(--rd-line); margin-top: 0; }
.rd-stats.is-flow .rd-stat { flex: 1 1 var(--rd-stat-min, 150px); border: 0; }
.rd-stat-v.is-ok { color: var(--rd-ok-ink); }
.rd-stat-v.is-warn { color: var(--rd-warn-ink); }
.rd-stat-v.is-bad { color: var(--rd-bad-ink); }

/* Scroll containers must be the containing block for what is inside them:
   a visually-hidden (absolutely positioned) header label sitting in the
   scrolled-out part of a wide table otherwise widens the whole page. */
.rd-tablewrap, .rd-scrollx { position: relative; }
/* 1fr tracks refuse to shrink below their content; a wide table would push
   the single-column phone layout sideways instead of scrolling in its wrapper. */
.rd-formgrid > *, .rd-grid2 > * { min-width: 0; }

/* card-in-a-column spacing + flush tables inside cards */
.rd-card > .rd-scrollx > .rd-table thead th:first-child,
.rd-card > .rd-scrollx > .rd-table tbody td:first-child,
.rd-card > .rd-scrollx > .rd-table tfoot td:first-child { padding-left: 14px; }
.rd-card > .rd-scrollx > .rd-table thead th:last-child,
.rd-card > .rd-scrollx > .rd-table tbody td:last-child,
.rd-card > .rd-scrollx > .rd-table tfoot td:last-child { padding-right: 14px; }
.rd-card.is-clip { overflow: hidden; }
.rd-card-head .rd-card-sub { font-size: 11.5px; color: var(--rd-muted); font-weight: 500; }
.rd-table tfoot td { border-top: 1px solid var(--rd-line-2); background: var(--rd-surface-2); font-weight: 600; color: var(--rd-ink); font-size: 12.5px; }
.rd-table td.rd-neg, .rd-neg { color: var(--rd-bad-ink); }
.rd-table td.rd-strong { font-weight: 600; color: var(--rd-ink); }
.rd-nowrap { white-space: nowrap; }
.rd-table.is-dense thead th, .rd-table.is-dense tbody td, .rd-table.is-dense tfoot td { padding-left: 10px; padding-right: 10px; }

/* key/value rows (payroll status, quick links) */
.rd-kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rd-line); font-size: 12.5px; color: var(--rd-muted); }
.rd-kv:first-child { padding-top: 0; }
.rd-kv:last-child { border-bottom: 0; padding-bottom: 0; }
.rd-kv b { color: var(--rd-ink); font-weight: 600; font-family: var(--rd-mono); font-variant-numeric: tabular-nums; }

/* stacked detail list: label over value, two-up */
.rd-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.rd-facts > div.is-full { grid-column: 1 / -1; }
.rd-facts dt { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--rd-faint); }
.rd-facts dd { margin: 3px 0 0; font-size: 12.5px; color: var(--rd-text); overflow-wrap: anywhere; }

/* a row that is a link (quick actions) */
.rd-navrow { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--rd-line); color: var(--rd-text); font-size: 12.5px; font-weight: 600; transition: background .14s; }
.rd-navrow:last-child { border-bottom: 0; }
.rd-navrow:hover { background: #f7fcfe; color: var(--rd-ink); }
.rd-navrow svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.7; fill: none; flex-shrink: 0; color: var(--rd-faint); }
.rd-navrow .rd-navrow-go { margin-left: auto; }

/* ==========================================================================
   The signature: today's shift
   A clock, the working day drawn as a track, and the one action that matters.
   ========================================================================== */
.rd-shift {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px 30px;
    padding: 18px 20px;
    background: var(--rd-surface); border: 1px solid var(--rd-line); border-radius: var(--rd-r-card);
}
.rd-shift-now {
    font-family: var(--rd-mono); font-variant-numeric: tabular-nums;
    font-size: 36px; font-weight: 600; letter-spacing: -.03em; line-height: 1; color: var(--rd-ink);
    white-space: nowrap;
}
.rd-shift-now small { font-size: 17px; font-weight: 500; color: var(--rd-faint); letter-spacing: -.01em; }
.rd-shift-date { margin-top: 7px; font-size: 12px; color: var(--rd-muted); white-space: nowrap; }
.rd-shift-state { font-size: 13px; color: var(--rd-text); }
.rd-shift-state b { color: var(--rd-ink); font-weight: 600; }
.rd-shift-state .rd-pill { margin-left: 6px; vertical-align: 1px; }
.rd-shift-state.is-bad { color: var(--rd-bad-ink); }

.rd-day { margin-top: 12px; }
.rd-day-track { position: relative; height: 8px; border-radius: 99px; background: var(--rd-line); }
.rd-day-fill { position: absolute; top: 0; bottom: 0; min-width: 8px; border-radius: 99px; background: var(--rd-accent); }
.rd-day-fill.is-done { background: var(--rd-ok); }
.rd-day-now { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 2px; background: var(--rd-ink); }
.rd-day-scale { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--rd-mono); font-size: 10.5px; color: var(--rd-faint); }
.rd-shift-act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rd-shift-act form { margin: 0; }
.rd-shift-done { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--rd-ok-ink); white-space: nowrap; }
.rd-shift-done svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; }

@media (max-width: 860px) {
    .rd-shift { grid-template-columns: minmax(0, 1fr) auto; }
    .rd-shift-main { grid-column: 1 / -1; grid-row: 2; }
    .rd-shift-now { font-size: 30px; }
}
@media (max-width: 480px) {
    .rd-shift { grid-template-columns: minmax(0, 1fr); }
    .rd-shift-main { grid-row: auto; }
    .rd-shift-act { align-items: stretch; }
    .rd-shift-act .rd-btn { width: 100%; justify-content: center; height: 44px; }
}

/* ==========================================================================
   Attendance calendar
   ========================================================================== */
.rd-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.rd-cal-dow { padding: 2px 0 4px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--rd-muted); }
.rd-cal-day {
    position: relative; min-height: 80px; padding: 7px 8px; display: flex; flex-direction: column; gap: 2px;
    border: 1px solid var(--rd-line); border-radius: var(--rd-r-ctl); background: var(--rd-surface);
}
.rd-cal-n { font-family: var(--rd-mono); font-size: 12px; font-weight: 600; color: var(--rd-ink); }
.rd-cal-s { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--rd-muted); }
.rd-cal-t { font-family: var(--rd-mono); font-size: 10.5px; color: var(--rd-muted); line-height: 1.4; }
.rd-cal-day.is-rest { background: var(--rd-surface-2); }
.rd-cal-day.is-rest .rd-cal-n { color: var(--rd-faint); }
.rd-cal-day.is-today { border-color: var(--rd-accent-ink); box-shadow: inset 0 0 0 1px var(--rd-accent-ink); }
.rd-cal-day.is-present  { background: var(--rd-ok-soft); border-color: #cfead9; }
.rd-cal-day.is-present .rd-cal-s { color: var(--rd-ok-ink); }
.rd-cal-day.is-late, .rd-cal-day.is-half_day { background: var(--rd-warn-soft); border-color: #f1dfbf; }
.rd-cal-day.is-late .rd-cal-s, .rd-cal-day.is-half_day .rd-cal-s { color: var(--rd-warn-ink); }
.rd-cal-day.is-absent   { background: var(--rd-bad-soft); border-color: #f5cfcc; }
.rd-cal-day.is-absent .rd-cal-s { color: var(--rd-bad-ink); }
.rd-cal-day.is-on_leave { background: var(--rd-accent-soft); border-color: #cdeef6; }
.rd-cal-day.is-on_leave .rd-cal-s { color: var(--rd-accent-ink); }
.rd-cal-day.is-holiday  { background: var(--rd-canvas); }
.rd-cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 11.5px; color: var(--rd-muted); }
.rd-cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rd-cal-legend i { width: 11px; height: 11px; border-radius: 3px; border: 1px solid var(--rd-line-2); flex-shrink: 0; }
.rd-cal-legend i.is-present  { background: var(--rd-ok-soft); border-color: #cfead9; }
.rd-cal-legend i.is-late     { background: var(--rd-warn-soft); border-color: #f1dfbf; }
.rd-cal-legend i.is-absent   { background: var(--rd-bad-soft); border-color: #f5cfcc; }
.rd-cal-legend i.is-on_leave { background: var(--rd-accent-soft); border-color: #cdeef6; }
.rd-cal-legend i.is-holiday  { background: var(--rd-canvas); }
@media (max-width: 640px) {
    .rd-cal { gap: 3px; }
    .rd-cal-day { min-height: 46px; padding: 5px 4px; align-items: center; }
    /* seven columns on a phone leave ~45px a cell: the tint and the legend carry
       the status, the detail stays available to assistive tech */
    .rd-cal-s, .rd-cal-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ==========================================================================
   Payslip
   ========================================================================== */
.rd-slip-net {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 16px; border-top: 1px solid var(--rd-line);
    background: var(--rd-head-tint); border-radius: 0 0 var(--rd-r-card) var(--rd-r-card);
}
.rd-slip-net span { font-size: 13px; font-weight: 600; color: var(--rd-ink); }
.rd-slip-net b { font-family: var(--rd-mono); font-size: 22px; font-weight: 700; color: var(--rd-accent-ink); font-variant-numeric: tabular-nums; }
.rd-totals-row.is-sum { color: var(--rd-ink); font-weight: 600; border-bottom: 0; }
.rd-totals-row.is-sum .v { color: var(--rd-ink); font-weight: 600; }
.rd-totals-row .v.rd-neg { color: var(--rd-bad-ink); }

/* ==========================================================================
   Sign-in pages
   ========================================================================== */
.rd-auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.rd-auth-aside {
    background: var(--rd-side); color: var(--rd-side-text);
    padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
    border-right: 1px solid #000;
}
.rd-auth-aside .rd-brand { padding: 0; font-size: 14px; }
.rd-auth-aside h2 { color: #fff; font-size: 34px; line-height: 1.16; letter-spacing: -.02em; max-width: 19ch; text-wrap: balance; }
.rd-auth-aside p { margin-top: 14px; max-width: 44ch; font-size: 13.5px; line-height: 1.65; color: var(--rd-side-text); }
/* the working day, drawn the same way the dashboard draws it */
.rd-auth-day { margin-top: 30px; max-width: 380px; }
.rd-auth-day .rd-day-track { background: rgba(255,255,255,.1); }
.rd-auth-day .rd-day-scale { color: rgba(255,255,255,.45); }
.rd-auth-foot { font-size: 11px; color: rgba(255,255,255,.4); }
.rd-auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.rd-auth-card { width: 100%; max-width: 380px; }
.rd-auth-card h1 { font-size: 22px; letter-spacing: -.01em; }
.rd-auth-card .rd-auth-sub { margin: 6px 0 22px; font-size: 13px; color: var(--rd-muted); }
.rd-auth-card .rd-field + .rd-field { margin-top: 14px; }
.rd-auth-card .rd-input { height: 40px; font-size: 14px; }
.rd-auth-card .rd-flash { margin-bottom: 16px; }
.rd-auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.rd-auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.rd-auth-actions form { margin: 0; }
.rd-auth-brand-sm { display: none; }
@media (max-width: 860px) {
    .rd-auth { grid-template-columns: minmax(0, 1fr); }
    .rd-auth-aside { display: none; }
    .rd-auth-main { align-items: flex-start; padding: 32px 20px; }
    .rd-auth-brand-sm { display: flex; align-items: center; gap: 9px; margin-bottom: 28px; font-weight: 700; font-size: 13px; letter-spacing: .04em; color: var(--rd-ink); }
    .rd-auth-card .rd-input { height: 44px; }
    .rd-auth-card .rd-btn.is-lg { height: 44px; }
}

/* --- small screens ------------------------------------------------------ */
@media (max-width: 860px) {
    /* a long ticker gives the title block a wide flex-basis and the wrapping
       command bar drops it under the burger; a zero basis keeps them on one row */
    .rd-cmdbar-title { flex-basis: 0; }
    .rd-toolbar .rd-input, .rd-toolbar .rd-select { flex: 1 1 auto; min-width: 0; }
    .rd-toolbar-field { flex: 1 1 100%; }
    .rd-toolbar-spacer { display: none; }
    .rd-btn { min-height: 36px; }
    .rd-btn.is-sm { min-height: 32px; }
    .rd-card > .rd-scrollx, .rd-section-body > .rd-scrollx { overflow-x: auto; }
    .rd-fields.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .rd-fields.is-3 { grid-template-columns: minmax(0, 1fr); }
    .rd-facts { grid-template-columns: minmax(0, 1fr); }
    .rd-hero-top { flex-direction: column; }
    .rd-hero-actions { flex-wrap: wrap; }
}
