/* ===================================================================
   Rescue 1122 Sindh - Material Design 3 skin
   Loaded after style.css. All colours come from --md-* variables that
   theme.js generates from one seed colour (see the Theme button).
   =================================================================== */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("../../vendor/fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("../../vendor/fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("../../vendor/fonts/roboto-latin-700-normal.woff2") format("woff2"); }

:root {
  /* fallback palette (replaced at runtime by theme.js) */
  --md-primary: #b6171e; --md-on-primary: #fff; --md-primary-container: #ffdad6; --md-on-primary-container: #410002;
  --md-secondary: #775652; --md-on-secondary: #fff; --md-secondary-container: #ffdad6; --md-on-secondary-container: #2c1512;
  --md-error: #ba1a1a; --md-on-error: #fff; --md-error-container: #ffdad6; --md-on-error-container: #410002;
  --md-surface: #fff8f7; --md-on-surface: #231918; --md-on-surface-variant: #534341; --md-outline: #857371; --md-outline-variant: #d8c2bf;
  --md-surface-container-lowest: #fff; --md-surface-container-low: #fff0ee; --md-surface-container: #fce9e7; --md-surface-container-high: #f6e4e2; --md-surface-container-highest: #f0dedc;
  --md-inverse-surface: #392e2d; --md-inverse-on-surface: #ffedea;
  --md-ok: #15803d; --md-ok-container: #d7f2de; --md-warn: #9a5b00; --md-warn-container: #ffe9c7;

  --md-font: "Roboto", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --md-shape-s: 8px; --md-shape-m: 12px; --md-shape-l: 16px; --md-shape-xl: 28px;
  --md-elev-1: 0 1px 2px rgba(0,0,0,.14), 0 1px 3px 1px rgba(0,0,0,.07);
  --md-elev-2: 0 1px 2px rgba(0,0,0,.14), 0 2px 6px 2px rgba(0,0,0,.08);
  --md-elev-3: 0 4px 8px 3px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.2);

  /* re-point the older token layer so every existing screen follows the palette */
  --o-paper: var(--md-surface);
  --o-surface: var(--md-surface-container-lowest);
  --o-ink: var(--md-on-surface);
  --o-muted: var(--md-on-surface-variant);
  --o-line: var(--md-outline-variant);
  --o-line-soft: var(--md-surface-container-high);
  --o-green: var(--md-primary);
  --o-green-2: var(--md-primary);
  --o-green-tint: var(--md-secondary-container);
  --o-red: var(--md-error);
  --o-red-dark: var(--md-error);
  --o-red-tint: var(--md-error-container);
  --o-amber: var(--md-warn);
  --o-amber-tint: var(--md-warn-container);
  --o-ok: var(--md-ok);
  --o-ok-tint: var(--md-ok-container);
  --o-head: var(--md-font);
  --o-body: var(--md-font);
  --o-radius: var(--md-shape-l);
}

html, body { background: var(--md-surface) !important; color: var(--md-on-surface); font-family: var(--md-font) !important; }
body, button, input, select, textarea { font-family: var(--md-font) !important; }
h1, h2, h3, h4, strong { font-family: var(--md-font) !important; }
::selection { background: var(--md-primary-container); color: var(--md-on-primary-container); }
a { color: var(--md-primary); }

/* ---------- Layout: navigation drawer + top app bar ---------- */
.app-page { background: var(--md-surface) !important; }
.sidebar {
  background: var(--md-surface-container-low) !important;
  color: var(--md-on-surface) !important;
  border-right: 0 !important;
  box-shadow: none !important;
}
.sidebar::before, .sidebar::after, .app-shell::before, .topbar::before, .topbar::after, .login-box::before { display: none !important; }
.sidebar-brand { border-bottom: 0 !important; padding: 20px 20px 12px !important; }
.sidebar-brand strong { color: var(--md-on-surface) !important; font-size: 15px !important; font-weight: 700 !important; letter-spacing: .02em; }
.sidebar-brand span { color: var(--md-on-surface-variant) !important; font-size: 12px !important; }
.brand-mark { background: var(--md-primary) !important; color: var(--md-on-primary) !important; border-radius: var(--md-shape-m) !important; box-shadow: none !important; font-weight: 700 !important; }

.sidebar .sidebar-nav { padding: 6px 12px !important; gap: 2px !important; }
.sidebar .sidebar-nav .tab, .sidebar .tab {
  min-height: 48px !important;
  border: 0 !important; border-radius: var(--md-shape-xl) !important;
  padding: 0 16px !important;
  color: var(--md-on-surface-variant) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 14px !important; font-weight: 500 !important; letter-spacing: .01em;
  text-align: left; transition: background .15s ease, color .15s ease;
}
.sidebar .sidebar-nav .tab:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent) !important; }
.sidebar .sidebar-nav .tab.active {
  background: var(--md-secondary-container) !important;
  color: var(--md-on-secondary-container) !important;
  box-shadow: none !important;
}
.sidebar .tab.active::before, .sidebar .tab::before { display: none !important; }
.sidebar .tab:disabled, .sidebar .tab[disabled] { opacity: .4 !important; }
.sidebar .tab.active .nav-icon, .nav-icon { color: inherit !important; opacity: 1 !important; }
.nav-badge { background: var(--md-error) !important; color: var(--md-on-error) !important; border-radius: 999px !important; margin-left: auto; }

.sidebar-footer { border-top: 0 !important; padding: 12px !important; color: var(--md-on-surface-variant) !important; }
.sidebar-footer > span:first-of-type { color: var(--md-on-surface-variant) !important; }
.sidebar-footer .user-card { background: var(--md-surface-container) !important; border-radius: var(--md-shape-l) !important; }
.user-avatar, .sidebar-footer .user-card .user-avatar { background: var(--md-primary) !important; color: var(--md-on-primary) !important; }
.user-meta strong { color: var(--md-on-surface) !important; }
.user-meta small, .user-meta small.user-id { color: var(--md-on-surface-variant) !important; }
.sidebar-footer button, .sidebar-footer .ghost {
  background: transparent !important; color: var(--md-primary) !important;
  border: 1px solid var(--md-outline) !important; border-radius: 999px !important; box-shadow: none !important;
}
.sidebar-footer button:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent) !important; }

.app-shell { background: var(--md-surface) !important; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  margin: 0 !important; padding: 12px 24px !important;
  min-height: 72px;
  background: color-mix(in srgb, var(--md-surface) 92%, transparent) !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  border-bottom: 1px solid var(--md-outline-variant) !important;
}
.topbar h1 { color: var(--md-on-surface) !important; font-size: 22px !important; font-weight: 500 !important; letter-spacing: 0 !important; }
.topbar p { color: var(--md-on-surface-variant) !important; }
.powered-by, .topbar-credit { color: var(--md-outline) !important; }
.header-pill, .storage-status {
  background: var(--md-surface-container-high) !important; color: var(--md-on-surface-variant) !important;
  border: 0 !important; border-radius: var(--md-shape-s) !important; font-weight: 500 !important; box-shadow: none !important;
}
.storage-status::before { background: var(--md-ok) !important; }
.icon-button { background: transparent !important; color: var(--md-on-surface) !important; border: 0 !important; box-shadow: none !important; border-radius: 50% !important; }
.icon-button:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent) !important; }

.tab-panel { padding-top: 8px; }
.panel-heading { margin-bottom: 16px !important; }
.panel-heading h2, .tab-panel > h2 { color: var(--md-on-surface) !important; font-size: 28px !important; font-weight: 400 !important; letter-spacing: 0 !important; }
.eyebrow, .panel-heading .eyebrow {
  color: var(--md-primary) !important; font-size: 12px !important; font-weight: 500 !important;
  letter-spacing: .1em !important; text-transform: uppercase;
}
.panel-heading p, .muted, small { color: var(--md-on-surface-variant); }

/* ---------- Cards, stats, tables ---------- */
.toolbar, .employee-form, .analytics-card, .table-wrap, .summary-layout article,
.form-card, .panel-card, .card, details.collapsible, .collapsible {
  background: var(--md-surface-container-lowest) !important;
  border: 1px solid var(--md-outline-variant) !important;
  border-radius: var(--md-shape-l) !important;
  box-shadow: none !important;
  color: var(--md-on-surface);
}
.stats-grid, .performance-summary-grid, .employee-summary-grid, .leave-overview {
  background: transparent !important; border: 0 !important; box-shadow: none !important; gap: 12px !important; padding: 0 !important;
}
.stats-grid > div, .kpi-grid > div, .performance-summary-grid > article, .employee-summary-grid > div, .leave-overview > div {
  background: var(--md-surface-container) !important;
  border: 0 !important; border-radius: var(--md-shape-l) !important; box-shadow: none !important;
  color: var(--md-on-surface) !important;
}
.stats-grid strong, .kpi-grid strong { font-weight: 500 !important; color: var(--md-on-surface); }
.stats-grid span, .kpi-grid span { color: var(--md-on-surface-variant) !important; }
.tile-icon { border-radius: var(--md-shape-m) !important; }
.analytics-card h3, .analytics-card h2 { color: var(--md-on-surface) !important; font-weight: 500 !important; }

table { border-collapse: separate; border-spacing: 0; }
thead th, th {
  background: var(--md-surface-container) !important; color: var(--md-on-surface-variant) !important;
  font-weight: 500 !important; font-size: 12.5px !important; letter-spacing: .03em; text-transform: none !important;
  border-bottom: 1px solid var(--md-outline-variant) !important;
}
td { color: var(--md-on-surface); border-bottom: 1px solid var(--md-surface-container-high) !important; }
tbody tr:nth-child(even) { background: transparent !important; }
tbody tr:hover { background: color-mix(in srgb, var(--md-primary) 5%, transparent) !important; }
.table-wrap { overflow: auto; }

/* ---------- Buttons ---------- */
button:not(.tab):not(.icon-button):not(.md-swatch):not(.md-fab):not(.link-button):not(.login-mode-tab):not(.employee-thumb):not(.pw-x):not(.md-theme-x):not(.ghost):not(.secondary):not(.danger):not(.profile-trigger):not([data-sm-go]):not(.password-reset-bell-btn):not([class*="fm-"]):not([class*="sm-"]):not([class*="hr-"]) {
  border-radius: 999px !important;
  min-height: 40px;
  padding: 0 22px;
  font-size: 14px !important; font-weight: 500 !important; letter-spacing: .01em;
  background: var(--md-primary) !important; color: var(--md-on-primary) !important;
  border: 0 !important; box-shadow: none !important;
  transition: box-shadow .15s ease, filter .15s ease;
}
button:not(.tab):not(.icon-button):not(.md-swatch):not(.md-fab):not(.link-button):not(.login-mode-tab):not(.employee-thumb):not(.pw-x):not(.md-theme-x):not(.ghost):not(.secondary):not(.danger):not(.profile-trigger):not([data-sm-go]):not(.password-reset-bell-btn):not([class*="fm-"]):not([class*="sm-"]):not([class*="hr-"]):hover { box-shadow: var(--md-elev-1) !important; filter: brightness(1.06); }
button.ghost, button.secondary, .secondary-button, button.outline {
  background: transparent !important; color: var(--md-primary) !important;
  border: 1px solid var(--md-outline) !important;
}
button.ghost:hover, button.secondary:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent) !important; box-shadow: none !important; filter: none !important; }
button.danger, .danger { background: var(--md-error) !important; color: var(--md-on-error) !important; border: 0 !important; }
button.ghost.danger, button.secondary.danger { background: transparent !important; color: var(--md-error) !important; border: 1px solid var(--md-error) !important; }
button:disabled, button[disabled] { opacity: .38 !important; box-shadow: none !important; filter: none !important; cursor: not-allowed; }
.link-button { color: var(--md-primary) !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }
.md-btn-tonal { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }

/* ---------- Fields ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]), select, textarea {
  background: var(--md-surface-container-lowest) !important;
  color: var(--md-on-surface) !important;
  border: 1px solid var(--md-outline) !important;
  border-radius: var(--md-shape-s) !important;
  min-height: 44px; box-shadow: none !important;
  font-size: 14.5px !important;
}
input::placeholder, textarea::placeholder { color: var(--md-on-surface-variant); opacity: .7; }
input:focus, select:focus, textarea:focus {
  outline: 0 !important; border-color: var(--md-primary) !important;
  box-shadow: 0 0 0 1px var(--md-primary) !important;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--md-primary); }
label { color: var(--md-on-surface-variant); font-weight: 500; }

/* ---------- Dialogs ---------- */
.form-modal, .pw-modal, .modal-backdrop { background: rgba(0, 0, 0, .42) !important; }
.form-modal-card, .pw-card, .modal-card {
  background: var(--md-surface-container-high) !important; color: var(--md-on-surface) !important;
  border: 0 !important; border-radius: var(--md-shape-xl) !important; box-shadow: var(--md-elev-3) !important;
}
.form-modal-card h2, .form-modal-card h3, .pw-card h2, .pw-card h3 { color: var(--md-on-surface) !important; font-weight: 400 !important; }
.pw-modal .pw-x { background: transparent !important; color: var(--md-on-surface-variant) !important; }

/* ---------- Chips / badges ---------- */
.role-chip, .filter-count, .profile-chip, .employee-shift-badge, .chip {
  background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important;
  border: 0 !important; border-radius: var(--md-shape-s) !important; font-weight: 500 !important;
}
.toast, .toast-stack > * { background: var(--md-inverse-surface) !important; color: var(--md-inverse-on-surface) !important; border-radius: var(--md-shape-s) !important; box-shadow: var(--md-elev-3) !important; }

/* ---------- Login page ---------- */
.login-page { background: var(--md-surface) !important; }
.login-box {
  background: var(--md-surface-container-lowest) !important;
  border: 1px solid var(--md-outline-variant) !important;
  border-radius: var(--md-shape-xl) !important; box-shadow: var(--md-elev-2) !important; overflow: hidden;
}
.login-box h1 { color: var(--md-on-surface) !important; font-weight: 500 !important; }
.login-kicker { color: var(--md-primary) !important; font-weight: 500 !important; letter-spacing: .1em; }
.login-box p.login-lead { color: var(--md-on-surface-variant) !important; }
.login-mode-tab { border-radius: 999px !important; }

/* ---------- Floating theme button + panel ---------- */
.md-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 56px; height: 56px; padding: 0; border: 0; border-radius: var(--md-shape-l);
  display: grid; place-items: center; cursor: pointer;
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  box-shadow: var(--md-elev-3);
}
.md-fab:hover { filter: brightness(.97); }
.md-theme-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 901; width: min(340px, calc(100vw - 32px));
  padding: 18px 18px 16px; border-radius: var(--md-shape-xl);
  background: var(--md-surface-container-high); color: var(--md-on-surface); box-shadow: var(--md-elev-3);
}
.md-theme-panel[hidden] { display: none !important; }
.md-theme-head { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.md-theme-x { border: 0; background: transparent !important; color: var(--md-on-surface-variant) !important; font-size: 24px; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; padding: 0; box-shadow: none !important; }
.md-theme-label { margin: 14px 0 8px; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--md-on-surface-variant); }
.md-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 8px; }
.md-swatch { aspect-ratio: 1; width: 100%; min-height: 0; padding: 0; border-radius: 50% !important; border: 2px solid transparent !important; cursor: pointer; box-shadow: none !important; }
.md-swatch.on { border-color: var(--md-on-surface) !important; outline: 2px solid var(--md-surface-container-high); outline-offset: -4px; }
.md-custom { display: flex; gap: 8px; align-items: center; }
.md-custom input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-s); background: transparent; cursor: pointer; }
.md-custom input[type="text"] { flex: 1; min-width: 0; text-transform: uppercase; }
.md-seg { display: flex; border: 1px solid var(--md-outline); border-radius: 999px; overflow: hidden; }
.md-seg button { flex: 1; min-height: 38px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--md-on-surface) !important; padding: 0 !important; box-shadow: none !important; filter: none !important; }
.md-seg button + button { border-left: 1px solid var(--md-outline) !important; }
.md-seg button.on { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }
.md-theme-note { margin: 12px 0 0; font-size: 12px; color: var(--md-on-surface-variant); }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .sidebar { background: var(--md-surface-container-low) !important; box-shadow: var(--md-elev-3) !important; }
  .topbar { padding: 8px 12px !important; min-height: 60px; }
  .topbar h1 { font-size: 18px !important; }
  .panel-heading h2, .tab-panel > h2 { font-size: 22px !important; }
  .md-fab { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .md-theme-panel { right: 14px; bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Specificity fixes for older override layers ---------- */
:root { --o-livery: none; }
.sidebar .sidebar-nav button.tab:not(.secondary):not(.ghost):not(.danger):not(.link-button):not(.login-mode-tab):not(.icon-button) {
  background: transparent !important; color: var(--md-on-surface-variant) !important; box-shadow: none !important; border-radius: var(--md-shape-xl) !important;
}
.sidebar .sidebar-nav button.tab.active:not(.secondary):not(.ghost):not(.danger):not(.link-button):not(.login-mode-tab):not(.icon-button) {
  background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important;
}
.sidebar .sidebar-footer button:not(.tab):not(.icon-button):not(.md-swatch) {
  background: transparent !important; color: var(--md-primary) !important; border: 1px solid var(--md-outline) !important; box-shadow: none !important;
}
.sidebar .sidebar-footer button:not(.tab):hover { background: color-mix(in srgb, var(--md-primary) 10%, transparent) !important; filter: none !important; }

button.ghost:not(.x), button.secondary:not(.x) { background: transparent !important; color: var(--md-primary) !important; border: 1px solid var(--md-outline) !important; border-radius: 999px !important; min-height: 40px; padding: 0 22px; font-weight: 500 !important; box-shadow: none !important; }
button.danger:not(.ghost):not(.secondary) { border-radius: 999px !important; min-height: 40px; padding: 0 22px; font-weight: 500 !important; }
button.profile-trigger:not(.employee-thumb) { background: transparent !important; color: var(--md-primary) !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 0 !important; border-radius: 4px !important; font-weight: 500 !important; text-align: left; }
.password-reset-bell-btn { background: var(--md-error-container) !important; color: var(--md-on-error-container) !important; border: 0 !important; border-radius: 50% !important; box-shadow: none !important; }
details > summary, .collapsible > summary, .import-panel > summary { background: transparent !important; color: var(--md-on-surface) !important; }
details { background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important; }
.tool-drawer, .tool-drawer > summary, .performance-variable-editor, .performance-variable-editor > summary { background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important; border-color: var(--md-outline-variant) !important; border-radius: var(--md-shape-l) !important; box-shadow: none !important; }
html[data-style="futuristic"] .tool-drawer, html[data-style="futuristic"] .tool-drawer > summary, html[data-style="futuristic"] details { background: var(--fx-glass) !important; border-color: var(--fx-line) !important; }

/* theme widget: id-level specificity so older button layers cannot touch it */
html body #mdThemeFab { border: 0 !important; position: fixed !important; left: auto !important; right: 20px !important; bottom: 20px !important; top: auto !important; width: 56px !important; height: 56px !important; min-height: 56px !important; padding: 0 !important; border-radius: 16px !important; background: var(--md-primary-container) !important; color: var(--md-on-primary-container) !important; box-shadow: var(--md-elev-3) !important; }
html[data-style="futuristic"] body #mdThemeFab { background: var(--md-primary) !important; color: var(--md-on-primary) !important; box-shadow: 0 0 22px var(--fx-glow) !important; }
html body #mdThemePanel .md-swatch { position: relative !important; width: 100% !important; aspect-ratio: 1; min-height: 0 !important; padding: 0 !important; border-radius: 50% !important; border: 2px solid transparent !important; box-shadow: none !important; }
html body #mdThemePanel .md-swatch.on { border-color: var(--md-on-surface) !important; }
html body #mdThemePanel .md-seg button { background: transparent !important; color: var(--md-on-surface) !important; border-radius: 0 !important; min-height: 38px !important; padding: 0 !important; box-shadow: none !important; }
html body #mdThemePanel .md-seg button.on { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }
html body #mdThemePanel .md-theme-x { border: 0 !important; background: transparent !important; color: var(--md-on-surface-variant) !important; width: 36px !important; min-height: 36px !important; padding: 0 !important; border-radius: 50% !important; box-shadow: none !important; }
html body #mdThemePanel #mdSeedApply { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }

/* component surfaces that older layers hard-coded to white */
button.fm-bell, button.fm-kpi, button.fm-quick, .password-reset-bell-btn, .fm-head, section.fm-card, section.pw-panel, .pie-tooltip, label.file-button, .filters.performance-filters, .performance-mini-result.pending, strong.performance-grade, button.sm-side.active {
  background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important; border-color: var(--md-outline-variant) !important;
}
button.fm-kpi, button.fm-quick { border-radius: var(--md-shape-l) !important; box-shadow: none !important; }
button.sm-side.active { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }
.fm-root h1, .fm-root h2, .fm-root h3, .fm-card h3, .fm-head h2 { color: var(--md-on-surface) !important; }
.fm-root, .fm-root p, .fm-root small, .fm-root td, .fm-root label { color: var(--md-on-surface); }
.fm-root .muted, .fm-root small { color: var(--md-on-surface-variant) !important; }
.fm-root a, .fm-root td a, .fm-root .link { color: var(--md-primary) !important; }
html[data-style="futuristic"] button.fm-bell, html[data-style="futuristic"] button.fm-kpi, html[data-style="futuristic"] button.fm-quick,
html[data-style="futuristic"] .fm-head, html[data-style="futuristic"] section.fm-card, html[data-style="futuristic"] section.pw-panel,
html[data-style="futuristic"] .filters.performance-filters, html[data-style="futuristic"] .pie-tooltip {
  background: var(--fx-glass) !important; border: 1px solid var(--fx-line) !important; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
html[data-style="futuristic"] button.sm-side.active { background: linear-gradient(90deg, color-mix(in srgb, var(--md-primary) 30%, transparent), transparent) !important; }

/* higher-specificity pass for fleet / store sub-components */
body :is(#appPage,#centralPage,#storePage) :is(button.fm-kpi, button.fm-quick, button.fm-bell, .fm-head, section.fm-card, section.pw-panel) {
  background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important; border-color: var(--md-outline-variant) !important;
}
body :is(#appPage,#centralPage,#storePage) button.sm-side {
  background: transparent !important; color: var(--md-on-surface-variant) !important; border: 0 !important; box-shadow: none !important; border-radius: var(--md-shape-xl) !important; min-height: 44px; padding: 0 16px;
}
body :is(#appPage,#centralPage,#storePage) button.sm-side.active { background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }
body :is(#appPage,#centralPage,#storePage) :is(button.fm-kpi *, button.fm-quick *) { color: inherit; }
html[data-style="futuristic"] body :is(#appPage,#centralPage,#storePage) :is(button.fm-kpi, button.fm-quick, button.fm-bell, .fm-head, section.fm-card, section.pw-panel) {
  background: var(--fx-glass) !important; border: 1px solid var(--fx-line) !important;
}
html[data-style="futuristic"] body :is(#appPage,#centralPage,#storePage) button.sm-side.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--md-primary) 30%, transparent), transparent) !important; color: var(--md-on-surface) !important; border-left: 2px solid var(--md-primary) !important; border-radius: 10px !important;
}

/* last detail fixes */
body button.employee-name-link, body button.collapse-toggle:not(.x) {
  min-height: 0 !important; box-shadow: none !important; border-radius: 6px !important;
}
body button.employee-name-link { background: transparent !important; color: var(--md-primary) !important; padding: 0 !important; border: 0 !important; text-align: left; font-weight: 500 !important; }
body button.collapse-toggle { background: transparent !important; color: var(--md-on-surface) !important; border: 0 !important; min-height: 44px !important; padding: 0 12px !important; font-weight: 500 !important; width: 100%; text-align: left; justify-content: flex-start; }
body button.collapse-toggle:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent) !important; }
body :is(button.password-reset-bell-btn, button.fm-bell) { background: var(--md-surface-container-high) !important; color: var(--md-on-surface) !important; border: 1px solid var(--md-outline-variant) !important; border-radius: 50% !important; }
body .password-reset-bell-btn .bell-symbol { color: var(--md-primary) !important; }
html[data-style="futuristic"] body :is(button.password-reset-bell-btn, button.fm-bell) { background: var(--fx-glass-strong) !important; border-color: var(--fx-line) !important; }
@media (max-width: 900px) {
  html body .sidebar { background: var(--md-surface-container-low) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; z-index: 60; }
  html[data-style="futuristic"] body .sidebar { background: color-mix(in srgb, var(--md-surface) 96%, #000) !important; }
  .topbar { flex-wrap: wrap; gap: 8px; align-items: center; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; width: 100%; }
  .topbar-actions .header-pill, .topbar-actions .storage-status { font-size: 12px !important; padding: 4px 10px !important; width: auto !important; }
  .topbar .icon-button { position: static !important; flex: none; width: 44px; height: 44px; background: var(--md-secondary-container) !important; color: var(--md-on-secondary-container) !important; }
}

html body .sidebar .sidebar-nav button.tab { border: 0 !important; }
html[data-style="futuristic"] body .sidebar .sidebar-nav button.tab.active:not(.secondary):not(.ghost):not(.danger):not(.link-button):not(.login-mode-tab):not(.icon-button) { border-left: 2px solid var(--md-primary) !important; }
body .fm-root button.fm-btn.primary { background: var(--md-primary) !important; color: var(--md-on-primary) !important; border: 0 !important; }
body :is(#appPage,#centralPage,#storePage) .fm-root button.fm-btn.primary { background: var(--md-primary) !important; color: var(--md-on-primary) !important; border: 0 !important; }

/* quick-action cards (buttons with a title + small description) must read as cards, not primary buttons */
body button[data-sm-go], body button:has(> strong):has(> small) {
  background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important;
  border: 1px solid var(--md-outline-variant) !important; border-radius: var(--md-shape-l) !important;
  box-shadow: none !important; filter: none !important; text-align: left; height: auto; padding: 14px 16px !important;
}
body button[data-sm-go] strong, body button:has(> strong):has(> small) strong { color: var(--md-on-surface) !important; font-size: 15px !important; font-weight: 600 !important; display: block; }
body button[data-sm-go] small, body button:has(> strong):has(> small) small { color: var(--md-on-surface-variant) !important; font-size: 13px !important; display: block; margin-top: 2px; }
body button[data-sm-go] .sm-quick-icon, body button[data-sm-go] svg { color: var(--md-primary) !important; }
body button[data-sm-go]:hover { border-color: var(--md-primary) !important; background: color-mix(in srgb, var(--md-primary) 6%, var(--md-surface-container-lowest)) !important; }
html[data-style="futuristic"] body button[data-sm-go] { background: var(--fx-glass) !important; border-color: var(--fx-line) !important; }
html[data-style="neo"] body button[data-sm-go] { background: var(--neo-bg) !important; border: 0 !important; box-shadow: var(--neo-raised-s) !important; }
html[data-style="bento"] body button[data-sm-go] { border: 0 !important; box-shadow: var(--bt-shadow) !important; }
html[data-style="pro"] body button[data-sm-go], html[data-style="pro"] body button:has(> strong):has(> small) { background: #fff !important; border: 1px solid var(--pr-line) !important; box-shadow: var(--pr-shadow) !important; border-radius: 14px !important; }

/* employee name links in tables: plain readable text, never a filled pill */
html body :is(#appPage,#centralPage,#storePage) table button.employee-name-link,
html body :is(#appPage,#centralPage,#storePage) button.employee-name-link {
  background: transparent !important; background-image: none !important; border: 0 !important; box-shadow: none !important;
  border-radius: 4px !important; min-height: 0 !important; height: auto !important; padding: 2px 0 !important;
  color: var(--md-primary) !important; font-size: 14.5px !important; font-weight: 600 !important; text-align: left !important;
  text-decoration: none !important; text-transform: none !important; filter: none !important; white-space: normal;
}
html body button.employee-name-link:hover { text-decoration: underline !important; background: transparent !important; }
html[data-style="neo"] body button.employee-name-link, html[data-style="futuristic"] body button.employee-name-link { color: color-mix(in srgb, var(--md-primary) 35%, #ffffff) !important; }
html[data-style="pro"] body button.employee-name-link { color: color-mix(in srgb, var(--md-primary) 85%, #000) !important; }

/* ---- Danger zone (clear data): always high-contrast, in every look ---- */
html body .clear-data-card { background: #fff1f1 !important; border: 2px solid #b91c1c !important; border-left-width: 8px !important; border-radius: 14px !important; box-shadow: none !important; padding: 20px 22px !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html body .clear-data-card h3 { color: #7f1d1d !important; font-size: 22px !important; font-weight: 800 !important; margin: 0 0 6px !important; text-shadow: none !important; }
html body .clear-data-card p { color: #3b1212 !important; font-size: 17px !important; line-height: 1.5 !important; font-weight: 500 !important; max-width: 70ch; }
html body .clear-data-card button, html body .clear-data-card button.danger {
  background: #b91c1c !important; color: #ffffff !important; border: 2px solid #7f1d1d !important; border-radius: 12px !important;
  font-size: 17px !important; font-weight: 700 !important; min-height: 50px !important; padding: 0 24px !important; letter-spacing: 0 !important;
  box-shadow: 0 2px 0 #7f1d1d !important; text-shadow: none !important; filter: none !important;
}
html body .clear-data-card button:hover { background: #991b1b !important; }
html body .clear-data-card button:active { transform: translateY(1px); box-shadow: none !important; }
/* confirmation dialog */
html[data-style] body div.cd-card.pw-card { background: #ffffff !important; color: #111827 !important; border-top: 8px solid #b91c1c !important; border-radius: 16px !important; }
html[data-style] body div.cd-card.pw-card .pw-head strong { color: #7f1d1d !important; font-size: 21px !important; font-weight: 800 !important; }
html[data-style] body div.cd-card.pw-card .pw-note { color: #1f2937 !important; font-size: 16.5px !important; line-height: 1.5 !important; background: #fff1f1 !important; border: 1px solid #fca5a5 !important; border-radius: 10px; padding: 12px 14px; }
html[data-style] body div.cd-card.pw-card .pw-note.warn { background: #fff7e0 !important; border-color: #ecd48a !important; color: #5c3d00 !important; }
html[data-style] body div.cd-card.pw-card label, html[data-style] body div.cd-card.pw-card label span { color: #111827 !important; font-size: 16px !important; font-weight: 600 !important; }
html[data-style] body div.cd-card.pw-card input[type="text"], html[data-style] body div.cd-card.pw-card input[type="password"] { background: #fff !important; color: #111827 !important; border: 2px solid #6b7280 !important; border-radius: 10px !important; font-size: 17px !important; min-height: 50px !important; box-shadow: none !important; }
html[data-style] body div.cd-card.pw-card .pw-msg { font-size: 15.5px !important; }
html[data-style] body div.cd-card.pw-card .pw-msg.bad { color: #b91c1c !important; } html[data-style] body div.cd-card.pw-card .pw-msg.ok { color: #15803d !important; }
html[data-style] body div.cd-card.pw-card .pw-actions button.danger, html[data-style] body div.cd-card.pw-card #cdGo { background: #b91c1c !important; color: #fff !important; border: 2px solid #7f1d1d !important; border-radius: 12px !important; font-size: 17px !important; font-weight: 700 !important; min-height: 50px !important; box-shadow: none !important; }
html[data-style] body div.cd-card.pw-card .pw-actions button.secondary { background: #fff !important; color: #111827 !important; border: 2px solid #6b7280 !important; border-radius: 12px !important; font-size: 17px !important; font-weight: 600 !important; min-height: 50px !important; box-shadow: none !important; }
html[data-style] body div.cd-card.pw-card .pw-x { color: #374151 !important; font-size: 28px !important; }

html[data-style] body div.cd-card.pw-card { background: #ffffff !important; box-shadow: 0 24px 60px rgba(0,0,0,.45) !important; }
html[data-style] body div.cd-card.pw-card .pw-head { background: #fff5f5 !important; border-bottom: 1px solid #fca5a5 !important; }
html[data-style] body div.cd-card.pw-card .pw-body { background: #ffffff !important; }
html[data-style] body div.cd-card.pw-card .pw-x { background: transparent !important; color: #374151 !important; box-shadow: none !important; }
html[data-style] body div.cd-card.pw-card .pw-head button.pw-x, html body .pw-modal .cd-card .pw-head button.pw-x { background: #fee2e2 !important; color: #7f1d1d !important; border-radius: 8px !important; width: 36px !important; height: 36px !important; min-height: 36px !important; padding: 0 !important; font-size: 26px !important; line-height: 1 !important; box-shadow: none !important; }

/* status badges: fixed, high-contrast colours in every look (light chip, dark text) */
html body .central-status.warn, html body .badge.warn, html body .status-badge.bad { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fca5a5 !important; font-weight: 700 !important; }
html body .central-status.ok { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #86efac !important; font-weight: 700 !important; }
html body .central-status { border-radius: 8px !important; font-size: 13.5px !important; padding: 5px 12px !important; text-shadow: none !important; }

/* sub-tab pills (HR / store views) and small chips: guaranteed contrast */
html body button.hr-view.active, html body button.hr-view.sm-view.active { background: var(--md-primary) !important; color: var(--md-on-primary) !important; font-weight: 700 !important; border: 0 !important; }
html body button.hr-view:not(.active) { color: var(--md-on-surface) !important; background: transparent !important; }
html body .fm-chip { font-weight: 600 !important; }
html[data-style="futuristic"] body .fm-chip, html[data-style="neo"] body .fm-chip { background: rgba(255,255,255,.14) !important; color: #f1f5f9 !important; }
html body .fm-root i.fm-badge, html body .nav-badge, html body i.fm-count { background: #dc2626 !important; color: #fff !important; }

/* ---- Access Type (create / edit user ID): tidy grid, clear checked state, all looks ---- */
html body fieldset.central-access { padding: 22px 20px 18px !important; gap: 16px !important; min-width: 0; }
html body fieldset.central-access legend { padding: 0 10px !important; font-size: 16px !important; font-weight: 800 !important; color: var(--md-primary) !important; }
html body .central-access-preset { max-width: 460px; width: 100%; font-size: 14.5px !important; font-weight: 600 !important; }
html body .central-access-preset select { width: 100% !important; margin-top: 6px; }
html body .central-access-list { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important; gap: 12px !important; }
html body .central-access-item {
  display: flex !important; align-items: center !important; gap: 12px !important; min-height: 52px !important; padding: 10px 14px !important;
  border: 1.5px solid var(--md-outline-variant) !important; border-radius: 12px !important;
  background: var(--md-surface-container-lowest) !important; color: var(--md-on-surface) !important;
  font-size: 14.5px !important; font-weight: 500 !important; line-height: 1.35 !important; box-shadow: none !important; cursor: pointer;
}
html body .central-access-item input[type="checkbox"] { width: 20px !important; min-width: 20px !important; height: 20px !important; min-height: 20px !important; margin: 0 !important; accent-color: var(--md-primary) !important; flex: none; }
html body .central-access-item:has(input:checked) {
  background: color-mix(in srgb, var(--md-primary) 14%, var(--md-surface-container-lowest)) !important;
  border-color: var(--md-primary) !important; font-weight: 600 !important;
}
html body .central-access-item:hover { border-color: var(--md-primary) !important; }
html[data-style="neo"] body .central-access-item { background: var(--neo-bg) !important; border-color: transparent !important; box-shadow: var(--neo-raised-s) !important; color: var(--neo-text) !important; }
html[data-style="neo"] body .central-access-item:has(input:checked) { box-shadow: var(--neo-inset) !important; border-color: var(--md-primary) !important; background: color-mix(in srgb, var(--md-primary) 18%, var(--neo-bg)) !important; }
html[data-style="futuristic"] body .central-access-item { background: var(--fx-glass) !important; border-color: var(--fx-line) !important; color: var(--md-on-surface) !important; }
html[data-style="pro"] body .central-access-item { background: #fff !important; border-color: #cbd5e1 !important; color: #0f172a !important; }
html[data-style="pro"] body .central-access-item:has(input:checked) { background: color-mix(in srgb, var(--md-primary) 10%, #fff) !important; border-color: var(--md-primary) !important; }
html[data-style="bento"] body .central-access-item { background: #fff !important; border-color: #e5e9e7 !important; color: #0f172a !important; }
html body .central-hint { color: var(--md-on-surface-variant) !important; font-size: 13.5px !important; }
html body label.central-access-preset { background: transparent !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; border-radius: 0 !important; }

/* Access Type heading: sits inside the box, left-aligned, never cut by the border */
html body fieldset.central-access { display: block !important; padding: 18px 22px 20px !important; }
html body fieldset.central-access > legend {
  float: left; width: 100%; padding: 0 0 14px !important; margin: 0 0 14px !important;
  font-size: 17px !important; font-weight: 700 !important; line-height: 1.3; text-align: left; color: var(--md-primary) !important;
  border-bottom: 1px solid var(--md-outline-variant); text-shadow: none !important;
}
html body fieldset.central-access > legend + * { clear: both; }
html body fieldset.central-access > * + * { margin-top: 14px; }
html body fieldset.central-access > legend + label { margin-top: 0; }
html[data-style="neo"] body fieldset.central-access > legend, html[data-style="futuristic"] body fieldset.central-access > legend { color: color-mix(in srgb, var(--md-primary) 35%, #ffffff) !important; }
html[data-style="pro"] body fieldset.central-access > legend { color: color-mix(in srgb, var(--md-primary) 85%, #000) !important; }

/* ---- Phone polish ---- */
@media (max-width: 900px) {
  html body .topbar { height: auto !important; min-height: 64px; padding: 10px 14px !important; align-items: center; }
  html body .topbar-brand { min-width: 0; flex: 1 1 0; }
  html body .topbar h1 { font-size: 19px !important; line-height: 1.2; overflow-wrap: anywhere; }
  html body .topbar p { font-size: 13px !important; }
  html body .topbar-actions { width: 100%; }
  html body .app-shell { padding-left: 14px !important; padding-right: 14px !important; }
  html body #mdThemeFab { width: 48px !important; height: 48px !important; min-height: 48px !important; right: 12px !important; bottom: 12px !important; opacity: .92; }
  html body .table-wrap { -webkit-overflow-scrolling: touch; }
  html body button:not(.tab):not(.icon-button):not(.md-swatch):not(.md-fab) { min-height: 44px; }
  html body input:not([type="checkbox"]):not([type="radio"]), html body select { min-height: 46px; font-size: 16px !important; }
  html body .clear-data-card { padding: 16px !important; }
  html body .clear-data-card button { width: 100% !important; }
  html body .central-access-list { grid-template-columns: 1fr !important; }
  html body .form-modal-card, html body .pw-card { max-width: calc(100vw - 20px) !important; }
}
/* Desktop view forced on a phone: keep the page at full desktop width */
html[data-view="desktop"] body { min-width: 1200px; }
.md-theme-panel #mdViewSeg button { font-size: 13px; }
.md-theme-panel { max-height: calc(100vh - 100px); overflow-y: auto; }
html body #mdThemePanel .md-custom { flex-wrap: wrap; }
html body #mdThemePanel .md-custom input[type="text"] { flex: 1 1 120px !important; min-width: 110px !important; width: auto !important; }
html body #mdThemePanel #mdSeedApply { flex: 1 1 100%; }

/* Clickable KPI tiles */
html body .central-kpi-grid > .kpi-link{cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}
html body .central-kpi-grid > .kpi-link:hover{transform:translateY(-3px);box-shadow:0 8px 22px rgba(0,0,0,.18)}
html body .central-kpi-grid > .kpi-link:focus-visible{outline:3px solid var(--md-primary,#1F5FBF);outline-offset:2px}
html body .central-kpi-grid > .kpi-link::after{content:"View →";display:block;margin-top:6px;font-size:12px;font-weight:600;opacity:.7}
html body .kpi-flash{animation:kpiflash 1.8s ease}
@keyframes kpiflash{0%,60%{box-shadow:0 0 0 4px var(--md-primary,#1F5FBF)}100%{box-shadow:0 0 0 0 transparent}}
