/* Full-site audit fixes (2026-11-27): header layout, notification popover, select chevrons, text overflow, and card alignment. */

/* 1. Prevent 1280px desktop header overlap and sticky occlusion */
html {
  scroll-padding-top: 136px;
}
.app-header {
  z-index: 40;
}
@media (max-width: 1380px) {
  .app-header > .app-header-inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand account"
      "nav nav";
    gap: 10px 20px;
    padding: 12px 24px;
    min-height: auto;
  }
  #tabs {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #tabs::-webkit-scrollbar {
    display: none;
  }
}

/* 2. Prevent notification popover right-edge clipping of the 域名 tab */
.notification-panel:not([hidden]) {
  width: min(440px, calc(100vw - 24px));
}
.notification-tabs {
  flex-wrap: wrap;
  row-gap: 4px;
}

/* 3. Single clean chevron on all native selects + prevent long email/domain text collision */
:root select:not([multiple]) {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  padding-right: 36px !important;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%236E6A62' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px 8px !important;
}
:root[data-theme=dark] select:not([multiple]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23B3B3BA' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
:root select:not([multiple])::picker-icon {
  display: none !important;
}
:root .pager select:not([multiple]),
:root .trash-page-size select:not([multiple]) {
  padding-right: 30px !important;
  background-position: right 10px center !important;
}

/* 4. Align domain summary card numbers evenly across all 4 cards */
:root .domain-summary-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 5. Initial boot loading placeholder before /api/config resolves */
#boot-loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}
#boot-loading[hidden] {
  display: none;
}

/* 6. Mailbox status quick filter chips */
.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.status-chips button {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.status-chips button.active {
  background: var(--blue-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* 7. Sticky verification code bar + cleaner desktop inbox split */
@media (min-width: 960px) {
  .inbox-grid {
    grid-template-columns: 380px minmax(0, 1fr);
  }
}
.reader-code-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.reader-code-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* 8. 15-day trash archive date tabs */
.trash-archive-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.trash-archive-dates button {
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  font-size: 13px;
}
.trash-archive-dates button span {
  margin-left: 4px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.trash-archive-dates button.active {
  background: var(--blue-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.trash-archive-dates button.active span {
  color: var(--accent);
}

/* 9. Admin health alert dot on nav tab */
.nav-alert-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: #e5484d;
  vertical-align: middle;
}
.nav-alert-dot[hidden] {
  display: none;
}

/* 10. Visual hierarchy between special tax region and regular region group */
#address-region-quick.is-inactive-group,
#address-special-quick.is-inactive-group {
  opacity: 0.58;
  transition: opacity 0.15s ease;
}
#address-region-quick.is-inactive-group:hover,
#address-special-quick.is-inactive-group:hover {
  opacity: 1;
}

/* 11. Lock background scroll & interaction when any modal dialog is open */
html:has(dialog[open]),
body:has(dialog[open]) {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
:root dialog[open] {
  max-height: min(86vh, calc(100dvh - 32px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-top: 0 !important;
}
:root dialog[open] > .dialog-top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  padding: 20px 0 14px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
:root dialog::backdrop {
  background: rgba(0, 0, 0, 0.58) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overscroll-behavior: none;
}
