* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f5f6f8; --surface: #ffffff; --border: #e3e6ea; --border-strong: #d0d5dd;
  --text: #1d2433; --muted: #667085; --primary: #2563eb; --primary-dark: #1d4ed8;
  --red: #d92d20; --amber: #dc6803; --green: #079455; --blue-bg: #eff4ff;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* Login */
#login-view { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2ff 0%, #f5f6f8 55%, #eef8f5 100%); }
.login-card { width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px 32px; box-shadow: 0 12px 40px rgba(16,24,40,.08); }
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-mark { width: 52px; height: 52px; margin: 0 auto 14px; background: var(--primary); color: #fff; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600; }
.login-brand h1 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.login-brand p { color: var(--muted); font-size: 12px; }
#login-form label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
#login-form input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; outline: none; transition: border .15s; }
#login-form input:focus { border-color: var(--primary); }
#login-btn { width: 100%; height: 44px; margin-top: 22px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; }
#login-btn:hover { background: var(--primary-dark); }
#login-btn:disabled { opacity: .6; cursor: wait; }
.msg { margin-top: 12px; color: var(--red); font-size: 13px; min-height: 18px; }
.demo-accounts { margin-top: 24px; border-top: 1px dashed var(--border); padding-top: 18px; }
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; text-align: center; }
.demo-row { display: flex; gap: 8px; }
.demo-row button { flex: 1; padding: 8px 4px; font-size: 11px; color: var(--primary); background: var(--blue-bg); border: 1px solid #dbe7ff; border-radius: 6px; cursor: pointer; }
.demo-row button:hover { background: #dfeaff; }

/* Topbar */
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.logo { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.sys-name { font-size: 15px; font-weight: 600; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: var(--blue-bg); color: var(--primary); }
.user-name { color: var(--muted); font-size: 13px; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: var(--bg); }
.kick-banner { background: #fef3f2; border-bottom: 1px solid #fecdca; color: var(--red); padding: 10px 28px; font-size: 13px; text-align: center; }

/* Layout */
.admin-panel, .workbench { max-width: 1360px; margin: 0 auto; padding: 24px 28px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-num { font-size: 28px; font-weight: 600; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

.wb-grid { display: grid; grid-template-columns: 1fr 380px; gap: 18px; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.card-head .sub { font-weight: 400; }

/* State controls */
.state-controls { display: flex; gap: 6px; }
.state-btn { font-size: 12px; padding: 5px 12px; border: 1px solid var(--border-strong); background: #fff; color: var(--muted); border-radius: 6px; cursor: pointer; }
.state-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.permit-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: #f9fafb; border-radius: 8px; margin-bottom: 12px; font-size: 12px; }
.btn-small { padding: 5px 12px; font-size: 12px; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.btn-small.ghost { background: #fff; color: var(--muted); border: 1px solid var(--border-strong); }
.hint { color: var(--muted); font-size: 12px; }
.hint.ok { color: var(--green); }
.hint.warn { color: var(--amber); }

/* Transcript */
.transcript { height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fcfcfd; }
.transcript-empty, .empty-hint { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13px; }
.tr-row { display: flex; gap: 10px; margin-bottom: 12px; }
.tr-role { flex: 0 0 40px; font-size: 11px; padding: 2px 0; text-align: center; border-radius: 4px; height: fit-content; }
.tr-row.customer .tr-role { background: #fef0e6; color: #b54708; }
.tr-row.agent .tr-role { background: #e7f6ef; color: #067647; }
.tr-text { flex: 1; line-height: 1.6; }
/* ASR 识别中的临时行：斜体浅色，与已落定的最终字幕区分 */
.tr-row.live-partial .tr-text { color: #667085; font-style: italic; }
.tr-row.live-partial .tr-role { opacity: 0.7; }
.stream-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.btn-primary { padding: 8px 16px; font-size: 13px; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled, .btn-small:disabled { opacity: .5; cursor: not-allowed; }

/* Blindspot */
.blindspot-box { display: flex; gap: 8px; }
.blindspot-box input { flex: 1; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; outline: none; }
.blindspot-box input:focus { border-color: var(--primary); }
.blindspot-result { margin-top: 12px; font-size: 13px; color: var(--muted); }
.bs-answer { background: var(--blue-bg); border-radius: 8px; padding: 12px; color: var(--text); }
.bs-meta { font-size: 11px; margin-top: 6px; }
.bs-hint { background: #fffaeb; border: 1px solid #fedf89; border-radius: 8px; padding: 10px 12px; color: #b54708; }

/* Alerts */
.alert-list { max-height: 300px; overflow-y: auto; }
.alert-row { border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.alert-words { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.hit-word { font-weight: 600; padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.hit-word.block { background: #fee4e2; color: var(--red); }
.hit-word.alert { background: #fef0c7; color: var(--amber); }
.hit-word.warn { background: #f2f4f7; color: var(--muted); }
.hit-level { font-size: 11px; color: var(--muted); }
.alert-text { font-size: 12px; color: var(--muted); }
.count-pill { background: #fef0e6; color: #b54708; font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 500; }

/* Quality */
.quality { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.q-item { background: #f9fafb; border-radius: 8px; padding: 12px 8px; text-align: center; }
.q-label { font-size: 11px; color: var(--muted); }
.q-val { font-size: 22px; font-weight: 600; margin: 4px 0 0; }
.q-unit { font-size: 10px; color: var(--muted); }
.q-level { margin-top: 12px; text-align: center; font-size: 12px; padding: 6px; border-radius: 6px; background: #f2f4f7; color: var(--muted); }
.q-level.ok { background: #ecfdf3; color: var(--green); }
.q-level.warn { background: #fffaeb; color: var(--amber); }
.q-level.bad { background: #fef3f2; color: var(--red); }
.lk-box .btn-primary { width: 100%; }
.lk-box .hint { display: block; margin-top: 10px; line-height: 1.7; }

/* Sensitive words config */
.sw-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-height: 160px; overflow-y: auto; }
.sw-row { display: inline-flex; align-items: center; gap: 4px; background: #f9fafb; border-radius: 6px; padding: 4px 6px; }
.sw-del { border: none; background: transparent; color: #98a2b3; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.sw-del:hover { color: var(--red); }
.blindspot-box select { max-width: 120px; }

@media (max-width: 1000px) {
  .wb-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
