/* ============================================================================
   SafeScan · Aria design system
   A single, token-driven stylesheet. English, LTR, light + calm teal.
   Structure:
     1. Fonts            6. Topbar           11. Tables         16. Auth
     2. Tokens           7. Buttons          12. Status/badges  17. Scan
     3. Base/typography  8. Cards/panels     13. Metrics        18. Specialized
     4. App shell        9. Forms            14. Empty states   19. Utilities
     5. Sidebar         10. Alerts/flash     15. Modals         20. Responsive
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/IBMPlexSansArabic-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/IBMPlexSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

/* 2. Tokens --------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Neutrals — cool greys drawn from the mark's light swoosh (#e4e5e7) */
    --bg: #f4f6f8;
    --bg-soft: #eceff4;
    --surface: #ffffff;
    --surface-2: #f3f5f9;
    --surface-3: #e8ecf3;
    --ink: #16212b;
    --ink-soft: #2b3947;
    --body: #43505f;
    --muted: #64748b;
    --muted-strong: #566372;
    --muted-soft: #6b7688;
    --border: #e4e8ee;
    --border-strong: #d3dae2;

    /* Brand — the company mark's deep navy.
       --primary-600 IS the logo navy; --primary is lifted one step so it stays legible
       as a link/accent on white, and --primary-700 is the deep stop for gradients and
       active text. White text is safe on 600 and 700 (both well past 7:1). */
    --primary: #1d3c7a;
    --primary-600: #152c5e;
    --primary-700: #0e1e42;
    --primary-soft: #e3e8f2;
    --primary-softer: #f1f4f9;
    --on-primary: #ffffff;
    /* Raw channels of the logo navy, for the rgba() tints below. */
    --primary-rgb: 21, 44, 94;

    /* Semantic */
    --success: #16a34a;
    --success-soft: #e7f6ec;
    --warning: #d97706;
    --warning-soft: #fbefd9;
    --danger: #e11d48;
    --danger-soft: #fce7ec;
    --info: #2563eb;
    --info-soft: #e7effe;
    --indigo: #6366f1;
    --indigo-soft: #ecedfd;
    --accent: #ea580c;
    --accent-soft: #fdeadf;

    /* Radii — clean, moderate */
    --r-xs: 6px;
    --r-sm: 8px;
    --r: 10px;
    --r-md: 12px;
    --r-lg: 14px;
    --r-xl: 20px;
    --pill: 999px;

    /* Shadows — layered (ambient + direct) so edges read cleanly on light surfaces */
    --shadow-xs: 0 1px 2px rgba(16, 33, 43, .04);
    --shadow-sm: 0 1px 2px rgba(16, 33, 43, .05), 0 1px 3px rgba(16, 33, 43, .04);
    --shadow: 0 1px 2px rgba(16, 33, 43, .04), 0 4px 14px rgba(16, 33, 43, .06);
    --shadow-md: 0 1px 2px rgba(16, 33, 43, .04), 0 4px 10px rgba(16, 33, 43, .05), 0 12px 30px rgba(16, 33, 43, .07);
    --shadow-lg: 0 2px 4px rgba(16, 33, 43, .05), 0 8px 20px rgba(16, 33, 43, .07), 0 24px 50px rgba(16, 33, 43, .10);
    --shadow-primary: 0 8px 20px -6px rgba(var(--primary-rgb), .4);
    --ring: 0 0 0 3px rgba(var(--primary-rgb), .25);

    /* Layout — top-nav, centered comfy canvas */
    --topnav-h: 58px;
    --topbar-h: 58px;
    --header-h: 104px;
    --sidebar-w: 264px;
    --sidebar-collapsed-w: 78px;
    --page-max: 1360px;
    --gutter: 28px;
    --gutter-sm: 16px;

    --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --transition: 160ms cubic-bezier(.4, 0, .2, 1);
    --z-dropdown: 1000; --z-sticky: 1030; --z-toast: 1080; --z-skip: 2000;
}

/* 3. Base / typography ---------------------------------------------------- */
* { box-sizing: border-box; }

html {
    min-height: 100%;
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 8px);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100dvh;
    margin: 0;
    color: var(--body);
    font-family: var(--font-sans);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(var(--primary-rgb), .05), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, rgba(var(--primary-rgb), .04), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.015em; }
h1 { letter-spacing: -.01em; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-700); }

img, svg { max-width: 100%; vertical-align: middle; }

strong, b { font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; opacity: 1; }

::selection { background: var(--primary-soft); color: var(--primary-700); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.tabular, .visual-code, .request-id { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.text-secondary { color: var(--muted) !important; }
.text-danger { color: var(--danger) !important; }
.max-w-220 { max-width: 220px; }

/* Page headers */
.page-title { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); font-weight: 700; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.page-kicker { color: var(--muted); font-size: .975rem; margin: .35rem 0 0; max-width: 62ch; }
.page-kicker.small { font-size: .85rem; }

.page-header {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
    justify-content: space-between; margin-bottom: 1.5rem;
}

.section-header, .section-mini-title {
    display: flex; align-items: center; gap: .55rem;
    font-weight: 700; color: var(--ink); margin-bottom: 1rem;
}
.section-mini-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.skip-link {
    position: fixed; inset-block-start: -60px; inset-inline-start: 16px; z-index: var(--z-skip);
    background: var(--primary-600); color: #fff; padding: .6rem 1rem; border-radius: var(--r-sm);
    box-shadow: var(--shadow-md); transition: inset-block-start var(--transition);
}
.skip-link:focus { inset-block-start: 16px; color: #fff; }

/* Material Symbols sizing (used alongside bootstrap-icons) */
.material-symbols-outlined { font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; vertical-align: middle; line-height: 1; }

/* 4. App shell + top navigation ------------------------------------------ */
.app-container { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter); }

.app-main { min-height: calc(100dvh - var(--topnav-h)); display: flex; flex-direction: column; }
.page-container { flex: 1 1 auto; padding-block: 1.75rem 2.5rem; }
main:focus { outline: none; }

.app-footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .82rem; padding-block: 1rem; }
.app-footer .app-container { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* Top navigation bar */
.topnav {
    position: sticky; inset-block-start: 0; z-index: var(--z-sticky);
    background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.6) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topnav-row1 { display: flex; align-items: center; gap: 1rem; min-height: var(--topnav-h); }

.topnav-brand { display: inline-flex; align-items: center; gap: .65rem; flex: 0 0 auto; color: var(--ink); }
.topnav-brand:hover { color: var(--ink); }
.brand-mark {
    flex: 0 0 auto; display: inline-grid; place-items: center; width: 38px; height: 38px;
    border-radius: var(--r); color: #fff; font-size: 1.1rem;
    background: linear-gradient(150deg, var(--primary), var(--primary-700)); box-shadow: var(--shadow-primary);
}
/* An uploaded logo brings its own colours — a navy company mark on the navy plate would
   vanish — so the plate becomes a light card and the artwork fills it edge to edge. */
.brand-mark:has(img) {
    background: #fff; border: 1px solid var(--border);
    box-shadow: var(--shadow-xs); padding: 3px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
/* Admin-editable name — cap it so a long one cannot crowd out the nav rail. */
.brand-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); max-width: 22ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-subtitle { font-size: .68rem; letter-spacing: .03em; color: var(--muted); }

.topnav-row2 { border-top: 1px solid var(--border); }
.topnav-row2 .appnav { height: 46px; align-items: stretch; }
.topnav-row2 .appnav-link { border-radius: 0; padding-block: 0; }
.topnav-row2 .appnav-link:hover { background: var(--primary-softer); }
.topnav-row2 .appnav-link.active::after { inset-inline: .7rem; inset-block-end: 0; height: 2.5px; border-radius: 3px 3px 0 0; }
.topnav-row2 .appnav-more > summary { height: 100%; }
.appnav { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.appnav-link {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .5rem .7rem; border-radius: var(--r-sm); color: var(--body);
    font-size: .88rem; font-weight: 600; position: relative; cursor: pointer;
    transition: color var(--transition), background var(--transition);
}
.appnav-link i { font-size: 1rem; }
.appnav-link:hover { color: var(--ink); background: var(--surface-2); }
.appnav-link.active { color: var(--primary-700); }
.appnav-link.active::after {
    content: ""; position: absolute; inset-inline: .55rem; inset-block-end: 0;
    height: 2.5px; border-radius: 3px; background: var(--primary);
}

.appnav-more { position: relative; }
.appnav-more > summary { list-style: none; }
.appnav-more > summary::-webkit-details-marker { display: none; }
.appnav-caret { font-size: .7rem !important; transition: transform var(--transition); }
.appnav-more[open] .appnav-caret { transform: rotate(180deg); }
.appnav-menu {
    position: absolute; inset-block-start: calc(100% + .55rem); inset-inline-end: 0; z-index: var(--z-dropdown);
    min-width: 220px; padding: .4rem; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; gap: .1rem;
}
.appnav-menu-link {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem;
    border-radius: var(--r-sm); color: var(--body); font-size: .88rem; font-weight: 500;
}
.appnav-menu-link i { color: var(--muted); width: 18px; text-align: center; }
.appnav-menu-link:hover { background: var(--surface-2); color: var(--ink); }
.appnav-menu-link.active { color: var(--primary-700); background: var(--primary-softer); }
.appnav-menu-link.active i { color: var(--primary); }

.topnav-actions { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; flex: 0 0 auto; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-chip {
    display: inline-flex; align-items: center; gap: .55rem; cursor: pointer;
    padding: .28rem .55rem .28rem .3rem; border-radius: var(--pill);
    background: var(--surface-2); border: 1px solid var(--border);
}
.user-chip:hover { border-color: var(--border-strong); }
.avatar {
    flex: 0 0 auto; display: inline-grid; place-items: center; width: 34px; height: 34px;
    border-radius: 50%; color: #fff; font-weight: 700; font-size: .9rem;
    background: linear-gradient(150deg, var(--primary-600), var(--primary-700));
}
.user-chip-copy { flex-direction: column; line-height: 1.15; min-width: 0; text-align: start; }
.user-chip-copy .fw-semibold { font-size: .82rem; color: var(--ink); white-space: nowrap; }
.user-chip-copy .small { font-size: .7rem; }
.user-menu-caret { font-size: .7rem; color: var(--muted); }
.user-menu-panel {
    position: absolute; inset-block-start: calc(100% + .55rem); inset-inline-end: 0; z-index: var(--z-dropdown);
    min-width: 240px; padding: .4rem; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.user-menu-head { padding: .55rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.user-menu-form { margin: 0; }
.user-menu-link {
    display: flex; align-items: center; gap: .6rem; width: 100%; text-align: start;
    padding: .55rem .7rem; border-radius: var(--r-sm); color: var(--body);
    font-size: .88rem; font-weight: 500; background: transparent; border: 0; cursor: pointer;
}
.user-menu-link i { color: var(--muted); width: 18px; text-align: center; }
.user-menu-link:hover { background: var(--surface-2); color: var(--ink); }
.user-menu-danger { color: var(--danger); }
.user-menu-danger i { color: var(--danger); }
.user-menu-danger:hover { background: var(--danger-soft); color: var(--danger); }

.topbar-search {
    display: flex; align-items: center; gap: .5rem; flex: 0 1 260px; min-width: 0; max-width: 300px;
    padding: 0 .8rem; height: 38px; border-radius: var(--pill);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.topbar-search:focus-within { border-color: var(--primary); box-shadow: var(--ring); background: #fff; }
.topbar-search i { flex: 0 0 auto; }
.topbar-search .form-control { border: 0; background: transparent; padding: 0; height: auto; box-shadow: none; font-size: .88rem; }
.topbar-search .form-control:focus { box-shadow: none; }

.btn-icon {
    display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto;
    border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2);
    color: var(--ink-soft); font-size: 1.05rem; cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-icon:hover { background: var(--primary-soft); color: var(--primary-700); border-color: transparent; }

/* 7. Buttons -------------------------------------------------------------- */
.btn {
    --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bd: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 44px; padding: .55rem 1.15rem; border-radius: var(--r);
    font-weight: 600; font-size: .925rem; line-height: 1.2; cursor: pointer;
    border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); }
.btn i, .btn .material-symbols-outlined { font-size: 1.05em; }
.btn.disabled, .btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 36px; padding: .35rem .8rem; font-size: .82rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 52px; padding: .8rem 1.5rem; font-size: 1.02rem; border-radius: var(--r-md); }

.btn-primary {
    --btn-fg: var(--on-primary); --btn-bd: transparent;
    background: linear-gradient(150deg, var(--primary-600), var(--primary-700));
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: linear-gradient(150deg, var(--primary), var(--primary-600)); box-shadow: 0 10px 24px -6px rgba(var(--primary-rgb), .5); color: #fff; transform: translateY(-1px); }

.btn-success { --btn-fg: #fff; --btn-bd: transparent; background: linear-gradient(150deg, #15803d, #166534); box-shadow: 0 8px 18px -6px rgba(22, 101, 52, .45); }
.btn-success:hover { color: #fff; transform: translateY(-1px); }
.btn-danger { --btn-fg: #fff; --btn-bd: transparent; background: linear-gradient(150deg, #dc2626, #b91c1c); box-shadow: 0 8px 18px -6px rgba(185, 28, 28, .4); }
.btn-danger:hover { color: #fff; transform: translateY(-1px); }
.btn-light { --btn-bg: var(--surface-2); --btn-fg: var(--ink-soft); --btn-bd: var(--border); }
.btn-light:hover { background: var(--surface-3); }

.btn-outline-primary { --btn-bg: transparent; --btn-fg: var(--primary-700); --btn-bd: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-soft); color: var(--primary-700); }
.btn-outline-secondary { --btn-bg: transparent; --btn-fg: var(--ink-soft); --btn-bd: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn-outline-danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn-icon-sm { display: inline-flex; align-items: center; gap: .35rem; width: auto; min-height: 40px; height: auto; padding: .32rem .6rem; border-radius: var(--r-sm); }
.btn-icon-sm:has(.btn-action-label) { justify-content: flex-start; }
.btn-action-label { font-weight: 600; font-size: .78rem; white-space: nowrap; }

/* Legacy "stitch" buttons → map to nova buttons */
.stitch-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.15rem; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; transition: var(--transition); }
.stitch-button:hover { background: var(--surface-2); color: var(--ink); }
.stitch-button-primary { border-color: transparent; color: #fff; background: linear-gradient(150deg, var(--primary-600), var(--primary-700)); box-shadow: var(--shadow-primary); }
.stitch-button-primary:hover { color: #fff; transform: translateY(-1px); }
.stitch-button-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-700); }
.stitch-button-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.stitch-button-ghost:hover { background: var(--surface-2); }

/* 8. Cards / panels ------------------------------------------------------- */
.app-card,
.data-panel, .detail-panel, .filter-panel, .settings-panel, .narrow-panel, .single-panel,
.stitch-panel, .stitch-report-card, .stitch-stat-card, .stitch-pairing-card, .stitch-qr-panel,
.kiosk-panel, .kiosk-qr-card, .kiosk-time-card, .kiosk-countdown-card, .kiosk-map-panel,
.kiosk-side-panel, .kiosk-details-section, .device-security-panel, .device-health-panel,
.device-spec-panel, .qr-panel, .qr-settings-panel, .connection-log-panel, .network-probe,
.hours-report-panel, .hours-period-card, .branch-score-card, .schedule-card, .report-section,
.security-tier-card, .office-map-shell, .bulk-assign-panel, .status-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); padding: 1.5rem;
}
.app-card { position: relative; }
.surface { background: var(--surface); border-radius: var(--r-lg); }

.card-header-clean {
    display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start;
    justify-content: space-between; margin-bottom: 1.25rem;
    padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.card-header-clean h2 { font-size: 1.1rem; margin: 0; }
.card-header-clean > div:first-child { min-width: 0; }

.dashboard-hero {
    display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; justify-content: space-between;
    margin-bottom: 1.75rem; padding: 1.75rem; border-radius: var(--r-xl);
    background:
        radial-gradient(700px 240px at 100% 0%, rgba(var(--primary-rgb), .09), transparent 70%),
        linear-gradient(135deg, #ffffff, var(--surface-3));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.dashboard-hero .page-kicker { color: var(--muted); }

/* 9. Forms ---------------------------------------------------------------- */
.form-label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink-soft); margin-bottom: .4rem; }
.form-hint, .form-text, .form-hint { color: var(--muted-strong); font-size: .8rem; margin-top: .35rem; }

.form-control, .form-select {
    width: 100%; min-height: 46px; padding: .6rem .9rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
    font-size: .95rem; font-family: inherit; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); background: #fff; }
.form-control:disabled, .form-select:disabled { background: var(--surface-2); color: var(--muted); opacity: .6; cursor: not-allowed; }
textarea.form-control { min-height: 110px; }

.form-select { background-position: left .9rem center; padding-inline-start: 2.2rem; }

.input-group-text { display: inline-flex; align-items: center; padding: 0 .9rem; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); border-radius: var(--r); }

.form-check-input { width: 1.15em; height: 1.15em; margin-top: .2em; border: 1.5px solid var(--border-strong); border-radius: .35em; cursor: pointer; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: var(--ring); border-color: var(--primary); }
.form-check-label { color: var(--body); font-size: .9rem; }
.form-switch .form-check-input { border-radius: var(--pill); }

.form-section, .form-section {
    padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface-2); margin-bottom: 1.25rem;
}

.is-error, .form-control.is-error { border-color: var(--danger); }
.is-ok, .form-control.is-ok { border-color: var(--success); }
.is-warning, .form-control.is-warning { border-color: var(--warning); }
.validation-summary-valid, .alert.validation-summary-valid { display: none !important; }

.auth-form-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* 10. Alerts / flash ------------------------------------------------------ */
.alert {
    display: flex; align-items: flex-start; gap: .7rem; padding: .9rem 1.1rem;
    border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2);
    color: var(--ink-soft); font-size: .92rem; margin-bottom: 1rem;
}
.alert i, .alert .material-symbols-outlined { flex: 0 0 auto; font-size: 1.15rem; margin-top: .05rem; }
.alert-success { background: var(--success-soft); border-color: transparent; color: #0b6b4f; }
.alert-danger { background: var(--danger-soft); border-color: transparent; color: #b32446; }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: #8a5410; }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--primary-700); }

.app-flash-stack {
    position: fixed; inset-block-start: 1rem; inset-inline-end: 1rem; z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: .6rem; width: min(380px, calc(100vw - 2rem));
}
.app-flash {
    display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1rem;
    background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary);
    border-radius: var(--r-md); box-shadow: var(--shadow-md); animation: appSlideUp .3s ease both;
}
.app-flash-icon { flex: 0 0 auto; font-size: 1.2rem; line-height: 1; }
.app-flash-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.app-flash-body strong { color: var(--ink); font-size: .9rem; }
.app-flash-body span { color: var(--muted); font-size: .82rem; }
.app-flash-success { border-inline-start-color: var(--success); } .app-flash-success .app-flash-icon { color: var(--success); }
.app-flash-danger { border-inline-start-color: var(--danger); } .app-flash-danger .app-flash-icon { color: var(--danger); }
.app-flash-warning { border-inline-start-color: var(--warning); } .app-flash-warning .app-flash-icon { color: var(--warning); }
.app-flash-info { border-inline-start-color: var(--info); } .app-flash-info .app-flash-icon { color: var(--info); }

/* 11. Tables -------------------------------------------------------------- */
.table-toolbar, .table-actions, .stitch-toolbar, .report-filter-actions, .network-helper-actions {
    display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between;
    margin-bottom: 1.1rem;
}
.table-toolbar h2, .stitch-toolbar h2 { font-size: 1.05rem; margin: 0; }
.table-search, .stitch-search { max-width: 280px; }

.table-responsive, .stitch-table-wrap { width: 100%; overflow-x: auto; border-radius: var(--r-md); }

.table, .stitch-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; color: var(--body); }
.table thead th, .stitch-table thead th {
    text-align: start; font-weight: 600; font-size: .78rem; letter-spacing: .02em; text-transform: uppercase;
    color: var(--muted-strong); background: var(--surface-2); padding: .75rem 1rem; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.table thead th:first-child { border-start-start-radius: var(--r-sm); }
.table thead th:last-child { border-start-end-radius: var(--r-sm); }
.table tbody td, .stitch-table tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.table-hover tbody tr, .stitch-table tbody tr { transition: background var(--transition); }
.table.table-hover tbody tr:hover { background: var(--primary-softer); }
.table-active, .table .table-active { background: var(--primary-soft); }
.align-middle { vertical-align: middle; }

/* 12. Status / badges ----------------------------------------------------- */
/* Pill-shaped badges only. .device-status is deliberately NOT in this list: it is a
   multi-line block, and a pill radius on a tall box renders as a blob (child radius
   must stay <= parent, curves concentric) while white-space:nowrap blocks wrapping. */
.status-pill, .stitch-status, .day-chip, .kiosk-device-pill, .kiosk-live-pill {
    display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .7rem;
    border-radius: var(--pill); font-size: .76rem; font-weight: 600; line-height: 1.4;
    background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--border);
    white-space: nowrap;
}
.status-pill i { font-size: .9em; }
.status-info, .status-indigo { background: var(--info-soft); color: var(--primary-700); border-color: transparent; }
.status-ok, .is-ok.status-pill, .stitch-status-online, .event-ok { background: var(--success-soft); color: #0b6b4f; border-color: transparent; }
.status-warn, .stitch-status-warn, .event-warn { background: var(--warning-soft); color: #8a5410; border-color: transparent; }
.status-bad, .stitch-status-offline { background: var(--danger-soft); color: #b32446; border-color: transparent; }

.status-dot, .kiosk-live-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-ok .status-dot, .stitch-status-online .status-dot { background: var(--success); }
.kiosk-live-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(18, 163, 122, .2); }

.risk-low { color: var(--success); } .risk-medium { color: var(--warning); } .risk-high { color: var(--danger); }

/* 13. Metrics ------------------------------------------------------------- */
.metric-grid { --gap: 1rem; }
.metric, .stitch-stat-card {
    display: flex; flex-direction: column; gap: .1rem; height: 100%;
    padding: 1.25rem; border-radius: var(--r-lg); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.metric strong, .stitch-stat-card strong { font-size: 1.9rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric span, .stitch-stat-card span { color: var(--muted); font-size: .84rem; }
.metric-icon {
    display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r);
    background: var(--primary-soft); color: var(--primary-700); font-size: 1.25rem; margin-bottom: .65rem;
}
.metric-success .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-danger .metric-icon { background: var(--danger-soft); color: var(--danger); }
.metric-warning .metric-icon { background: var(--warning-soft); color: var(--warning); }
.metric-indigo .metric-icon { background: var(--indigo-soft); color: var(--indigo); }
.metric::after { content: ""; position: absolute; inset-block-start: 0; inset-inline-end: 0; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--primary-rgb), .06), transparent 70%); }

/* 14. Empty states -------------------------------------------------------- */
.empty-state, .analytics-empty-state, .kiosk-empty-state, .upload-empty-state, .kiosk-display-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
    text-align: center; padding: 2.5rem 1.5rem; color: var(--muted);
    border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface-2);
}

/* Inside a table cell the full dashed empty-state is far too heavy. */
.device-status-empty {
    display: flex; flex-direction: column; align-items: flex-start; gap: .3rem;
    color: var(--muted); white-space: normal;
}
.device-status-empty .device-title { font-weight: 400; font-size: .74rem; color: var(--muted); }
.empty-state i, .analytics-empty-state i, .kiosk-empty-state i {
    display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-size: 1.5rem; margin-bottom: .25rem;
}
.analytics-empty-state strong { color: var(--ink); }
.empty-state { min-height: 120px; }

/* 15. Modals -------------------------------------------------------------- */
.modal-content { border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.25rem 1.5rem; align-items: center; }
.modal-title { color: var(--ink); }
.modal-body { padding: 1.25rem 1.5rem; color: var(--body); }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; gap: .5rem; }
.app-confirm-heading { display: flex; align-items: center; gap: .75rem; }
.app-confirm-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: var(--r); background: var(--danger-soft); color: var(--danger); font-size: 1.25rem; }
.app-confirm-modal .modal-content { border-top: 4px solid var(--danger); }
.btn-close { opacity: .6; transition: opacity var(--transition); }
.btn-close:hover { opacity: 1; }

/* 16. Auth ---------------------------------------------------------------- */
.auth-shell { display: grid; place-items: center; min-height: calc(100dvh - var(--topbar-h) - 8rem); padding: 2rem 0; }
.auth-shell-narrow { max-width: 480px; margin-inline: auto; }
.auth-card {
    display: grid; grid-template-columns: 1.05fr .95fr; width: min(1040px, 100%);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-form-panel { padding: clamp(1.75rem, 1rem + 2vw, 3rem); }
.auth-heading { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.75rem; }
.auth-heading .brand-mark { width: 52px; height: 52px; font-size: 1.4rem; }
.auth-eyebrow { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); font-weight: 600; margin-bottom: .25rem; }
.auth-secondary-link { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: .9rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; }

.auth-feature-panel {
    padding: clamp(1.75rem, 1rem + 2vw, 3rem); color: #dfe6f3;
    background:
        radial-gradient(620px 320px at 100% 0%, rgba(94, 132, 214, .3), transparent 65%),
        linear-gradient(160deg, #17306a, #0a142e);
    display: flex; flex-direction: column; justify-content: center;
}
.auth-feature-panel h2 { color: #ffffff; }
.auth-feature-panel .page-kicker { color: #a7b6d6; }
.auth-feature-panel .status-pill { background: rgba(255, 255, 255, .14); color: #fff; border-color: transparent; align-self: flex-start; }

.auth-check-list { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.auth-feature-panel .scan-step { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); }
.auth-feature-panel .scan-step i { background: rgba(126, 162, 232, .22); color: #a9c4f5; }
.auth-feature-panel .scan-step strong { color: #fff; }
.auth-feature-panel .scan-step span { color: #a7b6d6; }

.dev-login-panel { padding: 1.1rem; border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); }
.dev-login-button { flex-direction: column; align-items: stretch; gap: .1rem; text-align: center; min-height: 58px; padding: .5rem; }
.dev-login-button .small { font-weight: 400; }

/* 17. Scan ---------------------------------------------------------------- */
.scan-panel { display: grid; place-items: center; min-height: calc(100dvh - var(--header-h) - 10rem); padding-block: 1rem; }
.scan-card, .scan-hero {
    width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); box-shadow: var(--shadow-md); padding: 2rem; position: relative; overflow: hidden;
}
.scan-card::before {
    content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 6px;
    background: linear-gradient(90deg, var(--primary-700), var(--primary), var(--success));
}
.scan-card .brand-mark { width: 52px; height: 52px; font-size: 1.4rem; }
.scan-step {
    display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); height: 100%;
    min-width: 0;
}
.scan-step > div { min-width: 0; }
.scan-step i {
    display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto;
    border-radius: var(--r); background: var(--primary-soft); color: var(--primary-700); font-size: 1.2rem;
}
.scan-step strong { display: block; color: var(--ink); font-size: .92rem; overflow-wrap: anywhere; }
.scan-step span { color: var(--muted); font-size: .8rem; }

/* Three chips across a phone leaves ~59px of content each — far too narrow for a
   40px icon beside a label, so the text escaped the box and was clipped by the
   card. Stack icon over label below 576px so each chip fits its own column. */
@media (max-width: 575.98px) {
    .scan-step {
        flex-direction: column; align-items: center; justify-content: center;
        text-align: center; gap: .4rem; padding: .7rem .35rem;
    }
    .scan-step i { width: 34px; height: 34px; font-size: 1rem; }
    .scan-step strong { font-size: .74rem; }
}

.scan-message { padding: .9rem 1.1rem; border-radius: var(--r-md); font-size: .92rem; font-weight: 500; margin-bottom: 1rem; text-align: center; }
.scan-message-info { background: var(--info-soft); color: var(--primary-700); }
.scan-message-success { background: var(--success-soft); color: #0b6b4f; }
.scan-message-warning { background: var(--warning-soft); color: #8a5410; }
.scan-message-danger { background: var(--danger-soft); color: #b32446; }

/* Current attendance state, so the employee knows what the next scan will do. */
.scan-status { display: flex; align-items: center; gap: .85rem; padding: .9rem 1.1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.scan-status-dot { width: .7rem; height: .7rem; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.scan-status-in { background: var(--success-soft); border-color: transparent; }
.scan-status-in .scan-status-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.scan-status-out .scan-status-dot { background: var(--muted); }
.scan-status-body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.scan-status-body strong { color: var(--ink); font-size: .95rem; }
.scan-status-body span { color: var(--muted); font-size: .82rem; }
.scan-next-badge { flex: 0 0 auto; font-size: .78rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-700); }

/* Branch location accuracy feedback */
.office-location-status { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; padding: .6rem .8rem; border-radius: var(--r); font-size: .84rem; background: var(--surface-2); color: var(--ink-soft); }
.office-location-info { background: var(--info-soft); color: var(--primary-700); }
.office-location-ok { background: var(--success-soft); color: #0b6b4f; }
.office-location-warn { background: var(--warning-soft); color: #8a5410; }
.office-location-error { background: var(--danger-soft); color: #b32446; }

/* Attendance corrections */
.row-attention > td { background: var(--warning-soft); }
.correction-form { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; }
.correction-form input[type="datetime-local"] { max-width: 190px; }
.correction-form input[type="text"] { max-width: 170px; }
.correction-note { max-width: 260px; }

/* Attendance-rules configuration screens */
.policy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; }
.policy-field { display: flex; flex-direction: column; min-width: 0; }
.policy-field > .form-label { font-weight: 600; font-size: .86rem; color: var(--ink-soft); }
.policy-selector { max-width: 420px; }
.day-picker { display: flex; flex-wrap: wrap; gap: .35rem; }
.day-picker .day-chip { cursor: pointer; user-select: none; padding: .35rem .7rem; }
.day-picker .day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker .day-chip:has(input:checked) { background: var(--primary-soft); color: var(--primary-700); border-color: transparent; }
.day-picker .day-chip:has(input:focus-visible) { box-shadow: var(--ring); }
.effective-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: var(--r); background: var(--surface-2); font-size: .84rem; color: var(--muted); }
.effective-summary strong { color: var(--ink); }
.effective-summary b { color: var(--primary-700); font-variant-numeric: tabular-nums; }

/* Employee's progress toward today's required hours */
.today-panel { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.today-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .3rem 0; font-size: .88rem; }
.today-row span { color: var(--muted); }
.today-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.today-row-strong { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .6rem; }
.today-row-strong strong { color: var(--primary-700); font-size: 1.05rem; }
.today-progress { height: 8px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; margin-top: .75rem; }
.today-progress > span { display: block; height: 100%; width: 0; border-radius: var(--pill); background: var(--primary); transition: width var(--transition); }
.today-progress > span.is-complete { background: var(--success); }
.today-note { display: flex; align-items: flex-start; gap: .45rem; margin: .75rem 0 0; color: var(--muted); font-size: .78rem; }
.today-note i { color: var(--primary); margin-top: .1rem; }

/* In-app camera scanner */
.scan-video-shell { position: relative; border-radius: var(--r-md); overflow: hidden; background: #0b1220; margin-bottom: 1rem; }
.scan-video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.scan-video-frame { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(62%, 260px); aspect-ratio: 1; border: 3px solid rgba(255, 255, 255, .9); border-radius: var(--r-md); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.scan-video-hint { position: absolute; inset-block-end: .75rem; inset-inline: 0; margin: 0; text-align: center; color: #fff; font-size: .82rem; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

/* 18. Specialized (dashboard extras, kiosk, reports, schedules, devices…) - */
.security-stack { display: flex; flex-direction: column; gap: .65rem; }
.security-stack span { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; border-radius: var(--r); background: var(--surface-2); color: var(--ink-soft); font-size: .9rem; }
.security-stack i { color: var(--primary); }

.discipline-row, .device-health-row, .qr-setting-row, .qr-settings-panel .qr-setting-row, .stitch-setting-row, .stitch-toggle-list > *, .operation-row, .connection-event, .branch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 0; border-bottom: 1px solid var(--border);
}
.discipline-row:last-child, .device-health-row:last-child, .branch-row:last-child { border-bottom: 0; }
.discipline-row strong { display: block; color: var(--ink); font-size: .92rem; }
.discipline-row span { color: var(--muted); font-size: .8rem; }

/* Generic grids used by many admin panels */
.stitch-stat-grid, .hours-kpi-grid, .branch-stat-grid, .report-hub-grid,
.stitch-report-grid, .kiosk-admin-grid, .kiosk-display-grid, .kiosk-detail-grid,
.employee-create-grid, .stitch-form-grid, .report-filter-grid, .hours-report-grid,
.branch-performance-grid, .stitch-settings-grid, .schedule-grid, .kiosk-side-stack {
    display: grid; gap: 1rem;
}
.stitch-stat-grid, .hours-kpi-grid, .branch-stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.report-hub-grid, .stitch-report-grid, .report-filter-grid, .stitch-form-grid, .stitch-settings-grid, .employee-create-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kiosk-side-stack, .stitch-settings-stack, .stitch-choice-stack, .security-stack { display: flex; flex-direction: column; gap: 1rem; }

/* Report tiles */
.report-tile, .stitch-report-card {
    display: flex; flex-direction: column; gap: .5rem; padding: 1.4rem; height: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
a.report-tile:hover, a.stitch-report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-soft); }
.report-tile-icon, .stitch-report-icon {
    display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r);
    background: var(--primary-soft); color: var(--primary-700); font-size: 1.35rem;
}
.report-tile-warning .report-tile-icon { background: var(--warning-soft); color: var(--warning); }

/* Meters / progress bars */
.branch-meter, .compliance-meter, .health-meter, .hours-meter, .settings-meter, .stitch-meter {
    height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.branch-meter > span, .compliance-meter > span, .health-meter > span, .hours-meter > span, .settings-meter > span, .stitch-meter > span {
    display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--indigo));
}
.health-meter-ok > span { background: linear-gradient(90deg, #16b587, var(--success)); }

/* QR / kiosk surfaces */
.qr-surface, .kiosk-qr-surface, .stitch-qr-preview, .stitch-fake-qr, .kiosk-launch-qr-shell, .stitch-qr-stage {
    display: grid; place-items: center; padding: 1.25rem; border-radius: var(--r-md);
    background: #fff; border: 1px solid var(--border);
}
.visual-code, .stitch-fake-qr, .kiosk-display { font-variant-numeric: tabular-nums; }

/* Kiosk public display */
.kiosk-frame, .kiosk-body { min-height: 100dvh; }
.kiosk-hero, .kiosk-display-header { text-align: center; }
.kiosk-brand-row, .kiosk-brand-mark { display: flex; align-items: center; gap: .75rem; justify-content: center; }
.kiosk-safe-badge, .kiosk-live-pill { display: inline-flex; align-items: center; gap: .4rem; }

/* Spinner (kiosk) */
.kiosk-spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: kiosk-spin .8s linear infinite; }

/* Day picker / schedule chips */
.day-picker, .schedule-days { display: flex; flex-wrap: wrap; gap: .5rem; }
.day-chip { cursor: pointer; }
.day-chip.active, .schedule-days .active { background: var(--primary-600); color: #fff; border-color: transparent; }

/* Uploads --------------------------------------------------------------
   The preview is a fixed-size box holding an image of unknown dimensions, so
   the box is sized and the image is contained inside it. Sizing the wrapper
   alone lets a large upload render at its natural size and escape the card. */
.upload-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.upload-picker-button {
    display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
    padding: .5rem .9rem; border-radius: var(--r); border: 1px dashed var(--border-strong, var(--border));
    background: var(--surface-2); color: var(--ink-soft); font-size: .85rem; font-weight: 600;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.upload-picker-button:hover { border-color: var(--primary); color: var(--primary-700); background: var(--primary-softer); }
.upload-picker-name { min-width: 0; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }

.image-upload-preview {
    position: relative; overflow: hidden;
    display: grid; place-items: center;
    aspect-ratio: 1 / 1; width: 100%; max-width: 220px;
    padding: .75rem;
    border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2);
}
.image-upload-preview.image-upload-wide { aspect-ratio: 16 / 9; max-width: 100%; }
.image-upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-upload-preview .upload-empty-state { border: 0; background: transparent; padding: 0; }
.image-clear-btn {
    position: absolute; inset-block-start: .5rem; inset-inline-end: .5rem; z-index: 1;
    display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; line-height: 1;
}
/* Nothing to clear yet — keep the control out of the way until an image exists. */
.image-upload-preview:has(img.d-none) .image-clear-btn { display: none; }

/* Maps */
.map, .office-map, .kiosk-map-visual, .map-pin, .leaflet-container, .office-map-shell .map { border-radius: var(--r-md); }
.office-map, .map, .kiosk-map-visual { min-height: 260px; background: var(--surface-2); }

/* Device / connection icons */
.event-icon, .kiosk-device-icon, .stitch-device-icon, .stitch-report-icon, .device-status-head .event-icon {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r);
    background: var(--primary-soft); color: var(--primary-700); flex: 0 0 auto;
}
.event-ok.event-icon { background: var(--success-soft); color: var(--success); }
.event-warn.event-icon { background: var(--warning-soft); color: var(--warning); }

/* Misc panels default text */
.stitch-main-text, .stitch-title-stack strong, .device-title, .kiosk-card-heading { color: var(--ink); font-weight: 700; }
.stitch-sub-text, .stitch-eyebrow, .kiosk-eyebrow, .auth-eyebrow, .stitch-breadcrumb { color: var(--muted); font-size: .85rem; }

/* Status pages (access denied / closing) */
.status-page { display: grid; place-items: center; min-height: calc(100dvh - var(--topbar-h) - 6rem); text-align: center; }
.status-card { max-width: 520px; padding: 2.5rem; }

/* 19. Utilities ----------------------------------------------------------- */
.h-100 { height: 100%; }
.w-100 { width: 100%; }
.mx-auto { margin-inline: auto; }
.flex-fill { flex: 1 1 auto; }
.fw-semibold { font-weight: 600 !important; }
.small { font-size: .82rem; }

/* Bootstrap spinner used by JS loading-form */
.spinner-border-sm { width: 1rem; height: 1rem; border-width: .15em; }

@keyframes appSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes kiosk-spin { to { transform: rotate(360deg); } }

/* 18b. Stitch admin pattern (Kiosks, Reports, QR settings) ---------------- */
.stitch-page { display: flex; flex-direction: column; gap: 1.5rem; }
.stitch-heading-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.stitch-title-stack h1 { font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.85rem); margin: 0; }
.stitch-title-stack p { color: var(--muted); margin: .35rem 0 0; }
.stitch-breadcrumb { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.stitch-breadcrumb a { color: var(--muted); } .stitch-breadcrumb a:hover { color: var(--primary); }
.stitch-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.stitch-stat-card { position: relative; padding-inline-end: 4.25rem; }
.stitch-stat-card > div { display: flex; flex-direction: column; gap: .15rem; }
.stitch-stat-card > div span { color: var(--muted); font-size: .82rem; }
.stitch-stat-card strong { font-size: 1.8rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.stitch-stat-card small { color: var(--muted); font-size: .78rem; margin-top: .5rem; }
.stitch-stat-card > .material-symbols-outlined,
.stitch-stat-card > i.bi {
    position: absolute; inset-block-start: 1.1rem; inset-inline-end: 1.1rem;
    display: grid; place-items: center; width: 42px; height: 42px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
    font-size: 1.3rem; color: var(--muted);
}
.stitch-stat-card > .material-symbols-outlined.text-success,
.stitch-stat-card > i.bi.text-success { background: var(--success-soft); border-color: transparent; }
.stitch-stat-card > .material-symbols-outlined.text-danger,
.stitch-stat-card > i.bi.text-danger { background: var(--danger-soft); border-color: transparent; }
.stitch-stat-card > .material-symbols-outlined.text-warning,
.stitch-stat-card > i.bi.text-warning { background: var(--warning-soft); border-color: transparent; }
.stitch-stat-card > div { max-width: calc(100% - 3.4rem); }
.stitch-stat-card .stitch-meter { margin-top: .75rem; }

.stitch-panel-header { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.stitch-panel-header h2 { font-size: 1.1rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.stitch-panel-header p { color: var(--muted); font-size: .85rem; margin: .3rem 0 0; }
.stitch-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.stitch-icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); cursor: pointer; transition: var(--transition); }
.stitch-icon-button:hover { background: var(--primary-soft); color: var(--primary-700); border-color: transparent; }

.stitch-device-cell { display: flex; align-items: center; gap: .75rem; }
.stitch-device-cell strong { display: block; color: var(--ink); }
.stitch-device-cell small { color: var(--muted); font-size: .78rem; }
.stitch-main-text { display: block; color: var(--ink); font-weight: 600; }
.stitch-sub-text { display: block; color: var(--muted); font-size: .78rem; }

.stitch-status > span:first-child { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; display: inline-block; }
.stitch-status-online { color: var(--success); }
.stitch-status-warn { color: var(--warning); }
.stitch-status-offline { color: var(--danger); }
.stitch-status { background: var(--surface-2); }
.stitch-status-online.stitch-status { background: var(--success-soft); }
.stitch-status-warn.stitch-status { background: var(--warning-soft); color: #8a5410; }
.stitch-status-offline.stitch-status { background: var(--danger-soft); }

.stitch-row-actions { display: flex; align-items: center; gap: .35rem; }
.stitch-row-actions form { display: inline-flex; margin: 0; }
.stitch-icon-action { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); cursor: pointer; transition: var(--transition); }
.stitch-icon-action:hover { background: var(--primary-soft); color: var(--primary-700); border-color: transparent; }
.stitch-icon-danger:hover { background: var(--danger-soft); color: var(--danger); }

.stitch-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.stitch-qr-preview, .stitch-qr-stage { display: grid; place-items: center; padding: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); min-height: 220px; margin-bottom: 1rem; }
.stitch-qr-preview img, .stitch-qr-stage img { max-width: 220px; }
.stitch-fake-qr { width: 180px; height: 180px; border-radius: var(--r-sm); background: repeating-conic-gradient(var(--ink) 0% 25%, #fff 0% 50%) 50% / 20px 20px; opacity: .18; }
.stitch-copy-line { display: flex; gap: .5rem; }
.stitch-copy-line .form-control { flex: 1 1 auto; }
.stitch-info-list { display: flex; flex-direction: column; }
.stitch-info-list > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.stitch-info-list > div:last-child { border-bottom: 0; }
.stitch-info-list span { color: var(--muted); font-size: .85rem; }
.stitch-info-list strong { color: var(--ink); font-weight: 600; text-align: end; }
.stitch-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stitch-form-grid label { display: flex; flex-direction: column; gap: .4rem; font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
.stitch-pairing-card { display: flex; gap: .85rem; align-items: flex-start; margin-top: 1.25rem; padding: 1rem 1.1rem; border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--primary-softer); }
.stitch-pairing-card .material-symbols-outlined,
.stitch-pairing-card > i.bi { font-size: 1.6rem; color: var(--primary); }
.stitch-pairing-card strong { color: var(--ink); } .stitch-pairing-card p { color: var(--muted); font-size: .82rem; margin: .15rem 0 0; }
.stitch-modal .modal-header { align-items: flex-start; } .stitch-modal .modal-header p { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }

.stitch-report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; }
.stitch-report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem; align-content: start; }
.stitch-report-card { display: flex; flex-direction: column; gap: .5rem; }
.stitch-report-card h2 { font-size: 1.05rem; margin: .25rem 0 0; }
.stitch-report-card p { color: var(--muted); font-size: .85rem; flex: 1 1 auto; }
.stitch-report-card .stitch-button { align-self: flex-start; margin-top: .5rem; }
.stitch-report-card.danger .stitch-report-icon { background: var(--danger-soft); color: var(--danger); }
.stitch-report-side { display: flex; flex-direction: column; gap: 1.5rem; }
.stitch-report-list { display: flex; flex-direction: column; gap: .25rem; }
.stitch-report-list a { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: var(--r); color: var(--ink-soft); transition: var(--transition); }
.stitch-report-list a:hover { background: var(--surface-2); }
.stitch-report-list .material-symbols-outlined { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r); background: var(--primary-soft); color: var(--primary-700); flex: 0 0 auto; }
.stitch-report-list strong { display: block; color: var(--ink); font-size: .9rem; } .stitch-report-list small { color: var(--muted); font-size: .78rem; }

.stitch-settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; }
.stitch-choice-card { display: flex; align-items: flex-start; gap: .85rem; padding: 1rem 1.1rem; border: 1.5px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: var(--transition); }
.stitch-choice-card input { margin-top: .2rem; accent-color: var(--primary); }
.stitch-choice-card .material-symbols-outlined { color: var(--primary); font-size: 1.4rem; }
.stitch-choice-card strong { display: block; color: var(--ink); } .stitch-choice-card small { color: var(--muted); font-size: .8rem; }
.stitch-choice-card:hover { border-color: var(--primary); }
.stitch-choice-card.active { border-color: var(--primary); background: var(--primary-softer); box-shadow: var(--ring); }
.stitch-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; }
.stitch-setting-row strong { display: block; color: var(--ink); } .stitch-setting-row small { color: var(--muted); font-size: .8rem; }
.stitch-setting-row output { font-weight: 700; color: var(--primary-700); font-variant-numeric: tabular-nums; }
.stitch-range { width: 100%; accent-color: var(--primary); margin-bottom: 1rem; }
.stitch-toggle-list { display: flex; flex-direction: column; }
.stitch-toggle-list label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.stitch-toggle-list label:last-child { border-bottom: 0; }
.stitch-toggle-list strong { display: block; color: var(--ink); font-size: .9rem; } .stitch-toggle-list small { color: var(--muted); font-size: .8rem; }
.stitch-toggle-list input { accent-color: var(--primary); width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }

/* Real (saveable) verification policy controls on the QR settings screen. These were
   previously `disabled` mock-ups; they now post to the server, so they must look and
   behave like live switches. Overrides Bootstrap's .form-check float/padding layout. */
.range-scale { display: flex; justify-content: space-between; gap: 1rem; margin: -.5rem 0 1.25rem; color: var(--muted); font-size: .76rem; }

/* A native range track is ~16px tall, which is hard to grab with a thumb. Give the
   handle a proper touch-sized target without changing the track's visual weight. */
/* appearance:none is required for the ::-webkit-* track/thumb rules below to apply. */
.stitch-range { -webkit-appearance: none; appearance: none; height: 2.75rem; background: transparent; touch-action: pan-y; }
.stitch-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; margin-top: -10px; }
.stitch-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
.stitch-range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--pill); background: var(--surface-3); }
.stitch-range::-moz-range-track { height: 6px; border-radius: var(--pill); background: var(--surface-3); }
.stitch-range:focus-visible { outline: none; }
.stitch-range:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }
.policy-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); margin: 0; }
.policy-toggle:last-child { border-bottom: 0; }
.policy-toggle.form-check { padding-inline-start: 0; }
.policy-toggle > span { min-width: 0; }
.policy-toggle .form-check-input {
    float: none; margin: 0; flex: 0 0 auto; cursor: pointer;
    width: 2.6rem; height: 1.45rem; accent-color: var(--primary);
}
.policy-toggle .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.policy-toggle .form-check-input:focus-visible { box-shadow: var(--ring); }
.policy-toggle-readonly { background: var(--surface-2); border-radius: var(--r); padding: .9rem 1rem; }
.policy-toggle-readonly .btn { flex: 0 0 auto; }
.stitch-preview-column { display: flex; flex-direction: column; gap: 1.5rem; }
.stitch-live-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.stitch-live-meta span { color: var(--muted); font-size: .8rem; } .stitch-live-meta strong { display: block; color: var(--ink); font-variant-numeric: tabular-nums; }
.stitch-device-list { display: flex; flex-direction: column; gap: .35rem; }
.stitch-device-list a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: var(--r); border: 1px solid transparent; color: var(--ink-soft); transition: var(--transition); }
.stitch-device-list a:hover { background: var(--surface-2); }
.stitch-device-list a.active { background: var(--primary-softer); border-color: var(--primary-soft); }
.stitch-device-list .material-symbols-outlined { color: var(--primary); }
.stitch-device-list strong { display: block; color: var(--ink); font-size: .88rem; } .stitch-device-list small { color: var(--muted); font-size: .78rem; }

/* 18c. Public kiosk display (immersive dark) ------------------------------ */
.kiosk-body { min-height: 100dvh; margin: 0; color: #dfe6f3; background: radial-gradient(900px 500px at 100% 0%, rgba(94, 132, 214, .26), transparent 60%), linear-gradient(160deg, #17306a, #0a142e); }
.kiosk-display { width: min(1180px, 100%); margin-inline: auto; min-height: 100dvh; padding: clamp(1.25rem, 3vw, 2.5rem); display: flex; flex-direction: column; gap: 2rem; justify-content: center; }
.kiosk-display-empty { place-items: center; text-align: center; }
.kiosk-empty-state { max-width: 520px; padding: 3rem 2rem; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--r-xl); }
.kiosk-empty-state h1 { color: #fff; } .kiosk-empty-state p { color: #a7b6d6; }
.kiosk-brand-mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-md); font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, #3c63b4, var(--primary-600)); box-shadow: var(--shadow-primary); }
/* On the dark kiosk backdrop an uploaded logo needs its own light card to read. */
.kiosk-brand-mark:has(img) { background: #fff; padding: 5px; }
.kiosk-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.kiosk-eyebrow { color: #a7b6d6; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; margin: 0; }
.kiosk-display-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.kiosk-brand-row { display: flex; align-items: center; gap: 1rem; justify-content: flex-start; }
.kiosk-brand-row h1 { color: #fff; font-size: clamp(1.3rem, 1rem + 1.5vw, 2rem); margin: 0; }
.kiosk-header-meta { display: flex; flex-wrap: wrap; gap: .6rem; }
.kiosk-live-pill, .kiosk-device-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-radius: var(--pill); background: rgba(255, 255, 255, .08); color: #fff; font-size: .85rem; }
.kiosk-live-pill > span:first-child { width: .6rem; height: .6rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(18, 163, 122, .25); }
.kiosk-live-pill.is-error > span:first-child { background: var(--danger); box-shadow: 0 0 0 4px rgba(236, 77, 106, .25); }
.kiosk-display-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: stretch; }
.kiosk-qr-card { background: #fff; color: var(--ink); border-radius: var(--r-xl); padding: 1.75rem; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 1.25rem; }
.kiosk-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.kiosk-card-heading .kiosk-eyebrow { color: var(--muted); } .kiosk-card-heading h2 { color: var(--ink); font-size: 1.2rem; margin: .25rem 0 0; }
.kiosk-safe-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: var(--pill); background: var(--success-soft); color: #0b6b4f; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.kiosk-qr-surface { flex: 1 1 auto; min-height: 320px; }
.kiosk-qr-surface svg, .kiosk-qr-surface img { width: min(320px, 100%); height: auto; }
.kiosk-loading-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--muted); }
.kiosk-error-state { color: var(--danger); font-weight: 600; }
.kiosk-visual-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.kiosk-visual-strip > span { color: var(--muted); font-size: .85rem; } .kiosk-visual-strip .visual-code { font-size: 1.5rem; font-weight: 700; letter-spacing: .25em; color: var(--ink); }
/* The kiosk side panel sits on a WHITE surface (see the shared panel rule above).
   It previously kept dark-theme values (#fff text on rgba(255,255,255,.07)), which
   rendered the clock and countdown as white-on-white — invisible. Light theme only. */
.kiosk-side-panel { display: flex; flex-direction: column; gap: 1rem; }
.kiosk-time-card, .kiosk-countdown-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; color: var(--ink); }
.kiosk-time-card > span, .kiosk-countdown-copy > span { color: var(--muted); font-size: .82rem; }
.kiosk-time-card strong { display: block; font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.15; }
.kiosk-countdown-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.kiosk-countdown-copy strong { display: block; font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary-700); line-height: 1.15; }
/* Darker than --danger so the 5-second warning still reads clearly at a distance
   on the light card (a kiosk screen is viewed from further away than a phone). */
.kiosk-countdown-card.is-expiring .kiosk-countdown-copy strong { color: #a21030; }
.kiosk-countdown-ring { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-700); font-size: 1.4rem; }
.kiosk-countdown-card.is-expiring .kiosk-countdown-ring { background: var(--danger-soft); color: var(--danger); }
.kiosk-info-list { display: flex; flex-direction: column; gap: .85rem; }
.kiosk-info-list > div { display: flex; align-items: flex-start; gap: .7rem; color: var(--body); font-size: .88rem; }
.kiosk-info-list i { color: var(--primary); margin-top: .1rem; }
.kiosk-spinner { border-color: rgba(0, 0, 0, .12); border-top-color: var(--primary); }

/* 18d. People / schedules / offices / devices ----------------------------- */
.employee-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.employee-form-section { padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.employee-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.employee-email-note { display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; border-radius: var(--r); background: var(--info-soft); color: var(--primary-700); font-size: .85rem; }

.schedule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.schedule-card { padding: 1.25rem; }
.schedule-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.schedule-card-head strong { display: block; color: var(--ink); } .schedule-card-head span { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.schedule-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .85rem; }
.schedule-meta span { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: .76rem; }
.schedule-days { display: flex; flex-wrap: wrap; gap: .35rem; }
.schedule-days span { padding: .2rem .55rem; border-radius: var(--r-sm); background: var(--primary-softer); color: var(--primary-700); font-size: .74rem; font-weight: 600; }
.day-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.day-chip { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: inline-block; padding: .4rem .8rem; border-radius: var(--pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: .82rem; transition: var(--transition); }
.day-chip input:checked + span { background: var(--primary-600); border-color: transparent; color: #fff; }
.bulk-assign-panel.simple-work-assignment { display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: .75rem; align-items: center; padding: 1rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.table-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-start; margin: 0; }
.table-actions form { margin: 0; }

/* Editing an existing employee: make it obvious the form is no longer "add". */
#employeeFormCard.is-editing { border-color: var(--primary); box-shadow: var(--shadow-md); }
#employeeFormCard.is-editing .card-header-clean { border-bottom-color: var(--primary-soft); }

/* Deactivated rows stay visible (so they can be reactivated) but recede. */
.row-muted > td { background: var(--surface-2); }
.row-muted .device-status, .row-muted .device-title, .row-muted code { opacity: .65; }

.device-status { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; white-space: normal; }
.device-status-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.device-fingerprint { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.device-title { color: var(--ink); font-weight: 600; font-size: .85rem; overflow-wrap: anywhere; }
.device-meta-list { display: flex; flex-direction: column; gap: .15rem; }
.device-meta-list span { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.device-meta-list i { color: var(--muted-soft); font-size: .85em; flex: 0 0 auto; }

.office-map-shell { position: relative; }
.office-map, .office-map-shell .office-map { height: 280px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.office-map-tools { position: absolute; inset-block-start: .6rem; inset-inline-end: .6rem; z-index: 500; }
.settings-panel { padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.network-helper-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.network-helper-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.network-probe { display: flex; align-items: center; gap: .5rem; padding: .7rem .85rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); font-size: .85rem; color: var(--muted-strong); }
.network-probe.is-ok { background: var(--success-soft); color: #0b6b4f; border-color: transparent; }
.network-probe.is-warning { background: var(--warning-soft); color: #8a5410; border-color: transparent; }
.network-suggestion { font-family: ui-monospace, monospace; font-size: .82rem; color: var(--primary-700); }

/* 18e. Reports / hours / branches / generic panels ------------------------ */
.reports-hero { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.75rem; padding: 1.75rem; border-radius: var(--r-xl); background: radial-gradient(700px 240px at 100% 0%, rgba(var(--primary-rgb), .09), transparent 70%), linear-gradient(135deg, #fff, var(--surface-3)); border: 1px solid var(--border); }
.report-detail-grid, .report-split-grid, .hours-report-grid, .hours-report-board, .branch-performance-grid { display: grid; gap: 1.25rem; }
.report-split-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.report-detail-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.hours-report-board { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.branch-performance-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.filter-panel, .report-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; align-items: end; }
.hours-period-card-head, .branch-score-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.hours-period-value, .branch-compliance { font-size: 1.8rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hours-period-meta, .branch-stat-grid { color: var(--muted); font-size: .82rem; }
.hours-period-card-featured { border-color: var(--primary); background: var(--primary-softer); }
.report-tile-icon, .stitch-report-icon { flex: 0 0 auto; }

/* State toggle (site state / settings switches) */
.state-toggle { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--border); }
.state-toggle a, .state-toggle button, .state-toggle label { padding: .45rem 1rem; border-radius: var(--pill); color: var(--muted); font-weight: 600; font-size: .85rem; border: 0; background: transparent; cursor: pointer; }
.state-toggle .active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-xs); }

/* Identity preview — a stacked "how the brand will look" card, not a row. */
.preview-identity { display: flex; flex-direction: column; align-items: center; text-align: center; }
.preview-cover {
    display: grid; place-items: center; overflow: hidden;
    width: 100%; aspect-ratio: 16 / 6;
    border-radius: var(--r-md); border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary-softer), var(--surface-3));
}
.preview-cover img { width: 100%; height: 100%; object-fit: cover; }
.preview-logo {
    display: grid; place-items: center; overflow: hidden;
    width: 84px; height: 84px; margin-top: -42px; padding: .5rem;
    border-radius: var(--r-lg); border: 1px solid var(--border);
    background: var(--surface); box-shadow: var(--shadow-sm);
    color: var(--primary-600); font-size: 1.75rem;
}
.preview-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-identity p { color: var(--muted); max-width: 46ch; }

/* Connection log / device panels */
.connection-event, .device-health-row { display: flex; align-items: center; gap: .85rem; }
.event-info { min-width: 0; } .event-info strong { display: block; color: var(--ink); font-size: .88rem; } .event-info span { color: var(--muted); font-size: .78rem; }

/* 20b. UX polish — touch feedback, states, a11y --------------------------- */
.appnav-link:active, .appnav-menu-link:active, .user-menu-link:active, .user-chip:active,
.btn-icon:active, .btn-icon-sm:active, .stitch-icon-action:active, .stitch-icon-button:active,
.day-chip:active { transform: translateY(1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
* { -webkit-tap-highlight-color: transparent; }
.appnav-link, .appnav-menu-link, .user-menu-link, .user-chip, .btn, .btn-icon, .btn-icon-sm,
.stitch-icon-action, .stitch-icon-button, .stitch-icon-action, .day-chip, a, summary { touch-action: manipulation; }
.form-control[readonly] { background: var(--surface-2); color: var(--ink-soft); cursor: default; }
.form-label .req { color: var(--danger); margin-inline-start: .15rem; }
.app-flash { position: relative; }
.app-flash-close { margin-inline-start: auto; align-self: flex-start; background: transparent; border: 0; font-size: .9rem; line-height: 1; color: var(--muted); cursor: pointer; padding: .1rem; }
.app-flash-close:hover { color: var(--ink); }

@media (max-width: 1199.98px) {
    .appnav-link { padding-inline: .5rem; }
}

@media (max-width: 767.98px) {
    .btn-icon-sm, .stitch-icon-action, .stitch-icon-button { min-height: 44px; min-width: 44px; }
    .stitch-row-actions, .table-actions { gap: .5rem; }

    /* iOS Safari zooms the page when a focused control is under 16px — keep every
       text-entry control at 16px/44px on phones so tapping a field never zooms.
       Deliberately broad: schedule/time/number inputs carry no .form-control class. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),
    select, textarea, .form-control, .form-select, .form-control-lg {
        font-size: 1rem;
        min-height: 44px;
    }
    textarea, textarea.form-control { min-height: 88px; }
    .form-check-input { width: 1.25rem; height: 1.25rem; }
    .btn, .chip-btn { min-height: 44px; }
    .user-chip { min-height: 44px; }
}

/* iPhone notch / home-indicator safe areas (viewport-fit=cover) */
.topnav { padding-top: env(safe-area-inset-top); }
.app-footer { padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); }
.app-flash-stack { top: calc(1rem + env(safe-area-inset-top)); }

/* 18f. Report console (tabs, presets, compliance cells) ------------------- */
.report-page-head { align-items: center; }
.report-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.report-period-pill { font-variant-numeric: tabular-nums; }

.report-filter-card { padding: 1.1rem 1.25rem; }
.report-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip-btn {
    padding: .35rem .85rem; border-radius: var(--pill); font-size: .8rem; font-weight: 600;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--body); cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip-btn:hover { background: var(--primary-soft); color: var(--primary-700); border-color: transparent; }

.report-console { padding: 0; overflow: hidden; }
.report-tabs {
    display: flex; gap: .25rem; padding: .6rem .75rem 0; overflow-x: auto; scrollbar-width: none;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.report-tabs::-webkit-scrollbar { height: 0; }
.report-tab {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .65rem 1rem; border: 0; border-bottom: 2.5px solid transparent; background: transparent;
    color: var(--body); font-weight: 600; font-size: .88rem; cursor: pointer; border-radius: var(--r-sm) var(--r-sm) 0 0;
    transition: color var(--transition), background var(--transition);
    min-height: 44px; touch-action: manipulation;
}
.report-tab:hover { color: var(--ink); background: rgba(var(--primary-rgb), .05); }
.report-tab.active { color: var(--primary-700); border-bottom-color: var(--primary); background: var(--surface); }
.tab-count {
    font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: var(--pill);
    background: var(--surface-3); color: var(--muted-strong); font-variant-numeric: tabular-nums;
}
.report-tab.active .tab-count { background: var(--primary-soft); color: var(--primary-700); }
.report-tab-content { padding: 1.5rem; }

.report-pane-head {
    display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-start;
    justify-content: space-between; margin-bottom: 1.25rem;
}
.report-pane-head h2 { font-size: 1.1rem; margin: 0; }

.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.compliance-cell { display: flex; align-items: center; gap: .6rem; min-width: 120px; }
.compliance-cell .compliance-meter { flex: 1 1 auto; }
.delta-pos { color: var(--success); font-weight: 600; }
.delta-neg { color: var(--danger); font-weight: 600; }
.note-pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.alerts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 2rem; }

/* 20c. Responsive: phones & tablets ---------------------------------------- */
@media (max-width: 991.98px) {
    .report-tab-content { padding: 1.1rem; }
    .alerts-grid { grid-template-columns: 1fr; }
    .compliance-cell { min-width: 90px; }
}

@media (max-width: 767.98px) {
    .report-head-actions { width: 100%; }
    .report-filter-grid { grid-template-columns: 1fr 1fr; }
    .report-filter-actions { grid-column: 1 / -1; }
    .report-pane-head .table-search { width: 100%; max-width: none; }
    .table th.num, .table td.num { text-align: end; }
    .hours-kpi-grid { grid-template-columns: 1fr 1fr; }
    .branch-performance-grid { grid-template-columns: 1fr; }

    /* stitch tables become labeled cards on phones (same pattern as .table) */
    .stitch-table thead { display: none; }
    .stitch-table, .stitch-table tbody, .stitch-table tr, .stitch-table td { display: block; width: 100%; }
    .stitch-table tr { margin-bottom: .85rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
    .stitch-table td { display: flex; justify-content: space-between; gap: 1rem; align-items: center; text-align: end; border-bottom: 1px solid var(--border); padding: .7rem .9rem; }
    .stitch-table tr td:last-child { border-bottom: 0; }
    .stitch-table td::before { content: attr(data-label); font-weight: 600; color: var(--muted-strong); text-align: start; font-size: .78rem; }
    .stitch-table td[colspan]::before { content: none; }
    .stitch-table td[colspan] { justify-content: center; text-align: center; }
    .stitch-row-actions { justify-content: flex-end; }

    .stitch-heading-row { flex-direction: column; align-items: stretch; }
    .stitch-actions { justify-content: flex-start; }
    .kiosk-display { padding: 1rem; gap: 1.25rem; }
    .kiosk-display-header { flex-direction: column; align-items: flex-start; }
    .kiosk-qr-surface { min-height: 240px; }
    .auth-form-panel { padding: 1.5rem; }
    .dashboard-hero, .reports-hero { padding: 1.25rem; }
    .page-header { flex-direction: column; align-items: stretch; }
    .scan-card { padding: 1.25rem; }
    .office-map { height: 220px; }
}

@media (max-width: 575.98px) {
    .report-filter-grid { grid-template-columns: 1fr; }
    .hours-kpi-grid { grid-template-columns: 1fr; }
    .report-tab { padding: .6rem .7rem; font-size: .82rem; }
    .report-tab-content { padding: .9rem; }
    .brand-copy .brand-subtitle { display: none; }
    .metric { padding: 1rem; }
    .metric strong { font-size: 1.45rem; }
    .btn-lg { min-height: 48px; font-size: .95rem; }
}

@media print {
    .report-tabs, .report-filter-card, .report-head-actions, .topnav-row2 { display: none !important; }
    .report-console .tab-pane { display: block !important; opacity: 1 !important; margin-bottom: 1.5rem; }
    .report-console { border: 0; box-shadow: none; }
}

/* 20. Responsive ---------------------------------------------------------- */
@media (max-width: 991.98px) {
    :root { --gutter: var(--gutter-sm); }
    .auth-card { grid-template-columns: 1fr; }
    .auth-feature-panel { display: none; }
    .stitch-report-layout, .stitch-settings-grid, .kiosk-display-grid, .employee-create-grid { grid-template-columns: 1fr; }
    .kiosk-time-card strong { font-size: 2rem; }
}

@media (max-width: 767.98px) {
    .bulk-assign-panel.simple-work-assignment { grid-template-columns: 1fr; }
    .topbar-search { display: none !important; }
}

@media (max-width: 767.98px) {
    .page-container { padding-block: 1.25rem 2rem; }
    .dashboard-hero { padding: 1.25rem; }
    .app-card, .metric, .report-tile,
    .data-panel, .detail-panel, .filter-panel, .settings-panel, .stitch-panel,
    .kiosk-panel, .hours-report-panel, .schedule-card { padding: 1.1rem; }

    /* Responsive table → cards (uses JS-populated data-label) */
    .table-responsive .table thead { display: none; }
    .table-responsive .table, .table-responsive .table tbody, .table-responsive .table tr, .table-responsive .table td { display: block; width: 100%; }
    .table-responsive .table tr { margin-bottom: .85rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
    .table-responsive .table td { display: flex; justify-content: space-between; gap: 1rem; align-items: center; text-align: end; border-bottom: 1px solid var(--border); padding: .7rem .9rem; }
    .table-responsive .table tr td:last-child { border-bottom: 0; }
    .table-responsive .table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: start; font-size: .78rem; }
    .table-responsive .table td[colspan]::before { content: none; }
    .table-responsive .table td[colspan] { justify-content: center; text-align: center; }
}

@media (max-width: 575.98px) {
    .app-flash-stack { inset-inline: 1rem; width: auto; }
    .topnav-actions { gap: .35rem; }
    .topnav-brand .brand-subtitle { display: none; }
    .metric strong { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
    .topnav, .app-footer, .app-flash-stack { display: none !important; }
    .app-card, .metric { box-shadow: none; border-color: #ccc; }
    body { background: #fff; }
}

.policy-field-wide { grid-column: 1 / -1; }

/* ============================================================================
   21. Mobile app shell
   Below 992px the app stops looking like a website: the two-tier desktop header
   is replaced by a compact app bar, primary navigation moves to a fixed bottom
   tab bar (Instagram/Facebook pattern), and the rest of the menu lives in a
   bottom sheet. Desktop (>=992px) is untouched — the shell simply switches off.
   ========================================================================== */
:root {
    --appbar-h: 54px;
    --tabbar-h: 60px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Both shells are always rendered; only one is ever displayed. */
.mshell-appbar, .mshell-tabbar { display: none; }

@media (max-width: 991.98px) {
    .topnav, .app-footer { display: none !important; }
    .mshell-appbar { display: block; }
    .mshell-tabbar { display: flex; }

    html { scroll-padding-top: calc(var(--appbar-h) + var(--safe-top) + 8px); }
    /* Stops a scroll inside a sheet or a table from chaining to the page behind it. */
    body { overscroll-behavior-y: contain; }

    .app-main { min-height: calc(100dvh - var(--appbar-h)); }
    .page-container { padding-block: 1rem 1.25rem; }
    /* Room for the fixed tab bar so the last row of every screen stays tappable. */
    .app-authenticated .app-main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }

    .app-flash-stack {
        inset-inline: .7rem; width: auto;
        top: calc(var(--appbar-h) + var(--safe-top) + .5rem);
    }

    .auth-shell { min-height: auto; padding: 1rem 0 0; }
    .status-page { min-height: calc(100dvh - var(--appbar-h) - 6rem); }
    .scan-panel { min-height: auto; padding-block: 0; }
}

/* 21a. App bar ------------------------------------------------------------ */
.mshell-appbar {
    position: sticky; inset-block-start: 0; z-index: var(--z-sticky);
    padding-top: var(--safe-top);
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), background var(--transition);
    user-select: none; -webkit-user-select: none;
}
/* The hairline + lift only appear once content has scrolled under the bar. */
.mshell-appbar.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 14px rgba(16, 33, 43, .06); }

.mshell-appbar-inner {
    display: flex; align-items: center; gap: .5rem;
    height: var(--appbar-h); padding-inline: 14px;
}

.mshell-appbar-brand { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; color: var(--ink); }
.mshell-appbar-brand:hover { color: var(--ink); }
.mshell-appbar-brand .brand-mark { width: 32px; height: 32px; font-size: .95rem; border-radius: var(--r-sm); }
.mshell-appbar-brand .brand-mark i { font-size: .95rem; }
/* The site name is admin-editable, so it must never be able to shove the avatar off-screen. */
.mshell-appbar-wordmark {
    font-weight: 700; font-size: 1.08rem; letter-spacing: -.015em; color: var(--ink);
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mshell-back {
    display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 36px; height: 36px; margin-inline-start: -8px;
    border-radius: 50%; color: var(--ink); font-size: 1.3rem;
    transition: background var(--transition), transform var(--transition);
}
.mshell-back:active { background: var(--surface-3); transform: scale(.9); color: var(--ink); }

.mshell-appbar-title {
    flex: 1 1 auto; min-width: 0;
    font-size: 1.02rem; font-weight: 700; color: var(--ink); letter-spacing: -.015em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mshell-appbar-actions { display: flex; align-items: center; gap: .4rem; margin-inline-start: auto; flex: 0 0 auto; }
.mshell-appbar-avatar {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
    background: transparent; border: 0; border-radius: 50%; cursor: pointer;
    transition: transform var(--transition);
}
.mshell-appbar-avatar .avatar { width: 32px; height: 32px; font-size: .82rem; }
.mshell-appbar-avatar:active { transform: scale(.9); }

/* 21b. Bottom tab bar ----------------------------------------------------- */
.mshell-tabbar {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 1035;
    align-items: stretch; overflow: visible;
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 24px rgba(16, 33, 43, .07);
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

.mshell-tab {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: var(--tabbar-h); padding: 0 2px;
    background: transparent; border: 0; cursor: pointer;
    color: var(--muted); font-family: inherit; font-size: .66rem; font-weight: 600; line-height: 1;
    text-decoration: none; transition: color var(--transition);
}
.mshell-tab:hover { color: var(--muted); }
.mshell-tab-icon {
    display: grid; place-items: center; width: 52px; height: 26px;
    border-radius: var(--pill); font-size: 1.24rem;
    transition: background var(--transition), transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
.mshell-tab-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mshell-tab.active { color: var(--primary-700); }
.mshell-tab.active .mshell-tab-icon { background: var(--primary-soft); }
.mshell-tab:active .mshell-tab-icon { transform: scale(.86); }

/* On a tablet, tabs stretched across the full width read as a toolbar rather than a
   tab bar — cluster them in the middle at a phone-like size instead. */
@media (min-width: 576px) {
    .mshell-tabbar { justify-content: center; }
    .mshell-tab { flex: 0 1 132px; }
}

/* Raised centre action (employee "Scan"): the one thing the app exists to do. */
.mshell-tab-action { justify-content: flex-end; padding-bottom: 7px; gap: 5px; color: var(--primary-700); }
.mshell-fab {
    display: grid; place-items: center; width: 54px; height: 54px; margin-top: -24px;
    border-radius: 50%; color: #fff; font-size: 1.4rem;
    background: linear-gradient(150deg, var(--primary), var(--primary-700));
    box-shadow: 0 0 0 5px var(--surface), 0 10px 22px -6px rgba(var(--primary-rgb), .7);
    transition: transform .18s cubic-bezier(.34, 1.56, .64, 1);
}
.mshell-tab-action:active .mshell-fab { transform: scale(.9); }

/* 21c. "More" bottom sheet ------------------------------------------------ */
.mshell-sheet.offcanvas-bottom {
    height: auto; max-height: min(86dvh, 760px);
    border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface); color: var(--body);
    box-shadow: 0 -10px 44px rgba(16, 33, 43, .2);
}
.mshell-sheet-handle {
    flex: 0 0 auto; width: 38px; height: 4px; border-radius: var(--pill);
    background: var(--border-strong); margin: 9px auto 2px;
}
.mshell-sheet-head {
    display: flex; align-items: center; gap: .75rem;
    padding: .5rem 1.1rem .85rem; border-bottom: 1px solid var(--border);
}
.mshell-sheet-identity { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mshell-sheet-identity strong { color: var(--ink); font-size: .95rem; overflow-wrap: anywhere; }
.mshell-sheet-identity span { color: var(--muted); font-size: .78rem; }
.mshell-sheet-close {
    display: grid; place-items: center; width: 36px; height: 36px; margin-inline-start: auto; flex: 0 0 auto;
    border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted-strong);
    font-size: .85rem; cursor: pointer;
}
.mshell-sheet-close:active { transform: scale(.9); }

.mshell-sheet-body { padding: 1rem 1.1rem calc(1.1rem + var(--safe-bottom)); overscroll-behavior: contain; }
.mshell-sheet-caption {
    margin: 0 0 .6rem; font-size: .72rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.mshell-sheet-caption:not(:first-child) { margin-top: 1.4rem; }

.mshell-menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: .6rem; }
.mshell-menu-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
    min-height: 92px; padding: .85rem .35rem; text-align: center;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
    color: var(--body); font-size: .73rem; font-weight: 600; line-height: 1.25;
    transition: transform var(--transition), background var(--transition), border-color var(--transition);
}
.mshell-menu-tile i {
    display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto;
    border-radius: var(--r); background: var(--primary-soft); color: var(--primary-700); font-size: 1.15rem;
}
.mshell-menu-tile:active { transform: scale(.95); background: var(--surface-3); }
.mshell-menu-tile.active { border-color: var(--primary); background: var(--primary-softer); color: var(--primary-700); }

.mshell-sheet-rows { display: flex; flex-direction: column; gap: .15rem; }
.mshell-sheet-form { margin: 0; }
.mshell-sheet-row {
    display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 54px;
    padding: .6rem .65rem; border: 0; border-radius: var(--r-md); background: transparent;
    color: var(--body); font-family: inherit; font-size: .93rem; font-weight: 600; text-align: start; cursor: pointer;
    transition: background var(--transition);
}
.mshell-sheet-row > i:first-child {
    display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto;
    border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted-strong); font-size: 1rem;
}
.mshell-sheet-chevron { margin-inline-start: auto; color: var(--muted); font-size: .78rem; }
.mshell-sheet-row:active { background: var(--surface-2); }
.mshell-sheet-row-danger { color: var(--danger); }
.mshell-sheet-row-danger > i:first-child { background: var(--danger-soft); color: var(--danger); }

/* 21d. Native-feeling content on phones ----------------------------------- */
@media (max-width: 767.98px) {
    /* Large in-content title, app-bar title above it — the iOS/Android title pair.
       The hero loses its own card so the screen reads as one continuous surface. */
    .dashboard-hero, .reports-hero {
        padding: 0; margin-bottom: 1.1rem; gap: .85rem;
        background: none; border: 0; box-shadow: none;
        flex-direction: column; align-items: stretch;
    }
    .dashboard-hero .page-title, .reports-hero .page-title { font-size: 1.5rem; }
    .dashboard-hero > * + *, .reports-hero > * + * { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; }
    .dashboard-hero > * + * .btn, .reports-hero > * + * .btn { flex: 1 1 auto; }

    .app-card, .metric, .report-tile,
    .data-panel, .detail-panel, .filter-panel, .settings-panel, .stitch-panel,
    .kiosk-panel, .hours-report-panel, .schedule-card, .report-console, .status-card {
        border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
    }

    /* Row cards read as a grouped list rather than a stack of outlined boxes. */
    .table-responsive .table tr, .stitch-table tr {
        border-radius: var(--r-md); box-shadow: var(--shadow-xs); margin-bottom: .6rem;
    }
    .table-responsive .table td, .stitch-table td { padding: .62rem .85rem; font-size: .88rem; }

    /* Horizontal rails get edge padding + snap so a swipe lands on a whole tab. */
    .report-tabs { padding-inline: .75rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
    .report-tab { scroll-snap-align: start; }

    /* Dialogs arrive as bottom sheets, the way phone dialogs actually behave. */
    .modal-dialog, .modal-dialog-centered {
        position: fixed; inset-inline: 0; inset-block-end: 0;
        max-width: none; width: 100%; margin: 0; min-height: 0; align-items: flex-end;
    }
    /* Bootstrap pins scrollable dialogs to the viewport height; a sheet sizes to content. */
    .modal-dialog-scrollable { height: auto; }
    .modal-content { border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: var(--safe-bottom); }
    .modal-body { max-height: 62dvh; overflow-y: auto; overscroll-behavior: contain; }
    .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .28s cubic-bezier(.32, .72, 0, 1); }
    .modal.show .modal-dialog { transform: none; }
    .modal-footer > .btn { flex: 1 1 auto; }
}

/* On touch screens a :hover lift sticks after a tap, leaving the button visibly
   raised until something else is touched. Press feedback comes from :active. */
@media (hover: none) {
    .btn:hover, .btn-primary:hover, .btn-success:hover, .btn-danger:hover,
    .stitch-button:hover, .stitch-button-primary:hover { transform: none; }
}

/* Installed to the home screen: no browser chrome to pull against. */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; }
}
