/* The night variant preserves the working layout and IBM Plex Sans.
   Elevation uses neutral lightness steps; the existing blue remains the action hue. */
:root { color-scheme: light; }
.theme-control {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 37px; padding: 8px 12px; border: 1px solid var(--control, #c6d0de);
  border-radius: 6px; background: var(--surface, #fff); color: var(--text, #1b2b40);
  font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1.4;
  white-space: nowrap; cursor: pointer;
}
.theme-control svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-control:hover, .theme-control[aria-pressed="true"] { background: var(--active, #e9eff7); }
.theme-control:focus-visible { outline: 2px solid var(--accent, #173d68); outline-offset: 3px; }
.login-theme-tools { display: flex; justify-content: flex-end; margin-bottom: -10px; }
.document-theme-tools { display: flex; justify-content: flex-end; margin-bottom: 24px; }
html[data-theme="dark"] {
  color-scheme: dark; background: #17191d;
  --ground: #17191d; --surface: #202328; --raised: #282d34; --active: #2c333d;
  --border: #373e47; --rule: #30363e; --control: #6c7785;
  --text: #e0e5ed; --muted: #b2bbc9; --accent: #9ac2ea; --accent-soft: #273543;
  --negative: #f3adad; --warning: #e8c27b; --paper: #202328; --ink: #e0e5ed;
  color: var(--text);
}
html[data-theme="dark"] body { background: var(--ground); color: var(--text); }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar { background: var(--ground); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .inbox,
html[data-theme="dark"] .conversation-detail-head,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] dialog,
html[data-theme="dark"] .skip,
html[data-theme="dark"] .sample-message { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .conversation-list,
html[data-theme="dark"] .conversation-list-head,
html[data-theme="dark"] .conversation-reply-form,
html[data-theme="dark"] .whatsapp-simulator-messages,
html[data-theme="dark"] dialog .dialog-foot { background: var(--surface); }
html[data-theme="dark"] .callout-stat,
html[data-theme="dark"] .booking-summary,
html[data-theme="dark"] .code { background: var(--raised); }
html[data-theme="dark"] .canvas,
html[data-theme="dark"] .login-shell { background: var(--ground); }
html[data-theme="dark"] .nav a { color: var(--muted); }
html[data-theme="dark"] .nav a:hover,
html[data-theme="dark"] .nav a.active { color: var(--text); background: var(--active); }
html[data-theme="dark"] .nav .count { background: var(--raised); color: var(--text); }
html[data-theme="dark"] .nav-sep { background: var(--border); }
html[data-theme="dark"] .breadcrumb-sep { color: var(--muted); }
html[data-theme="dark"] .brand img,
html[data-theme="dark"] .initial-loading img { filter: brightness(0) invert(1); opacity: .88; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea { background: var(--surface); color: var(--text); border-color: var(--control); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #a5afbd; opacity: 1; }
html[data-theme="dark"] .workspace select { background: var(--raised); }
html[data-theme="dark"] .button,
html[data-theme="dark"] .slot-button { background: var(--surface); color: var(--text); border-color: var(--control); }
html[data-theme="dark"] .button:hover { background: var(--raised); }
html[data-theme="dark"] .button.primary,
html[data-theme="dark"] .chat-form .send { background: var(--accent); border-color: var(--accent); color: #15273a; }
html[data-theme="dark"] .button.primary:hover { background: #b2d4f3; border-color: #b2d4f3; }
html[data-theme="dark"] .button.dark { background: #d1dae6; color: #192633; border-color: #d1dae6; }
html[data-theme="dark"] .button.danger { color: var(--negative); border-color: #a36771; }
html[data-theme="dark"] .button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
html[data-theme="dark"] .button:disabled { opacity: .7; }
html[data-theme="dark"] .slot-button.selected { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] .day-button.selected { border-color: #6e92b6; }
html[data-theme="dark"] .data-table th { color: var(--muted); }
html[data-theme="dark"] .data-table tr:hover td { background: var(--raised); }
html[data-theme="dark"] .status.confirmed { background: #263b30; color: #abd8bb; }
html[data-theme="dark"] .status.pending,
html[data-theme="dark"] .status.handoff { background: #3a301f; color: #efd095; }
html[data-theme="dark"] .status.cancelled { background: #40282d; color: #f0b2b8; }
html[data-theme="dark"] .status.completed { background: #30363b; color: #c4cdd7; }
html[data-theme="dark"] .avatar { background: #304237; color: #c4ddca; }
html[data-theme="dark"] .avatar.a1 { background: #4a3830; color: #e9c3ad; }
html[data-theme="dark"] .avatar.a2 { background: #2e4050; color: #b8d8ed; }
html[data-theme="dark"] .avatar.a3 { background: #45384a; color: #dfc2e1; }
html[data-theme="dark"] .assistant-card { background: var(--accent-soft); }
html[data-theme="dark"] .assistant-card h2,
html[data-theme="dark"] .assistant-card p { color: #c6ddf3; }
html[data-theme="dark"] .assistant-note { color: #b6cce1; }
html[data-theme="dark"] .assistant-card .sample-message { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .assistant-card .button { background: var(--surface); color: var(--accent); border-color: var(--control); }
html[data-theme="dark"] .conversation-row:hover,
html[data-theme="dark"] .conversation-row.active { background: var(--active); }
html[data-theme="dark"] .category-chip.active,
html[data-theme="dark"] .success-mark { background: var(--accent-soft); color: var(--accent); border-color: var(--control); }
html[data-theme="dark"] .simulator-empty > span,
html[data-theme="dark"] .conversation-simulation-note { color: var(--muted); }
html[data-theme="dark"] .message.owner .message-meta { color: #b2cfbc; }
html[data-theme="dark"] .bubble { background: #2c333c; color: var(--text); }
html[data-theme="dark"] .message.user .bubble { background: #2b3c50; color: #d4e4f4; }
html[data-theme="dark"] .message.owner .bubble { background: #2d4035; color: #d2e5d7; }
html[data-theme="dark"] .chat-form input { background: var(--raised); }
html[data-theme="dark"] .chat-suggestions button { color: var(--accent); border-color: var(--control); }
html[data-theme="dark"] .notice,
html[data-theme="dark"] .handoff-alert { background: #273443; color: #cadaec; border-color: #617b97; }
html[data-theme="dark"] .notice.warning,
html[data-theme="dark"] .whatsapp-simulator-notice { background: #393020; color: #ebce96; border-color: #8a744a; }
html[data-theme="dark"] .form-error { background: #3d292d; color: var(--negative); }
html[data-theme="dark"] .demo-badge { background: var(--raised); color: var(--muted); border-color: var(--border); }
html[data-theme="dark"] .switch input { background: #505964; border-color: #89929e; }
html[data-theme="dark"] .switch input:checked { background: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] .switch input::before { background: #f0f3f7; }
html[data-theme="dark"] .switch input:checked::before { background: #15273a; }
html[data-theme="dark"] #toast { background: #d5e1ed; color: #172a3d; }
html[data-theme="dark"] dialog::backdrop { background: #05080cb8; }
html[data-theme="dark"] .shell.menu-open::before { background: #05080c99; }
html[data-theme="dark"] ::selection { background: #537595; color: #fff; }
html[data-theme="dark"] * { scrollbar-color: #778492 transparent; }
html[data-theme="dark"] .rc-document main { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .rc-document h2,
html[data-theme="dark"] .rc-document a { color: var(--accent); }
html[data-theme="dark"] .rc-document code,
html[data-theme="dark"] .rc-document pre,
html[data-theme="dark"] .rc-document th { background: var(--raised); color: var(--text); }
html[data-theme="dark"] .rc-document th,
html[data-theme="dark"] .rc-document td,
html[data-theme="dark"] .rc-document footer { border-color: var(--border); }
html[data-theme="dark"] .rc-document footer { color: var(--muted); }
@media (max-width: 640px) {
  .theme-control { min-height: 44px; }
  .topbar-right .theme-control { min-width: 44px; padding: 9px; }
  .topbar-right .theme-control span { display: none; }
  .topbar-right { gap: 8px; }
}
@media print {
  .theme-control, .login-theme-tools, .document-theme-tools { display: none !important; }
  html[data-theme="dark"], html[data-theme="dark"] body, html[data-theme="dark"] .rc-document main { background: #fff; color: #111; }
  html[data-theme="dark"] .rc-document :is(h2,a,code,pre,th,td,footer) { color: #111; background: #fff; border-color: #bbb; }
}
