/* ============================================================
   styles.css — 浅色主题、响应式（手机/电脑通用）
   ============================================================ */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on { background: #eef2ff; color: var(--primary); }
.sync-wrap { margin-left: auto; }
.sync-badge { font-size: 12px; padding: 5px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.badge-on { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }
.badge-local { background: #f1f5f9; color: #475569; }

.main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }

/* 页头 */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; flex: 1; min-width: 160px; }

/* 统计 */
.sort-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sort-bar select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: #fff; color: var(--ink); }
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.stat b { font-size: 22px; display: block; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.warn b { color: #d97706; }

/* 即将到期 */
.upcoming { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.upcoming h3 { margin: 0 0 8px; font-size: 14px; }
.up-item { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.up-item:first-of-type { border-top: none; }
.up-days { font-weight: 700; }
.up-item.urgent .up-days { color: #dc2626; }
.up-item.soon .up-days { color: #d97706; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 14px; }
.ent-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; box-shadow: var(--shadow); transition: .15s; }
.ent-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,23,42,.12); }
.ent-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tag { color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.ent-status { font-size: 11px; color: var(--muted); }
.st-done { color: #16a34a; } .st-paused { color: #94a3b8; }
.ent-name { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.prog { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.prog-bar { height: 100%; background: linear-gradient(90deg,#2563eb,#22c55e); }
.ent-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* 面板 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.panel h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field.block { width: 100%; }
.field span { font-size: 12px; color: var(--muted); }
.field input, .field select, .ta, .ent-sub input, .ent-sub select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.block-label { font-size: 12px; color: var(--muted); display: block; margin: 8px 0 4px; }
.ta { width: 100%; min-height: 60px; resize: vertical; }

/* 企业详情 */
.ent-sub { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); }
.ent-sub label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }

/* 材料清单 */
.mat-sec { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.mat-sec-title { background: #f8fafc; padding: 8px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.mat-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-top: 1px dashed var(--line); }
.mat-item:first-of-type { border-top: none; }
.mat-toggle { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; font-size: 13px; font-weight: 700; cursor: pointer; flex: 0 0 auto; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.mat-toggle.on { background: #16a34a; color: #fff; }
.mat-toggle.off { background: #fff; color: #ef4444; border-color: #ef4444; }
.mat-name { flex: 1; font-size: 13px; }
.mat-note { flex: 1.2; font-size: 12px; padding: 5px 8px; }

/* 账号管理 */
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.acct-head h3 { margin: 0; }
.show-pw { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.acct-actions { display: flex; gap: 8px; margin: 10px 0 2px; flex-wrap: wrap; }
.acct-grid { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; overflow-x: auto; }
.acct-row { display: grid; grid-template-columns: 1.3fr 1.7fr 1.1fr 1.1fr 1fr 1fr auto; gap: 6px; align-items: center; min-width: 720px; }
.acct-row input { padding: 7px 8px; font-size: 13px; width: 100%; }
.acct-head-row { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 2px 2px; }
.acct-head-row span:last-child { visibility: hidden; }
.imp-preview { font-size: 13px; color: var(--primary); background: #f1f5ff; border: 1px dashed #c7d2fe; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.imp-grp { margin: 6px 0 2px; font-weight: 600; }
.imp-grp-item { margin: 2px 0 2px 14px; color: var(--text); font-weight: 400; }
.modal.wide { max-width: 620px; }

/* 我的账号：搜索 + 企业分组 */
.acct-search input { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; box-sizing: border-box; }
.biz-grp { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; overflow: hidden; }
.biz-grp-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.biz-grp-name { font-weight: 700; font-size: 14px; }
.biz-grp-count { font-size: 12px; color: var(--muted); }
.biz-grp-ops { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.biz-toggle { border: none; background: transparent; cursor: pointer; font-size: 14px; padding: 2px 6px; color: var(--muted); }
.acct-row-ops { display: flex; gap: 4px; justify-content: flex-end; }
.acct-row.view { background: #f8fafc; border-radius: 8px; padding: 7px 8px; }
.acct-row.view span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* 企业详情子标签 */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13px; }
.tab.on { background: #eef2ff; color: var(--primary); border-color: #c7d2fe; }
.tab-body { min-height: 40px; }

/* 任务 */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
.task.done { opacity: .55; }
.task.done .task-title { text-decoration: line-through; }
.task-body { flex: 1; }
.task-title { font-weight: 600; }
.tag-sm { font-size: 11px; background: #eef2ff; color: var(--primary); padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.task-due { font-size: 12px; color: var(--muted); }

/* 按钮 */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.danger { color: #dc2626; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }

/* 设置 */
.auth-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.auth-row input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.muted { color: var(--muted); font-size: 13px; }
.hint { margin-top: 10px; font-size: 12px; color: var(--muted); background: #f8fafc; padding: 8px 10px; border-radius: 8px; }
.setup-steps { margin: 10px 0 8px; padding-left: 20px; font-size: 13px; line-height: 1.9; color: var(--text); }
.setup-steps li { margin-bottom: 2px; }
.setup-steps a { color: var(--primary); }
.warn { margin: 10px 0; font-size: 12.5px; line-height: 1.7; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 9px 11px; }
.warn b { color: #b45309; }
.warn-inline { display: inline-block; margin-top: 6px; font-size: 12px; line-height: 1.7; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 7px 10px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* 进度可视化：板块状态条 */
.gs-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.gs { width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; background: #cbd5e1; }
.gs-done { background: #16a34a; }
.gs-part { background: #cbd5e1; }
.gs-none { background: #cbd5e1; color: #475569; }
.gs-empty { background: #e2e8f0; color: #94a3b8; }
.miss-text { color: #dc2626; font-weight: 700; }
.ok-text { color: #16a34a; font-weight: 700; }

/* 企业详情汇总条 */
.sumbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.sum-pill { font-size: 13px; color: var(--muted); }
.sum-pill b { color: var(--ink); font-size: 15px; }
.sum-warn { background: #fef2f2; color: #b91c1c; padding: 4px 10px; border-radius: 999px; font-weight: 700; }
.sum-ok { background: #dcfce7; color: #15803d; padding: 4px 10px; border-radius: 999px; font-weight: 700; }

/* 缺口清单 */
.gap-panel { border-left: 4px solid #f59e0b; }
.gap-allok { color: #16a34a; font-weight: 600; }
.gap-sec { padding: 6px 0; border-top: 1px dashed var(--line); }
.gap-sec:first-of-type { border-top: none; }
.gap-sec-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.gap-item { display: inline-block; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 3px 6px 0 0; }
.gap-st { font-style: normal; opacity: .8; margin-left: 4px; }

/* 材料板块编辑 */
.mst-meta { display: flex; align-items: center; gap: 4px; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 7px; font-size: 12px; cursor: pointer; line-height: 1.3; }
.mini:hover { background: #f1f5f9; }
.mini.danger { color: #dc2626; border-color: #fecaca; }
.mini.danger:hover { background: #fef2f2; }
.mini:disabled { opacity: .35; cursor: not-allowed; }
.mini:disabled:hover { background: #fff; }
.mit-meta { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mat-item.miss { background: #fff7f7; border-left: 3px solid #ef4444; border-radius: 0 6px 6px 0; }
.add-sec-btn { margin-top: 10px; }

/* 模板库 */
.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: stretch; }
.tpl-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; height: 100%; }
.tpl-head { display: flex; align-items: flex-start; gap: 8px; }
.tpl-name { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.4; }
.tpl-meta { color: var(--muted); font-size: 12px; }
.tpl-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.mst-input { flex: 1; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-weight: 600; }
.mat-item .dot { color: var(--muted); flex: 0 0 auto; padding: 0 2px; }

/* AI 提示词库 */
.prompt-sec { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.prompt-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
/* 轻提示 toast（替代 alert，兼容手机 PWA 全屏） */
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%) translateY(-24px); background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.prompt-sec-name { flex: 1; font-size: 15px; font-weight: 600; padding: 4px 2px; border: none; border-bottom: 1px dashed var(--line); background: transparent; font-family: inherit; }
.prompt-sec-name:focus { outline: none; border-bottom-color: #2563eb; }
.prompt-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fafbfc; display: flex; flex-direction: column; gap: 6px; }
.prompt-item .purpose { font-weight: 600; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-family: inherit; }
.prompt-item .pnote { font-size: 12px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-family: inherit; }
.prompt-item .pcontent { min-height: 84px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; line-height: 1.5; font-family: inherit; resize: vertical; }
.prompt-item-actions { display: flex; gap: 6px; justify-content: flex-end; }
.prompt-empty { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.add-prompt-item-btn { margin-top: 2px; }

@media (max-width: 980px) {
  .tpl-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .stat-row { grid-template-columns: repeat(2,1fr); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .acct { grid-template-columns: 1fr 1fr; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .brand { font-size: 14px; }
  .nav a { padding: 6px 8px; }
}
@media (max-width: 420px) {
  .tpl-grid { grid-template-columns: 1fr; }
}
