:root {
  color-scheme: dark;
  --app-bg: #090b0a;
  --app-bg-raised: #101311;
  --app-surface: #151816;
  --app-surface-raised: #1b1f1c;
  --app-border: #343a35;
  --app-border-strong: #4a544c;
  --app-text: #edf1ed;
  --app-muted: #a3aca5;
  --app-accent: #74d69a;
  --app-accent-bright: #91e8b0;
  --app-accent-soft: rgba(116, 214, 154, 0.12);
  --app-accent-rgb: 116, 214, 154;
  --theme-bg-top: #1b1e1c;
  --theme-bg-bottom: #090b0a;
  --theme-cyan: var(--app-accent);
  --theme-cyan-soft: rgba(var(--app-accent-rgb), 0.24);
  --theme-slate: var(--app-muted);
  --theme-panel: rgba(20, 24, 21, 0.96);
  --theme-purple: #909791;
  --theme-purple-soft: rgba(144, 151, 145, 0.18);
  --re-purple: var(--app-accent);
  --accent-purple: var(--app-accent);
  --bg: var(--app-bg);
  --panel: var(--app-surface);
  --accent: var(--app-accent);
  --accent-purple: var(--app-accent);
  --text: var(--app-text);
  --subtext: var(--app-muted);
  --border: var(--app-border);
  --support-bg-a: #171b18;
  --support-bg-b: #0d100e;
  --support-card: #141715;
  --support-border: #343a35;
  --support-accent: var(--app-accent);
  --support-text: var(--app-text);
  --support-muted: var(--app-muted);
  --support-ok: var(--app-accent-bright);
  --support-warn: #c1c8c2;
  --terms-bg: #090b0a;
  --terms-card: #141715;
  --terms-border: #343a35;
  --terms-text: var(--app-text);
  --terms-muted: var(--app-muted);
  --terms-accent: var(--app-accent);
}

body.dashboard-page,
body.landing-page {
  --app-bg: #1e1e1e;
  --app-bg-raised: #252526;
  --app-surface: #252526;
  --app-surface-raised: #2d2d30;
  --app-border: #3c3c3c;
  --app-border-strong: #505050;
  --app-text: #cccccc;
  --app-muted: #9d9d9d;
  --app-accent: #007acc;
  --app-accent-bright: #4daafc;
  --app-accent-soft: rgba(0, 122, 204, 0.14);
  --app-accent-rgb: 0, 122, 204;
  --theme-cyan: var(--app-accent);
  --theme-cyan-soft: rgba(var(--app-accent-rgb), 0.24);
  --re-purple: var(--app-accent);
  --theme-purple: var(--app-accent-bright);
  --theme-purple-soft: rgba(var(--app-accent-rgb), 0.18);
  --theme-bg-top: #252526;
  --theme-bg-bottom: #1e1e1e;
  --theme-panel: #252526;
  --bg: var(--app-bg);
  --panel: var(--app-surface);
  --accent: var(--app-accent);
  --accent-purple: var(--app-accent);
  --text: var(--app-text);
  --subtext: var(--app-muted);
  --border: var(--app-border);
}

html,
body {
  background-color: var(--app-bg);
  color: var(--app-text);
}

body.dashboard-page,
body.landing-page,
body.support-page,
body.terms-page {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--app-accent-rgb), 0.09), transparent 48%),
    linear-gradient(160deg, #171a18 0%, #0c0e0d 45%, #080a09 100%) !important;
  color: var(--app-text) !important;
}

body.dashboard-page,
body.landing-page {
  background: #1e1e1e !important;
  color: #cccccc !important;
}

.landing-scene-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.2;
}

body.landing-page {
  isolation: isolate;
}

body.landing-page .landing-shell {
  position: relative;
  z-index: 1;
}

::selection {
  color: #ffffff;
  background: var(--app-accent);
}

body.dashboard-page a,
body.landing-page a,
body.support-page a,
body.terms-page a {
  color: var(--app-accent-bright);
}

body.dashboard-page button,
body.landing-page button,
body.support-page button,
body.terms-page button,
body.dashboard-page .upload-btn,
body.dashboard-page .market-btn,
body.dashboard-page .header-action-btn,
body.dashboard-page .auth-primary-btn,
body.dashboard-page .doc-editor-toggle,
body.landing-page .landing-button,
body.support-page button {
  border-color: var(--app-border-strong);
  color: var(--app-text);
  background: #333333;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.24);
}

body.dashboard-page button:hover,
body.landing-page button:hover,
body.support-page button:hover,
body.terms-page button:hover,
body.dashboard-page .upload-btn:hover,
body.dashboard-page .market-btn:hover,
body.dashboard-page .header-action-btn:hover,
body.dashboard-page .auth-primary-btn:hover,
body.dashboard-page .doc-editor-toggle:hover,
body.landing-page .landing-button:hover,
body.support-page button:hover {
  border-color: var(--app-accent);
  background: #3c3c3c;
  box-shadow: 0 0 0 1px rgba(var(--app-accent-rgb), 0.16) inset, 0 8px 22px rgba(0, 0, 0, 0.3);
}

body.landing-page .landing-button-primary {
  border-color: var(--app-accent);
  color: #ffffff;
  background: var(--app-accent);
}

body.landing-page .landing-button-primary:hover {
  border-color: var(--app-accent-bright);
  color: #ffffff;
  background: var(--app-accent-bright);
}

body.landing-page .landing-button-secondary {
  border-color: var(--app-border-strong);
  color: var(--app-text);
  background: #333333;
}

body.dashboard-page input,
body.dashboard-page select,
body.dashboard-page textarea,
body.landing-page input,
body.landing-page select,
body.landing-page textarea,
body.support-page input,
body.support-page select,
body.support-page textarea,
body.terms-page input,
body.terms-page select,
body.terms-page textarea {
  border-color: var(--app-border);
  color: var(--app-text);
  background-color: #1e1e1e;
}

body.dashboard-page input:focus,
body.dashboard-page select:focus,
body.dashboard-page textarea:focus,
body.support-page input:focus,
body.support-page select:focus,
body.support-page textarea:focus {
  border-color: var(--app-accent);
  outline-color: var(--app-accent);
  box-shadow: 0 0 0 2px rgba(var(--app-accent-rgb), 0.16);
}

body.dashboard-page .sidebar,
body.dashboard-page .doc-editor-pane,
body.dashboard-page .clm-pane,
body.dashboard-page .security-pane,
body.dashboard-page .compare-pane,
body.dashboard-page .chat-header,
body.dashboard-page .chat-input,
body.dashboard-page .auth-card,
body.dashboard-page .landing-header,
body.landing-page .landing-header,
body.landing-page .landing-hero-card,
body.landing-page .feature-card,
body.landing-page .pricing-card,
body.landing-page .landing-final-cta,
body.landing-page .landing-stat-list li,
body.dashboard-page .message-card {
  border-color: var(--app-border) !important;
  background: #252526 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22) !important;
}

body.dashboard-page .chat-container {
  background: #1e1e1e !important;
}

body.dashboard-page .message.user {
  border-color: rgba(var(--app-accent-rgb), 0.42) !important;
  background: linear-gradient(90deg, rgba(var(--app-accent-rgb), 0.2), #252526 75%) !important;
}

body.dashboard-page .message.bot,
body.dashboard-page .message-card {
  border-color: var(--app-border) !important;
  background: #252526 !important;
}

body.dashboard-page .message-card-header {
  border-bottom-color: var(--app-border) !important;
  background: rgba(var(--app-accent-rgb), 0.1) !important;
}

body.dashboard-page .message-card-label,
body.dashboard-page .tool-phase-label,
body.dashboard-page .chat-header-subtitle,
body.dashboard-page .doc-editor-subtitle,
body.dashboard-page .clm-subtitle,
body.dashboard-page .clm-label,
body.landing-page .landing-eyebrow,
body.landing-page .landing-nav-link,
body.landing-page .pricing-tier {
  color: var(--app-muted) !important;
}

body.dashboard-page .logo,
body.landing-page .landing-brand {
  background: none !important;
  color: var(--app-accent-bright) !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: none !important;
}

body.dashboard-page .copy-btn,
body.dashboard-page .security-control-status,
body.dashboard-page .clm-status-pill {
  border-color: rgba(var(--app-accent-rgb), 0.38) !important;
  color: var(--app-accent-bright) !important;
  background: rgba(var(--app-accent-rgb), 0.1) !important;
}

body.dashboard-page .copy-btn:hover,
body.dashboard-page .copy-btn.copied,
body.dashboard-page .chat-input button,
body.dashboard-page .chat-input button:hover {
  border-color: var(--app-accent) !important;
  color: var(--app-accent-bright) !important;
  background: rgba(var(--app-accent-rgb), 0.14) !important;
  box-shadow: 0 0 0 1px rgba(var(--app-accent-rgb), 0.16) inset !important;
}

body.dashboard-page .security-control-status.warn,
body.dashboard-page .deal-stage-under_contract {
  border-color: var(--app-border-strong) !important;
  color: #c2c9c3 !important;
  background: rgba(170, 180, 172, 0.1) !important;
}

body.dashboard-page .tool-phase-fill {
  background: linear-gradient(90deg, #1474dc, var(--app-accent-bright)) !important;
}

body.dashboard-page .dropdown:focus,
body.dashboard-page select:focus,
body.dashboard-page input[type="text"]:focus {
  border-color: var(--app-accent) !important;
  box-shadow: 0 0 0 2px rgba(var(--app-accent-rgb), 0.16) !important;
}

body.dashboard-page .legal-del,
body.dashboard-page .clm-redline-preview .legal-del {
  border-color: var(--app-border-strong) !important;
  color: #b8c0ba !important;
  background: rgba(158, 168, 160, 0.1) !important;
}

body.dashboard-page .legal-compare-table tr.del td:first-child,
body.dashboard-page .legal-compare-table tr.change td {
  background: rgba(158, 168, 160, 0.08) !important;
}

body.dashboard-page button::after,
body.landing-page button::after,
body.support-page button::after,
body.terms-page button::after {
  content: none !important;
}

body.dashboard-page .pricing-card-featured {
  border-color: rgba(var(--app-accent-rgb), 0.5) !important;
  background: #252526 !important;
}

body.dashboard-page #realEstatePane {
  border-color: var(--app-border-strong) !important;
  color: var(--app-text) !important;
  background: #252526 !important;
}

body.dashboard-page #realEstatePane .security-header,
body.dashboard-page #realEstatePane .re-crm-panel,
body.dashboard-page #realEstatePane .re-company-item {
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
  background: #2d2d30 !important;
}

body.dashboard-page #realEstatePane input,
body.dashboard-page #realEstatePane select,
body.dashboard-page #realEstatePane textarea {
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
  background: #1e1e1e !important;
}

body.dashboard-page #realEstatePane button {
  border-color: var(--app-border-strong) !important;
  color: var(--app-text) !important;
  background: #333333 !important;
  box-shadow: none !important;
}

body.dashboard-page #realEstatePane button:hover {
  border-color: var(--app-accent) !important;
  color: var(--app-accent-bright) !important;
  background: #3c3c3c !important;
}

body.dashboard-page #gthreadStatusPanel,
body.dashboard-page #adminPaymentsTable {
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
  background: #252526 !important;
}

body.dashboard-page #adminPaymentsTable * {
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
  background-color: transparent !important;
}

body.dashboard-page #adminPaymentsTable pre {
  background: #1e1e1e !important;
}

body.landing-page .hero-panel-badge {
  border-color: rgba(var(--app-accent-rgb), 0.42) !important;
  color: var(--app-accent-bright) !important;
  background: rgba(var(--app-accent-rgb), 0.12) !important;
}

body.support-page .support-shell .hero,
body.support-page .support-shell .card,
body.terms-page .terms-document {
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
  background: linear-gradient(165deg, #191d1a, #111412) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24) !important;
}

body.support-page .support-shell .hero p,
body.support-page .support-shell .card p,
body.support-page .support-shell .card li,
body.support-page .support-shell .card label,
body.terms-page .terms-document p,
body.terms-page .terms-document li {
  color: var(--app-muted) !important;
}

body.support-page .support-brand,
body.support-page .support-links a,
body.terms-page .terms-brand,
body.terms-page .terms-header a,
body.terms-page .effective-date {
  color: var(--app-accent-bright) !important;
}

body.support-page .status-box {
  border-color: var(--app-accent) !important;
  color: var(--app-accent-bright) !important;
  background: rgba(116, 214, 154, 0.09) !important;
}

body.support-page .warn-box,
body.terms-page .important {
  border-color: var(--app-accent) !important;
  color: var(--app-text) !important;
  background: rgba(116, 214, 154, 0.08) !important;
}

body.terms-page .placeholder {
  color: var(--app-accent-bright) !important;
}

body.dashboard-page #balanceDisplay {
  border-color: rgba(var(--app-accent-rgb), 0.42) !important;
  color: var(--app-accent-bright) !important;
  background: rgba(var(--app-accent-rgb), 0.12) !important;
}

body.dashboard-page {
  color: #cccccc !important;
}

body.dashboard-page .sidebar,
body.dashboard-page .chat-header,
body.dashboard-page .chat-input,
body.dashboard-page .doc-editor-pane,
body.dashboard-page .clm-pane,
body.dashboard-page .security-pane,
body.dashboard-page .compare-pane,
body.dashboard-page .auth-card,
body.dashboard-page #realEstatePane,
body.dashboard-page #gthreadStatusPanel,
body.dashboard-page #adminPaymentsTable {
  color: #cccccc !important;
  background-color: #252526 !important;
}

body.dashboard-page #realEstatePane .security-header,
body.dashboard-page #realEstatePane .re-crm-panel,
body.dashboard-page #realEstatePane .re-company-item {
  background: #2d2d30 !important;
}

body.dashboard-page #realEstatePane input,
body.dashboard-page #realEstatePane select,
body.dashboard-page #realEstatePane textarea {
  background: #1e1e1e !important;
}

body.dashboard-page .sidebar button,
body.dashboard-page .chat-header button,
body.dashboard-page .upload-btn,
body.dashboard-page .market-btn,
body.dashboard-page .header-action-btn,
body.dashboard-page .doc-editor-toggle,
body.landing-page .landing-button-secondary {
  border-color: var(--app-border-strong) !important;
  color: #cccccc !important;
  background: #333333 !important;
}

body.dashboard-page .sidebar button:hover,
body.dashboard-page .chat-header button:hover,
body.dashboard-page .upload-btn:hover,
body.dashboard-page .market-btn:hover,
body.dashboard-page .header-action-btn:hover,
body.dashboard-page .doc-editor-toggle:hover,
body.landing-page .landing-button-secondary:hover {
  border-color: var(--app-accent) !important;
  color: #ffffff !important;
  background: #3c3c3c !important;
}

body.landing-page {
  color: #cccccc !important;
}

body.landing-page .landing-header,
body.landing-page .landing-hero-card,
body.landing-page .feature-card,
body.landing-page .pricing-card,
body.landing-page .landing-final-cta {
  color: #cccccc !important;
  background-color: #252526 !important;
}

body.dashboard-page .message.user,
body.dashboard-page .message.bot,
body.dashboard-page .message-card {
  color: #cccccc !important;
}

body.dashboard-page .chat-input button,
body.dashboard-page .chat-input button:hover,
body.landing-page .landing-button-primary {
  color: #ffffff !important;
}

/* Spinner/scan animations only exist while a response is actually in progress. */
.tool-phase-wrap {
  display: none;
}

.tool-phase-wrap.active {
  display: block;
}

.message-card-body:not(.streaming) .stream-cursor {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .tool-phase-label::before,
  .tool-phase-fill,
  .stream-cursor {
    animation: none !important;
  }
}

body.dashboard-page,
body.landing-page {
  scrollbar-color: var(--app-accent) #252526;
  scrollbar-width: thin;
}

body.dashboard-page *::-webkit-scrollbar,
body.landing-page *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.dashboard-page *::-webkit-scrollbar-track,
body.landing-page *::-webkit-scrollbar-track {
  background: #252526;
}

body.dashboard-page *::-webkit-scrollbar-thumb,
body.landing-page *::-webkit-scrollbar-thumb {
  border: 2px solid #252526;
  border-radius: 6px;
  background: var(--app-accent);
}

body.dashboard-page *::-webkit-scrollbar-thumb:hover,
body.landing-page *::-webkit-scrollbar-thumb:hover {
  background: var(--app-accent-bright);
}

@media (max-width: 760px) {
  .landing-scene-canvas {
    opacity: 0.14;
  }

  body.landing-page .landing-header {
    background: #252526 !important;
  }
}

/* Right-hand Chats dropdown panel */
.chats-panel {
  width: 240px;
  min-width: 200px;
  padding: 12px;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e1e1e;
}

.chats-dropdown-trigger {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #202020;
  color: #e7e7e7;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.chats-dropdown[open] > .chats-dropdown-trigger {
  margin-bottom: 8px;
}

@media (max-width: 960px) {
  .chats-panel {
    display: none;
  }
}

.chat-history-list li { display: flex; align-items: center; gap: 2px; }
.chat-history-list li .chat-history-item { flex: 1 1 auto; }
body.dashboard-page .chat-history-delete { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; box-shadow: none; font-size: 13px; opacity: 0; cursor: pointer; transition: opacity .15s, background .15s; }
.chat-history-list li:hover .chat-history-delete, .chat-history-delete:focus-visible { opacity: 1; }
body.dashboard-page .chat-history-delete:hover { background: #4a1f22; border: 0; box-shadow: none; }
@media (hover: none) { .chat-history-delete { opacity: .7; } }
