/* Extra styles beyond Tailwind CDN — scrollbar + animation like alpha-dex-radar frontend */
.scrollbar-overlay {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted-foreground) / 0.35) hsl(var(--secondary));
}
.scrollbar-overlay::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.scrollbar-overlay::-webkit-scrollbar-track {
  background: hsl(var(--secondary));
}
.scrollbar-overlay::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 3px;
}
.scrollbar-overlay::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

@keyframes slideIn {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

details.watch-dd[open] > summary .details-chevron {
  transform: rotate(-180deg);
}

/* Hide default <summary> marker in dropdown */
details.watch-dd > summary {
  list-style: none;
}
details.watch-dd > summary::-webkit-details-marker {
  display: none;
}

/* Watchlist action buttons — hidden by default, visible on row hover */
.wl-actions-cell-hidden {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}
.group:hover .wl-actions-cell-hidden {
  opacity: 1;
}

/* Alpha research drawer + Brief pill */
.alpha-research-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.alpha-research-drawer-root.hidden {
  display: none;
}
.alpha-research-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}
.alpha-research-drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(
    max(300px, calc(var(--ar-drawer-width-pct, 40) * 1vw)),
    100vw
  );
  max-width: min(85vw, 1100px);
  background: hsl(var(--background));
  border-left: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
}
.alpha-research-resize {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 5;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 52px;
  padding: 0;
  margin: 0;
  border: 1px solid hsl(var(--border) / 0.9);
  border-radius: 999px;
  background: hsl(var(--card) / 0.95);
  backdrop-filter: blur(8px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.12);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease,
    background 0.2s ease;
}
.alpha-research-resize:hover,
.alpha-research-resize:focus-visible {
  border-color: hsl(var(--primary) / 0.55);
  background: hsl(var(--card));
  box-shadow:
    0 0 0 3px hsl(var(--primary) / 0.12),
    0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translate(-50%, -50%) scale(1.04);
  outline: none;
}
.alpha-research-resize:active {
  transform: translate(-50%, -50%) scale(0.98);
}
.alpha-research-resize-grip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}
.alpha-research-resize-grip i {
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: hsl(var(--muted-foreground) / 0.65);
  transition: background 0.2s ease;
}
.alpha-research-resize:hover .alpha-research-resize-grip i,
.alpha-research-resize:focus-visible .alpha-research-resize-grip i {
  background: hsl(var(--primary) / 0.85);
}
body.alpha-research-resizing {
  cursor: col-resize !important;
  user-select: none;
}
body.alpha-research-resizing .alpha-research-backdrop {
  pointer-events: none;
}
body.alpha-research-resizing .alpha-research-drawer {
  transition: none;
}
.alpha-research-drawer-head,
.alpha-research-drawer-foot {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.alpha-research-drawer-foot {
  border-bottom: none;
  border-top: 1px solid hsl(var(--border) / 0.6);
  align-items: center;
}
.alpha-research-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.alpha-research-lang-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.alpha-research-lang-tabs button {
  font-size: 0.65rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border) / 0.8);
  color: hsl(var(--muted-foreground));
}
.alpha-research-lang-tabs button.is-active {
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
}
.alpha-research-width-badge {
  font-size: 0.6rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}
.alpha-brief-btn {
  position: relative;
}
.alpha-brief-btn--ready {
  color: hsl(var(--primary));
}
.alpha-brief-btn--ready::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}
.alpha-brief-btn--error::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f97316;
}

/* Shared markdown (AI Coach + Research drawer) */
.ai-md {
  font-size: 0.875rem;
  line-height: 1.65;
  color: inherit;
}
.ai-md h1,
.ai-md h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.8em 0 0.35em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 0.2em;
}
.ai-md h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.7em 0 0.3em;
}
.ai-md h4,
.ai-md h5,
.ai-md h6 {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.6em 0 0.25em;
}
.ai-md p {
  margin: 0.45em 0;
}
.ai-md ul,
.ai-md ol {
  margin: 0.4em 0 0.4em 1.25em;
  padding: 0;
}
.ai-md li {
  margin: 0.15em 0;
}
.ai-md code {
  font-family: ui-monospace, monospace;
  font-size: 0.8em;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.ai-md pre {
  margin: 0.5em 0;
  border-radius: 6px;
  overflow-x: auto;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.ai-md pre code {
  background: none;
  padding: 0.75rem 1rem;
  display: block;
  font-size: 0.78em;
  white-space: pre;
}
.ai-md blockquote {
  margin: 0.5em 0;
  padding: 0.3em 0.75em;
  border-left: 3px solid rgba(56, 189, 248, 0.5);
  color: rgba(148, 163, 184, 1);
  background: rgba(56, 189, 248, 0.05);
  border-radius: 0 4px 4px 0;
}
.ai-md hr {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  margin: 0.75em 0;
}
.ai-md a {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ai-md a:hover {
  color: #7dd3fc;
}
.ai-md strong {
  font-weight: 700;
  color: inherit;
}
.ai-md em {
  font-style: italic;
}
.ai-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
  font-size: 0.8rem;
  display: block;
  overflow-x: auto;
}
.ai-md thead {
  background: rgba(56, 189, 248, 0.1);
}
.ai-md th {
  padding: 0.4em 0.7em;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
  color: #7dd3fc;
}
.ai-md td {
  padding: 0.35em 0.7em;
  border: 1px solid rgba(148, 163, 184, 0.15);
  vertical-align: top;
}
.ai-md tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.04);
}
.ai-md tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}
.ai-md em:only-child,
.ai-md p > em:only-child {
  color: rgba(148, 163, 184, 0.7);
  font-size: 0.78rem;
}

.alpha-research-drawer-head {
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.12) 0%,
    hsl(var(--background)) 45%,
    rgba(99, 102, 241, 0.08) 100%
  );
}
.alpha-research-lang-tabs button {
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.alpha-research-lang-tabs button:hover:not(.is-active) {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.alpha-research-lang-tabs button.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  font-weight: 600;
}
/* Alpha Debut — research notes drawer (VI, editable) */
.ad-research-notes-root {
  position: fixed;
  inset: 0;
  z-index: 98;
  pointer-events: none;
}
.ad-research-notes-root.hidden {
  display: none !important;
}
.ad-research-notes-root:not(.hidden) {
  pointer-events: auto;
}
.ad-research-notes-root .alpha-research-backdrop {
  z-index: 0;
}
.ad-research-notes-drawer {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  height: 100%;
  width: min(
    max(380px, calc(var(--ad-rn-width-pct, 52) * 1vw)),
    100vw
  );
  max-width: min(92vw, 1400px);
  background: hsl(var(--background));
  border-left: 1px solid hsl(142 76% 36% / 0.25);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.28);
  transition: width 0.22s ease, max-width 0.22s ease;
}
.ad-research-notes-drawer--expanded {
  width: min(96vw, 100vw) !important;
  max-width: 100vw !important;
}
.ad-notes-doc-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
  border-radius: 0.25rem;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease, background 0.15s ease;
}
.ad-notes-doc-btn:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.45);
}
.ad-notes-doc-btn--ready {
  color: hsl(142 76% 46%);
}
.ad-notes-doc-btn--ready::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}
.ad-research-notes-head {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  background: linear-gradient(
    90deg,
    hsl(142 76% 36% / 0.12) 0%,
    hsl(var(--background)) 50%,
    transparent 100%
  );
  flex-shrink: 0;
}
.ad-research-notes-toolbar {
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.45);
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.ad-research-notes-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1.1rem 0.5rem;
  overflow: hidden;
}
.ad-rn-mode-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.55);
  background: hsl(var(--muted) / 0.35);
  margin-bottom: 0.65rem;
}
.ad-rn-mode-btn {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
.ad-rn-mode-btn:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--background) / 0.6);
}
.ad-rn-mode-btn--active {
  color: hsl(142 76% 42%);
  background: hsl(142 76% 36% / 0.14);
  box-shadow: 0 0 0 1px hsl(142 76% 36% / 0.22);
}
.ad-rn-ollama-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.ad-rn-preview-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 0.75rem;
  border: 1px solid hsl(142 76% 36% / 0.18);
  background: linear-gradient(
    165deg,
    hsl(142 76% 36% / 0.06) 0%,
    hsl(var(--background)) 42%,
    hsl(var(--card) / 0.4) 100%
  );
  padding: 0.35rem;
}
.ad-rn-preview {
  min-height: min(68vh, calc(100vh - 17rem));
}
.ad-rn-edit-wrap {
  display: flex;
  flex-direction: column;
}
.ad-rn-editor-source {
  flex: 1;
  min-height: min(68vh, calc(100vh - 17rem));
  width: 100%;
  resize: vertical;
  font-size: 0.8125rem;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.9);
  padding: 0.85rem 1rem;
  color: hsl(var(--foreground));
}
.ad-rn-editor-source:focus {
  outline: none;
  border-color: hsl(142 76% 36% / 0.45);
  box-shadow: 0 0 0 3px hsl(142 76% 36% / 0.12);
}
.ad-rn-doc-card {
  border-radius: 0.65rem;
  border: 1px solid hsl(142 76% 36% / 0.2);
  background: hsl(var(--card) / 0.72);
  padding: 1.1rem 1.25rem 1.25rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 8px 28px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 hsl(142 76% 36% / 0.06);
}
.ad-rn-prose {
  font-size: 0.9rem;
  line-height: 1.72;
}
.ad-rn-prose h1,
.ad-rn-prose h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 1.1em 0 0.45em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid hsl(142 76% 36% / 0.22);
}
.ad-rn-prose h3 {
  font-size: 0.95rem;
  font-weight: 650;
  color: hsl(142 76% 46%);
  margin: 0.95em 0 0.35em;
}
.ad-rn-prose h2:first-child,
.ad-rn-prose h3:first-child {
  margin-top: 0.15em;
}
.ad-rn-search-report .ad-rn-source {
  margin: 1rem 0;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--muted) / 0.15);
}
.ad-rn-search-report .ad-rn-query {
  font-size: 0.72rem;
  max-height: 12rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.ad-rn-search-report .ad-rn-link a {
  color: hsl(142 76% 46%);
  word-break: break-all;
}
.ad-rn-serpapi-raw-html {
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-x: auto;
}
.ad-rn-serpapi-raw-html img {
  max-width: 100%;
  height: auto;
}
.ad-rn-prose ul,
.ad-rn-prose ol {
  margin: 0.5em 0 0.65em;
  padding-left: 1.35em;
}
.ad-rn-prose li {
  margin: 0.28em 0;
}
.ad-rn-prose li::marker {
  color: hsl(142 76% 42% / 0.85);
}
.ad-rn-prose blockquote {
  border-left: 3px solid hsl(142 76% 36% / 0.55);
  background: hsl(142 76% 36% / 0.07);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 0.55rem 0.9rem;
  margin: 0.75em 0;
  color: hsl(var(--muted-foreground));
}
.ad-rn-prose hr {
  border: none;
  border-top: 1px solid hsl(var(--border) / 0.7);
  margin: 1.25em 0;
}
.ad-rn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: min(50vh, 20rem);
  padding: 2rem 1.5rem;
  color: hsl(var(--muted-foreground));
}
.ad-rn-empty-icon {
  width: 2.75rem;
  height: 2.75rem;
  opacity: 0.45;
  margin-bottom: 0.75rem;
}
.ad-rn-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(var(--foreground) / 0.85);
  margin: 0 0 0.35rem;
}
.ad-rn-empty-hint {
  font-size: 0.8rem;
  line-height: 1.55;
  max-width: 22rem;
  margin: 0;
}
.ad-research-notes-foot {
  padding: 0.65rem 1.1rem;
  border-top: 1px solid hsl(var(--border) / 0.6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ar-research-article {
  margin-top: 0.25rem;
}
.ar-research-card {
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.85);
  padding: 0.875rem 1rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(56, 189, 248, 0.08);
}
.ar-research-meta {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid hsl(var(--border) / 0.55);
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}
.ar-research-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  border: 1px solid hsl(var(--border) / 0.7);
  background: hsl(var(--card) / 0.5);
  font-family: ui-monospace, monospace;
  font-size: 0.62rem;
}
.ar-research-meta-pill--deeper {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
}
.ar-research-sources {
  margin-top: 1rem;
}
.ar-research-sources h3 {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}
.ar-research-sources ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ar-research-sources a {
  font-size: 0.75rem;
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.ar-research-sources a:hover {
  color: #7dd3fc;
}
.ar-research-disclaimer {
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-style: italic;
  color: hsl(var(--muted-foreground) / 0.85);
}
.ar-research-status-banner {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  border: 1px solid hsl(var(--border) / 0.8);
}
.ar-research-status-banner--error {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
}
.ar-research-skeleton {
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border) / 0.6);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   Research Notes Drawer — Modern Redesign
   ═══════════════════════════════════════════════════════════ */

/* ── Header ── */
.ad-rn-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.1rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  background: linear-gradient(135deg, hsl(142 76% 36% / 0.09) 0%, transparent 65%);
  flex-shrink: 0;
  gap: 0.5rem;
}
.ad-rn-hd-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}
.ad-rn-hd-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 0.45rem;
  border: 1px solid hsl(142 76% 36% / 0.28);
  background: hsl(142 76% 36% / 0.11);
  color: hsl(142 76% 46%);
  flex-shrink: 0;
}
.ad-rn-hd-info {
  min-width: 0;
  flex: 1;
}
.ad-rn-hd-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.ad-rn-hd-badge {
  display: block;
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}
.ad-rn-hd-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.ad-rn-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 0.13s, background 0.13s, border-color 0.13s;
}
.ad-rn-icon-btn:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.5);
  border-color: hsl(var(--border));
}
.ad-rn-close-btn:hover {
  color: hsl(0 72% 51%);
  border-color: hsl(0 72% 51% / 0.35);
  background: hsl(0 72% 51% / 0.08);
}

/* ── Web Research Controls (#wrp-modal) — layout via inline styles ── */
#wrp-modal {
  flex-shrink: 0;
}
.ad-rn-search-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: hsl(var(--muted-foreground));
  opacity: 0.55;
  flex-shrink: 0;
}
.ad-rn-btn-gen {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.33rem 0.8rem;
  border-radius: 0.4rem;
  border: 1px solid hsl(142 76% 46% / 0.38);
  background: hsl(142 76% 36% / 0.14);
  color: hsl(142 76% 46%);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
  white-space: nowrap;
}
.ad-rn-btn-gen:hover:not(:disabled) {
  background: hsl(142 76% 36% / 0.24);
  border-color: hsl(142 76% 46% / 0.55);
}
.ad-rn-btn-gen:disabled { opacity: 0.45; cursor: default; }
.ad-rn-btn-sec {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.33rem 0.75rem;
  border-radius: 0.4rem;
  border: 1px solid hsl(var(--border) / 0.7);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}
.ad-rn-btn-sec:hover:not(:disabled) {
  background: hsl(var(--muted) / 0.45);
  color: hsl(var(--foreground));
}
.ad-rn-btn-sec:disabled { opacity: 0.45; cursor: default; }

/* ── 2 Main tabs bar ── */
.ad-rn-tabs-bar {
  display: flex;
  align-items: flex-end;
  padding: 0 1.1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--background) / 0.75);
  flex-shrink: 0;
  gap: 0;
}
.ad-rn-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
  margin-bottom: -1px;
  border-radius: 0.35rem 0.35rem 0 0;
  letter-spacing: 0.01em;
}
.ad-rn-tab:hover:not(.ad-rn-tab--active) {
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.2);
}
.ad-rn-tab--active {
  color: hsl(142 76% 46%);
  border-bottom-color: hsl(142 76% 46%);
}

/* ── Content panels ── */
.ad-rn-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1.1rem 0.5rem;
  overflow: hidden;
}

/* ── Footer ── */
.ad-rn-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.1rem;
  border-top: 1px solid hsl(var(--border) / 0.45);
  background: hsl(var(--background) / 0.7);
  flex-shrink: 0;
}
.ad-rn-status-text {
  flex: 1;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
  min-width: 0;
  word-break: break-word;
}
.ad-rn-status-text--err {
  color: hsl(0 72% 56%);
}
.ad-rn-btn-close {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.33rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid hsl(var(--border) / 0.6);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ad-rn-btn-close:hover {
  background: hsl(var(--muted) / 0.4);
  color: hsl(var(--foreground));
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Mobile nav toggle button
   ═══════════════════════════════════════════════════════════ */

.app-nav-toggle {
  /* Minimum 44×44px touch target */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav-toggle:hover {
  background: hsl(var(--muted) / 0.6);
}
.app-nav-toggle:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Mobile nav menu container
   ═══════════════════════════════════════════════════════════ */

#app-mobile-nav {
  /* Shown/hidden via JS (display:none / display:'') */
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Edge dock shared contract
   ═══════════════════════════════════════════════════════════ */

/* Base edge dock tab/trigger */
.edge-dock {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 85;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Expanded panel for any edge dock */
.edge-dock-panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: hsl(var(--card) / 0.98);
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem 0 0 0.75rem;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  /* Desktop default size — overridden per-dock */
  width: min(28rem, calc(100vw - 10px));
  height: min(85vh, 720px);
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Mobile sheet (full-screen bottom sheet)
   ═══════════════════════════════════════════════════════════ */

.ui-mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  /* Use dynamic viewport height so browser chrome doesn't clip */
  height: 100dvh;
  /* Safe area for devices with home indicator */
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
}

.ui-touch-target {
  min-width: 44px;
  min-height: 44px;
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Modal dialog contract
   ═══════════════════════════════════════════════════════════ */

.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.ui-modal > [role="dialog"] {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
}
/* .ui-modal sets display:flex unconditionally, same specificity as Tailwind's
   .hidden (display:none) — force it closed regardless of stylesheet load order,
   same pattern already used by .ad-research-notes-root.hidden below. */
.ui-modal.hidden {
  display: none !important;
}
/* Panel contract for consumers that put role="dialog" on the .ui-modal element
   itself (checkbox/label markup constraints) instead of on a direct child —
   same visual spec as ".ui-modal > [role="dialog"]" above, addressable by class. */
.ui-modal-panel {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
}
.ui-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
  shrink: 0;
}
.ui-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.ui-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  color: hsl(var(--muted-foreground));
  border-radius: 0.375rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ui-modal-close:hover {
  background: hsl(var(--muted) / 0.6);
  color: hsl(var(--foreground));
}
.ui-modal-body {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Split layout contract (kline chart, research panels)
   ═══════════════════════════════════════════════════════════ */

.ui-split-layout {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.ui-split-layout > * {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ui-split-handle {
  flex: 0 0 6px;
  min-width: 6px;
  max-width: 6px;
  background: hsl(var(--border));
  cursor: col-resize;
  transition: background 0.15s ease;
  position: relative;
  z-index: 1;
}
.ui-split-handle:hover,
.ui-split-handle:active {
  background: hsl(var(--primary) / 0.5);
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Mobile responsive rules  (max-width: 767.98px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Prevent horizontal overflow from header */
  #app-header {
    overflow: hidden;
  }

  /* Edge dock panels become full-screen bottom sheets on mobile */
  .edge-dock-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Research drawers go full-width on mobile */
  .alpha-research-drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-top: 1px solid hsl(var(--border));
  }

  .ad-research-notes-drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-top: 1px solid hsl(var(--border));
  }

  /* Split layout stacks vertically on mobile */
  .ui-split-layout {
    flex-direction: column;
  }
  .ui-split-handle {
    flex: 0 0 4px;
    min-height: 4px;
    max-height: 4px;
    min-width: unset;
    max-width: unset;
    cursor: row-resize;
  }

  /* Watchlist action cells always visible below 768px.
     Specificity must match/exceed watchlist.css's `.wl-actions-cell.wl-actions-cell-hidden`
     (opacity:0, unconditional) or this rule is silently outranked and never applies. */
  .wl-actions-cell.wl-actions-cell-hidden,
  .wl-actions-cell-hidden {
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Safe-area bottom padding for docks/sheets
   ═══════════════════════════════════════════════════════════ */

/* Applied to any element that sits at the bottom of the screen */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ═══════════════════════════════════════════════════════════
   WP01 — Reduced motion
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  /* Disable non-essential transitions and animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Keep the slideIn animation but make it instant */
  @keyframes slideIn {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(0); opacity: 1; }
  }

  .details-chevron {
    transition: none !important;
  }
}
