/* ==========================================================================
   Attendance — lightweight design system (2026-10)
   One cached stylesheet + self-hosted Lexend. No gradients, no shadows on
   lists, no hover animations: cheap to paint on low-end phones and old PCs.
   Part 1: app shell (applies to every admin page)
   Part 2: low-end performance overrides for legacy pages
   Part 3: components for redesigned pages (scoped under .ui)
   ========================================================================== */

:root {
    --ink: #1C2230;
    --ink-2: #4A5163;
    --muted: #6E7586;
    --canvas: #F3F4F7;
    --paper: #FFFFFF;
    --line: #DCDFE6;
    --line-soft: #E9EBF0;
    --accent: #5B3FD6;
    --accent-ink: #4630B0;
    --accent-wash: #EEEAFC;
    --ok: #16794A;   --ok-wash: #E3F3EA;
    --warn: #A15C07; --warn-wash: #FBEFD9;
    --bad: #A3302A;  --bad-wash: #F8E4E2;
    --side-w: 216px;
    --top-h: 52px;
    --r-sm: 6px;
    --r-md: 10px;
    --font: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Fonts: Lexend, self-hosted (cached after first visit) ---------- */
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/lexend-400.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/lexend-500.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/lexend-600.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 700 900; font-display: swap; src: url("fonts/lexend-700.woff2") format("woff2"); }

/* ---------- Part 1: shell ---------- */
/* One font everywhere, including legacy pages (icon fonts are restored below) */
html, body, button, input, select, textarea, optgroup, option, table, th, td,
h1, h2, h3, h4, h5, h6, p, span, div, a, label, small, strong, b, li, dialog, .btn, .form-control, .form-select {
    font-family: var(--font) !important;
}
.fa, .fas, .far, .fa-solid, .fa-regular, [class^="fa-"], [class*=" fa-"] { font-family: "Font Awesome 6 Free" !important; }
.fab, .fa-brands { font-family: "Font Awesome 6 Brands" !important; }

body {
    margin: 0 0 0 var(--side-w) !important;
    padding-top: 0 !important;
    background: var(--canvas) !important;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
.navbar.fixed-top, nav.navbar { display: none !important; }

.ic { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* The sidebar is locked down with #id selectors so page CSS (Bootstrap,
   resets, old inline styles) can't change its size or spacing.
   It must look identical on every page. */
#appSidebar, #appSidebar * { box-sizing: border-box !important; margin: 0; letter-spacing: normal; text-transform: none; }
#appSidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); z-index: 1000;
    background: var(--paper); border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    font-size: 14px !important; line-height: 20px !important; color: var(--ink); text-align: left;
}
#appSidebar .sb-brand { height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); font-size: 15px; font-weight: 700; color: var(--ink); }
#appSidebar .sb-mark { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
#appSidebar .sb-mark .ic { width: 16px; height: 16px; vertical-align: 0; }
#appSidebar .sb-nav { flex: 1 1 auto; overflow-y: auto; padding: 8px; display: block; }
#appSidebar .sb-group { display: block; margin: 14px 10px 4px; padding: 0; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); }
#appSidebar .sb-link {
    display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; margin: 0 0 2px;
    border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none !important;
    font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; border: 0; background: transparent;
}
#appSidebar .sb-link .ic { vertical-align: 0; }
#appSidebar .sb-link:hover { background: var(--canvas); color: var(--ink); }
#appSidebar .sb-link.is-active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
#appSidebar .sb-link.is-active .ic { color: var(--accent); }
#appSidebar .sb-user { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 14px; border-top: 1px solid var(--line-soft); }
#appSidebar .sb-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; line-height: 1; font-weight: 700; }
#appSidebar .sb-who { flex: 1 1 auto; min-width: 0; display: block; line-height: 16px; }
#appSidebar .sb-who b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#appSidebar .sb-who small { display: block; font-size: 12px; color: var(--muted); }
#appSidebar .sb-out { flex: 0 0 auto; color: var(--muted); padding: 6px; border-radius: var(--r-sm); display: flex; }
#appSidebar .sb-out:hover { color: var(--bad); background: var(--bad-wash); }

.sb-toggle { display: none !important; position: fixed; top: 10px; left: 10px; z-index: 1001; width: 40px; height: 40px; padding: 0; margin: 0; box-sizing: border-box; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); color: var(--ink); place-items: center; cursor: pointer; }
.sb-scrim { display: none; }

/* Legacy pages: unboxed container that fills the width */
.container, .container-fluid, .main-container {
    max-width: none !important; width: 100% !important; margin: 0 !important;
    padding: 20px !important; background: transparent !important;
    border-radius: 0 !important; box-shadow: none !important; border: none !important;
}

@media (max-width: 900px) {
    body { margin-left: 0 !important; padding-top: 52px !important; }
    #appSidebar { transform: translateX(-100%); }
    #appSidebar.is-open { transform: none; }
    #appSidebar.is-open + .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(28,34,48,.35); z-index: 999; }
    .sb-toggle { display: grid !important; }
}

/* ---------- Part 2: low-end overrides (all pages) ---------- */
/* backdrop-filter and hover lifts are the most expensive things on weak GPUs */
*, *::before, *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.btn:hover, .card:hover, [class*="-card"]:hover, [class*="-item"]:hover, .quick-action-btn:hover { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Part 3: components (.ui) ---------- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ui { padding: 20px 24px 48px; max-width: 1360px; font-size: 14px; line-height: 1.45; color: var(--ink); }
.ui *, .dlg *, .ui *::before, .dlg *::before, .ui *::after, .dlg *::after { box-sizing: border-box; }
.ui h1, .dlg h1 { font-size: 22px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.015em; }
.ui p, .dlg p { margin: 0; }
.ui a, .dlg a { color: var(--accent-ink); }
.ui .num, .dlg .num { font-variant-numeric: tabular-nums; }
.ui .muted, .dlg .muted { color: var(--muted); }
.ui .head, .dlg .head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ui .head p, .dlg .head p { color: var(--muted); margin-top: 4px; }
.ui .head-actions, .dlg .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.ui .b, .dlg .b { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.ui .b:hover, .dlg .b:hover { background: var(--canvas); }
.ui .b:focus-visible, .dlg .b:focus-visible, .ui input:focus-visible, .dlg input:focus-visible, .ui select:focus-visible, .dlg select:focus-visible, .ui textarea:focus-visible, .dlg textarea:focus-visible, .ui .seg a:focus-visible, .dlg .seg a:focus-visible, .ui .pg:focus-visible, .dlg .pg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui .b-primary, .dlg .b-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui .b-primary:hover, .dlg .b-primary:hover { background: var(--accent-ink); }
.ui .b-danger, .dlg .b-danger { color: var(--bad); }
.ui .b-danger:hover, .dlg .b-danger:hover { background: var(--bad-wash); border-color: #EBC3BF; }
.ui .b-danger-solid, .dlg .b-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.ui .b-danger-solid:hover, .dlg .b-danger-solid:hover { background: #8A2722; }
.ui .b-ghost, .dlg .b-ghost { border-color: transparent; background: transparent; }
.ui .b-icon, .dlg .b-icon { width: 32px; height: 32px; padding: 0; color: var(--ink-2); }
.ui .b-sm, .dlg .b-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.ui .b[disabled], .dlg .b[disabled], .ui .b.is-busy, .dlg .b.is-busy { opacity: .55; cursor: not-allowed; }
.ui .b.is-busy .ic, .dlg .b.is-busy .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented status filter */
.ui .seg, .dlg .seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.ui .seg a, .dlg .seg a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.ui .seg a:hover, .dlg .seg a:hover { background: var(--canvas); color: var(--ink); }
.ui .seg a.is-on, .dlg .seg a.is-on { background: var(--ink); color: #fff; }
.ui .seg .n, .dlg .seg .n { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.ui .seg a.is-on .n, .dlg .seg a.is-on .n { color: #C9CCE0; }
.ui .dot, .dlg .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ui .dot.ok, .dlg .dot.ok { background: var(--ok); }
.ui .dot.warn, .dlg .dot.warn { background: #D88A16; }
.ui .dot.bad, .dlg .dot.bad { background: var(--bad); }

/* Toolbar */
.ui .bar, .dlg .bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ui .bar .grow, .dlg .bar .grow { flex: 1; }
.ui .field, .dlg .field { position: relative; }
.ui .field > .ic, .dlg .field > .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ui input[type=text], .dlg input[type=text], .ui input[type=search], .dlg input[type=search], .ui input[type=date], .dlg input[type=date], .ui input[type=number], .dlg input[type=number], .ui select, .dlg select, .ui textarea, .dlg textarea { height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; padding: 0 10px; width: 100%; min-width: 0; }
.ui textarea, .dlg textarea { height: auto; padding: 8px 10px; resize: vertical; }
.ui .field input, .dlg .field input { padding-left: 32px; }
.ui .search, .dlg .search { width: 340px; }
.ui .filter-emp, .dlg .filter-emp { width: 220px; }

/* Bulk selection strip */
.ui .selbar, .dlg .selbar { display: none; align-items: center; gap: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--ink); color: #fff; border-radius: var(--r-md); }
.ui .selbar.is-on, .dlg .selbar.is-on { display: flex; }
.ui .selbar .grow, .dlg .selbar .grow { flex: 1; font-weight: 600; }
.ui .selbar .b, .dlg .selbar .b { height: 30px; background: transparent; color: #fff; border-color: #4A5163; }
.ui .selbar .b:hover, .dlg .selbar .b:hover { background: #2D3446; }
.ui .selbar .b-danger-solid, .dlg .selbar .b-danger-solid { background: var(--bad); border-color: var(--bad); }

/* Table */
.ui .panel, .dlg .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ui .tbl-wrap, .dlg .tbl-wrap { overflow-x: auto; }
.ui table.tbl, .dlg table.tbl { width: 100%; border-collapse: collapse; }
.ui .tbl th, .dlg .tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFAFC; white-space: nowrap; }
.ui .tbl td, .dlg .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ui .tbl tr:last-child td, .dlg .tbl tr:last-child td { border-bottom: 0; }
.ui .tbl tbody tr:hover td, .dlg .tbl tbody tr:hover td { background: #FAFAFD; }
.ui .tbl tr.is-sel td, .dlg .tbl tr.is-sel td { background: var(--accent-wash); }
.ui .tbl .c-check, .dlg .tbl .c-check { width: 40px; padding-right: 0; }
.ui .tbl .c-act, .dlg .tbl .c-act { width: 1%; white-space: nowrap; text-align: right; }
.ui .tbl input[type=checkbox], .dlg .tbl input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.ui .who b, .dlg .who b { display: block; font-weight: 650; }
.ui .who small, .dlg .who small { color: var(--muted); }
.ui .who .unknown, .dlg .who .unknown { color: var(--bad); }
.ui .reason, .dlg .reason { color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui .tag, .dlg .tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.ui .tag.active, .dlg .tag.active, .ui .tag.ok, .dlg .tag.ok { background: var(--ok-wash); color: var(--ok); }
.ui .tag.upcoming, .dlg .tag.upcoming, .ui .tag.scheduled, .dlg .tag.scheduled { background: var(--warn-wash); color: var(--warn); }
.ui .tag.expired, .dlg .tag.expired, .ui .tag.inactive, .dlg .tag.inactive { background: var(--bad-wash); color: var(--bad); }
.ui .tag.auto, .dlg .tag.auto { background: var(--canvas); color: var(--ink-2); font-weight: 600; }

/* The shift bar: 24h track with the shift drawn on it */
.ui .shift, .dlg .shift { position: relative; display: block; width: 120px; height: 6px; border-radius: 3px; margin-top: 6px; background: repeating-linear-gradient(90deg, var(--line-soft) 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.ui .shift i, .dlg .shift i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.ui .shift.is-empty, .dlg .shift.is-empty { background: var(--line-soft); }
.ui .ts-name, .dlg .ts-name { font-weight: 600; }
.ui .ts-time, .dlg .ts-time { color: var(--muted); font-size: 13px; }

/* Weekly strip (recurring) */
.ui .week, .dlg .week { display: grid; grid-template-columns: repeat(7, minmax(52px, 1fr)); gap: 4px; min-width: 390px; }
.ui .wd, .dlg .wd { border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 4px 6px 6px; font-size: 11.5px; line-height: 1.2; color: var(--muted); background: #FBFBFD; }
.ui .wd b, .dlg .wd b { display: block; color: var(--ink-2); font-size: 12px; }
.ui .wd.on, .dlg .wd.on { background: var(--paper); border-color: var(--line); color: var(--ink); }
.ui .wd .shift, .dlg .wd .shift { width: 100%; height: 4px; margin-top: 4px; }

/* Pager + footer */
.ui .foot, .dlg .foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); background: #FAFAFC; flex-wrap: wrap; }
.ui .foot select, .dlg .foot select { width: auto; height: 30px; }
.ui .pager, .dlg .pager { display: flex; gap: 4px; align-items: center; }
.ui .pg, .dlg .pg { min-width: 30px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.ui a.pg:hover, .dlg a.pg:hover { background: var(--canvas); }
.ui .pg.is-current, .dlg .pg.is-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.ui .pg-gap, .dlg .pg-gap { color: var(--muted); padding: 0 2px; }
.ui .empty, .dlg .empty { padding: 48px 20px; text-align: center; }
.ui .empty h2, .dlg .empty h2 { font-size: 16px; margin: 0 0 6px; }
.ui .empty p, .dlg .empty p { color: var(--muted); margin-bottom: 16px; }
.ui .region, .dlg .region { transition: opacity .12s; }
.ui .region.is-loading, .dlg .region.is-loading { opacity: .5; pointer-events: none; }

/* Notices */
.ui .note, .dlg .note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.ui .note.ok, .dlg .note.ok { background: var(--ok-wash); border-color: #BFE0CC; color: #0F5534; }
.ui .note.bad, .dlg .note.bad { background: var(--bad-wash); border-color: #EBC3BF; color: #7A211C; }
.ui .note .grow, .dlg .note .grow { flex: 1; }
.ui .note button, .dlg .note button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.ui .note-inline, .dlg .note-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; margin-bottom: 12px; border: 1px dashed #E2B9B5; border-radius: var(--r-md); color: var(--bad); background: #FFFBFA; font-weight: 500; flex-wrap: wrap; }

/* Dialogs (native <dialog>) */
dialog.dlg { border: 0; padding: 0; border-radius: 12px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--ink); font-family: var(--font); font-size: 14px; box-shadow: 0 18px 50px rgba(28,34,48,.28); }
dialog.dlg.sm { width: min(420px, calc(100vw - 24px)); }
dialog.dlg.lg { width: min(780px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(28,34,48,.45); }
.dlg form, .dlg .dlg-in { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.dlg-h h2 { margin: 0; font-size: 16px; font-weight: 700; }
.dlg-b { padding: 16px 18px; overflow-y: auto; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-soft); background: #FAFAFC; }
.dlg-f .spacer { flex: 1; }
.dlg .grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.dlg .s6 { grid-column: span 6; }
.dlg .s4 { grid-column: span 4; }
.dlg .s3 { grid-column: span 3; }
.dlg .s2 { grid-column: span 2; }
.dlg label.lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.dlg .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.dlg .section { margin: 18px 0 8px; font-weight: 700; font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.dlg .section small { font-weight: 500; color: var(--muted); }
.dlg .ctx { background: var(--canvas); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg .ctx b { display: block; }
.dlg .ctx small { color: var(--muted); }

/* Employee picker */
.picker { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.picker-top { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line-soft); background: #FAFAFC; align-items: center; }
.picker-top .field { flex: 1; }
.picker-list { max-height: 228px; overflow-y: auto; contain: content; }
.pk { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.pk:last-child { border-bottom: 0; }
.pk:hover { background: #FAFAFD; }
.pk input { width: 16px; height: 16px; accent-color: var(--accent); }
.pk span { flex: 1; }
.pk small { color: var(--muted); }
.picker-count { font-weight: 700; font-size: 13px; color: var(--accent-ink); white-space: nowrap; }
.picker-empty { padding: 16px; color: var(--muted); text-align: center; }

/* Day rows in schedule forms */
.dayrow { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.dayrow:last-child { border-bottom: 0; }
.dayrow b { font-weight: 600; }
.dayrow.on b { color: var(--accent-ink); }
.dayrow .shift { width: 100%; grid-column: 2; margin-top: 0; }
.day-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.view-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.view-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.view-meta small { display: block; color: var(--muted); }
.confirm-input { text-align: center; font-weight: 700; letter-spacing: .12em; }
.bd-block { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px; margin-bottom: 10px; }
.bd-block h3 { margin: 0 0 8px; font-size: 14px; }
.bd-row { display: flex; gap: 8px; flex-wrap: wrap; }
.bd-row > select, .bd-row > input { flex: 1; min-width: 160px; }

@media (max-width: 760px) {
    .ui { padding: 14px 12px 40px; }
    .ui .search, .dlg .search, .ui .filter-emp, .dlg .filter-emp { width: 100%; }
    .ui .bar > *, .dlg .bar > * { flex: 1 1 100%; }
    .ui .seg, .dlg .seg { width: 100%; }
    .ui .seg a, .dlg .seg a { flex: 1; justify-content: center; padding: 6px 6px; }
    .dlg .s3, .dlg .s2, .dlg .s4 { grid-column: span 6; }
    .dayrow { grid-template-columns: 1fr; gap: 4px; }
    .dayrow .shift { grid-column: 1; }
    .view-meta { grid-template-columns: 1fr; }

    /* table becomes stacked rows on phones */
    .ui .tbl thead, .dlg .tbl thead { display: none; }
    .ui .tbl, .dlg .tbl, .ui .tbl tbody, .dlg .tbl tbody, .ui .tbl tr, .dlg .tbl tr, .ui .tbl td, .dlg .tbl td { display: block; width: 100%; }
    .ui .tbl tr, .dlg .tbl tr { border-bottom: 1px solid var(--line); padding: 8px 4px; position: relative; }
    .ui .tbl td, .dlg .tbl td { border: 0; padding: 4px 8px; }
    .ui .tbl td.c-check, .dlg .tbl td.c-check { position: absolute; left: 0; top: 10px; width: 36px; }
    .ui .tbl td.c-check + td, .dlg .tbl td.c-check + td { padding-left: 36px; }
    .ui .tbl td.c-act, .dlg .tbl td.c-act { text-align: left; }
    .ui .tbl td[data-l]::before, .dlg .tbl td[data-l]::before { content: attr(data-l); display: block; font-size: 12px; color: var(--muted); }
    .ui .week, .dlg .week { min-width: 0; grid-template-columns: repeat(7, 1fr); }
}
