/* ==================================================================
   公众号助手 Web 版 —— 样式
   浅色主题，响应式（手机可用）
   ================================================================== */
:root {
  --accent: #07C160;
  --accent-dark: #06AD56;
  --accent-soft: #F0FBF5;
  --accent-bg: #F0FBF5;
  --text: #1F2329;
  --text-2: #646A73;
  --text-3: #8F959E;
  --line: #E5E6EB;
  --bg: #F5F6F7;
  --card: #FFFFFF;
  --danger: #F54A45;
  --warn: #FF8800;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 登录页 ---------------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: linear-gradient(150deg, #07C160 0%, #05994C 55%, #046E37 100%);
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 40px 36px 38px;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
  text-align: center;
}
.login-logo {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 16px;
  background: var(--accent); color: #fff; font-size: 26px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.login-card form { text-align: left; }

/* ---------------- 表单元素 ---------------- */
.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block; font-size: 13px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 500;
}
input[type=text], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  color: var(--text); background: #fff; transition: all .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, .12);
}
textarea { resize: vertical; line-height: 1.7; }
select { cursor: pointer; }

.err-msg { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 14px; font-family: inherit;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #C9CDD4; background: #FAFAFA; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: #FFD4D2; }
.btn-danger:hover { background: #FFF5F5; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ---------------- 布局 ---------------- */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; font-weight: bold; display: flex; align-items: center;
  justify-content: center; font-size: 15px; flex-shrink: 0;
}
.topbar .name { font-weight: 600; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--text-2); font-size: 13px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px; }

.tabs {
  display: flex; gap: 4px; background: #fff; padding: 4px;
  border-radius: 10px; margin-bottom: 18px; box-shadow: var(--shadow);
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: 108px; padding: 10px 14px; border-radius: 8px;
  text-align: center; cursor: pointer; font-size: 14px; color: var(--text-2);
  transition: all .15s; white-space: nowrap; user-select: none;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--accent); color: #fff; font-weight: 500; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-title {
  font-size: 16px; font-weight: 600; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.card-sub { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.row.tight > * { flex: 0 0 auto; min-width: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.pane { display: none; }
.pane.active { display: block; }

/* ---------------- 预览区 ---------------- */
.preview-phone {
  background: #EDEDED; border-radius: 12px; padding: 18px 0;
  max-height: 680px; overflow-y: auto;
}
.preview-inner {
  background: #fff; max-width: 400px; margin: 0 auto; padding: 22px 18px 40px;
  border-radius: 6px; min-height: 200px;
}
.preview-title {
  font-size: 21px; font-weight: bold; line-height: 1.4;
  margin-bottom: 8px; color: #1A1A1A; word-break: break-word;
}
.preview-meta { font-size: 12px; color: #9A9A9A; margin-bottom: 16px; }
.preview-digest {
  font-size: 13px; color: var(--text-2); background: #F7F7F7;
  padding: 10px 12px; border-radius: 6px; margin-bottom: 18px; line-height: 1.6;
}
.preview-body img { max-width: 100%; height: auto; border-radius: 6px; }

/* ---------------- 任务列表 ---------------- */
.task-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
  transition: all .15s;
}
.task-item:hover { border-color: #C9CDD4; background: #FAFAFA; }
.task-main { flex: 1; min-width: 0; }
.task-name {
  font-weight: 500; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-meta { font-size: 12px; color: var(--text-3); }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  font-size: 11px; margin-right: 6px; vertical-align: middle;
}
.tag-green { background: var(--accent-soft); color: var(--accent-dark); }
.tag-orange { background: #FFF4E6; color: #D46B08; }
.tag-blue { background: #EAF2FF; color: #2B6CB0; }
.tag-red { background: #FFF1F0; color: #CF1322; }
.task-error {
  margin-top: 5px; font-size: 12px; line-height: 1.5;
  color: #CF1322; background: #FFF1F0; border-radius: 5px;
  padding: 5px 8px; word-break: break-all;
}

/* ---------------- 提示与状态 ---------------- */
.alert {
  padding: 11px 14px; border-radius: 8px; font-size: 13px;
  margin-bottom: 14px; line-height: 1.7;
}
.alert-warn { background: #FFF7E6; color: #AD6800; border: 1px solid #FFE7BA; }
.alert-ok { background: var(--accent-soft); color: #06873F; border: 1px solid #B7F0CE; }
.alert-err { background: #FFF1F0; color: #CF1322; border: 1px solid #FFCCC7; }
.alert-info { background: #F0F5FF; color: #1D39C4; border: 1px solid #D6E4FF; }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; color: var(--text-3); padding: 34px 10px; font-size: 13px; }

.log-box {
  background: #1E1E1E; color: #D4D4D4; border-radius: 8px; padding: 12px 14px;
  font-family: Menlo, Consolas, monospace; font-size: 12px; line-height: 1.75;
  max-height: 260px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}

.records { font-size: 13px; }
.record {
  display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line);
}
.record:last-child { border-bottom: none; }
.record .t { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.record .c { flex: 1; min-width: 0; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-24px);
  background: #1F2329; color: #fff; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
  z-index: 999; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 88vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--accent); }

.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.mask.show { display: flex; }
.mask-box {
  background: #fff; border-radius: 12px; padding: 26px 30px;
  text-align: center; min-width: 220px;
}
.mask-box .spinner {
  width: 30px; height: 30px; border-width: 3px;
  border-color: rgba(7,193,96,.25); border-top-color: var(--accent);
  margin-bottom: 14px;
}

@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .card { padding: 16px; }
  .card-title { font-size: 15px; }
  .topbar { padding: 0 12px; }
  .topbar .name { font-size: 15px; }
  .tab { min-width: 92px; font-size: 13px; padding: 9px 10px; }
  .row > * { min-width: 100%; }
  .acct-switch { margin-left: 8px; }
  .acct-switch .acct-label { display: none; }
  .acct-switch select { min-width: 110px; max-width: 140px; }
  .mode-badge { display: none; }
}

/* ---------------- 整理方式选择弹窗 ---------------- */
.mode-ask-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.mode-ask {
  background: var(--card); border-radius: 14px; padding: 22px 20px 16px;
  width: 100%; max-width: 420px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
  animation: maIn .16s ease-out;
}
@keyframes maIn { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.mode-ask .ma-title { font-size: 16px; font-weight: 700; color: var(--text); }
.mode-ask .ma-sub { font-size: 13px; color: var(--text-3); margin: 6px 0 16px; line-height: 1.6; }
.mode-ask .ma-opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.mode-ask .ma-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.mode-ask .ma-opt b { display: block; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.mode-ask .ma-opt span { font-size: 12.5px; color: var(--text-3); line-height: 1.55; }
.mode-ask .ma-cancel {
  width: 100%; border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: 13px; padding: 8px; font-family: inherit;
}
.mode-ask .ma-cancel:hover { color: var(--text); }

/* ---------------- 排版工具条（主题 / 字号 / 行距 / 首行缩进）---------------- */
.layout-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 12px; margin: 0 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.layout-bar .lb-field {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2); white-space: nowrap;
}
/* 工具条里的下拉要「按内容自适应」，不能被全局的 width:100% 撑满 */
.layout-bar .lb-field select {
  width: auto; padding: 6px 10px; font-size: 13px; min-width: 84px;
}
.layout-bar .lb-field select#theme { min-width: 128px; }
.layout-bar .lb-check {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 13px; color: var(--text-2); white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.layout-bar .lb-check input[type=checkbox] {
  width: auto; margin: 0; cursor: pointer; accent-color: var(--accent);
}

/* 内嵌预览画布：底色跟随主题，切换时平滑过渡 */
#pvBody { transition: background .18s ease; border-radius: 6px; }

@media (max-width: 560px) {
  .layout-bar { gap: 8px 10px; }
  .layout-bar .lb-field { font-size: 12.5px; }
}
