:root {
  font-family: Inter, "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #29434d;
  background: #f6f8f9;
  font-synthesis: none;
  --teal: #167c80;
  --line: #e1e8eb;
  --muted: #7c8d96;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, .button, .menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #d9e3e6;
  border-radius: 7px;
  background: #fff;
  color: #36535e;
  padding: 9px 14px;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover, .menu > summary:hover { background: #f0f7f7; border-color: #b4cfd0; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.primary:hover { background: #126c70; border-color: #126c70; }
.quiet { background: transparent; border-color: transparent; }
.full { width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid #d9e3e8;
  border-radius: 6px;
  padding: 10px;
  color: #29434d;
  outline-color: var(--teal);
}
input[type=checkbox] { accent-color: var(--teal); vertical-align: middle; }
textarea { resize: vertical; line-height: 1.8; }
label { display: block; font-size: 12px; color: #687e89; margin: 0 0 16px; }
label > input, label > select, label > textarea { margin-top: 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.4px; }
h2 { font-size: 18px; font-weight: 600; }
a { color: #337e85; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.7; }
.no-items { padding: 20px; color: var(--muted); font-size: 12px; line-height: 1.8; }
details { margin-bottom: 14px; }
summary { font-size: 12px; line-height: 1.6; cursor: pointer; color: #6a858e; }
details[open] > summary { margin-bottom: 12px; }

/* Navigation stays separate from the active document. */
header { height: 62px; display: flex; align-items: center; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; color: #29434d; text-decoration: none; font-size: 17px; font-weight: 650; }
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: var(--teal); border-radius: 9px; font-size: 20px; font-weight: 500; }
#workspace { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 62px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px 15px; min-width: 0; }
.asset-nav { display:flex; flex-direction:column; gap:6px; margin-top:16px; }
.asset-dialog,.knowledge-dialog { width:min(1000px,94vw); max-height:90vh; overflow:auto; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:12px; }
.knowledge-tabs,.knowledge-actions,.knowledge-tools { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.knowledge-card { border:1px solid var(--line); padding:16px; margin:12px 0; border-radius:8px; }
.knowledge-card-heading { display:flex; justify-content:space-between; gap:12px; }
.knowledge-details { display:grid; grid-template-columns:150px minmax(0,1fr); font-size:13px; gap:8px; }
.knowledge-details dd { margin:0; min-width:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.memory-pair { grid-template-columns:minmax(0,1fr); }
.memory-pair dt { font-weight:600; }
.asset-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; max-height:360px; overflow:auto; }
.reference-excerpt { white-space:pre-wrap; overflow-wrap:anywhere; }
#contextPanel section + section { margin-top:24px; border-top:1px solid var(--line); padding-top:18px; }
.new-job { width: 100%; color: var(--teal); border-color: #c8dfe0; background: #f7fbfb; }
.list-heading { color: var(--muted); font-size: 11px; margin: 28px 10px 12px; }
.job-list { display: flex; flex-direction: column; gap: 6px; }
.job-button { display: block; text-align: left; padding: 12px 10px; width: 100%; border-color: transparent; overflow: hidden; }
.job-button.active { background: #edf6f5; border-color: #d4e8e5; }
.job-button strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 500; }
.job-button small { display: block; color: #85969e; font-size: 10px; margin-top: 6px; }
.workarea { padding: 26px; min-width: 0; }
.empty { min-height: 66vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.empty h1 { font-size: 21px; margin-bottom: 12px; }
.empty p { color: var(--muted); font-size: 13px; }
.job-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 0 0 19px; }
.job-title-group { min-width: 0; }
.job-heading h1 { font-size: 20px; margin: 0 0 7px; overflow-wrap: anywhere; }
.job-heading p { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 6px 10px; border-radius: 14px; background: #edf4f3; color: #4a807a; font-size: 10px; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; padding: 1px 5px; border-radius: 10px; color: #7b8d95; background: #f0f4f5; font-size: 10px; }
.menu { position: relative; margin: 0; flex-shrink: 0; }
.menu > summary { list-style: none; margin: 0; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "⌄"; font-size: 12px; opacity: .8; }
.menu[open] > summary { margin: 0; }
#exportMenu > summary { background: var(--teal); color: #fff; border-color: var(--teal); }
#exportMenu > summary:hover { background: #126c70; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 7px); z-index: 30; display: flex; flex-direction: column; gap: 3px; width: 160px; max-width: calc(100vw - 28px); padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 8px 28px #193c491a; }
.menu-panel .button { justify-content: flex-start; width: 100%; padding: 10px 12px; border-color: transparent; }
.job-progress-row { display: flex; gap: 12px; align-items: center; min-width: 0; margin: 0 0 15px; }
.job-progress-row:has(.job-progress:empty):not(:has(button:not([hidden]))) { display: none; }
.job-progress-row > button { flex-shrink: 0; padding: 5px 8px; font-size: 11px; }
.job-progress { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.job-progress > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-progress progress { flex: 1; min-width: 50px; max-width: 220px; height: 5px; accent-color: var(--teal); border: 0; }

/* Original and translation are the two main reading surfaces. */
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; height: calc(100vh - 237px); min-height: 480px; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.pane-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 51px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.pane-heading strong, .pane-heading a { font-size: 12px; font-weight: 600; text-decoration: none; }
.page-controls { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.page-controls button { padding: 0 9px; line-height: 25px; font-size: 17px; }
#pageJump { width: 49px; padding: 4px 3px 4px 7px; font-size: 11px; }
#pageLabel { min-width: 28px; }
#pdfScroll { overflow: auto; background: #edf1f3; padding: 14px; flex: 1; }
#pdfSurface { position: relative; margin: auto; width: fit-content; box-shadow: 0 2px 8px #25465e16; }
#pdfCanvas { display: block; background: #fff; }
#highlights { position: absolute; inset: 0; pointer-events: none; }
.highlight { position: absolute; border: 2px solid #139a9b; background: #4cd1c527; box-shadow: 0 0 0 3px #ffffff60; border-radius: 2px; }
#blockList { overflow: auto; flex: 1; }
.block { padding: 19px 17px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; cursor: pointer; }
.block.selected { border-left-color: #228f93; background: #fbfdfd; }
.block-top { display: flex; gap: 8px; justify-content: space-between; align-items: center; font-size: 10px; color: #879aa2; margin-bottom: 10px; }
.block-issue-button { padding: 3px 6px; color: #98713c; background: #fffaf1; border-color: #eee2cd; font-size: 10px; }
.block textarea { min-height: 112px; padding: 12px; border-color: #e3e9ed; font-size: 13px; background: #fff; }
.block-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.block-controls button { padding: 6px 10px; font-size: 11px; }
.block-source-details { min-width: 0; margin: 0; cursor: default; }
.block-source-details > summary { color: #7a919a; font-size: 11px; }
.block-source-details[open] { flex-basis: 100%; order: 2; }
.block-source-details[open] > summary { margin-bottom: 10px; }
.block-source { padding: 11px 13px; border-radius: 6px; background: #f5f8f9; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; color: #59717e; }
.save-translation { margin-left: auto; }
.table-preview { max-width: 100%; overflow-x: auto; margin: 0 0 12px; white-space: normal; }
.table-preview table { width: 100%; border-collapse: collapse; background: #fff; font-size: 11px; line-height: 1.6; }
.table-preview caption { text-align: left; font-size: 10px; font-weight: 600; color: #527784; padding-bottom: 7px; }
.table-preview th, .table-preview td { border: 1px solid #dce6ea; padding: 8px; vertical-align: top; text-align: start; min-width: 66px; max-width: 260px; overflow-wrap: anywhere; white-space: pre-wrap; }
.table-preview th { background: #eff6f6; font-weight: 600; color: #42626d; }
.table-preview tr:nth-child(even) td { background: #fafcfc; }
.table-preview-warning { margin: 0 0 8px; padding: 8px 10px; background: #fff7e6; color: #755015; font-size: 12px; line-height: 1.6; }
.table-preview-unverified th, .table-preview-unverified td { border-style: dashed; }
.table-editor { margin: 8px 0; }
.table-editor summary { font-size: 11px; padding: 7px 0; }
.table-editor textarea { margin-top: 6px; min-height: 140px; font-family: ui-monospace, monospace; font-size: 11px; }
.table-plain-fallback { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; color: #536c7b; margin-bottom: 12px; }
.edit-feedback { margin: 12px 0; }
.edit-feedback > summary { font-size: 11px; color: #527784; }
.edit-feedback fieldset { min-width: 0; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.edit-feedback label { font-size: 12px; }
.edit-feedback button { margin: 5px 6px 5px 0; padding: 7px 9px; font-size: 11px; }
.feedback-check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; overflow-wrap: anywhere; }
.feedback-check input { width: auto; flex: 0 0 auto; margin-top: 4px; }
.feedback-warning { padding: 9px; background: #fff7e6; color: #755015; font-size: 12px; }
.project-experiences { margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); }
.project-experiences .knowledge-actions > label { flex: 1 1 200px; min-width: 0; }
.experience-text p { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 250px; overflow: auto; }

/* Dialogs contain the steps needed only when requested. */
dialog { width: min(570px, 94vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 12px; padding: 25px; color: #29434d; overflow: auto; }
dialog::backdrop { background: #23434d55; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.dialog-heading h2 { margin: 5px 0 0; }
.dialog-heading > button { flex-shrink: 0; }
#uploadDialog, #humanDialog { width: min(460px, 94vw); }
.dropzone { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 30px 14px; margin-bottom: 23px; border: 1px dashed #b4ccd0; border-radius: 8px; background: #f8fbfb; text-align: center; cursor: pointer; }
.dropzone:focus-within { outline: 2px solid var(--teal); outline-offset: 3px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #527681; font-size: 13px; }
.file-symbol { font-size: 25px; color: #7aacae; line-height: 1; }
.language-row { display: grid; grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr); align-items: center; gap: 10px; }
.language-row > span { color: #91a4ad; font-size: 14px; }
.language-row select { font-size: 13px; }
.recognition-settings { margin: 0 0 22px; }
.recognition-settings summary { font-size: 11px; }
.recognition-settings[open] label { margin: 0; }
.recognition-settings select { font-size: 12px; }
.acknowledge { display: flex; align-items: flex-start; gap: 7px; line-height: 1.8; margin: 21px 0; }
.acknowledge input { flex-shrink: 0; margin: 5px 0 0; }
#issuesDialog .badge { margin-left: 5px; vertical-align: middle; }
#issueList { max-height: 64vh; overflow: auto; }
.issue { display: block; width: 100%; text-align: left; margin-bottom: 10px; border: 1px solid #ece1ce; border-radius: 7px; padding: 15px; background: #fffcf7; }
.issue:hover { border-color: #d0bf9d; }
.issue h3 { margin: 0 0 7px; color: #96703a; font-size: 12px; }
.issue p { margin-bottom: 8px; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.issue small { color: #9a927f; font-size: 10px; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - 62px); }
.login-card { width: min(390px, 90vw); padding: 32px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 15px 50px #163e4b09; }
.login-card h1 { margin-bottom: 25px; }
.login-card .primary { margin-top: 20px; }
#notice { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); padding: 14px 18px; background: #294f59; color: #fff; border-radius: 9px; font-size: 12px; line-height: 1.7; box-shadow: 0 5px 30px #18333f33; overflow-wrap: anywhere; }
#systemBanner { padding: 10px 24px; background: #fff8ea; border-bottom: 1px solid #eddfbf; color: #927546; font-size: 12px; line-height: 1.7; }
.error-panel { padding: 12px; margin-bottom: 15px; background: #fff2ef; border: 1px solid #ead0ca; border-radius: 7px; color: #9c574b; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }

@media (max-width: 1050px) {
  #workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding: 22px 12px; }
  .workarea { padding: 23px 18px; }
  .review-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .original-pane, .translation-pane { height: 65vh; min-height: 430px; }
}
@media (max-width: 650px) {
  header { height: 56px; padding: 0 16px; }
  .brand { font-size: 16px; }
  .brand-icon { width: 29px; height: 29px; font-size: 18px; }
  #workspace { display: block; min-height: calc(100vh - 56px); }
  .sidebar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .new-job { flex-shrink: 0; width: auto; padding: 9px 11px; }
  .list-heading { flex-shrink: 0; margin: 0; font-size: 10px; }
  .job-list { flex: 1; min-width: 0; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 3px; }
  .job-button { flex: 0 0 154px; width: 154px; padding: 8px 10px; }
  .job-button strong { font-size: 11px; }
  .job-button small { font-size: 9px; margin-top: 4px; }
  .job-list .no-items { padding: 4px; white-space: nowrap; margin: 0; }
  .workarea { padding: 22px 16px; }
  .empty { min-height: 55vh; }
  .empty h1 { font-size: 19px; }
  .job-heading { gap: 10px; }
  .job-heading h1 { font-size: 17px; }
  .badge { padding: 5px 8px; font-size: 9px; }
  .toolbar { margin-bottom: 16px; }
  .toolbar button, .toolbar .menu > summary { padding: 8px 11px; font-size: 11px; }
  .job-progress-row { gap: 7px; }
  .job-progress { gap: 8px; }
  .job-progress progress { max-width: 100px; }
  .review-grid { gap: 15px; }
  .original-pane, .translation-pane { height: 65vh; min-height: 420px; }
  dialog { padding: 22px 19px; }
  #notice { right: 16px; bottom: 16px; }
}
@media (max-width: 390px) {
  .sidebar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .list-heading { display: none; }
  .job-progress-row { flex-wrap: wrap; }
  .job-progress { flex-basis: 100%; }
}
