/* =====================================================
   App header — responsive layout (admin + employee)
   ===================================================== */

.app-header {
  height: auto !important;
  min-height: 56px;
}

.app-header .app-header-inner {
  width: 100%;
}

.app-header-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: space-between;
  min-height: 52px;
  width: 100%;
}

.app-header-start {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}

.app-header-center {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.app-header .app-utilities {
  flex: 0 0 auto;
  flex-shrink: 0;
  gap: 2px;
  margin-bottom: 0 !important;
}

#sidepanel-toggler {
  flex-shrink: 0;
}

/* Employee header: undo portal mobile search overlay on greeting block */
.app-header .app-header-center.app-search-box,
.app-header .app-search-box.app-header-center {
  background: transparent !important;
  display: flex !important;
  height: auto !important;
  left: auto !important;
  padding: 0 !important;
  position: static !important;
  top: auto !important;
}

.app-header-emp-meta {
  line-height: 1.2;
  margin: 0;
  min-width: 0;
  overflow: hidden;
}

.app-header-emp-meta.user-info {
  font-size: 0.8125rem;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-emp-meta.userInformationHeaderValue {
  font-size: 0.6875rem;
  margin-top: 0 !important;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dash-header-greet {
  align-items: center;
  flex-wrap: nowrap;
  margin-left: 0 !important;
}

/* ── Irregular attendance chip (header) ─────────────────────────── */
.app-header .dash-irregular-badge {
  align-items: center;
  background: rgba(217, 119, 6, 0.08);
  border: 1.5px solid rgba(217, 119, 6, 0.28);
  border-radius: 999px;
  color: #b45309;
  display: none;
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 6px;
  letter-spacing: 0;
  line-height: 1.35;
  margin-right: 4px;
  max-width: min(220px, 42vw);
  overflow: hidden;
  padding: 4px 10px 4px 8px;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.app-header .dash-irregular-badge.is-visible {
  display: inline-flex !important;
}

.app-header .dash-irregular-dot {
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
  height: 7px;
  opacity: 0.85;
  width: 7px;
}

.app-header .dash-irregular-label--short {
  display: none;
}

html.hrms-dark .app-header .dash-irregular-badge {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.32);
  color: #fbbf24;
}

/* Full-width header below sidebar breakpoint */
@media (max-width: 1199.98px) {
  .app-header-inner {
    margin-left: 0 !important;
  }
}

/* Tablet */
@media (max-width: 991.98px) {
  .dhg-greet {
    font-size: 1.0625rem;
  }

  .dhg-quote {
    font-size: 0.875rem;
  }
}

/* Mobile */
@media (max-width: 767.98px) {
  .app-header-toolbar {
    gap: 6px;
    min-height: 48px;
  }

  .app-header > .app-header-inner > .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .dhg-greet {
    font-size: 0.9375rem;
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-header .dash-irregular-badge {
    font-size: 0.6875rem;
    max-width: 96px;
    padding: 3px 8px 3px 6px;
  }

  .app-header .dash-irregular-label--long {
    display: none;
  }

  .app-header .dash-irregular-label--short {
    display: inline;
  }

  .app-utilities .hrms-theme-toggle svg,
  .app-utilities .hrms-notification-toggle .svgNotification {
    height: 20px !important;
    width: 20px !important;
  }

  .hrms-notification-toggle {
    height: 32px !important;
    width: 36px !important;
  }

  .app-user-dropdown img,
  .app-user-dropdown .round-border {
    height: 32px !important;
    width: 32px !important;
  }

  .app-notifications-dropdown .hrms-notification-menu {
    left: auto !important;
    max-width: calc(100vw - 16px) !important;
    right: 8px !important;
    width: min(360px, calc(100vw - 16px)) !important;
  }
}

/* Small phones — hide quote */
@media (max-width: 575.98px) {
  .dhg-sep,
  .dhg-quote {
    display: none !important;
  }

  .dhg-greet {
    max-width: 52vw;
  }

  .app-header-emp-meta {
    display: none !important;
  }

  .search-mobile-trigger {
    display: none !important;
  }
}

/* =====================================================
   Mobile sidebar overlay — content must not shift
   ===================================================== */
@media (max-width: 1199.98px) {
  /* Sidebar is inside .app-header (flex) but paints as fixed overlay */
  .app-header > .app-header-inner {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .app-header > #app-sidepanel {
    flex: 0 0 0 !important;
    height: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.sidebar-mobile-open .app-wrapper,
  body.sidebar-expanded .app-wrapper,
  body.sidebar-collapsed .app-wrapper,
  body.sidebar-mobile-open .app-header-inner,
  body.sidebar-expanded .app-header-inner,
  body.sidebar-collapsed .app-header-inner,
  body.sidebar-mobile-open .layout-page,
  body.sidebar-expanded .layout-page,
  body.sidebar-collapsed .layout-page {
    margin-left: 0 !important;
    padding-left: 0 !important;
    transform: none !important;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
    touch-action: none;
  }

  body.sidebar-mobile-open .app {
    overflow: hidden;
  }

  #app-sidepanel.hrms-sidebar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    height: 100vh !important;
    overflow: visible !important;
    top: 0;
    width: min(88vw, 300px);
    z-index: 1040;
  }

  /* Full-screen dim; must not be clipped by panel overflow */
  #app-sidepanel.hrms-sidebar.sidepanel-visible .sidepanel-drop {
    background: rgba(0, 0, 0, 0.45) !important;
    display: block !important;
    height: 100vh !important;
    inset: 0 !important;
    left: 0 !important;
    min-height: 100vh !important;
    min-width: 100vw !important;
    position: fixed !important;
    top: 0 !important;
    width: 100vw !important;
    z-index: 1 !important;
  }

  /* Menu fills shell — no dark gap between menu and backdrop */
  #app-sidepanel.hrms-sidebar .sidepanel-inner {
    box-shadow: var(--bd-sidebar-shadow, 2px 0 12px rgba(0, 0, 0, 0.18)) !important;
    height: 100vh !important;
    max-width: 100%;
    position: relative !important;
    width: 100% !important;
    z-index: 2 !important;
  }
}

@media (max-width: 767.98px) {
  #app-sidepanel.hrms-sidebar {
    width: min(88vw, 280px);
  }
}

/* =====================================================
   Employee/admin header final clamp
   Keeps irregular chip from pushing utilities off-screen.
   This file loads after style.css, so these rules intentionally win.
   ===================================================== */
.app-header .app-header-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 8px !important;
  overflow: visible !important;
  width: 100% !important;
}

.app-header .app-header-start,
.app-header .app-header-center,
.app-header .app-search-box.app-header-center {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.app-header #dash-header-greet {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.app-header .dhg-greet,
.app-header .dhg-quote {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-header .dhg-greet {
  flex: 0 1 auto !important;
  max-width: min(180px, 24vw) !important;
}

.app-header .dhg-quote {
  flex: 1 1 auto !important;
  max-width: min(520px, 38vw) !important;
}

.app-header .dash-irregular-badge {
  flex: 0 0 auto !important;
  max-width: min(190px, 18vw) !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-header .dash-irregular-label {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-header .app-utilities {
  align-items: center !important;
  display: inline-flex !important;
  flex: 0 0 auto !important;
  gap: 4px !important;
  justify-content: flex-end !important;
  min-width: 178px !important;
  overflow: visible !important;
  position: relative !important;
  z-index: 4 !important;
}

.app-header .app-utilities .app-utility-item {
  align-items: center !important;
  display: inline-flex !important;
  flex: 0 0 36px !important;
  height: 36px !important;
  justify-content: center !important;
  margin: 0 !important;
  min-width: 36px !important;
  overflow: visible !important;
  visibility: visible !important;
}

.app-header .app-utilities .app-utility-item>a,
.app-header .app-utilities .app-utility-item>button,
.app-header .hrms-theme-toggle,
.app-header .hrms-header-icon-btn,
.app-header .hrms-notification-toggle {
  align-items: center !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  color: var(--dash-header-text, var(--hrms-text, #5d6778)) !important;
  display: inline-flex !important;
  height: 34px !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0 !important;
  opacity: 1 !important;
  padding: 5px 7px !important;
  position: relative !important;
  text-decoration: none !important;
  visibility: visible !important;
  width: 36px !important;
}

.app-header .app-utilities svg,
.app-header .hrms-theme-toggle svg,
.app-header .hrms-header-icon-btn svg,
.app-header .hrms-notification-toggle .svgNotification {
  color: currentColor !important;
  display: block !important;
  fill: currentColor !important;
  height: 20px !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 20px !important;
}

.app-header .hrms-theme-toggle .theme-light-icon {
  display: none !important;
}

.app-header .hrms-theme-toggle .theme-dark-icon {
  display: block !important;
}

html.hrms-dark .app-header .hrms-theme-toggle .theme-dark-icon,
body.hrms-dark .app-header .hrms-theme-toggle .theme-dark-icon,
.dark .app-header .hrms-theme-toggle .theme-dark-icon {
  display: none !important;
}

html.hrms-dark .app-header .hrms-theme-toggle .theme-light-icon,
body.hrms-dark .app-header .hrms-theme-toggle .theme-light-icon,
.dark .app-header .hrms-theme-toggle .theme-light-icon {
  display: block !important;
}

@media (max-width: 991.98px) {
  .app-header .dhg-quote {
    max-width: 28vw !important;
  }

  .app-header .dash-irregular-badge {
    max-width: 112px !important;
  }
}

@media (max-width: 767.98px) {
  .app-header .app-header-toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    column-gap: 6px !important;
  }

  .app-header .dhg-quote,
  .app-header .dhg-sep {
    display: none !important;
  }

  .app-header .dhg-greet {
    max-width: min(110px, 28vw) !important;
  }

  .app-header .dash-irregular-badge {
    max-width: 78px !important;
  }

  .app-header .app-utilities {
    gap: 2px !important;
    min-width: 150px !important;
  }

  .app-header .app-utilities .app-utility-item {
    flex-basis: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .app-header .app-utilities .app-utility-item>a,
  .app-header .app-utilities .app-utility-item>button,
  .app-header .hrms-theme-toggle,
  .app-header .hrms-header-icon-btn,
  .app-header .hrms-notification-toggle {
    height: 32px !important;
    width: 32px !important;
  }
}
