/* Switcher overlays (tmux + Codex conversation search).
 *
 * Extracted from `templates/base.html` to keep templates lean.
 * Contract: selectors are referenced by `static/sidebar.js` and Playwright tests.
 */

[data-tmux-switcher] {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
  background: rgba(15, 23, 42, 0.35);
}

[data-tmux-switcher].is-open {
  display: flex;
}

[data-tmux-switcher-panel] {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 5rem);
  overflow: hidden;
  border: 1px solid rgb(226 232 240);
  border-radius: 1rem;
  background: rgb(255 255 255);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
}

[data-tmux-switcher-head] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  border-bottom: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  padding: 0.75rem 1rem;
}

[data-tmux-switcher-head-copy] {
  min-width: 0;
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgb(15 23 42);
}

[data-tmux-switcher-subtle] {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(100 116 139);
}

[data-tmux-switcher-close] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.5rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(71 85 105);
  background: rgb(255 255 255);
}

[data-tmux-switcher-search-wrap] {
  border-bottom: 1px solid rgb(226 232 240);
  padding: 0.75rem 1rem;
}

[data-tmux-switcher-search] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.6rem;
  background: rgb(255 255 255);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
}

[data-tmux-switcher-search-icon] {
  width: 1rem;
  height: 1rem;
  color: rgb(148 163 184);
}

[data-tmux-switcher-input] {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: rgb(15 23 42);
}

[data-tmux-switcher-kbd] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.4rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: rgb(100 116 139);
  background: rgb(248 250 252);
}

[data-tmux-switcher-list] {
  overflow: auto;
  max-height: 60vh;
  padding: 0.5rem;
}

[data-tmux-switcher-empty] {
  border: 1px dashed rgb(226 232 240);
  border-radius: 0.6rem;
  padding: 1.2rem 0.75rem;
  text-align: center;
  color: rgb(100 116 139);
  font-size: 0.875rem;
}

[data-tmux-switcher-item] {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: rgb(255 255 255);
  padding: 0.55rem 0.75rem;
  text-align: left;
}

[data-tmux-switcher-item]:hover,
[data-tmux-switcher-item][data-selected="1"] {
  border-color: rgb(199 210 254);
  background: rgb(238 242 255);
}

[data-tmux-switcher-item-row] {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

[data-tmux-switcher-item-main] {
  min-width: 0;
  flex: 1;
}

[data-tmux-switcher-item-title] {
  color: rgb(15 23 42);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-tmux-switcher-item-meta] {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

[data-tmux-switcher-chip] {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  color: rgb(71 85 105);
  background: rgb(241 245 249);
  border: 1px solid rgb(226 232 240);
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-tmux-switcher-chip][data-kind="mono"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

[data-tmux-switcher-item-subtitle] {
  margin-top: 0.35rem;
  color: rgb(71 85 105);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-tmux-switcher-dot] {
  margin-top: 0.2rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 9999px;
  background: rgb(203 213 225);
}

[data-tmux-switcher-dot="active"] {
  background: rgb(16 185 129);
}

[data-tmux-switcher-foot] {
  border-top: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  color: rgb(100 116 139);
  font-size: 0.7rem;
  padding: 0.5rem 1rem;
}

[data-codex-jsonl-switcher] {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
  background: rgba(15, 23, 42, 0.35);
}

[data-codex-jsonl-switcher].is-open {
  display: flex;
}

[data-codex-jsonl-switcher-panel] {
  width: min(64rem, calc(100vw - 2rem));
  max-height: calc(100vh - 5rem);
  overflow: hidden;
  border: 1px solid rgb(226 232 240);
  border-radius: 1rem;
  background: rgb(255 255 255);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
}

[data-codex-jsonl-switcher-head] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  border-bottom: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  padding: 0.75rem 1rem;
}

[data-codex-jsonl-switcher-head-copy] {
  min-width: 0;
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgb(15 23 42);
}

[data-codex-jsonl-switcher-subtle] {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(100 116 139);
}

[data-codex-jsonl-switcher-close] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.5rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgb(71 85 105);
  background: rgb(255 255 255);
}

[data-codex-jsonl-switcher-search-wrap] {
  border-bottom: 1px solid rgb(226 232 240);
  padding: 0.75rem 1rem;
}

[data-codex-jsonl-switcher-search] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.6rem;
  background: rgb(255 255 255);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
}

[data-codex-jsonl-switcher-search-icon] {
  width: 1rem;
  height: 1rem;
  color: rgb(148 163 184);
}

[data-codex-jsonl-switcher-input] {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  color: rgb(15 23 42);
}

[data-codex-jsonl-switcher-kbd] {
  border: 1px solid rgb(226 232 240);
  border-radius: 0.4rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: rgb(100 116 139);
  background: rgb(248 250 252);
}

[data-codex-jsonl-switcher-meta] {
  padding-top: 0.35rem;
}

[data-codex-jsonl-switcher-status] {
  border-radius: 9999px;
  border: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  color: rgb(100 116 139);
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
}

[data-codex-jsonl-switcher-status][data-tone="ok"] {
  border-color: rgb(167 243 208);
  background: rgb(236 253 245);
  color: rgb(6 95 70);
}

[data-codex-jsonl-switcher-status][data-tone="bad"] {
  border-color: rgb(254 202 202);
  background: rgb(254 242 242);
  color: rgb(153 27 27);
}

[data-codex-jsonl-switcher-list] {
  overflow: auto;
  max-height: 60vh;
  padding: 0.5rem;
}

[data-codex-jsonl-switcher-empty] {
  border: 1px dashed rgb(226 232 240);
  border-radius: 0.6rem;
  padding: 1.2rem 0.75rem;
  text-align: center;
  color: rgb(100 116 139);
  font-size: 0.875rem;
}

[data-codex-jsonl-switcher-item] {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: rgb(255 255 255);
  padding: 0.55rem 0.75rem;
  text-align: left;
}

[data-codex-jsonl-switcher-item]:hover,
[data-codex-jsonl-switcher-item][data-selected="1"] {
  border-color: rgb(199 210 254);
  background: rgb(238 242 255);
}

[data-codex-jsonl-switcher-item-row] {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

[data-codex-jsonl-switcher-item-main] {
  min-width: 0;
  flex: 1;
}

[data-codex-jsonl-switcher-item-title] {
  color: rgb(15 23 42);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-codex-jsonl-switcher-item-meta] {
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

[data-codex-jsonl-switcher-chip] {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  color: rgb(71 85 105);
  background: rgb(241 245 249);
  border: 1px solid rgb(226 232 240);
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-codex-jsonl-switcher-chip][data-kind="mono"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

[data-codex-jsonl-switcher-item-subtitle] {
  margin-top: 0.35rem;
  color: rgb(71 85 105);
  font-size: 0.75rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
}

[data-codex-jsonl-switcher-foot] {
  border-top: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
  color: rgb(100 116 139);
  font-size: 0.7rem;
  padding: 0.5rem 1rem;
}

html[data-theme="dark"] [data-tmux-switcher] {
  background: rgba(2, 6, 23, 0.65);
}

html[data-theme="dark"] [data-tmux-switcher-panel] {
  background: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] [data-tmux-switcher-head],
html[data-theme="dark"] [data-tmux-switcher-search-wrap],
html[data-theme="dark"] [data-tmux-switcher-foot] {
  background: #0b1220;
  border-color: #334155;
}

html[data-theme="dark"] [data-tmux-switcher-subtle],
html[data-theme="dark"] [data-tmux-switcher-kbd],
html[data-theme="dark"] [data-tmux-switcher-item-subtitle] {
  color: #94a3b8;
}

html[data-theme="dark"] [data-tmux-switcher-search],
html[data-theme="dark"] [data-tmux-switcher-close],
html[data-theme="dark"] [data-tmux-switcher-item] {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] [data-tmux-switcher-item]:hover,
html[data-theme="dark"] [data-tmux-switcher-item][data-selected="1"] {
  background: #1e293b;
  border-color: #475569;
}

html[data-theme="dark"] [data-tmux-switcher-chip] {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] [data-codex-jsonl-switcher] {
  background: rgba(2, 6, 23, 0.65);
}

html[data-theme="dark"] [data-codex-jsonl-switcher-panel] {
  background: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-head],
html[data-theme="dark"] [data-codex-jsonl-switcher-search-wrap],
html[data-theme="dark"] [data-codex-jsonl-switcher-foot] {
  background: #0b1220;
  border-color: #334155;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-subtle],
html[data-theme="dark"] [data-codex-jsonl-switcher-kbd],
html[data-theme="dark"] [data-codex-jsonl-switcher-item-subtitle] {
  color: #94a3b8;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-search],
html[data-theme="dark"] [data-codex-jsonl-switcher-close],
html[data-theme="dark"] [data-codex-jsonl-switcher-item] {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-item]:hover,
html[data-theme="dark"] [data-codex-jsonl-switcher-item][data-selected="1"] {
  background: #1e293b;
  border-color: #475569;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-chip],
html[data-theme="dark"] [data-codex-jsonl-switcher-status] {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-status][data-tone="ok"] {
  background: #022c22;
  border-color: #065f46;
  color: #6ee7b7;
}

html[data-theme="dark"] [data-codex-jsonl-switcher-status][data-tone="bad"] {
  background: #3f0a0a;
  border-color: #7f1d1d;
  color: #fecaca;
}

/* Global toast notifications (shared across the UI). */

[data-pitchai-toast-host] {
  position: fixed;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  z-index: 11000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  width: min(calc(100vw - 2rem), 48rem);
}

[data-pitchai-toast] {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid rgb(254 205 211);
  background: rgba(255, 241, 242, 0.96);
  color: rgb(136 19 55);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
}

[data-pitchai-toast][data-tone="info"] {
  border-color: rgb(191 219 254);
  background: rgba(239, 246, 255, 0.96);
  color: rgb(30 64 175);
}

[data-pitchai-toast][data-tone="ok"] {
  border-color: rgb(167 243 208);
  background: rgba(236, 253, 245, 0.96);
  color: rgb(6 78 59);
}

[data-pitchai-toast][data-tone="warn"] {
  border-color: rgb(253 230 138);
  background: rgba(254, 249, 195, 0.96);
  color: rgb(146 64 14);
}

[data-pitchai-toast].flash-toast {
  animation-duration: 4s;
}

html[data-theme="dark"] [data-pitchai-toast] {
  border-color: #7f1d1d;
  background: rgba(63, 10, 10, 0.9);
  color: #fecaca;
}

html[data-theme="dark"] [data-pitchai-toast][data-tone="info"] {
  border-color: #075985;
  background: rgba(12, 74, 110, 0.92);
  color: #bae6fd;
}

html[data-theme="dark"] [data-pitchai-toast][data-tone="ok"] {
  border-color: #065f46;
  background: rgba(2, 44, 34, 0.9);
  color: #6ee7b7;
}

html[data-theme="dark"] [data-pitchai-toast][data-tone="warn"] {
  border-color: #92400e;
  background: rgba(61, 26, 2, 0.92);
  color: #fde68a;
}
