/* ═══════════════════════════════════════════════════════════════════════
   WorkPulse — UI layer  (loads AFTER style.css and dark-mode.css)

   This is the approved mockup design applied to the app's existing class
   names. No view file has to change: .card, .btn-primary, .sidebar, .kpi
   and friends are simply restyled here.

   It also carries a Tailwind-named utility layer, so any NEW markup can be
   written in Tailwind classes without adding a build step.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. TOKENS ─────────────────────────────────────────────────────────── */
:root{
    --wp-page:#F1F4FB;
    --wp-surface:#FFFFFF;
    --wp-surface-2:#F7F9FD;
    --wp-line:#DEE5F3;
    --wp-line-soft:#E9EEF8;

    --wp-ink:#0C1730;
    --wp-ink-2:#37456A;
    --wp-muted:#63719A;
    --wp-faint:#8B97BA;

    --wp-accent:#1554C0;          /* readable AS text */
    --wp-fill:#1554C0;            /* white text sits on it */
    --wp-grad:linear-gradient(120deg,#0A2A6E 0%,#1554C0 48%,#1FA0E4 100%);

    --wp-shadow:0 1px 2px rgba(10,42,110,.05), 0 8px 24px -12px rgba(10,42,110,.16);
    --wp-shadow-lift:0 18px 40px -22px rgba(10,42,110,.6);

    --wp-r-lg:18px;
    --wp-r:14px;
    --wp-r-sm:11px;
    --wp-r-xs:9px;

    --wp-num:'JetBrains Mono',ui-monospace,Consolas,monospace;
    --wp-num-track:-.02em;
}

html[data-theme="dark"]{
    /* Lifted off pure black and desaturated: the old dark surfaces carried
       roughly 3x the colour cast of the light ones, which reads as murky. */
    --wp-page:#0B0F17;
    --wp-surface:#151B26;
    --wp-surface-2:#1E2532;
    --wp-line:#2B3442;
    --wp-line-soft:#222A37;

    --wp-ink:#EAEEF6;
    --wp-ink-2:#B7C1D2;
    --wp-muted:#8B97AB;
    --wp-faint:#78849A;

    /* #1554C0 as text on a dark page is 2.5:1 and unreadable; the fill has to
       stay dark enough for white text, so the two split apart here. */
    --wp-accent:#6AA6F7;
    --wp-fill:#2A6BD4;
    --wp-grad:linear-gradient(120deg,#1D4494 0%,#2668C9 46%,#3FC1F5 100%);

    --wp-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 10px 26px -16px rgba(0,0,0,.9);
    --wp-shadow-lift:inset 0 0 0 1px rgba(255,255,255,.10), 0 16px 38px -22px rgba(0,0,0,1);
}

/* Feed the new tokens back into the old variable names so anything still
   referencing them stays consistent. */
:root, html[data-theme="dark"]{
    --bg-primary:var(--wp-page);
    --bg-card:var(--wp-surface);
    --bg-card-hover:var(--wp-surface-2);
    --border-color:var(--wp-line);
    --border-light:var(--wp-line-soft);
    --text-primary:var(--wp-ink);
    --text-secondary:var(--wp-ink-2);
    --text-muted:var(--wp-muted);
    --accent-orange:var(--wp-fill);
    --accent-ink:var(--wp-accent);
    --shadow-card:var(--wp-shadow);
    --shadow-sm:var(--wp-shadow);
    --shadow-md:var(--wp-shadow);
    --shadow-lg:var(--wp-shadow-lift);
}

body{ background:var(--wp-page); color:var(--wp-ink); }

/* Every number in the app lines up in columns. */
.stat-value,.kpi .k-num,.data-table td,.mono,[class*="mono"],
.sal-card-salary,.emc-amount,.etb-val,.pt-kpi-val{
    font-variant-numeric:tabular-nums;
    letter-spacing:var(--wp-num-track);
}

/* ── 2. SHELL: sidebar ─────────────────────────────────────────────────
   Was a solid navy slab with an orange active block. Now a quiet panel so
   the content is the loudest thing on screen, not the furniture. */
.sidebar{
    background:var(--wp-surface);
    border-right:1px solid var(--wp-line);
}
.sidebar-brand{
    border-bottom:1px solid var(--wp-line-soft);
    padding:16px 16px 14px;
}
.brand-icon{
    background:var(--wp-grad);
    border-radius:11px;
    box-shadow:0 4px 12px -4px rgba(21,84,192,.6);
}
.brand-name{ color:var(--wp-ink); font-weight:800; letter-spacing:-.02em; }
.sidebar-nav{ padding:10px 9px; gap:2px; }
.nav-item{
    color:var(--wp-muted);
    border-radius:var(--wp-r-xs);
    font-size:.86rem;
    font-weight:600;
    padding:.6rem .7rem;
}
.nav-item svg{ opacity:1; width:17px; height:17px; }
.nav-item:hover{ background:var(--wp-surface-2); color:var(--wp-ink); }
.nav-item.active{
    background:rgba(21,84,192,.10);
    color:var(--wp-accent);
    font-weight:700;
}
html[data-theme="dark"] .nav-item.active{ background:rgba(106,166,247,.14); }
.nav-section{
    font-size:9px; font-weight:800; letter-spacing:.11em; text-transform:uppercase;
    color:var(--wp-faint); padding:14px 8px 5px;
}
.sidebar-footer{ border-top:1px solid var(--wp-line-soft); padding:9px; }
.user-card{ border-radius:12px; }
.user-card:hover{ background:var(--wp-surface-2); }
.user-avatar{ background:var(--wp-grad); border-radius:50%; }
.user-name{ color:var(--wp-ink); font-weight:700; }
.user-role{ color:var(--wp-muted); }

/* ── 3. SHELL: top bar ─────────────────────────────────────────────────── */
.top-bar{
    background:var(--wp-page);
    border-bottom:1px solid var(--wp-line-soft);
    height:60px;
}
.page-title{ font-weight:800; letter-spacing:-.025em; font-size:1.05rem; }
.topbar-icon-btn,.notification-bell{
    border-radius:11px;
    border:1px solid var(--wp-line);
    background:var(--wp-surface);
    color:var(--wp-ink-2);
}
.notification-bell:hover,.topbar-icon-btn:hover{ border-color:var(--wp-accent); }
.notif-badge{ background:var(--wp-fill); border:2px solid var(--wp-surface); font-family:var(--wp-num); }
/* Profile control (phones only) — the circle plus who you are signed in as.
   The role used to be printed separately down in the Admin dashboard's summary
   bar, which put it a long way from the account it describes. */
.topbar-avatar{
    width:auto; height:36px; border-radius:999px;
    background:var(--wp-surface); border:1px solid var(--wp-line);
    padding:0 10px 0 3px; gap:7px; max-width:44vw; overflow:hidden;
}
.topbar-avatar:hover{ border-color:var(--wp-accent); }
.tba-face{
    width:30px; height:30px; border-radius:50%; flex-shrink:0; overflow:hidden;
    background:var(--wp-grad); color:#fff;
    display:flex; align-items:center; justify-content:center;
    font-size:0.8rem; font-weight:700; line-height:1;
}
.tba-face img{ width:100%; height:100%; object-fit:cover; }
.tba-who{
    display:flex; flex-direction:column; justify-content:center;
    min-width:0; line-height:1.15; text-align:left;
}
.tba-name{
    font-size:0.76rem; font-weight:700; color:var(--wp-ink);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.tba-role{
    font-size:0.62rem; font-weight:600; color:var(--wp-muted);
    letter-spacing:0.3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
/* Very narrow phones: the name would squeeze the page title out entirely. */
@media (max-width:360px){
    .topbar-avatar{ width:32px; height:32px; padding:0; border:none; background:none; }
    .tba-who{ display:none; }
}

/* ── 3b. MONTH BAR ─────────────────────────────────────────────────────
   ‹  August 2026  ›  — one control for changing the month, used on every
   screen that has one. Rendered by views/shared/month_bar.php.

   Its CSS deliberately does NOT live here. This file is cached by the
   service worker and served cache-first, so phones carrying an older copy
   never received these rules and drew the month picker as a second,
   full-width field next to the label. The rules are inline in
   views/shared/header.php instead, where nothing can cache them. */

/* ── 4. CARDS ──────────────────────────────────────────────────────────── */
.card,.stat-card,.login-card,.modal,.notification-panel,.more-sheet{
    background:var(--wp-surface);
    border:1px solid var(--wp-line);
    border-radius:var(--wp-r-lg);
    box-shadow:var(--wp-shadow);
}
.card-header{
    padding:13px 17px;
    border-bottom:1px solid var(--wp-line-soft);
}
.card-header h3{
    font-size:.82rem; font-weight:700; letter-spacing:-.01em; color:var(--wp-ink);
}
.card-body{ padding:16px 17px; }

/* stat cards */
.stat-card{ padding:15px 16px; position:relative; overflow:hidden; }
.stat-label{
    font-size:9.5px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
    color:var(--wp-faint);
}
.stat-value{
    font-family:var(--wp-num); font-weight:800; letter-spacing:-.045em; line-height:1;
    color:var(--wp-ink); margin-top:6px;
}
.stat-sub{ font-size:11px; color:var(--wp-muted); margin-top:5px; }
.stat-icon{ border-radius:11px; }

/* ── 5. BUTTONS ────────────────────────────────────────────────────────── */
.btn{
    border-radius:var(--wp-r-sm);
    font-weight:700;
    letter-spacing:.005em;
    transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}
.btn-primary{
    background:var(--wp-grad);
    color:#fff;
    box-shadow:0 6px 16px -8px rgba(21,84,192,.9);
}
.btn-primary:hover{ transform:translateY(-1px); box-shadow:0 10px 22px -8px rgba(21,84,192,1); }
.btn-secondary{ background:var(--wp-fill); color:#fff; }
.btn-outline{
    background:var(--wp-surface);
    border:1px solid var(--wp-line);
    color:var(--wp-ink-2);
}
.btn-outline:hover{ border-color:var(--wp-accent); color:var(--wp-accent); background:var(--wp-surface); }
.btn-link{ color:var(--wp-accent); font-weight:700; }
.checkin-btn{ background:var(--wp-grad); border-radius:var(--wp-r); }

/* ── 6. FORMS ──────────────────────────────────────────────────────────── */
/* Tick boxes and radio buttons are excluded from all of this.
   A bare `input` selector also catches them, and `padding:.62rem .8rem` on a
   radio inflates it into a large empty box — which is what pushed the radio
   onto its own line and squeezed the text beside it into a narrow column on
   the settings page. They keep the browser's own appearance, tinted with
   accent-color below. */
input:not([type="checkbox"]):not([type="radio"]),select,textarea{
    border-radius:var(--wp-r-sm);
    border:1px solid var(--wp-line);
    background:var(--wp-surface-2);
    color:var(--wp-ink);
    padding:.62rem .8rem;
}
input::placeholder,textarea::placeholder{ color:var(--wp-faint); }
input:not([type="checkbox"]):not([type="radio"]):focus,select:focus,textarea:focus{
    border-color:#1E90D8;
    background:var(--wp-surface);
    box-shadow:0 0 0 3px rgba(47,179,236,.2);
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
    background:var(--wp-surface-2) !important;
    border-color:var(--wp-line) !important;
}

/* Tick boxes and radios: brand-tinted, and big enough to hit on a phone. */
input[type="checkbox"],input[type="radio"]{
    width:16px; height:16px; flex-shrink:0;
    accent-color:var(--wp-fill); cursor:pointer;
}
input[type="checkbox"]:focus-visible,input[type="radio"]:focus-visible{
    outline:2px solid var(--wp-accent); outline-offset:2px;
}
.form-group label{
    font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
    color:var(--wp-faint); margin-bottom:7px; display:block;
}

/* ── 7. BADGES & PILLS ─────────────────────────────────────────────────── */
.badge,.sp{
    border-radius:99px;
    font-size:9.5px;
    font-weight:800;
    letter-spacing:.05em;
    text-transform:uppercase;
    padding:3px 9px;
}
.badge-green,.sp-g{ background:var(--green-bg); color:var(--green); }
.badge-red,.sp-r{ background:var(--red-bg); color:var(--red); }
.badge-orange,.sp-o{ background:var(--orange-bg); color:var(--orange); }
.badge-blue,.sp-b{ background:rgba(21,84,192,.12); color:var(--wp-accent); }
.badge-gray,.sp-gray{ background:var(--wp-surface-2); color:var(--wp-muted); }

/* ── 8. TABLES ─────────────────────────────────────────────────────────── */
.data-table th,.att-table-admin th{
    font-size:9.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase;
    color:var(--wp-faint);
    border-bottom:1px solid var(--wp-line);
    padding:10px 13px;
}
.data-table td,.att-table-admin td{
    border-bottom:1px solid var(--wp-line-soft);
    padding:10px 13px;
    font-size:12.5px;
    color:var(--wp-ink-2);
}
.data-table tbody tr:hover,.att-table-admin tbody tr:hover{ background:var(--wp-surface-2); }
.table-wrapper{ border-radius:var(--wp-r); }

/* ── 9. KPI CARDS (HR / Admin dashboards) ──────────────────────────────── */
.kpi{
    background:var(--wp-surface);
    border:1px solid var(--wp-line);
    border-radius:var(--wp-r);
    box-shadow:var(--wp-shadow);
    padding:14px 15px;
}
.kpi:hover{ transform:translateY(-1px); border-color:#1E90D8; }
.kpi .k-lbl{ font-size:10px; font-weight:800; letter-spacing:.09em; }
.kpi .k-num{ font-family:var(--wp-num); font-weight:800; letter-spacing:-.045em; }
.kpi .k-sub{ font-size:11px; color:var(--wp-muted); }
.kpi .k-stripe{ width:3px; opacity:1; border-radius:0; }
.kpi-drawer{
    background:var(--wp-surface); border:1px solid var(--wp-line);
    border-radius:var(--wp-r); box-shadow:var(--wp-shadow);
}
.kpi-bar-mini{
    background:var(--wp-surface); border:1px solid var(--wp-line);
    border-radius:var(--wp-r); box-shadow:var(--wp-shadow);
}

/* ── 10. BOTTOM NAV (phones) ───────────────────────────────────────────── */
@media (max-width:768px){
    .bottom-nav{
        background:var(--wp-surface);
        border-top:1px solid var(--wp-line);
        box-shadow:0 -2px 14px rgba(10,42,110,.07);
        height:62px;
    }
    .bn-item{ color:var(--wp-faint); font-weight:700; position:relative; }
    .bn-item.active{ color:var(--wp-accent); }
    /* the active tab is marked on the top edge, not underlined: at 10px the
       labels are too small for an underline to read */
    .bn-item.active::before{
        content:""; position:absolute; top:-1px; left:50%; transform:translateX(-50%);
        width:26px; height:3px; border-radius:0 0 99px 99px; background:var(--wp-grad);
    }
}

/* ── 11. MODALS & SHEETS ───────────────────────────────────────────────── */
.modal-overlay{ background:rgba(4,8,18,.62); }
.modal-header{ padding:14px 17px; border-bottom:1px solid var(--wp-line-soft); }
.modal-header h3{ font-size:.9rem; font-weight:800; letter-spacing:-.01em; }
.modal-footer{ border-top:1px solid var(--wp-line-soft); padding:13px 17px; }
.more-sheet{ border-radius:var(--wp-r-lg) var(--wp-r-lg) 0 0; }
.ms-link{ border-radius:var(--wp-r-xs); font-weight:600; }
.ms-link:hover{ background:var(--wp-surface-2); }
.ms-group-title{
    font-size:9px; font-weight:800; letter-spacing:.11em; text-transform:uppercase;
    color:var(--wp-faint);
}

/* ── 12. MISC ──────────────────────────────────────────────────────────── */
.empty-state{ color:var(--wp-muted); font-size:12.5px; }
.toast{ border-radius:var(--wp-r); box-shadow:var(--wp-shadow-lift); }
.loading-spinner{ border-top-color:var(--wp-accent); }
.notif-item.unread{ background:rgba(21,84,192,.07); }
.progress-ring-text{ font-family:var(--wp-num); font-weight:800; }

/* ── 13. UTILITIES ────────────────────────────────────────────────────────
   Utilities now come from Tailwind (public/css/tailwind.css), which loads
   after this file. The hand-written layer that used to live here has been
   removed so there is exactly one source of truth. */

/* ── 14. PAGE-LEVEL OVERRIDES ─────────────────────────────────────────────
   These selectors live in per-page <style> blocks that load after this file,
   so matching their specificity is the only way to reach them. */

/* HR / Admin: live activity + timeline */
.live-feed .lf-row,.live-feed > div{ border-color:var(--wp-line-soft); }
.tl-row{ border-radius:var(--wp-r-xs); }
.audit-row{ border-bottom:1px solid var(--wp-line-soft); }

/* Section headings across dashboards */
.dlbl,.adm-an-head,.emd-section-ttl,.sal-section-lbl,.earn-hdr-title{
    font-weight:800; letter-spacing:-.01em; color:var(--wp-ink);
}
.earn-hdr-max-val,.pt-footer-val{ color:var(--wp-accent); font-family:var(--wp-num); }

/* Employee: calendar cells pick up the design's rounding */
.cal-day,.mc-day,.calendar-day,.pt-day{ border-radius:9px; }
.cal-day.today,.calendar-day.today{ outline-color:#1E90D8; }

/* Employee: work-log inputs match the shared field treatment */
.wl-input,.wl-notes-in{ border-radius:var(--wp-r-sm); background:var(--wp-surface-2); }
.wl-input:focus,.wl-notes-in:focus{
    border-color:#1E90D8; background:var(--wp-surface);
    box-shadow:0 0 0 3px rgba(47,179,236,.2);
}
.wl-chip{ border-radius:10px; font-weight:600; }
.wl-chip.active{ border-color:var(--wp-fill); background:rgba(21,84,192,.10); color:var(--wp-accent); }
.wl-add-btn{ border-radius:var(--wp-r-sm); }

/* Employee: progress tracks */
.sal-prog-track,.emc-prog,.lv-bar-wrap,.pts-bar,.uc-bar,.wlu-bar{
    border-radius:99px; overflow:hidden;
}
.sal-prog-fill,.emc-prog-fill{ border-radius:99px; }

/* Stat tiles inside the salary card */
.sal-stat{ background:var(--wp-surface-2); border:1px solid var(--wp-line-soft); border-radius:11px; }
.sal-stat-val{ font-family:var(--wp-num); font-variant-numeric:tabular-nums; letter-spacing:-.03em; }

/* Buttons that were defined per page */
.mn-btn,.emd-nav-btn,.cal-nav-btn{ border-radius:50%; border:1px solid var(--wp-line); background:var(--wp-surface); }
.mn-btn:hover,.emd-nav-btn:hover{ border-color:#1E90D8; color:var(--wp-accent); }
.emd-tab.active{ background:var(--wp-fill); }
.lv-mode-btn.active,.we-mode-btn.active{ background:var(--wp-fill); color:#fff; }

/* Kiosk / QR display keeps the deep navy ground */
.qr-frame-box{ border-radius:18px; }


/* ── 15. "MORE" SHEET ─────────────────────────────────────────────────
   Built to match the employee actions sheet: full-width rows separated by
   hairlines, icon then label. The old version had loose 12px rows with no
   dividers, so the list read as floating text; and the floating Announce
   button sat on top of Profile and Log out. */
.more-sheet{ border-radius:22px 22px 0 0; border:1px solid var(--wp-line); border-bottom:none; }
.more-sheet-grab{ background:var(--wp-line); }
.more-sheet-head{
    padding:4px 16px 11px; font-size:1rem; font-weight:800; letter-spacing:-.02em;
    border-bottom:1px solid var(--wp-line-soft);
}
.more-sheet-close{ background:var(--wp-surface-2); border:1px solid var(--wp-line); color:var(--wp-muted); }

.more-sheet-body{
    padding:0 0 env(safe-area-inset-bottom);   /* the FAB is hidden while this is open */
    max-height:min(70vh, 600px); overflow-y:auto;
}

/* Five headings cost ~30px each — 150px of a phone sheet spent on five words
   for a nine-item menu. The grouping is worth keeping, the labels are not:
   each heading becomes a thin tinted rule that still separates the groups. */
.more-sheet-body .ms-group-title{
    height:0; padding:0; margin:7px 0 0; font-size:0; line-height:0;
    background:none; border:none; border-top:1px solid var(--wp-line);
}
.more-sheet-body .ms-group-title:first-child{ display:none; }
/* the row above a divider already drew a hairline — do not stack two */
.more-sheet-body .ms-link:has(+ .ms-group-title){ border-bottom:none; }

.ms-link{
    display:flex; align-items:center; gap:13px; width:100%;
    padding:12px 16px; border:none; border-bottom:1px solid var(--wp-line-soft);
    background:none; text-align:left; color:var(--wp-ink);
    font-size:.88rem; font-weight:600;
    transition:background-color .15s ease;
}
.ms-link svg{ width:19px; height:19px; flex-shrink:0; opacity:1; color:var(--wp-muted); }
.ms-link:last-child{ border-bottom:none; }
.ms-link:active,.ms-link:hover{ background:var(--wp-surface-2); }
.ms-link:hover svg{ color:var(--wp-accent); }

/* Log out ends the session — it is not one of the choices above it. */
.ms-link-danger{ color:var(--red); font-weight:700; border-bottom:none;
    border-top:1px solid var(--wp-line); margin-top:7px; }
.ms-link-danger svg{ color:var(--red); }
.ms-link-danger:active,.ms-link-danger:hover{ background:var(--neg-bg); }

/* The Announce button floats above everything, this sheet included. */
body:has(.more-sheet.open) .announce-fab{ opacity:0; pointer-events:none; }
