/* 智能发布系统 - 界面样式 */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-h: #1d4ed8;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.layout { display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar {
  width: 220px; flex-shrink: 0; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; gap: 10px; align-items: center; padding: 20px 16px; border-bottom: 1px solid #1e293b; }
.logo-icon {
  width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg,#3b82f6,#2563eb);
  color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.logo-title { color: #fff; font-size: 15px; font-weight: 600; }
.logo-sub { font-size: 11px; color: #64748b; margin-top: 2px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px;
  color: #94a3b8; cursor: pointer; user-select: none; transition: all .15s; font-size: 14px;
}
.nav a:hover { background: #1e293b; color: #e2e8f0; }
.nav a.active { background: #2563eb; color: #fff; }
.nav .ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-foot { padding: 14px 16px; font-size: 11px; color: #475569; border-top: 1px solid #1e293b; }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.content { padding: 24px; }

/* 卡片 & 统计 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .lbl { color: var(--muted); font-size: 12px; }
.stat.blue .num { color: var(--accent); } .stat.green .num { color: var(--green); }
.stat.orange .num { color: var(--orange); } .stat.red .num { color: var(--red); }

/* 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 13px; transition: all .15s;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
.td-actions .btn { margin: 0 4px 4px 0; }
.muted { color: var(--muted); }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* inline 元素(span 等)需块级化省略号才生效,长文本不再折行 */
.ellipsis:not(td) { display: block; }
/* 任务表格:固定布局铺满 100% 宽,列宽可控,不出横向滚动条 */
table.fit { table-layout: fixed; }
table.fit th, table.fit td { overflow-wrap: break-word; }
.w55 { width: 55px; } .w110 { width: 110px; } .w135 { width: 135px; } .w180 { width: 180px; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; line-height: 18px; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.gray { background: #e2e8f0; color: #475569; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }

/* 开关 */
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { display: none; }
.switch i {
  position: absolute; inset: 0; border-radius: 20px; background: #cbd5e1; transition: .2s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: .2s;
}
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { left: 18px; }

/* 表单 */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form-item label b { color: var(--text); font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
input[type=text], input[type=password], input[type=number], input[type=time], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  font-size: 13px; color: var(--text); background: #fff; outline: none; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea { resize: vertical; min-height: 70px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.checks label { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; color: var(--text); }

/* 发布字段配置表(任务弹窗) */
.field-grid { display: grid; grid-template-columns: 110px 108px 1fr; gap: 8px 10px; align-items: center; }
.field-grid .f-name { font-size: 13px; color: var(--text); }
.field-grid .f-name small { display: block; color: var(--muted); font-size: 11px; }
.field-grid select { padding: 6px 8px; }
.field-grid input { padding: 6px 10px; }
.field-grid input:disabled { background: #f6f7f9; color: var(--muted); }

/* 侧边栏用户区(登录页独立于 /login,不在此处) */
.auth-user { color: #cbd5e1; }
.auth-ops a { color: #94a3b8; cursor: pointer; text-decoration: none; }
.auth-ops a:hover { color: #fff; }

/* 任务内容预览 */
.preview-loading { padding: 40px 0; text-align: center; color: var(--muted); font-size: 14px; }
.preview-meta { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.preview-meta .muted { font-size: 12px; margin-top: 4px; line-height: 1.8; }
.pv-title { font-size: 17px; font-weight: 700; color: var(--text); }
.pv-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pv-tag { font-size: 11px; color: var(--muted); background: #f1f5f9;
  border-radius: 4px; padding: 3px 8px; }
.pv-tag b { color: var(--text); font-weight: 600; margin-right: 4px; }
.preview-body { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 18px 22px; font-size: 14px; line-height: 1.9; color: var(--text); }
.preview-body p { margin: 0 0 12px; }
.preview-body img { max-width: 100%; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none;
  align-items: flex-start; justify-content: center; z-index: 100; overflow-y: auto; padding: 40px 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 720px; padding: 24px 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: pop .18s ease;
}
.modal.wide { max-width: 900px; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 16px; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 目标选择行 */
.target-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }

/* 站点卡片列表 */
.site-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.site-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.site-card .site-name { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.site-card .site-url { color: var(--muted); font-size: 12px; margin: 6px 0 10px; word-break: break-all; }
.site-card .site-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.7; }
.site-card .site-ops { display: flex; flex-wrap: wrap; gap: 8px; }
.cols-box { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.cols-box code { background: var(--bg); padding: 1px 6px; border-radius: 4px; }

/* Toast */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px;
  max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slide .2s ease; line-height: 1.5;
}
.toast.err { background: #991b1b; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 快速开始 */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.quick .q { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px 16px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.quick .q b { display: block; color: var(--text); margin-bottom: 4px; }
.quick .q b em { font-style: normal; color: var(--accent); margin-right: 6px; }

/* 内容预览 */
.preview-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.result-list { margin-top: 12px; font-size: 13px; line-height: 2; }
.result-list .ok { color: var(--green); } .result-list .no { color: var(--red); }

/* 分页与筛选 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar input { width: auto; }
.toolbar .grow { flex: 1; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* AI 供应商快速选择 */
.provider-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip {
  border: 1px solid var(--line); background: #f8fafc; color: var(--text);
  padding: 6px 13px; border-radius: 20px; cursor: pointer; font-size: 12px;
  transition: all .15s; font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
