/*
 * WAFID UI 2.0 — central design system for the administrative panel (screen only).
 * Printing templates (cards, receipts, reports) have their own CSS and are not affected.
 * No build step: this file is served as is and linked from WafidPanelProvider.
 * See docs/UI_DESIGN_SYSTEM.md.
 */

/* IBM Plex Sans Arabic 1.1.0, SIL OFL 1.1 — public/fonts/wafid/OFL-LICENSE.txt */
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 400; font-display: swap; src: url('../../fonts/wafid/IBMPlexSansArabic-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 500; font-display: swap; src: url('../../fonts/wafid/IBMPlexSansArabic-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 600; font-display: swap; src: url('../../fonts/wafid/IBMPlexSansArabic-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 700 800; font-display: swap; src: url('../../fonts/wafid/IBMPlexSansArabic-Bold.woff2') format('woff2'); }

/* ───────────── 1. Design tokens ───────────── */
:root:root {
    --font-family: 'IBM Plex Sans Arabic';

    --w-nav: #102d49;
    --w-blue: #164b82;
    --w-blue-hover: #1d5c9c;
    --w-green: #16865f;
    --w-green-2: #24966d;
    --w-accent: #5ad0a3;
    --w-bg: #f3f7fa;
    --w-card: #ffffff;
    --w-card-soft: #f6f9fb;
    --w-ink: #173047;
    --w-muted: #5b6f80;
    --w-line: #dfe8ee;
    --w-field-line: #cbd9e3;
    --w-warn: #b77920;
    --w-warn-ink: #8c5d14;
    --w-danger: #a63d2f;
    --w-tint-blue: #e9f2fa;
    --w-tint-green: #e6f5ef;
    --w-tint-warn: #fff2dc;
    --w-tint-danger: #fdeeea;
    --w-link: #164b82;
    --w-shadow: 0 8px 28px rgb(22 59 90 / .05);

    --w-radius-sm: 10px;
    --w-radius: 12px;
    --w-radius-lg: 14px;
    --w-sidebar: 252px;
    --w-sidebar-min: 76px;
    --w-topbar: 68px;
    --w-field: 44px;
    --w-touch: 44px;
}

:root:root.dark {
    --w-nav: #0c2238;
    --w-bg: #0f1b29;
    --w-card: #172636;
    --w-card-soft: #1c2e41;
    --w-ink: #e6eef5;
    --w-muted: #9db2c4;
    --w-line: #29405a;
    --w-field-line: #36506c;
    --w-warn: #e3ac55;
    --w-warn-ink: #f0c47c;
    --w-danger: #f09a8c;
    --w-tint-blue: #1d3a58;
    --w-tint-green: #163c34;
    --w-tint-warn: #3d3019;
    --w-tint-danger: #42251f;
    --w-link: #8cc2f2;
    --w-shadow: 0 8px 28px rgb(0 0 0 / .22);
}

/* ───────────── 2. Base ───────────── */
body.fi-body,
body.fi-body.dark,
.dark body.fi-body { background: var(--w-bg); color: var(--w-ink); font-size: 14.5px; line-height: 1.65; }

.fi-header-heading { color: var(--w-ink); font-size: 27px; line-height: 1.4; letter-spacing: 0; font-weight: 700; }
.fi-header-subheading { color: var(--w-muted); font-size: 13.5px; }
.fi-section-header-heading, .fi-modal-heading { color: var(--w-ink); font-size: 18px; }

/* Cards and containers */
.fi-section:not(.fi-section-not-contained),
.fi-ta-ctn,
.fi-wi-stats-overview-stat {
    background: var(--w-card);
    border: 1px solid var(--w-line);
    border-radius: var(--w-radius-lg);
    box-shadow: var(--w-shadow);
    --tw-ring-shadow: 0 0 #0000;
}

/* Buttons */
.fi-btn { min-height: 40px; border-radius: var(--w-radius-sm); font-weight: 600; }
.fi-btn.fi-size-lg, .fi-simple-page .fi-btn[type='submit'] { min-height: var(--w-field); }
.fi-btn.fi-color-primary:not(.fi-outlined) { background: var(--w-blue); color: #fff; }
.fi-btn.fi-color-primary:not(.fi-outlined):hover { background: var(--w-blue-hover); }
.fi-btn.fi-color-primary:not(.fi-outlined) .fi-icon { color: #fff; }
.fi-btn.fi-color-success:not(.fi-outlined) { background: var(--w-green); color: #fff; }
.dark .fi-btn.fi-color-primary:not(.fi-outlined) { background: #2a6cb0; }
.fi-btn:focus-visible, .fi-icon-btn:focus-visible, .fi-sidebar-item-btn:focus-visible, .wf-link:focus-visible { outline: 3px solid #52b99a; outline-offset: 2px; }

/* Fields */
.fi-input-wrp { border-radius: var(--w-radius-sm); background: var(--w-card); min-height: var(--w-field); box-shadow: none; --tw-ring-shadow: 0 0 #0000; border: 1px solid var(--w-field-line); align-items: center; }
.fi-input-wrp:focus-within { border-color: var(--w-blue); box-shadow: 0 0 0 3px rgb(22 75 130 / .14); }
.fi-input-wrp.fi-invalid { border-color: var(--w-danger); }
.fi-fo-field-label-content { color: var(--w-ink); font-weight: 600; font-size: 13.5px; }

/* Dropdowns, modals, notifications */
.fi-dropdown-panel { border-radius: var(--w-radius); border: 1px solid var(--w-line); background: var(--w-card); }
.fi-modal-window { background: var(--w-card); border-radius: 16px; border: 1px solid var(--w-line); }
.fi-modal-slide-over .fi-modal-window { border-radius: 0; }
.fi-no-notification { border-radius: var(--w-radius); }

/* Badges keep their text so a state never depends on colour only */
.fi-badge { border-radius: 20px; font-weight: 600; }

/* ───────────── 3. Sidebar ───────────── */
.fi-sidebar.fi-main-sidebar { background: var(--w-nav); color: #e8f2fa; }
.fi-main-sidebar .fi-sidebar-header { background: var(--w-nav); box-shadow: none; --tw-ring-shadow: 0 0 #0000; border-bottom: 1px solid rgb(255 255 255 / .09); height: auto; min-height: 84px; padding: 14px 16px; }
.fi-main-sidebar .fi-sidebar-nav { padding: 14px 12px 24px; gap: 6px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .18) transparent; }
.fi-main-sidebar .fi-sidebar-nav-groups { gap: 12px; }
.fi-main-sidebar .fi-sidebar-group-label { color: #8fb0c9; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.fi-main-sidebar .fi-sidebar-group-btn { padding-block: 4px; min-height: 30px; }
.fi-main-sidebar .fi-sidebar-group-collapse-btn, .fi-main-sidebar .fi-sidebar-group-collapse-btn .fi-icon { color: #8fb0c9; }
.fi-main-sidebar .fi-sidebar-item-btn { min-height: 42px; border-radius: 9px; padding: 8px 12px; gap: 11px; background: transparent; border-inline-start: 3px solid transparent; }
.fi-main-sidebar .fi-sidebar-item-label { color: #c4d6e5; font-size: 13.5px; font-weight: 400; }
.fi-main-sidebar .fi-sidebar-item-btn > .fi-icon { color: #9fbdd4; width: 20px; height: 20px; }
.fi-main-sidebar .fi-sidebar-item-btn:hover { background: rgb(255 255 255 / .07); }
.fi-main-sidebar .fi-sidebar-item-btn:hover .fi-sidebar-item-label { color: #fff; }
.fi-main-sidebar .fi-sidebar-item.fi-active > .fi-sidebar-item-btn { background: rgb(255 255 255 / .12); border-inline-start-color: var(--w-accent); }
.fi-main-sidebar .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label { color: #fff; font-weight: 700; }
.fi-main-sidebar .fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon { color: var(--w-accent); }
/* The dropdown shown for a collapsed group keeps readable colours */
.fi-main-sidebar .fi-dropdown-panel .fi-dropdown-list-item-label { color: var(--w-ink); }

/* Brand (sidebar header, mobile drawer and sign-in pages) */
.fi-logo:has(> .wf-brand) { height: auto !important; }
.wf-brand { display: flex; align-items: center; gap: 11px; text-align: start; line-height: 1.25; }
.wf-brand img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; flex: none; }
.wf-brand-text { display: grid; }
.wf-brand-name { font-size: 21px; font-weight: 700; color: var(--w-ink); }
.wf-brand-name small { font-size: 11px; font-weight: 600; color: var(--w-green-2); margin-inline-start: 5px; letter-spacing: .6px; }
.wf-brand-sub { font-size: 11.5px; font-weight: 400; color: var(--w-muted); }
.fi-main-sidebar .wf-brand-name { color: #fff; }
.fi-main-sidebar .wf-brand-name small { color: var(--w-accent); }
.fi-main-sidebar .wf-brand-sub { color: #9db7cc; }
.fi-topbar-start .wf-brand-sub { display: none; }
.fi-topbar-start .wf-brand img { width: 36px; height: 36px; }

/* ───────────── 4. Top bar ───────────── */
.fi-topbar-ctn { z-index: 28; }
.fi-topbar { min-height: var(--w-topbar); background: var(--w-card); box-shadow: none; --tw-ring-shadow: 0 0 #0000; border-bottom: 1px solid var(--w-line); gap: 10px; }
.wf-context { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.35; }
.wf-context-crumb { font-size: 11.5px; color: var(--w-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-context-title { font-size: 15px; font-weight: 700; color: var(--w-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-iconbtn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 1px solid var(--w-line); border-radius: var(--w-radius-sm); background: var(--w-card); color: var(--w-ink); cursor: pointer; }
.wf-iconbtn:hover { background: var(--w-card-soft); }
.wf-iconbtn:focus-visible { outline: 3px solid #52b99a; outline-offset: 2px; }
.wf-iconbtn svg { width: 20px; height: 20px; }
.wf-iconbtn .wf-when-dark, .dark .wf-iconbtn .wf-when-light { display: none; }
.dark .wf-iconbtn .wf-when-dark { display: block; }
.wf-userbadge { display: grid; line-height: 1.35; border-inline-start: 1px solid var(--w-line); padding-inline-start: 12px; max-width: 260px; }
.wf-userbadge b { font-size: 13px; color: var(--w-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-userbadge span { font-size: 11.5px; color: var(--w-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-topbar .fi-user-menu-trigger .fi-avatar { width: 40px; height: 40px; border-radius: 12px; }

/* ───────────── 5. Desktop layout: full-height sidebar beside the top bar ───────────── */
@media (min-width: 1024px) {
    .fi-main-sidebar { --sidebar-width: var(--w-sidebar); }
    .fi-main-sidebar.fi-sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; height: 100dvh; width: var(--w-sidebar) !important; z-index: 30; translate: none !important; transform: none !important; }
    .fi-main-sidebar.fi-sidebar:not(.fi-sidebar-open) { width: var(--w-sidebar-min) !important; }
    .fi-main-sidebar .fi-sidebar-header-ctn { display: block; }
    .fi-main-sidebar .fi-sidebar-header { display: flex !important; }
    .fi-main-sidebar:not(.fi-sidebar-open) .fi-sidebar-header { padding-inline: 8px; justify-content: center; }
    .fi-main-sidebar:not(.fi-sidebar-open) .fi-sidebar-header-logo-ctn { display: block !important; }
    .fi-main-sidebar:not(.fi-sidebar-open) .wf-brand-text { display: none; }
    .fi-main-sidebar:not(.fi-sidebar-open) .fi-sidebar-item-btn { justify-content: center; padding-inline: 8px; }
    .fi-main-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav { padding-inline: 8px; }

    body.fi-body-has-navigation .fi-topbar-ctn,
    body.fi-body-has-navigation .fi-main-ctn { margin-inline-start: var(--w-sidebar); }
    /* The class follows the sidebar store (topbar-context view). Deliberately no :has() here: it was seen left
       stale after the sidebar opened, which slid the page under the sidebar. */
    body.fi-body-has-navigation.wf-sidebar-collapsed .fi-topbar-ctn,
    body.fi-body-has-navigation.wf-sidebar-collapsed .fi-main-ctn { margin-inline-start: var(--w-sidebar-min); }
    /* Keep the collapse button; the brand now lives in the sidebar. */
    .fi-topbar-start > a, .fi-topbar-start .fi-logo { display: none !important; }
    .fi-topbar-start { order: -1; margin: 0; }
    .fi-topbar .wf-context { order: 0; }
    .fi-topbar { padding-inline: 20px; }
    .fi-main { max-width: 1500px; padding-inline: 30px; }
}

@media (max-width: 1279px) { .wf-userbadge { display: none; } }

/* ───────────── 6. Sign-in, MFA and other simple pages ───────────── */
.fi-simple-layout { background: var(--w-bg); }
.fi-simple-main { background: var(--w-card); border: 1px solid var(--w-line); border-radius: 18px; box-shadow: 0 22px 60px rgb(16 45 73 / .10); --tw-ring-shadow: 0 0 #0000; }
.fi-simple-header .fi-logo { margin-bottom: 14px; }
.fi-simple-header .wf-brand { flex-direction: column; text-align: center; gap: 8px; }
.fi-simple-header .wf-brand img { width: 74px; height: 74px; border-radius: 18px; border: 1px solid var(--w-line); padding: 6px; }
.fi-simple-header-heading { color: var(--w-ink); font-size: 23px; }
.fi-simple-header-subheading { color: var(--w-muted); }
.fi-simple-page .fi-input-wrp { min-height: 46px; }
.fi-simple-page .fi-btn[type='submit'] { min-height: 48px; font-size: 15px; }
/* One-time code boxes read left to right in every language */
.fi-one-time-code-input-ctn { direction: ltr; justify-content: center; }

.wf-auth-aside { display: none; }

@media (min-width: 1024px) {
    .fi-simple-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); min-height: 100dvh; align-items: stretch; }
    .wf-auth-aside {
        grid-column: 1; grid-row: 1 / -1; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
        padding: 56px clamp(40px, 5vw, 84px); color: #fff; background: linear-gradient(125deg, #102d49 0%, #164b82 66%, #16865f 100%);
    }
    .wf-auth-aside::after { content: ''; position: absolute; width: 430px; height: 430px; inset-inline-end: -170px; top: -140px; border: 1px solid rgb(255 255 255 / .16); border-radius: 50%; box-shadow: 0 0 0 46px rgb(255 255 255 / .035), 0 0 0 96px rgb(255 255 255 / .03); pointer-events: none; }
    .fi-simple-layout > .fi-simple-main-ctn { grid-column: 2; grid-row: 1; padding: 32px; align-self: center; width: 100%; }
    .fi-simple-layout > .fi-simple-layout-header { grid-column: 2; }
    .fi-simple-layout .fi-simple-main { margin-block: 0; }
    .fi-simple-header .wf-brand { display: none; }
    .fi-simple-header .fi-logo { display: none; }
}
.wf-auth-aside img { width: 118px; height: 118px; object-fit: contain; background: #fff; border-radius: 26px; padding: 10px; box-shadow: 0 24px 48px rgb(0 20 45 / .35); margin-bottom: 30px; }
.wf-auth-tag { align-self: flex-start; font-size: 12.5px; border: 1px solid rgb(255 255 255 / .3); background: rgb(255 255 255 / .1); border-radius: 30px; padding: 4px 14px; }
.wf-auth-aside h2 { font-size: clamp(34px, 3.4vw, 46px); font-weight: 700; line-height: 1.3; margin: 16px 0 8px; }
.wf-auth-aside h2 small { font-size: 15px; letter-spacing: 2px; color: #bfeeda; margin: 0 12px; display: inline-block; }
.wf-auth-aside p { max-width: 520px; color: #dcecf3; font-size: 15.5px; }
.wf-auth-note { position: absolute; bottom: 28px; inset-inline-start: clamp(40px, 5vw, 84px); font-size: 12px; color: #cfe3ee; }

/* ───────────── 7. Dashboard ───────────── */
.wf-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 26px 30px; border-radius: 17px; color: #fff; background: linear-gradient(115deg, #123c66, #155780 64%, #137d72); }
.wf-hero::after { content: ''; position: absolute; width: 300px; height: 300px; inset-inline-end: -90px; top: -150px; border: 1px solid rgb(255 255 255 / .18); border-radius: 50%; box-shadow: 0 0 0 36px rgb(255 255 255 / .035), 0 0 0 76px rgb(255 255 255 / .03); pointer-events: none; }
.wf-hero > * { position: relative; z-index: 1; min-width: 0; }
.wf-hero h2 { font-size: 24px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.wf-hero p { color: #daebf1; margin-top: 4px; }
.wf-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wf-hero-chips span { border: 1px solid rgb(255 255 255 / .28); background: rgb(255 255 255 / .12); border-radius: 30px; padding: 3px 13px; font-size: 12.5px; }
.wf-hero img { width: 88px; height: 88px; object-fit: contain; background: #fff; border-radius: 20px; padding: 8px; flex: none; }

.fi-wi-stats-overview-stat { padding: 18px; }
.fi-wi-stats-overview-stat-label { color: var(--w-muted); font-size: 13px; }
.fi-wi-stats-overview-stat-value { color: var(--w-ink); font-size: 29px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fi-wi-stats-overview-stat-label-ctn > .fi-icon { box-sizing: content-box; width: 22px; height: 22px; padding: 9px; border-radius: var(--w-radius-sm); background: var(--w-tint-blue); color: var(--w-link); }

.wf-panel { height: 100%; background: var(--w-card); border: 1px solid var(--w-line); border-radius: var(--w-radius-lg); box-shadow: var(--w-shadow); padding: 20px; min-width: 0; }
.wf-panel-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.wf-panel-head h3 { font-size: 18px; font-weight: 700; color: var(--w-ink); }
.wf-panel-head small { color: var(--w-muted); font-size: 12px; }

.wf-list { display: grid; gap: 10px; }
.wf-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 9px 12px; border: 1px solid var(--w-line); border-radius: var(--w-radius); color: var(--w-ink); }
a.wf-row:hover { border-color: #8eb9ce; background: var(--w-card-soft); }
.wf-row-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: var(--w-radius-sm); background: var(--w-tint-blue); color: var(--w-link); }
.wf-row-icon svg { width: 21px; height: 21px; }
.wf-row-icon.is-green { background: var(--w-tint-green); color: var(--w-green-2); }
.wf-row-icon.is-warn { background: var(--w-tint-warn); color: var(--w-warn-ink); }
.wf-row-icon.is-danger { background: var(--w-tint-danger); color: var(--w-danger); }
.wf-row-text { flex: 1; min-width: 0; display: grid; line-height: 1.5; }
.wf-row-text b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.wf-row-text small { font-size: 12px; color: var(--w-muted); overflow-wrap: anywhere; }
.wf-count { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wf-count.is-zero { color: var(--w-muted); font-weight: 500; }

.wf-bars { display: grid; gap: 13px; }
.wf-bar { display: grid; grid-template-columns: minmax(96px, 132px) minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 13px; }
.wf-bar-track { height: 10px; border-radius: 10px; background: var(--w-card-soft); border: 1px solid var(--w-line); overflow: hidden; }
.wf-bar-track i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, #206697, #43a98d); }
.wf-bar b { text-align: end; font-variant-numeric: tabular-nums; }

.wf-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.wf-quick a { display: grid; justify-items: start; gap: 9px; padding: 14px; border: 1px solid var(--w-line); border-radius: var(--w-radius); font-size: 13.5px; font-weight: 600; color: var(--w-ink); min-width: 0; }
.wf-quick a:hover { border-color: var(--w-green-2); background: var(--w-card-soft); }

.wf-empty { text-align: center; color: var(--w-muted); padding: 26px 12px; font-size: 13.5px; }
.wf-empty svg { width: 34px; height: 34px; margin: 0 auto 8px; opacity: .6; }

/* Single short forms sit in one narrow card */
.wf-formcard { display: grid; gap: 22px; width: 100%; max-width: 560px; height: auto; margin-inline: auto; padding: 24px; }
.wf-formcard > .fi-btn { min-height: var(--w-field); width: 100%; }

/* ───────────── 8. Tables and lists (UI-03) ───────────── */
.fi-ta-ctn { overflow: clip; }
.fi-ta-header-toolbar { gap: 10px; padding-block: 12px; }
.fi-ta-header-toolbar > :empty, .fi-ta-header-toolbar .fi-ta-actions:empty { display: none; }
.fi-ta-search-field { min-width: min(100%, 300px); }

/* Outlined row buttons stay readable on the dark surface */
.dark .fi-ta-actions .fi-btn.fi-outlined, .dark .fi-ta-filters-trigger-action-ctn .fi-btn { color: var(--w-link); }
.dark .fi-ta-actions .fi-btn.fi-outlined .fi-icon { color: var(--w-link); }

/* Collapsible filter panel above the table */
.fi-ta-filters-above-content-ctn { background: var(--w-card-soft); border-bottom: 1px solid var(--w-line); }
.fi-ta-filters-heading { font-size: 15px; color: var(--w-ink); }

/* Our own simple tables (sessions, shifts, activity, department) */
.wf-table-wrap { overflow-x: auto; border: 1px solid var(--w-line); border-radius: var(--w-radius); }
.wf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.fi-ta-table thead th, .fi-ta-header-cell, .wf-table th { background: var(--w-card-soft); color: var(--w-muted); font-size: 12px; font-weight: 600; text-align: start; }
.wf-table th { padding: 12px 14px; white-space: nowrap; }
.wf-table td { padding: 10px 14px; height: 58px; border-top: 1px solid var(--w-line); text-align: start; overflow-wrap: break-word; }
.wf-table thead + tbody tr:first-child td { border-top-color: var(--w-line); }
.wf-table tbody tr:hover td { background: var(--w-card-soft); }
.wf-table .wf-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf-table .wf-cell-empty { text-align: center; color: var(--w-muted); height: 96px; }

.wf-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.wf-filters label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--w-ink); min-width: 160px; }
.wf-filters input, .wf-filters select { min-height: var(--w-field); padding: 8px 12px; border: 1px solid var(--w-field-line); border-radius: var(--w-radius-sm); background: var(--w-card); color: var(--w-ink); font: inherit; font-weight: 400; }
.wf-filters input:focus-visible, .wf-filters select:focus-visible { outline: 3px solid #52b99a; outline-offset: 1px; }
.wf-note { font-size: 13px; color: var(--w-muted); }

@media (min-width: 640px) {
    .fi-ta-table tbody .fi-ta-row { height: 58px; }
    /* Compact cells so wide tables fit, rows stay 56-60px */
    .fi-ta-table .fi-ta-text:not(.fi-inline), .fi-ta-table .fi-ta-header-cell { padding-inline: 7px; }
    .fi-ta-table .fi-ta-text, .fi-ta-table .fi-ta-text .fi-size-sm, .fi-ta-table .fi-ta-text-item { font-size: 13px; }
    .fi-ta-table .fi-badge { font-size: 12px; }
    .fi-ta-table .fi-ta-cell:first-child .fi-ta-text, .fi-ta-table .fi-ta-header-cell:first-of-type { padding-inline-start: 16px; }
    .fi-ta-table .fi-ta-text:not(.fi-inline) { padding-block: 14px; }
    .fi-ta-table tbody td:has(> .fi-ta-actions) { padding: 0 4px; }
    .fi-ta-table .fi-ta-actions { padding: 10px 4px; gap: 10px; flex-wrap: nowrap; }
    .fi-ta-table .fi-ta-actions .fi-btn { min-height: 36px; white-space: nowrap; }
    /* The actions of a row stay in sight when a wide table has to scroll */
    .fi-ta-table tbody td:last-child:has(> .fi-ta-actions) { position: sticky; inset-inline-end: 0; z-index: 1; background: var(--w-card); box-shadow: 0 0 10px rgb(23 48 71 / .07); }
    /* Wrapped names keep a readable width */
    .fi-ta-table .fi-ta-text.fi-wrapped { min-width: 9rem; }
}

/* Long pages (25 or 50 rows) scroll inside the table with the column titles staying on top */
@media (min-width: 1024px) {
    .fi-ta-content-ctn { max-height: max(440px, calc(100dvh - 250px)); overflow: auto; }
    .fi-ta-table thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--w-line); }
}

/* Phones: one card per record, two fields per line */
@media (max-width: 639px) {
    .fi-ta-search-field { min-width: 0; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody { display: grid; gap: 10px; padding: 10px; background: var(--w-bg); }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody tr.fi-ta-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; background: var(--w-card); border: 1px solid var(--w-line); border-radius: var(--w-radius); box-shadow: 0 2px 7px rgb(23 48 71 / .04); }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody tr.fi-ta-row > td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody tr.fi-ta-row > td:first-child { grid-column: 1 / -1; color: var(--w-link); font-weight: 700; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody tr.fi-ta-row > td:first-child .fi-ta-text-item { color: var(--w-link); font-weight: 700; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-cell-label { font-size: 11.5px; font-weight: 400; color: var(--w-muted); margin-bottom: 2px; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-cell-content .fi-ta-col, .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-cell-content .fi-ta-text { padding: 0; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile tbody tr.fi-ta-row > td:has(> .fi-ta-actions) { grid-column: 1 / -1; border-top: 1px solid var(--w-line); padding-top: 10px; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-actions { display: flex; flex-wrap: wrap; justify-content: stretch; gap: 8px; padding: 0; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-actions > * { flex: 1 1 120px; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-actions .fi-btn, .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-actions .fi-link { width: 100%; min-height: var(--w-touch); justify-content: center; }
    .fi-ta-table.fi-ta-table-stacked-on-mobile .fi-ta-actions .fi-dropdown-trigger { display: flex; width: 100%; }

    .wf-filters > label { flex: 1 1 100%; }
    .wf-table-wrap { border: 0; overflow: visible; }
    .wf-table, .wf-table tbody { display: block; }
    .wf-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .wf-table tbody { display: grid; gap: 10px; }
    .wf-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; background: var(--w-card); border: 1px solid var(--w-line); border-radius: var(--w-radius); }
    .wf-table td { display: block; height: auto; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
    .wf-table td::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 400; color: var(--w-muted); }
    .wf-table td:first-child { grid-column: 1 / -1; font-weight: 700; color: var(--w-link); }
    .wf-table td.wf-cell-action, .wf-table td.wf-cell-wide, .wf-table td.wf-cell-empty { grid-column: 1 / -1; }
    .wf-table td.wf-cell-action { border-top: 1px solid var(--w-line); padding-top: 10px; }
    .wf-table td.wf-cell-action::before, .wf-table td.wf-cell-empty::before { display: none; }
    .wf-table td.wf-cell-action .fi-btn { width: 100%; min-height: var(--w-touch); }
    .wf-table td.wf-cell-empty { padding: 18px 0; height: auto; }
    .wf-table tbody tr:hover td { background: transparent; }
}

/* ───────────── 9. Electronic file (UI-04) ───────────── */
.wf-file { background: var(--w-card); border: 1px solid var(--w-line); border-radius: var(--w-radius-lg); box-shadow: var(--w-shadow); padding: 20px; display: grid; gap: 16px; min-width: 0; }
.wf-file > * { min-width: 0; }
.wf-file-top { display: flex; gap: 18px; align-items: flex-start; }
.wf-file-id { flex: 1; min-width: 0; display: grid; gap: 8px; }
.wf-file-id h2 { font-size: 23px; font-weight: 700; line-height: 1.45; color: var(--w-ink); overflow-wrap: anywhere; }
.wf-file-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wf-file-number { font-size: 13px; color: var(--w-muted); }
.wf-file-number b { color: var(--w-link); font-size: 15px; margin-inline-start: 4px; }
.wf-file-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0; }
.wf-file-facts > div { background: var(--w-card-soft); border: 1px solid var(--w-line); border-radius: var(--w-radius-sm); padding: 6px 12px; min-width: 0; }
.wf-file-facts dt { font-size: 11.5px; color: var(--w-muted); }
.wf-file-facts dd { margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }

.wf-photo { width: 104px; height: 124px; flex: none; border: 1px solid var(--w-line); border-radius: var(--w-radius); background: var(--w-tint-blue); overflow: hidden; display: grid; }
.wf-photo img { width: 100%; height: 100%; object-fit: cover; }
.wf-photo-btn, .wf-photo-none { display: grid; place-content: center; justify-items: center; gap: 6px; width: 100%; height: 100%; padding: 6px; text-align: center; font-size: 12px; color: var(--w-link); }
.wf-photo-btn { cursor: pointer; font-weight: 600; }
.wf-photo-btn:focus-visible { outline: 3px solid #52b99a; outline-offset: -3px; }
.wf-photo-none { color: var(--w-muted); }
.wf-photo svg { width: 30px; height: 30px; }

/* Horizontal stepper: stages come from the file's procedure version */
.wf-steps { display: flex; gap: 4px; overflow-x: auto; padding: 14px 0 4px; margin: 0; list-style: none; border-top: 1px solid var(--w-line); scrollbar-width: thin; }
.wf-steps li { flex: 1 1 0; min-width: 104px; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center; position: relative; }
.wf-steps li:not(:last-child)::after { content: ''; position: absolute; top: 15px; inset-inline-start: calc(50% + 20px); width: calc(100% - 36px); height: 2px; background: var(--w-line); }
.wf-steps li.is-done:not(:last-child)::after { background: #9ed3bd; }
.wf-steps i, .wf-vsteps i { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--w-line); background: var(--w-card-soft); color: var(--w-muted); font-style: normal; font-size: 13px; font-weight: 700; }
.wf-steps span { font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.wf-steps small { font-size: 11px; color: var(--w-muted); line-height: 1.45; }
.wf-steps li.is-done i, .wf-vsteps li.is-done i { background: var(--w-tint-green); color: var(--w-green-2); border-color: #9ed3bd; }
.wf-steps li.is-current i, .wf-vsteps li.is-current i { background: var(--w-blue); color: #fff; border-color: var(--w-blue); }
.wf-steps li.is-current span { font-weight: 700; color: var(--w-link); }
.wf-steps li.is-current small { color: var(--w-link); font-weight: 600; }
.wf-steps li.is-fix i, .wf-vsteps li.is-fix i { background: var(--w-tint-warn); color: var(--w-warn-ink); border-color: var(--w-warn); }
.wf-steps li.is-skipped i, .wf-vsteps li.is-skipped i { border-style: dashed; }

.wf-next { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--w-radius); background: var(--w-tint-warn); border: 1px solid color-mix(in srgb, var(--w-warn) 35%, transparent); }
.wf-next.is-complete { background: var(--w-tint-green); border-color: color-mix(in srgb, var(--w-green-2) 35%, transparent); }
.wf-next .wf-row-text { min-width: 180px; }
.wf-next .fi-btn { min-height: var(--w-field); }

.wf-block-title { font-size: 16px; font-weight: 700; color: var(--w-ink); margin-bottom: 14px; }
.wf-vsteps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; }
.wf-vsteps li { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 20px; }
.wf-vsteps li:not(:last-child)::before { content: ''; position: absolute; inset-inline-start: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--w-line); }
.wf-vsteps li > div { display: grid; gap: 1px; min-width: 0; padding-top: 3px; }
.wf-vsteps b { font-size: 14px; overflow-wrap: anywhere; }
.wf-vsteps small { font-size: 12px; color: var(--w-muted); }
.wf-vsteps .wf-vsteps-now { color: var(--w-link); font-weight: 600; margin-top: 3px; }

.wf-timeline { list-style: none; margin: 0 0 10px; padding: 0; }
.wf-timeline li { position: relative; padding-block: 0 16px; padding-inline-start: 26px; display: grid; gap: 1px; }
.wf-timeline li::before { content: ''; position: absolute; inset-inline-start: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--w-green-2); border: 3px solid var(--w-tint-green); box-sizing: content-box; margin-inline-start: -3px; }
.wf-timeline li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 5px; top: 22px; bottom: 2px; width: 2px; background: var(--w-line); }
.wf-timeline b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.wf-timeline small { font-size: 12px; color: var(--w-muted); }

/* The page's many actions stay neutral so the required one stands out; warnings and danger keep their colour */
.fi-resource-applicant-files.fi-resource-view-record-page .fi-header .fi-ac .fi-btn:not(.fi-color-danger, .fi-color-warning) { background: var(--w-card); color: var(--w-ink); border: 1px solid var(--w-field-line); box-shadow: none; --tw-ring-shadow: 0 0 #0000; min-height: 38px; font-size: 13px; }
.fi-resource-applicant-files.fi-resource-view-record-page .fi-header .fi-ac .fi-btn:not(.fi-color-danger, .fi-color-warning) .fi-icon { color: var(--w-link); }
.fi-resource-applicant-files.fi-resource-view-record-page .fi-header .fi-ac .fi-btn:not(.fi-color-danger, .fi-color-warning):hover { background: var(--w-card-soft); border-color: var(--w-link); }

/* Tabs scroll sideways; records inside a tab read as separate cards */
.fi-resource-view-record-page .fi-tabs { overflow-x: auto; scrollbar-width: thin; flex-wrap: nowrap; justify-content: flex-start; }
.fi-resource-view-record-page .fi-tabs-item { flex: none; min-height: var(--w-touch); }
.fi-resource-view-record-page .fi-tabs-item.fi-active { background: var(--w-tint-green); box-shadow: inset 0 -3px 0 var(--w-green-2); }
.fi-resource-view-record-page .fi-tabs-item.fi-active .fi-tabs-item-label, .fi-resource-view-record-page .fi-tabs-item.fi-active .fi-icon { color: var(--w-ink); font-weight: 700; }
.fi-resource-view-record-page .fi-in-repeatable-item { background: var(--w-card-soft); border: 1px solid var(--w-line); border-radius: var(--w-radius); padding: 14px; box-shadow: none; --tw-ring-shadow: 0 0 #0000; }
.fi-resource-view-record-page .fi-in-entry-label, .fi-resource-view-record-page .fi-in-entry-label-ctn { color: var(--w-muted); font-size: 12px; font-weight: 500; }
.fi-resource-view-record-page .fi-in-text-item { overflow-wrap: anywhere; }

/* ───────────── 10. Phones and small tablets ───────────── */
.wafid-bottom-nav { display: none; }
@media (max-width: 1023px) {
    .fi-main-sidebar.fi-sidebar { background: var(--w-nav); }
    .fi-topbar { padding-inline: 12px; gap: 8px; }
    .fi-topbar-start { display: none !important; }
    .fi-topbar .fi-icon-btn { min-width: var(--w-touch); min-height: var(--w-touch); }
    .wf-iconbtn { width: var(--w-touch); height: var(--w-touch); }
    .fi-main-sidebar .fi-sidebar-item-btn { min-height: 46px; }

    .wafid-bottom-nav { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 25; gap: 2px; background: var(--w-card); border-top: 1px solid var(--w-line); box-shadow: 0 -5px 20px rgb(23 48 71 / .06); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
    .wafid-bottom-nav > * { flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: var(--w-radius); background: transparent; color: var(--w-muted); font-size: 11.5px; line-height: 1.3; cursor: pointer; text-decoration: none; }
    .wafid-bottom-nav > [aria-current='page'] { background: var(--w-tint-blue); color: var(--w-link); font-weight: 700; }
    .wafid-bottom-nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    /* Room under the content so the bar never covers buttons, tables or pagination. */
    .fi-body .fi-main { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
    #wafid-idle { bottom: calc(5rem + env(safe-area-inset-bottom, 0px)) !important; }
}
@media (max-width: 639px) {
    .fi-header-heading { font-size: 22px; }
    .wf-file { padding: 14px; }
    .wf-file-top { gap: 12px; flex-wrap: wrap; }
    .wf-photo { width: 80px; height: 96px; }
    .wf-file-id h2 { font-size: 18px; }
    .wf-file-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wf-steps li { min-width: 92px; }
    .wf-next .fi-btn { width: 100%; }
    .wf-hero { padding: 18px 16px; }
    .wf-hero h2 { font-size: 19px; }
    .wf-hero img { width: 56px; height: 56px; border-radius: 13px; padding: 5px; align-self: flex-start; }
    .wf-panel { padding: 14px; }
    /* Dashboard numbers two per row */
    .fi-wi-stats-overview .fi-section-content.fi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
    .fi-wi-stats-overview .fi-section-content.fi-grid > * { grid-column: auto !important; min-width: 0; }
    .fi-wi-stats-overview-stat { height: 100%; }
    .fi-wi-stats-overview-stat-label-ctn { flex-direction: column; align-items: flex-start; gap: 8px; }
    .fi-topbar-open-sidebar-btn { order: -2; }
    .fi-wi-stats-overview-stat { padding: 12px; }
    .fi-wi-stats-overview-stat-value { font-size: 22px; }
    .fi-wi-stats-overview-stat-label { font-size: 12px; }
    .fi-simple-main { padding-inline: 18px; margin: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) { .wf-quick a, a.wf-row { transition: none; } }
@media print { .wafid-bottom-nav, .wf-iconbtn, .wf-context, .wf-auth-aside { display: none !important; } }

/* ───────────── UI-06: reports ───────────── */
.wr-bar { height: auto; display: grid; gap: 12px; }
.wr-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.wr-filters label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--w-muted); min-width: 11rem; }
.wr-filters > .fi-btn { min-height: var(--w-field); }
.wr-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--w-muted); }
.wr-note svg { flex: none; color: var(--w-blue); }
.wr-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); align-items: start; }
.wr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.wr-table th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--w-muted); background: var(--w-card-soft); padding: 9px 12px; border-block: 1px solid var(--w-line); }
.wr-table th:first-child { border-start-start-radius: var(--w-radius-sm); border-inline-start: 1px solid var(--w-line); }
.wr-table th:last-child { border-start-end-radius: var(--w-radius-sm); border-inline-end: 1px solid var(--w-line); }
.wr-table td { padding: 10px 12px; border-bottom: 1px solid var(--w-line); color: var(--w-ink); }
.wr-table tbody tr:hover td { background: var(--w-card-soft); }
.wr-table td:not(:first-child), .wr-table th:not(:first-child) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wr-table td.wr-zero { color: var(--w-muted); }
.wr-table tr.wr-total td { background: var(--w-tint-blue); font-weight: 700; border-bottom: 0; }
.wr-table tr.wr-total td:first-child { border-end-start-radius: var(--w-radius-sm); }
.wr-table tr.wr-total td:last-child { border-end-end-radius: var(--w-radius-sm); }
.wr-table tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
    .wr-filters label { min-width: 0; flex: 1 1 100%; }
    .wr-filters > .fi-btn { flex: 1 1 100%; justify-content: center; }
    .wr-table th, .wr-table td { padding: 9px 8px; }
}

/* ───────────── UI-06: create / edit forms ───────────── */
.fi-resource-create-record-page form.fi-sc-form,
.fi-resource-edit-record-page form.fi-sc-form {
    background: var(--w-card); border: 1px solid var(--w-line); border-radius: var(--w-radius-lg);
    box-shadow: var(--w-shadow); padding: 24px; max-width: 980px; gap: 24px;
}
.fi-resource-create-record-page form.fi-sc-form > .fi-sc:last-child,
.fi-resource-edit-record-page form.fi-sc-form > .fi-sc:last-child {
    border-top: 1px solid var(--w-line); padding-top: 18px; margin-top: 4px;
}
.fi-resource-create-record-page form.fi-sc-form .fi-btn,
.fi-resource-edit-record-page form.fi-sc-form .fi-btn { min-height: var(--w-field); }
.fi-fo-field-helper-text, .fi-fo-field-wrp-hint { color: var(--w-muted); font-size: 12.5px; }
.fi-fo-field-wrp-error-message { font-weight: 600; }
.fi-sc-form .fi-section { box-shadow: none; background: var(--w-card-soft); }
@media (max-width: 640px) {
    .fi-resource-create-record-page form.fi-sc-form,
    .fi-resource-edit-record-page form.fi-sc-form { padding: 16px; }
    .fi-resource-create-record-page form.fi-sc-form > .fi-sc:last-child .fi-btn,
    .fi-resource-edit-record-page form.fi-sc-form > .fi-sc:last-child .fi-btn { flex: 1 1 100%; justify-content: center; }
}

/* ───────────── UI-07: contrast fixes found by the dark/mobile audit ───────────── */
.fi-ta-placeholder, .fi-ta-empty-state-description { color: var(--w-muted); }
/* the typed-in area fills the whole 44px field, so a tap anywhere in it focuses the control */
.fi-input-wrp .fi-input, .fi-input-wrp .fi-select-input, .fi-input-wrp .fi-select-input-btn { min-height: calc(var(--w-field) - 2px); }
@media (max-width: 768px) {
    .fi-ac-icon-btn-action, .fi-icon-btn { min-width: var(--w-touch); min-height: var(--w-touch); }
    .fi-copyable { display: inline-flex; align-items: center; min-height: var(--w-touch); }
    .fi-ta-col a.fi-ta-col, a.fi-ta-col { min-height: 28px; }
}
@media (max-width: 768px) {
    .fi-btn, .fi-user-menu-trigger { min-height: var(--w-touch); }
    .fi-user-menu-trigger { min-width: var(--w-touch); }
}

/* ───────────── Reports page — same identity as the printed card (blue / green / orange, rounded panels, accent stripe) ───────────── */
.wr-root { display: grid; gap: 18px; }
.wr-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-radius: 16px; color: #fff;
    background: linear-gradient(135deg, #164b82, #1d5c9c); border-bottom: 4px solid #24966d; box-shadow: var(--w-shadow); }
.wr-hero h2 { margin: 0; font-size: 20px; font-weight: 700; }
.wr-hero p { margin: 2px 0 0; font-size: 13px; opacity: .85; direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
.wr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wr-chip { padding: 7px 14px; min-height: 36px; border-radius: 999px; border: 1px solid rgb(255 255 255 / .45); background: rgb(255 255 255 / .12); color: #fff; font: inherit; font-size: 13px; cursor: pointer; transition: background .15s, transform .15s; }
.wr-chip:hover { background: rgb(255 255 255 / .28); transform: translateY(-1px); }
.wr-chip:focus-visible, .wr-seg button:focus-visible { outline: 3px solid #5ad0a3; outline-offset: 2px; }
.wr-kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.wr-kpi { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--w-card); border: 1px solid var(--w-line); border-inline-start: 6px solid var(--k, #164b82); box-shadow: var(--w-shadow); transition: transform .15s; }
.wr-kpi:hover { transform: translateY(-2px); }
.wr-kpi-blue { --k: #164b82; } .wr-kpi-green { --k: #24966d; } .wr-kpi-orange { --k: #ad4c0b; }
.wr-kpi-label { font-size: 12.5px; color: var(--w-muted); font-weight: 600; }
.wr-kpi-value { font-size: 26px; line-height: 1.2; color: var(--k); font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
.dark .wr-kpi-blue { --k: #8cc2f2; } .dark .wr-kpi-orange { --k: #f0a064; } .dark .wr-kpi-green { --k: #5ad0a3; }
.wr-seg { display: inline-flex; border: 1px solid var(--w-field-line); border-radius: 10px; overflow: hidden; min-height: var(--w-field); }
.wr-seg button { padding: 0 16px; font: inherit; font-size: 13.5px; font-weight: 600; background: var(--w-card); color: var(--w-muted); border: 0; cursor: pointer; }
.wr-seg button.is-on { background: #164b82; color: #fff; }
.wr-card { background: var(--w-card); border: 1px solid var(--w-line); border-radius: 14px; padding: 14px 16px 16px; box-shadow: var(--w-shadow); border-inline-start: 6px solid #164b82; }
.wr-card:nth-child(3n+2) { border-inline-start-color: #24966d; }
.wr-card:nth-child(3n) { border-inline-start-color: #ad4c0b; }
.wr-card-title { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--w-ink); }
.wr-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.wr-bars li { display: grid; grid-template-columns: minmax(7rem, 1.2fr) 2fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.wr-bar-label { color: var(--w-ink); }
.wr-bar-track { height: 10px; background: var(--w-card-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--w-line); }
.wr-bar-track i { display: block; height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.wr-b1 { background: #164b82; } .wr-b2 { background: #24966d; }
.dark .wr-b1 { background: #4d9be0; }
.wr-bars b { min-width: 2.2rem; text-align: end; font-variant-numeric: tabular-nums; direction: ltr; }
.wr-bars b.wr-zero { color: var(--w-muted); font-weight: 500; }
.wr-bars li:hover .wr-bar-track i { filter: brightness(1.15); }
.wr-bar-total { margin-top: 2px; padding: 8px 10px; border-radius: 10px; background: var(--w-tint-blue); font-weight: 700; }
.wr-bar-total { grid-template-columns: 1fr auto; }
.wr-bar-total span:empty { display: none; }
.wr-loading { opacity: .55; transition: opacity .15s; }
@media (max-width: 640px) {
    .wr-hero { padding: 14px; }
    .wr-bars li { grid-template-columns: 1fr auto; }
    .wr-bar-track { grid-column: 1 / -1; order: 3; }
    .wr-seg { width: 100%; } .wr-seg button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .wr-chip, .wr-kpi, .wr-bar-track i { transition: none; } }

/* ───────────── Reference laboratory page ───────────── */
.wr-chip.is-on { background: #fff; color: #164b82; font-weight: 700; }
.lab-card .wr-card-title small { font-weight: 500; color: var(--w-muted); font-size: 13px; }
.lab-types { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-type { padding: 4px 12px; border-radius: 999px; border: 1px solid #164b82; background: var(--w-tint-blue); color: #164b82; font: inherit; font-size: 13px; cursor: pointer; }
.lab-type.is-off { border-color: var(--w-field-line); background: transparent; color: var(--w-muted); text-decoration: line-through; }
.lab-tests { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.lab-tests li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--w-line); border-radius: 10px; background: var(--w-card-soft); }
.lab-name { font-weight: 600; }
.lab-opts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.lab-opt { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--w-field-line); background: var(--w-card); color: var(--w-ink); font: inherit; font-size: 13px; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
button.lab-opt:hover { transform: translateY(-1px); }
.lab-opt.is-on.lab-done { background: #24966d; border-color: #24966d; color: #fff; }
.lab-opt.is-on.lab-negative { background: #164b82; border-color: #164b82; color: #fff; }
.lab-opt.is-on.lab-positive { background: #ad4c0b; border-color: #ad4c0b; color: #fff; }
.lab-pending { font-size: 12.5px; color: var(--w-muted); align-self: center; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ───────────── Guide: help button, guided tours (spotlight + arrow), help page ───────────── */
#wafid-guide { position: fixed; inset-inline-start: 18px; bottom: 18px; z-index: 55; }
.wg-fab { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #164b82, #24966d); box-shadow: 0 8px 22px rgb(22 59 90 / .35); }
.wg-fab::first-line { font-size: 18px; }
.wg-fab:hover { filter: brightness(1.08); }
.wg-fab:focus-visible, .wg-menu button:focus-visible, .wg-card button:focus-visible { outline: 3px solid #5ad0a3; outline-offset: 2px; }
.wg-menu { position: absolute; bottom: 58px; inset-inline-start: 0; width: min(320px, calc(100vw - 36px)); background: var(--w-card); color: var(--w-ink); border: 1px solid var(--w-line); border-radius: 14px; padding: 8px; box-shadow: 0 16px 40px rgb(0 0 0 / .22); }
.wg-menu[hidden] { display: none; }
.wg-menu-title { margin: 6px 10px 8px; font-weight: 700; color: #164b82; }
.dark .wg-menu-title { color: #8cc2f2; }
.wg-menu button, .wg-menu a { display: grid; gap: 2px; width: 100%; text-align: start; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; text-decoration: none; }
.wg-menu button:hover, .wg-menu a:hover { background: var(--w-tint-blue); }
.wg-menu button span { font-weight: 700; } .wg-menu small { color: var(--w-muted); font-size: 12.5px; }
.wg-menu a { font-size: 13px; color: var(--w-link); }
.wg-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.wg-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgb(10 28 46 / .62), 0 0 0 3px #5ad0a3; animation: wg-pulse 1.6s ease-in-out infinite; }
@keyframes wg-pulse { 50% { box-shadow: 0 0 0 9999px rgb(10 28 46 / .62), 0 0 0 7px rgb(90 208 163 / .55); } }
.wg-card { box-sizing: border-box; position: fixed; pointer-events: auto; background: #fff; color: #0f2237; border-radius: 16px; padding: 16px 18px; box-shadow: 0 18px 50px rgb(0 0 0 / .4); border-top: 5px solid #24966d; max-width: calc(100vw - 24px); direction: rtl; }
.wg-count { margin: 0 0 4px; font-size: 12px; color: #5b6f80; }
.wg-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: #164b82; }
.wg-text { margin: 0 0 14px; font-size: 14.5px; line-height: 1.7; }
.wg-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.wg-btns button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid #cbd9e3; background: #fff; color: #0f2237; font: inherit; font-size: 14px; cursor: pointer; }
.wg-btns .wg-next { background: #164b82; border-color: #164b82; color: #fff; font-weight: 700; }
.wg-btns .wg-end { margin-inline-start: auto; border: 0; background: transparent; color: #5b6f80; }
.wg-btns button:disabled { opacity: .4; cursor: default; }
.wg-arrow { position: absolute; width: 18px; height: 18px; background: #fff; transform: rotate(45deg); }
.wg-card[data-side="bottom"] .wg-arrow { top: -9px; margin-inline-start: -9px; border-top: 5px solid #24966d; }
.wg-card[data-side="top"] .wg-arrow { bottom: -9px; margin-inline-start: -9px; }
.wg-card[data-side="inline-end"] .wg-arrow { right: -9px; margin-top: -9px; }
html[dir="ltr"] .wg-card[data-side="inline-end"] .wg-arrow { right: auto; left: -9px; }
.hp-tours { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.hp-tour { display: flex; align-items: center; gap: 14px; padding: 16px; text-align: start; font: inherit; color: var(--w-ink); background: var(--w-card); border: 1px solid var(--w-line); border-inline-start: 6px solid #24966d; border-radius: 14px; box-shadow: var(--w-shadow); cursor: pointer; transition: transform .15s; }
.hp-tour:hover { transform: translateY(-2px); }
.hp-tour:nth-child(2) { border-inline-start-color: #164b82; } .hp-tour:nth-child(3) { border-inline-start-color: #ad4c0b; }
.hp-tour strong { display: block; font-size: 16px; } .hp-tour small { color: var(--w-muted); font-size: 13px; }
.hp-play { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--w-tint-green); color: #24966d; font-size: 16px; }
.hp-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.hp-stage { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }
.hp-stage:not(:last-child)::before { content: ''; position: absolute; inset-inline-start: 19px; top: 40px; bottom: 0; width: 3px; background: linear-gradient(#164b82, #24966d); opacity: .35; border-radius: 2px; }
.hp-num { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 700; background: #164b82; }
.hp-s1 .hp-num { background: #24966d; } .hp-s2 .hp-num { background: #ad4c0b; }
.hp-stage strong { font-size: 16px; } .hp-stage p { margin: 2px 0 4px; line-height: 1.7; } .hp-stage small { color: var(--w-muted); }
.hp-faq { display: grid; gap: 8px; }
.hp-faq details { border: 1px solid var(--w-line); border-radius: 10px; padding: 10px 14px; background: var(--w-card-soft); }
.hp-faq summary { cursor: pointer; font-weight: 600; } .hp-faq p { margin: 8px 0 0; line-height: 1.7; color: var(--w-muted); }
@media (max-width: 640px) { .wg-fab span { display: none; } .wg-fab { padding: 0; width: 52px; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .wg-spot { animation: none; } .hp-tour { transition: none; } }
.wf-next.is-card { background: var(--w-tint-green); border-color: color-mix(in srgb, var(--w-green-2) 35%, transparent); }
.wf-next.is-stop { background: var(--w-tint-danger); border-color: color-mix(in srgb, var(--w-danger) 35%, transparent); }
