/* ============================================================
   黄腾腾投标智能体 V2 · 设计系统 (2026 重设计)
   基底：浅灰高对比 + 现代专业蓝主色
   全部组件保留原 class 命名，旧 JS 逻辑零改动即可焕新。
   ============================================================ */
:root {
  /* 品牌主色 —— 现代专业蓝 */
  --brand: #2563EB;
  --brand-2: #1D4ED8;
  --brand-soft: #EFF4FF;
  --brand-solid: #2563EB;
  --brand-hover: #1D4ED8;
  --success-solid: #16A34A;

  /* 中性 / 基底 —— 浅灰高对比 */
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --surface-3: #E9EEF5;
  --border: #E6E9F0;
  --border-strong: #D6DCE6;

  /* 文字 */
  --text: #0F172A;
  --text-2: #475569;
  --muted: #64748B;

  /* 语义色 */
  --success: #16A34A;
  --success-soft: #ECFDF3;
  --success-ring: rgba(22, 163, 74, .16);
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --danger-ring: rgba(220, 38, 38, .25);
  --warn: #D97706;
  --warn-soft: #FFFAEB;
  --warn-ring: rgba(217, 119, 6, .22);

  /* 风险等级色 (高/中/低) */
  --risk-high: #DC2626;
  --risk-mid: #D97706;
  --risk-low: #2563EB;

  /* 第二线(紫色，用于 B线 / 投标文件区分) */
  --line-b: #7C3AED;
  --line-b-soft: #F3EEFE;

  /* 圆角 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-full: 999px;

  /* 阴影 */
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .10), 0 4px 8px rgba(15, 23, 42, .05);
  --sh-blue: 0 8px 24px rgba(37, 99, 235, .18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  /* 派生变量：统一控件底色 / 禁用态 / 聚焦环，便于深色主题整体覆盖 */
  --input-bg: #FFFFFF;
  --disabled-bg: #F3F5F8;
  --focus-ring: rgba(37, 99, 235, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
a { color: var(--brand-2); cursor: pointer; text-decoration: none; }
::selection { background: var(--brand-soft); }
:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus-ring); border-radius: var(--r-sm); }

/* ---------- 按钮 ---------- */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 9px 16px; border-radius: var(--r-md); font-size: 14px; cursor: pointer; font-family: inherit; font-weight: 600;
  transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; user-select: none; white-space: nowrap; }
.btn:hover { border-color: var(--border-strong); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-solid); color: #fff; border-color: var(--brand-solid); box-shadow: var(--sh-blue); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-primary:disabled { background: #9DB5E8; border-color: #9DB5E8; box-shadow: none; }
.btn-secondary { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.btn-secondary:hover { background: var(--brand-soft); color: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- 输入 ---------- */
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; width: 100%;
  background: var(--input-bg); transition: .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus-ring); }
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
label input, label textarea, label select { margin-top: 6px; color: var(--text); font-weight: 400; }
.text-area { min-height: 120px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.select { max-width: 320px; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 12% -10%, #DBEAFE 0%, transparent 55%),
    radial-gradient(900px 480px at 110% 110%, #EDE9FE 0%, transparent 50%),
    linear-gradient(135deg, #1E40AF 0%, #2563EB 100%); padding: 20px; }
.auth-card { background: var(--surface); border-radius: 18px; padding: 38px 34px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg); }
.brand-block { text-align: center; margin-bottom: 24px; }
.brand-logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; margin-bottom: 12px; box-shadow: var(--sh-blue); }
.brand-logo.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 16px; margin: 0; }
.brand-block h1 { font-size: 20px; margin: 0; }
.brand-sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.auth-tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.auth-tab { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--muted); font-family: inherit; transition: .15s; }
.auth-tab.active { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-hint { color: var(--danger); font-size: 13px; min-height: 18px; text-align: center; margin: 8px 0 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- 顶栏 ---------- */
.topbar { height: 60px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px); -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 30; }
.topbar-left { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; margin: -4px -8px; border-radius: var(--r-md); transition: background .15s; }
.topbar-left:hover { background: var(--surface-2); }
.topbar-title { font-weight: 800; font-size: 15px; letter-spacing: .2px; }
.topbar-nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar-link { padding: 7px 13px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; }
.topbar-link:hover { background: var(--surface-2); color: var(--text); }
.topbar-link.active { background: var(--brand-soft); color: var(--brand); }
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ready-chip { font-size: 12px; padding: 4px 10px; border-radius: var(--r-full); background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.ready-chip.ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.ready-chip.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.main { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.2px; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- 工作台 ---------- */
.workspace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ws-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; overflow: hidden; }
.ws-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent, var(--brand)); opacity: 0; transition: opacity .2s; }
.ws-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent, var(--brand)); }
.ws-card:hover::before { opacity: 1; }
.ws-card.ws-a { --accent: #2563EB; }
.ws-card.ws-b { --accent: #7C3AED; }
.ws-icon { font-size: 32px; margin-bottom: 10px; width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); }
.ws-card.ws-a .ws-icon { background: #EFF4FF; }
.ws-card.ws-b .ws-icon { background: var(--line-b-soft); }
.ws-card h3 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.ws-card p { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.ws-points { list-style: none; padding: 0; margin: 0 0 18px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.ws-points li { display: flex; align-items: flex-start; gap: 8px; }
.ws-points li .tick { color: var(--success); font-weight: 700; }
.tag { font-size: 11px; padding: 2px 9px; border-radius: var(--r-full); font-weight: 700; white-space: nowrap; }
.tag-a { background: #EFF4FF; color: #2563EB; }
.tag-b { background: var(--line-b-soft); color: var(--line-b); }

/* 就绪度横幅 */
.ready-banner { display: flex; align-items: center; gap: 16px; padding: 18px 22px;
  background: linear-gradient(100deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 40%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  border-radius: var(--r-lg); margin-bottom: 28px; }
.ready-banner .rb-icon { width: 46px; height: 46px; border-radius: 13px; flex: none; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px; box-shadow: var(--sh-blue); }
.ready-banner h3 { margin: 0 0 3px; font-size: 17px; }
.ready-banner p { margin: 0; color: var(--text-2); font-size: 13px; }
.ready-banner .rb-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.ready-banner .mini-bar { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; min-width: 120px; }
.ready-banner .mini-bar i { display: block; height: 100%; background: var(--brand); border-radius: var(--r-full); transition: width .4s ease; }
.ready-banner .rb-pct { font-size: 12px; color: var(--muted); white-space: nowrap; }

.recent-block { margin-top: 34px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.recent-head h3 { margin: 0; font-size: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; gap: 2px; }
.seg-btn { border: none; background: transparent; padding: 7px 15px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13px; color: var(--muted); font-family: inherit; transition: all .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.recent-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  cursor: pointer; transition: .15s; }
.recent-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.recent-item .ri-name { font-weight: 600; margin-bottom: 4px; }
.recent-item .ri-meta { font-size: 12px; color: var(--muted); }

/* ---------- 向导布局 ---------- */
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.breadcrumb a { cursor: pointer; }
.b-company-bar { margin-bottom: 14px; }
.b-company-pick { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; }
.bcp-label { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.b-company-pick select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 14px; background: var(--input-bg); color: var(--text); cursor: pointer; min-width: 180px; }
.a-org-bar { margin-bottom: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.a-org-pick { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; }
.aop-label { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.a-org-pick select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 14px; background: var(--input-bg); color: var(--text); cursor: pointer; min-width: 200px; }
.org-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0; }
.org-editor .full { grid-column: 1 / -1; }
.wizard-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.wizard-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); }
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 22px; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 6px 10px;
  border-radius: 8px; background: var(--surface-2); }
.step span { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.step.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.step.active span { background: var(--brand-solid); color: #fff; border-color: var(--brand-solid); }
.step.done span { background: var(--success-solid); color: #fff; border-color: var(--success-solid); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: block; }
.panel + .panel { margin-top: 18px; }
.panel.active, .step-panel.active, .stab-panel.active { display: block; }
.step-panel, .stab-panel { display: none; }
.panel h3 { margin: 0 0 6px; font-size: 16px; }
.panel-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head-row h3 { margin: 0; font-size: 16px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 14px; }
.row-center { justify-content: center; }

.app-footer { text-align: center; padding: 18px 16px; margin-top: 28px; color: var(--muted); font-size: 13px; background: var(--surface); border-top: 1px solid var(--border); letter-spacing: .5px; }

/* 启动遮罩：避免刷新时先闪登录屏（首屏显示 loading，whoami 返回后再决定去主页还是登录页） */
.boot-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--bg);
}
.boot-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: boot-spin .8s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-text { color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.boot-loading.hidden { display: none; }

/* 废标闸门条 */
.gate-bar { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); margin-bottom: 18px; transition: all .25s ease; }
.gate-bar.locked { background: var(--danger-soft); border-color: var(--danger-ring); }
.gate-bar.open { background: var(--success-soft); border-color: rgba(22, 163, 74, .28); }
.gate-ring { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; position: relative;
  background: conic-gradient(var(--success) calc(var(--p, 0) * 1%), var(--border-strong) 0); transition: background .4s ease; }
.gate-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.gate-ring span { position: relative; z-index: 1; }
.gate-bar.locked .gate-ring { background: conic-gradient(var(--danger) calc(var(--p, 0) * 1%), var(--border-strong) 0); }
.gate-text strong { font-size: 15px; }
.gate-bar.locked .gate-text strong { color: var(--danger); }
.gate-bar.open .gate-text strong { color: var(--success); }
.gate-text p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }

.disq-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.disq-list { display: flex; flex-direction: column; gap: 12px; }
.disq-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 14px 12px; background: var(--surface);
  border-left: 4px solid var(--muted); transition: box-shadow .16s, border-color .16s; }
.disq-card:hover { box-shadow: var(--shadow-md); }
.disq-card.risk-高 { border-left-color: var(--risk-high); }
.disq-card.risk-中 { border-left-color: var(--risk-mid); }
.disq-card.risk-低 { border-left-color: var(--risk-low); }
.disq-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.disq-risk { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.risk-高 .disq-risk, .disq-risk.r-高 { background: var(--danger-soft); color: var(--danger); }
.risk-中 .disq-risk, .disq-risk.r-中 { background: var(--warn-soft); color: var(--warn); }
.risk-低 .disq-risk, .disq-risk.r-低 { background: var(--success-soft); color: var(--success); }
.disq-cat { font-size: 11px; color: var(--muted); }
.disq-clause { font-size: 13px; margin: 8px 0; }
.disq-detail { font-size: 13px; }
.disq-detail .lbl { color: var(--muted); }
.disq-solution { background: var(--surface-2); padding: 8px 10px; border-radius: 8px; margin-top: 8px; font-size: 13px; }
.disq-evidence { font-size: 12px; color: var(--brand-2); margin-top: 6px; }
.disq-actions { display: flex; gap: 8px; margin-top: 10px; }
.disq-actions .btn { padding: 6px 12px; font-size: 13px; flex: 1; }
.btn-state { border: 1px solid var(--border); background: var(--input-bg); border-radius: var(--r-sm); cursor: pointer; padding: 7px 12px; font-size: 13px; font-family: inherit; color: var(--muted); transition: all .14s; }
.btn-state:hover { border-color: var(--border-strong); }
.btn-state.active-satisfied { background: var(--success); color: #fff; border-color: var(--success); }
.btn-state.active-risk { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-state.active-pending { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }

/* 表单网格 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { margin-bottom: 0; }
.draft-block { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.draft-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.draft-head h4 { margin: 0; font-size: 14px; }

.profile-preview { background: var(--surface-2); border-radius: 10px; padding: 16px; font-size: 13px; }
.profile-preview h4 { margin: 0 0 8px; }
.profile-preview .pp-row { display: grid; grid-template-columns: 120px 1fr; gap: 6px; padding: 3px 0; }
.profile-preview .pp-k { color: var(--muted); }
.warn-line { color: var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-size: 13px; }

.gate-mini { padding: 12px 16px; border-radius: 10px; margin: 12px 0; font-size: 13px; font-weight: 600; }
.gate-mini.locked { background: var(--danger-soft); color: var(--danger); }
.gate-mini.open { background: var(--success-soft); color: var(--success); }

.wizard-nav { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* 侧栏 */
.wizard-side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 16px; }
.side-gate { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); transition: all .25s ease; }
.side-gate.locked { background: var(--danger-soft); border-color: var(--danger-ring); }
.side-gate.open { background: var(--success-soft); border-color: rgba(22, 163, 74, .28); }
.side-gate-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.side-gate.locked .side-gate-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.side-gate.open .side-gate-dot { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.side-gate strong { font-size: 14px; }
.side-gate p { margin: 0; font-size: 12px; color: var(--text-2); }
.side-gate.locked strong { color: var(--danger); }
.side-gate.open strong { color: var(--success); }
.side-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.side-progress-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.side-steps { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.side-steps li { padding: 6px 0; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.side-steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.side-steps li.active { color: var(--brand); font-weight: 600; }
.side-steps li.active::before { background: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }
.side-steps li.done { color: var(--success); }
.side-steps li.done::before { background: var(--success); }
.side-tip { background: var(--brand-soft); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* A线 单列 */
.single-col { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }

/* A线 右栏：强制合规项清单（三态） */
.a-check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.a-check-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); transition: color .2s ease; }
.aci-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--border-strong); background: var(--surface); transition: all .2s ease; }
.a-check-item.pending .aci-dot { border-color: var(--warn); border-style: dashed; }
.a-check-item.ok { color: var(--success); }
.a-check-item.ok .aci-dot { background: var(--success); border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.a-check-item.risk { color: var(--danger); }
.a-check-item.risk .aci-dot { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* A线 右栏：落款预览卡 */
.a-sign-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.asc-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.asc-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 5px 0; font-size: 13px; align-items: baseline; }
.asc-k { color: var(--muted); }
.asc-v { color: var(--text); font-weight: 600; word-break: break-all; }

/* 大块 dropzone（整个区域可点击 + 拖拽） */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r-lg); padding: 32px 20px; text-align: center; color: var(--muted); margin: 10px 0; background: var(--surface); transition: border-color .15s, background .15s, transform .08s; }
.dropzone[role="button"] { cursor: pointer; user-select: none; }
.dropzone:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone:active { transform: scale(.998); }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon { font-size: 40px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .08)); }
.dropzone .dz-title { color: var(--text); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.dropzone .dz-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }
.dropzone .dz-hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.dropzone .text-area { margin-top: 10px; }
.compliance-box { margin-top: 14px; }
.violation { background: var(--danger-soft); border: 1px solid var(--danger-ring); border-radius: 9px; padding: 12px 14px; margin-bottom: 10px; font-size: 13px; }
.violation .v-rule { font-weight: 700; color: var(--danger); }
.violation .v-fix { color: var(--text-2); margin-top: 4px; }
.compliance-pass { background: var(--success-soft); border: 1px solid rgba(22, 163, 74, .28); border-radius: 9px; padding: 12px 14px; color: var(--success); font-weight: 600; }

/* ---------- 设置中心 ---------- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.settings-tabs { grid-row: 1 / -1; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 10px; box-shadow: var(--shadow); position: sticky; top: 82px; }
.settings-tabs .stab { border: none; background: transparent; text-align: left; padding: 11px 13px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; width: 100%; transition: all .15s; }
.settings-tabs .stab:hover { background: var(--surface-2); color: var(--text); }
.settings-tabs .stab.active { background: var(--brand-soft); color: var(--brand); }
.stab-panel { grid-column: 2; }
.company-bar {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-bottom: 14px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 16%, var(--border)); border-radius: var(--r-lg);
}
.company-bar .cb-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.company-bar .cb-label { font-size: 13px; color: var(--muted); font-weight: 500; min-width: 56px; white-space: nowrap; text-align: right; flex-shrink: 0; }
.company-bar .cb-pick-row .cb-select { flex: 0 1 auto; min-width: 200px; max-width: 320px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--input-bg); cursor: pointer; font-family: inherit; }
.company-bar .cb-count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.company-bar .cb-rename-row .cb-name { flex: 1 1 280px; max-width: 420px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; background: var(--input-bg); }
.company-bar .cb-actions-row { gap: 8px; padding-top: 2px; }
.company-bar .btn-danger { color: var(--danger); border-color: var(--danger-ring); }
.company-bar .btn-danger:hover { background: var(--danger-soft); }
.profile-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0; }
.profile-editor .full { grid-column: 1 / -1; }
.repeat-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; position: relative; }
.repeat-item .del { position: absolute; top: 8px; right: 10px; color: var(--danger); cursor: pointer; font-size: 12px; }
.flabel { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
.date-cell { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.date-cell input[type="date"] { width: auto; flex: 1; min-width: 0; }
.date-cell input[type="date"]:disabled { background: var(--disabled-bg); color: var(--muted); }
.long-chk { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; cursor: pointer; }
.long-chk input[type="checkbox"] { width: auto; margin: 0; padding: 0; accent-color: var(--brand); }
.add-btn { font-size: 13px; color: var(--brand-2); cursor: pointer; margin-top: 4px; display: inline-block; }
.admin-users { display: flex; flex-direction: column; gap: 8px; }
.admin-user { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }

/* 设置中心 · 主题切换 */
.theme-seg { margin-top: 6px; }
.theme-seg .seg-btn { font-weight: 600; }

/* 设置卡片标题间距微调（原有 .panel 已含基础样式） */
.stab-panel h3 { font-size: 17px; }
.stab-panel .card-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.panel-head-row .card-sub { margin: 4px 0 0; }

/* ---------- 通用卡片（备用） ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0F172A; color: #fff;
  padding: 11px 20px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 100;
  opacity: 0; pointer-events: none; transition: all .25s ease; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="dark"] .toast { background: #1F2A3D; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

/* ---------- 生成结果卡片 ---------- */
.gen-result { margin-top: 16px; }
.gr-card { display: flex; gap: 14px; align-items: flex-start; background: var(--success-soft); border: 1px solid rgba(22, 163, 74, .28);
  border-radius: var(--r-lg); padding: 16px 18px; animation: grIn .25s ease; }
@keyframes grIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gr-icon { font-size: 26px; line-height: 1; }
.gr-body { flex: 1; }
.gr-title { font-weight: 700; color: var(--success); font-size: 15px; }
.gr-file { margin: 4px 0 10px; color: var(--text); font-size: 13px; word-break: break-all; }
.gr-tip { margin-top: 8px; color: var(--muted); font-size: 12px; }
.gr-actions { display: flex; gap: 10px; }

/* ================= 深色主题 =================
   仅覆盖 CSS 变量与少量硬编码颜色，浅色为 :root 默认。
   通过 <html data-theme="dark"> 生效。 */
[data-theme="dark"] {
  --brand: #60A5FA;
  --brand-2: #93C5FD;
  --brand-soft: #16233F;
  --brand-solid: #2563EB;
  --brand-hover: #1D4ED8;
  --success-solid: #16A34A;
  --bg: #0B1120;
  --surface: #131B2C;
  --surface-2: #1B2538;
  --surface-3: #232F45;
  --border: #243049;
  --border-strong: #33415C;
  --text: #E8EDF5;
  --text-2: #B4C0D3;
  --muted: #8A97AD;
  --success: #22C55E;
  --success-soft: #0F2A1C;
  --danger: #F87171;
  --danger-soft: #2A1414;
  --warn: #FBBF24;
  --warn-soft: #2A200E;
  --input-bg: #1B2538;
  --disabled-bg: #0E1726;
  --focus-ring: rgba(96, 165, 250, .30);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --sh-blue: 0 8px 24px rgba(37, 99, 235, .30);
  --line-b-soft: #1E1A33;
}
[data-theme="dark"] .auth-wrap { background: linear-gradient(135deg, #0E1B30 0%, #13243F 100%); }
[data-theme="dark"] .btn-primary:disabled { background: #2A3550; border-color: #2A3550; color: #7E8AA0; }
[data-theme="dark"] .btn-secondary:hover { background: #1E3050; }
[data-theme="dark"] .gate-ring::before { background: var(--surface); }
[data-theme="dark"] .violation { border-color: var(--danger); }
[data-theme="dark"] .compliance-pass { border-color: var(--success); }
[data-theme="dark"] .gr-card { border-color: var(--success); }
[data-theme="dark"] .company-bar { border-color: var(--border); }
[data-theme="dark"] .company-bar .cb-count { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .company-bar .btn-danger { border-color: var(--danger); }
[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); }
[data-theme="dark"] .ready-banner { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
[data-theme="dark"] .dropzone .dz-title { color: var(--text); }
[data-theme="dark"] .dropzone .dz-tag { background: var(--brand-soft); color: var(--brand); }

/* 跟随系统：未显式选择时，按操作系统偏好套用深色覆盖 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --brand: #60A5FA; --brand-2: #93C5FD; --brand-soft: #16233F;
    --brand-solid: #2563EB; --brand-hover: #1E40AF; --success-solid: #16A34A;
    --bg: #0B1120; --surface: #131B2C; --surface-2: #1B2538; --surface-3: #232F45; --border: #243049; --border-strong: #33415C;
    --text: #E8EDF5; --text-2: #B4C0D3; --muted: #8A97AD;
    --success: #22C55E; --success-soft: #0F2A1C;
    --danger: #F87171; --danger-soft: #2A1414;
    --warn: #FBBF24; --warn-soft: #2A200E;
    --input-bg: #1B2538; --disabled-bg: #0E1726; --focus-ring: rgba(96, 165, 250, .30);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 6px 16px rgba(0, 0, 0, .45); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    --line-b-soft: #1E1A33;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .workspace-grid, .wizard-layout, .form-grid, .profile-editor, .org-editor { grid-template-columns: 1fr; }
  .wizard-side { position: static; }
  .topbar-nav { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; position: static; overflow-x: auto; grid-row: auto; }
  .stab-panel { grid-column: 1; }
}
