/* =====================================================================
   Demo Garments Attendance — mobile-first design system
   Typeface: Inter (Google Fonts, system-ui fallback)

   Built thumb-first: bottom tab bar + off-canvas drawer on phones,
   top nav + sidebar-style drawer from 900px. Light and dark themes.
   Legacy class names (.btn-light, .fld, .grid-stats, .modal …) are kept
   so existing pages keep working; the newer BEM-ish names are aliases.
   ===================================================================== */

/* =====================  1. tokens  ===================== */
:root {
    color-scheme: light dark;

    /* neutrals — light */
    --bg:             #f1f5f9;
    --surface:        #ffffff;
    --surface-raised: #ffffff;
    --surface-sunken: #f8fafc;
    --border:         #e2e8f0;
    --border-strong:  #cbd5e1;
    --text:           #0f172a;
    --text-muted:     #475569;
    --text-inverse:   #ffffff;

    /* brand */
    --primary:          #1e40af;
    --primary-hover:    #16308c;
    --primary-contrast: #ffffff;
    --primary-soft:     #e8eef9;
    --primary-ring:     rgba(30, 64, 175, .35);

    /* semantic */
    --success: #15803d; --success-soft: #dcfce7; --success-ink: #14532d;
    --warn:    #b45309; --warn-soft:    #fef3c7; --warn-ink:    #92400e;
    --danger:  #b91c1c; --danger-soft:  #fee2e2; --danger-ink:  #7f1d1d;
    --info:    #1d4ed8; --info-soft:    #dbeafe; --info-ink:    #1e3a8a;

    /* attendance status */
    --st-present:  #15803d; --st-present-bg:  #dcfce7;
    --st-absent:   #b91c1c; --st-absent-bg:   #fee2e2;
    --st-mispunch: #b45309; --st-mispunch-bg: #fef3c7;
    --st-holiday:  #1d4ed8; --st-holiday-bg:  #dbeafe;
    --st-leave:    #7c3aed; --st-leave-bg:    #ede9fe;

    /* legacy aliases still referenced by pages */
    --card: var(--surface-raised);
    --muted: var(--text-muted);
    --green: var(--success);
    --red: var(--danger);
    --amber: var(--warn);
    --primary-dark: var(--primary-hover);
    --radius: 14px;
    --shadow-sm: var(--sh-1);
    --shadow-md: var(--sh-2);

    /* type */
    --font: 'Inter', system-ui, "Segoe UI", Roboto, Arial, sans-serif;
    --fs-xs:   .75rem;
    --fs-sm:   .875rem;
    --fs-base: 1rem;
    --fs-lg:   1.125rem;
    --fs-xl:   1.375rem;
    --fs-2xl:  1.75rem;
    --fs-3xl:  2.25rem;
    --fw-normal: 400; --fw-medium: 500; --fw-semi: 600; --fw-bold: 700; --fw-black: 800;
    --lh-tight: 1.2; --lh-snug: 1.35; --lh-normal: 1.55;
    --tracking-tight: -.015em;
    --tracking-wide: .04em;

    /* space / shape */
    --sp-1: .25rem; --sp-2: .5rem;  --sp-3: .75rem; --sp-4: 1rem;
    --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem;  --sp-10: 2.5rem; --sp-12: 3rem;
    --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

    --sh-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --sh-2: 0 2px 6px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .05);
    --sh-3: 0 8px 20px rgba(15, 23, 42, .12);
    --sh-4: 0 -6px 24px rgba(15, 23, 42, .16);
    --sh-focus: 0 0 0 3px var(--primary-ring);

    --z-sticky: 100; --z-dropdown: 200; --z-scrim: 300; --z-drawer: 310;
    --z-modal: 500; --z-toast: 600;

    --tap: 44px;
    --topbar-h: 56px;
    --tabbar-h: 58px;
    --drawer-w: 288px;
}

/* dark theme — follows the OS, or the explicit choice in the account menu */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:             #0b1220;
        --surface:        #111c31;
        --surface-raised: #182741;
        --surface-sunken: #0d1626;
        --border:         #26334d;
        --border-strong:  #3a4b6b;
        --text:           #e8edf7;
        --text-muted:     #9fb0c9;
        --text-inverse:   #0a1428;

        --primary:          #6c9bff;
        --primary-hover:    #8fb4ff;
        --primary-contrast: #0a1428;
        --primary-soft:     #1b2c4c;
        --primary-ring:     rgba(108, 155, 255, .45);

        --success: #4ade80; --success-soft: #10331f; --success-ink: #bbf7d0;
        --warn:    #fbbf24; --warn-soft:    #3a2a08; --warn-ink:    #fde68a;
        --danger:  #f87171; --danger-soft:  #3a1517; --danger-ink:  #fecaca;
        --info:    #93c5fd; --info-soft:    #14264a; --info-ink:    #bfdbfe;

        --st-present:  #4ade80; --st-present-bg:  #10331f;
        --st-absent:   #f87171; --st-absent-bg:   #3a1517;
        --st-mispunch: #fbbf24; --st-mispunch-bg: #3a2a08;
        --st-holiday:  #93c5fd; --st-holiday-bg:  #14264a;
        --st-leave:    #c4b5fd; --st-leave-bg:    #241b45;

        --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
        --sh-2: 0 2px 8px rgba(0, 0, 0, .55);
        --sh-3: 0 10px 26px rgba(0, 0, 0, .6);
        --sh-4: 0 -8px 28px rgba(0, 0, 0, .65);
    }
}
:root[data-theme="dark"] {
    --bg:             #0b1220;
    --surface:        #111c31;
    --surface-raised: #182741;
    --surface-sunken: #0d1626;
    --border:         #26334d;
    --border-strong:  #3a4b6b;
    --text:           #e8edf7;
    --text-muted:     #9fb0c9;
    --text-inverse:   #0a1428;

    --primary:          #6c9bff;
    --primary-hover:    #8fb4ff;
    --primary-contrast: #0a1428;
    --primary-soft:     #1b2c4c;
    --primary-ring:     rgba(108, 155, 255, .45);

    --success: #4ade80; --success-soft: #10331f; --success-ink: #bbf7d0;
    --warn:    #fbbf24; --warn-soft:    #3a2a08; --warn-ink:    #fde68a;
    --danger:  #f87171; --danger-soft:  #3a1517; --danger-ink:  #fecaca;
    --info:    #93c5fd; --info-soft:    #14264a; --info-ink:    #bfdbfe;

    --st-present:  #4ade80; --st-present-bg:  #10331f;
    --st-absent:   #f87171; --st-absent-bg:   #3a1517;
    --st-mispunch: #fbbf24; --st-mispunch-bg: #3a2a08;
    --st-holiday:  #93c5fd; --st-holiday-bg:  #14264a;
    --st-leave:    #c4b5fd; --st-leave-bg:    #241b45;

    --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sh-2: 0 2px 8px rgba(0, 0, 0, .55);
    --sh-3: 0 10px 26px rgba(0, 0, 0, .6);
    --sh-4: 0 -8px 28px rgba(0, 0, 0, .65);
}

/* =====================  2. base  ===================== */
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }

h1 { font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: var(--lh-tight);
     letter-spacing: var(--tracking-tight); margin: 0 0 var(--sp-1); }
h2 { font-size: var(--fs-lg); font-weight: var(--fw-semi); line-height: var(--lh-snug);
     margin: var(--sp-6) 0 var(--sp-2); }
h3 { font-size: var(--fs-base); font-weight: var(--fw-semi); margin: var(--sp-4) 0 var(--sp-2); }

.page-sub { color: var(--text-muted); margin: 0 0 var(--sp-4); font-size: var(--fs-sm); }
.legend, .hint { font-size: var(--fs-sm); color: var(--text-muted); line-height: var(--lh-snug); }
.u-num, .stat .num, .stat-num, table.tbl { font-variant-numeric: tabular-nums; }
.u-label { font-size: var(--fs-xs); font-weight: var(--fw-semi); text-transform: uppercase;
           letter-spacing: var(--tracking-wide); color: var(--text-muted); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: var(--sp-2); top: -60px; z-index: var(--z-toast);
    background: var(--surface-raised); color: var(--text); padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-md); box-shadow: var(--sh-3); font-weight: var(--fw-semi);
    transition: top .15s ease;
}
.skip-link:focus { top: var(--sp-2); }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}
.ic { width: 22px; height: 22px; flex: 0 0 auto; }

/* =====================  3. app shell  ===================== */

/* --- progress bar for boosted navigation --- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: var(--z-toast); pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .25s ease; }
.htmx-request .progress span, .progress.htmx-request span { width: 75%; }

/* --- top bar --- */
.topbar {
    position: sticky; top: 0; z-index: var(--z-sticky);
    display: flex; align-items: center; gap: var(--sp-2);
    min-height: var(--topbar-h);
    padding: env(safe-area-inset-top, 0px) max(var(--sp-3), env(safe-area-inset-right, 0px))
             0 max(var(--sp-3), env(safe-area-inset-left, 0px));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--sh-1);
    transition: transform .22s ease;
}
.topbar.is-hidden { transform: translateY(-100%); }

.brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--text); font-weight: var(--fw-bold);
         letter-spacing: var(--tracking-tight); white-space: nowrap; min-height: var(--tap); }
.brand:hover { color: var(--text); }
.brand-mark {
    width: 32px; height: 32px; border-radius: var(--r-md); flex: 0 0 auto;
    display: grid; place-items: center;
    background: var(--primary); color: var(--primary-contrast);
    font-weight: var(--fw-black); font-size: var(--fs-base);
}
.brand-mark-lg { width: 56px; height: 56px; border-radius: var(--r-lg); font-size: var(--fs-xl); }
.brand-text { font-size: var(--fs-base); }
.brand-long { display: none; }

.icon-btn {
    min-width: var(--tap); min-height: var(--tap);
    display: grid; place-items: center;
    background: none; border: 0; color: var(--text); cursor: pointer;
    border-radius: var(--r-md); padding: 0;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

.nav { display: none; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-1); margin-left: auto; }

.bell { position: relative; }
.bell-badge {
    position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--danger); color: #fff; border-radius: var(--r-full);
    font-size: 11px; font-weight: var(--fw-bold); line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

/* --- account menu --- */
.menu-wrap { position: relative; }
.avatar-btn {
    display: flex; align-items: center; gap: var(--sp-2);
    min-height: var(--tap); padding: 0 var(--sp-1); border: 0; background: none;
    color: var(--text); cursor: pointer; border-radius: var(--r-md);
}
.avatar-btn:hover { background: var(--surface-sunken); }
.avatar {
    width: 34px; height: 34px; border-radius: var(--r-full); flex: 0 0 auto;
    display: grid; place-items: center; object-fit: cover;
    background: var(--primary-soft); color: var(--primary);
    font-weight: var(--fw-bold); font-size: var(--fs-sm);
}
.avatar-meta { display: none; text-align: left; line-height: 1.25; }
.avatar-name { display: block; font-size: var(--fs-sm); font-weight: var(--fw-semi); }
.avatar-role { display: block; font-size: var(--fs-xs); color: var(--text-muted); text-transform: capitalize; }

.menu-drop {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown);
    min-width: 232px; padding: var(--sp-1);
    background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--sh-3);
}
.menu-head { padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-1); }
.menu-head b { display: block; font-size: var(--fs-sm); }
.menu-head small { color: var(--text-muted); font-size: var(--fs-xs); text-transform: capitalize; }
.menu-drop a, .menu-drop .menu-item {
    display: flex; align-items: center; gap: var(--sp-3);
    width: 100%; min-height: var(--tap); padding: 0 var(--sp-3);
    border: 0; background: none; text-align: left; cursor: pointer;
    color: var(--text); font: inherit; font-size: var(--fs-sm); border-radius: var(--r-md);
}
.menu-drop a:hover, .menu-drop .menu-item:hover { background: var(--surface-sunken); color: var(--text); }
.menu-drop .danger { color: var(--danger); }
.menu-drop .ic { width: 18px; height: 18px; opacity: .8; }

/* --- drawer --- */
.drawer-scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: rgba(15, 23, 42, .55); }
.drawer {
    position: fixed; inset: 0 auto 0 0; z-index: var(--z-drawer);
    width: min(86vw, var(--drawer-w));
    background: var(--surface-raised); box-shadow: var(--sh-3);
    display: flex; flex-direction: column;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--sp-4));
}
.drawer-enter { transition: transform .22s cubic-bezier(.2, .7, .3, 1); }
.drawer-start { transform: translateX(-100%); }
.drawer-end { transform: translateX(0); }

.drawer-head {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
}
.drawer-title { flex: 1; min-width: 0; line-height: 1.3; }
.drawer-title b { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-title small { color: var(--text-muted); font-size: var(--fs-xs); text-transform: capitalize; }

.drawer-nav { padding: var(--sp-2) var(--sp-2) var(--sp-4); }
.drawer-link {
    display: flex; align-items: center; gap: var(--sp-3);
    width: 100%; min-height: var(--tap); padding: 0 var(--sp-3);
    border: 0; background: none; cursor: pointer; text-align: left;
    color: var(--text); font: inherit; font-size: var(--fs-base); font-weight: var(--fw-medium);
    border-radius: var(--r-md);
}
.drawer-link:hover { background: var(--surface-sunken); color: var(--text); }
.drawer-link.active {
    background: var(--primary-soft); color: var(--primary); font-weight: var(--fw-semi);
    box-shadow: inset 3px 0 0 var(--primary);
}
.drawer-link .ic { opacity: .85; }
.drawer-link span:not(.caret) { flex: 1; min-width: 0; }
.drawer-grp .caret { font-size: .7em; color: var(--text-muted); transition: transform .18s ease; }
.drawer-grp .caret.up { transform: rotate(180deg); }
.drawer-sub { padding: var(--sp-1) 0 var(--sp-2) calc(var(--sp-3) + 22px + var(--sp-3)); }
.drawer-sub a {
    display: flex; align-items: center; min-height: 40px; padding: 0 var(--sp-3);
    color: var(--text-muted); font-size: var(--fs-sm); border-radius: var(--r-md);
}
.drawer-sub a:hover { background: var(--surface-sunken); color: var(--text); }
.drawer-sub a.active { color: var(--primary); font-weight: var(--fw-semi); background: var(--primary-soft); }

/* --- bottom tab bar --- */
.tabbar {
    position: fixed; inset: auto 0 0 0; z-index: var(--z-sticky);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 3px rgba(15, 23, 42, .06);
}
.tab {
    display: grid; place-items: center; gap: 2px;
    min-height: var(--tabbar-h); padding: var(--sp-1) 2px;
    border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font: inherit;
    font-size: var(--fs-xs); font-weight: var(--fw-semi);
}
.tab:hover { color: var(--text-muted); }
.tab-ic { width: 24px; height: 24px; }
.tab.active { color: var(--primary); }
.tab:active { background: var(--surface-sunken); }

/* --- content --- */
.container {
    max-width: 1200px; margin: 0 auto;
    padding: var(--sp-4) max(var(--sp-3), env(safe-area-inset-left, 0px))
             calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-8))
             max(var(--sp-3), env(safe-area-inset-right, 0px));
}
body.no-shell .container { padding-bottom: var(--sp-8); }
.container > * { max-width: 100%; }

/* =====================  4. components  ===================== */

/* --- card --- */
.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
    overflow-wrap: break-word;
}
.card--flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-title { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-semi); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

/* --- stat tiles --- */
.grid-stats, .stat-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.stat {
    min-height: 88px; padding: var(--sp-3) var(--sp-4);
    display: flex; flex-direction: column; justify-content: center;
    background: var(--surface-raised); border: 1px solid var(--border);
    border-left: 4px solid var(--primary); border-radius: var(--r-lg);
    box-shadow: var(--sh-1); color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}
a.stat:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--sh-2); }
a.stat:active { transform: translateY(0) scale(.99); }
.stat .num, .stat-num {
    font-size: var(--fs-2xl); font-weight: var(--fw-black);
    line-height: var(--lh-tight); color: var(--primary);
    letter-spacing: var(--tracking-tight);
}
.stat .lbl, .stat-lbl {
    font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-top: 2px;
}
.stat--danger  { border-left-color: var(--danger); }
.stat--danger  .num, .stat--danger  .stat-num { color: var(--danger); }
.stat--warn    { border-left-color: var(--warn); }
.stat--warn    .num, .stat--warn    .stat-num { color: var(--warn); }
.stat--success { border-left-color: var(--success); }
.stat--success .num, .stat--success .stat-num { color: var(--success); }

/* --- buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    min-height: var(--tap); padding: 0 var(--sp-4);
    border: 1px solid transparent; border-radius: var(--r-md);
    background: var(--primary); color: var(--primary-contrast);
    font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semi);
    line-height: 1; text-align: center; cursor: pointer;
    box-shadow: var(--sh-1);
    transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--primary-hover); color: var(--primary-contrast); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn + .btn { margin-left: var(--sp-2); }

.btn-sm, .btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg, .btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-base); }
.btn-block, .btn--block { display: flex; width: 100%; margin-left: 0; }

.btn-light, .btn--secondary {
    background: var(--surface-raised); color: var(--text); border-color: var(--border-strong); box-shadow: none;
}
.btn-light:hover, .btn--secondary:hover { background: var(--surface-sunken); color: var(--text); }

.btn-outline, .btn--ghost {
    background: transparent; color: var(--primary); border-color: var(--border-strong); box-shadow: none;
}
.btn-outline:hover, .btn--ghost:hover { background: var(--primary-soft); color: var(--primary); }

.btn-danger, .btn--danger { background: var(--danger); color: #fff; }
.btn-danger:hover, .btn--danger:hover { background: var(--danger-ink); color: #fff; }
.btn-green, .btn--success { background: var(--success); color: #fff; }
.btn-green:hover, .btn--success:hover { background: var(--success-ink); color: #fff; }
:root[data-theme="dark"] .btn-danger, :root[data-theme="dark"] .btn-green,
:root[data-theme="dark"] .btn--danger, :root[data-theme="dark"] .btn--success { color: var(--text-inverse); }

/* --- forms --- */
label.fld, .field { display: block; margin-bottom: var(--sp-3); }
label.fld > span, .field-label {
    display: block; margin-bottom: var(--sp-1);
    font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text);
}
input[type=text], input[type=password], input[type=date], input[type=month],
input[type=time], input[type=number], input[type=tel], input[type=email],
input[type=file], select, textarea, .input {
    width: 100%; min-height: var(--tap);
    padding: var(--sp-2) var(--sp-3);
    font: inherit; font-size: var(--fs-base);
    color: var(--text); background: var(--surface);
    border: 1.5px solid var(--border-strong); border-radius: var(--r-md);
    -webkit-appearance: none; appearance: none;
}
input[type=file] { padding: var(--sp-2); }
select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right var(--sp-3) center; background-size: 18px;
    padding-right: var(--sp-8);
}
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239fb0c9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
input:focus-visible, select:focus-visible, textarea:focus-visible, .input:focus-visible {
    outline: none; border-color: var(--primary); box-shadow: var(--sh-focus);
}
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
textarea { min-height: 88px; resize: vertical; }
.field-hint { font-size: var(--fs-sm); color: var(--text-muted); margin: var(--sp-1) 0 0; }
.fld-opt { font-weight: var(--fw-normal); color: var(--text-muted); font-size: var(--fs-xs); }
.field-error { font-size: var(--fs-sm); color: var(--danger); margin: var(--sp-1) 0 0; }
.is-invalid .input, .is-invalid input { border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 var(--sp-4); }
.form-row { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); align-items: end; }
.form-row label.fld { margin-bottom: 0; }
.form-row .btn { width: 100%; }

/* Report toolbars carry a filter form plus several export/share actions.
   On a phone the form fills the width and the actions pair up two-to-a-row,
   so the report itself is not pushed off the first screen. */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); align-items: stretch; }
.toolbar > form { flex: 1 1 100%; display: grid; grid-template-columns: 1fr; gap: var(--sp-3); align-items: end; }
.toolbar form label.fld { margin-bottom: 0; }
.toolbar form .btn { width: 100%; }
.toolbar > .btn, .toolbar > a.btn { flex: 1 1 calc(50% - var(--sp-3)); min-width: 0; }
.toolbar > .btn + .btn { margin-left: 0; }

/* password reveal (login) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 72px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    min-height: 36px; padding: 0 var(--sp-3);
    border: 0; background: var(--surface-sunken); color: var(--primary);
    border-radius: var(--r-sm); font: inherit; font-size: var(--fs-sm);
    font-weight: var(--fw-semi); cursor: pointer;
}

/* --- badges --- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 22px; padding: 2px var(--sp-2);
    border-radius: var(--r-full);
    font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap;
}
.badge-green, .badge--present { background: var(--st-present-bg);  color: var(--success-ink); }
.badge-red,   .badge--absent  { background: var(--st-absent-bg);   color: var(--danger-ink); }
.badge-amber, .badge--mispunch{ background: var(--st-mispunch-bg); color: var(--warn-ink); }
.badge-blue,  .badge--holiday { background: var(--st-holiday-bg);  color: var(--info-ink); }
.badge--leave { background: var(--st-leave-bg); color: var(--st-leave); }
.badge-gray, .badge--neutral { background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); }

/* --- chips --- */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding: var(--sp-1) 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center; white-space: nowrap;
    min-height: 36px; padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong); border-radius: var(--r-full);
    background: var(--surface-raised); color: var(--text-muted);
    font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.chip.is-on, .chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }

/* --- flash messages --- */
.flash {
    padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
    margin-bottom: var(--sp-4); font-size: var(--fs-sm);
    border: 1px solid transparent; border-left-width: 4px;
}
.flash-ok   { background: var(--success-soft); color: var(--success-ink); border-left-color: var(--success); }
.flash-err  { background: var(--danger-soft);  color: var(--danger-ink);  border-left-color: var(--danger); }
.flash-info { background: var(--info-soft);    color: var(--info-ink);    border-left-color: var(--info); }

/* --- tabs / segmented control --- */
.tabs {
    display: flex; gap: 3px; padding: 3px; margin-bottom: var(--sp-4);
    background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: var(--r-md); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    flex: 1 1 0; min-width: max-content; min-height: 40px; padding: 0 var(--sp-3);
    border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semi);
    border-radius: calc(var(--r-md) - 3px); white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface-raised); color: var(--primary); box-shadow: var(--sh-1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- tables --- */
.table-wrap {
    position: relative;
    overflow: auto; -webkit-overflow-scrolling: touch;
    border-radius: var(--r-md);
}
table.tbl {
    border-collapse: collapse; width: 100%;
    background: var(--surface-raised);
    font-size: var(--fs-sm);
}
.tbl th, .tbl td {
    border: 1px solid var(--border);
    padding: var(--sp-2) var(--sp-3);
    text-align: left; vertical-align: middle;
}
.tbl th {
    background: var(--surface-sunken); color: var(--text-muted);
    font-size: var(--fs-xs); font-weight: var(--fw-bold);
    text-transform: uppercase; letter-spacing: var(--tracking-wide);
    white-space: nowrap;
}
.tbl thead th { position: sticky; top: 0; z-index: 3; }
.tbl tbody tr:nth-child(even) td { background: var(--surface-sunken); }
.tbl tbody tr:hover td { background: var(--primary-soft); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl td.ctr, .tbl th.ctr { text-align: center; }
.tbl .rowname { font-weight: var(--fw-semi); }
.tbl .btn-sm { white-space: nowrap; }

/* --- list rows --- */
.row {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 56px; padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border); color: var(--text);
}
.row:active { background: var(--surface-sunken); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-size: var(--fs-base); font-weight: var(--fw-semi);
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.row-chev { color: var(--text-muted); font-size: 20px; }

/* --- modal / bottom sheet --- */
.modal {
    display: none; position: fixed; inset: 0; z-index: var(--z-modal);
    background: rgba(15, 23, 42, .55);
    align-items: flex-end; justify-content: center;
}
.modal.open { display: flex; }
.modal-box {
    position: relative; width: 100%; max-height: 88dvh; overflow-y: auto;
    background: var(--surface-raised);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--sh-4);
    padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
    animation: sheetUp .22s cubic-bezier(.2, .7, .3, 1) both;
}
.modal-box::before {
    content: ''; display: block; width: 40px; height: 4px; margin: 0 auto var(--sp-4);
    border-radius: var(--r-full); background: var(--border-strong);
}
.modal-box h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal-actions .btn { width: 100%; margin-left: 0; }
@keyframes sheetUp { from { transform: translateY(100%); } }

/* --- toasts --- */
.toast-stack {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-3));
    z-index: var(--z-toast);
    display: grid; gap: var(--sp-2); width: min(92vw, 420px);
    pointer-events: none;
}
.toast {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-raised); border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--r-md); box-shadow: var(--sh-3);
    font-size: var(--fs-sm); color: var(--text);
    animation: toastIn .2s ease both;
}
.toast-ok { border-left-color: var(--success); }
.toast-err { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Legacy standalone toasts (report_daily #toast, attendance #shareToast):
   fixed, hidden until the page's own script adds .show. */
.toast[id] {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-3));
    z-index: var(--z-toast); width: min(92vw, 420px);
    opacity: 0; pointer-events: none; animation: none;
    transition: opacity .2s ease, transform .2s ease;
}
.toast[id].show { opacity: 1; pointer-events: auto; }
@media (min-width: 900px) {
    .toast[id] { left: auto; right: var(--sp-5); bottom: var(--sp-5); transform: none; }
}

/* --- empty state --- */
.empty { text-align: center; padding: var(--sp-10) var(--sp-4); display: grid; gap: var(--sp-3); justify-items: center; }
.empty-ico { font-size: 44px; opacity: .55; }
.empty-title { font-size: var(--fs-lg); font-weight: var(--fw-semi); margin: 0; }
.empty-text { color: var(--text-muted); max-width: 34ch; margin: 0; }

/* --- skeleton --- */
.skeleton {
    background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--border) 37%, var(--surface-sunken) 63%);
    background-size: 400% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r-sm);
}
.skeleton--line { height: 14px; width: var(--w, 100%); margin-bottom: var(--sp-2); }
.skeleton--tile { height: 88px; border-radius: var(--r-lg); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* --- employee photos --- */
.emp-photo, .avatar--md { width: 40px; height: 40px; border-radius: var(--r-full); object-fit: cover; background: var(--primary-soft); display: inline-block; }
.emp-photo-lg { width: 96px; height: 96px; border-radius: var(--r-lg); object-fit: cover; background: var(--primary-soft); box-shadow: var(--sh-1); }
.emp-photo-xl { width: 72px; height: 72px; border-radius: var(--r-lg); object-fit: cover; background: var(--primary-soft); flex: 0 0 auto; box-shadow: var(--sh-1); }
.emp-initial, .emp-initial-xl {
    display: inline-grid; place-items: center;
    background: var(--primary-soft); color: var(--primary); font-weight: var(--fw-bold);
}
.emp-initial { width: 40px; height: 40px; border-radius: var(--r-full); font-size: var(--fs-sm); }
.emp-initial-xl { width: 72px; height: 72px; border-radius: var(--r-lg); font-size: var(--fs-xl); flex: 0 0 auto; }
.emp-head { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.emp-head-name { font-weight: var(--fw-bold); font-size: var(--fs-lg); letter-spacing: var(--tracking-tight); }
.emp-head-code { font-weight: var(--fw-medium); color: var(--text-muted); }
.emp-head-sub { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }

/* --- combobox --- */
.combo { position: relative; }
.combo-input { width: 100%; }
.combo-list {
    display: none; position: absolute; z-index: var(--z-dropdown);
    left: 0; right: 0; top: calc(100% + 4px);
    max-height: 280px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--sh-3);
}
.combo-list.open { display: block; }
.combo-item {
    padding: var(--sp-3); cursor: pointer; font-size: var(--fs-sm);
    border-bottom: 1px solid var(--border); min-height: var(--tap);
    display: flex; align-items: center; gap: var(--sp-2);
}
.combo-item:last-child { border-bottom: 0; }
.combo-item small { color: var(--text-muted); }
.combo-item:hover, .combo-item.active { background: var(--primary-soft); color: var(--primary); }
.combo-empty { padding: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }

/* --- checkbox list --- */
.check-box-list {
    max-height: 300px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.check-item {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: var(--tap); padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border); cursor: pointer; font-size: var(--fs-sm);
}
.check-item:last-child { border-bottom: 0; }
.check-item:hover { background: var(--surface-sunken); }
.check-item.on { background: var(--primary-soft); }
.check-item small { color: var(--text-muted); }

/* --- punch grid helpers --- */
.holiday-cell { color: var(--info); font-weight: var(--fw-semi); font-style: italic; background: var(--st-holiday-bg) !important; }
.punch-manual { color: var(--danger); font-weight: var(--fw-semi); }
.punch-del { cursor: pointer; border-radius: var(--r-xs); padding: 2px 4px; display: inline-block; }
.punch-del:hover { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.consol-tbl td, .consol-tbl th { padding: 2px 4px; font-size: var(--fs-xs); text-align: center; white-space: nowrap; }
.consol-emp td { background: var(--primary-soft) !important; font-weight: var(--fw-bold); text-align: left; }
.consol-tbl .plabel { font-weight: var(--fw-semi); background: var(--surface-sunken) !important; text-align: left; }

/* --- login --- */
.login-wrap {
    min-height: 100dvh; display: grid; place-items: center;
    padding: var(--sp-4) var(--sp-4) var(--sp-10); background: var(--bg);
}
.login-card {
    width: min(100%, 420px);
    background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: var(--r-xl); box-shadow: var(--sh-2);
    padding: var(--sp-6) var(--sp-5);
}
.login-brand { text-align: center; margin-bottom: var(--sp-5); display: grid; gap: var(--sp-2); justify-items: center; }
.login-brand h1 { margin: 0; font-size: var(--fs-xl); }
.login-brand .hint { margin: 0; }
.login-help { margin: var(--sp-5) 0 0; text-align: center; }

/* --- report head (print only) --- */
.report-head { display: none; }

/* =====================  5. breakpoints  ===================== */

/* ≥480px — roomier stat grid */
@media (min-width: 480px) {
    .toolbar form { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
    .toolbar .btn, .form-row .btn { width: auto; }
    .form-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ≥640px */
@media (min-width: 640px) {
    .grid-stats, .stat-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .container { padding-left: var(--sp-4); padding-right: var(--sp-4); }
    .toolbar { align-items: flex-end; }
    .toolbar > form { flex: 0 1 auto; display: flex; flex-wrap: wrap; align-items: flex-end; }
    .toolbar form label.fld { min-width: 170px; }
    .toolbar form .btn { width: auto; }
    .toolbar > .btn, .toolbar > a.btn { flex: 0 0 auto; }
    .modal { align-items: center; padding: var(--sp-4); }
    .modal-box {
        width: min(100%, 520px); border-radius: var(--r-lg);
        animation: none; padding: var(--sp-5);
        max-height: 86dvh;
    }
    .modal-box::before { display: none; }
    .modal-actions { grid-template-columns: auto auto; justify-content: flex-end; }
    .modal-actions .btn { width: auto; min-width: 120px; }
}

/* ≥900px — shell switch: inline top nav, no bottom bar */
@media (min-width: 900px) {
    .nav-toggle { display: none; }
    .tabbar { display: none; }
    .container { padding-bottom: var(--sp-12); }
    .brand-long { display: inline; }
    .brand-text { font-size: var(--fs-lg); }
    .avatar-meta { display: block; }

    .grid-stats, .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .form-grid { grid-template-columns: 1fr 1fr 1fr; }

    .nav { display: flex; align-items: center; gap: 2px; margin-left: var(--sp-3); flex: 1; }
    .nav-link, .nav-grp-btn {
        display: inline-flex; align-items: center; gap: 3px;
        min-height: 38px; padding: 0 var(--sp-3);
        border: 0; background: none; cursor: pointer;
        color: var(--text-muted); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium);
        border-radius: var(--r-md); white-space: nowrap;
    }
    .nav-link:hover, .nav-grp-btn:hover { background: var(--surface-sunken); color: var(--text); }
    .nav-link.active, .nav-group.active > .nav-grp-btn { background: var(--primary-soft); color: var(--primary); font-weight: var(--fw-semi); }
    .nav-grp-btn .caret { font-size: .65em; opacity: .8; }
    .nav-group { position: relative; }
    .nav-drop {
        position: absolute; left: 0; top: calc(100% + 6px); z-index: var(--z-dropdown);
        min-width: 232px; padding: var(--sp-1);
        background: var(--surface-raised); border: 1px solid var(--border);
        border-radius: var(--r-lg); box-shadow: var(--sh-3);
    }
    .nav-drop a {
        display: flex; align-items: center; min-height: 40px; padding: 0 var(--sp-3);
        color: var(--text); font-size: var(--fs-sm); border-radius: var(--r-md);
    }
    .nav-drop a:hover { background: var(--surface-sunken); }
    .nav-drop a.active { background: var(--primary-soft); color: var(--primary); font-weight: var(--fw-semi); }

    .toolbar .btn, .form-row .btn { width: auto; }
    .tbl th, .tbl td { padding: var(--sp-2) var(--sp-3); }
    .table-wrap { max-height: calc(100dvh - 220px); }
    .toast-stack { left: auto; right: var(--sp-5); bottom: var(--sp-5); transform: none; }
}

/* =====================  6. table → cards on narrow screens  =====================
   Opt-in with class "stackable" on the table. Wide punch grids
   (.consol-tbl, .tbl--scroll) intentionally keep horizontal scrolling. */
@media (max-width: 899px) {
    .tbl.stackable, .tbl.stackable tbody, .tbl.stackable td { display: block; width: 100%; }
    .tbl.stackable tr { display: flex; flex-direction: column; width: 100%; }
    /* An avatar cell and the name become the card header, whatever their
       column order in the table. */
    /* A card with a photo gets a left avatar gutter; everything else sits
       to its right. Browsers without :has() fall back to a stacked avatar. */
    .tbl.stackable tr:has(td.cell-avatar) { position: relative; padding-left: calc(var(--sp-3) + 52px); }
    .tbl.stackable td.cell-avatar {
        order: -2; position: absolute; left: var(--sp-3); top: var(--sp-3);
        width: 40px; padding: 0; justify-content: flex-start;
    }
    .tbl.stackable td.cell-avatar::before { content: none; }
    .tbl.stackable td.rowname, .tbl.stackable td.cell-primary { order: -1; }
    .tbl.stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .tbl.stackable {
        border-collapse: separate; border-spacing: 0; background: transparent; font-size: var(--fs-sm);
    }
    .tbl.stackable tr {
        background: var(--surface-raised); border: 1px solid var(--border);
        border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-2);
        box-shadow: var(--sh-1);
    }
    .tbl.stackable tbody tr:nth-child(even) td,
    .tbl.stackable tbody tr:hover td { background: transparent; }
    .tbl.stackable td {
        display: flex; align-items: center; justify-content: space-between;
        gap: var(--sp-3); border: 0; padding: 3px 0; text-align: right;
    }
    .tbl.stackable td::before {
        content: attr(data-label);
        flex: 0 0 auto; text-align: left;
        font-size: var(--fs-xs); font-weight: var(--fw-semi);
        text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-muted);
    }
    .tbl.stackable td:empty { display: none; }
    .tbl.stackable td.cell-primary, .tbl.stackable td.rowname {
        font-size: var(--fs-lg); font-weight: var(--fw-semi);
        padding-bottom: var(--sp-2); margin-bottom: var(--sp-1);
        border-bottom: 1px solid var(--border);
    }
    .tbl.stackable td.cell-actions { justify-content: flex-start; flex-wrap: wrap; gap: var(--sp-2); padding-top: var(--sp-3); }
    .tbl.stackable td.cell-actions::before { flex-basis: 100%; margin-bottom: var(--sp-1); }
    .tbl.stackable .btn { margin-left: 0; }
    .table-wrap:has(.tbl.stackable) { overflow: visible; max-height: none; }
    .card:has(> .table-wrap > .tbl.stackable) {
        padding: 0; background: transparent; border: 0; box-shadow: none;
    }

    /* Wide grids that keep scrolling get a visible edge fade. */
    .table-wrap { max-height: none; }
    .consol-wrap, .no-fit-wrap { overflow-x: auto; }
}

/* very small phones: icons only in the tab bar */
@media (max-width: 359px) {
    .tab span:not(.ic) { display: none; }
}

/* =====================  7. htmx feedback  ===================== */
.htmx-indicator { opacity: 0; transition: opacity .12s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .btn { pointer-events: none; opacity: .75; }
.htmx-swapping { opacity: 0; transition: opacity .12s ease; }

/* =====================  8. motion  ===================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .skeleton { background: var(--surface-sunken); }
}

/* =====================  9. print (A4)  ===================== */
@page { size: A4 portrait; margin: 12mm 10mm; }

@media print {
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    :root {
        --surface: #fff; --surface-raised: #fff; --surface-sunken: #f2f2f2;
        --bg: #fff; --text: #000; --text-muted: #333; --border: #999;
        --primary: #1e40af; --primary-soft: #eef2fb;
    }
    body { background: #fff; font-size: 10pt; line-height: 1.3; }

    .topbar, .tabbar, .drawer, .drawer-scrim, .toast-stack, .progress,
    .no-print, .tabs, .toolbar, .btn, .chips, .skip-link, [x-cloak] { display: none !important; }

    .container { max-width: none; margin: 0; padding: 0; }
    .card { border: 0; box-shadow: none; padding: 0; border-radius: 0; margin: 0 0 6mm; }

    .report-head {
        display: block !important; text-align: center; margin-bottom: 5mm;
        border-bottom: 1.5px solid #000; padding-bottom: 2mm;
    }
    .report-head h1 { font-size: 14pt; margin: 0; color: #000; }
    .report-head .sub { font-size: 9pt; color: #333; }

    /* stacked tables print as real tables again */
    .tbl.stackable, .tbl.stackable tbody, .tbl.stackable td { display: revert !important; }
    .tbl.stackable tr { display: table-row !important; border: 0 !important; padding: 0 !important;
                        margin: 0 !important; box-shadow: none !important; }
    .tbl.stackable thead { position: static !important; width: auto !important; height: auto !important;
                           clip-path: none !important; display: table-header-group !important; }
    .tbl.stackable td::before { content: none !important; }
    .tbl.stackable td.cell-primary, .tbl.stackable td.rowname { font-size: inherit; border-bottom: 1px solid #999; }

    .table-wrap { overflow: visible !important; max-height: none !important; }
    .tbl { font-size: 8.5pt; }
    .tbl th, .tbl td { border: 1px solid #999; padding: 1.2mm 1.6mm; }
    .tbl thead th { position: static !important; background: #eee !important; color: #000 !important; font-size: 8pt; }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr, tbody.emp-block { break-inside: avoid; page-break-inside: avoid; }

    /* status survives a greyscale printer */
    .badge { border: 1px solid currentColor; background: transparent !important; padding: 0 1mm; font-size: 7.5pt; }

    .emp-head { display: flex; margin-bottom: 4mm; padding: 2mm; border-radius: 2mm;
                align-items: center; background: var(--primary-soft); }
    .emp-photo-xl, .emp-initial-xl { width: 18mm; height: 18mm; box-shadow: none; }
    .emp-head-name { font-size: 12pt; }
    .emp-head-sub { font-size: 9pt; }

    .consol-tbl th, .consol-tbl td { font-size: 6.5pt; padding: .4mm .6mm; }
    .tab-panel { display: none !important; }
    .tab-panel.active { display: block !important; }
    a[href]::after { content: none; }
}
