/* Dark mode. Loaded after the page styles; only active when <html data-theme="dark">. */
:root { --surface: #fff; }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1514;
  --surface: #17211f;
  --text: #e8f0ee;
  --muted: #9fb3af;
  --border: #2a3a37;
  --teal-dark: #6fd8c8;
  --error: #ff8a80;
}

html[data-theme="dark"] body { background: var(--bg); color: var(--text); }

html[data-theme="dark"] :is(.card, .form-card, .item-card, .chat-shell, .conv-item, .topnav,
  .google-btn, .secondary-btn, .danger-btn, .step, .quick a, .theme-opt, .tool-row) {
  background: var(--surface);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] ::placeholder { color: #6f827e; opacity: 1; }

html[data-theme="dark"] .topnav a.active,
html[data-theme="dark"] .topnav a:hover,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .status-badge.assistant,
html[data-theme="dark"] .step-num,
html[data-theme="dark"] .secondary-btn:hover { background: #1d2e2b; color: var(--teal-dark); }
html[data-theme="dark"] .step.done .step-num { background: var(--teal); color: #fff; }
html[data-theme="dark"] .badge.off,
html[data-theme="dark"] .status-badge.closed { background: #232d2b; color: var(--muted); }

html[data-theme="dark"] button:not(.secondary-btn):not(.danger-btn):not(.me-small):not(.google-btn):not(.theme-opt):not(.bell-btn):not(.nav-toggle):hover { background: #13897b; }
html[data-theme="dark"] .me-small { color: var(--teal-dark); border-color: var(--teal-dark); }
html[data-theme="dark"] .danger-btn { color: var(--error); }

html[data-theme="dark"] .item-desc { color: #cfd9d6; }
html[data-theme="dark"] .item-thumb { background: var(--bg); }
html[data-theme="dark"] .progress { background: #2a3a37; }
html[data-theme="dark"] .me-row { border-top-color: var(--border); }
html[data-theme="dark"] .me-field input,
html[data-theme="dark"] .me-field textarea { border-color: var(--border); }

html[data-theme="dark"] .msg-bubble.needs-human { background: #3a3210; border-color: #a06c00; }
html[data-theme="dark"] .status-badge.human { background: #3a2f10; color: #f2c14e; }
html[data-theme="dark"] .needs-human-tag { color: #f2c14e; }
html[data-theme="dark"] a { color: var(--teal-dark); }
html[data-theme="dark"] .step { color: var(--text); }
html[data-theme="dark"] .quick a { color: var(--teal-dark); }

/* Assistant bubbles get a soft teal tint so they differ from customer bubbles */
.msg.assistant .msg-bubble:not(.needs-human) { background: #e3f1ee; }
html[data-theme="dark"] .msg.assistant .msg-bubble:not(.needs-human) { background: #1d3a35; }

html[data-theme="dark"] :is(.bell-btn, .nav-toggle):hover { background: #1d2e2b; }
