/* app.css —— 全站样式：布局 / 表格 / 徽章 / 模态框 / 进度条 / 提示条 / 表单 / 分页
 * 依据：docs/design_v1.md §6.0（紧凑、信息密度优先）与 §6.2（徽章配色）
 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* hidden 属性必须压过任何 display 规则。
   本项目 modal-root / confirm-root / tipbar / filters / pager 等类都设了 display，
   其优先级高于浏览器对 [hidden] 的默认 display:none —— 缺这条兜底时
   <div id="modal-root" hidden> 仍会铺满全屏（position:fixed;inset:0;z-index:100）
   并吃掉全部点击，表现为“被蒙版遮住、无法操作”。 */
[hidden] { display: none !important; }

body {
  font: 13px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  color: #1f2430; background: #f4f6f9;
}
a { color: #1668dc; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 46px; padding: 0 16px; background: #ffffff;
  border-bottom: 1px solid #e2e6ee; position: sticky; top: 0; z-index: 50;
}
.brand { font-size: 15px; font-weight: 700; color: #14336b; white-space: nowrap; }
.brand-sub { margin-left: 8px; font-size: 12px; font-weight: 400; color: #8a93a6; }
.mainnav { display: flex; gap: 4px; }
.navlink {
  padding: 5px 14px; border-radius: 4px; color: #46506b; font-size: 13px;
}
.navlink:hover { background: #eef2f8; text-decoration: none; }
.navlink.active { background: #1668dc; color: #fff; }
.topbar-right { margin-left: auto; }

/* ---------------- 页面容器 ---------------- */
.page { padding: 12px 16px 32px; }
.card {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 10px;
}
.card > h2 { font-size: 13px; color: #1f2430; margin-bottom: 8px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head h2 { font-size: 14px; }
.card-head .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(520px, 1.2fr); gap: 10px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px;
  line-height: 18px; white-space: nowrap; border: 1px solid transparent;
}
.badge-grey { background: #f0f1f4; color: #5a6377; border-color: #e2e4ea; }
.badge-blue { background: #e8f1ff; color: #1668dc; border-color: #cfe1ff; }
.badge-green { background: #e8f8ee; color: #199e53; border-color: #cdeedd; }
.badge-red { background: #fdecec; color: #d33333; border-color: #f8d4d4; }
.badge-orange { background: #fff3e4; color: #d97917; border-color: #ffe0bd; }
.badge-purple { background: #f1ebfd; color: #6b3fd4; border-color: #e2d6fb; }
.badge-click { cursor: pointer; }
.badge-click:hover { filter: brightness(0.96); }
.badge.sel { outline: 2px solid #1668dc; outline-offset: 1px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 4px; border: 1px solid #d3d9e4; background: #fff;
  color: #1f2430; font-size: 13px; cursor: pointer; line-height: 20px;
}
.btn:hover { border-color: #1668dc; color: #1668dc; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: #1668dc; border-color: #1668dc; color: #fff; }
.btn-primary:hover { background: #0f57bd; color: #fff; }
.btn-danger { background: #fff; border-color: #e0a3a3; color: #d33333; }
.btn-danger:hover { background: #fdecec; color: #d33333; }
.btn-plain { background: #fff; }
.btn-mini { padding: 1px 8px; font-size: 12px; line-height: 18px; }
.btn-active { background: #1668dc; border-color: #1668dc; color: #fff; }
.btn.is-loading { opacity: 0.75; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th, table.tbl td {
  border-bottom: 1px solid #eceff5; padding: 5px 8px; text-align: left; vertical-align: top;
}
table.tbl th { background: #f7f9fc; color: #5a6377; font-weight: 600; white-space: nowrap; }
table.tbl tr:hover td { background: #fafbfe; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mid, table.tbl th.mid { text-align: center; }
.cell-long { max-width: 420px; }
.cell-full { display: block; white-space: pre-wrap; word-break: break-word; }
.cell-short { white-space: pre-wrap; word-break: break-word; }
.link { margin-left: 6px; font-size: 12px; white-space: nowrap; }
.empty { padding: 18px; text-align: center; color: #98a1b3; }
.muted { color: #98a1b3; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------------- 提示条 ---------------- */
.tipbar {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 16px 0; padding: 7px 12px; border-radius: 4px; font-size: 13px;
  border: 1px solid transparent;
}
.tipbar-info { background: #eef4ff; border-color: #cfe1ff; color: #1b4b9c; }
.tipbar-success { background: #e8f8ee; border-color: #cdeedd; color: #14713c; }
.tipbar-warn { background: #fff3e4; border-color: #ffe0bd; color: #92540c; }
.tipbar-error { background: #fdecec; border-color: #f8d4d4; color: #a52323; }
.tipbar-text { flex: 1; }
.tipbar-close { border: none; background: transparent; cursor: pointer; font-size: 16px; color: inherit; line-height: 1; }
.inline-tip { padding: 6px 10px; border-radius: 4px; margin-bottom: 8px; font-size: 12.5px; border: 1px solid transparent; }
.inline-tip-info { background: #eef4ff; border-color: #cfe1ff; color: #1b4b9c; }
.inline-tip-success { background: #e8f8ee; border-color: #cdeedd; color: #14713c; }
.inline-tip-warn { background: #fff3e4; border-color: #ffe0bd; color: #92540c; }
.inline-tip-error { background: #fdecec; border-color: #f8d4d4; color: #a52323; }
.field-error { color: #d33333; font-size: 12px; margin-left: 6px; }

/* ---------------- 上传区 ---------------- */
.dropzone {
  border: 1.5px dashed #c3cddd; border-radius: 6px; background: #fbfcfe;
  padding: 18px 12px; text-align: center; color: #5a6377; transition: .15s;
}
.dropzone.dragover { border-color: #1668dc; background: #eef4ff; }
.dropzone .dz-main { font-size: 14px; margin-bottom: 6px; }
.dropzone .dz-sub { font-size: 12px; color: #98a1b3; }
.file-line { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.file-name { font-weight: 600; word-break: break-all; }

/* ---------------- 表单 ---------------- */
.frow { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.flabel { flex: 0 0 132px; padding-top: 4px; color: #5a6377; font-size: 12.5px; text-align: right; }
.fctl { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input {
  padding: 3px 8px; border: 1px solid #d3d9e4; border-radius: 4px; font-size: 13px;
  font-family: inherit; line-height: 20px; background: #fff; color: #1f2430;
}
.input:focus { outline: none; border-color: #1668dc; box-shadow: 0 0 0 2px rgba(22,104,220,.12); }
.input[readonly], .input:disabled { background: #f5f6f9; color: #7a8395; }
.input-num { width: 110px; }
.input-mini { padding: 1px 6px; font-size: 12px; }
.input-wide { width: 100%; }
.fhint { font-size: 12px; color: #98a1b3; }
.inline-fields { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 2px 4px 2px 0; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-slider {
  width: 34px; height: 18px; background: #ccd3e0; border-radius: 10px; position: relative; transition: .15s;
}
.switch-slider:after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  background: #fff; border-radius: 50%; transition: .15s;
}
.switch-input:checked + .switch-slider { background: #1668dc; }
.switch-input:checked + .switch-slider:after { left: 18px; }
.switch-input:disabled + .switch-slider { opacity: .5; }

/* ---------------- Tab ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid #e2e6ee; margin-bottom: 10px; }
.tab {
  padding: 6px 14px; cursor: pointer; font-size: 13px; color: #46506b;
  border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; margin-bottom: -1px;
}
.tab:hover { color: #1668dc; }
.tab.active { background: #fff; border-color: #e2e6ee; color: #1668dc; font-weight: 600; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* ---------------- 模态框 ---------------- */
.modal-root {
  position: fixed; inset: 0; background: rgba(20, 26, 38, .42);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 6px; margin-top: 60px; width: 660px; max-width: 94vw;
  max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 8px 28px rgba(16, 24, 40, .18);
}
.modal-wide { width: 860px; }
.modal-narrow { width: 420px; }
.modal-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid #eceff5; }
.modal-title { font-size: 14px; flex: 1; }
.modal-x { border: none; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: #7a8395; }
.modal-body { padding: 12px 14px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid #eceff5;
  background: #fbfcfe; border-radius: 0 0 6px 6px;
}
.confirm-text { margin: 4px 0 6px; }

/* ---------------- 卡片 / 汇总 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.stat {
  background: #fff; border: 1px solid #e2e6ee; border-radius: 6px; padding: 8px 10px;
}
.stat .stat-label { font-size: 12px; color: #7a8395; }
.stat .stat-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .stat-value small { font-size: 12px; font-weight: 400; color: #7a8395; margin-left: 3px; }
.chipline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 12px;
  background: #f2f5fa; border: 1px solid #e2e8f2; font-size: 12px; color: #33405c;
}
.chip .chip-num { color: #1668dc; font-weight: 600; }

/* ---------------- 进度条 ---------------- */
.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  flex: 1; height: 10px; background: #eaeef5; border-radius: 6px; overflow: hidden; min-width: 160px;
}
.progress-inner { height: 100%; width: 0; background: #1668dc; transition: width .3s; }
.progress-inner.done { background: #199e53; }
.progress-inner.fail { background: #d33333; }
.progress-text { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lane-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lane-box {
  border: 1px solid #e2e6ee; border-radius: 5px; padding: 6px 10px; min-width: 150px; background: #fbfcfe;
}
.lane-box .lane-name { font-size: 12.5px; color: #46506b; }
.lane-box .lane-num { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lane-box .lane-err { color: #d33333; font-size: 12px; }

/* ---------------- 日志 ---------------- */
.logbox {
  max-height: 260px; overflow: auto; background: #10141c; color: #d7dde8;
  border-radius: 5px; padding: 8px 10px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; margin: 0;
}
.logbox.collapsed { max-height: 72px; }
.log-line-warn { color: #ffcf7a; }
.log-line-error { color: #ff9d9d; }
details.fold { margin-top: 8px; }
details.fold > summary { cursor: pointer; font-size: 12.5px; color: #1668dc; }
details.fold > summary::-webkit-details-marker { color: #1668dc; }
.fold-body { margin-top: 8px; }

/* ---------------- 分页 / 多选下拉 ---------------- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pager-info { color: #7a8395; font-size: 12px; margin-right: 4px; }
.ms-wrap { position: relative; display: inline-block; }
.ms-btn {
  padding: 3px 10px; border: 1px solid #d3d9e4; border-radius: 4px; background: #fff;
  font-size: 13px; cursor: pointer; font-family: inherit; color: #1f2430;
}
.ms-btn.open, .ms-btn:hover { border-color: #1668dc; color: #1668dc; }
.ms-caret { margin-left: 4px; font-size: 10px; }
.ms-panel {
  position: absolute; z-index: 60; top: 28px; left: 0; min-width: 220px; max-height: 260px; overflow: auto;
  background: #fff; border: 1px solid #e2e6ee; border-radius: 5px; box-shadow: 0 6px 18px rgba(16,24,40,.12);
  padding: 6px 8px;
}
.ms-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12.5px; cursor: pointer; }
.ms-actions { display: flex; gap: 6px; border-top: 1px solid #eceff5; margin-top: 4px; padding-top: 6px; }
.hidden { display: none !important; }
.sec-title { font-size: 12.5px; color: #5a6377; margin: 10px 0 6px; font-weight: 600; }
.kbd-hint { font-size: 12px; color: #98a1b3; }

/* ---------------- 审校通道 ---------------- */
.lane-block { border: 1px solid #e2e6ee; border-radius: 6px; margin-bottom: 8px; background: #fff; }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.lane-title { font-weight: 600; min-width: 66px; }
.lane-head .lane-provider { min-width: 160px; }
.lane-head .lane-model { min-width: 180px; }
.lane-adv { border-top: 1px dashed #e2e6ee; padding: 10px 10px 2px; background: #fbfcfe; border-radius: 0 0 6px 6px; }
.model-group { border: 1px solid #e2e6ee; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
.model-group h3 { font-size: 13px; margin-bottom: 6px; color: #33405c; }
.model-group .model-chip { cursor: pointer; }
.model-group .model-chip:hover { border-color: #1668dc; }
