:root {
  --ink: #142033;
  --muted: #687386;
  --line: #e5eaf0;
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --blue: #246bfd;
  --blue-dark: #1750c9;
  --green: #19a474;
  --amber: #dd8b1c;
  --red: #d94a58;
  --shadow: 0 12px 40px rgba(28, 46, 74, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  height: 72px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand, .top-actions, .inline-actions { display: flex; align-items: center; gap: 12px; }
.brand > div { display: grid; gap: 2px; }
.brand span:not(.brand-mark) { color: var(--muted); font-size: 12px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #266bff, #18a777); font-weight: 800; box-shadow: 0 8px 24px rgba(36,107,253,.25); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; }
.badge { padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.good { color: #087854; background: #e5f7f0; }
.badge.warn { color: #9d5a00; background: #fff2da; }
.badge.muted { color: var(--muted); background: #eef1f5; }

main { width: min(1440px, 92vw); margin: 0 auto; padding: 38px 0 72px; }
.hero { display: flex; justify-content: space-between; gap: 36px; align-items: end; padding: 30px 0 34px; }
.hero h1 { margin: 7px 0 10px; max-width: 720px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.04em; line-height: 1.12; }
.hero p:not(.eyebrow) { max-width: 720px; color: var(--muted); margin: 0; line-height: 1.7; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.hero-actions { display: grid; grid-template-columns: auto auto; align-items: end; gap: 9px; min-width: 300px; }
.hero-actions label { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.hero-actions select { grid-column: 1 / -1; }

button, select, input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fff; color: var(--ink); }
button { font-weight: 700; }
button:hover { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
button[data-busy="true"] { cursor: wait; }
button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-dark); }
button.secondary { color: var(--blue); border-color: #cbd9ff; background: #f6f8ff; }
.feishu-link {
  display: inline-flex;
  align-items: center;
  padding: 9px 13px;
  border: 1px solid #cbd9ff;
  border-radius: 10px;
  color: var(--blue);
  background: #f6f8ff;
  font-weight: 650;
  text-decoration: none;
}
.feishu-link:hover { background: #eaf0ff; }
.feishu-panel .panel-heading { flex-wrap: wrap; gap: 10px; }
.feishu-panel .inline-actions, .feishu-controls { flex-wrap: wrap; }
.feishu-controls { display: flex; align-items: end; gap: 10px; }
.feishu-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.feishu-job-list { display: grid; gap: 8px; }
.feishu-job { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.feishu-job p { margin: 5px 0 0; line-height: 1.7; }
.feishu-job strong { font-size: 13px; }
#feishuJobFeedback:empty { display: none; }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }

.notice { padding: 15px 18px; margin-bottom: 22px; border: 1px solid #f2ce87; border-radius: 12px; background: #fff7e8; color: #84520d; line-height: 1.6; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.status-card { display: flex; flex-direction: column; gap: 7px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.status-card > span { color: var(--muted); font-size: 12px; }
.status-card strong { font-size: 15px; line-height: 1.5; }
.status-card small { color: var(--muted); line-height: 1.6; }
.coverage-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.metric-note { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.metric-card { position: relative; overflow: hidden; display: grid; gap: 9px; min-height: 150px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.metric-card.accent-green::before { background: var(--green); }
.metric-card.accent-amber::before { background: var(--amber); }
.metric-card.accent-red::before { background: var(--red); }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { font-size: 35px; letter-spacing: -.04em; }

.panel-grid { display: grid; gap: 18px; margin-top: 18px; }
.two-columns { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); }
.panel { margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.panel-grid > .panel { margin-top: 0; }
.panel-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel h2 { margin: 4px 0 0; font-size: 19px; }
.hint { color: var(--muted); font-size: 12px; }

.bar-chart { height: 230px; display: flex; gap: 6px; align-items: end; padding-top: 18px; overflow-x: auto; }
.bar-column { min-width: 18px; flex: 1 0 18px; display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 7px; height: 100%; }
.bar { width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #5d8cff, #276bfc); transition: height .25s ease; }
.bar-column span { writing-mode: vertical-rl; transform: rotate(180deg); color: var(--muted); font-size: 9px; white-space: nowrap; }
.donut-wrap { min-height: 230px; display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 24px; }
.donut { width: 150px; aspect-ratio: 1; border-radius: 50%; position: relative; }
.donut::after { content: ""; position: absolute; inset: 25px; border-radius: 50%; background: #fff; }
.legend { display: grid; gap: 12px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td:first-child { font-weight: 700; }
.employee-heading { flex-wrap: wrap; margin-bottom: 8px; }
.employee-filters { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-left: auto; }
.employee-filters label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.employee-filters select { width: 180px; max-width: 100%; min-width: 0; }
.employee-filter-status { margin: 0 0 8px; line-height: 1.6; }
.directory-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.directory-toolbar p { margin: 0; line-height: 1.6; }
.employee-more { margin-top: 12px; }
.identity-panel { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.identity-panel summary { cursor: pointer; font-size: 14px; font-weight: 700; }
.identity-panel > .hint { line-height: 1.7; }
.directory-import { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.directory-import label { font-size: 13px; font-weight: 700; }
.directory-import input { width: min(345px, 100%); min-width: 0; padding: 7px 10px; font-size: 13px; }
#directoryImportStatus:empty { display: none; }
.identity-list { display: grid; gap: 10px; margin-bottom: 12px; max-height: 440px; overflow-y: auto; }
.identity-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) repeat(2, minmax(100px, 1fr)) auto; gap: 12px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.identity-caption { align-self: center; min-width: 0; overflow-wrap: anywhere; }
.identity-caption strong { font-size: 13px; }
.identity-caption small { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; }
.identity-row label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.identity-row input { width: 100%; min-width: 0; }
.identity-row button { white-space: nowrap; }
.rank-list, .conversation-list, .job-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(90px, 130px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.rank-track { height: 8px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.rank-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2d70ff, #68a2ff); }
.conversation-row, .job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; }
.conversation-row small, .job-row small { display: block; color: var(--muted); margin-top: 4px; }
.conversation-row button, .job-row button { padding: 7px 10px; font-size: 12px; }
.conversation-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.conversation-caption, .conversation-details, .viewer-heading h2, .summary-conversation, .job-row > div { min-width: 0; overflow-wrap: anywhere; }
.conversation-caption strong { font-size: 14px; }
.conversation-caption small, .conversation-details { line-height: 1.5; }
.conversation-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; align-items: center; margin-top: 5px; color: var(--muted); font-size: 12px; }
.conversation-kind { padding: 2px 7px; border-radius: 6px; color: #244a9d; background: #eaf0ff; font-weight: 700; }
.reviewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.reviewer-toolbar p { margin: 0; }
.reviewer-toolbar button { padding: 6px 8px; font-size: 12px; }
.conversation-search { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.conversation-search label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.viewer-more { margin-top: 12px; }
.conversation-viewer { width: min(720px, calc(100% - 24px)); max-height: 88vh; padding: 20px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.conversation-viewer::backdrop { background: rgb(20 32 51 / 54%); }
.viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.viewer-heading h2 { margin: 0; font-size: 20px; }
.viewer-status { margin: 12px 0; color: var(--muted); line-height: 1.55; }
.viewer-status:empty { display: none; }
#reviewerLoginMount { overflow-x: auto; }
.conversation-export .hint { margin: 10px 0; }
.conversation-export .hint:empty { display: none; }
.conversation-export .inline-actions { flex-wrap: wrap; justify-content: flex-start; }
.conversation-export select { max-width: min(280px, 76vw); }
.conversation-export input { min-width: 0; }
#conversationExportMount:not(:empty) { margin-bottom: 10px; }
.conversation-guide { line-height: 1.6; }
.analysis-heading { flex-wrap: wrap; margin-bottom: 10px; }
.job-progress { margin: 0 0 10px; }
.completed-jobs { margin-top: 12px; }
.completed-jobs summary { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 700; }
.completed-jobs .job-list { margin-top: 10px; }
.job-result { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 8px; background: #f7f9fc; color: #38465b; line-height: 1.6; }
.summary-conversation { margin: 10px 0; font-weight: 700; }
.summary-actions { margin-top: 14px; }
.summary-feedback:empty { display: none; }

.auth-panel { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #e4ebff, transparent 40%), radial-gradient(circle at 80% 80%, #daf4ea, transparent 42%), #f7f9fc; }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 24px 90px rgba(28,46,74,.15); }
.auth-card h1 { margin: 5px 0 0; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.auth-card label { font-size: 13px; font-weight: 700; }
.form-error { min-height: 20px; color: var(--red) !important; }
.toast { position: fixed; right: 28px; bottom: 28px; max-width: 440px; padding: 13px 16px; color: #fff; background: #1d2939; border-radius: 11px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: 1fr; }
  .hero { align-items: stretch; flex-direction: column; }
  .hero-actions { width: min(440px, 100%); }
}
@media (max-width: 620px) {
  .topbar { padding: 0 18px; }
  main { width: calc(100% - 28px); padding-top: 18px; }
  .brand > div span, .config-badge { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .status-grid, .identity-row { grid-template-columns: 1fr; }
  .employee-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin-left: 0; }
  .employee-filters label { grid-template-columns: minmax(0, 1fr); }
  .employee-filters select { width: 100%; padding-inline: 8px; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .inline-actions { flex-wrap: wrap; justify-content: end; }
  .summary-actions { justify-content: start; }
}
