:root {
  /* Five3 Servicepro blue palette */
  --bt-green: #2563EB;
  --bt-green-dark: #1D4ED8;
  --bt-green-top: #3B82F6;
  --bt-accent: #06B6D4;
  --sidebar-bg: #0F172A;
  --sidebar-text: #94A3B8;
  --sidebar-active: #3B82F6;
  --sidebar-hover: #1E293B;
  --content-bg: #F1F5F9;
  --panel-bg: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --table-head: #F1F5F9;
  --table-hover: #EFF6FF;
  --danger: #EF4444;
  --link: #2563EB;
  --dash-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; }
html {
  height: 100%;
}
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--content-bg);
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top module bar */
.bt-topbar {
  background: linear-gradient(180deg, var(--bt-green-top) 0%, var(--bt-green) 100%);
  color: #fff;
  height: 48px;
  display: flex;
  align-items: stretch;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.bt-brand {
  display: none;
}
.bt-modules {
  display: flex;
  align-items: stretch;
  flex: 1;
}
.bt-module {
  display: flex;
  align-items: center;
  padding: 0 1.1rem;
  color: rgba(255,255,255,.92);
  text-decoration: none;
  font-size: 0.92rem;
  border-bottom: 3px solid transparent;
}
.bt-module:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.bt-module.active {
  background: rgba(0,0,0,.12);
  border-bottom-color: #fff;
  font-weight: 600;
}
.bt-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  margin-left: auto;
}
.bt-user { font-size: 0.85rem; opacity: .95; }
.bt-user-role {
  display: inline-block;
  margin-inline-start: .35rem;
  padding: .05rem .5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  font-size: .72rem;
  font-weight: 600;
  vertical-align: 1px;
}
.bt-user-role::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: .3rem;
  border-radius: 50%;
  background: var(--role-color, #fff);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
  vertical-align: 1px;
}
.bt-logout {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 0.25rem 0.65rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.82rem;
}
.bt-logout:hover { background: rgba(255,255,255,.25); }

.bt-nav-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  cursor: pointer;
}
.bt-nav-toggle:hover { background: rgba(0, 0, 0, 0.2); }
.bt-nav-toggle-bars,
.bt-nav-toggle-bars::before,
.bt-nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  position: relative;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.bt-nav-toggle-bars::before,
.bt-nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.bt-nav-toggle-bars::before { top: -6px; }
.bt-nav-toggle-bars::after { top: 6px; }
body.bt-nav-open .bt-nav-toggle-bars { background: transparent; }
body.bt-nav-open .bt-nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
body.bt-nav-open .bt-nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }
.bt-nav-backdrop {
  display: none;
  position: fixed;
  inset: 48px 0 0 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.45);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

/* Mobile horizontal page strip (Attendance / Device / System ? Personnel uses .bt-inner-tabs) */
.bt-mobile-subnav {
  display: none;
  flex-shrink: 0;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 0.35rem;
}
.bt-mobile-subnav::-webkit-scrollbar { display: none; }
.bt-mobile-subnav[hidden] { display: none !important; }
.bt-mobile-subnav-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.bt-mobile-subnav-link:hover { color: var(--text); text-decoration: none; }
.bt-mobile-subnav-link.active {
  color: var(--bt-green-dark);
  font-weight: 600;
  border-bottom-color: var(--bt-green);
}

/* Layout */
.bt-layout {
  display: flex;
  height: calc(100% - 48px);
  min-height: calc(100% - 48px);
  width: 100%;
}
@media (min-width: 901px) {
  .bt-topbar {
    margin-left: 268px;
    width: calc(100% - 268px);
  }
  html[dir="rtl"] .bt-topbar {
    margin-left: 0;
    margin-right: 268px;
  }
  body.bt-no-sidebar .bt-topbar {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  .bt-sidebar {
    margin-top: -48px;
    height: calc(100% + 48px);
    min-height: calc(100% + 48px);
    z-index: 110;
  }
  .bt-sidebar-brand {
    height: 48px;
    padding: 0 1rem;
  }
}
body.bt-no-sidebar .bt-nav-toggle,
body.bt-no-sidebar .bt-nav-backdrop,
body.bt-no-sidebar .bt-sidebar {
  display: none !important;
}
/* Live Map: normal document flow (no workbench) so content cannot collapse to 0 height. */
body.bt-no-sidebar .bt-layout,
body.bt-no-sidebar .bt-content,
body.bt-no-sidebar .bt-solo-content {
  display: block;
  height: auto;
  min-height: calc(100vh - 48px);
  overflow: visible;
  width: 100%;
  max-width: none;
  margin: 0;
}
body.bt-no-sidebar .bt-mobile-subnav {
  display: none !important;
}
body.bt-no-sidebar .bt-livemap-page {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
  flex: none;
}
/* Live Locations: scroll the solo content pane (parent .bt-content is overflow:hidden). */
body.bt-live-locations .bt-content {
  overflow: hidden;
}
body.bt-live-locations .bt-solo-content {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: block;
  width: 100%;
}
body.bt-live-locations .bt-locations-page {
  overflow: visible;
  height: auto;
  min-height: min-content;
  flex: none;
  display: block;
}
.bt-live-demo-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
  margin: 0.75rem 1rem 0;
  padding: 0.7rem 1rem;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.92rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.bt-live-demo-ribbon strong { color: #78350f; }
.bt-live-demo-badge {
  display: inline-block;
  margin-inline-start: 0.45rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
body.bt-tv-mode .bt-live-demo-ribbon {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  justify-content: center;
  text-align: center;
}
.bt-locations-page.is-demo .bt-live-loading p::after {
  content: none;
}
.bt-sidebar {
  width: 268px;
  min-width: 268px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0;
  overflow: hidden;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}
.bt-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 1rem 1rem 0.9rem;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.bt-sidebar-brand:hover { color: #fff; text-decoration: none; }
.bt-sidebar-logo {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.bt-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  line-height: 1.2;
}
.bt-sidebar-brand-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: #F8FAFC;
}
.bt-sidebar-brand-text span {
  font-size: 0.72rem;
  font-weight: 500;
  color: #7DD3FC;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-sidebar-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.55rem 0.75rem;
}
.bt-sidebar-foot {
  flex: 0 0 auto;
  position: relative;
  padding: 0.65rem 0.7rem 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}
.bt-account-menu {
  position: relative;
  margin: 0;
}
.bt-account-menu > summary.bt-sidebar-user {
  list-style: none;
  cursor: pointer;
  width: 100%;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
}
.bt-account-menu > summary.bt-sidebar-user::-webkit-details-marker { display: none; }
.bt-account-menu > summary.bt-sidebar-user::marker { content: ""; }
.bt-account-menu > summary.bt-sidebar-user:hover,
.bt-account-menu[open] > summary.bt-sidebar-user {
  background: rgba(255, 255, 255, 0.06);
}
.bt-account-caret {
  margin-left: auto;
  color: #64748B;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.bt-account-menu[open] .bt-account-caret { transform: rotate(180deg); }
.bt-account-panel {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: calc(100% + 0.4rem);
  z-index: 40;
  padding: 0.65rem 0.7rem 0.7rem;
  border-radius: 12px;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.bt-account-heading {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94A3B8;
}
.bt-account-lang {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
}
.bt-account-lang .bt-lang-btn {
  flex: 1;
  min-height: 32px;
  border-radius: 8px;
}
.bt-sidebar-logout-form { margin: 0; }
.bt-sidebar-foot .bt-logout {
  width: 100%;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #FCA5A5;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.bt-sidebar-foot .bt-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #FEE2E2;
  text-decoration: none;
}
.bt-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.bt-sidebar-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #334155, #1E293B);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #E2E8F0;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bt-sidebar-user-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.bt-sidebar-user-meta strong {
  font-size: 0.88rem;
  font-weight: 600;
  color: #F1F5F9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-sidebar-role {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ECFDF5;
  background: color-mix(in srgb, var(--role-color, #14B8A6) 78%, #0F172A);
}
.bt-sidebar-org {
  margin: 0.75rem 0.75rem 0.35rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  color: #E2E8F0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-sidebar-search {
  margin: 0 0.65rem 0.75rem;
  padding: 0.35rem 0.5rem;
  width: calc(100% - 1.3rem);
  border: 1px solid #555;
  border-radius: 3px;
  background: #2f353c;
  color: #ddd;
  font-size: 0.82rem;
}
.bt-nav-group {
  margin: 0 0 0.15rem;
  border-bottom: none;
  border-radius: 10px;
  overflow: hidden;
}
.bt-nav-group > summary.bt-nav-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.8rem 0.9rem;
  min-height: 44px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  color: #e2e6ea;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  user-select: none;
  list-style: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.bt-nav-group > summary.bt-nav-title::-webkit-details-marker { display: none; }
.bt-nav-group > summary.bt-nav-title::marker { content: ""; font-size: 0; }
.bt-nav-group > summary.bt-nav-title:hover { background: var(--sidebar-hover); color: #fff; }
.bt-nav-group[open] > summary.bt-nav-title {
  color: #fff;
  background: rgba(0, 0, 0, 0.08);
}
.bt-nav-group.is-active > summary.bt-nav-title {
  color: #fff;
  background: rgba(0, 0, 0, 0.08);
}
.bt-nav-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 15px;
  line-height: 1;
  color: #aeb6bf;
  opacity: 0.95;
}
.bt-nav-group[open] > summary .bt-nav-icon { color: #d5dbe1; }
.bt-nav-label { flex: 1; min-width: 0; }
.bt-nav-chevron {
  flex-shrink: 0;
  margin-left: auto;
  width: auto;
  font-size: 10px;
  line-height: 1;
  color: #8a939c;
  transition: transform 0.15s ease;
}
.bt-nav-group:not([open]) > summary .bt-nav-chevron { transform: rotate(-90deg); }
.bt-nav-group:not([open]) > .bt-nav-link { display: none; }
.bt-nav-group[open] > .bt-nav-link {
  background: transparent;
}
.bt-nav-flat {
  margin: 0 0 0.25rem;
  border-bottom: none;
}
.bt-nav-flat > .bt-nav-link,
.bt-nav-flat .bt-nav-row > .bt-nav-link {
  display: block;
  margin: 0.15rem 0;
  padding: 0.65rem 0.85rem;
  min-height: 40px;
  color: #CBD5E1;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
  border-left: none;
  border-radius: 10px;
  transition: background 0.12s ease, color 0.12s ease;
}
.bt-nav-flat > .bt-nav-link:hover,
.bt-nav-flat .bt-nav-row > .bt-nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.bt-nav-flat > .bt-nav-link.active,
.bt-nav-flat .bt-nav-row > .bt-nav-link.active {
  color: #fff;
  background: var(--sidebar-active);
  border-left-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.bt-nav-flat .bt-nav-row { background: transparent; }
.bt-nav-group > .bt-nav-link,
.bt-nav-group .bt-nav-row > .bt-nav-link {
  display: block;
  margin: 0.1rem 0.35rem;
  padding: 0.58rem 0.75rem 0.58rem 2.55rem;
  min-height: 36px;
  color: #94A3B8;
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.35;
  border-left: none;
  border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease;
}
.bt-nav-group > .bt-nav-link:hover,
.bt-nav-group .bt-nav-row > .bt-nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.bt-nav-group > .bt-nav-link.active,
.bt-nav-group .bt-nav-row > .bt-nav-link.active {
  color: #fff;
  background: #60A5FA;
  border-left-color: transparent;
  font-weight: 500;
  box-shadow: none;
}
.bt-nav-favorites .bt-nav-row > .bt-nav-link.active,
.bt-nav-favorites a.bt-nav-link.active {
  background: transparent;
  color: #94A3B8;
  font-weight: 400;
  box-shadow: none;
}
.bt-nav-group:not([open]) > .bt-nav-row { display: none; }
.bt-nav-group[open] > .bt-nav-row,
.bt-nav-favorites[open] .bt-nav-row { background: transparent; }
.bt-nav-favorites[open] .bt-nav-favorites-empty { background: transparent; }
.bt-nav-row {
  display: flex;
  align-items: stretch;
  position: relative;
}
.bt-nav-row > .bt-nav-link {
  flex: 1;
  min-width: 0;
  padding-right: 2.2rem;
}
.bt-nav-pin {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #8a939c;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: 0.55;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.bt-nav-row:hover .bt-nav-pin,
.bt-nav-pin.is-pinned {
  opacity: 1;
}
.bt-nav-pin:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fbbf24;
}
.bt-nav-pin.is-pinned {
  color: #fbbf24;
}
.bt-nav-favorites > summary .bt-nav-icon {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}
.bt-nav-favorites-list:empty + .bt-nav-favorites-empty {
  display: block;
}
.bt-nav-favorites-empty {
  margin: 0;
  padding: 0.55rem 0.9rem 0.75rem 2.85rem;
  font-size: 12px;
  line-height: 1.35;
  color: #8a939c;
  background: #323840;
}
.bt-nav-group[data-always-open] > summary .bt-nav-chevron {
  visibility: hidden;
}
.bt-content {
  flex: 1;
  padding: 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--content-bg);
}
.bt-content > .bt-page {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Page chrome */
.bt-page {
  background: var(--panel-bg);
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bt-page-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.bt-page-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text); }
.bt-toolbar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: #fff;
}
.bt-toolbar-spacer { flex: 1; }
.bt-dropdown {
  position: relative;
  display: inline-block;
}
.bt-dropdown-toggle::after {
  content: "";
}
.bt-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 40;
  padding: 0.25rem 0;
}
.bt-dropdown.open .bt-dropdown-menu { display: block; }
.bt-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.85rem;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.bt-dropdown-item:hover:not(.is-disabled):not(:disabled) {
  background: #f0f4f8;
}
.bt-dropdown-item.is-disabled,
.bt-dropdown-item:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}
.bt-modal-enroll { width: min(420px, 96vw); }
.bt-enroll-form { padding: 0.75rem 1rem 0; }
.bt-enroll-hint { margin: 0 0 0.75rem; padding: 0 0 0 130px; max-width: 28rem; }
.bt-enroll-status { font-size: 0.75rem; margin-right: 0.35rem; }
.bt-enroll-status.ok { color: #2e7d32; }
.bt-enroll-status.fail { color: #c62828; }
.bt-enroll-form .bt-form-row.compact {
  grid-template-columns: 130px 1fr;
  align-items: center;
  margin-bottom: 0.75rem;
}
.bt-modal-backdrop.is-open { display: flex; }
.bt-modal-backdrop[hidden] { display: none !important; }
.bt-search {
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.85rem;
  min-width: 180px;
}
.bt-page-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-bg);
}
.bt-page-body > .bt-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.bt-page-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bt-settings-panel {
  margin: 0;
  border-radius: 0;
  border-top: none;
  padding-bottom: 1.5rem;
}
.bt-settings-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.bt-settings-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.bt-settings-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.bt-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.35rem 1rem;
}
.bt-device-id {
  font-size: 0.78rem;
  word-break: break-all;
  background: #f3f4f6;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}
.bt-geo-map-link {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
}
.bt-geo-panel,
.bt-enroll-panel {
  margin: 0;
  border-radius: 0;
  border-top: none;
  padding: 1rem 1.15rem 1.5rem;
}
.bt-geo-hero {
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  margin: 0.75rem 0 1.25rem;
}
.bt-geo-add {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.05rem 1.1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.bt-geo-card-title {
  margin: 0;
  font-size: 0.95rem;
}
.bt-geo-actions { display: flex; }
.bt-geo-gps {
  width: 100%;
  min-height: 2.75rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.bt-geo-hint { margin: 0; }
.bt-geo-ll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.bt-geo-field span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.bt-geo-field input,
.bt-geo-name,
.bt-geo-coord,
.bt-geo-radius input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
}
.bt-geo-coord,
.js-geo-lat,
.js-geo-lng {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}
.bt-geo-save { margin-top: 0.15rem; }
.bt-geo-map-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.bt-geo-search {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: stretch;
  z-index: 5;
}
.bt-geo-search-field {
  flex: 1 1 10rem;
  min-width: 0;
  margin: 0;
}
.bt-geo-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.bt-geo-search-btn,
.bt-geo-expand-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.bt-geo-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 14rem;
  overflow: auto;
  z-index: 20;
}
.bt-geo-search-results li { margin: 0; }
.bt-geo-search-hit {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
}
.bt-geo-search-hit:hover,
.bt-geo-search-hit:focus {
  background: #f1f5f9;
  outline: none;
}
.bt-geo-search-empty {
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.bt-geo-map {
  min-height: 22rem;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #e8eef5;
  z-index: 1;
}
.bt-geo-done-map {
  display: none;
  width: 100%;
  min-height: 2.85rem;
}
.bt-geo-map-wrap.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 1200;
  margin: 0;
  padding: 0.75rem;
  gap: 0.55rem;
  background: #0f172a;
  box-sizing: border-box;
}
.bt-geo-map-wrap.is-maximized .bt-geo-map {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.18);
}
.bt-geo-map-wrap.is-maximized .bt-geo-map .leaflet-container {
  min-height: 100%;
  height: 100%;
}
.bt-geo-map-wrap.is-maximized .bt-geo-map-hint {
  color: rgba(248, 250, 252, 0.78);
  margin: 0;
}
.bt-geo-map-wrap.is-maximized .bt-geo-done-map {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bt-geo-map-wrap.is-maximized .bt-geo-expand-btn {
  background: #fff;
  border-color: #cbd5e1;
}
body.bt-geo-map-open {
  overflow: hidden;
}
.bt-geo-map .leaflet-container { height: 100%; min-height: 22rem; font-family: inherit; }
.bt-geo-address {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.bt-geo-address-label {
  display: block;
  font-size: 0.72rem;
  color: #166534;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bt-geo-address strong { font-size: 0.88rem; color: #14532d; }
.bt-geo-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.bt-geo-status.is-ok { color: #166534; }
.bt-geo-status.is-error { color: #b91c1c; }
.bt-geo-list-title {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}
.bt-geo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.85rem;
}
.bt-geo-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.95rem 0.75rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.bt-geo-card.is-inactive { opacity: 0.72; }
.bt-geo-card-form { display: flex; flex-direction: column; gap: 0.55rem; }
.bt-geo-card-address {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.bt-geo-card-address.is-missing { font-style: italic; }
.bt-geo-radius { display: flex; align-items: center; gap: 0.35rem; }
.bt-geo-radius span:first-child { font-size: 0.78rem; color: var(--text-muted); }
.bt-geo-radius input { width: 5.5rem; }
.bt-geo-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.2rem;
}
.bt-geo-card-actions { display: flex; gap: 0.35rem; }
.bt-geo-empty { margin: 1rem 0 0.25rem; }
.bt-status-pill {
  border: 0;
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.bt-status-pill.is-on { background: #e8f5e9; color: #1b7a32; }
.bt-status-pill.is-off { background: #f3f4f6; color: #6b7280; }
.bt-enroll-add {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem 1.05rem;
  margin-bottom: 1.1rem;
}
.bt-enroll-add-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 0.9rem;
  margin-bottom: 0.35rem;
}
.bt-enroll-add-grid > .field:not(.narrow) {
  flex: 0 1 24rem;
  width: min(100%, 24rem);
}
.bt-enroll-add-grid > .field.narrow {
  flex: 0 0 8.5rem;
  width: 8.5rem;
  max-width: 8.5rem;
}
.bt-enroll-add-grid > .field.narrow input {
  width: 100%;
}
.bt-site-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.bt-site-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}
.bt-site-pick input { margin: 0; }
.bt-site-pick em { color: var(--text-muted); font-style: normal; font-size: 0.72rem; }
.bt-site-picks-compact { margin-bottom: 0.4rem; }
.bt-enroll-table td { vertical-align: top; }
.bt-enroll-photo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: #eef2f6;
}
.bt-enroll-photo.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #64748b;
}
.bt-enroll-name,
.bt-enroll-meta,
.bt-enroll-email {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.bt-enroll-email {
  color: #1b7a32;
  font-weight: 600;
  word-break: break-all;
}
.bt-enroll-upload {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.35rem;
  max-width: 11rem;
}
.bt-enroll-upload input[type="file"] { font-size: 0.75rem; }
.bt-enroll-sites .btn,
.bt-enroll-upload + form,
td form { margin-top: 0.35rem; }
.bt-enroll-row-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 11rem;
}
.bt-enroll-sites-select {
  width: 100%;
  min-width: 10rem;
  max-width: 16rem;
  min-height: 2.1rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
}
.bt-enroll-perms {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.bt-enroll-perm {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.bt-enroll-perm input { margin: 0; }
.bt-enroll-hours {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}
.bt-enroll-hours input[type="time"] {
  margin-left: 0.25rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--line, #dbe3ee);
  border-radius: 6px;
  font: inherit;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.bt-enroll-reset-pin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.bt-enroll-lockout-warn {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.bt-email-alias {
  display: flex;
  align-items: stretch;
  max-width: 22rem;
  gap: 0;
}
.bt-email-alias-input {
  flex: 1 1 auto;
  min-width: 0;
}
.bt-email-alias-input input {
  width: 100%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.bt-email-domain {
  display: inline-flex;
  align-items: center;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.875rem;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .bt-enroll-add-grid > .field:not(.narrow) {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }
}
@media (max-width: 900px) {
  .bt-geo-hero {
    grid-template-columns: 1fr;
  }
  .bt-geo-map-wrap { order: -1; }
  .bt-geo-map,
  .bt-geo-map .leaflet-container {
    min-height: min(52vh, 22rem);
  }
  .bt-geo-gps,
  .bt-geo-save {
    min-height: 2.85rem;
  }
}
.bt-sync-status-panel {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  background: #f8fafb;
  border-bottom: 1px solid var(--border);
}
.bt-sync-status-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
}
.bt-sync-status-label {
  font-weight: 600;
  margin-right: 0.5rem;
}
.bt-sync-resource-table {
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
  max-width: 720px;
}

/* Data table (BioTime / ZKT style) */
.bt-table-wrap { overflow-x: auto; }
.bt-table-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #fff;
}
.bt-toolbar-columns {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}
.bt-table-toolbar-row {
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.bt-table-toolbar-row-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.bt-columns-picker { position: relative; flex-shrink: 0; }
.bt-columns-trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
  vertical-align: middle;
}
.bt-columns-trigger-label {
  display: inline-block;
  line-height: 1.2;
}
.bt-columns-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  width: 14px;
  min-width: 14px;
  height: 12px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.bt-columns-trigger-bar {
  display: block;
  width: 2px;
  height: 12px;
  background: #666;
  border-radius: 1px;
}
.bt-columns-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.4rem 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: 20;
}
.bt-columns-menu.open { display: block; }
.bt-columns-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.bt-columns-option:hover { background: #f5f7f9; }
.bt-columns-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem 0.35rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.bt-columns-actions .btn {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.25rem 0.4rem;
}
.bt-table-panel .bt-table-data th.bt-sticky-col,
.bt-table-panel .bt-table-data td.bt-sticky-col {
  position: sticky;
  background-clip: padding-box;
  background: #fff;
  /* Solid edge so scrolled cells cannot show through subpixel gaps */
  box-shadow: 2px 0 0 0 #fff, 3px 0 0 0 var(--border);
}
.bt-table-panel .bt-table-data thead th.bt-sticky-col {
  z-index: 20;
  background: var(--table-head);
  box-shadow: 2px 0 0 0 var(--table-head), 3px 0 0 0 var(--border);
}
.bt-table-panel .bt-table-data tbody tr:nth-child(even) {
  background: #F8FAFC;
}
.bt-table-panel .bt-table-data tbody tr:nth-child(even):hover {
  background: var(--table-hover);
}
.bt-table-panel .bt-table-data tbody tr:nth-child(even) td.bt-sticky-col {
  background: #F8FAFC;
  box-shadow: 2px 0 0 0 #F8FAFC, 3px 0 0 0 var(--border);
}
.bt-table-panel .bt-table-data tbody tr:hover td.bt-sticky-col {
  background: var(--table-hover);
  box-shadow: 2px 0 0 0 var(--table-hover), 3px 0 0 0 var(--border);
}
.bt-table-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: #5c6570 #d8dde3;
}
.bt-table-viewport::-webkit-scrollbar {
  width: 14px;
  height: 18px;
}
.bt-table-viewport::-webkit-scrollbar-thumb {
  background: #5c6570;
  border-radius: 8px;
  border: 3px solid #d8dde3;
}
.bt-table-viewport::-webkit-scrollbar-thumb:horizontal {
  min-width: 48px;
}
.bt-table-viewport::-webkit-scrollbar-track {
  background: #d8dde3;
}
.bt-table-viewport::-webkit-scrollbar-corner {
  background: #d8dde3;
}
.bt-table-panel .bt-table-wrap { overflow: visible; width: 100%; }
.bt-table-viewport .bt-monthly-matrix-wrap,
.bt-table-viewport .bt-schedule-grid-wrap {
  flex: none;
  max-height: none;
  overflow: visible;
  min-height: auto;
}
.bt-table-panel .bt-table-data {
  width: 100%;
  min-width: max-content;
  table-layout: auto;
  /* collapse breaks sticky columns on mobile (gaps / overlapping text) */
  border-collapse: separate;
  border-spacing: 0;
}
.bt-table-panel .bt-table-data th,
.bt-table-panel .bt-table-data td {
  min-width: 0;
  width: auto;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
.bt-col-hidden { display: none !important; }

.bt-table-data tbody tr.bt-row-weekend-holiday td {
  color: #2e7d32;
}

.bt-status-green {
  color: #2e7d32 !important;
  font-weight: 600;
}

.bt-table-data tbody tr.bt-row-weekend-holiday .bt-badge.active,
.bt-table-data tbody tr.bt-row-weekend-holiday .bt-status-green {
  background: #e8f5e9;
  color: #2e7d32;
}
.bt-page-hidden { display: none !important; }
.bt-table-pager {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.45rem 0.85rem;
  border-top: 1px solid var(--border);
  background: #f5f7f9;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.bt-pager-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.bt-pager-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text);
}
.bt-pager-size {
  min-width: 4.2rem;
  padding: 0.25rem 0.4rem;
}
.bt-pager-range { white-space: nowrap; }
.bt-pager-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.bt-pager-pages {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 0.15rem;
}
.bt-pager-page.active {
  background: var(--bt-green);
  border-color: var(--bt-green-dark);
  color: #fff;
}
.bt-pager-nav .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.bt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.bt-table th {
  background: var(--table-head);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bt-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
.bt-table-panel .bt-table-data td {
  white-space: nowrap;
}
.bt-table-panel .bt-table-data.bt-monthly-matrix td.punch-cell,
.bt-table-panel .bt-monthly-matrix td.punch-cell {
  white-space: pre-line;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bt-table tbody tr:hover { background: var(--table-hover); }
.bt-tx-photo-link { display: inline-block; }
.bt-tx-photo {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
  background: #eef2f6;
}
.bt-table .num { text-align: center; }
.bt-table-data th.bt-col-center,
.bt-table-data td.bt-col-center {
  text-align: center;
}
.bt-monthly-matrix .sticky-col3,
.bt-monthly-matrix .sticky-col4 {
  text-align: center;
}
.bt-table-data th.bt-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.35rem;
}
.bt-table-data th.bt-sortable:hover {
  background: color-mix(in srgb, var(--table-head) 85%, var(--accent) 15%);
}
.bt-table-data th.bt-sortable::after {
  content: "";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -0.45rem;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 4px solid currentColor;
  opacity: 0.28;
  transform: none;
  box-shadow: 0 6px 0 -1px currentColor;
}
.bt-table-data th.bt-sortable {
  position: relative;
}
.bt-table-data th.bt-sort-asc::after {
  content: "";
  margin-top: -0.2rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--accent, #2e7d32);
  border-top: 0;
  box-shadow: none;
  opacity: 0.95;
  color: var(--accent, #2e7d32);
}
.bt-table-data th.bt-sort-desc::after {
  content: "";
  margin-top: -0.15rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--accent, #2e7d32);
  border-bottom: 0;
  box-shadow: none;
  opacity: 0.95;
  color: var(--accent, #2e7d32);
}
.bt-table-data th.bt-has-sort-arrows { cursor: pointer; user-select: none; white-space: nowrap; }
.bt-table-data th.bt-sortable.bt-has-sort-arrows { padding-right: 0.5rem; }
.bt-table-data th.bt-has-sort-arrows::after { display: none; }
.bt-sort-arrows {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-inline-start: 0.3rem;
  vertical-align: middle;
}
.bt-sort-up,
.bt-sort-down {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.35;
  cursor: pointer;
}
.bt-sort-up { border-bottom: 5px solid currentColor; }
.bt-sort-down { border-top: 5px solid currentColor; }
.bt-sort-up:hover,
.bt-sort-down:hover { opacity: 0.7; }
th.bt-sort-asc .bt-sort-up { border-bottom-color: var(--accent, #2e7d32); opacity: 1; }
th.bt-sort-desc .bt-sort-down { border-top-color: var(--accent, #2e7d32); opacity: 1; }
.bt-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}
.bt-badge.active { background: #e8f5e9; color: #2e7d32; }
.bt-badge.inactive { background: #fce4ec; color: #c62828; }

/* Footer / pagination bar */
.bt-footer {
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1.4;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn.primary {
  background: var(--bt-green);
  border-color: var(--bt-green-dark);
  color: #fff;
}
.btn.primary:hover { background: var(--bt-green-dark); color: #fff; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Messages */
.bt-messages { list-style: none; margin: 0; padding: 0.65rem 1rem 0; }
.msg {
  padding: 0.55rem 0.85rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.msg.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.msg.error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.msg.warning { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.msg.info { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

/* Cards / panels for reports & settings */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem;
}
.hero { padding: 1rem; }
.hero h1 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.muted { color: var(--text-muted); }
.hint { font-size: 0.78rem; color: var(--text-muted); }
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  padding: 0 1rem 1rem;
}
.report-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
}
.report-card h3 { margin: 0.35rem 0; font-size: 0.95rem; }
.report-card h3 a { color: var(--text); text-decoration: none; }
.report-card h3 a:hover { color: var(--link); }
.eyebrow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--bt-green-dark); font-weight: 600; }

.filter-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.filter-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: var(--text-muted); }
.filter-form input {
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
}
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.data-table th, table.data-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.data-table th { background: var(--table-head); color: var(--text-muted); }

/* Settings form */
.settings-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.settings-form .field label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.settings-form .field input[type="text"],
.settings-form .field input[type="password"],
.settings-form .field input[type="number"] {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
}
.settings-form .field.narrow { max-width: 12rem; }
.settings-form .checkboxes { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0.5rem 0 1rem; }
.settings-form .checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; cursor: pointer; }
.settings-form .form-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; margin-top: 1rem; }
.settings-form .field-error { color: var(--danger); font-size: 0.8rem; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code { background: #f0f2f4; padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.85em; }

.bt-system-config-panel { margin: 0; border-top: none; max-width: 520px; }

/* Admin → User add/edit form */
.bt-user-page-hint {
  margin: 0 1rem 0.75rem;
  max-width: 40rem;
}
.bt-user-form-panel {
  margin: 0 1rem 1rem;
  max-width: 36rem;
  padding: 1rem 1.15rem 1.1rem;
}
.bt-user-form-panel .bt-section-title {
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.bt-user-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
}
.bt-user-form .field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.bt-user-form .field .bt-search,
.bt-user-form .field input,
.bt-user-form .field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.bt-user-form .field .hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  line-height: 1.35;
}
.bt-user-form-check {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.35rem;
}
.bt-user-form .form-actions {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
@media (max-width: 560px) {
  .bt-user-form .form-grid {
    grid-template-columns: 1fr;
  }
}
.bt-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.bt-config-row label { font-weight: 600; color: var(--text-muted); min-width: 10rem; }
.bt-config-toggle span:first-child { flex: 1; font-weight: 600; color: var(--text); }
.bt-log-pre {
  background: #1e2328;
  color: #d4dae0;
  padding: 1rem;
  border-radius: 4px;
  max-height: 60vh;
  overflow: auto;
  font-size: 0.8rem;
  line-height: 1.45;
}
.bt-icon-user::before { content: "\1F464"; }
.bt-icon-database::before { content: "\1F4BE"; }
.bt-icon-config::before { content: "\2699"; }
.bt-icon-service::before { content: "\1F527"; }

/* Login ? tech blue canvas image, centered white card (Servicepro) */
body.login-page {
  min-height: 100vh;
  height: auto;
  background: #F8FAFC;
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background-color: #F8FAFC;
  background-image: url("/static/img/login-bg.png?v=81");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
.login-panel {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  padding: 2rem 1.75rem 1.75rem;
  width: 100%;
  max-width: 420px;
}
.login-license-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.login-license-form textarea {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  font-family: Consolas, "Courier New", monospace;
}
.login-subheading { font-size: 1rem; margin: 0 0 0.35rem; }
.login-machine {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.login-machine .machine-code {
  display: inline-block;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  background: #F1F5F9;
  border-radius: 6px;
}
.login-panel h1 { margin: 0 0 0.25rem; font-size: 1.35rem; color: var(--text); }
.login-panel .subtitle { color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.85rem; }
.login-panel label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.login-panel input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  background: #fff;
}
.login-panel input:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.login-panel .login-remember input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: #2563EB;
  flex-shrink: 0;
}
.login-panel .btn.primary {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.95rem;
  border-radius: 8px;
  margin-top: 0.25rem;
}
.login-panel .hint + .btn.primary {
  display: inline-block;
  margin-top: 1rem;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.login-captcha.is-hidden {
  display: none;
}
.login-demo {
  margin-top: 1.1rem;
}
.login-demo-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.login-demo-sep::before,
.login-demo-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #e2e8f0);
}
.login-demo-sep span {
  flex-shrink: 0;
}
.login-demo-btn {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.95rem;
  border-radius: 8px;
  background: #fff;
  color: #1d4ed8;
  border: 1.5px solid #2563eb;
  font-weight: 600;
  cursor: pointer;
}
.login-demo-btn:hover {
  background: #eff6ff;
}
.login-demo-hint {
  margin: 0.55rem 0 0;
  text-align: center;
  font-size: 0.78rem;
}
body.login-page-vps .login-demo-btn {
  padding: 0.75rem 1rem;
  font-size: 1.02rem;
  border-radius: 9px;
}

/* VPS tenant login ? slightly larger card / controls */
body.login-page-vps .login-wrap {
  padding: 2.5rem 1.5rem;
}
body.login-page-vps .login-brand h2 {
  font-size: 1.65rem;
}
body.login-page-vps .login-brand .login-org-name {
  font-size: 1.05rem;
}
body.login-page-vps .login-panel {
  max-width: 480px;
  padding: 2.35rem 2.1rem 2rem;
  border-radius: 12px;
}
body.login-page-vps .login-panel h1 {
  font-size: 1.55rem;
}
body.login-page-vps .login-panel .subtitle {
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
}
body.login-page-vps .login-panel label {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}
body.login-page-vps .login-panel input {
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  border-radius: 9px;
}
body.login-page-vps .login-remember {
  font-size: 0.95rem;
  margin-bottom: 1.15rem;
}
body.login-page-vps .login-panel .btn.primary {
  padding: 0.75rem 1rem;
  font-size: 1.02rem;
  border-radius: 9px;
}
.login-brand {
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.login-brand h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #0F172A;
}
.login-brand h2::before {
  content: "F3";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}
.login-brand p {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.login-brand .login-org-name {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}
.login-captcha {
  margin: 0.75rem 0 0.25rem;
  padding: 0.75rem;
  background: #F1F5F9;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}
.login-captcha label {
  font-weight: 600;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

/* BioTime tab bar & settings forms */
.bt-tabbar {
  background: #e8eaed;
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.75rem 0;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.bt-tab {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  font-size: 0.82rem;
  color: var(--text);
}
.bt-tab.active { font-weight: 600; border-top: 2px solid var(--bt-green); }
.bt-inner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 0.75rem;
}
.bt-inner-tab {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.bt-inner-tab:hover { color: var(--text); text-decoration: none; }
.bt-inner-tab.active {
  color: var(--bt-green-dark);
  font-weight: 600;
  border-bottom-color: var(--bt-green);
}
.bt-settings-form { background: #fff; min-height: 320px; }
.bt-form-panel { padding: 1.25rem 1.5rem; max-width: 640px; }
.bt-form-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
    max-width: none;
}
.bt-check-yes { color: var(--bt-accent, #06B6D4); font-weight: 700; }
.bt-form-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}
.bt-form-label { text-align: right; padding-top: 0.35rem; color: var(--text-muted); font-size: 0.85rem; }
.bt-form-label.required::after { content: " *"; color: #e53935; }
.bt-form-field select,
.bt-form-field input[type="number"],
.bt-form-field input[type="time"],
.bt-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.85rem;
  min-width: 12rem;
}
.bt-time-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.bt-time-range input[type="time"] {
  min-width: 7rem;
}
.bt-form-actions { padding: 0.75rem 1.5rem 1rem; border-top: 1px solid var(--border); display: flex; gap: 0.65rem; }
.bt-filter-form label { font-size: 0.82rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 0.15rem; }
.status-warn { color: #e65100; font-weight: 600; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; }
.bt-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Modal (BioTime Add dialog) */
.bt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.bt-modal {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  width: min(920px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.bt-modal-dept-schedule {
  width: min(1100px, 98vw);
  max-height: 92vh;
}
.bt-modal-dept-schedule .bt-modal-split {
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.15fr);
  min-height: 420px;
}
.bt-modal-dept-schedule .bt-dept-list {
  max-height: 52vh;
}
.bt-modal-dept-schedule .bt-emp-item {
  white-space: normal;
  align-items: flex-start;
}
.bt-modal-dept-schedule .bt-emp-item-name {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
}
.bt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.bt-modal-header h2 { margin: 0; font-size: 1rem; }
.bt-modal-close { font-size: 1.5rem; color: var(--text-muted); text-decoration: none; line-height: 1; }
.bt-modal-body { padding: 0; overflow: auto; }
.bt-modal-split { display: grid; grid-template-columns: 220px 1fr; min-height: 320px; }
.bt-modal-left {
  border-right: 1px solid var(--border);
  padding: 0.75rem;
  background: #fafbfc;
}
.bt-modal-right { padding: 0.75rem 1rem; }
.bt-week-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem 0.75rem;
  font-size: 0.88rem;
}
.bt-week-day { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.bt-modal-panel-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.bt-dept-list { max-height: 360px; overflow-y: auto; }
.bt-dept-tree-hint { margin: 0 0 0.5rem; font-size: 0.8rem; }
.bt-dept-tree { border-bottom: 1px solid var(--border); padding: 0.15rem 0; }
.bt-dept-tree:last-child { border-bottom: 0; }
.bt-dept-tree-head {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.bt-dept-tree-toggle {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}
.bt-dept-tree-toggle:hover { color: var(--text); }
.bt-dept-tree-count { font-size: 0.78rem; margin-left: 0.15rem; }
.bt-dept-tree-emps {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.4rem 1.55rem;
  display: block;
}
.bt-dept-tree-emps[hidden] { display: none !important; }
.bt-dept-tree-emps > li {
  display: block;
  margin: 0;
  padding: 0;
}
.bt-emp-item {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.28rem 0.2rem;
  font-size: 0.84rem;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
}
.bt-emp-item input {
  flex: 0 0 auto;
  margin: 0;
}
.bt-emp-item-code {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 2.75rem;
}
.bt-emp-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-dept-tree-empty { margin: 0.15rem 0; font-size: 0.8rem; }
.bt-dept-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
a.bt-dept-link {
  display: block;
  padding: 0.4rem 0.5rem;
  margin: 0 -0.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 3px;
}
a.bt-dept-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
a.bt-dept-link.active {
  background: rgba(122, 193, 67, 0.25);
  color: var(--sidebar-active);
  font-weight: 600;
}
.bt-form-row.compact {
  grid-template-columns: 100px 1fr;
  margin-bottom: 0.65rem;
}
.bt-table-compact th, .bt-table-compact td { padding: 0.35rem 0.5rem; font-size: 0.82rem; }
.bt-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.field-error { color: var(--danger); font-size: 0.8rem; display: block; margin-top: 0.25rem; }

.bt-modal-wide { width: min(720px, 96vw); }
.bt-modal-timetable { width: min(920px, 96vw); }
.bt-modal-shift { width: min(820px, 96vw); }
.bt-modal-device { width: min(760px, 96vw); }

/* Department bulk manual punch */
.bt-modal-bulk { width: min(680px, 96vw); }
.bt-bulk { padding: 1rem 1rem 0; background: #f6f8fa; }
.bt-bulk-intro { margin: 0 0 0.9rem; font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; }
.bt-bulk-section { border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 0.95rem; margin-bottom: 0.75rem; background: #fff; }
.bt-bulk-step { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.7rem; font-size: 0.9rem; font-weight: 600; }
.bt-bulk-step span { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--bt-accent, #06B6D4); color: #fff; font-size: 0.72rem; }
.bt-bulk-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; align-items: center; margin-bottom: 0.55rem; }
.bt-bulk-row:last-child { margin-bottom: 0; }
.bt-bulk-label { font-size: 0.82rem; color: var(--text-muted); }
.bt-bulk-dept { width: 100%; max-width: 22rem; }
.bt-bulk-inline { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bt-bulk input[type="date"], .bt-bulk input[type="time"], .bt-bulk textarea {
  padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.85rem; font-family: inherit;
}
.bt-bulk textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.bt-bulk-placeholder { margin: 0.35rem 0 0; padding: 0.9rem; text-align: center; font-size: 0.82rem; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 6px; }
.bt-bulk-emp-box { margin-top: 0.55rem; }
.bt-bulk-emp-toolbar { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.45rem; }
.bt-bulk-emp-toolbar .bt-search { flex: 1 1 10rem; min-width: 0; }
.bt-bulk-count { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.bt-bulk-emps {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.3rem;
  max-height: 13rem; overflow: auto; padding: 0.4rem; border: 1px solid var(--border); border-radius: 6px; background: #fafbfc;
}
.bt-bulk-emp { display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.45rem; border-radius: 4px; background: #fff; border: 1px solid transparent; font-size: 0.82rem; cursor: pointer; min-width: 0; }
.bt-bulk-emp[hidden] { display: none; }
.bt-bulk-emp:hover { border-color: var(--border); }
.bt-bulk-emp:has(input:not(:checked)) { opacity: 0.55; }
.bt-bulk-emp-code { font-weight: 600; font-variant-numeric: tabular-nums; }
.bt-bulk-emp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.bt-bulk-days { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.bt-bulk-day { position: relative; cursor: pointer; }
.bt-bulk-day input { position: absolute; opacity: 0; pointer-events: none; }
.bt-bulk-day span { display: inline-block; min-width: 2.6rem; padding: 0.3rem 0.5rem; text-align: center; font-size: 0.8rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); background: #fff; user-select: none; }
.bt-bulk-day input:checked + span { background: var(--bt-accent, #06B6D4); border-color: var(--bt-accent, #06B6D4); color: #fff; }
.bt-bulk-day input:focus-visible + span { outline: 2px solid var(--bt-accent, #06B6D4); outline-offset: 2px; }
.bt-bulk-times { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.6rem; }
.bt-bulk-time { display: flex; flex-direction: column; gap: 0.3rem; }
.bt-bulk-time input[type="time"] { width: 100%; box-sizing: border-box; }
.bt-bulk-time-label { font-size: 0.78rem; font-weight: 600; }
.bt-bulk-time-label.in { color: #15803d; }
.bt-bulk-time-label.mid { color: #b45309; }
.bt-bulk-time-label.out { color: #b91c1c; }
.bt-bulk-error { color: #b42318; font-size: 0.8rem; margin: 0.2rem 0 0.5rem; }
.bt-bulk-error ul { margin: 0; padding-left: 1rem; }
.bt-bulk-footer { position: sticky; bottom: 0; margin: 0 -1rem; align-items: center; }
.bt-bulk-summary { margin-right: auto; font-size: 0.82rem; color: var(--text-muted); }
.bt-bulk-footer .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 560px) {
  .bt-bulk-row { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* Device add dialog ? two columns like ZKBio Time */
.bt-device-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  padding: 0.75rem 1rem 0.25rem;
}
.bt-device-col {
  min-width: 0;
  padding: 0 0.5rem;
}
.bt-device-col:first-child {
  border-right: 1px solid var(--border);
  padding-left: 0;
}
.bt-device-col:last-child {
  padding-right: 0;
}
.bt-device-grid .bt-form-row.compact {
  grid-template-columns: minmax(6.5rem, 7.5rem) minmax(0, 1fr);
  gap: 0.65rem;
}
.bt-device-grid .bt-form-label {
  text-align: left;
  padding-top: 0.35rem;
}
.bt-device-grid .bt-form-field select,
.bt-device-grid .bt-form-field input[type="number"],
.bt-device-grid .bt-form-field input[type="text"] {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.bt-field-with-unit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.bt-field-with-unit input[type="number"] {
  width: 5rem !important;
  flex: 0 0 auto;
}
.bt-field-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bt-table-device-wrap {
  overflow-x: auto;
}
.bt-table-device th,
.bt-table-device td {
  white-space: nowrap;
}
.bt-table-device .bt-col-check {
  width: 2rem;
}
.bt-table-device .bt-col-state {
  width: 7.5rem;
  text-align: left;
}
.bt-table-device .bt-col-actions {
  width: 4.5rem;
}
.bt-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}
.bt-status-dot.online {
  background: #43a047;
}
.bt-status-dot.offline {
  background: #e53935;
}
.bt-device-status {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.bt-device-status.upload {
  color: #1565c0;
}
.bt-device-status.download {
  color: #7b1fa2;
}
.bt-device-status.online {
  color: #2e7d32;
}
.bt-device-status.offline {
  color: #c62828;
}
.bt-device-status.unauthorized {
  color: #6d4c41;
}
.bt-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}
.bt-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}
.bt-action-btn.edit {
  color: #43a047;
}
.bt-action-btn.delete {
  color: #e53935;
}
.bt-action-btn:hover {
  background: #f0f2f5;
}

/* Employee list table */
.bt-employee-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.bt-table-employees {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}
.bt-table-employees thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #475569;
  text-transform: none;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: center;
}
.bt-table-employees tbody td {
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  text-align: center;
}
.bt-table-employees tbody tr:nth-child(even) td {
  background: #fafbfc;
}
.bt-table-employees tbody tr:hover td {
  background: #f1f5f9;
}
.bt-table-employees tbody tr:last-child td {
  border-bottom: none;
}
.bt-table-employees .bt-emp-code {
  width: 6.5rem;
  white-space: nowrap;
}
.bt-table-employees .bt-emp-name {
  font-weight: 550;
  min-width: 10rem;
}
.bt-table-employees .bt-col-actions {
  width: 8rem;
  text-align: center;
}
.bt-table-employees .bt-row-actions {
  white-space: nowrap;
}
.bt-table-employees td.bt-row-actions {
  display: table-cell;
}
.bt-table-employees .bt-action-btn {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  border: 1px solid transparent;
  vertical-align: middle;
  margin: 0 0.15rem;
}
.bt-table-employees .bt-action-btn.edit {
  width: auto;
  padding: 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.bt-table-employees .bt-action-btn.edit {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.bt-table-employees .bt-action-btn.delete {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}
.bt-table-employees .bt-action-btn:hover {
  filter: brightness(0.97);
}

/* Shift add dialog ? equal columns, contained timetable preview */
.bt-shift-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 260px;
}
.bt-shift-col-left {
  border-right: 1px solid var(--border);
  padding: 0.75rem 1rem;
  background: #fafbfc;
  min-width: 0;
  overflow: hidden;
}
.bt-shift-col-right {
  padding: 0.75rem 1rem;
  min-width: 0;
}
.bt-shift-hint {
  font-size: 0.85rem;
  margin: 0 0 0.65rem;
  line-height: 1.35;
}
.bt-shift-footer-hint {
  margin: 0.75rem 1rem 0;
  padding-bottom: 0.25rem;
}
.bt-shift-grid .bt-form-row.compact {
  grid-template-columns: minmax(5rem, 6.5rem) minmax(0, 1fr);
  gap: 0.65rem;
}
.bt-shift-grid .bt-form-label {
  text-align: left;
  padding-top: 0.35rem;
}
.bt-shift-grid .bt-form-field select,
.bt-shift-grid .bt-form-field input[type="number"] {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.bt-shift-timetable-table {
  margin-top: 0.5rem;
  max-height: 10.5rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
}
.bt-shift-timetable-table .bt-table {
  width: 100%;
  table-layout: fixed;
  margin: 0;
}
.bt-shift-timetable-table th:nth-child(1),
.bt-shift-timetable-table td:nth-child(1) { width: 46%; }
.bt-shift-timetable-table th:nth-child(n+2),
.bt-shift-timetable-table td:nth-child(n+2) { width: 18%; }
.bt-shift-timetable-table th,
.bt-shift-timetable-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-week-grid-shift {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 14rem;
}

@media (max-width: 720px) {
  .bt-shift-grid { grid-template-columns: 1fr; }
  .bt-shift-col-left { border-right: none; border-bottom: 1px solid var(--border); }
}

/* Timetable add dialog ? equal columns so time inputs do not overlap */
.bt-timetable-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
}
.bt-timetable-col {
  padding: 0.75rem 1rem;
  min-width: 0;
}
.bt-timetable-col-in {
  border-right: 1px solid var(--border);
  background: #fafbfc;
}
.bt-timetable-mid {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  background: #fafbfc;
}
.bt-timetable-mid-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 1.25rem;
}
.bt-timetable-hint {
  margin: 0.75rem 1rem 0;
  padding-bottom: 0.25rem;
}
.bt-modal-form-head {
  padding: 0.75rem 1rem 0.25rem;
}
.bt-modal-form-head .bt-form-row.compact {
  grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr);
  gap: 0.65rem;
}
.bt-modal-form-head .bt-form-label { text-align: left; }
.bt-modal-form-head .bt-form-field input { max-width: 20rem; width: 100%; box-sizing: border-box; }
.bt-tt-head { padding: 1rem 1.1rem 0.85rem; }
.bt-tt-identity {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 0.7rem 1rem;
}
.bt-tt-field label {
  display: block;
  margin: 0 0 0.32rem;
  font-size: 0.74rem;
  font-weight: 650;
  color: #64748B;
}
.bt-tt-field label.required::after { content: " *"; color: #e53935; }
.bt-tt-field input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.bt-tt-field input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: var(--bt-green);
}
.bt-tt-depts {
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background: #F8FAFC;
}
.bt-tt-depts-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin-bottom: 0.55rem;
}
.bt-tt-depts-title strong {
  font-size: 0.82rem;
  color: var(--text);
}
.bt-tt-depts-title span {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.bt-dept-chips ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.bt-dept-chips li { margin: 0; }
.bt-dept-chips label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.32rem 0.75rem;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}
.bt-dept-chips label:hover { border-color: #94A3B8; background: #F8FAFC; }
.bt-dept-chips label:has(input:checked) {
  border-color: #0F766E;
  background: #CCFBF1;
  color: #115E59;
  font-weight: 700;
}
.bt-dept-chips input {
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  accent-color: #0F766E;
}
@media (max-width: 720px) {
  .bt-tt-identity { grid-template-columns: 1fr; }
}
.bt-timetable-grid .bt-form-row.compact {
  grid-template-columns: minmax(6.5rem, 8.5rem) minmax(0, 1fr);
  gap: 0.65rem;
}
.bt-timetable-grid .bt-form-label {
  text-align: left;
  padding-top: 0.35rem;
  line-height: 1.25;
}
.bt-timetable-grid .bt-form-field input[type="time"],
.bt-timetable-grid .bt-form-field input[type="number"],
.bt-timetable-grid .bt-form-field select {
  min-width: 0;
  width: 100%;
  max-width: 11rem;
  box-sizing: border-box;
}
.bt-timetable-grid-rules .bt-form-row.compact {
  grid-template-columns: minmax(8.5rem, 10.5rem) minmax(0, 1fr);
}
.bt-timetable-grid-rules .bt-form-field input[type="number"],
.bt-timetable-grid-rules .bt-form-field select {
  max-width: none;
}

@media (max-width: 720px) {
  .bt-timetable-grid { grid-template-columns: 1fr; }
  .bt-timetable-col-in { border-right: none; border-bottom: 1px solid var(--border); }
  .bt-timetable-mid-fields { grid-template-columns: 1fr; }
}

/* Employee search picker (ZKT / BioTime style) */
.bt-emp-picker {
  position: relative;
  width: 100%;
  max-width: 420px;
}
.bt-emp-picker-value { display: none !important; }
.bt-emp-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.bt-emp-picker.open .bt-emp-picker-trigger,
.bt-emp-picker-trigger:focus {
  border-color: var(--bt-green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.bt-emp-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.bt-emp-filter {
  display: inline-block;
  width: 16rem;
  max-width: 16rem;
  vertical-align: middle;
}
.bt-toolbar .bt-emp-filter,
.bt-preview-filters .bt-emp-filter {
  width: 16rem;
  max-width: 18rem;
}
.bt-emp-filter .bt-emp-picker-trigger {
  min-height: 32px;
  font-size: 0.85rem;
}
.bt-emp-filter .bt-emp-picker-panel {
  z-index: 50;
  min-width: 100%;
  width: max(100%, 18rem);
}
.bt-emp-picker-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-emp-picker-arrow {
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
}
.bt-emp-picker-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 40;
  background: #fff;
  border: 1px solid var(--bt-green);
  border-radius: 3px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  display: flex;
  flex-direction: column;
}
.bt-emp-picker-panel[hidden] { display: none !important; }
.bt-emp-picker-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.bt-emp-picker-search-icon {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
}
.bt-emp-picker-search {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.88rem;
  background: transparent;
}
.bt-emp-picker-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  max-height: 320px;
}
.bt-emp-picker-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.65rem;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: 0.86rem;
}
.bt-emp-picker-option[hidden] {
  display: none !important;
}
.bt-emp-picker-option:hover,
.bt-emp-picker-option.selected {
  background: #e8f5e9;
}
.bt-emp-picker-code {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.bt-emp-picker-name { color: var(--text); }
.bt-emp-picker-empno {
  font-style: normal;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
}
.bt-emp-picker-email {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1b7a32;
  word-break: break-all;
}
.bt-emp-picker-email.is-missing {
  color: var(--text-muted);
  font-weight: 500;
  font-style: italic;
}
.bt-emp-picker-dept {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.bt-emp-picker-empty,
.bt-emp-picker-none {
  padding: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  list-style: none;
}
.bt-emp-picker.has-error .bt-emp-picker-trigger {
  border-color: var(--danger);
}
.bt-modal-tabs { padding: 0 1rem; margin: 0; border-bottom: 1px solid var(--border); }
.bt-modal-tabs .bt-inner-tab {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
.bt-color-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 0.35rem;
}
.bt-color-field { display: flex; align-items: center; gap: 0.5rem; }
.bt-color-field input[type=color] { width: 3rem; height: 2rem; padding: 0; border: 1px solid var(--border); }
.bt-color-preview { width: 1.5rem; height: 1.5rem; border-radius: 2px; border: 1px solid var(--border); }

@media (max-width: 720px) {
  .bt-modal-split { grid-template-columns: 1fr; }
  .bt-modal-left { border-right: none; border-bottom: 1px solid var(--border); }
}

/* Schedule preview + transaction-style reports */
.bt-preview-page {
  flex: 1;
  min-height: 0;
}
.bt-preview-page .bt-tabbar {
  flex-shrink: 0;
  text-decoration: none;
}
.bt-preview-page .bt-tabbar .bt-tab { text-decoration: none; color: var(--text); }
.bt-preview-page form.bt-preview-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bt-preview-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bt-preview-sidebar {
  width: 180px;
  min-width: 180px;
  border-right: 1px solid var(--border);
  background: #fafbfc;
  padding: 0.75rem;
  overflow-y: auto;
  flex-shrink: 0;
}
.bt-preview-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #fff;
}
.bt-preview-main > .bt-toolbar,
.bt-preview-main > .bt-preview-filters {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  overflow: visible;
}
.bt-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
.bt-filter-actions .btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.bt-preview-main > .bt-page-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.bt-page-body > .bt-table-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.bt-page-body > .bt-table-pager {
  flex-shrink: 0;
  margin-top: auto;
}
.bt-preview-main > .bt-footer {
  margin-top: 0;
}
.bt-preview-main > .bt-footer {
  flex-shrink: 0;
}
.bt-page > .bt-tabbar { flex-shrink: 0; }
.bt-page > .bt-page-header,
.bt-page > .bt-toolbar { flex-shrink: 0; }
.bt-page > .bt-page-body { flex: 1; min-height: 0; }
.bt-page > .bt-page-body-scroll { flex: 1; min-height: 0; }
.bt-page > .bt-footer { flex-shrink: 0; }

/* Toolbar + table pages that POST from one form (manual log, holiday, leave, ?) */
.bt-page-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bt-page-form > .bt-toolbar {
  flex-shrink: 0;
}
.bt-page-form > .bt-page-body {
  flex: 1;
  min-height: 0;
}

/* Department schedule ? table + right assignment preview (ZKBio style) */
.bt-dept-schedule-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.bt-dept-schedule-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.bt-dept-schedule-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.bt-dept-schedule-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bt-dept-schedule-main > .bt-page-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.bt-dept-schedule-main > .bt-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.bt-table tbody tr.bt-schedule-row {
  cursor: pointer;
}
.bt-table tbody tr.bt-schedule-row.selected {
  background: #e8f4e4;
}
.bt-table tbody tr.bt-schedule-row.selected td {
  background: transparent;
}
.bt-table tbody tr.bt-schedule-row:hover {
  background: #f5faf3;
}
.bt-assignment-preview {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
}
.bt-assignment-preview-head {
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.bt-assignment-preview-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.3;
}
.bt-assignment-preview-dept {
  font-size: 0.78rem;
  margin-top: 0.15rem;
}
.bt-assignment-preview-filter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.bt-assignment-preview-filter input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.78rem;
}
.bt-assignment-preview-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.bt-assignment-preview-search {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.bt-assignment-preview-days {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.35rem 0;
}
.bt-assignment-day {
  display: flex;
  align-items: stretch;
  min-height: 2.35rem;
  border-bottom: 1px solid #eef1ee;
}
.bt-assignment-day-date {
  width: 5.5rem;
  flex-shrink: 0;
  background: var(--bt-green, #2563EB);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.4rem;
  text-align: center;
  line-height: 1.2;
}
.bt-assignment-day-time {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: #fdfcf7;
  color: var(--text);
  line-height: 1.25;
  word-break: break-word;
}
.bt-assignment-day.is-off .bt-assignment-day-date {
  background: #c5d4bc;
}
.bt-assignment-day.is-off .bt-assignment-day-time {
  background: #fafafa;
  color: var(--text-muted);
}
.bt-assignment-preview-empty,
.bt-assignment-preview-empty-inline {
  padding: 1.25rem 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

@media (max-width: 960px) {
  .bt-dept-schedule-layout { flex-direction: column; }
  .bt-assignment-preview {
    width: 100%;
    max-width: none;
    min-width: 0;
    max-height: 320px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}
.bt-schedule-grid-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  max-height: none;
}
.bt-schedule-grid .day-col { text-align: center; min-width: 2.2rem; padding: 0.35rem 0.25rem; }
.bt-schedule-grid th.day-col { font-size: 0.78rem; background: #eef1f4; }
.bt-shift-cell {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bt-shift-cell.filled { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.bt-schedule-grid .sticky-col { position: sticky; left: 0; background: #fff; z-index: 4; min-width: 5rem; }
.bt-schedule-grid .sticky-col2 { position: sticky; left: 5rem; background: #fff; z-index: 5; min-width: 5rem; }
.bt-schedule-grid .sticky-col3 { position: sticky; left: 10rem; background: #fff; z-index: 6; min-width: 6rem; }
.bt-schedule-grid .sticky-col4 { position: sticky; left: 16rem; background: #fff; z-index: 7; min-width: 6rem; }
/* Monthly Report: wider name/dept/area defaults; JS (table-enhance) overwrites left from measured widths */
.bt-monthly-matrix.bt-schedule-grid .sticky-col { min-width: 4.5rem; }
.bt-monthly-matrix.bt-schedule-grid .sticky-col2 { left: 4.5rem; min-width: 10rem; }
.bt-monthly-matrix.bt-schedule-grid .sticky-col3 { left: 14.5rem; min-width: 7rem; }
.bt-monthly-matrix.bt-schedule-grid .sticky-col4 { left: 21.5rem; min-width: 7rem; }
.bt-monthly-matrix.bt-schedule-grid .sticky-col,
.bt-monthly-matrix.bt-schedule-grid .sticky-col2,
.bt-monthly-matrix.bt-schedule-grid .sticky-col3,
.bt-monthly-matrix.bt-schedule-grid .sticky-col4 {
  background-clip: padding-box;
  box-shadow: 2px 0 0 0 #fff, 3px 0 0 0 #94A3B8;
}
.bt-monthly-matrix.bt-schedule-grid thead th.sticky-col,
.bt-monthly-matrix.bt-schedule-grid thead th.sticky-col2,
.bt-monthly-matrix.bt-schedule-grid thead th.sticky-col3,
.bt-monthly-matrix.bt-schedule-grid thead th.sticky-col4 {
  box-shadow: 2px 0 0 0 var(--table-head), 3px 0 0 0 #94A3B8;
}

/* Workbench tabs (ZKBio-style multi-page) */
.bt-workbench {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bt-workbench-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem 0;
  background: #e8eaed;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.bt-workbench-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 14rem;
  padding: 0.42rem 0.55rem 0.42rem 0.75rem;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: #f4f5f7;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.bt-workbench-tab:hover { background: #fff; }
.bt-workbench-tab.active {
  background: #fff;
  font-weight: 600;
  border-top: 2px solid var(--bt-green);
  padding-top: calc(0.42rem - 1px);
}
.bt-workbench-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-workbench-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 2px;
  color: #666;
  font-size: 1rem;
  line-height: 1;
}
.bt-workbench-tab-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}
.bt-workbench-panels {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--content-bg);
}
.bt-workbench-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.bt-workbench-panel.active { display: flex; }
.bt-workbench-panel > .bt-page,
.bt-workbench-panel > .bt-messages + .bt-page {
  flex: 1;
  min-height: 0;
}
.bt-workbench-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.bt-workbench-panel-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.92);
}
.bt-workbench-panel-loading[hidden] {
  display: none !important;
}
body.bt-embed {
  margin: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
}
body.bt-embed .bt-page {
  flex: 1;
  min-height: 0;
  height: auto;
  margin: 0;
}
body.bt-embed .bt-messages {
  margin: 0;
  flex-shrink: 0;
}
body.bt-embed .bt-tabbar {
  display: none;
}
html.bt-in-iframe .bt-topbar,
html.bt-in-iframe .bt-sidebar,
html.bt-in-iframe .bt-workbench-tabs {
  display: none !important;
}
.bt-monitoring-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bt-monitoring-stats-compact {
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}
.bt-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
}
.bt-stat-card.online { border-left: 3px solid #43a047; }
.bt-stat-card.offline { border-left: 3px solid #e53935; }
.bt-stat-card.communicated { border-left: 3px solid #1e88e5; }
.bt-stat-label { display: block; font-size: 0.78rem; color: var(--muted); }
.bt-stat-value { font-size: 1.35rem; color: var(--text); }
.bt-monitoring-page {
  min-height: 0;
}
.bt-monitoring-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bt-monitoring-feed {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.bt-monitoring-feed-toolbar {
  border: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bt-monitoring-feed > .bt-page-body {
  flex: 1;
  min-height: 0;
}
.bt-monitoring-reports {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  min-height: 0;
}
.bt-section-title { font-size: 0.95rem; margin: 0; font-weight: 600; }
.bt-punch-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.bt-punch-thumb-empty {
  display: inline-block;
  width: 48px;
  text-align: center;
  color: var(--muted);
}
.bt-monitor-photo { width: 56px; }
.bt-monitor-row-new { background: #f1f8e9; }
.bt-face-punch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid #90caf9;
}
.bt-modal-employee {
  width: min(760px, 96vw);
  height: min(90vh, 640px);
  max-height: min(90vh, 640px);
  overflow: hidden;
}
.bt-modal-employee .bt-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100%;
}
.bt-modal-employee .bt-modal-tabs,
.bt-modal-employee .bt-modal-footer,
.bt-modal-employee .form-errors {
  flex: 0 0 auto;
}
.bt-employee-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
.bt-emp-profile {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.35rem;
  min-width: 0;
}
.bt-emp-photo-panel {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.bt-emp-photo-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.bt-employee-bio-photo {
  width: 72px;
  height: 88px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  background: #f8fafc;
}
.bt-employee-bio-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
  padding: 0.25rem;
}
.bt-emp-photo-file {
  max-width: 100%;
  overflow: hidden;
}
.bt-emp-photo-file input[type="file"] {
  width: 100%;
  max-width: 100%;
  font-size: 0.75rem;
}
.bt-emp-photo-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
}
.bt-emp-profile-fields {
  padding: 0;
  min-width: 0;
}
.bt-emp-profile-fields .bt-device-col:first-child {
  border-right: 1px solid var(--border);
}
.bt-emp-settings-span {
  grid-column: 1 / -1;
}
.bt-emp-tab-hint,
.bt-emp-tab-actions {
  margin: 0.65rem 1rem 0.35rem;
}
.bt-emp-attendance {
  padding: 0.75rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.bt-emp-settings-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}
.bt-emp-settings-title {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text);
}
.bt-emp-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.15rem 1rem;
}
.bt-emp-settings-grid .bt-form-row.compact {
  grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.bt-emp-settings-grid .bt-form-label {
  text-align: left;
  padding-top: 0.3rem;
}
.bt-emp-settings-grid .bt-form-field select,
.bt-emp-settings-grid .bt-form-field input[type="text"],
.bt-emp-settings-grid .bt-form-field input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.bt-modal-employee .bt-modal-tabs { margin-bottom: 0; }

/* Employee dialog — profile header, stacked labels, soft inputs */
.bt-modal-employee .bt-modal-header { background: #fff; padding: 0.9rem 1.25rem; }
.bt-modal-employee .bt-modal-header h2 { font-size: 1.05rem; font-weight: 650; }
.bt-emp-hero {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 60%, #ecfeff 100%);
  border-bottom: 1px solid var(--border);
}
.bt-emp-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
}
.bt-emp-avatar img,
.bt-emp-avatar-initials {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  box-sizing: border-box;
}
.bt-emp-avatar img[hidden],
.bt-emp-avatar-initials[hidden] { display: none; }
.bt-emp-avatar-initials {
  background: linear-gradient(135deg, var(--bt-green-top), var(--bt-accent));
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bt-emp-avatar-edit {
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bt-green);
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}
.bt-emp-avatar-edit:hover { background: var(--bt-green-dark); }
.bt-emp-hero-info { min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.bt-emp-hero-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-emp-hero-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bt-emp-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
}
.bt-emp-chip.is-ok { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.bt-emp-chip.is-off { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.bt-emp-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.bt-emp-hero-actions .btn { border-radius: 8px; background: #fff; }
.bt-emp-upload-btn { position: relative; cursor: pointer; }
.bt-emp-photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.bt-emp-photo-clear { font-size: 0.78rem; color: var(--text-muted); }
.bt-emp-hero .bt-emp-photo-hint { font-size: 0.75rem; color: var(--text-muted); }

.bt-modal-employee .bt-modal-tabs { padding: 0 1.25rem; gap: 0.25rem; background: #fff; }
.bt-modal-employee .bt-inner-tab { padding: 0.75rem 0.85rem; font-weight: 500; }
.bt-modal-employee .bt-inner-tab:hover { color: var(--bt-green); }
.bt-modal-employee .bt-inner-tab.active { color: var(--bt-green); font-weight: 650; }

.bt-modal-employee .bt-emp-profile { padding: 0; gap: 0; }
.bt-modal-employee .bt-device-grid {
  gap: 0 1.5rem;
  padding: 1.1rem 1.25rem 0.4rem;
}
.bt-modal-employee .bt-device-col,
.bt-modal-employee .bt-emp-profile-fields .bt-device-col:first-child {
  padding: 0;
  border-right: none;
}
.bt-modal-employee .bt-form-row.compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}
.bt-modal-employee .bt-form-label {
  text-align: left;
  padding: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.01em;
}
.bt-modal-employee .bt-form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.bt-modal-employee .bt-form-field select,
.bt-modal-employee .bt-form-field textarea {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bt-modal-employee .bt-form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.bt-modal-employee .bt-form-field select:focus,
.bt-modal-employee .bt-form-field textarea:focus {
  outline: none;
  border-color: var(--bt-green);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.bt-modal-employee .bt-form-field input[type="checkbox"] { accent-color: var(--bt-green); width: 1rem; height: 1rem; }
.bt-modal-employee .bt-form-field .hint { display: block; margin-top: 0.3rem; font-size: 0.74rem; line-height: 1.35; }
.bt-modal-employee .bt-email-alias { display: flex; align-items: stretch; }
.bt-modal-employee .bt-email-alias .bt-email-alias-input { flex: 1; min-width: 0; }
.bt-modal-employee .bt-email-alias .bt-email-alias-input input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bt-modal-employee .bt-email-domain {
  display: flex;
  align-items: center;
  padding: 0 0.7rem;
  border: 1px solid #cbd5e1;
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.85rem;
}

.bt-modal-employee .bt-emp-attendance { padding: 1.1rem 1.25rem 0.5rem; gap: 1rem; }
.bt-modal-employee .bt-tab-fields[data-panel="hr"] { padding: 1.1rem 1.25rem 0.5rem; }
.bt-modal-employee .bt-emp-settings-block {
  border-radius: 12px;
  padding: 0.9rem 1rem 0.4rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.bt-modal-employee .bt-emp-settings-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.bt-modal-employee .bt-emp-settings-grid { gap: 0 1.25rem; }
.bt-modal-employee .bt-emp-settings-grid .bt-form-row.compact:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.bt-modal-employee .bt-emp-settings-grid .bt-form-row.compact:has(input[type="checkbox"]) .bt-form-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.bt-modal-employee .bt-emp-settings-grid .bt-form-row.compact:has(input[type="checkbox"]) .bt-form-field { display: contents; }
.bt-modal-employee .bt-emp-settings-grid .bt-form-row.compact:has(input[type="checkbox"]) .hint { flex-basis: 100%; margin-top: 0; }
.bt-modal-employee .bt-emp-tab-hint,
.bt-modal-employee .bt-emp-tab-actions { margin: 0.25rem 1.25rem 0.5rem; }

.bt-modal-employee .bt-modal-footer { background: #fff; padding: 0.8rem 1.25rem; }
.bt-modal-employee .bt-modal-footer .btn { border-radius: 8px; min-width: 6rem; justify-content: center; }

@media (max-width: 720px) {
  .bt-emp-hero { flex-direction: column; text-align: center; }
  .bt-emp-hero-chips,
  .bt-emp-hero-actions { justify-content: center; }
  .bt-modal-employee .bt-device-grid { grid-template-columns: 1fr; }
}

.bt-monitoring-table th,
.bt-monitoring-table td {
  text-align: center;
  vertical-align: middle;
}
.bt-modal-employee .bt-device-grid {
  max-width: 100%;
}
.bt-modal-employee .bt-email-alias {
  max-width: 100%;
  flex-wrap: wrap;
}
.bt-modal-employee input,
.bt-modal-employee select,
.bt-modal-employee textarea {
  max-width: 100%;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .bt-monitoring-layout {
    grid-template-columns: 1fr;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bt-monitoring-feed {
    border-right: none;
    min-height: min(52vh, 28rem);
  }
  .bt-monitoring-reports {
    border-top: 1px solid var(--border);
  }
  .bt-emp-settings-grid {
    grid-template-columns: 1fr;
  }
  .bt-emp-profile-fields {
    grid-template-columns: 1fr;
  }
  .bt-emp-profile-fields .bt-device-col:first-child {
    border-right: none;
  }
}
html.bt-in-iframe .bt-layout {
  display: flex !important;
  height: 100% !important;
  min-height: 0 !important;
}
html.bt-in-iframe .bt-content {
  width: 100% !important;
  max-width: none !important;
}
html.bt-in-iframe .bt-workbench-panel:not(#bt-workbench-home) {
  display: none !important;
}
html.bt-in-iframe #bt-workbench-home {
  display: flex !important;
}
.bt-schedule-grid thead th.sticky-col,
.bt-schedule-grid thead th.sticky-col2,
.bt-schedule-grid thead th.sticky-col3,
.bt-schedule-grid thead th.sticky-col4 { background: var(--table-head); z-index: 3; }
.bt-person-list { padding: 1rem; display: grid; gap: 0.75rem; }
.bt-person-card h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.bt-person-days { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.bt-day-cell {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
  text-align: center;
  min-width: 2.5rem;
}
.bt-day-num { display: block; font-size: 0.7rem; color: var(--text-muted); }

/* Monthly Check-in & out matrix */
.bt-monthly-matrix-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  max-height: none;
}
.bt-monthly-matrix.bt-table th,
.bt-monthly-matrix.bt-table td {
  border: 1px solid #94A3B8;
}
.bt-monthly-matrix .day-col {
  text-align: center;
  min-width: 6.8rem;
  max-width: 8.5rem;
  width: 8.5rem;
  padding: 0.3rem 0.2rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  box-sizing: border-box;
}
.bt-monthly-matrix.has-hours .day-col {
  min-width: 8.8rem;
  max-width: 10.5rem;
  width: 10.5rem;
}
.bt-monthly-matrix.has-shift .day-col {
  min-width: 7.2rem;
  max-width: 9.5rem;
  width: 9.5rem;
}
.bt-monthly-matrix.has-shift.has-hours .day-col {
  min-width: 8.5rem;
  max-width: 10.5rem;
  width: 10.5rem;
}
.bt-monthly-matrix th.day-col {
  background: var(--table-head);
  color: var(--text);
  font-weight: 600;
  font-size: 0.75rem;
}
.bt-monthly-matrix .punch-cell {
  white-space: pre-line;
  line-height: 1.3;
  vertical-align: top;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 10.5rem;
}
.bt-monthly-matrix .punch-cell.has-mp {
  color: var(--danger);
  font-weight: 600;
}
.hr-leave-mark {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #DCFCE7;
  color: #15803D;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.weekend-mark {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #E2E8F0;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bt-monthly-matrix tbody td.punch-cell.has-weekend {
  background: #F1F5F9;
}
.bt-monthly-matrix tbody td.punch-cell.has-hr-leave:not(.has-mp) {
  background: #F0FDF4;
}
.bt-monthly-matrix th.total-col,
.bt-monthly-matrix td.total-col {
  text-align: center !important;
  min-width: 4.5rem;
  font-weight: inherit;
  white-space: nowrap;
}
.bt-monthly-matrix th.total-col {
  font-weight: 600;
}
.bt-monthly-matrix tbody tr:nth-child(even) td { background: #F1F5F9; }
.bt-monthly-matrix tbody tr:nth-child(even) td.sticky-col,
.bt-monthly-matrix tbody tr:nth-child(even) td.sticky-col2,
.bt-monthly-matrix tbody tr:nth-child(even) td.sticky-col3,
.bt-monthly-matrix tbody tr:nth-child(even) td.sticky-col4 {
  background: #F1F5F9;
  box-shadow: 2px 0 0 0 #F1F5F9, 3px 0 0 0 #94A3B8;
}
.bt-monthly-matrix tbody tr:hover td { background: var(--table-hover); }
.bt-monthly-matrix tbody tr:hover td.sticky-col,
.bt-monthly-matrix tbody tr:hover td.sticky-col2,
.bt-monthly-matrix tbody tr:hover td.sticky-col3,
.bt-monthly-matrix tbody tr:hover td.sticky-col4 {
  background: var(--table-hover);
  box-shadow: 2px 0 0 0 var(--table-hover), 3px 0 0 0 #94A3B8;
}

/* Standard report grid — same look as the Monthly Report for every report */
.bt-report-grid-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}
.bt-report-grid.bt-table th,
.bt-report-grid.bt-table td {
  border: 1px solid #94A3B8;
  padding: 0.35rem 0.5rem;
}
.bt-report-grid.bt-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--table-head);
  color: var(--text);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: center;
  white-space: nowrap;
}
.bt-report-grid.bt-table td {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.bt-report-grid.bt-table td.text-col { text-align: left; }
.bt-report-grid .sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}
.bt-report-grid thead th.sticky-col { z-index: 4; background: var(--table-head); }
.bt-report-grid tbody tr:nth-child(even) td { background: #F1F5F9; }
.bt-report-grid tbody tr:hover td { background: var(--table-hover); }
.bt-report-grid tbody td.has-hr-leave { background: #F0FDF4; }
.bt-filter-form .bt-hours-filter {
  margin: 0 0.35rem 0 0.15rem;
  white-space: nowrap;
}
/* Fields have a caption above the box; line buttons up with the boxes, not the caption. */
.bt-toolbar > .inline-form.bt-filter-form { align-items: flex-end; }
.bt-date-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem 0.5rem;
  padding: 0.1rem 0.7rem 0.1rem 0;
  margin-right: 0.15rem;
  border-right: 1px solid var(--border);
}
.bt-month-filter select {
  min-width: 11rem;
  font-weight: 600;
  color: var(--text);
}
.bt-filter-form > .checkbox-label.bt-hours-filter { min-height: 34px; }
.bt-filter-form .bt-filter-dropdown .bt-columns-menu { left: 0; right: auto; }
[dir="rtl"] .bt-filter-form .bt-filter-dropdown .bt-columns-menu { left: auto; right: 0; }
.bt-filter-form .bt-filter-dropdown .bt-columns-option {
  flex-direction: row;
  color: var(--text);
  font-size: 0.85rem;
  gap: 0.45rem;
}
.bt-filter-form .bt-filter-dropdown .bt-columns-option input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
}
.bt-filter-dropdown-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bt-report-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
}
.bt-report-loading[hidden] { display: none !important; }
.bt-report-loading-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
  text-align: center;
  min-width: 240px;
}
.bt-report-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 0.75rem;
  border: 3px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: bt-spin 0.8s linear infinite;
}
@keyframes bt-spin { to { transform: rotate(360deg); } }
body.bt-report-busy { cursor: progress; }
.bt-mp-legend {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  background: #FEE2E2;
  color: var(--danger);
  font-weight: 700;
  border-radius: 3px;
  font-size: 0.8rem;
}

/* ?? Mobile / tablet shell & page chrome (shared by all VPS tenants + on-prem) ?? */
@media (max-width: 900px) {
  body {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  .bt-nav-toggle { display: inline-flex; }

  /* ServicePro-style sticky wrap header + horizontal module strip */
  .bt-topbar {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    align-items: center;
    align-content: start;
    gap: 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.16);
  }
  .bt-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0.05rem;
    padding: 0.35rem 0.75rem;
    flex: 1;
    min-width: 0;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.15;
  }
  .bt-brand:hover { color: #fff; text-decoration: none; }
  .bt-brand-name { display: block; }
  .bt-brand-customer {
    display: block;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.88;
  }
  .bt-modules {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px 4px;
    gap: 2px;
  }
  .bt-modules::-webkit-scrollbar { display: none; }
  .bt-module {
    flex: 0 0 auto;
    padding: 0 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
    min-height: 34px;
    border-bottom-width: 2px;
  }
  .bt-topbar-right {
    padding: 0 0.65rem;
    gap: 0.45rem;
    margin-left: auto;
  }
  .bt-user {
    max-width: 6.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bt-layout {
    flex: 1;
    min-height: 0;
    height: auto;
    position: relative;
  }
  .bt-nav-backdrop {
    inset: 0;
    top: 0;
  }
  body.bt-nav-open .bt-nav-backdrop {
    display: block;
  }

  .bt-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 95;
    width: min(300px, 86vw);
    min-width: 0;
    padding-top: env(safe-area-inset-top, 0);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.25);
  }
  body.bt-nav-open .bt-sidebar {
    transform: translateX(0);
  }
  .bt-content {
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  .bt-mobile-subnav:not([hidden]) {
    display: flex;
    scroll-padding-inline: 0.75rem;
    padding: 0 0.15rem;
  }
  .bt-mobile-subnav-link {
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
  }

  .bt-inner-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scroll-padding-inline: 0.5rem;
  }
  .bt-inner-tab { flex: 0 0 auto; white-space: nowrap; }

  .bt-tabbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bt-tab { flex: 0 0 auto; white-space: nowrap; }

  .bt-workbench-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 0.25rem 0.4rem 0;
  }
  .bt-workbench-tab {
    flex: 0 0 auto;
    max-width: 11rem;
    font-size: 0.78rem;
    padding: 0.35rem 0.45rem 0.35rem 0.6rem;
  }

  .bt-page-header,
  .bt-toolbar,
  .bt-preview-main > .bt-toolbar,
  .bt-preview-main > .bt-preview-filters {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }
  .bt-page-header {
    gap: 0.35rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  .bt-page-header .muted,
  .bt-page-header .hint {
    flex: 1 1 100%;
    font-size: 0.78rem;
    margin: 0;
  }
  .bt-toolbar {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .bt-search {
    min-width: 0;
    width: auto;
    max-width: 100%;
  }
  .bt-toolbar > .bt-search,
  .bt-toolbar > form > .bt-search {
    flex: 1 1 8rem;
    min-width: 0;
  }

  /* Compact filter bars (reports, logs, schedule, calculation, ?) */
  .bt-toolbar > .inline-form.bt-filter-form,
  .bt-filter-form,
  .filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.45rem;
    align-items: flex-end;
    width: 100%;
  }
  .bt-date-cluster {
    flex: 1 1 100%;
    border-right: none;
    padding-right: 0;
    margin-right: 0;
  }
  .bt-date-cluster > label {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    flex: 1 1 calc(50% - 0.25rem);
    max-width: calc(50% - 0.25rem);
    min-width: 0;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.2;
  }
  .bt-date-cluster > label.bt-month-filter {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .bt-filter-form > label,
  .filter-form > label,
  .bt-preview-filters > label {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    flex: 1 1 calc(50% - 0.25rem);
    max-width: calc(50% - 0.25rem);
    min-width: 0;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.2;
  }
  .bt-filter-form > label:has(select),
  .bt-filter-form > label.bt-emp-filter-label,
  .filter-form > label:has(select),
  .bt-preview-filters > label.bt-emp-filter-label,
  .bt-preview-filters > label:has(select) {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .bt-filter-form input,
  .bt-filter-form select,
  .filter-form input,
  .filter-form select,
  .bt-preview-filters input,
  .bt-preview-filters select,
  .bt-filter-form .bt-search,
  .bt-preview-filters .bt-search {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    padding: 0.32rem 0.4rem;
    min-height: 2.05rem;
    line-height: 1.25;
  }
  .bt-filter-form input[type="date"],
  .bt-preview-filters input[type="date"],
  .filter-form input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }
  .bt-emp-filter-label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.12rem;
  }
  .bt-emp-filter,
  .bt-toolbar .bt-emp-filter,
  .bt-preview-filters .bt-emp-filter {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  .bt-emp-filter .bt-emp-picker-trigger {
    width: 100%;
    min-height: 2.05rem;
    padding: 0.32rem 0.5rem;
    font-size: 0.8rem;
  }
  .bt-emp-filter .bt-emp-picker-panel {
    width: 100%;
    min-width: 0;
    max-width: min(100vw - 1.5rem, 24rem);
  }
  .bt-filter-form .bt-hours-filter,
  .bt-filter-form > .checkbox-label {
    flex: 1 1 100%;
    max-width: 100%;
    flex-direction: row;
    align-items: center;
    white-space: normal;
    font-size: 0.8rem;
    min-height: auto;
  }
  .bt-filter-form > .btn,
  .bt-filter-form > a.btn,
  .bt-filter-form > button,
  .bt-preview-filters > .btn,
  .bt-preview-filters > a.btn,
  .bt-preview-filters > button,
  .filter-form > .btn,
  .filter-form > button {
    flex: 0 0 auto;
    max-width: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    min-height: 2.05rem;
  }

  .bt-form-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .bt-form-label { text-align: left; padding-top: 0; }
  .bt-form-panel { padding: 1rem; }
  .bt-form-panel-grid { grid-template-columns: 1fr; }
  .bt-form-field select,
  .bt-form-field input[type="number"],
  .bt-form-field input[type="time"],
  .bt-select {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  .bt-form-actions {
    flex-wrap: wrap;
    padding: 0.75rem 1rem 1rem;
  }

  .bt-enroll-hint { padding-left: 0; }
  .bt-enroll-form .bt-form-row.compact {
    grid-template-columns: 1fr;
  }

  .bt-config-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .bt-config-row label { min-width: 0; }

  .bt-preview-page form.bt-preview-layout,
  .bt-preview-layout {
    flex-direction: column;
  }
  .bt-preview-sidebar {
    width: 100%;
    min-width: 0;
    max-height: 11rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Keep page numbers / footer visible under the scrolling table */
  .bt-table-pager,
  .bt-page > .bt-footer,
  .bt-page-body > .bt-table-pager {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 4;
  }
  .bt-table-pager {
    gap: 0.35rem 0.5rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.75rem;
  }
  .bt-pager-left,
  .bt-pager-nav,
  .bt-pager-pages {
    flex-wrap: wrap;
  }
  .bt-pager-size { min-width: 3.4rem; }
  .bt-pager-nav .btn {
    min-width: 2rem;
    padding: 0.25rem 0.4rem;
  }
  .bt-footer {
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }
  .bt-footer .muted {
    flex: 1 1 100%;
    font-size: 0.7rem;
    line-height: 1.35;
  }

  .bt-table th,
  .bt-table td {
    padding: 0.4rem 0.45rem;
    font-size: 0.78rem;
  }
  .bt-monthly-matrix .day-col {
    min-width: 5.2rem;
    max-width: 7rem;
    font-size: 0.68rem;
    padding: 0.22rem 0.12rem;
  }
  .bt-monthly-matrix.has-hours .day-col {
    min-width: 6.2rem;
    max-width: 8.5rem;
  }
  .bt-monthly-matrix .sticky-col,
  .bt-monthly-matrix .sticky-col2 {
    min-width: 4.2rem;
    font-size: 0.72rem;
  }

  /* Mobile: no frozen columns ? every column scrolls with the table */
  .bt-table-panel .bt-table-data th.bt-sticky-col,
  .bt-table-panel .bt-table-data td.bt-sticky-col,
  .bt-schedule-grid .sticky-col,
  .bt-schedule-grid .sticky-col2,
  .bt-schedule-grid .sticky-col3,
  .bt-schedule-grid .sticky-col4 {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
  }

  .login-wrap { padding: 1.25rem 0.85rem; }
  .login-panel { padding: 1.5rem 1.15rem 1.25rem; }
  .login-machine .machine-code {
    word-break: break-all;
    white-space: normal;
  }

  .bt-dropdown-menu {
    left: auto;
    right: 0;
    min-width: min(220px, calc(100vw - 1.5rem));
  }

  .bt-modal {
    width: min(920px, 100vw - 0.75rem);
    max-height: 92vh;
  }
  .bt-modal-backdrop { padding: 0.5rem; }
}

@media (max-width: 600px) {
  .bt-user { display: none; }
  .bt-brand-name { font-size: 0.92rem; }
  .bt-brand-customer { max-width: 7rem; font-size: 0.68rem; }
  .bt-logout { padding: 0.3rem 0.55rem; }
  .bt-page-title { font-size: 0.95rem; }
  /* Phone: ServicePro-like compact module chips */
  .bt-topbar {
    padding-bottom: 0;
  }
  .bt-modules {
    margin: 0;
    padding: 2px 8px 4px;
  }
  .bt-module {
    font-size: 0.75rem;
    min-height: 32px;
    padding: 0 0.65rem;
  }
  body.bt-product-vps .bt-modules {
    background: rgba(0, 0, 0, 0.12);
  }
  .bt-monitoring-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
  }
  .bt-stat-card { padding: 0.45rem 0.55rem; }
  .bt-stat-label { font-size: 0.68rem; }
  .bt-stat-value { font-size: 1.1rem; }
  .bt-monitoring-feed { min-height: min(48vh, 22rem); }
  .bt-page-header { display: none; }
  body.bt-embed .bt-page-header { display: none; }
}

/* When topbar modules stay on one row (short phones with few modules), keep sidebar under topbar only */
@media (max-width: 900px) and (min-width: 0) {
  body.bt-embed .bt-nav-toggle,
  html.bt-in-iframe .bt-nav-toggle { display: none !important; }
  html.bt-in-iframe .bt-sidebar,
  body.bt-embed .bt-sidebar {
    position: static !important;
    transform: none !important;
    width: auto !important;
    box-shadow: none !important;
  }
}

.bt-superadmin-main {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  overflow: auto;
  height: auto;
  min-height: calc(100vh - 48px);
}
@media (max-width: 900px) {
  .bt-superadmin-main {
    margin: 1rem auto;
    padding: 0 0.75rem;
    min-height: calc(100dvh - 88px);
  }
}

/* Superadmin customer pages */
.sa-tenant-page {
  padding-bottom: 2rem;
}
.sa-tenant-header {
  align-items: flex-start;
}
.sa-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}
.sa-meta {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.875rem;
}
.sa-tenant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
  padding: 0.25rem;
  background: #f3f4f6;
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
}
.sa-tenant-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.sa-tenant-tab:hover {
  background: #e5e7eb;
  color: #111827;
}
.sa-tenant-tab.is-active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.sa-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sa-card {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sa-card-flush {
  padding: 0;
  overflow: hidden;
}
.sa-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.sa-card-head-pad {
  padding: 1.15rem 1.25rem 0.85rem;
  margin-bottom: 0;
}
.sa-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: #111827;
}
.sa-card-lead {
  margin: 0.35rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 42rem;
}
.sa-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.sa-pill-ok {
  background: #ecfdf5;
  color: #047857;
}
.sa-pill-warn {
  background: #fff7ed;
  color: #c2410c;
}
.sa-domain-form {
  margin-top: 0.25rem;
}
.sa-domain-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.sa-domain-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  max-width: 36rem;
}
.sa-domain-at {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
}
.sa-domain-input {
  flex: 1 1 12rem;
  min-width: 10rem;
}
.sa-domain-hint {
  margin: 0.55rem 0 0;
}
.sa-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 0.25rem;
}
.sa-form-grid .field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.sa-form-grid .field .hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.35;
}
.sa-form-grid .field .field-error {
  display: block;
  margin-top: 0.25rem;
  color: #b91c1c;
  font-size: 0.8rem;
}
.sa-form-grid .bt-search,
.sa-form-grid input,
.sa-form-grid textarea,
.sa-form-grid select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.sa-span-2 {
  grid-column: 1 / -1;
}
.sa-active-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  margin: 0.35rem 0 0;
}
.sa-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.15rem 0 0.5rem;
}
.sa-email-alias {
  max-width: 100%;
}
.sa-email-alias .bt-search,
.sa-email-alias input {
  width: 100%;
}
.sa-active-field {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.35rem;
}
.sa-users-table td {
  vertical-align: middle;
}
.sa-email {
  font-size: 0.9rem;
}
.sa-inline-role select {
  min-width: 11rem;
  width: auto;
}
.sa-inline-pass {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.sa-inline-pass input {
  width: 8.5rem;
}
.sa-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.sa-empty {
  color: #6b7280;
  text-align: center;
  padding: 1.5rem 1rem !important;
}
@media (max-width: 800px) {
  .sa-form-grid {
    grid-template-columns: 1fr;
  }
  .sa-span-2 {
    grid-column: auto;
  }
  .sa-domain-row {
    max-width: none;
  }
  .sa-inline-pass input {
    width: 100%;
  }
}

/* VPS attendance chat ? button only until opened */
.bt-aichat-fab {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 240;
  width: 3.15rem;
  height: 3.15rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bt-aichat-fab:hover { filter: brightness(1.06); }
.bt-aichat-fab .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.bt-aichat-fab svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bt-aichat-panel {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 241;
  width: min(420px, calc(100vw - 1.5rem));
  height: min(580px, calc(100vh - 5rem));
  background: #F8FBFF;
  border: 1px solid #BFDBFE;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(30, 64, 175, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bt-aichat-panel[hidden] {
  display: none !important;
}
.bt-aichat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem 0.7rem;
  background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
  color: #fff;
}
.bt-aichat-head strong { display: block; font-size: 0.95rem; }
.bt-aichat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  z-index: 2;
  position: relative;
}
.bt-aichat-close:hover { background: rgba(255, 255, 255, 0.28); }
.bt-aichat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem 0.2rem;
  max-height: 6.4rem;
  overflow: auto;
  border-bottom: 1px solid #DBEAFE;
  background: #EFF6FF;
}
.bt-aichat-chip {
  border: 1px solid #BFDBFE;
  background: #fff;
  color: #1E3A8A;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.bt-aichat-chip:hover { border-color: #2563EB; color: #1D4ED8; background: #DBEAFE; }
.bt-aichat-chip-row,
.bt-aichat-mean {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.bt-aichat-mean { margin-top: 0.35rem; }
.bt-aichat-mean-label {
  margin: 0.45rem 0 0.15rem !important;
  color: #1E40AF;
  font-size: 0.75rem;
  font-weight: 600;
}
.bt-aichat-mean .bt-aichat-chip {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1E3A8A;
  text-align: left;
  white-space: normal;
  border-radius: 10px;
  line-height: 1.25;
  max-width: 100%;
}
.bt-aichat-mean .bt-aichat-chip:hover {
  border-color: #2563EB;
  color: #1D4ED8;
  background: #DBEAFE;
}
.bt-aichat-log {
  flex: 1;
  overflow: auto;
  padding: 0.75rem;
  background: #F8FBFF;
}
.bt-aichat-msg {
  max-width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.82rem;
}
.bt-aichat-msg p { margin: 0 0 0.4rem; }
.bt-aichat-msg p:last-child { margin-bottom: 0; }
.bt-aichat-user {
  margin-left: 1.5rem;
  background: #DBEAFE;
  color: #1E3A8A;
}
.bt-aichat-bot {
  margin-right: 1.5rem;
  background: #fff;
  border: 1px solid #BFDBFE;
}
.bt-aichat-pending {
  color: #1D4ED8;
  font-style: normal;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.bt-aichat-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid #BFDBFE;
  border-top-color: #2563EB;
  border-radius: 999px;
  animation: bt-aichat-spin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes bt-aichat-spin {
  to { transform: rotate(360deg); }
}
.bt-aichat-table-wrap { overflow: auto; max-height: 12rem; margin-top: 0.45rem; }
.bt-aichat-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.bt-aichat-table th, .bt-aichat-table td {
  border: 1px solid #BFDBFE;
  padding: 0.2rem 0.35rem;
  text-align: left;
  white-space: nowrap;
}
.bt-aichat-table th { background: #EFF6FF; color: #1E3A8A; }
.bt-aichat-pdf {
  display: inline-block;
  margin-top: 0.35rem;
  background: #2563EB;
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.78rem;
}
.bt-aichat-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem;
  border-top: 1px solid #DBEAFE;
  background: #fff;
}
.bt-aichat-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}
.bt-aichat-form textarea:focus {
  outline: 2px solid #93C5FD;
  border-color: #2563EB;
}
.bt-aichat-send {
  border: 0;
  background: #2563EB;
  color: #fff;
  border-radius: 8px;
  padding: 0 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.bt-aichat-send:hover { background: #1D4ED8; }
.bt-aichat-send:disabled {
  opacity: 0.65;
  cursor: wait;
}
html.bt-in-iframe .bt-aichat-fab,
html.bt-in-iframe .bt-aichat-panel,
body.bt-embed .bt-aichat-fab,
body.bt-embed .bt-aichat-panel { display: none !important; }
@media (max-width: 700px) {
  .bt-aichat-fab, .bt-aichat-panel {
    right: 0.7rem;
    bottom: 0.7rem;
  }
  .bt-aichat-panel {
    width: calc(100vw - 1.4rem);
    height: min(78vh, 560px);
  }
}

/* Device map location picker */
.bt-device-ll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.bt-device-ll label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* VPS Live Map ? offline far view, no street tiles */
.bt-livemap-page { display: flex; flex-direction: column; min-height: 0; }
.bt-livemap-day {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.bt-livemap-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0 1rem 0.75rem;
}
.bt-livemap-present .bt-stat-value { color: #16a34a; }
.bt-livemap-absent .bt-stat-value { color: #2563eb; }
.bt-livemap-noshow .bt-stat-value { color: #b45309; }
.bt-livemap-late .bt-stat-value { color: #d97706; }
.bt-livemap-suspicious .bt-stat-value { color: #dc2626; }
.bt-livemap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 0.75rem;
  padding: 0 1rem;
  min-height: 0;
  flex: 1;
}
.bt-livemap-main { min-width: 0; }
.bt-livemap-canvas {
  height: min(58vh, 520px);
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #f5f0e6;
  position: relative;
}
.bt-livemap-canvas .leaflet-container {
  height: 100%;
  width: 100%;
  font-family: inherit;
  background: #f5f0e6;
}
.bt-livemap-hint { margin: 0.4rem 0 0; }
.bt-livemap-side {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  overflow: auto;
}
.bt-livemap-side-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}
.bt-livemap-locations,
.bt-livemap-unmapped {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}
.bt-livemap-locations li,
.bt-livemap-unmapped li {
  margin: 0 0 0.35rem;
}
.bt-livemap-loc {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.2rem 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.bt-livemap-loc span { flex: 1; }
.bt-livemap-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bt-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
  background: #64748b;
}
.bt-dot.present { background: #16a34a; }
.bt-dot.late { background: #f59e0b; }
.bt-dot.absent { background: #2563eb; }
.bt-dot.suspicious { background: #ef4444; }
.bt-dot.empty { background: #94a3b8; }
.bt-livemap-recent { padding: 0.75rem 1rem 1rem; }
.bt-livemap-emp-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.bt-livemap-photo,
.bt-livemap-photo-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #475569;
}
.bt-livemap-photo-sm { width: 36px; height: 36px; }
.bt-livemap-popup h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.bt-livemap-popup-meta { margin: 0 0 0.5rem; color: var(--text-muted); font-size: 0.75rem; }
.bt-livemap-popup-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  font-size: 0.78rem;
}
.bt-livemap-popup-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0 0;
}
.bt-livemap-popup-last {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.bt-livemap-online { margin-left: 0.4rem; }
.bt-livemap-online.is-on { color: #16a34a; font-weight: 600; }
.bt-livemap-pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e2e8f0;
}
.bt-livemap-pill.is-present { background: #dcfce7; color: #166534; }
.bt-livemap-pill.is-late { background: #fef3c7; color: #92400e; }
.bt-livemap-pill.is-absent { background: #dbeafe; color: #1d4ed8; }
.bt-livemap-pill.is-suspicious { background: #fee2e2; color: #b91c1c; }
.bt-livemap-pin { background: none; border: 0; }
.bt-livemap-pin-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 120px;
}
.bt-livemap-pin-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}
.bt-livemap-pin-badge {
  position: absolute;
  top: 0;
  right: 34px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}
.bt-livemap-pin-name {
  margin-top: 0.2rem;
  max-width: 7.5rem;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
}
.bt-livemap-hover-tip {
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}
.bt-livemap-hover-tip::before { border-top-color: #0f172a; }
.bt-livemap-permanent-tip {
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}
.bt-livemap-permanent-tip::before { border-top-color: #0f172a; }
.bt-livemap-present-now {
  margin: 0.35rem 0;
  font-size: 1rem;
}
.bt-livemap-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.bt-livemap-people {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 22rem;
  overflow: auto;
}
.bt-livemap-person-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.bt-livemap-person-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.bt-livemap-person-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.bt-livemap-emp-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  background: #94a3b8;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bt-livemap-emp-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bt-livemap-emp-marker.is-late { border-color: #f59e0b; }
.bt-livemap-emp-marker.is-suspicious { border-color: #ef4444; }
.bt-livemap-emp-marker.is-present { border-color: #16a34a; }

/* Location presence cards (replaces live map) */
.bt-locations-page { overflow: visible; }
.bt-locations-hint { padding: 0 1rem 0.75rem; margin: 0; }
.bt-live-header {
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 1rem;
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
  border-bottom: 2px solid var(--bt-green);
}
.bt-live-header .bt-page-title { color: var(--bt-green-dark); }
.bt-live-header .bt-stat-card { border-top: 3px solid var(--bt-accent); }
.bt-live-header .bt-livemap-present { border-top-color: #16a34a; }
.bt-live-header .bt-livemap-absent { border-top-color: var(--bt-green); }
.bt-live-header .bt-livemap-noshow { border-top-color: #d97706; }
.bt-live-stat-secondary .bt-stat-value { color: #0891b2; }
body .bt-locations-page .bt-location-card { border-top: 3px solid var(--bt-green-top); }
body .bt-locations-page .bt-location-card.is-noshow { border-top-color: #d97706; }
body .bt-locations-page .bt-location-card.is-card-empty { border-top-color: #cbd5e1; }
.bt-locations-page .bt-location-card-title { color: var(--bt-green-dark); }
.bt-live-tv-brand { display: none; }
.bt-live-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 9rem;
  flex: 0 0 auto;
}
.bt-live-header .bt-livemap-stats {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(5.5rem, 1fr));
  gap: 0.45rem;
  padding: 0;
  margin: 0;
}
.bt-live-header .bt-stat-card {
  padding: 0.35rem 0.55rem;
  min-width: 0;
}
.bt-live-header .bt-stat-label { font-size: 0.68rem; }
.bt-live-header .bt-stat-value { font-size: 1.15rem; }
.bt-live-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-left: 0;
  flex: 0 0 auto;
}
.bt-live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
}
.bt-live-refresh-hint { font-size: 0.8rem; }
.bt-live-stats-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.bt-live-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.bt-live-loading[hidden] { display: none !important; }
.bt-live-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: bt-live-spin 0.8s linear infinite;
}
@keyframes bt-live-spin {
  to { transform: rotate(360deg); }
}
.bt-live-error { margin: 0 1rem 0.75rem; }
.bt-location-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.15rem 1rem 2rem;
}
.bt-location-section.is-bare {
  margin-top: 0.15rem;
}
.bt-location-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 32rem;
  max-height: 32rem;
  min-height: 32rem;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.bt-location-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  flex: 0 0 auto;
}
.bt-location-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-right: 0.15rem;
}
.bt-location-card-body::-webkit-scrollbar {
  width: 6px;
}
.bt-location-card-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
.bt-location-card.is-present { border-color: #86efac; box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.12); }
.bt-location-card.is-left { border-color: #93c5fd; box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.1); }
.bt-location-card.is-absent { border-color: #fcd34d; box-shadow: 0 0 0 1px rgba(180, 83, 9, 0.12); }
.bt-location-card.is-mobile { border-left: 3px solid #2563eb; }
.bt-location-card.is-unassigned { border-style: dashed; opacity: 0.95; }
.bt-location-card.is-noshow { border-left: 3px solid #d97706; }
.bt-location-card-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.bt-location-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.bt-location-count strong {
  font-size: 0.82rem;
  font-weight: 700;
}
.bt-location-count.is-inside {
  background: #dcfce7;
  color: #166534;
}
.bt-location-count.is-left {
  background: #dbeafe;
  color: #1d4ed8;
}
.bt-location-count.is-noshow {
  background: #fef3c7;
  color: #92400e;
}
.bt-location-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.25;
  min-width: 0;
}
.bt-location-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.bt-location-section:first-child { margin-top: 0; }
.bt-location-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-bottom: 0;
  border-bottom: none;
}
.bt-location-section-head strong {
  color: var(--text);
  font-size: 0.8rem;
}
.bt-location-person.is-left { background: #eff6ff; }
.bt-location-person.is-noshow { background: #fffbeb; }
.bt-livemap-pill.is-noshow {
  background: #fef3c7;
  color: #92400e;
}
.bt-livemap-pill.is-leave.is-sick,
.bt-dash-pill.is-leave {
  background: #dcfce7;
  color: #15803d;
}
.bt-livemap-pill.is-leave.is-vacation {
  background: #e0f2fe;
  color: #0369a1;
}
.bt-livemap-pill.is-leave.is-personal {
  background: #f3e8ff;
  color: #7e22ce;
}
.bt-location-person.is-leave { background: #f0fdf4; }
.bt-location-person-name,
.bt-dash-emp-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.bt-leave-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  padding: 0.05rem 0.32rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.bt-leave-mark.is-sick { background: #15803d; color: #fff; }
.bt-leave-mark.is-vacation { background: #0284c7; color: #fff; }
.bt-leave-mark.is-personal { background: #7e22ce; color: #fff; }
.bt-location-person-name strong,
.bt-dash-emp-name strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.bt-tv-mode .bt-leave-mark { font-size: 0.7rem; }
.bt-location-card-desc,
.bt-location-card-devices {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
}
.bt-location-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.bt-location-person {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.35rem;
  border-radius: 8px;
  background: #f8fafc;
}
.bt-location-person-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.bt-location-person-info strong {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-location-person-position {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bt-green-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-location-person-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.bt-location-empty { font-size: 0.82rem; padding: 0.35rem 0; margin: 0; }
.bt-location-card-foot {
  margin-top: 0.25rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.bt-location-empty-state {
  grid-column: 1 / -1;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
/* Live View: arrange (drag to reorder) and open one location. */
.bt-location-cards .bt-location-card { cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.bt-location-cards .bt-location-card:hover { box-shadow: 0 4px 14px rgba(37, 99, 235, 0.16); }
.bt-live-arrange-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0.75rem 1rem 0;
  padding: 0.55rem 0.85rem;
  border: 1px dashed var(--bt-green);
  border-radius: 10px;
  background: #eff6ff;
  color: var(--bt-green-dark);
  font-weight: 500;
}
.bt-live-arrange-bar[hidden] { display: none; }
.bt-live-arrange-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.is-arranging .bt-location-cards .bt-location-card { cursor: grab; border-style: dashed; }
.is-arranging .bt-location-cards .bt-location-card:active { cursor: grabbing; }
.is-arranging .bt-location-card-body { pointer-events: none; }
.bt-location-card.is-dragging { opacity: 0.4; }
body .bt-locations-page .bt-location-card.is-drop-target {
  border-color: var(--bt-green);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
  transform: scale(1.01);
}
.bt-live-move { display: inline-flex; gap: 0.2rem; flex: 0 0 auto; }
.bt-live-move + .bt-location-card-title { flex: 1 1 auto; }
.bt-live-move-btn {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #fff;
  color: var(--bt-green-dark);
  font-size: 0.7rem;
  cursor: pointer;
}
.bt-live-move-btn:hover { background: var(--bt-green); border-color: var(--bt-green); color: #fff; }
.bt-live-focus {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
  background: rgba(15, 23, 42, 0.55);
}
.bt-live-focus[hidden] { display: none; }
.bt-live-focus-inner {
  position: relative;
  width: min(1400px, 100%);
  height: 100%;
  display: flex;
}
.bt-live-focus-body { flex: 1 1 auto; min-width: 0; display: flex; }
.bt-live-focus-close {
  position: absolute;
  top: -0.9rem;
  right: -0.9rem;
  z-index: 1;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: var(--bt-green);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
}
body .bt-live-focus .bt-live-focus-body .bt-location-card {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 1.25rem 1.5rem;
  gap: 0.9rem;
  font-size: 18px;
  cursor: default;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.35);
}
body .bt-live-focus .bt-live-focus-body .bt-location-card-title { font-size: 1.6em; }
body .bt-live-focus .bt-live-focus-body .bt-location-count { font-size: 1em; padding: 0.25em 0.75em; }
body .bt-live-focus .bt-live-focus-body .bt-location-count strong { font-size: 1.3em; }
body .bt-live-focus .bt-live-focus-body .bt-location-card-body { overflow-y: auto; scrollbar-width: thin; }
body .bt-live-focus .bt-live-focus-body .bt-location-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
  gap: 0.5em;
}
body .bt-live-focus .bt-live-focus-body .bt-location-person { padding: 0.45em 0.6em; gap: 0.6em; }
body .bt-live-focus .bt-live-focus-body .bt-location-person .bt-livemap-pill { display: none; }
body .bt-live-focus .bt-live-focus-body .bt-location-person-info strong { font-size: 1em; }
body .bt-live-focus .bt-live-focus-body .bt-location-person-position { font-size: 0.85em; }
body .bt-live-focus .bt-live-focus-body .bt-location-person-info .muted { font-size: 0.85em; }
body .bt-live-focus .bt-live-focus-body .bt-livemap-photo-sm { width: 2.6em; height: 2.6em; font-size: 0.9em; }
body .bt-live-focus .bt-live-focus-body .bt-location-section-head,
body .bt-live-focus .bt-live-focus-body .bt-location-section-head strong,
body .bt-live-focus .bt-live-focus-body .bt-location-empty { font-size: 0.95em; }
body.bt-tv-mode #bt-live-arrange-btn,
body.bt-tv-mode .bt-live-arrange-bar { display: none; }

/* Live View TV mode: full screen, every location card on one screen. */
.bt-live-tv-clock,
.bt-live-tv-exit { display: none; }
body.bt-tv-mode { overflow: hidden; }
body.bt-tv-mode .bt-topbar,
body.bt-tv-mode .bt-sidebar,
body.bt-tv-mode .bt-mobile-subnav,
body.bt-tv-mode .bt-messages { display: none !important; }
body.bt-live-locations.bt-tv-mode .bt-locations-page {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
  background: #e8eef8;
}
body.bt-tv-mode .bt-page-header.bt-live-header {
  display: flex !important;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  position: static;
  padding: 0.55rem 1rem;
  color: #fff;
  background: linear-gradient(120deg, var(--bt-green-dark) 0%, var(--bt-green) 55%, var(--bt-accent) 100%);
  border-bottom: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
body.bt-tv-mode .bt-live-tv-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 0 0 auto;
  min-width: 0;
}
body.bt-tv-mode .bt-live-tv-logo {
  height: 2.6rem;
  width: auto;
  display: block;
}
body.bt-tv-mode .bt-live-tv-customer {
  padding-left: 0.85rem;
  border-left: 2px solid rgba(255, 255, 255, 0.45);
  font-size: 1.3rem;
  font-weight: 650;
  line-height: 1.15;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.bt-tv-mode .bt-live-header-main { min-width: 0; }
body.bt-tv-mode .bt-live-header-main .bt-page-title { font-size: 1.05rem; color: #fff; }
body.bt-tv-mode .bt-live-header .muted { color: rgba(255, 255, 255, 0.82); }
body.bt-tv-mode .bt-live-header .bt-stat-card {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-top: 3px solid rgba(255, 255, 255, 0.6);
}
body.bt-tv-mode .bt-live-header .bt-livemap-present { border-top-color: #4ade80; }
body.bt-tv-mode .bt-live-header .bt-livemap-absent { border-top-color: #bfdbfe; }
body.bt-tv-mode .bt-live-header .bt-livemap-noshow { border-top-color: #fbbf24; }
body.bt-tv-mode .bt-live-header .bt-stat-label { color: rgba(255, 255, 255, 0.85); }
body.bt-tv-mode .bt-live-header .bt-stat-value { color: #fff; }
body.bt-tv-mode .bt-live-header .bt-livemap-present .bt-stat-value { color: #bbf7d0; }
body.bt-tv-mode .bt-live-header .bt-livemap-noshow .bt-stat-value { color: #fde68a; }
body.bt-tv-mode .bt-live-header .bt-livemap-stats {
  order: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
body.bt-tv-mode .bt-live-stat-secondary { display: block; }
body.bt-tv-mode .bt-live-header .bt-stat-label { font-size: 0.8rem; }
body.bt-tv-mode .bt-live-header .bt-stat-value { font-size: 1.6rem; }
body.bt-tv-mode .bt-live-toggle,
body.bt-tv-mode .bt-live-refresh-hint,
body.bt-tv-mode #bt-live-refresh-btn,
body.bt-tv-mode #bt-live-tv-btn { display: none; }
body.bt-tv-mode .bt-live-header-actions {
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}
body.bt-tv-mode .bt-live-tv-clock {
  display: block;
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
body.bt-tv-mode #bt-live-last-update { font-size: 0.75rem; }
body.bt-tv-mode .bt-live-tv-exit {
  display: inline-flex;
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  opacity: 0.45;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
}
body.bt-tv-mode .bt-live-tv-exit:hover,
body.bt-tv-mode .bt-live-tv-exit:focus-visible { opacity: 1; }
body.bt-tv-mode .bt-live-loading { flex: 1 1 auto; }
body.bt-tv-mode .bt-location-cards {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: repeat(var(--tv-cols, 4), minmax(0, 1fr));
  grid-template-rows: repeat(var(--tv-rows, 2), minmax(0, 1fr));
  gap: 0.6rem;
  padding: 0.6rem;
  font-size: var(--tv-font, 16px);
}
body.bt-tv-mode .bt-location-card {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0.6em 0.75em;
  gap: 0.45em;
}
body.bt-tv-mode .bt-location-card-title { font-size: 1.15em; }
body.bt-tv-mode .bt-location-card-counts { gap: 0.4em; }
body.bt-tv-mode .bt-location-count { font-size: 1.05em; padding: 0.2em 0.65em; gap: 0.35em; }
body.bt-tv-mode .bt-location-count strong { font-size: 1.3em; }
body.bt-tv-mode .bt-location-card-body {
  overflow-y: hidden;
  scrollbar-width: none;
  padding-right: 0;
}
body.bt-tv-mode .bt-location-card-body::-webkit-scrollbar { display: none; }
body.bt-tv-mode .bt-location-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5em, 1fr));
  gap: 0.3em;
}
body.bt-tv-mode .bt-location-person { padding: 0.25em 0.35em; gap: 0.45em; background: #f0fdf4; }
body.bt-tv-mode .bt-location-person.is-left { background: #eff6ff; }
body.bt-tv-mode .bt-location-person.is-noshow { background: #fffbeb; }
body.bt-tv-mode .bt-location-person .bt-livemap-pill { display: none; }
body.bt-tv-mode .bt-location-person-info strong { font-size: 0.95em; }
body.bt-tv-mode .bt-location-person-position { font-size: 0.85em; }
body.bt-tv-mode .bt-location-person-info .muted { font-size: 0.92em; font-weight: 500; color: #334155; }
body.bt-tv-mode .bt-livemap-photo-sm { width: 2.2em; height: 2.2em; font-size: 0.85em; }
body.bt-tv-mode .bt-location-section-head,
body.bt-tv-mode .bt-location-section-head strong,
body.bt-tv-mode .bt-location-empty { font-size: 0.85em; }

@media (max-width: 1200px) {
  .bt-location-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-location-card {
    height: 30rem;
    max-height: 30rem;
    min-height: 30rem;
  }
}
@media (max-width: 900px) {
  .bt-live-header {
    flex-wrap: wrap;
  }
  .bt-live-header .bt-livemap-stats {
    order: 3;
    flex: 1 1 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bt-live-stat-secondary { display: none; }
  .bt-live-stats-scroll {
    display: grid;
    grid-auto-flow: unset;
    padding-bottom: 0;
  }
  .bt-livemap-layout { grid-template-columns: 1fr; }
  .bt-livemap-canvas { height: 360px; }
  .bt-location-cards { grid-template-columns: 1fr; }
  .bt-location-card {
    height: 28rem;
    max-height: 28rem;
    min-height: 28rem;
  }
}
@media (max-width: 600px) {
  body.bt-live-locations .bt-page-header.bt-live-header {
    display: flex !important;
    position: static;
    padding: 0.45rem 0.65rem;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
  }
  body.bt-live-locations .bt-live-header-main .bt-page-title {
    font-size: 0.95rem;
  }
  body.bt-live-locations #bt-live-day-window {
    font-size: 0.72rem;
  }
  body.bt-live-locations .bt-live-refresh-hint {
    display: none;
  }
  body.bt-live-locations .bt-live-header .bt-livemap-stats {
    order: 3;
    flex-basis: 100%;
  }
}


/* ===== Shift UI (outlet ? 24h board) ===== */
.bt-shift-ui-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.bt-shift-ui-toolbar {
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.bt-shift-ui-date {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.bt-shift-ui-date input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  font: inherit;
}
#shift-ui-status.is-error { color: var(--danger); }

.bt-shift-ui-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 240px;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  padding: 0 0.75rem 0.75rem;
}
.bt-shift-ui-side,
.bt-shift-ui-detail {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  overflow: auto;
  min-height: 0;
}
.bt-shift-ui-side-head {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-bottom: 0.5rem;
}
.bt-shift-ui-side-head-gap { margin-top: 1rem; }
.bt-shift-ui-palette,
.bt-shift-ui-unassigned {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.bt-shift-ui-palette-item {
  border: 1px solid var(--border);
  border-left: 4px solid #2563EB;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  background: #F8FAFC;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.bt-shift-ui-palette-item[data-color="1"] { border-left-color: #0891B2; }
.bt-shift-ui-palette-item[data-color="2"] { border-left-color: #059669; }
.bt-shift-ui-palette-item[data-color="3"] { border-left-color: #D97706; }
.bt-shift-ui-palette-item[data-color="4"] { border-left-color: #DC2626; }
.bt-shift-ui-palette-item[data-color="5"] { border-left-color: #7C3AED; }
.bt-shift-ui-palette-item.is-dragging,
.bt-shift-ui-block.is-dragging,
.bt-shift-ui-chip.is-dragging { opacity: 0.55; }

.bt-shift-ui-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.bt-shift-ui-coverage {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: #F8FAFC;
  min-height: 52px;
}
.bt-shift-ui-coverage-label {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.bt-shift-ui-coverage-track {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(24, minmax(28px, 1fr));
  align-items: end;
  padding: 0.25rem 0 0;
  min-width: 0;
}
.bt-shift-ui-cov-cell {
  position: relative;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  border-right: 1px solid #EEF2F7;
}
.bt-shift-ui-cov-bar {
  width: 55%;
  max-width: 14px;
  background: linear-gradient(180deg, #60A5FA 0%, #2563EB 100%);
  border-radius: 3px 3px 0 0;
  min-height: 0;
}
.bt-shift-ui-cov-n {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.1;
  height: 0.9rem;
}

.bt-shift-ui-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.bt-shift-ui-hours,
.bt-shift-ui-row {
  display: flex;
  align-items: stretch;
  min-width: 860px;
}
.bt-shift-ui-hours {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #F1F5F9;
  border-bottom: 1px solid var(--border);
}
.bt-shift-ui-row-label {
  width: 160px;
  flex-shrink: 0;
  padding: 0.45rem 0.55rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--panel-bg);
}
.bt-shift-ui-hours .bt-shift-ui-row-label { background: #F1F5F9; }
.bt-shift-ui-row-label strong { font-size: 0.82rem; }
.bt-shift-ui-emp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.2rem;
}
.bt-shift-ui-chip {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E3A8A;
  cursor: grab;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-shift-ui-chip.is-more {
  cursor: default;
  background: #F1F5F9;
  border-color: var(--border);
  color: var(--text-muted);
}
.bt-shift-ui-chip-block {
  display: flex;
  flex-direction: column;
  max-width: none;
  white-space: normal;
  padding: 0.35rem 0.45rem;
}

.bt-shift-ui-track {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(24, minmax(28px, 1fr));
  min-height: 64px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(100% / 24 - 1px),
      #EEF2F7 calc(100% / 24 - 1px),
      #EEF2F7 calc(100% / 24)
    );
}
.bt-shift-ui-track.is-drop-target {
  outline: 2px dashed var(--bt-green);
  outline-offset: -2px;
  background-color: #EFF6FF;
}
.bt-shift-ui-track-hours {
  min-height: 28px;
  background: transparent;
}
.bt-shift-ui-hour {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.35rem 0;
  border-right: 1px solid #E2E8F0;
}
.bt-shift-ui-slot {
  position: relative;
  border-right: 1px solid transparent;
  min-height: 64px;
}
.bt-shift-ui-slot.has-cover { background: rgba(37, 99, 235, 0.04); }
.bt-shift-ui-slot-n {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: #64748B;
  z-index: 1;
  pointer-events: none;
}

.bt-shift-ui-block {
  position: absolute;
  top: 8px;
  bottom: 16px;
  z-index: 3;
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  color: #fff;
  cursor: grab;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  border: 1px solid rgba(255,255,255,0.2);
}
.bt-shift-ui-block[data-color="1"] { background: linear-gradient(135deg, #22D3EE 0%, #0891B2 100%); }
.bt-shift-ui-block[data-color="2"] { background: linear-gradient(135deg, #34D399 0%, #059669 100%); }
.bt-shift-ui-block[data-color="3"] { background: linear-gradient(135deg, #FBBF24 0%, #D97706 100%); }
.bt-shift-ui-block[data-color="4"] { background: linear-gradient(135deg, #F87171 0%, #DC2626 100%); }
.bt-shift-ui-block[data-color="5"] { background: linear-gradient(135deg, #A78BFA 0%, #7C3AED 100%); }
.bt-shift-ui-block-title {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-shift-ui-block-meta {
  font-size: 0.62rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-shift-ui-row {
  border-bottom: 1px solid var(--border);
}
.bt-shift-ui-row:hover .bt-shift-ui-row-label { background: #F8FAFC; }
.bt-shift-ui-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.bt-shift-ui-detail-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.65rem;
}
.bt-shift-ui-detail-time {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}
.bt-shift-ui-detail-section { margin-top: 0.75rem; }
.bt-shift-ui-detail-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.bt-shift-ui-detail-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.35rem;
  background: #F8FAFC;
}
.bt-shift-ui-detail-emps {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bt-shift-ui-detail-emps li {
  padding: 0.25rem 0;
  border-bottom: 1px solid #F1F5F9;
}
.bt-shift-ui-detail .btn.danger {
  margin-top: 0.75rem;
  width: 100%;
  background: #FEE2E2;
  border-color: #FECACA;
  color: #B91C1C;
}
.bt-shift-ui-detail .btn.danger:hover {
  background: #FECACA;
}

@media (max-width: 1100px) {
  .bt-shift-ui-layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .bt-shift-ui-detail { display: none; }
}
@media (max-width: 800px) {
  .bt-shift-ui-layout {
    grid-template-columns: 1fr;
  }
  .bt-shift-ui-side {
    max-height: 180px;
  }
}

/* —— Language switcher —— */
.bt-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0.1rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
}
.bt-lang-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.28rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
}
.bt-lang-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.bt-lang-btn.active {
  color: #0f172a;
  background: #fff;
}
.bt-lang-switch-login {
  float: right;
  margin: 0 0 0.85rem;
  background: #E2E8F0;
}
html[dir="rtl"] .bt-lang-switch-login {
  float: left;
}
.bt-lang-switch-login .bt-lang-btn {
  color: #64748B;
}
.bt-lang-switch-login .bt-lang-btn:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}
.bt-lang-switch-login .bt-lang-btn.active {
  color: #fff;
  background: var(--bt-green, #0d9488);
}

/* —— RTL shell —— */
html[dir="rtl"] body {
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
html[dir="rtl"] .bt-topbar-right {
  margin-left: 0;
  margin-right: auto;
}
html[dir="rtl"] .bt-nav-title,
html[dir="rtl"] .bt-nav-link,
html[dir="rtl"] .bt-module,
html[dir="rtl"] .bt-form-label,
html[dir="rtl"] .bt-page,
html[dir="rtl"] table.data th,
html[dir="rtl"] table.data td {
  text-align: right;
}
html[dir="rtl"] .login-panel {
  text-align: right;
}
html[dir="rtl"] .login-panel label,
html[dir="rtl"] .login-panel input,
html[dir="rtl"] .login-panel .btn {
  text-align: right;
}
html[dir="rtl"] .login-panel .btn {
  text-align: center;
}
html[dir="rtl"] .login-remember {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  html[dir="rtl"] .bt-sidebar {
    left: auto;
    right: 0;
    transform: translateX(105%);
    box-shadow: -4px 0 24px rgba(15, 23, 42, 0.25);
  }
  html[dir="rtl"] body.bt-nav-open .bt-sidebar {
    transform: translateX(0);
  }
  html[dir="rtl"] .bt-topbar-right {
    margin-right: 0;
  }
}

/* Login on phones: match the web face punch look. Desktop is untouched. */
@media (max-width: 640px) {
  body.login-page,
  body.login-page-vps { background: #F8FAFC; }
  body.login-page .login-wrap,
  body.login-page-vps .login-wrap {
    min-height: 100dvh;
    align-items: flex-start;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
    background-attachment: fixed;
  }
  body.login-page .login-shell {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
  }
  body.login-page .login-brand {
    margin: 4px 0 18px;
  }
  body.login-page .login-brand h2,
  body.login-page-vps .login-brand h2 {
    font-size: 1.35rem;
    gap: 10px;
  }
  body.login-page .login-brand h2::before {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 0.9rem;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
  }
  body.login-page .login-brand .login-org-name,
  body.login-page-vps .login-brand .login-org-name {
    font-size: 0.9rem;
    color: #64748B;
    font-weight: 500;
  }
  body.login-page .login-panel,
  body.login-page-vps .login-panel {
    max-width: none;
    padding: 20px 18px 22px;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  }
  body.login-page .bt-lang-switch-login {
    float: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
    margin: 0 0 18px;
    padding: 4px;
    border-radius: 10px;
    background: #F1F5F9;
  }
  body.login-page .bt-lang-switch-login .bt-lang-btn {
    padding: 9px 8px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
  }
  body.login-page .bt-lang-switch-login .bt-lang-btn.active {
    background: #2563EB;
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  }
  body.login-page .login-panel h1,
  body.login-page-vps .login-panel h1 {
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
  }
  body.login-page .login-panel .subtitle,
  body.login-page-vps .login-panel .subtitle {
    font-size: 0.95rem;
    margin: 0 0 18px;
  }
  body.login-page .login-panel label,
  body.login-page-vps .login-panel label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748B;
    margin: 0 0 6px;
  }
  body.login-page .login-panel input:not([type="checkbox"]):not([type="hidden"]),
  body.login-page-vps .login-panel input:not([type="checkbox"]):not([type="hidden"]) {
    height: 48px;
    padding: 0 14px;
    font-size: 16px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    margin-bottom: 14px;
  }
  body.login-page .login-panel textarea {
    font-size: 16px;
    border-radius: 10px;
  }
  body.login-page .login-remember,
  body.login-page-vps .login-remember {
    font-size: 0.95rem;
    margin: 2px 0 16px;
  }
  body.login-page .login-panel .login-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }
  body.login-page .login-panel .btn.primary,
  body.login-page-vps .login-panel .btn.primary {
    min-height: 52px;
    padding: 14px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 10px;
    background: #2563EB;
    border-color: #2563EB;
    color: #fff;
  }
  body.login-page .login-panel .btn:not(.primary) {
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
  }
  body.login-page .msg {
    border-radius: 10px;
  }
  body.login-page .login-machine .machine-code {
    display: block;
    word-break: break-all;
    white-space: normal;
  }
}

.bt-filter-toggle { display: none; }

/* Admin on phones: face-punch style shell + card lists. Desktop is untouched. */
@media (max-width: 640px) {
  body:not(.login-page) { background: #F1F5F9; }
  .bt-content { background: #F1F5F9; }
  .bt-page { background: transparent; }

  .bt-topbar { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18); }
  .bt-brand { padding: 0.45rem 0.6rem; }
  .bt-brand-name { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
  .bt-module { font-size: 0.8rem; min-height: 36px; border-radius: 8px 8px 0 0; }

  .bt-workbench-tabs { display: none !important; }
  .bt-mobile-subnav { display: none !important; }

  .bt-monitoring-page .bt-monitoring-stats,
  .bt-monitoring-page .bt-monitoring-feed-toolbar,
  .bt-monitoring-page .bt-monitoring-reports { display: none !important; }
  .bt-monitoring-page .bt-monitoring-feed { min-height: 0; }

  .bt-pager-single { display: none !important; }

  /* Report pages: no title chrome, filters folded behind one button, compact footer */
  .bt-page[data-report-slug] > .bt-tabbar,
  .bt-page[data-report-slug] > .bt-page-header { display: none !important; }
  .bt-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    padding: 0 0.85rem;
    border: 0;
    border-radius: 10px;
    background: #EFF6FF;
    color: #1D4ED8;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
  }
  .bt-filter-toggle-range { flex: 1; text-align: right; color: #334155; font-weight: 500; }
  .bt-filter-toggle-chevron { transition: transform 0.15s ease; }
  .bt-filters-open .bt-filter-toggle-chevron { transform: rotate(180deg); }
  .bt-filters-collapsible:not(.bt-filters-open) > form { display: none !important; }
  .bt-filters-collapsible { padding: 0.5rem; }
  .bt-filters-collapsible.bt-filters-open > form { margin-top: 0.4rem; }
  .bt-filter-form > label.bt-hours-filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #334155;
  }
  .bt-filter-form > label.bt-hours-filter input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0;
  }
  .bt-page[data-report-slug] .bt-footer {
    justify-content: center;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
  }
  .bt-page[data-report-slug] .bt-footer .muted,
  .bt-page[data-report-slug] .bt-footer .hint { display: none; }

  /* Report grids (Punch Log, Daily Punch Card, Daily Hours, …): one card per row */
  .bt-table-panel-cards .bt-report-grid-wrap { overflow: visible; }
  .bt-card-table.bt-report-grid td.bt-card-blank,
  .bt-card-table.bt-report-grid td.bt-card-dash { display: none; }
  .bt-filters-collapsible > .bt-filter-toggle { flex: 1 1 0; width: auto; min-width: 0; }
  .bt-toolbar-collapsible:not(.bt-toolbar-open) > :not(.bt-toolbar-toggle):not(.bt-toolbar-keep):not(.bt-toolbar-columns) { display: none !important; }
  .bt-toolbar-collapsible > .btn.primary.bt-toolbar-keep { order: -1; }
  .bt-toolbar-collapsible > .bt-toolbar-toggle { order: -1; flex: 1 1 9rem; width: auto; min-width: 0; min-height: 42px; }
  .bt-toolbar-collapsible > .bt-toolbar-toggle .bt-filter-toggle-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
  .bt-toolbar-collapsible.bt-toolbar-open .bt-filter-toggle-chevron { transform: rotate(180deg); }
  .bt-toolbar-collapsible > form.inline-form[method="post"] { width: auto; order: 0; }
  .bt-toolbar-collapsible > .bt-toolbar-columns { order: -1; margin-left: 0; }
  .bt-toolbar-collapsible > .bt-toolbar-columns .btn { min-height: 42px; }
  .bt-toolbar-collapsible > .bt-toolbar-search { order: -1; flex: 1 1 0; width: auto; min-width: 0; }
  .bt-toolbar-collapsible > .bt-toolbar-toggle.bt-toolbar-toggle-icon {
    position: relative;
    flex: 0 0 42px;
    width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .bt-toolbar-collapsible.bt-toolbar-open > .bt-toolbar-toggle-icon { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
  .bt-toolbar-toggle-icon.is-filtered::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563EB;
  }
  .btn.bt-columns-trigger,
  .bt-toolbar .btn.bt-columns-trigger { width: 42px; min-height: 42px; padding: 0; justify-content: center; }
  .bt-columns-trigger-label { display: none; }

  /* Section tabs duplicate the side menu on phones */
  .bt-page > .bt-tabbar,
  .bt-page > .bt-inner-tabs:not(.bt-inner-tabs-keep) { display: none !important; }
  .bt-filters-collapsible > .bt-toolbar-columns { order: 0; margin-left: 0; }
  .bt-filters-collapsible > .bt-toolbar-columns .btn { min-height: 44px; }
  .bt-pager-first,
  .bt-pager-last { display: none !important; }
  .bt-table-pager { flex-wrap: wrap; gap: 0.3rem 0.6rem; }
  .bt-pager-nav { flex-wrap: nowrap; }
  .bt-pager-pages { flex-wrap: nowrap; }
  .bt-card-table.bt-report-grid.bt-table td,
  .bt-card-table.bt-report-grid .sticky-col {
    position: static;
    min-width: 0;
    padding: 0.3rem 0;
    border: 0;
    border-top: 1px solid #F1F5F9;
    font-size: 0.85rem;
    text-align: right;
  }
  .bt-card-table.bt-report-grid.bt-table td.bt-card-key {
    border-top: 0;
    padding: 0 0 0.35rem;
    font-size: 1rem;
    text-align: left;
  }
  .bt-card-table td.bt-card-key.bt-card-date,
  .bt-card-table.bt-report-grid.bt-table td.bt-card-key.bt-card-date {
    order: -1;
    margin-left: auto;
    align-self: center;
    padding: 0.1rem 0.55rem;
    margin-bottom: 0.35rem;
    border-radius: 999px;
    background: #EFF6FF !important;
    color: #1D4ED8;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
  }
  .bt-card-table td.status-warn,
  .bt-card-table td .status-warn { color: var(--danger, #DC2626); font-weight: 600; }

  /* Monthly report: one card per employee, days listed */
  .bt-table-panel-cards .bt-monthly-matrix-wrap { overflow: visible; max-height: none; }
  .bt-card-table.bt-monthly-matrix.bt-table td,
  .bt-card-table.bt-monthly-matrix .day-col,
  .bt-card-table.bt-monthly-matrix .total-col,
  .bt-card-table.bt-monthly-matrix .sticky-col,
  .bt-card-table.bt-monthly-matrix .sticky-col2,
  .bt-card-table.bt-monthly-matrix .sticky-col3,
  .bt-card-table.bt-monthly-matrix .sticky-col4 {
    position: static;
    min-width: 0;
    max-width: none;
    padding: 0.3rem 0;
    border: 0;
    border-top: 1px solid #F1F5F9;
    font-size: 0.85rem;
    text-align: right;
    white-space: normal;
    vertical-align: baseline;
  }
  .bt-card-table.bt-monthly-matrix td.bt-card-key {
    border-top: 0;
    padding: 0 0 0.35rem;
    font-size: 1rem;
    text-align: left;
  }
  .bt-card-table.bt-monthly-matrix td.day-col[data-label]::before { font-variant-numeric: tabular-nums; }
  .bt-card-table.bt-monthly-matrix td.bt-card-blank::after { content: "—"; color: #CBD5E1; }
  .bt-card-table.bt-monthly-matrix td.has-weekend { color: #94A3B8; }
  .bt-card-table.bt-monthly-matrix td.has-mp { color: var(--danger); font-weight: 600; }
  .bt-card-table.bt-monthly-matrix td.has-mp::before { color: var(--danger); }
  .bt-card-table.bt-monthly-matrix td.total-col {
    margin-top: 0.2rem;
    padding-top: 0.55rem;
    border-top: 1px solid #E2E8F0;
    font-weight: inherit;
    color: inherit;
  }
  .bt-workbench-panels, #bt-workbench-home { background: transparent; }

  .bt-messages { padding: 0.6rem 0.75rem 0; }
  .bt-messages .msg { border-radius: 10px; margin-bottom: 0.4rem; font-size: 0.85rem; }

  .bt-inner-tabs,
  .bt-tabbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0.6rem 0.75rem 0;
    padding: 4px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .bt-inner-tabs::-webkit-scrollbar,
  .bt-tabbar::-webkit-scrollbar { display: none; }
  .bt-inner-tab,
  .bt-tab {
    flex: 1 0 auto;
    padding: 0.55rem 0.8rem;
    border: 0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    color: #64748B;
    background: transparent;
  }
  .bt-inner-tab.active,
  .bt-tab.active {
    background: #2563EB;
    color: #fff;
    border: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  }
  .bt-modal .bt-inner-tabs { margin: 0 0 0.6rem; }

  .bt-toolbar {
    margin: 0.6rem 0.75rem 0;
    padding: 0.65rem;
    gap: 0.5rem;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    background: #fff;
  }
  .bt-toolbar > .inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    order: 2;
  }
  .bt-toolbar > .inline-form > .bt-search[type="search"],
  .bt-toolbar > .inline-form > input[type="search"] { flex: 1 1 100%; }
  .bt-toolbar > .inline-form > select { flex: 1 1 auto; min-width: 0; }
  .bt-toolbar .bt-search,
  .bt-toolbar select,
  .bt-toolbar input[type="search"],
  .bt-toolbar input[type="text"] {
    min-height: 42px;
    font-size: 16px;
    border-radius: 10px;
  }
  .bt-toolbar .btn { min-height: 42px; border-radius: 10px; padding: 0.45rem 0.9rem; }
  .bt-toolbar > .btn.primary,
  .bt-toolbar > a.btn.primary { order: 1; }
  .bt-toolbar-spacer { display: none; }
  .bt-toolbar > .muted { order: 3; font-size: 0.8rem; }
  .bt-toolbar-columns { order: 4; margin-left: auto; }

  .bt-page-body { background: transparent; }

  /* Card lists */
  .bt-table-panel-cards { background: transparent; }
  .bt-table-panel-cards .bt-table-viewport {
    overflow-x: hidden;
    padding: 0.6rem 0.75rem 0.75rem;
  }
  .bt-table-panel .bt-table-data.bt-card-table,
  .bt-card-table,
  .bt-card-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
  }
  .bt-card-table thead { display: none; }
  .bt-card-table tbody tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.5rem;
    margin: 0 0 0.65rem;
    padding: 0.75rem 0.85rem 0.55rem;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  }
  .bt-card-table tbody tr:hover td { background: transparent; }
  .bt-table-panel .bt-card-table td,
  .bt-card-table td {
    display: flex;
    flex: 1 1 100%;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.45rem 0;
    border: 0;
    border-top: 1px solid #F1F5F9;
    background: transparent !important;
    font-size: 0.88rem;
    text-align: right;
    white-space: normal;
    word-break: break-word;
  }
  .bt-card-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    color: #64748B;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
  }
  .bt-card-table td.bt-card-key {
    order: -2;
    flex: 0 1 auto;
    display: inline-block;
    padding: 0 0 0.35rem;
    border-top: 0;
    text-align: left;
    font-size: 1rem;
    font-weight: 700;
    color: #0F172A;
  }
  .bt-card-table td.bt-card-key::before { content: none; }
  .bt-card-table td.bt-card-key + td.bt-card-key { font-weight: 600; color: #334155; }
  .bt-card-table td.bt-card-check {
    order: -3;
    display: block;
    flex: 0 0 auto;
    width: auto;
    padding: 0 0.25rem 0.35rem 0;
    border: 0;
  }
  .bt-card-table td.bt-card-check::before { content: none; }
  .bt-card-table td.bt-card-check input { width: 20px; height: 20px; margin: 0; vertical-align: middle; }
  .bt-card-table td.bt-card-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.55rem;
    margin-top: 0.2rem;
  }
  .bt-card-table td.bt-card-actions::before { content: none; }
  .bt-card-table td.bt-card-actions .bt-action-btn {
    width: auto;
    min-width: 2.4rem;
    height: 2.2rem;
    padding: 0 0.8rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
  }
  .bt-card-table td.bt-card-actions .btn { min-height: 2.2rem; border-radius: 8px; }
  .bt-card-table td.bt-card-actions form { display: inline-flex; margin: 0; }
  .bt-card-table td > form,
  .bt-card-table td > select { max-width: 100%; }
  .bt-card-table td:has(form, select, .bt-enroll-perms) { flex-direction: column; text-align: left; }
  .bt-card-table td:has(form, select, .bt-enroll-perms)::before { max-width: none; }
  .bt-card-table td select { width: 100%; min-height: 42px; font-size: 16px; border-radius: 10px; }
  .bt-card-table tr.bt-card-empty { display: block; text-align: center; }
  .bt-card-table tr.bt-card-empty td { display: block; border: 0; text-align: center; }

  .bt-table-pager {
    margin: 0;
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: rgba(248, 250, 252, 0.97);
    border-top: 1px solid #E2E8F0;
    justify-content: center;
  }
  .bt-pager-nav .btn { min-width: 2.3rem; min-height: 2.1rem; border-radius: 8px; }
  .bt-pager-nav .btn.active { background: #2563EB; border-color: #2563EB; color: #fff; }

  .bt-aichat-fab {
    right: 0.85rem;
    bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
    width: 2.9rem;
    height: 2.9rem;
  }

  .bt-modal { border-radius: 14px; }
  .bt-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .bt-modal select,
  .bt-modal textarea { font-size: 16px; }

  .panel,
  .bt-settings-panel { border-radius: 12px; }
}

/* —— Modern home dashboard (full-width duty board) —— */
.bt-page.bt-dashboard-page {
  max-width: none;
  width: 100%;
  padding: 1rem 1.25rem 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.bt-dash-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.bt-dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.bt-dash-stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--dash-shadow);
  text-decoration: none;
  color: inherit;
  min-height: 84px;
  text-align: left;
  font: inherit;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.12s ease;
}
button.bt-dash-stat.is-filter { cursor: pointer; }
a.bt-dash-stat:hover,
button.bt-dash-stat.is-filter:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}
button.bt-dash-stat.is-filter.active {
  border-color: #93C5FD;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.bt-dash-stat-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
}
.bt-dash-stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}
.bt-dash-stat-ok .bt-dash-stat-value { color: #059669; }
.bt-dash-stat-warn .bt-dash-stat-value { color: #DC2626; }
.bt-dash-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.bt-dash-card-link {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.bt-dash-board {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--dash-shadow);
  padding: 0.85rem 1rem 0.5rem;
  margin-bottom: 1rem;
}
.bt-dash-board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.bt-dash-board-hint {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}
.bt-dash-board-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.bt-dash-chip {
  border: 1px solid var(--border);
  background: #F8FAFC;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.bt-dash-chip:hover { border-color: #BFDBFE; color: var(--text); }
.bt-dash-chip.active {
  background: var(--bt-green);
  border-color: var(--bt-green);
  color: #fff;
}
.bt-dash-board-table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
}
.bt-dash-board-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.bt-dash-board-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bt-dash-board-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  font-size: 0.9rem;
}
.bt-dash-row.is-hidden { display: none; }
.bt-dash-row:hover td { background: #F8FAFC; }
.bt-dash-emp {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 12rem;
}
.bt-dash-emp-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}
.bt-dash-emp-text strong {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-dash-emp-text .muted { font-size: 0.75rem; }
.bt-dash-punch-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  background: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #475569;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.bt-dash-punch-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bt-dash-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bt-dash-pill.is-present { background: #D1FAE5; color: #047857; }
.bt-dash-pill.is-left { background: #E0E7FF; color: #3730A3; }
.bt-dash-pill.is-absent { background: #FEE2E2; color: #B91C1C; }
.bt-dash-pill.is-absent.is-leave { background: #DCFCE7; color: #15803D; }
.bt-dash-inout .muted { font-size: 0.8rem; }
.bt-dash-col-progress {
  min-width: 11rem;
  white-space: nowrap;
}
.bt-dash-progress {
  display: inline-block;
  vertical-align: middle;
  width: min(140px, 28vw);
  height: 8px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
  margin-right: 0.45rem;
}
.bt-dash-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #34D399, #059669);
  min-width: 0;
}
.bt-dash-progress-bar.is-left {
  background: linear-gradient(90deg, #93C5FD, #2563EB);
}
.bt-dash-progress-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
}
.bt-dash-empty,
.bt-dash-filter-empty {
  margin: 0.5rem 0;
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.bt-dash-punch-list-full {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.bt-dash-punch-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem 0.4rem;
  border-radius: 12px;
}
.bt-dash-punch-row:hover { background: #F8FAFC; }
.bt-dash-punch-meta,
.bt-dash-punch-time {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.bt-dash-punch-meta strong,
.bt-dash-punch-time strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-dash-punch-meta .muted,
.bt-dash-punch-time .muted { font-size: 0.75rem; }
.bt-dash-punch-time { text-align: right; }
.bt-dash-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.bt-dash-quick-link {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--dash-shadow);
}
.bt-dash-quick-link:hover {
  border-color: #BFDBFE;
  background: #EFF6FF;
  text-decoration: none;
}
.bt-nav-home {
  margin-bottom: 0.35rem;
}
@media (max-width: 900px) {
  .bt-dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-dash-board-table { min-width: 640px; }
}
@media (max-width: 720px) {
  .bt-dash-punch-row { grid-template-columns: 36px minmax(0, 1fr); }
  .bt-dash-punch-time { grid-column: 2; text-align: left; }
}
.bt-dept-checks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: contents;
}
.bt-dept-checks li {
  margin: 0;
}
.bt-dept-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
}
