/* =====================================================================
   医患沟通录音与信息提取系统 — 样式
   ===================================================================== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --ink: #16233a;
  --ink-2: #3d4c63;
  --muted: #6b7a90;
  --faint: #9aa6b8;
  --line: #e6ebf3;
  --line-strong: #d5ddec;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --green: #16a34a;
  --green-soft: #ecfdf3;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --violet: #7c3aed;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-2: 0 10px 30px -18px rgba(16, 24, 40, .35);
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Consolas", "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

/* ---------------- 顶栏 ---------------- */

.app-header {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #6366f1 55%, #8b5cf6);
  color: #fff;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 700;
  box-shadow: 0 8px 18px -8px rgba(59, 130, 246, .9);
}

.brand-text h1 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.brand-text p { margin: 3px 0 0; font-size: 11.5px; color: var(--faint); }

.header-right { display: flex; align-items: center; gap: 9px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.status-pill i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .12);
}
.status-pill.busy i { background: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.status-pill.warn i { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); }
.status-pill.err i { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }

/* ---------------- 按钮 ---------------- */

.btn {
  height: 32px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
  transition: all .16s ease;
  white-space: nowrap;
}
.btn:hover { background: #f1f4fa; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #3b82f6, var(--primary));
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, .9);
}
.btn.primary:hover { background: linear-gradient(180deg, #2563eb, var(--primary-dark)); }
.btn.primary:disabled { background: #c7d2e5; box-shadow: none; }

.btn.ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn.ghost:hover { border-color: #b9c6db; background: var(--surface-2); }
.btn.ghost.danger { color: var(--red); border-color: #f3d3d3; }
.btn.ghost.danger:hover { background: var(--red-soft); }

.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 36px; }
.btn.dashed {
  width: 100%; height: 34px;
  border: 1px dashed var(--line-strong);
  background: transparent; color: var(--muted);
}
.btn.dashed:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.icon-btn {
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: transparent;
  color: var(--faint); font-size: 18px; line-height: 1;
}
.icon-btn:hover { background: #f1f4fa; color: var(--ink); }

.link { font-size: 11.5px; color: var(--muted); }
.link:hover { color: var(--primary); }

/* ---------------- 主布局 ---------------- */

.layout {
  display: grid;
  grid-template-columns: 258px minmax(560px, 1fr) 342px;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 66px);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px;
}
.panel-head h2 { margin: 0; font-size: 13.5px; font-weight: 700; }

.panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--faint);
}

/* ---------------- 患者列表 ---------------- */

.search-wrap { padding: 0 12px 10px; }
.search {
  width: 100%; height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  transition: border-color .16s, background .16s;
}
.search:focus { border-color: var(--primary); background: #fff; }
.search::placeholder { color: var(--faint); }

/* 日期筛选 */

.date-filter {
  margin: 0 12px 10px;
  padding: 9px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff, #f5f8fe);
  box-shadow: inset 0 1px 0 #fff;
}

.df-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px;
}
.df-head span {
  font-size: 10.5px; font-weight: 600; letter-spacing: .5px;
  color: var(--muted); text-transform: uppercase;
}
.df-reset {
  border: none; padding: 0; background: transparent;
  font-size: 10.5px; color: var(--primary);
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.df-reset.show { opacity: 1; pointer-events: auto; }
.df-reset:hover { text-decoration: underline; }

.df-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.df-sel { position: relative; }
.df-sel::after {
  content: ""; position: absolute; right: 8px; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}
.df-sel select {
  width: 100%; height: 28px;
  padding: 0 16px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
  appearance: none; -webkit-appearance: none;
  outline: none; cursor: pointer;
  transition: border-color .16s, box-shadow .16s, background .16s, color .16s;
}
.df-sel select:hover { border-color: #b9c6db; }
.df-sel select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.df-sel select.on {
  border-color: #bcd2ff; background: var(--primary-soft);
  color: var(--primary-dark); font-weight: 600;
}

.df-chips { display: flex; gap: 5px; margin-top: 7px; }
.df-chip {
  flex: 1; height: 24px; padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 11px; color: var(--muted);
  transition: all .14s;
}
.df-chip:hover { border-color: #bcd2ff; color: var(--primary); }
.df-chip.is-on {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 5px 12px -8px rgba(37, 99, 235, .95);
}

.patient-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }

.patient-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .14s;
  border: 1px solid transparent;
}
.patient-item:hover { background: var(--surface-2); }
.patient-item.active {
  background: var(--primary-soft);
  border-color: #d5e3ff;
}
.patient-item .avatar {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #e0e9ff, #eef2ff);
  color: var(--primary);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  flex: none;
}
.patient-item.active .avatar {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
}
.patient-item .p-info { flex: 1; min-width: 0; }
.patient-item .p-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.patient-item .p-sub { font-size: 11px; color: var(--faint); margin-top: 2px; }
.patient-item .p-date {
  flex: none; font-size: 10.5px; color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding: 2px 5px; border-radius: 6px;
  background: #f4f7fc;
}
.patient-item.active .p-date { background: #e3edff; color: #4b76d1; }

.empty-list { padding: 24px 12px; text-align: center; color: var(--faint); font-size: 12px; line-height: 1.7; }
.empty-list .link-btn {
  margin-top: 8px;
  border: 1px solid var(--line-strong); background: #fff;
  color: var(--primary); font-size: 11.5px;
  height: 26px; padding: 0 12px; border-radius: 7px;
}
.empty-list .link-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

/* 数据位置弹窗 */

.path-list { display: flex; flex-direction: column; gap: 8px; }
.path-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.path-item .pi-icon {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px;
}
.path-item .pi-body { flex: 1; min-width: 0; }
.path-item .pi-label { font-size: 11px; color: var(--muted); }
.path-item .pi-value {
  margin-top: 3px;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink); word-break: break-all; line-height: 1.5;
}
.path-item .pi-meta { font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.path-item .pi-copy {
  flex: none; border: 1px solid var(--line-strong); background: #fff;
  color: var(--muted); font-size: 10.5px; height: 22px; padding: 0 8px;
  border-radius: 6px;
}
.path-item .pi-copy:hover { border-color: var(--primary); color: var(--primary); }
.modal-body code {
  font-family: var(--mono); font-size: 11px;
  background: #f1f4fa; padding: 1px 4px; border-radius: 4px;
}

/* ---------------- 工作区 ---------------- */

.workspace { position: relative; }

.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}
.empty-art {
  width: 76px; height: 76px; border-radius: 24px;
  background: linear-gradient(135deg, #eef4ff, #f5f3ff);
  display: grid; place-items: center;
  font-size: 30px;
  margin-bottom: 18px;
}
.empty-state h3 { margin: 0 0 8px; font-size: 16px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 12.5px; line-height: 1.8; }

.workspace-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.workspace-head {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.patient-chip { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.patient-chip .avatar {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff; display: grid; place-items: center;
  font-size: 15px; font-weight: 700;
}
.ws-name { font-size: 14px; font-weight: 700; }
.ws-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.mode-tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.mode-tab {
  height: 27px; padding: 0 16px;
  border: none; border-radius: 7px;
  background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 500;
  transition: all .16s;
}
.mode-tab:hover { color: var(--ink); }
.mode-tab.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

.workspace-actions { margin-left: auto; display: flex; gap: 7px; }

.workspace-scroll { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }

/* ---------------- 卡片 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.card-actions { display: flex; gap: 7px; flex: none; }
.hint { margin: 4px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.6; }

/* ---------------- 录音 ---------------- */

.rec-state {
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.rec-state.recording { background: var(--red-soft); border-color: #f6d5d5; color: var(--red); }
.rec-state.paused { background: var(--amber-soft); border-color: #fbe3bd; color: var(--amber); }
.rec-state.busy { background: var(--primary-soft); border-color: #d8e4ff; color: var(--primary); }

.recorder-body {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 6px 4px 4px;
}

.mic-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #3b82f6, #2563eb);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 22px -12px rgba(37, 99, 235, .95);
  transition: transform .16s, box-shadow .16s;
}
.mic-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(37, 99, 235, .95); }
.mic-btn .mic-icon { font-size: 26px; line-height: 1; }
.mic-btn.recording {
  background: linear-gradient(145deg, #ef4444, #dc2626);
  animation: pulse 1.6s infinite;
}
.mic-btn:disabled { opacity: .5; animation: none; cursor: not-allowed; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35); }
  70% { box-shadow: 0 0 0 16px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.rec-center { min-width: 0; }
.timer { font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: .5px; line-height: 1.1; }

.level-meter {
  height: 6px; border-radius: 4px;
  background: #eef2f8;
  overflow: hidden;
  margin: 9px 0 7px;
}
.level-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 4px;
  transition: width .08s linear;
}
.level-fill.hot { background: linear-gradient(90deg, #f59e0b, #dc2626); }

.rec-meta { font-size: 11.5px; color: var(--faint); }

.rec-controls { display: flex; gap: 8px; align-items: center; }

.rec-options {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.rec-options .hint { margin: 0; }

/* 上传已有音频：独立一行放在录音按钮下方，不和录音参数混在一起 */
.upload-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 10px 4px 2px;
  border-top: 1px dashed var(--line);
}
.upload-row .hint { margin: 0; font-size: 12px; }

.progress-block { margin-top: 12px; }
.progress { height: 5px; border-radius: 3px; background: #eef2f8; overflow: hidden; }
.progress-fill {
  height: 100%; width: 35%;
  border-radius: 3px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width .4s ease;
}
.progress-fill.indeterminate {
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}
.progress-text { margin-top: 6px; font-size: 11.5px; color: var(--primary); }

.audio-block {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 12px;
}
.audio-block audio { height: 32px; flex: 1; max-width: 420px; }

/* ---------------- 转写稿 ---------------- */

.transcript-card { display: flex; flex-direction: column; }

.role-bar {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.role-bar:empty { display: none; }

.role-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.role-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--primary)); }
.role-chip .spk { color: var(--muted); }
.role-chip select {
  height: 24px; border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff; padding: 0 4px;
  font-size: 11.5px; color: var(--ink-2);
}

.transcript-list { margin-top: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.placeholder { padding: 26px 12px; text-align: center; color: var(--faint); font-size: 12px; }

.utt {
  display: grid;
  grid-template-columns: 44px 76px 1fr;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border-left: 3px solid var(--c, #cbd5e1);
  transition: background .14s;
}
.utt:hover { background: var(--surface-2); }
.utt-time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); padding-top: 3px; }

.utt-role {
  height: 24px; padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--c-bg, #f3f6fb);
  color: var(--c, var(--muted));
  font-size: 11.5px; font-weight: 600;
  justify-self: start;
  align-self: start;
  white-space: nowrap;
}
.utt-role:hover { border-color: currentColor; }

.utt-text {
  width: 100%;
  min-height: 22px;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  resize: none;
  line-height: 1.65;
  font-size: 12.5px;
  color: var(--ink-2);
  overflow: hidden;
}
.utt-text:hover { background: #fff; border-color: var(--line); }
.utt-text:focus { background: #fff; border-color: var(--primary); outline: none; }

/* ---------------- 表单 ---------------- */

.form-body { display: flex; flex-direction: column; gap: 18px; }

.form-section { border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--surface-2); }
.form-section h4 {
  margin: 0 0 11px; font-size: 12.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.form-section h4::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary);
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--muted); }
.field > span b { color: var(--red); font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > span { white-space: nowrap; }

.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.field textarea { resize: vertical; min-height: 58px; line-height: 1.65; }
.field select { height: 32px; padding: 0 8px; }
.field input { height: 32px; }

.history-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: #fff;
  margin-bottom: 9px;
}
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.history-head span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------------- 右侧栏 ---------------- */

.side-tabs {
  display: flex;
  padding: 8px 10px 0;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.side-tab {
  flex: 1;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 9px 9px 0 0;
  color: var(--muted);
  font-size: 12.5px; font-weight: 500;
  position: relative;
}
.side-tab:hover { color: var(--ink); background: var(--surface-2); }
.side-tab.active { color: var(--primary); font-weight: 600; }
.side-tab.active::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--primary);
}

.side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-hint { margin: 0; }

.task-list { display: flex; flex-direction: column; gap: 9px; }

.task-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px;
}
.task-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.task-index { font-size: 10.5px; font-weight: 700; color: var(--primary); letter-spacing: .3px; }
.task-del { border: none; background: transparent; color: var(--faint); font-size: 11px; }
.task-del:hover { color: var(--red); }
.task-item input, .task-item textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; padding: 6px 8px; font-size: 12px; outline: none;
}
.task-item input { margin-bottom: 6px; height: 28px; font-weight: 600; }
.task-item textarea { min-height: 62px; resize: vertical; line-height: 1.6; }
.task-item input:focus, .task-item textarea:focus { border-color: var(--primary); }

.pack-row { display: flex; gap: 6px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.pack-row select {
  height: 32px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; padding: 0 8px; font-size: 12px; outline: none;
}

.score-status { min-height: 16px; }

.score-result { display: flex; flex-direction: column; gap: 11px; }

.score-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8faff, #f4f7ff);
  border: 1px solid #e6edfb;
}
.donut {
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e9eef8 0);
  position: relative;
  flex: none;
}
.donut::after {
  content: ""; position: absolute; inset: 8px;
  border-radius: 50%; background: #fff;
}
.donut b {
  position: relative; z-index: 1;
  font-family: var(--mono); font-size: 19px; color: var(--c);
}
.score-hero-text { min-width: 0; }
.score-level { font-size: 13px; font-weight: 700; color: var(--c); }
.score-sub { font-size: 11px; color: var(--faint); margin-top: 3px; line-height: 1.5; }

.dim { display: flex; flex-direction: column; gap: 4px; }
.dim-head { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.dim-head .name { font-weight: 600; color: var(--ink-2); }
.dim-head .w { margin-left: auto; font-size: 10px; color: var(--faint); }
.dim-head .v { font-family: var(--mono); font-weight: 700; color: var(--c, var(--primary)); }
.dim-bar { height: 5px; border-radius: 3px; background: #eef2f8; overflow: hidden; }
.dim-bar i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--primary)); }
.dim-comment { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* 未评维度：灰化 + 虚线底槽，视觉上和"0 分"明确区分 */
.dim.missing .dim-head .name { color: var(--faint); font-weight: 500; }
.dim.missing .dim-head .v { font-size: 11px; font-weight: 600; letter-spacing: .5px; }
.dim.missing .dim-bar {
  background: repeating-linear-gradient(90deg, #e8edf5 0 6px, transparent 6px 10px);
}
.dim.missing .dim-comment { color: var(--faint); font-style: italic; }

/* 覆盖率提示条 */
.score-note {
  margin: 2px 0 4px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 11px;
  line-height: 1.5;
}

.bullets { display: flex; flex-direction: column; gap: 4px; }
.bullets .t { font-size: 11.5px; font-weight: 700; }
.bullets .i { font-size: 11.5px; color: var(--ink-2); line-height: 1.6; padding-left: 10px; position: relative; }
.bullets .i::before { content: "·"; position: absolute; left: 2px; color: var(--faint); }

.overall {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
}
.overall .t { font-size: 11px; font-weight: 700; color: #92400e; margin-bottom: 4px; }
.overall .c { font-size: 11.5px; color: #6b4d16; line-height: 1.7; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(16, 24, 40, .38);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 60;
  padding: 24px;
}
.modal {
  width: 400px; max-width: 100%;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: pop .18s ease;
}
.modal.wide { width: 940px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-body .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-foot .hint { margin-right: auto; }

.archive-body { display: grid; grid-template-columns: 420px 1fr; gap: 0; height: 460px; }
.archive-list { overflow-y: auto; border-right: 1px solid var(--line); }
.archive-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
}
.archive-item:hover { background: var(--surface-2); }
.archive-item.active { background: var(--primary-soft); }
.archive-item .a-name { font-size: 12.5px; font-weight: 600; }
.archive-item .a-sub { font-size: 11px; color: var(--faint); margin-top: 3px; }

.archive-json {
  margin: 0; padding: 14px;
  overflow: auto;
  font-family: var(--mono); font-size: 11px;
  line-height: 1.7; color: var(--ink-2);
  background: var(--surface-2);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------------- Toast ---------------- */

.toast-wrap {
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
}
.toast {
  min-width: 220px; max-width: 380px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
  color: var(--ink-2);
  animation: toastIn .2s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 滚动条 ---------------- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8dfeb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c3cddd; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 自适应 ---------------- */

@media (max-width: 1280px) {
  .layout { grid-template-columns: 226px minmax(480px, 1fr) 306px; }
}

/* ---------------- 补充 ---------------- */

#packDesc { white-space: pre-line; }

#roleMenu {
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
#roleMenu > div:hover { background: #f1f4fa; }

.empty-state .empty-art { font-size: 30px; }



/* =====================================================================
   表格模板（切换 + 编辑器）
   ===================================================================== */

.tpl-picker { display: flex; align-items: center; gap: 6px; }
.tpl-picker select {
  height: 28px; max-width: 190px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); font-size: 12px; color: var(--ink-2);
}
.tpl-picker select:disabled { color: var(--faint); background: var(--surface-2); }
.tpl-gear {
  width: 28px; height: 28px; border-radius: 8px; padding: 0;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: all .15s;
}
.tpl-gear:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.form-empty {
  padding: 24px; text-align: center; color: var(--faint); font-size: 12.5px;
  border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--surface-2);
}
.field-locked input,
.field-locked select,
.field-locked textarea {
  background: var(--surface-2); color: var(--muted);
  cursor: not-allowed; border-style: dashed;
}
.field-locked select:disabled { opacity: 1; }

.modal.xwide { width: min(1060px, 96vw); }
.tpl-body {
  display: grid; grid-template-columns: 232px minmax(0, 1fr);
  height: min(66vh, 560px);
}
.tpl-side {
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  background: var(--surface-2); min-height: 0;
}
.tpl-side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.tpl-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; }
.tpl-group { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.tpl-group-title {
  font-size: 10.5px; color: var(--faint); font-weight: 700;
  letter-spacing: .04em; padding: 4px 6px;
}
.tpl-item {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  text-align: left; padding: 8px 10px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: background .12s;
}
.tpl-item:hover { background: #eef2f9; }
.tpl-item.is-on { background: var(--primary-soft); border-color: #cddcff; }
.tpl-item-name { font-size: 12.5px; color: var(--ink); }
.tpl-item.is-on .tpl-item-name { color: var(--primary-dark); font-weight: 600; }
.tpl-item-meta { font-size: 10.5px; color: var(--faint); }

.tpl-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tpl-main-head {
  padding: 10px 16px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); border-bottom: 1px solid var(--line); flex: none;
}
.tpl-editor {
  overflow: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px; flex: 1;
}
.tpl-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-tip { margin: -2px 0 0; }

.tpl-sec {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 8px;
}
.tpl-sec-head { display: flex; gap: 7px; align-items: center; }
.tpl-sec-title {
  flex: 1; min-width: 0; height: 30px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--surface);
}
.tpl-sec-layout {
  height: 30px; border: 1px solid var(--line-strong); border-radius: 7px;
  font-size: 12px; background: var(--surface); color: var(--ink-2);
}
.tpl-fields { display: flex; flex-direction: column; gap: 6px; }
.tpl-field-row {
  display: grid; grid-template-columns: minmax(0, 1.1fr) 96px minmax(0, 1.4fr) 48px 26px;
  gap: 6px; align-items: center;
}
.tpl-field-row .tpl-f-label,
.tpl-field-row .tpl-f-options,
.tpl-field-row .tpl-f-ph {
  height: 28px; padding: 0 8px; width: 100%; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 12px; background: var(--surface); color: var(--ink);
}
.tpl-f-type {
  height: 28px; border: 1px solid var(--line-strong); border-radius: 6px;
  font-size: 12px; background: var(--surface); color: var(--ink-2);
}
.tpl-f-full {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tpl-f-full input { width: 13px; height: 13px; margin: 0; }
.tpl-sec .btn.dashed { height: 30px; align-self: flex-start; padding: 0 12px; font-size: 12px; }

/* =====================================================================
   多段录音 / 评分范围 / 技能包查看
   ===================================================================== */

/* 录音历史列表（平铺在录音卡片底部） */
.rec-list-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.rec-list-head { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.rec-list {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 180px; overflow: auto; padding-right: 2px;
}
.rec-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; text-align: left;
  font-size: 12px; color: var(--ink); width: 100%;
}
.rec-item:hover { background: var(--surface-2); border-color: var(--line-strong); }
.rec-item.active {
  border-color: var(--primary); background: var(--primary-soft);
}
.ri-no { font-weight: 600; white-space: nowrap; }
.ri-tag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: rgba(37, 99, 235, .12); color: var(--ink-2); white-space: nowrap;
}
.ri-time { color: var(--muted); white-space: nowrap; }
.ri-dur { color: var(--ink-2); white-space: nowrap; }
.ri-count { margin-left: auto; font-size: 10.5px; color: var(--faint); white-space: nowrap; }

.scope-head {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 6px; font-size: 11.5px; color: var(--muted);
}
.scope-head .link-btn {
  border: 0; background: transparent; color: var(--primary);
  font-size: 11.5px; padding: 0; cursor: pointer;
}
.scope-head .link-btn:first-of-type { margin-left: auto; }
.scope-head .link-btn:hover { text-decoration: underline; }

.score-scope {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 196px; overflow: auto; padding-right: 2px;
}
.scope-group { display: flex; flex-direction: column; gap: 4px; }
.scope-title { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.scope-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer; background: var(--surface);
}
.scope-item:hover { background: var(--surface-2); border-color: var(--line-strong); }
.scope-item input { margin: 0; width: 13px; height: 13px; }
.si-name { font-size: 12px; color: var(--ink); }
.si-meta { margin-left: auto; font-size: 10.5px; color: var(--faint); }

.pack-view { display: flex; flex-direction: column; gap: 10px; }
.pack-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.pack-meta .tag {
  background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 5px; padding: 1px 6px;
}
.pack-desc { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.pack-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pack-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  background: var(--surface-2); padding: 7px 8px; border-bottom: 1px solid var(--line);
}
.pack-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.pack-table .pk-name { white-space: nowrap; }
.pack-table .pk-w { white-space: nowrap; color: var(--muted); }
.pack-table .pk-crit { color: var(--ink-2); line-height: 1.55; }
/* 弹窗体限高：内容超出时内部滚动，不再撑出屏幕 */
.modal-body.pack-view { max-height: calc(100vh - 190px); overflow: auto; }
/* 超长评分要点折叠 */
.pack-table .pk-crit.clamp { position: relative; }
.pack-table .pk-crit.clamp .pk-crit-text { max-height: 132px; overflow: hidden; }
.pack-table .pk-crit.clamp::after {
  content: ""; position: absolute; left: 0; right: 0; top: 106px; height: 28px;
  background: linear-gradient(rgba(255,255,255,0), var(--surface));
  pointer-events: none;
}
.pk-crit-toggle {
  display: inline-block; margin-top: 6px;
  border: 0; background: transparent; color: var(--primary);
  font-size: 11.5px; cursor: pointer; padding: 0;
}
.pk-crit-toggle:hover { text-decoration: underline; }
.pack-rules { display: flex; flex-direction: column; gap: 4px; }
.pack-rules .pr-title { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.pack-rules .pr-item { font-size: 12px; color: var(--ink-2); }
.pack-doc { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pack-doc-body {
  margin: 0; width: 100%; max-height: 46vh; overflow: auto;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---------------- 登录 / 初始化遮罩 ---------------- */

.auth-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 26px 26px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.auth-card h2 { margin: 0; font-size: 17px; }
.auth-sub { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-note {
  margin: 0; font-size: 12.5px; line-height: 1.6;
  background: var(--primary-soft); color: var(--ink-2);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.auth-field input {
  height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0 10px; background: var(--surface-2); outline: none;
}
.auth-field input:focus { border-color: var(--primary); background: #fff; }
.auth-btn { height: 38px; font-size: 13.5px; }
.auth-err { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--red); }

.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.user-chip::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
}

/* ---------------- 用户管理 ---------------- */

.users-body { display: flex; flex-direction: column; gap: 14px; }
.ua-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ua-row input, .ua-row select {
  height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0 9px; background: var(--surface-2); outline: none; min-width: 120px;
}
.ua-row input:focus, .ua-row select:focus { border-color: var(--primary); background: #fff; }
.users-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.users-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  background: var(--surface-2); padding: 8px 9px; border-bottom: 1px solid var(--line);
}
.users-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users-table .u-disabled { color: var(--faint); }
.u-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.u-badge.on { background: var(--green-soft); color: var(--green); }
.u-badge.off { background: var(--red-soft); color: var(--red); }
.u-role { color: var(--muted); }
.u-ops { display: flex; gap: 6px; }
.u-ops .btn { height: 26px; padding: 0 9px; font-size: 11.5px; }
