:root {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --line: #c7d4e2;
  --text: #162436;
  --muted: #5d7187;
  --cyan: #087c76;
  --blue: #246cc7;
  --amber: #996000;
  --red: #b4233a;
}

html[data-theme="light"] body {
  background: linear-gradient(145deg, #f8fbff, #eef4fa 48%, #e8f0f7) !important;
  color: var(--text) !important;
}

html[data-theme="light"] header {
  background: rgba(248, 251, 255, .94) !important;
}

html[data-theme="light"] nav,
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] option,
html[data-theme="light"] textarea,
html[data-theme="light"] button,
html[data-theme="light"] .output,
html[data-theme="light"] .activitylog,
html[data-theme="light"] .syncstat,
html[data-theme="light"] .job,
html[data-theme="light"] .message.assistant,
html[data-theme="light"] .progress-metric {
  background: #f7fafd !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #71849a !important;
  opacity: 1;
}

html[data-theme="light"] input:disabled,
html[data-theme="light"] select:disabled,
html[data-theme="light"] textarea:disabled,
html[data-theme="light"] button:disabled {
  background: #e5edf5 !important;
  color: #64778b !important;
  opacity: 1;
}

html[data-theme="light"] .card,
html[data-theme="light"] .box {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
  box-shadow: 0 12px 32px rgba(43, 73, 103, .12) !important;
}

html[data-theme="light"] .message.user,
html[data-theme="light"] nav a:hover,
html[data-theme="light"] nav a.active,
html[data-theme="light"] .tab.active,
html[data-theme="light"] .solver-row.active {
  background: #dcecf5 !important;
  color: var(--text) !important;
}

html[data-theme="light"] .bar,
html[data-theme="light"] .progress-track {
  background: #d9e4ee !important;
}

html[data-theme="light"] .workspace-sidebar,
html[data-theme="light"] .family-bar,
html[data-theme="light"] .messages,
html[data-theme="light"] .knowledge-gap,
html[data-theme="light"] .attachment,
html[data-theme="light"] .upload-button,
html[data-theme="light"] .capability-bar,
html[data-theme="light"] .voice-studio,
html[data-theme="light"] .voice-sample-guide,
html[data-theme="light"] .voice-sample-row,
html[data-theme="light"] .camera-preview,
html[data-theme="light"] .trace-panel,
html[data-theme="light"] .message-trace,
html[data-theme="light"] .source-list,
html[data-theme="light"] .specialist-responses,
html[data-theme="light"] .progress-panel,
html[data-theme="light"] .solver-row,
html[data-theme="light"] .capability-suggestion,
html[data-theme="light"] .message-body code,
html[data-theme="light"] .message-body pre,
html[data-theme="light"] .item:hover {
  background: #f5f9fc !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="light"] .workspace-item:hover,
html[data-theme="light"] .workspace-item.active,
html[data-theme="light"] .voice-mode.active {
  background: #dcecf5 !important;
  color: #17374b !important;
  border-color: #79aabc !important;
}

html[data-theme="light"] .attachment-progress-track {
  background: #d4e1ec !important;
}

html[data-theme="light"] .message-body h3,
html[data-theme="light"] .message-body h4,
html[data-theme="light"] .source-response,
html[data-theme="light"] .message-trace summary,
html[data-theme="light"] .capability-suggestion h4,
html[data-theme="light"] .capability-count,
html[data-theme="light"] .jobmix,
html[data-theme="light"] .badge {
  color: #24445b !important;
}

html[data-theme="light"] table,
html[data-theme="light"] td,
html[data-theme="light"] th,
html[data-theme="light"] fieldset {
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="light"] a,
html[data-theme="light"] .muted {
  color: var(--muted);
}

.obi-theme-control {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 10000;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line, #20334c);
  border-radius: 12px;
  background: var(--panel, #0d1b2d);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
}

.obi-theme-control button {
  min-width: 38px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent !important;
  color: var(--muted, #8ea5bd) !important;
  font: 12px/1.2 Inter, "Segoe UI", sans-serif;
}

.obi-theme-control button[aria-pressed="true"] {
  border-color: var(--cyan, #39d8ca);
  color: var(--text, #e8f0fa) !important;
  background: color-mix(in srgb, var(--cyan, #39d8ca) 16%, transparent) !important;
}

@media (max-width: 620px) {
  .obi-theme-control { right: 8px; bottom: 8px; }
  .obi-theme-control button { min-width: 34px; padding: 6px; }
  .obi-theme-label { display: none; }
}
