:root {
  color-scheme: light;
  --ink: #16233a;
  --muted: #68758a;
  --line: #dbe4f0;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --green: #1955b8;
  --green-dark: #083e98;
  --green-soft: #e8f2ff;
  --amber: #9a5b0b;
  --amber-soft: #fff4dd;
  --red: #a33838;
  --shadow: 0 12px 34px rgba(8, 62, 152, .12);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #f3f8ff 0 58%, #e7f2ff 58%); }
.login-panel { width: min(390px, 100%); padding: 38px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-panel h1 { margin: 20px 0 4px; font-size: 24px; }
.login-panel p { margin: 0 0 26px; color: var(--muted); }
.login-panel label + label { margin-top: 14px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--green); font: 700 25px/1 Georgia, serif; }
.brand-mark.login-brand { font-family: Arial, sans-serif; font-size: 17px; }
.brand-mark.small { width: 34px; height: 34px; font-family: Arial, sans-serif; font-size: 12px; }
label { display: grid; gap: 7px; color: #34435a; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #c7d4e5; border-radius: 5px; padding: 10px 11px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25, 85, 184, .12); }
.button { min-height: 38px; border: 1px solid transparent; border-radius: 5px; padding: 8px 15px; font-weight: 700; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #c7d4e5; color: #27466f; background: white; }
.button.danger { color: var(--red); background: transparent; }
.button.wide { width: 100%; margin-top: 18px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; color: #edf6ff; background: #083e98; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 25px; font-size: 16px; }
nav { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; border-radius: 5px; padding: 11px 13px; text-align: left; color: #c5ddfa; background: transparent; }
.nav-item:hover, .nav-item.active { color: white; background: #1955b8; }
.nav-item.logout { margin-top: auto; }
.workspace { min-width: 0; padding: 34px 40px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: 25px; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; }
.account-button { border: 1px solid #b8cce5; color: #174b91; background: #edf5ff; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metrics div { display: grid; gap: 4px; padding: 18px 22px; border-right: 1px solid var(--line); }
.metrics div:last-child { border: 0; }
.metrics span { color: var(--muted); }
.metrics strong { font-size: 26px; }
.exam-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 18px; }
.exam-filters label { min-width: 168px; gap: 5px; color: var(--muted); font-size: 12px; }
.exam-filters select { min-height: 38px; padding-block: 7px; color: var(--ink); font-size: 14px; }
.table-wrap { margin-top: 22px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 1120px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e7edf5; text-align: left; vertical-align: middle; }
th { color: #53637a; background: #f8faff; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.exam-table { min-width: 0; table-layout: fixed; }
.exam-table th:nth-child(1) { width: 28%; }
.exam-table th:nth-child(2) { width: 15%; }
.exam-table th:nth-child(3) { width: 13%; }
.exam-table th:nth-child(4) { width: 16%; }
.exam-table th:nth-child(5) { width: 8%; }
.exam-table th:nth-child(6) { width: 20%; }
.exam-table th, .exam-table td { padding-inline: 10px; }
.exam-title { display: grid; gap: 2px; min-width: 0; }
.exam-title strong { overflow-wrap: anywhere; }
.exam-title small { color: var(--muted); }
.exam-meta { gap: 6px; }
.exam-meta-item { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: baseline; gap: 6px; min-width: 0; }
.exam-meta-item span { color: var(--muted); font-size: 11px; }
.exam-meta-item strong, .exam-meta-item time { min-width: 0; color: #405572; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.exam-meta-item time { white-space: nowrap; }
.tag, .module-count { display: inline-flex; margin: 2px 5px 2px 0; border-radius: 4px; padding: 3px 7px; white-space: nowrap; font-size: 12px; }
.tag { color: #405572; background: #edf3fa; }
.module-count { color: var(--green-dark); background: var(--green-soft); }
.parse-progress { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.parse-progress strong { min-width: 34px; color: var(--green-dark); font-size: 12px; text-align: right; }
.parse-progress small { width: 100%; color: var(--muted); font-size: 11px; }
.parse-progress.failed .progress-track i { background: var(--red); }
.progress-track { width: min(66px, calc(100% - 48px)); min-width: 38px; height: 7px; overflow: hidden; border-radius: 4px; background: #dce8f7; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: #4aa3f5; }
.status { display: inline-flex; border-radius: 4px; padding: 3px 8px; font-size: 12px; font-weight: 700; }
.status.published { color: var(--green-dark); background: var(--green-soft); }
.status.draft { color: var(--amber); background: var(--amber-soft); }
.status.active { color: var(--green-dark); background: var(--green-soft); }
.status.disabled { color: var(--red); background: #fbeaea; }
.status.neutral { color: #5f6f84; background: #edf1f6; }
.status.processing, .status.queued { color: #15519d; background: #e7f1ff; }
.status.completed { color: #16633d; background: #e5f4ec; }
.status.failed { color: var(--red); background: #fbeaea; }
.actions-cell { text-align: right; white-space: normal; }
.table-action { border: 0; padding: 5px 8px; color: var(--green); background: transparent; font-weight: 700; }
.exam-table .table-action { padding-inline: 5px; }
.action-list { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; }
.table-action.delete { color: var(--red); }
.table-action:disabled { color: #8998ac; cursor: wait; }
.table-action.unavailable:disabled { opacity: .65; cursor: not-allowed; }
.import-jobs { margin-top: 18px; padding: 16px 18px; border-block: 1px solid #c8daf0; background: #f5f9ff; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.import-job-rows { display: grid; gap: 10px; margin-top: 14px; }
.import-job-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr) minmax(148px, auto); align-items: center; gap: 18px; padding-top: 10px; border-top: 1px solid #dbe6f3; }
.job-name { display: grid; gap: 3px; min-width: 0; }
.job-name strong, .job-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-name small { color: var(--muted); }
.job-progress { display: grid; grid-template-columns: minmax(90px, 1fr) auto; align-items: center; gap: 10px; }
.job-progress .progress-track { width: 100%; }
.job-progress span { color: #31547e; font-size: 12px; white-space: nowrap; }
.job-completed-time { display: grid; gap: 1px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.job-completed-time strong { color: #31547e; font-size: 12px; font-weight: 600; }
.import-jobs-footer { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid #dbe6f3; }
.import-jobs-footer .button { min-height: 34px; padding: 6px 13px; font-size: 12px; }
.empty { padding: 50px; text-align: center; color: var(--muted); }
dialog { width: min(940px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 22px 80px rgba(8, 38, 88, .3); }
dialog::backdrop { background: rgba(8, 30, 66, .5); }
#examForm { padding: 0 26px 24px; }
.dialog-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; margin: 0 -26px 24px; padding: 20px 26px; border-bottom: 1px solid var(--line); background: white; }
.dialog-header h2 { margin: 0; font-size: 20px; }
.dialog-header p, .editor-heading p { margin: 3px 0 0; color: var(--muted); }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 4px; color: #4a5b72; background: transparent; font-size: 26px; line-height: 1; }
.icon-button:hover { background: #edf3fa; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.upload-band { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px -26px; padding: 20px 26px; border-block: 1px solid var(--line); background: #f7faff; }
.upload-band small { color: var(--muted); font-weight: 400; }
.upload-band input { padding: 8px; background: white; }
.segment-info { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: -8px 0 20px; color: var(--muted); font-size: 12px; }
.segment-info strong { width: 100%; color: #34435a; font-size: 13px; }
.batch-dialog { width: min(820px, calc(100vw - 32px)); }
#batchForm { padding: 0 26px 24px; }
.account-dialog { width: min(680px, calc(100vw - 32px)); }
#accountForm { padding: 0 26px 24px; }
.report-dialog { width: min(760px, calc(100vw - 32px)); }
.report-panel { padding: 0 26px 24px; }
.media-dialog { width: min(1040px, calc(100vw - 32px)); }
.media-panel { padding: 0 26px 24px; }
.media-content { min-height: 160px; }
.document-preview-frame { width: 100%; height: min(72vh, 780px); display: block; border: 1px solid var(--line); background: white; }
.document-preview-image { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.answer-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); background: var(--line); }
.answer-preview-grid div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: white; }
.answer-preview-grid span { color: var(--muted); }
.audio-preview-list { display: grid; gap: 14px; }
.audio-preview-item { display: grid; grid-template-columns: minmax(130px, .35fr) minmax(240px, 1fr); align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.audio-preview-item:last-child { border-bottom: 0; }
.audio-preview-item audio { width: 100%; }
.report-status { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.report-status strong { font-size: 24px; color: var(--green-dark); }
.report-status > span:last-child { color: var(--muted); }
.report-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.report-metrics div { display: grid; gap: 4px; padding: 14px 10px; }
.report-metrics span, .report-details span { color: var(--muted); font-size: 12px; }
.report-metrics strong { font-size: 20px; }
.report-section { margin-top: 22px; }
.report-section h3 { margin: 0 0 10px; font-size: 15px; }
.report-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.report-details div { display: grid; gap: 4px; min-width: 0; padding: 11px 13px; background: white; }
.report-details strong { overflow-wrap: anywhere; }
.report-warnings { display: grid; gap: 8px; }
.report-warnings p { margin: 0; padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.report-warnings .report-ok { border-color: var(--green); background: var(--green-soft); }
.report-unparsed { display: grid; gap: 8px; }
.unparsed-group { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 11px 13px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.unparsed-group strong { overflow-wrap: anywhere; }
.unparsed-group span { color: #6e4b18; white-space: nowrap; }
.report-unparsed .report-ok { margin: 0; padding: 10px 12px; border-left: 3px solid var(--green); background: var(--green-soft); }
.account-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.account-summary div { display: grid; gap: 5px; min-height: 82px; align-content: center; padding: 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.account-summary div:nth-child(2n) { border-right: 0; }
.account-summary div:nth-last-child(-n+2) { border-bottom: 0; }
.account-summary span { color: var(--muted); font-size: 12px; }
.account-summary strong { overflow-wrap: anywhere; }
.password-heading { margin: 24px 0 14px; font-size: 16px; }
.zip-import-band { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; margin: 22px 0 0; padding: 18px 20px; border: 1px solid #b8d4f3; border-radius: 7px; background: #f0f7ff; }
.zip-picker { display: grid; gap: 8px; }
.zip-picker span { font-weight: 700; }
.zip-picker small, .zip-import-action small { color: var(--muted); font-weight: 400; }
.zip-picker input { padding: 8px; background: white; }
.zip-import-action { display: grid; justify-items: end; gap: 7px; }
.user-overview { display: grid; grid-template-columns: 1.15fr repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.user-overview > div { min-height: 132px; padding: 20px 22px; border-right: 1px solid var(--line); }
.user-overview > div:last-child { border-right: 0; }
.total-users { display: grid; align-content: center; gap: 5px; }
.total-users > span, .period-stat > span { color: var(--muted); }
.total-users > strong { font-size: 34px; }
.total-users > small { color: var(--green); }
.total-users > small.warning { color: var(--amber); }
.period-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.period-stat > span { grid-column: 1 / -1; font-weight: 700; }
.period-stat div { display: grid; gap: 2px; }
.period-stat strong { font-size: 26px; }
.period-stat small { color: var(--muted); }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-heading h3 { margin: 0; }
.code-editor { height: 280px; margin-top: 12px; resize: vertical; font: 12px/1.55 Consolas, monospace; }
.answers-field { margin-top: 15px; }
.dialog-footer { position: sticky; bottom: -24px; display: flex; justify-content: flex-end; gap: 10px; margin: 20px -26px -24px; padding: 16px 26px; border-top: 1px solid var(--line); background: white; }
.error { min-height: 20px; margin: 8px 0 0 !important; color: var(--red) !important; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 11px 16px; border-radius: 5px; color: white; background: #123364; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1400px) {
  .exam-table-wrap { overflow: visible; border: 0; background: transparent; }
  .exam-table, .exam-table tbody { display: block; width: 100%; }
  .exam-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .exam-table tbody { display: grid; gap: 9px; }
  .exam-table tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px 8px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
  .exam-table td { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 6px; border: 0; text-align: left; }
  .exam-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600; }
  .exam-table td:first-child { grid-column: 1 / span 3; grid-row: 1; padding-bottom: 6px; border: 0; }
  .exam-table td:nth-child(2) { grid-column: 4 / span 2; grid-row: 1; }
  .exam-table td:nth-child(3) { grid-column: 1 / span 2; grid-row: 2; display: flex; flex-wrap: wrap; align-content: start; align-items: center; gap: 4px; }
  .exam-table td:nth-child(3)::before { width: 100%; }
  .exam-table td:nth-child(4) { grid-column: 3 / span 2; grid-row: 2; }
  .exam-table td:nth-child(5) { grid-column: 6; grid-row: 1; }
  .exam-table .actions-cell { grid-column: 5 / span 2; grid-row: 2; display: flex; flex-wrap: wrap; align-content: start; align-items: center; justify-content: flex-start; }
  .exam-table .actions-cell::before { width: 100%; text-align: left; }
  .exam-table .tag, .exam-table .status { justify-self: start; }
  .exam-table .module-count { margin: 0; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .exam-table tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .exam-table td:first-child { grid-column: 1 / span 2; grid-row: 1; }
  .exam-table td:nth-child(2) { grid-column: 3 / span 2; grid-row: 1; }
  .exam-table td:nth-child(3) { grid-column: 1 / span 2; grid-row: 2; }
  .exam-table td:nth-child(4) { grid-column: 3; grid-row: 2; }
  .exam-table td:nth-child(5) { grid-column: 4; grid-row: 2; }
  .exam-table .actions-cell { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; }
  .brand { grid-column: 1; padding: 0; }
  nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .nav-item { width: 100%; padding: 9px 8px; text-align: center; white-space: nowrap; }
  .nav-item.logout { grid-column: 2; grid-row: 1; width: auto; margin: 0; }
  .workspace { padding: 24px 16px 50px; }
  .metrics { grid-template-columns: 1fr; }
  .user-overview { grid-template-columns: 1fr; }
  .user-overview > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .account-summary { grid-template-columns: 1fr; }
  .account-summary div, .account-summary div:nth-child(2n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .account-summary div:last-child { border-bottom: 0; }
  .metrics div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics div:last-child { border-bottom: 0; }
  .exam-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exam-filters label { min-width: 0; }
  .form-grid, .upload-band { grid-template-columns: 1fr; }
  .zip-import-band { grid-template-columns: 1fr; }
  .zip-import-action { justify-items: stretch; }
  .import-job-row { grid-template-columns: 1fr; gap: 8px; }
  .job-completed-time { grid-template-columns: auto 1fr; gap: 8px; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-details { grid-template-columns: 1fr; }
  .audio-preview-item { grid-template-columns: 1fr; gap: 8px; }
  .unparsed-group { grid-template-columns: 1fr; }
  .unparsed-group span { white-space: normal; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column-reverse; }
  .exam-table tr { grid-template-columns: 1fr; gap: 2px; padding: 11px 10px; }
  .exam-table td:nth-child(n+2) { grid-column: auto; grid-row: auto; }
  .exam-table td:first-child, .exam-table .actions-cell { grid-column: auto; }
  .exam-table .exam-meta { gap: 5px; }
  .exam-table .exam-meta-item { grid-template-columns: 56px minmax(0, 1fr); }
  .exam-table .actions-cell { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; padding-top: 10px; border-top: 1px solid #e7edf5; }
  .exam-table .actions-cell::before { width: 100%; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 480px) {
  .exam-filters { grid-template-columns: 1fr; }
  .exam-table tr { grid-template-columns: 1fr; }
  .exam-table td:first-child, .exam-table .actions-cell { grid-column: auto; }
}
