/* ══════════════════════════════════════════════════════════════
   IMC MediaBrain — 白天模式（浅色主题）覆盖层
   ------------------------------------------------------------------
   黑夜模式（默认）为各页面原生样式，本文件不做改动。
   白天模式通过给 <html> 设置 data-theme="light"（由 js/theme.js 负责）
   后整体生效。所有规则都以 html[data-theme="light"] 前缀，其特异性
   高于页面内的 :root（变量翻转）与裸 body 选择器，因此无需修改各页面
   即可覆盖：
     · 719+ 处 var(--xxx) 用法（翻转 CSS 变量即可）
     · body 背景渐变 / 网格、导航栏、下拉菜单、登录卡片
     · nav.js 注入的高管监控弹窗、任务悬浮卡片
     · media-lib.js 媒体库弹窗
     · 通用输入框 / 下拉 / 滚动条等
   ══════════════════════════════════════════════════════════════ */

/* ── 0. 表面色 RGB 变量 ──
   各页面把暗色表面色以字面量硬编码（rgba(10,24,37,x) 面板 / rgba(6,16,26,x)
   深色区 / rgba(5,12,18,x) 输入框 / rgba(255,255,255,x) 边框与悬浮）。
   将这些字面量改写为 rgba(var(--c-xxx), x) 后，暗色默认值与原值完全一致
   （暗色外观不变），白天模式只需翻转下列变量即可整体变浅。
   暗色默认值（theme.css 全站加载，故 :root 即可保证每页都有） */
:root {
  --c-panel: 10, 24, 37;
  --c-deep: 6, 16, 26;
  --c-input: 5, 12, 18;
  --c-edge: 255, 255, 255;
  --c-bar: 30, 55, 78;   /* 工具栏 / 次级表面 */
}

/* ── 1. 核心 CSS 变量（覆盖各页面 :root 暗色调色板） ── */
html[data-theme="light"] {
  color-scheme: light;
  --c-panel: 255, 255, 255;
  --c-deep: 246, 249, 252;
  --c-input: 255, 255, 255;
  --c-edge: 26, 54, 78;
  --c-bar: 228, 236, 244;
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(20, 50, 75, 0.14);
  --text: #16242f;
  --muted: #5b6c7a;
  --accent: #0c9b8d;        /* 暗色用浅青 #4ed9c8，浅底需加深以保证对比度 */
  --warm: #cf8526;
  --danger: #d9484b;
  --shadow: 0 18px 50px rgba(70, 100, 130, 0.16);
}

/* ma.php 的扩展变量 */
html[data-theme="light"] {
  --surface: rgba(255, 255, 255, 0.9);
  --surface2: rgba(243, 247, 251, 0.95);
  --border: rgba(20, 50, 75, 0.14);
  --border-hover: rgba(20, 50, 75, 0.26);
  --text-dim: #5b6c7a;
  --text-muted: #8190a0;
  --accent-dim: rgba(12, 155, 141, 0.1);
  --danger-dim: rgba(217, 72, 75, 0.1);
  --blue: #2f6fd6;
  --blue-dim: rgba(47, 111, 214, 0.1);
  --green: #1f9d57;
}

/* ── 2. 全局基础：背景渐变 / 网格 / 链接 ── */
html[data-theme="light"] body {
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(12, 155, 141, 0.1), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(207, 133, 38, 0.1), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(120, 170, 210, 0.2), transparent 42%),
    linear-gradient(180deg, #f4f8fc 0%, #e9f0f7 50%, #eef3f8 100%);
}
html[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(20, 50, 75, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 50, 75, 0.05) 1px, transparent 1px);
  opacity: 0.5;
}

/* ── 3. 导航栏（nav.css） ── */
html[data-theme="light"] .site-nav {
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, 0.86);
}
html[data-theme="light"] .nav-link:hover {
  color: var(--text);
  background: rgba(20, 50, 75, 0.06);
}
html[data-theme="light"] .nav-link.active {
  color: var(--accent);
  background: rgba(12, 155, 141, 0.1);
  border-color: rgba(12, 155, 141, 0.28);
}
html[data-theme="light"] .nav-icon-btn:hover {
  color: var(--text);
  background: rgba(20, 50, 75, 0.06);
}
html[data-theme="light"] .nav-icon-btn[data-tip]::after {
  background: rgba(255, 255, 255, 0.97);
  border-color: var(--line);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(70, 100, 130, 0.18);
}
html[data-theme="light"] .nav-user-menu,
html[data-theme="light"] .nav-ai-menu {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 40px rgba(70, 100, 130, 0.22);
}
html[data-theme="light"] .nav-user-menu.open,
html[data-theme="light"] .nav-ai-menu.open {
  border-color: rgba(12, 155, 141, 0.5);
  box-shadow:
    0 0 0 1px rgba(12, 155, 141, 0.18),
    0 12px 40px rgba(70, 100, 130, 0.22),
    0 0 22px rgba(12, 155, 141, 0.14);
}
html[data-theme="light"] .nav-user-menu-item,
html[data-theme="light"] .nav-ai-menu-item {
  color: var(--text);
}
html[data-theme="light"] .nav-user-menu-item:hover,
html[data-theme="light"] .nav-ai-menu-item:hover {
  background: rgba(20, 50, 75, 0.06);
  color: var(--accent);
}

/* ── 4. 登录 / 注册 / 重置（common.css） ── */
html[data-theme="light"] .login-overlay {
  background:
    radial-gradient(circle at 10% 10%, rgba(12, 155, 141, 0.1), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(207, 133, 38, 0.1), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(120, 170, 210, 0.2), transparent 42%),
    linear-gradient(180deg, #f4f8fc 0%, #e9f0f7 50%, #eef3f8 100%);
}
html[data-theme="light"] .login-card {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.7));
  box-shadow: 0 24px 70px rgba(70, 100, 130, 0.18);
}
html[data-theme="light"] .login-field input,
html[data-theme="light"] .login-captcha-row input {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
}
html[data-theme="light"] .login-field input:focus,
html[data-theme="light"] .login-captcha-row input:focus {
  border-color: rgba(12, 155, 141, 0.55);
}
html[data-theme="light"] .login-submit {
  background: linear-gradient(135deg, rgba(12, 155, 141, 0.95), rgba(9, 130, 118, 0.95));
  border-color: rgba(12, 155, 141, 0.5);
  color: #ffffff;
}
html[data-theme="light"] .login-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(13, 170, 154, 1), rgba(10, 145, 131, 1));
}
html[data-theme="light"] .hero-badge {
  border-color: rgba(12, 155, 141, 0.32);
  background: rgba(12, 155, 141, 0.08);
}

/* ── 5. nav.js 注入：高管变动监控弹窗（.ln-*） ── */
html[data-theme="light"] .ln-modal {
  background: #ffffff;
  border-color: rgba(12, 155, 141, 0.28);
  box-shadow: 0 20px 60px rgba(70, 100, 130, 0.28);
}
html[data-theme="light"] .ln-head {
  background: #f3f7fb;
  border-bottom-color: rgba(12, 155, 141, 0.18);
}
html[data-theme="light"] .ln-head-title { color: var(--text); }
html[data-theme="light"] .ln-x { color: var(--muted); }
html[data-theme="light"] .ln-x:hover { color: var(--text); background: rgba(20, 50, 75, 0.06); }
html[data-theme="light"] .ln-body { color: #3a4a57; }
html[data-theme="light"] .ln-desc {
  background: rgba(12, 155, 141, 0.07);
  color: #2f3e4a;
}
html[data-theme="light"] .ln-stat {
  background: #f3f7fb;
  border-color: rgba(12, 155, 141, 0.18);
}
html[data-theme="light"] .ln-stat-label { color: var(--muted); }
html[data-theme="light"] .ln-stat-value { color: var(--text); }
html[data-theme="light"] .ln-stat-value.ln-accent { color: var(--accent); }
html[data-theme="light"] .ln-section-label { color: #5a8294; }
html[data-theme="light"] .ln-url-list { border-color: rgba(12, 155, 141, 0.18); }
html[data-theme="light"] .ln-url-list li { border-bottom-color: rgba(12, 155, 141, 0.1); }
html[data-theme="light"] .ln-url-list li:nth-child(odd) { border-right-color: rgba(12, 155, 141, 0.1); }
html[data-theme="light"] .ln-url-list a { color: #2a7689; }
html[data-theme="light"] .ln-url-list a:hover { background: rgba(12, 155, 141, 0.08); color: var(--accent); }

/* ── 6. nav.js 注入：任务进度悬浮卡片（.task-card / .tc-*） ── */
html[data-theme="light"] .task-card {
  background: #ffffff;
  border-color: rgba(12, 155, 141, 0.22);
  box-shadow: 0 8px 24px rgba(70, 100, 130, 0.16);
}
html[data-theme="light"] .task-card.is-system { border-color: rgba(12, 155, 141, 0.45); }
html[data-theme="light"] .task-card.is-done { border-color: rgba(12, 155, 141, 0.5); }
html[data-theme="light"] .task-card.is-failed { border-color: rgba(217, 72, 75, 0.5); }
html[data-theme="light"] .task-card .tc-title { color: var(--text); }
html[data-theme="light"] .task-card .tc-stage { background: rgba(20, 50, 75, 0.06); color: #5a8294; }
html[data-theme="light"] .task-card.is-system .tc-stage { color: var(--accent); background: rgba(12, 155, 141, 0.12); }
html[data-theme="light"] .task-card .tc-stage.done { color: var(--accent); background: rgba(12, 155, 141, 0.14); }
html[data-theme="light"] .task-card .tc-stage.failed { color: var(--danger); background: rgba(217, 72, 75, 0.12); }
html[data-theme="light"] .task-card .tc-msg { color: #5a8294; }
html[data-theme="light"] .task-card .tc-bar-wrap { background: rgba(20, 50, 75, 0.1); }
html[data-theme="light"] .task-card .tc-bar { background: var(--accent); }
html[data-theme="light"] .task-card .tc-bar.failed { background: var(--danger); }
html[data-theme="light"] .task-card .tc-time { color: var(--muted); }
html[data-theme="light"] .task-card .tc-chip {
  color: #5a8294;
  background: rgba(20, 50, 75, 0.05);
  border-color: rgba(20, 50, 75, 0.1);
}
html[data-theme="light"] .task-card.is-system .tc-chip {
  color: #3a8d82;
  background: rgba(12, 155, 141, 0.08);
  border-color: rgba(12, 155, 141, 0.18);
}
html[data-theme="light"] .task-card .tc-btn {
  color: #5a8294;
  border-color: rgba(20, 50, 75, 0.18);
}
html[data-theme="light"] .task-card .tc-btn:hover { color: var(--text); background: rgba(20, 50, 75, 0.06); }
html[data-theme="light"] .task-card .tc-btn.primary { color: var(--accent); border-color: rgba(12, 155, 141, 0.4); }
html[data-theme="light"] .tc-toolbar .tc-collapse {
  color: #4a7286;
  background: #ffffff;
  border-color: rgba(20, 50, 75, 0.32);
  box-shadow: 0 2px 6px rgba(70, 100, 130, 0.18);
}
html[data-theme="light"] .tc-toolbar .tc-collapse:hover {
  color: var(--text);
  background: rgba(20, 50, 75, 0.05);
  border-color: rgba(20, 50, 75, 0.45);
}

/* ── 7. media-lib.js 媒体库弹窗 ── */
html[data-theme="light"] .media-modal,
html[data-theme="light"] .cleanup-dialog {
  background: rgba(255, 255, 255, 0.99);
}
html[data-theme="light"] .media-tab:hover { background: rgba(20, 50, 75, 0.06); }
html[data-theme="light"] .media-tab .tab-count { background: rgba(20, 50, 75, 0.1); }
html[data-theme="light"] .media-action-btn:hover,
html[data-theme="light"] .btn-cleanup-cancel:hover { background: rgba(20, 50, 75, 0.06); }
html[data-theme="light"] .media-item .media-meta .voice-badge { background: rgba(20, 50, 75, 0.07); color: var(--text); }
html[data-theme="light"] .cleanup-days-input { background: #ffffff; }

/* ── 8. 主题菜单选中态 / 钉住图标（nav.js 注入） ── */
html[data-theme="light"] .nav-theme-menu-item.active { color: var(--accent); background: rgba(12, 155, 141, 0.12); }
html[data-theme="light"] .nav-theme-pin:hover { color: var(--accent); background: rgba(20, 50, 75, 0.08); }
html[data-theme="light"] .nav-theme-pin.is-pinned { color: var(--accent); }

/* ── 9. 通用控件兜底（特异性高于页面内 .class 规则，可整体翻转） ── */
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] [contenteditable="true"],
html[data-theme="light"] [contenteditable=""] {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: var(--muted); }
html[data-theme="light"] select option { background: #ffffff; color: var(--text); }

/* 代码块 / 行内代码：浅底深字 */
html[data-theme="light"] body pre {
  background: #f3f6fa;
  border-color: var(--line);
}
html[data-theme="light"] body pre code { color: #1c3a44; }
html[data-theme="light"] body code.inline,
html[data-theme="light"] body :not(pre) > code {
  background: rgba(20, 50, 75, 0.07);
  color: #1c3a44;
}

/* 滚动条 */
html[data-theme="light"] ::-webkit-scrollbar-track { background: rgba(20, 50, 75, 0.04); }
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(20, 50, 75, 0.2);
  border-radius: 6px;
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(20, 50, 75, 0.32); }

/* 文本选区 */
html[data-theme="light"] ::selection { background: rgba(12, 155, 141, 0.22); color: #102028; }

/* ── 10. 主操作按钮（浅青/暖色渐变 + 近白文字，浅底会失效，改实心强调色） ── */
html[data-theme="light"] .cmp-primary-btn,
html[data-theme="light"] .dw-primary-btn,
html[data-theme="light"] .nt-primary,
html[data-theme="light"] .rn-primary,
html[data-theme="light"] .rw-primary-btn,
html[data-theme="light"] .tts-set-save,
html[data-theme="light"] .config-toolbar .toolbar-btn.primary,
html[data-theme="light"] .title-toolbar .toolbar-btn.primary,
html[data-theme="light"] .selection-bar .toolbar-btn.primary {
  background: linear-gradient(135deg, #11b3a2, #0c9b8d);
  border-color: rgba(12, 155, 141, 0.55);
  color: #ffffff;
}

/* ── 11. ma.php 纯白标题文字（浅底不可见） ── */
html[data-theme="light"] .header h1,
html[data-theme="light"] .card h2,
html[data-theme="light"] .member-card-name,
html[data-theme="light"] .modal h3 {
  color: var(--text);
}

/* ── 12. 纯十六进制深色对话框卡片 ── */
html[data-theme="light"] .cmp-dialog-box,
html[data-theme="light"] .dw-dialog-box,
html[data-theme="light"] .rw-card {
  background: #ffffff;
  border-color: rgba(12, 155, 141, 0.28);
  box-shadow: 0 24px 70px rgba(70, 100, 130, 0.22);
}

/* ── 13. 富文本编辑器 / 可编辑正文（页面将其强制为深色，浅色下改回白底） ── */
html[data-theme="light"] .content-card .lead-value[contenteditable="true"],
html[data-theme="light"] .content-card .body[contenteditable="true"],
html[data-theme="light"] .content-card .we-wrap {
  background: #ffffff;
}
html[data-theme="light"] .cmp-editor .w-e-text-container,
html[data-theme="light"] .rw-editor .w-e-text-container,
html[data-theme="light"] .content-card .we-editor .w-e-text-container {
  background: #ffffff !important;
}

/* ── 14. index.html 首页专属深色区块（英雄/徽标区、搜索工具栏、数据概览、档期卡片） ── */
html[data-theme="light"] .hero {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 246, 251, 0.86)),
    linear-gradient(180deg, rgba(20, 50, 75, 0.03), transparent);
}
html[data-theme="light"] .note-chip {
  background: rgba(207, 133, 38, 0.08);
  color: #9a5b12;
}
html[data-theme="light"] .hh-title-tip {
  background: rgba(255, 255, 255, 0.98);
}
html[data-theme="light"] .metric-card {
  background: rgba(255, 255, 255, 0.72);
}
html[data-theme="light"] .url-modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.98));
}
html[data-theme="light"] .toolbar {
  background: rgba(255, 255, 255, 0.82);
}
html[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.85);
}
html[data-theme="light"] .featured-item,
html[data-theme="light"] .page-card {
  background: rgba(255, 255, 255, 0.66);
}
html[data-theme="light"] .featured-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 246, 251, 0.98)),
    radial-gradient(circle at top right, rgba(207, 133, 38, 0.12), transparent 45%);
}
/* 搜索框放大镜图标：硬编码浅蓝灰 #8ea7b8，浅色白底上对比度过低 */
html[data-theme="light"] .search-box::before { border-color: var(--muted); }
html[data-theme="light"] .search-box::after { background: var(--muted); }
/* 搜索框聚焦边框：默认浅青 rgba(78,217,200,.5) 在浅底上过淡，改用加深强调色 */
html[data-theme="light"] .search-box input:focus { border-color: rgba(12, 155, 141, 0.55); }
/* 运行概览标题“运行概览”：硬编码浅色 #d5e3ed，浅底过浅 */
html[data-theme="light"] .hero-panel h2 { color: var(--text); }
/* 运行概览：副说明文字硬编码浅色 #cfe0ea，浅底过浅，改用 muted */
html[data-theme="light"] .metric-sub { color: var(--muted); }
/* Daily Digest / No Data 徽标：硬编码 #d9e7ef 浅底几乎不可见 */
html[data-theme="light"] .featured-kicker {
  color: var(--muted);
  background: rgba(20, 50, 75, 0.06);
  border-color: rgba(20, 50, 75, 0.12);
}
/* 全部档期时间徽标（如 08:00）：硬编码近白文字 #f3fbff 在浅色渐变底上不可读 */
html[data-theme="light"] .hour-badge {
  color: #0c6c63;
  background: linear-gradient(135deg, rgba(12, 155, 141, 0.16), rgba(207, 133, 38, 0.14));
  border-color: rgba(12, 155, 141, 0.3);
}
/* Daily Digest / 全部档期 的“最近更新”时间：var(--muted) 偏浅，略加深提升可读性 */
html[data-theme="light"] .featured-meta,
html[data-theme="light"] .issue-meta { color: #46586a; }

/* ── 15. recommend.php 选题分类下拉 / remix.php 脚本·文章选项卡（独有深色） ── */
html[data-theme="light"] .ai-toolbar .toolbar-topic select {
  background: rgba(12, 155, 141, 0.08);
  border-color: rgba(12, 155, 141, 0.4);
}
html[data-theme="light"] .tab-bar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(238, 244, 250, 0.92) 100%);
  border-color: rgba(12, 155, 141, 0.28);
  border-top-color: rgba(12, 155, 141, 0.4);
  box-shadow: 0 4px 16px rgba(70, 100, 130, 0.12), inset 0 1px 0 rgba(12, 155, 141, 0.06);
}
/* 彩色链接按钮：浅色渐变 + 近白文字会失效，改实心/加深 */
html[data-theme="light"] .link-btn.primary {
  background: linear-gradient(135deg, #11b3a2, #0c9b8d);
  border-color: rgba(12, 155, 141, 0.5);
  color: #ffffff;
}
html[data-theme="light"] .link-btn.warm {
  background: rgba(207, 133, 38, 0.16);
  border-color: rgba(207, 133, 38, 0.42);
  color: #9a5b12;
}
html[data-theme="light"] .link-btn.violet {
  background: linear-gradient(135deg, #3b82f6, #2560c4);
  border-color: rgba(47, 111, 214, 0.5);
  color: #ffffff;
}
/* 重新扫描按钮：浅青渐变 + 近白文字，浅底失效，改实心强调色 */
html[data-theme="light"] .action-btn {
  background: linear-gradient(135deg, #11b3a2, #0c9b8d);
  border-color: rgba(12, 155, 141, 0.5);
  color: #ffffff;
}
