/* Canonical CSS owner: dialogs. Historical layers consolidated 2026-08-02. */
.dialog-header-actions {
  display: flex;

  align-items: center;

  gap: 8px;
}

.dialog-header h2 {
  margin: 2px 0px 0px;

  font-size: 16px;

  font-weight: var(--font-weight-semibold);

  letter-spacing: 0px;
}

.dialog-actions {
  display: flex;

  justify-content: flex-end;

  flex-wrap: wrap;

  gap: 8px;

  margin-top: 22px;
}

.admin-dialog .model-role-selectors {
  gap: 10px;
}

.admin-dialog .model-pool-list {
  margin-top: 14px;
}

.admin-dialog .model-row {
  border-color: var(--border);

  border-radius: 8px;

  background: var(--surface-subtle);
}

@keyframes overlay-enter {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@media (max-width: 767px) {
  .dialog-header-actions {
    flex-wrap: wrap;

    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  .dialog-header {
    min-width: 0px;

    padding-right: 12px;

    padding-left: 12px;

    gap: 8px;
  }
}

.global-search-button .lucide {
  width: 17px;

  height: 17px;
}

.global-search-dialog::backdrop {
  background: rgba(34, 44, 53, 0.42);

  backdrop-filter: blur(4px);
}

.global-search-head > .lucide {
  width: 20px;

  height: 20px;

  color: var(--text-muted);
}

.global-search-head input::-webkit-search-cancel-button {
  display: none;
}

.global-search-group + .global-search-group {
  margin-top: 6px;
}

.global-search-result:focus-visible {
  outline: rgba(8, 100, 135, 0.38) solid 2px;

  outline-offset: -2px;
}

.global-search-result-icon .lucide {
  width: 16px;

  height: 16px;
}

.global-search-result-copy {
  min-width: 0px;
}

.global-search-result-copy strong {
  display: block;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  font-size: 13px;
}

.global-search-result-copy span {
  display: block;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  margin-top: 3px;

  color: var(--text-muted);

  font-size: 11px;
}

.global-search-result-code {
  color: var(--text-muted);

  font-size: 11px;

  font-variant-numeric: tabular-nums;
}

.global-search-empty .lucide {
  width: 22px;

  height: 22px;
}

.global-search-empty p {
  margin: 4px 0px 0px;

  color: var(--text);

  font-size: 13px;

  font-weight: 650;
}

.global-search-empty span {
  font-size: 11px;
}

.global-search-loading {
  min-height: 210px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 9px;

  color: var(--text-muted);

  font-size: 12px;
}

@media (max-width: 767px) {
  .global-search-dialog {
    width: calc(-16px + 100vw);

    max-height: calc(-16px + 100dvh);

    margin: 8px auto;
  }

  .global-search-shell {
    max-height: calc(-16px + 100dvh);
  }

  .global-search-head {
    min-height: 58px;

    grid-template-columns: 22px minmax(0px, 1fr) 34px;

    padding-inline: 13px 9px;
  }

  .global-search-head input {
    height: 56px;

    font-size: 16px;
  }

  .global-search-head kbd {
    display: none;
  }

  .global-search-results {
    max-height: calc(-74px + 100dvh);
  }

  .global-search-result {
    min-height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-search-result {
    transition: none;
  }
}

.alert-button {
  position: relative;
}

.alert-button.has-alerts {
  border-color: var(--warning-color);

  background: var(--warning-soft);

  color: var(--warning-color);
}

.alert-badge {
  position: absolute;

  top: -5px;

  right: -5px;

  min-width: 18px;

  height: 18px;

  padding: 0px 4px;

  border: 2px solid var(--surface);

  border-radius: 9px;

  background: var(--market-up);

  color: var(--text-inverse);

  font-size: 9px;

  font-weight: 750;

  line-height: 14px;

  text-align: center;

  font-variant-numeric: tabular-nums;
}

.alerts-dialog {
  width: min(760px, -32px + 100vw);
}

.alerts-toolbar {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  padding: 14px 18px;

  border-bottom: 1px solid var(--border);
}

.alert-form {
  border-bottom: 1px solid var(--border);
}

.alert-form-grid {
  display: grid;

  grid-template-columns: minmax(0px, 1.4fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr);

  gap: 12px;
}

.alert-list-section {
  padding-bottom: 18px;
}

.alert-list {
  display: grid;

  border-top: 1px solid var(--border);
}

.alert-item {
  display: grid;

  grid-template-columns: 36px minmax(0px, 1fr) auto;

  gap: 12px;

  align-items: start;

  min-height: 82px;

  padding: 14px 18px;

  border-bottom: 1px solid var(--border);

  background: var(--surface);
}

.alert-item.is-unread {
  box-shadow: inset 3px 0 var(--action);
}

.alert-item.is-read {
  opacity: 0.68;
}

.alert-item.is-upcoming {
  background: var(--surface-muted);

  opacity: 1;
}

.alert-item-icon {
  width: 36px;

  height: 36px;

  display: grid;

  place-items: center;

  border-radius: 6px;

  background: var(--action-soft);

  color: var(--action);
}

.alert-item-icon .lucide {
  width: 18px;

  height: 18px;
}

.alert-item-copy {
  min-width: 0px;
}

.alert-item-copy > div {
  display: flex;

  gap: 10px;

  color: var(--text-secondary);

  font-size: 10px;
}

.alert-item-copy strong {
  display: block;

  margin-top: 5px;

  font-size: 13px;
}

.alert-item-copy p {
  margin: 5px 0px 0px;

  color: var(--text-secondary);

  font-size: 12px;

  line-height: 1.55;
}

.alert-stock-link {
  margin-top: 6px;

  border: 0px;

  background: transparent;

  color: var(--action);

  cursor: pointer;

  font-size: 11px;
}

.alert-item-actions {
  display: flex;

  gap: 6px;
}

.alert-item-actions .icon-button {
  width: 34px;

  height: 34px;
}

@media (max-width: 767px) {
  .alerts-dialog {
    width: calc(-16px + 100vw);

    margin: 8px auto;
  }

  .alert-form-grid {
    grid-template-columns: 1fr;
  }

  .alert-item {
    grid-template-columns: 32px minmax(0px, 1fr);

    padding-inline: 13px;
  }

  .alert-item-icon {
    width: 32px;

    height: 32px;
  }

  .alert-item-actions {
    grid-column: 2;
  }
}

.assistant-member-gate {
  margin: 14px 18px 0px;
}

.assistant-member-content {
  transition: opacity var(--motion-medium) ease, filter var(--motion-medium) ease;
}

.assistant-messages {
  min-height: 320px;

  max-height: min(540px, -340px + 100dvh);

  overflow-y: auto;

  padding: 18px;

  background: var(--surface-muted);

  scroll-behavior: smooth;
}

.assistant-message {
  max-width: 88%;

  margin-bottom: 14px;
}

.assistant-message.user {
  margin-left: auto;
}

.assistant-message-label {
  display: flex;

  align-items: center;

  gap: 8px;

  margin-bottom: 5px;

  color: var(--text-secondary);

  font-size: 10px;
}

.assistant-message.user .assistant-message-label {
  justify-content: flex-end;
}

.assistant-message-content {
  padding: 11px 13px;

  border: 1px solid var(--border);

  border-radius: 6px;

  background: var(--surface);

  font-size: 13px;

  line-height: 1.72;

  overflow-wrap: anywhere;
}

.assistant-message.user .assistant-message-content {
  border-color: var(--color-action-line);

  background: var(--action-soft);
}

.assistant-message.is-error .assistant-message-content {
  border-color: var(--market-up);

  background: var(--market-up-soft);

  color: var(--market-up);
}

.assistant-message-content p {
  margin: 0px 0px 8px;
}

.assistant-message-content p:last-child {
  margin-bottom: 0px;
}

.assistant-thinking {
  color: var(--text-secondary);
}

.assistant-stream-caret {
  display: inline-block;

  width: 6px;

  height: 14px;

  margin: 0px 0px -2px 3px;

  background: var(--action);

  animation: 900ms steps(1) 0s infinite normal none running assistant-caret;
}

.assistant-quick-prompts {
  display: flex;

  flex-wrap: wrap;

  gap: 7px;

  padding: 12px 18px;

  border-top: 1px solid var(--border);

  background: var(--surface);
}

.assistant-quick-prompts button {
  min-height: 32px;

  padding: 0px 10px;

  border: 1px solid var(--border);

  border-radius: 4px;

  background: var(--surface);

  color: var(--text-secondary);

  cursor: pointer;

  font-style: inherit;

  font-variant: inherit;

  font-weight: inherit;

  font-stretch: inherit;

  line-height: inherit;

  font-family: inherit;

  font-optical-sizing: inherit;

  font-size-adjust: inherit;

  font-kerning: inherit;

  font-feature-settings: inherit;

  font-variation-settings: inherit;

  font-language-override: inherit;

  font-size: 11px;

  transition: border-color var(--motion-fast) ease, color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.assistant-quick-prompts button:hover {
  border-color: var(--action);

  background: var(--action-soft);

  color: var(--action);
}

.assistant-form {
  display: grid;

  grid-template-columns: minmax(0px, 1fr) auto;

  gap: 10px;

  align-items: end;

  padding: 14px 18px;

  border-top: 1px solid var(--border);
}

.assistant-form textarea {
  width: 100%;

  min-height: 76px;

  max-height: 180px;

  resize: vertical;

  padding: 10px 12px;

  border: 1px solid var(--border-strong);

  border-radius: 4px;

  color: var(--text);

  font-style: inherit;

  font-variant: inherit;

  font-weight: inherit;

  font-stretch: inherit;

  font-size: inherit;

  font-family: inherit;

  font-optical-sizing: inherit;

  font-size-adjust: inherit;

  font-kerning: inherit;

  font-feature-settings: inherit;

  font-variation-settings: inherit;

  font-language-override: inherit;

  line-height: 1.6;
}

.assistant-form textarea:focus {
  border-color: var(--action);

  outline: 2px solid color-mix(in srgb, var(--action) 20%, transparent);

  outline-offset: 1px;
}

.assistant-form-actions {
  display: flex;

  gap: 8px;
}

.assistant-disclaimer {
  margin: 0px;

  padding: 0px 18px 14px;

  color: var(--text-secondary);

  font-size: 10px;
}

@media (max-width: 767px) {
  .assistant-dialog {
    max-width: none;

    border-radius: 8px;

    width: calc(-16px + 100vw);

    max-height: calc(-16px + 100dvh);

    margin: 8px auto;
  }

  .assistant-member-gate {
    margin: 10px 13px 0px;
  }

  .assistant-messages {
    min-height: 260px;

    max-height: calc(-390px + 100dvh);

    padding: 13px;
  }

  .assistant-message {
    max-width: 96%;
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .assistant-form textarea {
    font-size: 16px;
  }

  .assistant-form-actions {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-member-content {
    transition: none;
  }

  .assistant-stream-caret {
    animation: auto ease 0s 1 normal none running none;
  }

  .assistant-messages {
    scroll-behavior: auto;
  }
}

.dialog-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 16px;

  padding: 20px;

  min-height: 62px;

  border-bottom-color: var(--border);
}

.assistant-dialog {
  border-radius: 12px;

  width: min(820px, -32px + 100vw);

  max-height: min(860px, -32px + 100dvh);

  max-width: 820px;
}

.dialog-eyebrow {
  color: var(--text-3);

  font-size: var(--font-size-caption);
}

.global-search-dialog {
  border-color: rgba(116, 132, 145, 0.38);

  border-radius: 8px;

  box-shadow: var(--shadow-float);

  max-width: 700px;

  width: min(660px, -32px + 100vw);

  max-height: min(620px, -48px + 100dvh);

  margin: 9vh auto auto;

  overflow: hidden;
}

.global-search-shell {
  display: grid;

  grid-template-rows: auto minmax(180px, 1fr);

  max-height: min(620px, -48px + 100dvh);
}

.global-search-head {
  display: grid;

  align-items: center;

  min-height: 64px;

  grid-template-columns: 22px minmax(0px, 1fr) auto 34px;

  gap: 10px;

  padding: 0px 12px 0px 18px;

  border-color: var(--dialog-line);
}

.global-search-head input {
  min-width: 0px;

  padding: 0px;

  border: 0px;

  outline: 0px;

  background: transparent;

  font-style: inherit;

  font-variant: inherit;

  font-weight: inherit;

  font-stretch: inherit;

  line-height: inherit;

  font-family: inherit;

  font-optical-sizing: inherit;

  font-size-adjust: inherit;

  font-kerning: inherit;

  font-feature-settings: inherit;

  font-variation-settings: inherit;

  font-language-override: inherit;

  height: 62px;

  color: var(--dialog-ink);

  font-size: 15px;
}

.global-search-head kbd {
  padding: 4px 7px;

  border-bottom-width: 2px;

  font: 11px / 1.2 ui-monospace, SFMono-Regular, Consolas, monospace;

  border-color: var(--border-strong);

  border-radius: 5px;

  background: var(--surface-subtle);

  color: var(--text-tertiary);
}

.global-search-results {
  min-height: 180px;

  overflow-y: auto;

  overscroll-behavior: contain;

  max-height: min(536px, -112px + 100dvh);

  padding: 7px;
}

.global-search-group-title {
  margin: 0px;

  font-weight: 700;

  padding: 9px 10px 5px;

  color: var(--text-tertiary);

  font-size: 10px;
}

.global-search-result {
  width: 100%;

  display: grid;

  grid-template-columns: 34px minmax(0px, 1fr) auto;

  align-items: center;

  gap: 10px;

  padding: 7px 10px;

  border: 0px;

  color: var(--text);

  background: transparent;

  text-align: left;

  cursor: pointer;

  transition: background-color 150ms, color 150ms;

  min-height: 52px;

  border-radius: 7px;
}

.global-search-result.is-active,
.global-search-result:hover {
  background: var(--action-soft);

  color: var(--action);
}

.global-search-result-icon {
  width: 32px;

  height: 32px;

  display: grid;

  place-items: center;

  color: var(--text-muted);

  border-color: var(--border);

  border-radius: 7px;

  background: var(--surface-subtle);
}

.global-search-empty {
  display: flex;

  align-items: center;

  justify-content: center;

  flex-direction: column;

  gap: 7px;

  color: var(--text-muted);

  text-align: center;

  min-height: 190px;
}

.alerts-dialog .alerts-toolbar {
  padding: 11px 20px;

  border-color: var(--dialog-line);

  background: var(--surface-subtle);
}

.alerts-dialog .alert-form {
  padding-block: 16px;
}

.alerts-dialog .alert-form-grid {
  grid-template-columns: minmax(0px, 1.35fr) 150px 135px;

  gap: 10px;
}

.alerts-dialog .alert-form textarea {
  min-height: 68px;

  resize: vertical;
}

.alerts-dialog .alert-list-section {
  padding-bottom: 14px;
}

.alerts-dialog .alert-list {
  max-height: 224px;

  overflow-y: auto;

  border-color: var(--dialog-line);
}

.alerts-dialog .alert-list > .empty-state {
  min-height: 94px;
}

.alerts-dialog .alert-item {
  min-height: 72px;

  padding: 12px 8px;

  border-color: var(--dialog-line);
}

.assistant-dialog[open] {
  display: flex;

  flex-direction: column;
}

.assistant-dialog .assistant-member-gate {
  flex: 0 0 auto;

  margin: 12px 16px 0px;
}

.assistant-dialog .assistant-member-content {
  min-height: 0px;

  display: flex;

  flex: 1 1 auto;

  flex-direction: column;
}

.assistant-dialog .assistant-messages {
  min-height: 0px;

  max-height: none;

  flex: 1 1 auto;

  padding: 16px 18px;

  background: var(--surface-subtle);
}

.assistant-dialog .assistant-message {
  max-width: 86%;

  margin-bottom: 11px;
}

.assistant-dialog .assistant-message-content {
  border-color: var(--border);

  border-radius: 8px;

  font-size: 12.5px;

  line-height: 1.62;
}

.assistant-dialog .assistant-quick-prompts {
  flex: 0 0 auto;

  padding: 10px 16px;

  border-color: var(--dialog-line);
}

.assistant-dialog .assistant-quick-prompts button {
  min-height: 30px;

  border-radius: 6px;
}

.assistant-dialog .assistant-form {
  flex: 0 0 auto;

  padding: 11px 16px 8px;

  border-color: var(--dialog-line);
}

.assistant-dialog .assistant-form textarea {
  min-height: 66px;

  max-height: 126px;

  resize: none;

  border-radius: 7px;

  font-size: 12.5px;
}

.assistant-dialog .assistant-disclaimer {
  flex: 0 0 auto;

  padding: 0px 16px 11px;
}

@media (max-width: 760px) {
  .alerts-dialog .alert-form-grid {
    grid-template-columns: 1fr;
  }

  .assistant-dialog {
    height: calc(-16px + 100dvh);
  }

  .assistant-dialog .assistant-messages {
    padding: 13px;
  }

  .assistant-dialog .assistant-message {
    max-width: 96%;
  }

  .assistant-dialog .assistant-form {
    grid-template-columns: 1fr;
  }

  .assistant-dialog .assistant-form-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 460px) {
  .global-search-dialog {
    margin-top: 8px;
  }

  .global-search-head {
    grid-template-columns: 20px minmax(0px, 1fr) 32px;

    padding-left: 12px;
  }

  .global-search-head kbd {
    display: none;
  }

  .global-search-result-code {
    display: none;
  }
}

.drawer {
  position: fixed;

  top: 0px;

  right: -460px;

  width: 440px;

  bottom: 0px;

  background: var(--surface);

  z-index: 95;

  box-shadow: var(--shadow-float);

  transition: right 0.25s;

  display: flex;

  flex-direction: column;
}

.drawer .d-h {
  padding: 14px 18px;

  border-bottom: 1px solid var(--line-soft);

  display: flex;

  align-items: center;

  font-weight: 700;

  font-size: 14px;
}

.drawer .d-h .x {
  margin-left: auto;

  color: var(--faint);

  font-size: 18px;
}

.drawer .d-b {
  flex: 1 1 0%;

  overflow: auto;

  padding: 16px 18px;
}

.drawer .d-f {
  padding: 12px 18px;

  border-top: 1px solid var(--line-soft);

  display: flex;

  justify-content: flex-end;

  gap: 8px;
}

:root[data-theme="dark"] :is(.global-search-result:hover, .global-search-result.is-active) {
  background: var(--action-soft);

  color: var(--action);
}
