/* Native viewer header and compact profile/status pop-up. */

.status-strip {
  gap: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand { gap: 12px; }
.brand-mark { width: 34px; height: 34px; }
.brand-subtitle { display: block; }
.status-panel { position: relative; gap: 0; }
.header-menu { position: relative; flex: 0 0 auto; }
.header-menu > summary { list-style: none; }
.header-menu > summary::-webkit-details-marker { display: none; }

.header-menu-button {
  position: relative;
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  user-select: none;
}

.header-menu-button.live-poll-enabled::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--live) 20%, transparent);
}

.header-menu-button.tone-warn {
  border-color: color-mix(in srgb, var(--warn) 32%, var(--border));
  background: var(--warn-soft);
  color: var(--warn);
}

.header-menu-button.tone-bad {
  border-color: color-mix(in srgb, var(--bad) 32%, var(--border));
  background: var(--bad-soft);
  color: var(--bad);
}

.header-menu-button:hover,
.header-menu[open] > .header-menu-button { border-color: var(--border-strong); }

.header-menu-button:not(.tone-warn):not(.tone-bad):hover,
.header-menu[open] > .header-menu-button:not(.tone-warn):not(.tone-bad) {
  background: var(--surface-2);
  color: var(--ink);
}

.header-menu-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

.header-menu-role-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
}

.header-menu-role-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-menu-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: min(310px, calc(100vw - 28px));
  gap: 0;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px color-mix(in srgb, #000 16%, transparent);
}

.header-menu-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px 8px;
  border-bottom: 1px solid var(--border);
}

.header-menu-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-menu-role {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--quiet-soft);
  color: var(--quiet);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.045em;
}

.header-menu-diagnostics {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
}

.header-menu-diagnostics .status-widget {
  display: grid;
  gap: 5px;
  text-align: left;
}

.header-menu-diagnostics .status-indicator { justify-content: flex-start; }
.header-menu-diagnostics .status-times {
  display: flex;
  max-width: none;
  justify-content: flex-start;
  gap: 3px 9px;
}
.header-menu-diagnostics .status-times .status-line + .status-line { display: inline; }
.header-menu-diagnostics .status-line { white-space: normal; }

.header-menu-refresh-row,
.header-menu-option {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  color: var(--ink);
  text-align: left;
}

.header-menu-refresh-row { border-bottom: 1px solid var(--border); }
.header-menu-option {
  border: 0;
  border-radius: 6px;
  background: transparent;
}
.header-menu-option:hover { background: var(--surface-2); }

.header-menu-option-copy { display: grid; min-width: 0; gap: 2px; }
.header-menu-option-title { font-size: 12px; font-weight: 680; }
.header-menu-option-note { color: var(--muted); font-size: 10px; font-weight: 500; }
.header-menu-refresh-action { display: inline-flex; flex: 0 0 auto; }
.header-menu-refresh-action .refresh-button {
  display: inline-grid;
  width: 31px;
  min-width: 31px;
  height: 31px;
  min-height: 31px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
}

.admin-live-switch {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 28px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
}
.admin-live-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 140ms ease, background-color 140ms ease;
}
.admin-live-toggle[aria-pressed="true"] .admin-live-switch {
  border-color: color-mix(in srgb, var(--live) 55%, var(--border));
  background: var(--live-soft);
}
.admin-live-toggle[aria-pressed="true"] .admin-live-switch::after {
  transform: translateX(12px);
  background: var(--live);
}

.header-menu-dashboard-separator,
.header-menu-auth-separator { border-top: 1px solid var(--border); }
.header-menu-dashboard-actions:empty,
.header-menu-dashboard-actions[hidden] { display: none; }
.header-menu-dashboard-actions { display: grid; gap: 2px; padding: 4px 0; }
.header-menu-dashboard-action {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}
.header-menu-dashboard-action:hover { background: var(--surface-2); }
.header-menu-dashboard-action[aria-pressed="true"],
.header-menu-dashboard-action[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.header-menu-auth { display: block; width: 100%; padding-top: 4px; }
.header-menu-auth .session-action {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.header-menu-auth .session-action:hover { background: var(--surface-2); text-decoration: none; }
.header-menu-auth .session-role::before { display: none; }
.header-menu-auth .session-sign-in { color: var(--accent); }

@media (max-width: 760px) {
  .status-strip { gap: 10px; }
  .brand, .brand > span { min-width: 0; }
  .brand-title, .brand-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand-subtitle { display: block; max-width: min(56vw, 330px); }
  .header-menu-panel { width: min(300px, calc(100vw - 20px)); }
}

@media (max-width: 520px) {
  .status-strip { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-title { font-size: 14px; }
  .brand-subtitle { max-width: 62vw; font-size: 10px; }
  .header-menu-panel {
    position: fixed;
    top: 54px;
    right: 10px;
    width: min(300px, calc(100vw - 20px));
  }
}
