/* Светлая тема v3: спокойный фон, белые карточки, мягкие тени, заметные состояния */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg-card: #ffffff;
  --bg-hover: #eef2f8;
  --border: #dfe5ee;
  --text: #1b2330;
  --muted: #5c6b7f;
  --primary: #6d28d9;
  --primary-2: #4f46e5;
  --pos: #0f9d58;
  --neg: #d93025;
  --warn: #b26a00;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 2px 6px rgba(16, 24, 40, .07), 0 10px 24px rgba(16, 24, 40, .06);
}

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

/* карточки-панели */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .editor-wrap,
html[data-theme="light"] .ai-panel {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
}

html[data-theme="light"] .agent-head { border-bottom: 1px solid var(--border) !important; padding-bottom: 8px; }
html[data-theme="light"] .chat-foot { border-top: 1px dashed var(--border) !important; color: var(--muted) !important; font-size: 12px; }

/* кнопки */
html[data-theme="light"] .btn,
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .composer-mode,
html[data-theme="light"] .chip-select {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
html[data-theme="light"] .btn:hover,
html[data-theme="light"] .icon-btn:hover,
html[data-theme="light"] .composer-mode:hover,
html[data-theme="light"] .chip-select:hover { background: var(--bg-hover) !important; border-color: #cfd8e6 !important; }
html[data-theme="light"] .btn:active,
html[data-theme="light"] .icon-btn:active { transform: translateY(1px); }
html[data-theme="light"] .btn.ghost { background: #fff !important; }

/* кнопка отправки: акцентная, с контуром (раньше «пропадала») */
html[data-theme="light"] #btn-chat-send {
  background: linear-gradient(180deg, #7c3aed, #6d28d9) !important;
  color: #fff !important;
  border: 1px solid #5b21b6 !important;
  box-shadow: 0 2px 6px rgba(109, 40, 217, .35), inset 0 1px 0 rgba(255, 255, 255, .25) !important;
}
html[data-theme="light"] #btn-chat-send:hover { background: linear-gradient(180deg, #8b5cf6, #7c3aed) !important; }
html[data-theme="light"] #btn-chat-send:disabled { background: #c7cbe0 !important; border-color: #b9bfd6 !important; box-shadow: none !important; }

/* поля ввода */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .area,
html[data-theme="light"] .name-input,
html[data-theme="light"] .tree-search {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
}
html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus {
  outline: none !important;
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .18) !important;
}
html[data-theme="light"] ::placeholder { color: #93a0b4 !important; }

/* редактор кода */
html[data-theme="light"] .editor { border: 1px solid var(--border) !important; background: #fbfcfe !important; }
html[data-theme="light"] .code-area,
html[data-theme="light"] #code,
html[data-theme="light"] .highlight,
html[data-theme="light"] .code { background: #fbfcfe !important; color: #1b2330 !important; }
html[data-theme="light"] .gutter { background: #f1f4f9 !important; color: #97a3b6 !important; border-right: 1px solid var(--border) !important; }
html[data-theme="light"] #code::selection { background: #dbeafe; }

/* вкладки файлов */
html[data-theme="light"] .tabs { background: #eef2f8 !important; }
html[data-theme="light"] .file-tab,
html[data-theme="light"] .tab {
  background: #fff !important; color: var(--muted) !important;
  border: 1px solid var(--border) !important; border-radius: 9px !important;
}
html[data-theme="light"] .file-tab.active,
html[data-theme="light"] .tab.active {
  background: #ede9fe !important; color: #4c1d95 !important;
  border-color: #c4b5fd !important; box-shadow: var(--shadow-sm);
}

/* список файлов */
html[data-theme="light"] .file-list li { color: var(--text) !important; border-radius: 9px; }
html[data-theme="light"] .file-list li:hover { background: var(--bg-hover) !important; }
html[data-theme="light"] .file-list li.active { background: #ede9fe !important; color: #4c1d95 !important; }

/* ЧАТ: сообщения различимы, ошибки видны */
html[data-theme="light"] .chat-box { background: #fbfcfe !important; border: 1px solid var(--border) !important; padding: 8px; }
html[data-theme="light"] .msg { border-radius: 12px !important; }
html[data-theme="light"] .msg.assistant {
  background: #f3f6fc !important; color: #16202e !important;
  border: 1px solid #e3eaf5 !important; box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .msg.user {
  background: #ede9fe !important; color: #2a1a4a !important;
  border: 1px solid #ddd6fe !important;
}
html[data-theme="light"] .msg.sys {
  background: #f7f9fc !important; color: #5c6b7f !important;
  border: 1px dashed #dfe5ee !important; font-size: 12.5px;
}
html[data-theme="light"] .msg.sys.err,
html[data-theme="light"] .msg.err,
html[data-theme="light"] .msg-status.failed {
  background: #fdecec !important; color: #a3231b !important;
  border: 1px solid #f6c9c5 !important; border-left: 3px solid var(--neg) !important;
}
html[data-theme="light"] .msg-status.delivered { color: var(--pos) !important; }
html[data-theme="light"] .reason-box { background: #f7f9fc !important; border: 1px solid var(--border) !important; border-radius: 10px !important; }
html[data-theme="light"] .reason-box summary { color: var(--muted) !important; }
html[data-theme="light"] .chat-actions .btn { background: #fff !important; }

/* «Рассуждения», шаги, предупреждения */
html[data-theme="light"] .steps,
html[data-theme="light"] .tool-step { background: #f7f9fc !important; border: 1px solid var(--border) !important; border-radius: 10px !important; color: #3c4a5d !important; }
html[data-theme="light"] .warn, html[data-theme="light"] .msg-status { color: var(--warn) !important; }

/* композер */
html[data-theme="light"] .composer { background: #fff !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow-md) !important; }


/* плашки, счётчики, статусы */
html[data-theme="light"] .pill { background: #eef2f8 !important; color: #4a5768 !important; }
html[data-theme="light"] .project-hint, html[data-theme="light"] .muted, html[data-theme="light"] .history-meta { color: var(--muted) !important; }
html[data-theme="light"] .problems .issue, html[data-theme="light"] .review .issue { background: #f7f9fc !important; border-left: 3px solid var(--warn) !important; color: #3c4a5d !important; }

/* скроллбар */
html[data-theme="light"] * { scrollbar-color: #c6d0de #f4f6fa; scrollbar-width: thin; }
html[data-theme="light"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="light"] ::-webkit-scrollbar-track { background: #f4f6fa; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c6d0de; border-radius: 8px; border: 2px solid #f4f6fa; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #aebbcd; }

/* ================= v4: голубой акцент, подсветка как в Notepad++, меню одной строкой ================= */
html[data-theme="light"] { --primary: #2563eb; --primary-2: #1d4ed8; }
html[data-theme="light"] #btn-chat-send {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255,255,255,.25) !important;
}
html[data-theme="light"] #btn-chat-send:hover { background: linear-gradient(180deg, #60a5fa, #3b82f6) !important; }
html[data-theme="light"] .self-chk input { accent-color: #2563eb; }
html[data-theme="light"] .self-chk.on { border-color: #2563eb !important; color: #1d4ed8 !important; }

/* редактор: текст рисует слой подсветки, сама textarea прозрачная (иначе подсветка не видна) */
html[data-theme="light"] .code, html[data-theme="light"] #code {
  color: transparent !important; caret-color: #1b2330 !important; background: transparent !important;
}
html[data-theme="light"] .highlight { background: #fbfcfe !important; }

/* палитра токенов как в Notepad++ (светлая) */
html[data-theme="light"] .tok-kw { color: #0033b3 !important; font-weight: 600; }
html[data-theme="light"] .tok-str { color: #067d17 !important; }
html[data-theme="light"] .tok-num { color: #1750eb !important; }
html[data-theme="light"] .tok-com { color: #8c8c8c !important; font-style: italic; }
html[data-theme="light"] .tok-var { color: #0f6f9c !important; }
html[data-theme="light"] .tok-cmd { color: #00627a !important; }

html[data-theme="light"] .btn, html[data-theme="light"] .icon-btn, html[data-theme="light"] .composer-mode, html[data-theme="light"] .chip-select { border-radius: 4px !important; }

/* сообщения пользователя: светло-голубые при отправке, светло-зелёные после доставки модели */
html[data-theme="light"] .msg.user { background: #e6f4ff !important; border-color: #b9dcff !important; color: #12324f !important; }
html[data-theme="light"] .msg.user.delivered { background: #e8f8ef !important; border-color: #b7e4c9 !important; color: #14402a !important; }
html[data-theme="light"] .msg.user.failed { background: #fdecec !important; border-color: #f6c9c5 !important; }

/* нижние служебные сообщения — плашки, чтобы не терялись */
html[data-theme="light"] #status {
  background: #eef4ff !important; color: #1b3a5c !important; border: 1px solid #d5e3fb !important;
  border-radius: 8px !important; padding: 5px 10px !important;
}
html[data-theme="light"] .editor-info > * {
  background: #eef4ff !important; color: #1b3a5c !important; border: 1px solid #d5e3fb !important;
  border-radius: 6px !important; padding: 2px 7px !important;
}

/* --- v5: подсказки читаемы, список чатов с прямыми углами --- */
html[data-theme="light"] .tooltip {
  background: #ffffff !important; color: #1b2330 !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .16) !important;
}
html[data-theme="light"] .session-select { border-radius: 4px !important; }
html[data-theme="light"] .chat-foot { color: var(--muted) !important; }
html[data-theme="light"] .chat-foot .agent-sub { color: #2b3a4d !important; }

html[data-theme="light"] #ps-quick { background: #fff !important; color: var(--text) !important; }


