@layer reset, base, layout, components, pages, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button, select { cursor: pointer; }
  button { color: inherit; }
  img { display: block; max-width: 100%; }
}
@layer base {
  :root { --paper: #f4f2ec; --surface: #fffefa; --ink: #1e343b; --muted: #61747a; --line: #dedfd5; --navy: #172a31; --jade: #236953; --jade-dark: #194e3e; --jade-pale: #eaf2eb; --amber: #8c5822; --amber-pale: #fff2dc; --red: #a44438; --red-pale: #fff0e9; --radius: 10px; --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif; --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
  html { scroll-behavior: smooth; }
  body { font: 14px/1.65 var(--sans); color: var(--ink); background: var(--paper); }
  a { color: var(--jade); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
  :focus-visible { outline: 3px solid #ba823e; outline-offset: 3px; }
  button:disabled { cursor: not-allowed; opacity: .48; }
  h1, h2, h3 { line-height: 1.3; }
  h1 { font: 600 clamp(27px, 3vw, 36px)/1.3 var(--serif); letter-spacing: .04em; }
  h2 { font-size: 19px; font-weight: 650; }
  h3 { font-size: 16px; }
  small { font-size: 12px; }
  .muted { color: var(--muted); }
  .mono, .number { font-variant-numeric: tabular-nums; }
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
  .skip-link { position: fixed; top: -80px; left: 20px; z-index: 100; background: var(--surface); padding: 10px 20px; }
  .skip-link:focus { top: 10px; }
  .eyebrow { color: var(--jade); font-size: 11px; font-weight: 750; letter-spacing: .17em; margin-bottom: 9px; }
  .subtext { margin-top: 10px; color: var(--muted); max-width: 760px; }
  .nowrap { white-space: nowrap; }
}
@layer layout {
  .shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
  .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy); color: #c1cdd0; padding: 30px 18px 20px; z-index: 20; }
  .brand { display: flex; align-items: center; gap: 12px; color: #fffdf4; margin: 0 8px 35px; text-decoration: none; }
  .brand-seal { display: inline-grid; place-items: center; flex-shrink: 0; width: 42px; height: 46px; background: #b78958; color: #fff9eb; border-radius: 3px; font: 28px var(--serif); box-shadow: inset 0 0 0 3px #b78958, inset 0 0 0 4px #dec5a3; }
  .brand strong { display: block; font: 600 25px/1.3 var(--serif); letter-spacing: .15em; }
  .brand small { display: block; font-size: 10px; letter-spacing: .08em; color: #acbcbf; }
  .nav-group-label { font-size: 10px; letter-spacing: .12em; color: #8ba0a4; padding: 20px 14px 8px; }
  .nav-link { width: 100%; display: flex; align-items: center; gap: 12px; border-radius: 6px; padding: 11px 14px; color: #c1cdd0; text-decoration: none; margin: 3px 0; border: 1px solid transparent; }
  .nav-link:hover { background: #233b42; color: white; }
  .nav-link.active { color: #fffef6; background: #2d494a; border-color: #43625b; }
  .nav-link svg { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
  .sidebar-bottom { margin-top: auto; padding: 28px 12px 0; color: #91a7ac; font-size: 11px; line-height: 1.9; }
  .sidebar-bottom strong { font: 22px var(--serif); display: block; color: #d4dbcf; margin-bottom: 8px; letter-spacing: .1em; }
  .workspace { min-width: 0; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 77px; border-bottom: 1px solid var(--line); padding: 14px 38px; background: #faf9f3; }
  .topbar-left, .account { display: flex; align-items: center; gap: 12px; }
  .topbar-title { font-size: 12px; color: var(--muted); letter-spacing: .05em; }
  .account-name { line-height: 1.4; text-align: right; }
  .avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: #e1e8dc; color: var(--jade); font-family: var(--serif); font-size: 19px; }
  .menu-toggle, .menu-backdrop { display: none; }
  main { padding: 33px 38px 55px; max-width: 1700px; margin: auto; }
  .page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 27px; }
  .page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding-top: 7px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
  .section-gap { margin-top: 24px; }
  .split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); gap: 22px; }
  .stack { display: grid; gap: 18px; }
  .flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .between { justify-content: space-between; }
}
@layer components {
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 550; line-height: 1.4; transition: background .15s, border-color .15s; }
  .btn:hover { background: #eeefe7; border-color: #b4c1b4; }
  .btn.primary { background: var(--jade); color: white; border-color: var(--jade); }
  .btn.primary:hover { background: var(--jade-dark); }
  .btn.danger { color: var(--red); border-color: #e7c8bc; background: #fffbf8; }
  .btn.small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
  .btn.ghost { border-color: transparent; background: transparent; }
  .btn svg { width: 16px; height: 16px; }
  .icon-btn { width: 35px; height: 35px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; }
  .icon-btn svg { width: 17px; height: 17px; }
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .panel-head { padding: 20px 23px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
  .panel-head p { margin-top: 4px; font-size: 12px; color: var(--muted); }
  .panel-body { padding: 23px; }
  .panel-foot { padding: 14px 23px; border-top: 1px solid var(--line); background: #fafaf4; }
  .field { display: grid; gap: 6px; min-width: 0; }
  .field > label, .field-label { font-size: 12px; font-weight: 650; }
  .field small { color: var(--muted); line-height: 1.6; }
  .field input, .field select, .field textarea, .filter-select { width: 100%; border: 1px solid #cdd4c9; background: #fffefa; color: var(--ink); min-height: 41px; border-radius: 5px; padding: 9px 11px; line-height: 1.5; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--jade); }
  .field textarea { min-height: 104px; resize: vertical; }
  .field input:disabled, .field select:disabled, .field textarea:disabled { background: #efefe9; color: #73817d; }
  .field input[type=checkbox], .field input[type=radio] { width: 16px; min-height: 16px; height: 16px; accent-color: var(--jade); }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
  .form-grid .full { grid-column: 1 / -1; }
  fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
  legend { font-size: 13px; font-weight: 650; margin-bottom: 10px; }
  .checklist { display: flex; flex-wrap: wrap; gap: 9px; }
  .check { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-size: 12px; }
  .check:has(input:checked) { background: var(--jade-pale); border-color: #85ae91; }
  input[type=checkbox], input[type=radio] { accent-color: var(--jade); }
  .divider { height: 1px; background: var(--line); margin: 21px 0; }
  .badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 550; white-space: nowrap; line-height: 1.5; color: #586d71; background: #edf0ec; }
  .badge.good { background: var(--jade-pale); color: #286449; }
  .badge.warn { background: var(--amber-pale); color: var(--amber); }
  .badge.bad { background: var(--red-pale); color: var(--red); }
  .notice { border: 1px solid #d4ddd1; border-left: 3px solid #6c9777; background: #f3f6ee; padding: 13px 16px; font-size: 12px; line-height: 1.8; border-radius: 4px; }
  .notice.warn { border-color: #e6d7b7; border-left-color: #ad7a34; background: #fffaed; color: #775722; }
  .notice.error, .form-error { border-color: #e5c1b8; border-left-color: var(--red); background: var(--red-pale); color: #8b3c31; }
  .form-error:empty { display: none; }
  .form-error { padding: 11px 14px; border-radius: 4px; margin-bottom: 14px; font-size: 13px; }
  .table-wrap { width: 100%; overflow: auto; }
  table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
  th { color: #6b7c7d; font-size: 11px; font-weight: 600; background: #f8f8f1; padding: 12px 20px; border-bottom: 1px solid var(--line); }
  td { padding: 15px 20px; border-bottom: 1px solid #e8e9e0; font-size: 12px; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover td { background: #fafbf4; }
  td strong { font-size: 13px; font-weight: 600; }
  td .secondary { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
  .empty { text-align: center; color: var(--muted); padding: 52px 22px; }
  .empty .empty-glyph { display: block; margin: 0 auto 15px; width: 58px; height: 58px; border: 1px solid #d4decd; color: #84a28b; font: 31px/58px var(--serif); border-radius: 9px; background: #f5f8ef; }
  .empty h3 { color: var(--ink); margin-bottom: 8px; }
  .empty p { max-width: 520px; margin: 0 auto 17px; font-size: 13px; }
  .loading { min-height: 240px; display: grid; place-content: center; text-align: center; gap: 14px; color: var(--muted); }
  .spinner { width: 25px; height: 25px; border: 2px solid #d3ddd0; border-top-color: var(--jade); border-radius: 50%; animation: spin .7s linear infinite; margin: auto; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 23px; }
  .stat { padding: 23px 25px; border-right: 1px solid var(--line); position: relative; }
  .stat:last-child { border-right: 0; }
  .stat-label { font-size: 12px; color: var(--muted); }
  .stat-value { font: 500 35px/1.4 var(--sans); letter-spacing: -.04em; margin: 7px 0 4px; font-variant-numeric: tabular-nums; }
  .stat-value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 7px; letter-spacing: 0; }
  .stat-detail { font-size: 11px; color: var(--muted); }
  .stat.emphasis { background: var(--jade-pale); }
  .stat.emphasis .stat-value { color: var(--jade); }
  .tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 0 21px; }
  .tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 12px 15px; color: var(--muted); font-size: 12px; white-space: nowrap; }
  .tab.active { border-bottom-color: var(--jade); color: var(--jade); font-weight: 650; }
  .filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
  .filter-select { width: auto; max-width: 330px; min-width: 180px; font-size: 12px; }
  .outcome-date-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: -6px 0 20px; }
  .outcome-date-bar label { font-size: 12px; font-weight: 600; }
  .outcome-date-bar .filter-select { width: 155px; min-width: 145px; flex: none; }
  .outcome-date-bar .muted { font-size: 11px; }
  .progress { height: 5px; border-radius: 8px; background: #e8ece2; overflow: hidden; margin: 7px 0; }
  .progress > span { display: block; height: 100%; background: #497c58; border-radius: inherit; }
  .pagination { display: flex; align-items: center; justify-content: flex-end; gap: 13px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; }
  .pill-radio { display: flex; border: 1px solid var(--line); border-radius: 6px; padding: 4px; gap: 4px; }
  .pill-radio label { flex: 1; padding: 8px 12px; text-align: center; border-radius: 4px; cursor: pointer; font-size: 12px; }
  .pill-radio label:has(input:checked) { color: var(--jade); background: var(--jade-pale); font-weight: 650; }
  .pill-radio input { margin-right: 5px; }
  details > summary { cursor: pointer; font-size: 12px; font-weight: 600; padding: 11px 0; }
  details[open] > summary { color: var(--jade); }
  dialog { border: 1px solid var(--line); border-radius: 12px; width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 50px); padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px #13272935; }
  dialog::backdrop { background: #10232988; backdrop-filter: blur(3px); }
  .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 22px 25px; border-bottom: 1px solid var(--line); }
  .modal-body { padding: 25px; }
  .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
  .export-scope { margin-top: 8px; font-size: 12px; line-height: 1.8; }
  .export-options { display: grid; gap: 12px; margin-top: 20px; }
  .export-option { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; }
  .export-option > div { flex: 1 1 240px; }
  .export-option strong { font-size: 13px; }
  .export-option p { margin-top: 5px; font-size: 12px; line-height: 1.7; }
  #task-export-link[hidden] { display: none; }
  dialog.image-modal { width: min(950px, calc(100vw - 32px)); }
  dialog.native-image-dialog { width: min(1120px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); }
  .native-image-dialog .modal-head { padding: 14px 18px; }
  .image-viewer-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px; }
  .image-viewer-tools [aria-pressed="true"] { border-color: var(--jade); color: var(--jade); background: var(--jade-pale); }
  .image-viewer-stage { height: min(65vh, 680px); height: min(65dvh, 680px); overflow: auto; background: #edf0e9; overscroll-behavior: contain; }
  .image-viewer-stage:focus-visible { outline: 2px solid var(--jade); outline-offset: -3px; }
  .image-viewer-canvas { display: flex; align-items: center; justify-content: center; min-width: 100%; min-height: 100%; width: max-content; padding: 12px; }
  .image-viewer-image { display: block; flex: none; max-width: none; max-height: none; background: white; }
  .image-viewer-image[hidden] { display: none; }
  .image-viewer-stage[data-mode="fit"] .image-viewer-canvas { width: 100%; height: 100%; }
  .image-viewer-stage[data-mode="fit"] .image-viewer-image { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
  .image-viewer-status { font-size: 12px; color: var(--muted); padding: 12px 18px; margin: 0; }
  .toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: grid; gap: 9px; max-width: min(400px, calc(100vw - 32px)); }
  .toast { border: 1px solid #bbcdba; background: #fffef7; color: var(--ink); border-radius: 7px; padding: 13px 18px; box-shadow: 0 6px 25px #172a311a; font-size: 13px; }
  .toast.error { border-color: #d9ada1; color: var(--red); }
}
@layer pages {
  .boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 20px; color: var(--muted); }
  .login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
  .login-story { background: var(--navy); color: #f1f0e5; padding: 55px clamp(35px, 7vw, 110px); display: flex; flex-direction: column; justify-content: space-between; min-height: 680px; overflow: hidden; position: relative; }
  .login-story .brand { margin: 0; }
  .login-story h1 { font-size: clamp(36px, 4.2vw, 62px); line-height: 1.55; letter-spacing: .08em; position: relative; }
  .login-story h1 em { color: #b8cbae; font-style: normal; }
  .login-story p { color: #a7b9b9; margin-top: 22px; max-width: 360px; }
  .login-grid { position: absolute; width: 340px; height: 340px; right: -160px; top: 32%; border: 1px solid #829b8833; background-image: linear-gradient(45deg, transparent 49.8%, #829b8820 50%, transparent 50.2%), linear-gradient(-45deg, transparent 49.8%, #829b8820 50%, transparent 50.2%); }
  .login-grid::after, .login-grid::before { content: ''; position: absolute; background: #829b8833; }
  .login-grid::after { left: 50%; width: 1px; height: 100%; }
  .login-grid::before { top: 50%; height: 1px; width: 100%; }
  .login-footer { font-size: 11px; letter-spacing: .08em; color: #8da7a9; }
  .login-form-side { display: grid; width: 100%; max-width: none; margin: 0; align-content: center; padding: 55px clamp(30px, 7vw, 110px); }
  .login-form-side h2 { font: 30px var(--serif); margin-bottom: 10px; }
  .login-form-side form { margin-top: 32px; }
  .login-form-side .field { margin: 19px 0; }
  .login-form-side .field input { min-height: 48px; }
  .login-form-side .btn { width: 100%; min-height: 48px; margin-top: 12px; }
  .flow-strip { display: flex; flex-wrap: wrap; gap: 15px 0; margin-bottom: 23px; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
  .flow-item { flex: 1; padding-left: 20px; border-left: 1px solid var(--line); }
  .flow-item:first-child { padding-left: 0; border: 0; }
  .flow-item span { display: block; font-size: 11px; color: var(--muted); }
  .flow-item strong { font-size: 21px; font-weight: 550; }
  .workflow-note { padding: 18px 23px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
  .task-name { white-space: normal; min-width: 140px; max-width: 300px; }
  .task-config { margin-top: 26px; scroll-margin-top: 18px; }
  .task-config .settings-form { padding: 24px; display: grid; gap: 28px; }
  .task-config .settings-section { min-width: 0; padding: 0; }
  .task-config .settings-section + .settings-section { border-top: 1px solid var(--line); padding-top: 24px; }
  .task-config .settings-section > legend { float: left; width: 100%; margin: 0 0 16px; color: var(--ink); font-size: 15px; line-height: 1.5; }
  .task-config .settings-section > legend + * { clear: both; }
  .task-config .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; align-items: start; }
  .task-config .settings-grid .full { grid-column: 1 / -1; }
  .task-config .settings-grid .field { grid-template-rows: minmax(24px, auto) 44px auto; align-content: start; gap: 7px; }
  .task-config .settings-grid .field > label { display: flex; align-items: center; min-height: 24px; margin: 0; font-size: 13px; line-height: 1.5; }
  .task-config .settings-grid .field > input,
  .task-config .settings-grid .field > select { height: 44px; min-height: 44px; margin: 0; font-size: 14px; }
  .task-config .settings-grid .field > small { display: block; margin: 0; font-size: 12px; line-height: 1.65; }
  .task-config .settings-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
  .task-config .settings-personnel { min-width: 0; }
  .task-config .settings-personnel .field-label { display: block; min-height: 24px; margin-bottom: 9px; font-size: 13px; }
  .task-config .settings-personnel .checklist { align-items: flex-start; }
  .task-config .settings-personnel .check { min-height: 40px; }
  .task-config .settings-choice { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf5; }
  .task-config .settings-choice .check { border: 0; padding: 0; align-items: flex-start; font-size: 13px; line-height: 1.6; }
  .task-config .settings-choice input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; }
  .task-config .settings-choice .settings-note { margin-top: 7px; padding-left: 23px; }
  .task-config .settings-lock-notice { margin: 0; }
  .task-config .settings-section:disabled { opacity: .78; }
  .task-config .settings-section:disabled .check { cursor: default; }
  @media (max-width: 720px) {
    .task-config .settings-form { padding: 18px; gap: 24px; }
    .task-config .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .task-config .settings-section + .settings-section { padding-top: 20px; }
    .task-config .settings-grid .field { grid-template-rows: auto 44px auto; }
    .task-config .settings-choice { padding: 14px; }
  }
  .threshold-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .preview-stats { display: flex; gap: 30px; flex-wrap: wrap; margin: 21px 0; }
  .preview-stats strong { display: block; font-size: 27px; font-weight: 550; }
  .preview-stats span { font-size: 11px; color: var(--muted); }
  .preview-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .preview-images figure { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
  .preview-images img { height: 170px; width: 100%; object-fit: contain; background: #eeefe8; }
  .preview-images figcaption { padding: 9px; font-size: 11px; }
  .sample-thumb { width: 52px; height: 52px; object-fit: contain; background: #f2f3ec; border: 1px solid var(--line); border-radius: 4px; }
  button.thumb-button { padding: 0; border: 0; background: transparent; }
  .target-word { font: 26px var(--serif); }
  .candidate { color: var(--muted); font-size: 11px; max-width: 160px; overflow-wrap: anywhere; white-space: normal; }
  .sample-row-error { white-space: normal; max-width: 230px; color: var(--red); }
  .scoring-layout { display: grid; grid-template-columns: minmax(290px, 1fr) minmax(390px, 1fr); gap: 23px; align-items: start; }
  .scoring-workspace { min-width: 0; }
  .scoring-workspace [hidden] { display: none !important; }
  .scoring-panel, .sample-viewer { min-width: 0; }
  .sample-id { font-size: 11px; }
  .image-tip { font-size: 10px; }
  .reference-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
  .character-reference p { margin: 12px 0 16px; font-size: 12px; color: var(--muted); }
  .character-reference .general-reference { padding-top: 15px; margin-top: 19px; border-top: 1px solid var(--line); font-size: 12px; }
  .previous-review { padding: 14px 18px; border: 1px solid #e6d7b7; border-radius: 7px; background: #fffaf0; font-size: 12px; }
  .previous-review p { margin-top: 12px; }
  .sample-viewer { position: sticky; top: 18px; }
  .sample-title { display: flex; justify-content: space-between; align-items: center; padding: 19px 23px; border-bottom: 1px solid var(--line); }
  .sample-title .target-word { font-size: 39px; margin-right: 12px; }
  .sample-meta { display: flex; align-items: center; }
  .image-stage { min-height: 310px; display: grid; place-items: center; background-color: #f0f1e9; background-image: linear-gradient(#dee2d433 1px, transparent 1px), linear-gradient(90deg, #dee2d433 1px, transparent 1px); background-size: 24px 24px; padding: 26px; }
  .image-stage > button { border: 0; padding: 0; background: transparent; width: 100%; cursor: zoom-in; }
  .image-stage img { width: 100%; height: 300px; object-fit: contain; filter: drop-shadow(0 5px 10px #25332813); }
  .image-stage .empty { padding: 35px 10px; }
  .image-tools { display: flex; justify-content: space-between; align-items: center; padding: 11px 19px; border-top: 1px solid var(--line); }
  .image-mode { display: flex; gap: 4px; }
  .image-mode button { font-size: 11px; min-height: 30px; }
  .image-mode .selected { background: var(--jade-pale); color: var(--jade); border-color: #bbceb9; }
  .paired-images { display: grid; grid-template-columns: 1fr 1fr; }
  .paired-images > div + div { border-left: 1px solid var(--line); }
  .image-label { padding: 10px 16px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); background: #fbfbf4; }
  .paired-images .image-stage { min-height: 250px; padding: 16px; }
  .paired-images .image-stage img { height: 230px; }
  .reference-empty { padding: 30px 8px; color: var(--muted); font-size: 11px; text-align: center; }
  .reference-empty span { font: 45px var(--serif); color: #afbaaa; display: block; margin-bottom: 15px; }
  .reference-empty small { font-size: 10px; }
  .score-header { padding: 19px 23px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
  .score-header small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
  .score-total { text-align: right; font-size: 30px; font-weight: 550; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .score-total span { font-size: 12px; color: var(--muted); font-weight: 400; }
  .score-body { padding: 18px 23px 22px; }
  .validity-label { font-size: 12px; font-weight: 650; margin: 1px 0 9px; }
  .score-validity { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .score-validity label { display: flex; gap: 9px; align-items: flex-start; padding: 13px 11px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
  .score-validity label:has(input:checked) { background: var(--jade-pale); border-color: #6f9e88; box-shadow: inset 0 0 0 1px #6f9e88; }
  .score-validity label:has(input[value="N"]:checked) { background: #fff4df; border-color: #b88943; box-shadow: inset 0 0 0 1px #b88943; }
  .score-validity input { margin-top: 4px; accent-color: var(--jade); flex-shrink: 0; }
  .score-validity small { display: block; font-size: 10px; line-height: 1.6; font-weight: 400; margin-top: 4px; color: var(--muted); }
  .score-dimensions { margin-top: 12px; }
  .review-flag { display: block; margin-top: 3px; color: #805317; font-weight: 650; }
  .score-row { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; align-items: start; border-bottom: 1px solid #e8e9e0; padding: 14px 0; }
  .score-row:last-child { border: 0; }
  .score-row-label { font-size: 13px; font-weight: 600; }
  .score-index { color: #8c9c8a; font: 10px ui-monospace, monospace; margin-right: 8px; }
  .score-range { margin-top: 4px; color: var(--muted); font-size: 10px; }
  .score-input-group { display: grid; grid-template-columns: 29px 1fr 29px; border: 1px solid #cbd4c5; border-radius: 5px; height: 39px; overflow: hidden; }
  .score-input-group button { border: 0; background: #f4f6ee; font-size: 17px; color: var(--jade); padding: 0; }
  .score-input-group button:hover { background: #e5eddf; }
  .score-input-group input { -moz-appearance: textfield; appearance: textfield; border: 0; background: var(--surface); color: var(--ink); width: 100%; min-width: 0; text-align: center; padding: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
  .score-input-group input::-webkit-inner-spin-button, .score-input-group input::-webkit-outer-spin-button { appearance: none; }
  .score-input-group:focus-within { box-shadow: 0 0 0 2px #769d70; }
  .score-input-group input:focus-visible { outline: none; }
  .score-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 18px; }
  .score-actions .btn { min-height: 45px; }
  .exception-prompt { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px; border: 1px solid #e6d7b7; border-radius: 6px; background: #fffaed; }
  .exception-prompt strong { font-size: 13px; color: #775722; }
  .exception-prompt p { font-size: 11px; color: #775722; margin-top: 5px; }
  .btn.exception { color: #775722; border-color: #b2945f; background: #fffaf0; font-weight: 650; flex-shrink: 0; min-height: 42px; }
  .btn.exception:hover { border-color: #775722; background: #f4ead4; }
  .exception-note { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 46ch; font-size: 12px; margin: 7px 0; }
  .exception-decisions { display: flex; flex-wrap: wrap; gap: 12px 24px; }
  .exception-policy { font-size: 12px; }
  @media (max-width: 460px) { .exception-prompt { align-items: stretch; flex-direction: column; } .flow-strip .flow-item { flex-basis: 33.333%; } }
  .draft-status { font-size: 10px; color: var(--muted); margin-top: 11px; text-align: center; min-height: 17px; }
  .n-fields { margin-top: 17px; }
  .n-fields[hidden] { display: none; }
  .n-fields .field + .field { margin-top: 12px; }
  .lease { font-size: 10px; color: var(--muted); }
  @media (max-width: 600px) {
    .sample-title { padding: 15px; gap: 10px; flex-wrap: wrap; }
    .score-validity label { padding: 11px 9px; }
    .score-actions { grid-template-columns: 1fr; }
    .score-actions .btn.primary { grid-row: 1; }
  }
  .history-table { white-space: normal; }
  .history-table th, .history-table td { font-size: 11px; padding: 8px; }
  .rubric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 23px; }
  .rubric-grid table { white-space: normal; }
  .rubric-grid td:first-child { width: 85px; }
  .rubric-grid td { vertical-align: top; }
  .rule-max { font-family: var(--serif); font-size: 28px; color: var(--jade); }
  .outcome-images { display: flex; flex-wrap: wrap; gap: 16px; }
  .outcome-images figure { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f5f6ef; }
  .outcome-images img { width: 150px; height: 150px; object-fit: contain; }
  .outcome-images figcaption { font-size: 11px; text-align: center; padding: 6px; border-top: 1px solid var(--line); }
}
@layer responsive {
  @media (min-width: 1600px) { main { padding-left: 55px; padding-right: 55px; } .scoring-layout { grid-template-columns: 1.1fr 1fr; } .image-stage { min-height: 420px; } .image-stage img { height: 390px; } }
  @media (max-width: 1200px) { .shell { grid-template-columns: 196px minmax(0, 1fr); } .sidebar { padding-inline: 12px; } main { padding: 28px 24px 45px; } .topbar { padding-inline: 24px; } .stat { padding: 20px 17px; } .stat-value { font-size: 30px; } .scoring-layout { grid-template-columns: minmax(240px, .9fr) minmax(345px, 1fr); gap: 17px; } .split { grid-template-columns: 1fr; } .score-body { padding-inline: 18px; } .image-stage { padding: 18px; } .image-stage img { height: 270px; } }
  @media (max-width: 1000px) { .shell { grid-template-columns: 180px minmax(0, 1fr); } .brand { margin-inline: 5px; } .nav-link { padding-inline: 11px; font-size: 12px; } .stats { grid-template-columns: 1fr 1fr; } .stat:nth-child(2) { border-right: 0; } .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); } .grid-2, .rubric-grid { grid-template-columns: 1fr; } .scoring-layout { grid-template-columns: 1fr; } .sample-viewer { position: static; } .image-stage { min-height: 270px; } .image-stage img { height: 260px; } .page-heading { flex-wrap: wrap; } .page-actions { padding-top: 0; } .login-form-side { padding-inline: 40px; } }
  @media (max-width: 720px) { .shell { display: block; } .sidebar { position: fixed; width: 224px; left: -240px; transition: left .2s; box-shadow: 10px 0 30px #182b3320; } .shell.menu-open .sidebar { left: 0; } .menu-backdrop { display: none; } .shell.menu-open .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 19; background: #172a3166; border: 0; } .menu-toggle { display: inline-grid; } .topbar { min-height: 65px; padding: 12px 18px; gap: 12px; } .topbar-title { display: none; } .topbar .account { gap: 8px; } .account-name small { display: none; } .account-name { font-size: 12px; } .topbar .btn { padding-inline: 7px; } main { padding: 24px 17px 40px; } h1 { font-size: 28px; } .page-heading { gap: 17px; margin-bottom: 22px; } .subtext { font-size: 12px; } .stat { padding: 18px; } .stat-value { font-size: 30px; } .panel-head, .panel-body, .panel-foot { padding-inline: 17px; } .form-grid { gap: 15px; } .threshold-grid { grid-template-columns: repeat(2, 1fr); } .filter-select { max-width: 100%; min-width: 140px; flex: 1; } .flow-item { padding-left: 11px; } .flow-item span { font-size: 10px; } .flow-item strong { font-size: 20px; } .login { display: block; } .login-story { min-height: 0; padding: 25px 28px 35px; } .login-story .brand { margin-bottom: 25px; } .login-story h1 { font-size: 30px; line-height: 1.55; } .login-story h1 br { display: none; } .login-story p { font-size: 12px; margin-top: 12px; } .login-footer { display: none; } .login-grid { width: 200px; height: 200px; right: -65px; top: 60px; } .login-form-side { padding: 35px 28px 45px; } .login-form-side form { margin-top: 20px; } .toast-stack { bottom: 16px; right: 16px; } .preview-images { grid-template-columns: 1fr 1fr; } .modal-head, .modal-body { padding: 20px; } .sample-title { padding: 17px; } .image-tools { gap: 9px; flex-wrap: wrap; } }
  @media (max-width: 380px) { .form-grid { grid-template-columns: 1fr; } .form-grid .full { grid-column: auto; } .score-row { grid-template-columns: minmax(0, 1fr) 119px; } .score-body { padding-inline: 14px; } .score-row-label { font-size: 12px; } .score-index { display: none; } .score-actions { grid-template-columns: 1fr; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
}

@layer responsive {
  .review-groups { display: grid; gap: 12px; margin: 16px 0; }
  .review-group { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: #f8faf5; }
  .review-group .field { margin: 0; min-width: 0; }
  .review-group .field > span { font-size: 12px; font-weight: 600; }
  .review-group select { width: 100%; }
  .review-group > .btn { min-height: 40px; margin-bottom: 1px; }
  .scoring-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
  .scoring-toolbar h1 { font: 650 22px/1.3 var(--sans); letter-spacing: 0; white-space: nowrap; }
  .scoring-toolbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .scoring-toolbar .filter-select { width: 225px; min-width: 150px; max-width: 35vw; height: 36px; font-size: 12px; }
  .scoring-workspace .scoring-layout { gap: 16px; align-items: stretch; }
  .scoring-workspace .sample-viewer { position: static; }
  .scoring-workspace .sample-title { padding: 10px 16px; gap: 8px; }
  .scoring-workspace .sample-title .target-word { font-size: 34px; }
  .scoring-workspace .sample-meta { min-width: 0; }
  .scoring-workspace .sample-meta strong { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .scoring-workspace .image-tools { padding: 8px 12px; }
  .scoring-workspace .panel-foot { padding: 8px 14px; }
  .scoring-workspace .image-tip { display: none; }
  .scoring-reference-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
  .scoring-reference-actions > .muted { font-size: 11px; }
  .scoring-workspace .score-header { padding: 10px 16px; }
  .scoring-workspace .score-header h2 { font-size: 16px; }
  .scoring-workspace .score-total { font-size: 27px; }
  .scoring-workspace .score-body { padding: 10px 16px 8px; }
  .scoring-workspace .score-validity { gap: 8px; }
  .scoring-workspace .score-validity label { padding: 7px 10px; align-items: center; font-size: 12px; }
  .scoring-workspace .score-validity input { margin: 0; }
  .scoring-workspace .score-dimensions { margin: 5px 0 0; }
  .scoring-workspace .score-row { padding: 5px 0; gap: 8px; min-height: 43px; align-items: center; grid-template-columns: minmax(0, 1fr) 126px; }
  .scoring-workspace .score-row-label { font-size: 12px; }
  .scoring-workspace .score-range { margin: 0 0 0 6px; white-space: nowrap; }
  .scoring-workspace .score-input-group { height: 33px; grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .scoring-workspace .score-note-field { margin-top: 8px; gap: 4px; }
  .scoring-workspace .score-note-field label { margin: 0; font-size: 11px; }
  .scoring-workspace #score-note { min-height: 48px; height: 48px; padding: 6px 9px; font-size: 12px; line-height: 1.5; }
  .scoring-workspace .n-fields { padding-top: 12px; }
  .scoring-workspace .n-fields .notice { padding: 10px 12px; font-size: 12px; }
  .scoring-workspace .n-fields .section-gap { margin-top: 14px; }
  .scoring-workspace .score-footer { padding: 10px 16px 8px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); position: sticky; bottom: 0; z-index: 2; }
  .scoring-workspace .score-actions { margin: 0; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
  .scoring-workspace .score-actions .btn { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .scoring-workspace .draft-status { margin-top: 5px; font-size: 10px; min-height: 16px; }
  .rule-dialog-section { border-top: 1px solid var(--line); padding: 12px 0; }
  .rule-dialog-section summary { font-size: 13px; }
  .rule-dialog-section table { margin-top: 12px; }
  @media (min-width: 1100px) {
    .scoring-mode .topbar { min-height: 55px; height: 55px; padding: 8px 24px; }
    .scoring-mode #main { padding: 14px 22px; height: calc(100dvh - 55px); min-height: 610px; display: flex; flex-direction: column; }
    .scoring-mode #assignment-workspace { min-height: 0; flex: 1; }
    .scoring-mode .scoring-workspace { height: 100%; display: flex; flex-direction: column; }
    .scoring-mode .scoring-layout { min-height: 0; flex: 1; grid-template-columns: minmax(340px, 1fr) minmax(390px, 1fr); }
    .scoring-mode .scoring-panel { min-height: 0; }
    .scoring-mode #score-form { height: 100%; min-height: 0; display: flex; flex-direction: column; }
    .scoring-mode .score-body { min-height: 0; overflow-y: auto; flex: 1; }
    .scoring-mode .score-footer, .scoring-mode .score-header { flex: 0 0 auto; }
    .scoring-mode .paired-images .image-stage { min-height: 270px; height: min(36vh, 340px); padding: 12px; }
    .scoring-mode .paired-images .image-stage img { height: min(32vh, 310px); }
  }
  @media (max-width: 1099px) and (min-width: 721px) {
    .scoring-workspace .scoring-layout { grid-template-columns: 1fr; }
    .scoring-workspace .paired-images .image-stage { min-height: 220px; }
    .scoring-workspace .paired-images .image-stage img { height: 200px; }
  }
  @media (max-width: 720px) {
    .review-group { grid-template-columns: 1fr 1fr; }
    .review-group .field:nth-child(3) { grid-column: 1 / -1; }
    .scoring-mode #main { padding: 15px 12px 25px; }
    .scoring-toolbar { align-items: flex-start; flex-direction: column; gap: 9px; }
    .scoring-toolbar h1 { font-size: 20px; }
    .scoring-toolbar-actions { width: 100%; }
    .scoring-toolbar .filter-select { min-width: 0; max-width: none; flex: 1; }
    .scoring-workspace .scoring-layout { grid-template-columns: minmax(0, 1fr); }
    .scoring-workspace .paired-images .image-stage { min-height: 180px; padding: 10px; }
    .scoring-workspace .paired-images .image-stage img { height: 165px; }
    .scoring-workspace .sample-meta strong { max-width: 160px; }
    .scoring-workspace .score-actions .btn.primary { grid-row: auto; }
    .scoring-workspace .score-row { min-height: 48px; }
    .scoring-workspace .score-input-group { height: 38px; }
    .scoring-workspace .score-footer { bottom: env(safe-area-inset-bottom, 0); }
  }
}

/* Both first scores remain visible beside the final arbitration form. */
.arbitration-reference { margin-top: 10px; border: 1px solid #9bad9d; border-top: 4px solid var(--green, #365b43); border-radius: 8px; overflow: hidden; background: #fff; }
.arbitration-reference-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 9px 12px; background: #eef3ec; }
.arbitration-reference-head h2 { margin: 0; font-size: 16px; color: #24432d; }
.arbitration-reference-head > span { font-size: 10px; color: #536654; }
.arbitration-comparison { width: 100%; table-layout: fixed; border-collapse: collapse; }
.arbitration-comparison th, .arbitration-comparison td { padding: 6px 8px; font-size: 13px; line-height: 1.25; text-align: center; border-bottom: 1px solid #e4e9e2; }
.arbitration-comparison th:first-child { width: 36%; text-align: left; }
.arbitration-comparison th:last-child { width: 15%; }
.arbitration-comparison thead { background: #f8faf6; }
.arbitration-comparison thead strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arbitration-comparison thead small { display: block; margin-top: 3px; color: #697568; font-size: 10px; font-weight: 400; }
.arbitration-comparison tbody th { font-size: 11px; font-weight: 500; }
.arbitration-comparison tbody td { font-variant-numeric: tabular-nums; font-weight: 650; }
.arbitration-comparison tbody th small, .arbitration-comparison tfoot small { color: #798477; font-size: 10px; font-weight: 400; }
.arbitration-comparison .reference-difference { color: #6a7566; font-size: 12px; }
.arbitration-comparison .has-difference { color: #895718; background: #fff5e5; }
.arbitration-comparison tfoot { background: #eef3ec; }
.arbitration-comparison tfoot td { font-size: 21px; color: #24432d; font-weight: 700; }
.arbitration-comparison tfoot th, .arbitration-comparison tfoot td { border-bottom: 0; padding-block: 8px; }
.reference-status { padding: 8px 12px; font-size: 11px; background: #fff8e9; }
.reference-status p { margin: 3px 0; overflow-wrap: anywhere; }
@media (min-width: 1101px) {
  .scoring-mode .arbitration-workspace .sample-viewer { min-height: 0; overflow-y: auto; }
  .scoring-mode .arbitration-workspace .paired-images .image-stage { min-height: 115px; height: 115px; padding: 5px; }
  .scoring-mode .arbitration-workspace .paired-images .image-stage img { height: 105px; }
  .arbitration-workspace .sample-title { padding-block: 5px; }
  .arbitration-workspace .sample-title .target-word { font-size: 28px; line-height: 1; }
  .arbitration-workspace .image-label { padding: 3px 12px; }
  .arbitration-workspace .image-tools { padding: 4px 10px; }
  .arbitration-workspace .scoring-reference-actions { padding-block: 4px; }
  .arbitration-workspace .arbitration-reference-head { padding-block: 7px; }
  .arbitration-workspace .arbitration-comparison tbody th, .arbitration-workspace .arbitration-comparison tbody td { padding-block: 4px; }
  .arbitration-workspace .arbitration-comparison tfoot th, .arbitration-workspace .arbitration-comparison tfoot td { padding-block: 6px; }
  .arbitration-workspace .panel-foot { padding-block: 2px; }
}
@media (max-width: 600px) {
  .arbitration-reference-head h2 { font-size: 15px; }
  .arbitration-comparison th, .arbitration-comparison td { padding-inline: 6px; }
  .arbitration-comparison tbody th small { display: none; }
}
