/**
 * Critical layout + visibility — loads from /static/ so the app stays usable
 * when cdn.tailwindcss.com is blocked, slow, or fails.
 */
.hidden {
  display: none !important;
}

/* Face gate + employee face overlay */
#faceGateOverlay,
#empFaceOverlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.97);
}
#faceGateOverlay.hidden,
#empFaceOverlay.hidden {
  display: none !important;
}

/* When employee must register face, hide dashboard chrome behind overlay */
.premium-ui.face-gate-active #dashSidebar,
.premium-ui.face-gate-active .dash-top-header,
.premium-ui.face-gate-active .dash-main-scroll {
  visibility: hidden;
  pointer-events: none;
}

/* Company dashboard shell */
.premium-ui.flex.h-screen,
.premium-ui.ui-reimagined.flex.h-screen {
  display: flex;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
  color: #0f172a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

.premium-ui #dashSidebar {
  width: 16rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  min-height: 0;
}

.premium-ui #dashSidebar + div,
.premium-ui > div.flex-1,
.premium-ui > .flex-1 {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#globalPreloader.hidden {
  display: none !important;
}

#globalPreloader:not(.hidden) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(15, 23, 42, 0.3);
}

#attendhr-three-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.premium-ui .dash-top-header,
.premium-ui header.dash-top-header {
  flex-shrink: 0;
  min-height: 4rem;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1rem;
}

.premium-ui .dash-main-scroll,
.premium-ui main.flex-1 {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.premium-ui #mobileNavOverlay.hidden {
  display: none !important;
}

.premium-ui #mobileNavOverlay:not(.hidden) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(15, 23, 42, 0.4);
}

.premium-ui .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.premium-ui .nav-item:hover {
  background: #f8fafc;
}

.premium-ui .nav-item.bg-emerald-50 {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.premium-ui .nav-group-label {
  display: block;
  padding: 0.5rem 0.75rem 0.15rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.premium-ui section[id^="section-"] {
  width: 100%;
  max-width: 100%;
}

.premium-ui section[id^="section-"].hidden {
  display: none !important;
}

/* HR attendance tabs fallback */
#att_hr_tab_bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
}

#att_hr_tab_bar.hidden {
  display: none !important;
}

.att-hr-tab {
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #475569;
}

.att-hr-tab.is-active {
  background: #fff;
  color: #5b21b6;
  border-color: #c4b5fd;
  box-shadow: 0 1px 3px rgba(91, 33, 182, 0.12);
}

.att-hr-pane.hidden {
  display: none !important;
}

/* Generic flex helpers used everywhere */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.overflow-x-auto { overflow-x: auto; }

/* Buttons — avoid raw browser default when Tailwind missing */
.premium-ui button,
.premium-ui .la-primary-action,
.premium-ui .la-secondary-action {
  font-family: inherit;
  cursor: pointer;
}

.premium-ui .la-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background: #7c3aed;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border: none;
}

.premium-ui .la-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background: #fff;
  color: #334155;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid #e2e8f0;
}

@media (min-width: 1024px) {
  .premium-ui #dashSidebar {
    position: static;
    transform: none;
  }
}

@media (max-width: 1023px) {
  .premium-ui #dashSidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 500;
    transform: translateX(-100%);
  }
  .premium-ui #dashSidebar.translate-x-0,
  .premium-ui #dashSidebar:not(.-translate-x-full) {
    transform: translateX(0);
  }
}

/* Daily attendance rows — compact grid (works without Tailwind) */
.premium-ui table.att-rows-table {
  font-size: 11px;
  border-collapse: collapse;
  width: 100%;
}
.premium-ui table.att-rows-table td,
.premium-ui table.att-rows-table th {
  padding: 2px 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.premium-ui table.att-rows-table tbody tr {
  height: 26px;
  border-bottom: 1px solid #f1f5f9;
}
.premium-ui .att-st-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}
.premium-ui .att-issue-chip {
  display: inline-block;
  margin-right: 2px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
}
.premium-ui .att-rows-table-wrap.att-hide-photo-cols .att-col-photo {
  display: none;
}

/* Overview dashboard — layout must not break on auto-refresh / missing Tailwind */
#section-overview .dash-overview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 1024px) {
  #section-overview .dash-overview-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
#section-overview .dash-overview-dual-grid,
#section-overview .dash-ops-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 768px) {
  #section-overview .dash-overview-dual-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  #section-overview .dash-ops-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
#section-overview .dash-overview-kpi-grid > div,
#section-overview .dash-overview-dual-grid > div {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
#section-overview .dash-overview-kpi-grid p[id^="stat-"] {
  margin-top: 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
#section-overview .dash-overview-kpi-grid > div,
#section-overview .dash-overview-dual-grid > div,
#section-overview .dash-overview-kpi-grid .ui-card-collapsed,
#section-overview .dash-overview-dual-grid .ui-card-collapsed {
  max-height: none !important;
  overflow: visible !important;
  height: auto !important;
}

/* Auth pages (login / register-face) — styled before Tailwind CDN loads */
.auth-page {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #020617;
  color: #f1f5f9;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.auth-page a {
  color: #34d399;
  text-decoration: none;
}
.auth-page a:hover {
  color: #6ee7b7;
  text-decoration: underline;
}
.auth-page header {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.85);
  background: rgba(2, 6, 23, 0.92);
}
.auth-page header > div {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.auth-page header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.auth-page header nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  text-decoration: none;
}
.auth-page header nav a:hover {
  color: #fff;
  background: #1e293b;
  text-decoration: none;
}
.auth-page header nav a.auth-nav-cta {
  border: 1px solid #475569;
  color: #e2e8f0;
  font-weight: 600;
}
.auth-page .auth-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.auth-page .auth-brand:hover {
  text-decoration: none;
  color: #fff;
}
.auth-page .auth-brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: #10b981;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-page main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  position: relative;
}
.auth-page .auth-card {
  width: 100%;
  max-width: 28rem;
  border-radius: 1rem;
  border: 1px solid rgba(30, 41, 59, 0.9);
  background: rgba(15, 23, 42, 0.82);
  padding: 1.5rem 1.75rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
}
.auth-page .auth-card h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
}
.auth-page .auth-card .auth-sub {
  margin: 0.5rem 0 0;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}
.auth-page .auth-card form {
  margin-top: 1.5rem;
}
.auth-page .auth-card label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
}
.auth-page .auth-field {
  margin-bottom: 1.1rem;
}
.auth-page .auth-card input[type="text"],
.auth-page .auth-card input[type="password"],
.auth-page .auth-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.85rem 0.7rem 2.35rem;
  border-radius: 0.75rem;
  border: 1px solid #334155;
  background: rgba(2, 6, 23, 0.75);
  color: #f1f5f9;
  font-size: 0.875rem;
  outline: none;
}
.auth-page .auth-card input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}
.auth-page .auth-input-wrap {
  position: relative;
}
.auth-page .auth-input-wrap .auth-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  font-size: 0.875rem;
}
.auth-page .auth-card button[type="submit"],
.auth-page .auth-btn-primary {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 0.75rem;
  background: #059669;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}
.auth-page .auth-card button[type="submit"]:hover:not(:disabled) {
  background: #10b981;
}
.auth-page .auth-card button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: wait;
}
.auth-page #error-message:not(.hidden) {
  display: block;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(127, 29, 29, 0.6);
  background: rgba(69, 10, 10, 0.45);
  color: #fecaca;
  font-size: 0.8125rem;
}
.auth-page #error-message.hidden {
  display: none !important;
}
.auth-page footer {
  flex-shrink: 0;
  border-top: 1px solid #1e293b;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}
.auth-page .auth-toggle-pw {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
}
.auth-page .text-center {
  text-align: center;
}
.auth-page .auth-footnote {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.8125rem;
  color: #64748b;
}
