/* TradeSync 7-F 前端深色主题（延续旧 web_ui.html 风格） */
:root {
  --bg: #0f172a;            /* 页面底色 */
  --card: #1e293b;          /* 卡片 */
  --border: #334155;        /* 边框 */
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;        /* 主色（旧 UI 点缀蓝） */
  --ok: #4ade80;
  --err: #f87171;
  --warn: #f59e0b;
  --input: #0f172a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }

/* ============ 滚动条（全站页面级 + 容器级统一深色协调） ============
   轨道透明 → 露出页面/面板深色底，不再出现浏览器原生浅灰轨道；
   滑块取 #334155（面板边框同色阶），hover/active 逐级提亮。
   Firefox 用标准属性，Chromium/Safari 用 ::-webkit-scrollbar。 */
* {
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #475569; background-clip: padding-box; }
::-webkit-scrollbar-thumb:active { background: #64748b; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ============ 布局 ============ */
.wrap { display: flex; gap: 16px; padding: 16px 24px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; }
.col { width: 300px; flex-shrink: 0; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; color: var(--accent); margin-bottom: 12px; }
.card > h2 + * { margin-top: 0; }

/* ============ 三步式（旧 UI 风格） ============ */
.step { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  color: #0f172a; font-weight: 700; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.step.collapsed .mod-inner { display: none; }
.mod-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none; }
.mod-header .name { font-weight: 600; font-size: 14px; }
.mod-header .desc { color: var(--muted); font-size: 12px; }
.mod-inner { padding: 0 14px 14px; border-top: 1px solid var(--border); }
.mod-controls-inline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; font-size: 12.5px; color: #cbd5e1;
}

/* ============ 表单 ============ */
label { font-size: 12px; color: #cbd5e1; display: block; margin: 10px 0 4px; }
input[type="text"], input[type="url"], input[type="number"], textarea, select {
  width: 100%; padding: 8px 10px; background: var(--input);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; font-family: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); }
.a-field { margin-bottom: 8px; }
.a-field label { margin: 8px 0 4px; font-weight: 600; color: #f1f5f9; }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.editor-box {
  background: #0f172a; border: 1px solid var(--border); border-radius: 6px;
  min-height: 140px; padding: 10px; font-size: 13px; line-height: 1.7;
}
.editor-box:focus { outline: 1px solid var(--accent); }

/* ============ 富文本编辑器（对齐旧 UI 工具栏 + 粘贴图片） ============ */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 6px;
  background: #1e293b; border: 1px solid var(--border); border-radius: 6px 6px 0 0;
}
.editor-toolbar button, .editor-toolbar select {
  background: #0f172a; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 4px; padding: 3px 8px; font-size: 12px; cursor: pointer;
}
.editor-toolbar button:hover { background: #334155; }
.editor-toolbar .tb-color {
  display: inline-flex; align-items: center; gap: 2px; background: #0f172a;
  border: 1px solid #334155; border-radius: 4px; padding: 2px 6px; cursor: pointer;
  position: relative; color: #f87171; font-size: 12px;
}
.editor-toolbar .tb-color input {
  position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%;
  cursor: pointer; padding: 0; border: none;
}
.editor-toolbar + .editor-wrap { border-radius: 0 0 6px 6px; }
.editor-wrap {
  background: #0f172a; border: 1px solid var(--border);
  min-height: 150px; padding: 10px; font-size: 13px; line-height: 1.7;
  outline: none; overflow-y: auto;
}
.editor-wrap:focus { border-color: var(--accent); }
.editor-wrap img { max-width: 100%; border-radius: 4px; }
.editor-wrap:empty::before { content: attr(data-ph); color: var(--muted); }
/* 源码编辑框（HTML 模式） */
.editor-source {
  display: none; width: 100%; min-height: 150px; background: #020617;
  border: 1px solid var(--border); border-radius: 0 0 6px 6px; padding: 10px;
  font-size: 12.5px; font-family: monospace; color: var(--text); resize: vertical;
}


/* 渠道专属配置区 */
.chan-fields { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.chan-fields-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
.chan-copy-status { font-size: 12px; }
.chan-copy-status[data-state="ok"] { color: var(--ok); }
.chan-copy-status[data-state="empty"] { color: var(--muted); }
.chan-copy-status[data-state="error"] { color: var(--err); }

/* 语言 tab */
.form-lang-tabs { display: flex; gap: 4px; margin: 12px 0 4px; }
.form-lang-tab {
  padding: 5px 14px; font-size: 12.5px; border-radius: 6px 6px 0 0;
  background: #0f172a; border: 1px solid var(--border); border-bottom: none;
  color: var(--muted); cursor: pointer;
}
.form-lang-tab.active { background: var(--accent); color: #0f172a; font-weight: 600; }
.form-lang-pane { display: none; }
.form-lang-pane.active { display: block; }

/* ============ 按钮 ============ */
button {
  background: var(--accent); color: #0f172a; border: none; padding: 8px 14px;
  border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600;
}
button:hover { opacity: .9; }
button.ghost { background: #334155; color: var(--text); }
button.ghost:hover { background: #475569; }
button.warn { background: var(--warn); color: #0f172a; }
button.danger { background: var(--err); color: #fff; }
button.mini { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.row-right { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 10px; }
.chk input { width: auto; }

/* ============ 预览卡片 ============ */
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pv-card { background: #0f172a; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.pv-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pv-card-name { font-size: 13px; font-weight: 600; color: var(--accent); }
.preview-lang-tabs { display: flex; gap: 4px; }
.preview-lang-tab {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: #1e293b; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
}
.preview-lang-tab.active { background: var(--accent); color: #0f172a; font-weight: 700; }
.pv-lang-content { display: none; font-size: 13px; line-height: 1.7; }
.pv-lang-content.active { display: block; }
.pv-title { font-size: 16px; margin-bottom: 6px; }
.pv-cover { max-width: 100%; border-radius: 6px; margin-bottom: 6px; }
.fb-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.fb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #0f172a; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.fb-name { font-size: 13px; font-weight: 600; }
.fb-sub { font-size: 11px; color: var(--muted); }
.fb-msg { font-size: 13px; margin-bottom: 6px; }
.fb-photos img { max-width: 100%; border-radius: 6px; margin-bottom: 4px; }
.fb-linkcard { display: flex; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 6px; text-decoration: none; }
.lk-img { width: 56px; height: 56px; background: var(--card); border-radius: 6px; background-size: cover; }
.lk-domain { font-size: 11px; color: var(--muted); }
.lk-title { font-size: 12.5px; color: var(--text); }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.status-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.status-tag.ok { background: #14532d; color: var(--ok); }
.status-tag.err { background: #7f1d1d; color: var(--err); }
.status-tag.warn { background: #78350f; color: var(--warn); }
.status-tag.muted { background: #334155; color: var(--muted); }
.status-tag.dry { background: #0c4a6e; color: #7dd3fc; }

/* ============ 输出 / 日志 ============ */
pre, #mkt-log {
  background: #020617; color: #e2e8f0; padding: 12px; border-radius: 8px;
  font-size: 12px; overflow: auto; max-height: 320px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
}
.hint {
  background: #0c4a6e; border: 1px solid #075985; color: #bae6fd;
  padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 10px;
}
.hint.warn { background: #78350f; border-color: #92400e; color: #fde68a; }
.status { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.tag.ok { color: var(--ok); font-weight: 700; }
.tag.err { color: var(--err); font-weight: 700; }

/* ============ 首页工作台（3 主板块卡横向 + 工具入口行） ============ */
.home-wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }
.home-hero { padding: 6px 4px 4px; margin-bottom: 18px; }
.home-hero h1 { font-size: 24px; margin: 0 0 6px; }
.home-hero p { font-size: 13px; color: var(--muted); margin: 0; }

.grid-home {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; padding: 0; align-items: stretch;
}
@media (max-width: 960px) { .grid-home { grid-template-columns: 1fr; } }
.home-card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px; text-decoration: none; color: var(--text);
  transition: border-color .15s;
}
.home-card:hover { border-color: var(--accent); }
.home-card h3 { font-size: 17px; margin: 0 0 6px; color: var(--accent); }
.home-card .home-sub { font-size: 13px; color: var(--text); line-height: 1.6; margin: 0 0 12px; }
.home-card .home-tip { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; }
.home-card .home-plan {
  font-size: 12px; color: var(--muted); line-height: 1.6; margin: 12px 0 0;
  border-top: 1px dashed var(--border); padding-top: 10px; opacity: .85;
}
.home-card .pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.home-card .pill {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: rgba(56, 189, 248, .12); color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, .25);
}

/* 板块占位 */
.placeholder { border: 1px dashed var(--border); border-radius: 10px; padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13px; }
