/* ===== 系列文库 · 公共样式 ===== */
:root {
  --bg: #f4f7f5; --surface: #fff; --surface-2: #f8faf9; --surface-3: #eef3f0;
  --border: #e2e9e5; --border-strong: #cfdbd4;
  --text: #1c2723; --text-2: #5b6b64; --text-3: #8b9a93;
  --brand: #147a5b; --brand-strong: #0e6148; --brand-soft: #e7f4ed; --brand-soft-2: #d5ecdf;
  --accent: #b96a12; --accent-soft: #fff3e2; --danger: #c0392b; --danger-soft: #fdecea;
  --code-bg: #f2f6f4; --selection: #c9e9d9;
  --shadow-sm: 0 1px 2px rgba(16,45,34,.05);
  --shadow: 0 2px 6px rgba(16,45,34,.05), 0 14px 36px rgba(16,45,34,.06);
  --shadow-lg: 0 24px 70px rgba(12,35,26,.18);
  --radius: 12px; --reading-size: 16px;
  --font: "PingFang SC","Microsoft YaHei","Hiragino Sans GB","Noto Sans CJK SC",system-ui,-apple-system,"Segoe UI",sans-serif;
  --mono: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
}
[data-theme="dark"] {
  --bg: #0e1512; --surface: #151e1a; --surface-2: #1a2520; --surface-3: #223029;
  --border: #26342d; --border-strong: #35483e;
  --text: #e7efea; --text-2: #a6b8ae; --text-3: #778b80;
  --brand: #55c996; --brand-strong: #74d9aa; --brand-soft: #17392b; --brand-soft-2: #1d4b38;
  --accent: #e6a75c; --accent-soft: #3a2a17; --danger: #ef8a7d; --danger-soft: #3a201e;
  --code-bg: #111b16; --selection: #235440;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 2px 8px rgba(0,0,0,.24), 0 16px 40px rgba(0,0,0,.26);
  --shadow-lg: 0 24px 70px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
::selection { background: var(--selection); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn { height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: .16s; }
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-2); font-size: 15px; display: inline-grid; place-items: center; transition: .16s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.input, input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; height: 34px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 13px; outline: none; transition: .16s;
}
textarea { height: auto; min-height: 90px; padding: 9px 11px; line-height: 1.7; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: block; margin-bottom: 13px; font-size: 12.5px; color: var(--text-2); }
label.field > span { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text); }
label.field .hint { display: block; margin-top: 5px; font-size: 11.5px; font-weight: 400; color: var(--text-3); line-height: 1.6; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--brand-soft); color: var(--brand-strong); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .ell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data .acts { white-space: nowrap; text-align: right; }
table.data .acts .btn { margin-left: 5px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(12,28,22,.48); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(3px); }
.modal-box { width: min(var(--modal-w, 620px), 100%); max-height: 88vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* 提示 */
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 9px; box-shadow: var(--shadow); padding: 11px 15px; font-size: 12.8px; color: var(--text); max-width: min(420px,88vw); line-height: 1.65; animation: toastIn .22s ease-out; }
.toast.warn { border-left-color: var(--accent); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.notice { border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border)); background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 11px 14px; font-size: 12.5px; line-height: 1.7; margin-bottom: 16px; }
.notice.ok { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); background: var(--brand-soft); }

/* 上传组件 */
.drop-zone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px 18px; text-align: center; background: var(--surface-2); transition: .16s; }
.drop-zone.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone .dz-ico { font-size: 30px; color: var(--brand); }
.drop-zone h3 { margin: 8px 0 5px; font-size: 14px; }
.drop-zone p { margin: 0 0 14px; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.drop-zone .btn { margin: 0 4px; }
.queue { margin-top: 14px; max-height: 170px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
.queue-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.queue-item:last-child { border-bottom: 0; }
.queue-item .qi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-box { display: grid; gap: 9px; margin: 16px 0 6px; }
.mode-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; cursor: pointer; background: var(--surface); }
.mode-opt:hover { border-color: var(--brand); }
.mode-opt.on { border-color: var(--brand); background: var(--brand-soft); }
.mode-opt input { margin-top: 3px; accent-color: var(--brand); }
.mode-opt b { display: block; font-size: 13px; margin-bottom: 3px; }
.mode-opt span { font-size: 11.8px; color: var(--text-2); line-height: 1.6; }
.progress-track { height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.progress-track > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.upload-note { font-size: 12px; color: var(--text-2); margin-top: 9px; line-height: 1.7; }
.upload-result { font-size: 12.8px; line-height: 1.8; }

@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .modal-box { padding: 17px; }
  table.data th, table.data td { padding: 8px 9px; }
}
