/* Account menu, preferences, and notification history. */

/* ---------- Account menu ---------- */

.session-menu {
  position: relative;
}

.session-menu summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-height-md);
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  list-style: none;
  cursor: pointer;
  color: var(--color-chrome-text);
}

.session-menu summary::-webkit-details-marker {
  display: none;
}

.session-menu summary:hover {
  background: var(--color-chrome-surface);
  color: var(--color-text-inverse);
}

.session-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--color-action-active);
  color: var(--color-on-action);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.session-name {
  font-size: var(--text-label);
  font-weight: 600;
}

.session-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.375rem);
  z-index: var(--z-dropdown);
  min-width: 14rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-1);
}

.session-dropdown-header {
  padding: var(--space-3);
  overflow-wrap: anywhere;
}

.session-dropdown-name {
  font-size: var(--text-label);
  font-weight: 600;
}

.session-dropdown-role {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.session-dropdown-divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--color-border);
}

.session-dropdown form {
  margin: 0;
}

.session-dropdown a,
.session-dropdown > button,
.session-dropdown form button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--control-height-md);
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-label);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.session-dropdown a:hover,
.session-dropdown > button:hover,
.session-dropdown form button:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}

.session-dropdown .danger {
  color: var(--color-danger-text);
}

.session-dropdown .danger:hover {
  background: var(--color-danger-bg);
}

.account-dropdown {
  width: min(23rem, calc(100vw - 2 * var(--space-3)));
  max-height: calc(100dvh - var(--topbar-height) - var(--space-6));
  overflow-y: auto;
}

/* Two-option preferences share an aligned label and inset control. */
.pref-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
}

.pref-help {
  grid-column: 1 / -1;
  margin: 0 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pref-row-label {
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.pref-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 3px;
  border-radius: var(--radius-lg);
  background: var(--color-canvas);
  border: var(--border-width) solid var(--color-border-strong);
  box-shadow: var(--shadow-inset);
}

.pref-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: calc(var(--control-height-md) - 2px);
  padding: 0 var(--space-2);
  border: var(--border-width) solid transparent;
  border-radius: calc(var(--radius-lg) - 2px);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-label);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.pref-option:hover:not(.is-active) {
  color: var(--color-text-secondary);
  background: var(--color-surface-subtle);
}

.pref-option.is-active {
  background: var(--color-action-subtle);
  color: var(--color-action-text);
  border-color: var(--color-action);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.pref-option.is-active:hover {
  background: var(--color-action-subtle-hover);
  color: var(--color-action-hover);
  border-color: var(--color-action-hover);
}

.pref-option .icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
  opacity: 0.75;
}

.pref-option.is-active .icon {
  opacity: 1;
}

@media (max-width: 40rem) {
  .pref-row {
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: var(--space-2);
  }

  .account-dropdown {
    position: fixed;
    top: calc(var(--topbar-height) + var(--space-2));
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 360px) {
  .pref-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
}

@media (pointer: coarse) {
  .pref-option { min-height: var(--touch-target-min); }
}

/* ---------- Notification history ---------- */

.notice-menu summary {
  gap: 0;
  padding: 0;
  width: var(--control-height-md);
  justify-content: center;
  position: relative;
}

/* The dot only has to say "something failed"; the panel says what. */
.notice-dot {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-danger-text);
}

.notice-dropdown {
  width: 22rem;
}

.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 20rem;
  overflow-y: auto;
}

.notice-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid transparent;
  font-size: var(--text-label);
  color: var(--color-text-secondary);
}

.notice-item + .notice-item {
  border-top: var(--border-width) solid var(--color-border);
}

.notice-item--error {
  border-left-color: var(--color-danger-text);
}

.notice-item--warning {
  border-left-color: var(--color-warning-text);
}

.notice-item--success {
  border-left-color: var(--color-success-text);
}

.notice-item--info {
  border-left-color: var(--color-action-text);
}

.notice-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

