/* =====================================================================
 * 龙晶工作平台 · 设计系统（Round 6 重做）
 * Token + 通用样式 + 各模块专用样式。遵循 SaaS 标杆（Linear/Notion/Stripe）
 * ===================================================================== */

/* ---------- 设计 Tokens ---------- */
:root {
  /* 品牌 */
  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-soft: rgba(29, 78, 216, 0.08);
  --brand-soft-strong: rgba(29, 78, 216, 0.12);
  --brand-2: #dc2626;

  /* 中性 */
  --text-1: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --hover-bg: #f1f5f9;

  /* 状态 */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-fg: #166534;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-fg: #92400e;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-fg: #991b1b;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --info-fg: #1e40af;

  /* 形状 */
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --radius-pill: 999px;

  /* 阴影 */
  --shadow-1: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 10px 25px rgba(15, 23, 42, 0.10);

  /* 字体 */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-stack);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ---------- 通用工具 ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
@media (max-width: 1023px) { .container { padding: 24px 16px 60px; } }

/* ---------- Topbar（6 页面统一） ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
@media (max-width: 1023px) { .topbar { padding: 0 16px; gap: 8px; } }
.topbar .brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.topbar .brand-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-1); text-decoration: none; font-weight: 700; font-size: 15px;
}
.topbar .brand-link:hover { color: var(--brand); }
.topbar .brand-logo { width: 28px; height: 28px; border-radius: 6px; }
.topbar .brand-sub {
  color: var(--text-3); font-size: 13px; font-weight: 500;
  padding-left: 10px; margin-left: 4px; border-left: 1px solid var(--border);
  white-space: nowrap;
}
@media (max-width: 1023px) { .topbar .brand-sub { display: none; } }

/* 三大板块主导航 */
.main-nav { display: flex; gap: 4px; margin: 0 12px; }
.main-nav .nav-btn {
  padding: 8px 14px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.main-nav .nav-btn:hover { background: var(--brand-soft); color: var(--brand); }
.main-nav .nav-btn.active {
  color: var(--brand);
  background: var(--brand-soft-strong);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

/* 当页专属 tools */
.brand-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* 右上角 actions */
.topbar .actions { display: flex; align-items: center; gap: 12px; }
.topbar .user { color: var(--text-2); font-size: 13px; white-space: nowrap; }
@media (max-width: 1023px) { .topbar .user { display: none; } }

/* 用户下拉菜单（details/summary） */
.actions .user-menu { position: relative; }
.actions .user-menu > summary {
  list-style: none; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-btn);
  background: var(--hover-bg); color: var(--text-2);
  font-size: 13px; user-select: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.actions .user-menu > summary::-webkit-details-marker { display: none; }
.actions .user-menu > summary:hover { background: var(--brand-soft); color: var(--brand); }
.actions .user-menu[open] > summary { background: var(--brand); color: #fff; }
.actions .user-menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); box-shadow: var(--shadow-2);
  border-radius: var(--radius-card); min-width: 200px; padding: 6px 0;
  z-index: 100; border: 1px solid var(--border);
}
.actions .user-menu-pop a {
  display: block; padding: 10px 16px; font-size: 14px;
  color: var(--text-2); text-decoration: none; transition: background .12s;
}
.actions .user-menu-pop a:hover { background: var(--hover-bg); color: var(--text-1); }

[data-roles].role-hidden { display: none !important; }

/* ---------- 页头（page-head） ---------- */
.page-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head .page-titles { flex: 1; min-width: 0; }
.page-head h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.page-head .page-sub { color: var(--text-2); font-size: 14px; }
.page-head .page-tools { display: flex; gap: 8px; align-items: center; }

/* ---------- 卡片 / 面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  padding: 24px;
  margin-bottom: 24px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.panel-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.panel-head .count { font-size: 12px; color: var(--text-2); font-weight: 400; }
.panel-sub { color: var(--text-2); font-size: 13px; margin-top: -8px; margin-bottom: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-card); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
thead { background: var(--hover-bg); }
th {
  padding: 12px 16px; text-align: left;
  font-weight: 600; color: var(--text-2);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-1); vertical-align: middle;
}
tbody tr:hover { background: var(--hover-bg); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.row-active { background: var(--brand-soft); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--hover-bg); border-color: var(--border-strong); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover-bg); color: var(--text-1); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn + .btn { margin-left: 4px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; color: var(--text-2);
}
input, select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 14px;
  background: var(--surface);
  color: var(--text-1);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }

.error-text { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ---------- 徽章 / 状态 pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500;
  background: var(--hover-bg); color: var(--text-2);
  white-space: nowrap;
}
.badge.success { background: var(--success-bg); color: var(--success-fg); }
.badge.warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge.danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.badge.muted { background: var(--hover-bg); color: var(--text-2); }
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ---------- KPI 卡片 ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .15s, transform .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.kpi-card .kpi-label {
  font-size: 13px; color: var(--text-2); font-weight: 500;
  margin-bottom: 8px;
}
.kpi-card .kpi-value {
  font-size: 28px; font-weight: 700; color: var(--text-1);
  letter-spacing: -.01em;
  word-break: break-all;
}
.kpi-card.brand { border-color: var(--brand); }
.kpi-card.brand .kpi-value { color: var(--brand); }
.kpi-card.danger .kpi-value { color: var(--danger); }
.kpi-card.success .kpi-value { color: var(--success); }
.kpi-card .kpi-trend {
  font-size: 12px; margin-top: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-2);
}
.kpi-card .kpi-trend.up { color: var(--success); }
.kpi-card .kpi-trend.down { color: var(--danger); }

/* ---------- Loading / Empty / Spinner ---------- */
.loading {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  padding: 48px 24px; text-align: center;
  color: var(--text-3); font-size: 14px;
}
.empty .empty-emoji { font-size: 32px; display: block; margin-bottom: 12px; }

/* ---------- 项目卡片 grid（研发页） ---------- */
.model-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.model-card {
  border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 20px; background: var(--surface);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.model-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--brand); }
.model-card .m-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.model-card .m-desc { color: var(--text-2); font-size: 13px; margin-bottom: 12px; min-height: 20px; }
.model-card .m-meta { font-size: 12px; color: var(--text-3); margin-bottom: 12px; line-height: 1.6; }
.model-card .m-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; font-size: 12px; color: var(--text-2); }
.model-card .m-options label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.model-card .m-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Tab 切换（财务/项目） ---------- */
.tab-bar {
  display: flex; gap: 2px; padding: 4px;
  background: var(--hover-bg); border-radius: var(--radius-btn);
  margin-bottom: 24px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab-bar .tab {
  padding: 8px 16px;
  border-radius: 6px;
  background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  border: none;
}
.tab-bar .tab:hover { background: var(--surface); color: var(--text-1); }
.tab-bar .tab.active {
  background: var(--surface); color: var(--brand); font-weight: 600;
  box-shadow: var(--shadow-1);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- 时间线（项目详情） ---------- */
.timeline {
  display: flex; align-items: stretch; gap: 0;
  margin: 16px 0;
}
.timeline .stage {
  flex: 1;
  position: relative;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-card);
  min-width: 0;
}
.timeline .stage + .stage { margin-left: 16px; }
.timeline .stage::before {
  content: ''; position: absolute;
  left: 16px; top: -1px; bottom: -1px; width: 2px;
  background: var(--border);
}
.timeline .stage:first-child::before { left: 50%; }
.timeline .stage.active { border-color: var(--brand); background: var(--brand-soft); }
.timeline .stage.done { border-color: var(--success); background: var(--success-bg); }
.timeline .stage .stage-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.timeline .stage .stage-meta { font-size: 12px; color: var(--text-2); }
.timeline .stage .stage-meta .owner { color: var(--brand); font-weight: 500; }

/* 进度条 */
.progress {
  height: 8px; background: var(--hover-bg);
  border-radius: 999px; overflow: hidden;
}
.progress > .bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .3s;
}
.progress.success > .bar { background: var(--success); }
.progress.warning > .bar { background: var(--warning); }
.progress.danger > .bar { background: var(--danger); }

/* ---------- 登录页 ---------- */
.auth-body { background: var(--bg); min-height: 100vh; }
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
@media (max-width: 1023px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
.auth-brand {
  background: linear-gradient(135deg, var(--brand) 0%, #2563eb 50%, #3b82f6 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: ''; position: absolute;
  top: -50%; right: -20%; width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}
.auth-brand-inner { max-width: 420px; position: relative; z-index: 1; }
.auth-brand-logo { width: 56px; height: 56px; margin-bottom: 24px; filter: brightness(0) invert(1); }
.auth-brand-name { font-size: 32px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
.auth-brand-tagline { font-size: 14px; opacity: 0.85; margin-bottom: 32px; }
.auth-brand-feats {
  list-style: none; padding: 0; margin: 32px 0 0;
  display: grid; gap: 12px;
}
.auth-brand-feats li {
  padding: 12px 16px; background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-btn);
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card-title { font-size: 28px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
.auth-card-sub { color: var(--text-2); margin: 0 0 32px; font-size: 14px; }
.auth-form .field { margin-bottom: 20px; }
.auth-submit { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }
.auth-hint { color: var(--text-3); font-size: 13px; margin: 24px 0 0; text-align: center; }
.auth-foot {
  color: var(--text-3); font-size: 12px;
  margin-top: 32px; padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.auth-foot a { color: var(--text-2); }
.auth-foot a:hover { color: var(--brand); }

/* ---------- 仪表盘 3 卡片 ---------- */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ---------- 折/柱图容器 ---------- */
.chart-wrap {
  width: 100%; overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  background: var(--surface);
}
.chart-wrap svg { display: block; max-width: 100%; height: auto; }

/* ---------- 两栏布局 ---------- */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 1023px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 强制密码改页（force_change_password） ---------- */
.force-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.force-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 32px;
  box-shadow: var(--shadow-1);
}

/* ---------- 筛选条 ---------- */
.filter-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 16px; margin-bottom: 16px;
  background: var(--hover-bg); border-radius: var(--radius-btn);
  border: 1px solid var(--border);
}
.filter-row label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-2); font-weight: 500;
}
.filter-row label input,
.filter-row label select { min-width: 140px; }

/* ---------- 小节标题 / 弹层 ---------- */
.section-h {
  font-size: 13px; font-weight: 600;
  color: var(--text-2); margin: 24px 0 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.section-h:first-child { margin-top: 0; }

.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-card);
  box-shadow: var(--shadow-2); width: 100%; max-width: 920px;
  max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px;
}
.modal-body {
  padding: 24px; overflow-y: auto; flex: 1;
}
@media (max-width: 1023px) {
  .modal-box { max-height: 95vh; }
  .modal-body { padding: 16px; }
}

/* ---------- 用户菜单 SVG ---------- */
.svg-icon { width: 16px; height: 16px; vertical-align: middle; }

/* ---------- 页脚 ---------- */
.page-foot {
  margin-top: 40px; padding: 24px;
  text-align: center; color: var(--text-3); font-size: 12px;
  border-top: 1px solid var(--border);
}
.page-foot a { color: var(--text-2); }
.page-foot a:hover { color: var(--brand); }

/* ---------- 旧样式别名（兼容旧 JS 残留） ---------- */
.brand-tools .btn { padding: 5px 12px; font-size: 13px; }
.topbar .actions { gap: 12px; }

/* ============================================================
 * 兼容层：v33 自动编译（index.html + build.js）所用样式
 * 保留所有旧 class 以保证 1000+ 行 build.js 不破。
 * ============================================================ */
.req { color: var(--danger); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.sys-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--hover-bg); color: var(--text-2); border: 1px solid var(--border); font-size: 12px; white-space: nowrap; line-height: 1.4; }
.sys-info { display: inline-flex; align-items: center; gap: 6px; }

/* v33 模型卡片补充 */
.model-card .share-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.model-card .share-badge.share-fresh { background: var(--success-bg); color: var(--success-fg); }
.model-card .share-badge.share-stale { background: var(--warning-bg); color: var(--warning-fg); }
.model-card .share-badge.share-none  { background: var(--hover-bg); color: var(--text-3); }

/* v33 弹层 / 表单 */
#help-modal, #legend-modal, #project-modal, #browse-modal, #product-modal,
#force-build-modal, #clone-project-modal, #user-modal, #log-modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
}
.dlg, .dlg-box, .log-box {
  background: var(--surface); border-radius: var(--radius-card);
  box-shadow: var(--shadow-2); width: 100%;
  max-width: 920px; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.dlg.lg { max-width: 1080px; }
.dlg-head, .log-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 16px;
}
.dlg-body, .log-body { padding: 24px; overflow-y: auto; flex: 1; }
.log-body {
  background: #0f172a; color: #e2e8f0;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all;
  padding: 16px;
}
.dlg-err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0; }
.field-hint {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  padding: 10px 14px; border-radius: var(--radius-btn);
  margin: 12px 0; font-size: 13px; color: var(--text-2);
}
.field-hint summary { cursor: pointer; font-weight: 500; color: var(--text-1); }
.field-hint-compact {
  background: var(--info-bg); border-left: 3px solid var(--info);
  padding: 10px 14px; border-radius: var(--radius-btn);
  margin: 12px 0; font-size: 13px; line-height: 1.7;
}
.help-tip {
  display: inline-block; margin-left: 4px;
  width: 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: 50%; background: var(--hover-bg); color: var(--text-2);
  font-size: 12px; cursor: help;
}
.help-body details { margin-bottom: 12px; }
.help-body summary { font-weight: 600; padding: 8px 0; cursor: pointer; }
.help-body details > * { margin-left: 12px; }
.help-body pre {
  background: var(--bg); padding: 10px; border-radius: var(--radius-btn);
  border: 1px solid var(--border); overflow-x: auto;
  font-size: 12px;
}
.help-table { width: 100%; font-size: 13px; margin: 8px 0; }
.help-table th, .help-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.help-table th { background: var(--hover-bg); width: 120px; font-weight: 600; }

/* v33 目录浏览 */
.dir-picker { display: flex; gap: 8px; }
.dir-picker input { flex: 1; }
.browse-roots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.browse-roots button { padding: 4px 10px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-btn); background: var(--surface); cursor: pointer; }
.browse-roots button:hover { background: var(--hover-bg); }
.browse-bar { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.browse-bar .browse-path { flex: 1; background: var(--bg); padding: 6px 10px; border-radius: var(--radius-btn); border: 1px solid var(--border); font-size: 13px; }
.browse-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-btn); }
.browse-list .browse-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; }
.browse-list .browse-item:last-child { border-bottom: none; }
.browse-list .browse-item:hover { background: var(--hover-bg); }

/* v33 任务/产物表格状态 */
.status-queued { background: var(--hover-bg); color: var(--text-2); }
.status-running { background: var(--info-bg); color: var(--info-fg); }
.status-success { background: var(--success-bg); color: var(--success-fg); }
.status-failed { background: var(--danger-bg); color: var(--danger-fg); }
.status-cancelled { background: var(--hover-bg); color: var(--text-3); }
.status-interrupted { background: var(--warning-bg); color: var(--warning-fg); }
.status-waiting_retry { background: var(--warning-bg); color: var(--warning-fg); }

.badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
}

/* v33 模型卡片选项（option 列表） */
.model-card .m-options code, .model-card .m-meta code {
  background: var(--bg); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
}

/* 用户管理（旧 UI 模态） */
#user-modal .field input, #user-modal .field select { padding: 8px 10px; }

/* ===== 运维中心 (ops.html, Round 7) ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.kpi-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 500;
}
.kpi-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-1);
  margin-top: 8px;
}
.kpi-value.mono { font-family: ui-monospace, Menlo, monospace; font-size: 16px; }

.terminal {
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, Menlo, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.55;
  padding: 16px;
  border-radius: var(--radius-btn);
  max-height: 500px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--brand);
  background: rgba(29, 78, 216, 0.04);
}
.dropzone p { margin: 4px 0; font-size: 15px; color: var(--text-2); }
.dropzone p:first-child { font-size: 17px; color: var(--text-1); font-weight: 500; }

.upload-result { margin-top: 16px; }
.upload-result .panel { padding: 18px; }

.row { display: flex; align-items: center; }
.row.gap-8 { gap: 8px; }

/* modal 显示控制（兼容旧 JS 的 display:block/none） */
.modal[style*="display: block"],
.modal[style*="display:block"] { display: flex !important; }