.main-header.navbar {
  position: relative;
}

/* Keep a deliberate gap between the attendance clock and Quick Create on every viewport. */
.main-header .hr-clock-nav {
  margin-right: .45rem;
}

.ithd-global-search {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, 42vw);
  min-width: 320px;
  transform: translate(-50%, -50%);
  z-index: 1035;
}

.ithd-global-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.ithd-global-search-input {
  width: 100%;
  height: 36px;
  padding: 0 86px 0 38px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: #fff;
  color: #182230;
  font-size: .9rem;
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
  transition: box-shadow .15s ease, border-color .15s ease, width .16s ease;
}

.ithd-global-search-input:focus {
  border-color: rgba(77,163,255,.9);
  box-shadow: 0 0 0 3px rgba(77,163,255,.18), 0 4px 14px rgba(0,0,0,.18);
}

.ithd-global-search-input::placeholder { color: #7d8794; }

.ithd-global-search-icon {
  position: absolute;
  left: 14px;
  z-index: 2;
  color: #5f6b78;
  font-size: .85rem;
  pointer-events: none;
}

.ithd-global-search-kbd {
  position: absolute;
  right: 12px;
  padding: 2px 6px;
  border: 1px solid #d5dbe3;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f7f9fb;
  color: #7b8590;
  font-size: .65rem;
  font-family: inherit;
  line-height: 1.2;
  pointer-events: none;
}

.ithd-global-search-clear {
  display: none;
  position: absolute;
  right: 54px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7b8590;
  font-size: .75rem;
}

.ithd-global-search-clear.is-visible { display: inline-flex; align-items: center; justify-content: center; }
.ithd-global-search-clear:hover { background: #eef1f5; color: #313b46; }

.ithd-global-search-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(68vh, 620px);
  overflow-y: auto;
  z-index: 2055;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: #101a2a;
  box-shadow: 0 18px 50px rgba(0,0,0,.34);
}

.ithd-global-search-panel.is-open { display: block; }

.ithd-global-search-group {
  padding: 9px 10px 5px;
  color: #8fa6c9;
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ithd-global-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #dfe9f7 !important;
  text-decoration: none !important;
}

.ithd-global-search-result:hover,
.ithd-global-search-result.is-active {
  background: rgba(255,255,255,.075);
  color: #fff !important;
}

.ithd-global-search-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(107,165,255,.12);
  color: #9fc4ff;
}

.ithd-global-search-result-body {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
}

.ithd-global-search-result-title {
  overflow: hidden;
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ithd-global-search-result-subtitle,
.ithd-global-search-result-meta {
  overflow: hidden;
  color: #aebdd2;
  font-size: .74rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ithd-global-search-result-meta { color: #7f96b4; }
.ithd-global-search-result-arrow { flex: 0 0 auto; color: #607a9f; font-size: .68rem; }

.ithd-global-search-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 14px;
  color: #dce7f6;
}

.ithd-global-search-message > i { width: 26px; text-align: center; color: #8fb6ed; }
.ithd-global-search-message strong { display: block; font-size: .84rem; }
.ithd-global-search-message small { display: block; margin-top: 2px; color: #8da0bb; font-size: .73rem; }

@media (max-width: 1199.98px) {
  .ithd-global-search {
    position: relative;
    left: auto;
    top: auto;
    flex: 1 1 420px;
    width: auto;
    max-width: 520px;
    min-width: 220px;
    margin: 0 .55rem;
    transform: none;
    align-self: center;
  }
  .ithd-global-search-kbd { display: none; }
  .ithd-global-search-input { padding-right: 42px; }
  .ithd-global-search-clear { right: 10px; }
}

@media (max-width: 767.98px) {
  .main-header.navbar {
    flex-wrap: nowrap;
    padding-left: .35rem;
    padding-right: .35rem;
  }

  .main-header .navbar-nav {
    flex-wrap: nowrap;
    align-items: center;
  }

  /* Docs and Feature Request are useful on desktop, but waste premium phone space. */
  .main-header .ithd-phone-hide {
    display: none !important;
  }

  .main-header .hr-clock-nav {
    margin-right: .4rem;
  }

  /* Collapsed phone state: search is one circular icon. */
  .ithd-global-search {
    position: relative;
    left: auto;
    top: auto;
    flex: 0 0 38px;
    width: 38px !important;
    max-width: 38px;
    min-width: 38px;
    margin: 0 .3rem;
    transform: none;
    align-self: center;
    z-index: 1060;
  }

  .ithd-global-search-box {
    width: 38px;
    height: 38px;
  }

  .ithd-global-search-input {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    color: transparent;
    caret-color: transparent;
    cursor: pointer;
    font-size: .82rem;
  }

  .ithd-global-search-input::placeholder { color: transparent; }

  .ithd-global-search-icon {
    left: 0;
    width: 38px;
    text-align: center;
  }

  .ithd-global-search-kbd,
  .ithd-global-search-clear {
    display: none !important;
  }

  /* Tapping the icon temporarily turns the header into a full search field. */
  .ithd-global-search.is-mobile-expanded {
    position: absolute;
    left: 52px !important;
    right: 8px;
    top: 50%;
    width: auto !important;
    max-width: none;
    min-width: 0;
    margin: 0;
    transform: translateY(-50%);
    z-index: 1065;
  }

  .ithd-global-search.is-mobile-expanded .ithd-global-search-box {
    width: 100%;
    height: auto;
  }

  .ithd-global-search.is-mobile-expanded .ithd-global-search-input {
    width: 100%;
    height: 38px;
    padding: 0 38px;
    border-radius: 999px;
    color: #182230;
    caret-color: auto;
    cursor: text;
  }

  .ithd-global-search.is-mobile-expanded .ithd-global-search-input::placeholder {
    color: #7d8794;
  }

  .ithd-global-search.is-mobile-expanded .ithd-global-search-icon {
    left: 14px;
    width: auto;
    text-align: left;
  }

  .ithd-global-search.is-mobile-expanded .ithd-global-search-clear.is-visible {
    display: inline-flex !important;
    right: 10px;
  }

  /* While search is open, hide the normal right-hand buttons behind it. */
  .main-header.ithd-mobile-search-open > .navbar-nav.ml-auto,
  .main-header.ithd-mobile-search-open > .navbar-nav.ms-auto {
    visibility: hidden;
  }

  .ithd-global-search-panel {
    position: fixed;
    top: 58px;
    left: 8px;
    right: 8px;
    max-height: calc(100vh - 74px);
  }
}
