/* ============================================================
   pf 营销云平台 · 青碧色专业设计系统
   设计语言：白底 / 细描边 / 低阴影 / 大留白 / 精致排版
   ============================================================ */
:root {
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;   /* 主色 */
  --teal-700: #0f766e;   /* 深主色 */
  --teal-800: #115e59;
  --teal-900: #134e4a;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --line:    #e2e8f0;
  --line-soft: #eef2f6;
  --bg:      #f7faf9;
  --white:   #ffffff;

  --gold:    #b45309;    /* 琥珀金：强调/数据 */
  --gold-soft: #fef3c7;
  --danger:  #dc2626;
  --success: #0d9488;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
  --shadow-hover: 0 4px 16px rgba(13,148,136,.10);
  --sidebar-w: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-700); text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, var(--teal-50), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #ecfdf5, transparent 55%),
    var(--white);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 8px 30px rgba(15,23,42,.05);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-800));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 20px; letter-spacing: -1px;
}
.login-brand h1 { font-size: 19px; color: var(--ink-900); font-weight: 700; letter-spacing: -.3px; }
.login-sub { color: var(--ink-500); font-size: 13px; margin: 6px 0 28px; }

/* ============ 应用骨架 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--line);
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 20;
}
.side-brand {
  height: 68px; display: flex; align-items: center; gap: 11px;
  padding: 0 22px; border-bottom: 1px solid var(--line-soft);
}
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-800));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: -1px; flex: none;
}
.side-brand b { color: var(--ink-900); font-size: 15px; letter-spacing: -.2px; }
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; color: var(--ink-400); letter-spacing: 1px; padding: 14px 12px 6px; font-weight: 600; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-500); cursor: pointer; margin-bottom: 2px;
  font-weight: 500; transition: all .15s;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--teal-50); color: var(--teal-700); }
.nav-item.active { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); font-weight: 600; }
/* 全局图标尺寸约束：SVG 未显式设宽高时会按默认 300×150 渲染，必须全局兜底 */
.ico { width: 17px; height: 17px; flex: none; vertical-align: -3px; }
.nav-item .ico { width: 18px; height: 18px; opacity: .85; }
.stat .label .ico, .ai-panel h3 .ico, .set-section h4 .ico { width: 16px; height: 16px; color: var(--teal-600); }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-400); }
.side-foot .who { color: var(--ink-700); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.side-foot .who .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
.side-foot button { margin-top: 10px; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar {
  height: 68px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 17px; color: var(--ink-900); font-weight: 650; letter-spacing: -.2px; }
.topbar .crumb { font-size: 12px; color: var(--ink-400); }
.content { padding: 30px 32px 60px; max-width: 1280px; }

/* ============ 通用组件 ============ */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 15px; color: var(--ink-900); font-weight: 650; }
.card-head .desc { font-size: 12px; color: var(--ink-400); font-weight: 400; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--white); color: var(--ink-700); cursor: pointer;
  font-weight: 600; font-size: 13px; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--teal-300); color: var(--teal-700); background: var(--teal-50); }
.btn-primary { background: var(--teal-600); border-color: var(--teal-600); color: #fff; box-shadow: 0 1px 2px rgba(13,148,136,.2); }
.btn-primary:hover { background: var(--teal-700); border-color: var(--teal-700); color: #fff; box-shadow: var(--shadow-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
label.field .hint { font-weight: 400; color: var(--ink-400); }
input[type=text], input[type=password], input[type=number], input[type=email], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink-900); outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--teal-400); box-shadow: 0 0 0 3px var(--teal-50); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.muted { color: var(--ink-500); }
.tiny { font-size: 12px; }

/* ============ 统计卡片 ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--teal-500); }
.stat.gold::before { background: var(--gold); }
.stat .label { font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: 7px; }
.stat .num { font-size: 30px; font-weight: 700; color: var(--ink-900); margin-top: 8px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat.gold .num { color: var(--gold); }
.stat .sub { font-size: 11px; color: var(--ink-400); margin-top: 4px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-400); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfdfc; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfdfc; }
td .main-txt { color: var(--ink-900); font-weight: 550; }
td .sub-txt { color: var(--ink-400); font-size: 12px; }
.actions { display: flex; gap: 6px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.badge-teal { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: #fde68a; }
.badge-gray { background: var(--line-soft); color: var(--ink-500); }
.badge-red { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.badge-green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.dot-inline { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============ 工具栏 ============ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { max-width: 300px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 9px 16px; cursor: pointer; color: var(--ink-500); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--teal-700); }
.tab.active { color: var(--teal-700); border-bottom-color: var(--teal-600); }

/* ============ 空状态 ============ */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-400); }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(15,23,42,.2); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; color: var(--ink-900); font-weight: 650; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { background: none; border: none; cursor: pointer; color: var(--ink-400); font-size: 22px; line-height: 1; padding: 4px; }
.x-btn:hover { color: var(--ink-900); }

/* ============ AI 生成面板 ============ */
.ai-panel { background: linear-gradient(135deg, var(--teal-50), #ecfdf5); border: 1px solid var(--teal-100); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.ai-panel h3 { font-size: 14px; color: var(--teal-800); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ai-panel p { font-size: 12px; color: var(--teal-700); opacity: .8; margin-bottom: 16px; }
.ai-result { margin-top: 16px; background: var(--white); border: 1px solid var(--teal-100); border-radius: var(--radius-sm); padding: 16px; }

/* ============ 编辑器 ============ */
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: #fbfdfc; }
.editor-toolbar button { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--white); border-radius: 5px; cursor: pointer; color: var(--ink-700); font-weight: 600; }
.editor-toolbar button:hover { background: var(--teal-50); border-color: var(--teal-300); color: var(--teal-700); }
.editor-area { min-height: 260px; border: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 16px; outline: none; background: var(--white); }
.editor-area:focus { border-color: var(--teal-400); }
.preview-frame { width: 100%; min-height: 300px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

/* ============ 设置分区 ============ */
.set-section { margin-bottom: 16px; }
.set-section h4 { font-size: 14px; color: var(--ink-900); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.set-section .sec-desc { font-size: 12px; color: var(--ink-400); margin-bottom: 16px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ============ 提示条 ============ */
.notice { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 18px; display: flex; gap: 9px; align-items: flex-start; line-height: 1.6; }
.notice-info { background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-100); }
.notice-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ============ Toast ============ */
#toast { position: fixed; top: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink-900); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(15,23,42,.2); animation: slidein .2s ease; max-width: 340px; }
.toast.ok { background: var(--teal-700); }
.toast.err { background: var(--danger); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--teal-200); border-top-color: var(--teal-600); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .set-grid { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .side-brand b, .nav-item span, .nav-group, .side-foot .who span, .side-foot button { display: none; }
  .side-brand, .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  .main { margin-left: 64px; }
  .content { padding: 20px; }
}
