/* @axiom/ui-shell — global application header */

:root,
html[data-theme='dark'] {
  color-scheme: dark;
  --ax-shell-bg: rgba(14, 22, 20, 0.92);
  --ax-shell-border: rgba(216, 228, 222, 0.14);
  --ax-shell-text: #e8f0eb;
  --ax-shell-muted: #c5d4cc;
  --ax-shell-accent: #c47a2c;
  --ax-shell-accent-soft: #e8b574;
  --ax-shell-panel: #16201c;
  --ax-shell-hover: rgba(216, 228, 222, 0.08);
  --ax-shell-avatar-bg: #2f6b4f;
  --ax-shell-danger: #a63d3d;
  --ax-shell-font: 'Outfit', system-ui, sans-serif;
  --ax-shell-display: 'DM Serif Display', Georgia, serif;
}

html[data-theme='light'] {
  color-scheme: light;
  /* Soft day — muted sage paper, not glare-white */
  --ax-shell-bg: rgba(188, 198, 192, 0.94);
  --ax-shell-border: rgba(22, 32, 28, 0.14);
  --ax-shell-text: #16201c;
  --ax-shell-muted: #3f4e47;
  --ax-shell-accent: #9a5c1f;
  --ax-shell-accent-soft: #b8732a;
  --ax-shell-panel: #c5cec8;
  --ax-shell-hover: rgba(22, 32, 28, 0.07);
  --ax-shell-avatar-bg: #2f6b4f;
  --ax-shell-danger: #8f3838;
}

.ax-shell-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ax-shell-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.25rem;
  flex-shrink: 0;
  min-height: 3.25rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--ax-shell-border);
  background: var(--ax-shell-bg);
  backdrop-filter: blur(10px);
  color: var(--ax-shell-text);
  font-family: var(--ax-shell-font);
  z-index: 40;
  position: relative;
}

.ax-shell-header-left,
.ax-shell-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ax-shell-header-center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.ax-shell-logo {
  font-family: var(--ax-shell-display);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ax-shell-text);
  text-decoration: none;
  line-height: 1;
}

.ax-shell-logo:hover,
.ax-shell-logo:focus-visible {
  color: var(--ax-shell-accent-soft);
  outline: none;
}

.ax-shell-search {
  position: relative;
  width: min(28rem, 100%);
}

.ax-shell-search--dual {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: min(32rem, 100%);
  background: var(--ax-shell-hover);
  border: 1px solid var(--ax-shell-border);
  border-radius: 4px;
}

.ax-shell-search--dual:focus-within {
  border-color: var(--ax-shell-accent-soft);
}

.ax-shell-search-mode {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.75rem;
  margin: 0;
  padding: 0 0.55rem;
  border: 0;
  border-right: 1px solid var(--ax-shell-border);
  border-radius: 3px 0 0 3px;
  background: transparent;
  color: var(--ax-shell-muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.ax-shell-search-mode:hover,
.ax-shell-search-mode:focus-visible {
  color: var(--ax-shell-text);
  background: var(--ax-shell-hover);
  outline: none;
}

.ax-shell-search[data-mode='solve'] .ax-shell-search-mode {
  color: var(--ax-shell-accent-soft);
}

.ax-shell-search[data-mode='search'] .ax-shell-search-mode {
  color: var(--ax-shell-muted);
}

.ax-shell-search-input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ax-shell-text);
  background: var(--ax-shell-hover);
  border: 1px solid var(--ax-shell-border);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
}

.ax-shell-search--dual .ax-shell-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.ax-shell-search-input:focus {
  outline: none;
  border-color: var(--ax-shell-accent-soft);
}

.ax-shell-search--dual .ax-shell-search-input:focus {
  border-color: transparent;
}

.ax-shell-search-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow: auto;
  background: var(--ax-shell-panel);
  border: 1px solid var(--ax-shell-border);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.ax-shell-search-hit,
.ax-shell-notification,
.ax-shell-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ax-shell-text);
  background: transparent;
  border: 0;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.ax-shell-search-hit:hover,
.ax-shell-search-hit:focus-visible,
.ax-shell-notification:hover,
.ax-shell-notification:focus-visible,
.ax-shell-menu-item:hover,
.ax-shell-menu-item:focus-visible {
  background: var(--ax-shell-hover);
  outline: none;
}

.ax-shell-menu-item--current {
  font-weight: 600;
}

.ax-shell-search-kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ax-shell-muted);
}

.ax-shell-search-empty,
.ax-shell-notifications-empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  color: var(--ax-shell-muted);
  font-size: 0.85rem;
}

.ax-shell-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ax-shell-muted);
  cursor: pointer;
}

.ax-shell-icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.ax-shell-icon-btn:hover,
.ax-shell-icon-btn:focus-visible {
  color: var(--ax-shell-text);
  border-color: var(--ax-shell-border);
  outline: none;
}

.ax-shell-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--ax-shell-accent);
  color: #0e1614;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.ax-shell-notifications,
.ax-shell-user {
  position: relative;
}

.ax-shell-notifications-panel,
.ax-shell-user-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: min(20rem, calc(100vw - 1.5rem));
  background: var(--ax-shell-panel);
  border: 1px solid var(--ax-shell-border);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  z-index: 60;
  overflow: hidden;
}

.ax-shell-notification--unread {
  font-weight: 600;
}

.ax-shell-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 12rem;
  padding: 0.2rem 0.35rem 0.2rem 0.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ax-shell-text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.ax-shell-user-trigger:hover,
.ax-shell-user-trigger:focus-visible {
  border-color: var(--ax-shell-border);
  background: var(--ax-shell-hover);
  outline: none;
}

.ax-shell-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ax-shell-user-chevron {
  color: var(--ax-shell-muted);
  font-size: 0.75rem;
  margin-right: 0.15rem;
}

.ax-shell-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.ax-shell-avatar--initials {
  background: var(--ax-shell-avatar-bg);
  color: #e8f0eb;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ax-shell-avatar--lg {
  width: 2.35rem;
  height: 2.35rem;
  font-size: 0.8rem;
}

.ax-shell-menu-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--ax-shell-border);
}

.ax-shell-menu-fullname {
  font-weight: 600;
  font-size: 0.92rem;
}

.ax-shell-menu-role {
  font-size: 0.78rem;
  color: var(--ax-shell-muted);
  margin-top: 0.1rem;
}

.ax-shell-menu-section {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--ax-shell-border);
}

.ax-shell-menu-section--session {
  border-bottom: 0;
}

.ax-shell-menu-section--session .ax-shell-menu-item {
  color: var(--ax-shell-danger);
}

.ax-shell-menu-item:disabled,
.ax-shell-menu-item[aria-disabled='true'] {
  opacity: 0.45;
  cursor: default;
}

.ax-shell-menu-item:disabled:hover,
.ax-shell-menu-item[aria-disabled='true']:hover {
  background: transparent;
}

@media (max-width: 720px) {
  .ax-shell-header {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .ax-shell-header-center {
    grid-column: 1 / -1;
    order: 3;
  }

  .ax-shell-user-name {
    display: none;
  }
}
