:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #165d59;
  --brand-dark: #0f4541;
  --warning: #9a3412;
  --danger: #b42318;
  --soft: #eef6f5;
  --shadow: 0 16px 40px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-copy {
  min-width: 0;
}

.product-name {
  font-size: 18px;
  font-weight: 750;
}

.product-subtitle {
  display: -webkit-box;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  max-width: 1280px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.language-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.language-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.language-switch button.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.lang-ar body {
  direction: rtl;
  font-family:
    "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, ui-sans-serif, system-ui,
    sans-serif;
}

.lang-ar .topbar,
.lang-ar .app-shell,
.lang-ar .panel,
.lang-ar .action-dialog-panel {
  direction: rtl;
}

.lang-ar th,
.lang-ar td {
  text-align: right;
}

.lang-ar input,
.lang-ar textarea {
  text-align: right;
}

.lang-ar input[type="file"],
.lang-ar .score-input,
.lang-ar .row-number,
.lang-ar .self-score-cell,
.lang-ar .evaluator-score-cell,
.lang-ar .row-average-cell {
  text-align: center;
}

.lang-ar .btn-row,
.lang-ar .admin-tools,
.lang-ar .meta,
.lang-ar .action-dialog-actions {
  direction: rtl;
}

.lang-ar .product-subtitle {
  max-width: 1340px;
}

.login-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  max-width: 280px;
  min-height: 42px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 650;
}

.app-shell {
  width: min(1680px, calc(100vw - 40px));
  margin: 14px auto 36px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 24px;
}

.center-panel {
  max-width: 520px;
  margin: 80px auto;
  padding: 32px;
  text-align: center;
}

.login-panel {
  max-width: 520px;
  margin: 54px auto;
  padding: 28px 32px 32px;
  text-align: left;
}

.login-title {
  margin-bottom: 20px;
  font-size: 22px;
  line-height: 1.25;
}

.login-form {
  gap: 16px;
}

.login-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.login-actions {
  justify-content: stretch;
}

.login-actions .btn {
  width: 100%;
  min-height: 46px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.label {
  font-size: 13px;
  font-weight: 700;
}

input,
button,
textarea {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

input[type="file"] {
  padding: 8px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.update-actions {
  justify-content: flex-end;
}

.update-actions .hint {
  order: -1;
}

.compact-update-form {
  gap: 8px;
}

.update-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.update-file-field {
  min-width: 0;
}

.update-submit {
  white-space: nowrap;
}

.update-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.update-hint-row .hint:first-child {
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 0 16px;
  font-weight: 750;
  cursor: pointer;
}

.btn.secondary {
  background: #fff;
  color: var(--brand);
}

.btn.danger {
  border-color: #d92d20;
  background: #d92d20;
  color: #fff;
}

.btn.compact-btn,
.compact-btn {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  border: 1px solid #f2c94c;
  background: #fffbeb;
  color: #7a4b00;
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.readonly-notice {
  margin-bottom: 18px;
}

.access-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  padding: 6px 11px;
  font-size: 12px;
  line-height: 1.35;
}

.access-status span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #98a2b3;
}

.access-status strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 850;
}

.access-status em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-status.can-edit span {
  background: var(--brand);
}

.access-status.readonly span {
  background: #98a2b3;
}

.error {
  border: 1px solid #fda29b;
  background: #fff1f0;
  color: var(--danger);
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.success {
  border: 1px solid #9bd6ce;
  background: var(--soft);
  color: var(--brand-dark);
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.approval-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid #77c7b4;
  border-left: 6px solid var(--brand);
  border-radius: 8px;
  background: linear-gradient(90deg, #e9f7f4 0%, #ffffff 72%);
  box-shadow: 0 12px 32px rgba(22, 93, 89, 0.12);
}

.approval-kicker {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.approval-banner h2 {
  font-size: 21px;
  color: var(--brand-dark);
}

.approval-banner p {
  margin: 6px 0 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.55;
}

.review-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  margin-bottom: 8px;
}

.committee-identity-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.committee-identity-line h1 {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

.committee-meta {
  min-width: 0;
  margin-top: 0;
}

.committee-meta .chip {
  min-height: 21px;
  padding: 0 7px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.chip-button {
  font: inherit;
  cursor: pointer;
}

.chip-button:hover {
  border-color: rgba(20, 99, 91, 0.45);
  color: var(--brand-dark);
  background: #f4fbfa;
}

.section {
  padding: 14px 18px 16px;
  margin-bottom: 12px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
}

.scroll-hint {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #667085;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 750;
}

.fullscreen-toggle {
  cursor: pointer;
}

.fullscreen-toggle:hover {
  border-color: #9eb7b3;
  color: var(--brand);
  background: #f4fbfa;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  table-layout: auto;
}

th,
td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.55;
}

th {
  background: #f1f4f7;
  color: #344054;
  font-weight: 800;
  white-space: nowrap;
}

tfoot td {
  background: #f1f4f7;
  font-weight: 800;
}

.score-standard-panel {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.score-standard-panel summary {
  cursor: pointer;
  padding: 8px 10px;
  background: #f1f4f7;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
  user-select: none;
}

.score-standard-content {
  max-height: 360px;
  overflow: auto;
  padding: 8px 10px 9px;
}

.score-standard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.score-rule-block {
  min-width: 0;
}

.score-rule-block h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.score-rule-table {
  min-width: 0;
  table-layout: fixed;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.score-rule-table td {
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.32;
}

.score-rule-table td:nth-child(1) {
  width: 46px;
  white-space: nowrap;
  color: var(--brand);
  font-weight: 850;
}

.score-rule-table td:nth-child(2) {
  width: 38px;
  white-space: nowrap;
  color: #475467;
  font-weight: 750;
}

.score-note-list {
  margin: 7px 0 0;
  padding-left: 20px;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}

.score-note-list li {
  margin: 2px 0;
}

tr:last-child td {
  border-bottom: 0;
}

.guided-table {
  min-width: 1580px;
  table-layout: fixed;
}

.guided-table th:nth-child(1),
.guided-table td:nth-child(1) {
  width: 46px;
}

.guided-table th:nth-child(2),
.guided-table td:nth-child(2) {
  width: 225px;
}

.guided-table th:nth-child(3),
.guided-table td:nth-child(3) {
  width: 285px;
}

.guided-table th:nth-child(4),
.guided-table td:nth-child(4) {
  width: 1024px;
}

.row-number {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.dimension-cell {
  font-weight: 400;
}

.original-dimension-cell {
  color: #475467;
  font-weight: 750;
  line-height: 1.35;
}

.committee-table .dimension-cell,
.committee-table .self-evidence-cell {
  line-height: 1.42;
}

.self-evidence-content {
  max-height: 132px;
  overflow: auto;
  padding-right: 4px;
}

.text-lightbox-btn {
  margin-top: 6px;
}

.inline-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.guide-table-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid #cfd8e3;
  border-radius: 7px;
  background: #fbfdfd;
}

.guide-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.guide-table th,
.guide-table td {
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.guide-table th {
  background: #eef6f5;
  color: var(--brand-dark);
}

.guide-table th:nth-child(1),
.guide-table td:nth-child(1) {
  width: 92px;
  font-weight: 750;
}

.guide-table th:nth-child(2),
.guide-table td:nth-child(2) {
  width: 20%;
}

.guide-table th:nth-child(3),
.guide-table td:nth-child(3) {
  width: calc(55% - 92px);
}

.guide-table th:nth-child(4),
.guide-table td:nth-child(4) {
  width: 25%;
}

.muted-cell {
  color: var(--muted);
}

.committee-summary-section {
  padding: 10px 16px 12px;
  margin-bottom: 10px;
}

.committee-summary-section .section-title {
  margin-bottom: 8px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: #fbfcfe;
}

.summary-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  color: var(--brand-dark);
}

.summary-grid span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.committee-table {
  width: 100%;
  min-width: 1210px;
  table-layout: fixed;
}

.committee-table-wrap {
  max-height: calc(100vh - 160px);
  overflow: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #98a2b3 #edf2f7;
}

.committee-table-wrap::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.committee-table-wrap::-webkit-scrollbar-track {
  background: #edf2f7;
}

.committee-table-wrap::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 3px solid #edf2f7;
  border-radius: 999px;
  background: #98a2b3;
}

.committee-table-wrap::-webkit-scrollbar-corner {
  background: #edf2f7;
}

body.committee-fullscreen-active {
  overflow: hidden;
}

.committee-score-section.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: 0;
  padding: 14px 18px 16px;
  background: #fff;
}

.committee-score-section.is-fullscreen .section-title {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.committee-score-section.is-fullscreen .score-standard-panel {
  flex: 0 0 auto;
}

.committee-score-section.is-fullscreen .committee-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.committee-score-section.is-fullscreen #committee-save-status {
  flex: 0 0 auto;
  padding-top: 6px;
}

.committee-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line);
}

.committee-col-row {
  width: 34px;
}

.committee-col-original-dimension {
  width: 89px;
}

.committee-col-dimension {
  width: 230px;
}

.committee-col-score {
  width: 50px;
}

.committee-col-evaluator {
  width: 72px;
}

.committee-col-evaluator-evidence {
  width: 230px;
}

.committee-col-average {
  width: 64px;
}

.committee-col-evidence-text {
  width: 367px;
}

.committee-col-images {
  width: 156px;
}

.score-input {
  width: 48px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 5px;
}

.score-input-wrap,
.score-display-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.score-input.is-invalid {
  border-color: var(--danger);
  color: var(--danger);
  background: #fffafa;
}

.score-inline-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
}

.is-hidden {
  display: none;
}

.committee-table .self-score-head,
.committee-table .self-score-cell,
.committee-table .evaluator-head,
.committee-table .evaluator-score-cell {
  text-align: center;
}

.committee-table .self-score-head,
.committee-table .self-score-cell,
.committee-table .evaluator-head,
.committee-table .evaluator-score-cell,
.committee-table .evaluator-evidence-head,
.committee-table .evaluator-evidence-cell,
.committee-table .row-average-head,
.committee-table .row-average-cell {
  padding-left: 6px;
  padding-right: 6px;
}

.committee-table .evaluator-head {
  white-space: normal;
  word-break: break-all;
  line-height: 1.2;
}

.committee-table .evaluator-evidence-head {
  white-space: nowrap;
  color: var(--brand-dark);
}

.evaluator-evidence-cell {
  background: #fbfdfd;
}

.judge-evidence-form {
  display: grid;
  gap: 6px;
}

.judge-evidence-form:focus,
.judge-evidence-form:focus-within {
  outline: 1px solid rgba(22, 93, 89, 0.24);
  outline-offset: 2px;
}

.judge-evidence-form.is-inactive {
  display: none;
}

.judge-evidence-thumb {
  position: relative;
  display: inline-block;
}

.thumb-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(180, 35, 24, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  padding: 0;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
}

.lang-ar .thumb-remove {
  right: auto;
  left: -5px;
}

.evidence-textarea {
  width: 100%;
  min-height: 72px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 7px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.evidence-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #9eb7b3;
  border-radius: 6px;
  background: #f7fbfa;
  color: var(--brand);
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.evidence-upload input {
  display: none;
}

.evidence-required-hint {
  color: var(--muted);
  line-height: 1.45;
}

.evidence-required-hint.is-required {
  color: var(--danger);
  font-weight: 400;
}

.evidence-upload-status {
  color: var(--muted);
}

.evidence-upload-status.is-busy {
  color: var(--brand);
  font-weight: 800;
}

.evidence-upload-status.is-error {
  color: var(--danger);
  font-weight: 800;
}

.judge-evidence-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 5px;
}

.judge-evidence-thumbs a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.judge-evidence-thumbs img {
  display: block;
  width: 100%;
  height: 42px;
  object-fit: cover;
}

.judge-evidence-readonly {
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.committee-table .row-average-head,
.committee-table .row-average-cell {
  border-left: 1px solid var(--line);
  background: #f1f4f7;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}

.thumb-grid a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.thumb-grid img {
  display: block;
  width: 100%;
  height: 54px;
  object-fit: cover;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 44px;
  background: rgba(15, 23, 42, 0.78);
}

.lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 90vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.text-lightbox {
  place-items: start center;
  overflow: auto;
}

.text-lightbox-panel {
  width: min(94vw, 1120px);
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  padding: 18px 22px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

.action-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.32);
}

.action-dialog-panel {
  width: min(420px, 92vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.action-dialog-panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.25;
}

.action-dialog-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.action-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.score-saved-panel {
  width: min(560px, 92vw);
}

.action-dialog.is-error .action-dialog-panel {
  border-color: rgba(180, 35, 24, 0.3);
}

.action-dialog.is-error .action-dialog-panel h2 {
  color: var(--danger);
}

.action-dialog-busy-panel {
  display: grid;
  justify-items: center;
  text-align: center;
}

.action-dialog-busy-panel p {
  margin-bottom: 0;
}

.judge-progress-panel {
  width: min(560px, 92vw);
}

.judge-progress-panel p {
  margin-bottom: 14px;
}

.judge-progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.judge-progress-grid section {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
  overflow: hidden;
}

.judge-progress-grid h3 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f1f5f9;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.judge-progress-item,
.judge-progress-empty {
  min-height: 34px;
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f5;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.judge-progress-item:last-child,
.judge-progress-empty:last-child {
  border-bottom: 0;
}

.judge-progress-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.judge-progress-empty {
  color: var(--muted);
}

.action-spinner {
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border: 3px solid #dbe4e2;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: action-spin 0.85s linear infinite;
}

@keyframes action-spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  padding: 18px;
  color: var(--muted);
  background: #fafbfc;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.report-box {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.6;
  color: #263238;
  background: #fbfcfe;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(360px, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 0;
}

.admin-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}

.admin-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-tools input[type="text"] {
  max-width: 360px;
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

.admin-tools .login-role {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
}

.admin-list {
  display: grid;
  gap: 3px;
}

.admin-sections {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.admin-section {
  display: grid;
  gap: 9px;
  margin-bottom: 0;
}

.admin-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.admin-section-title h2 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-section-title .hint {
  min-width: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.inline-form,
.assignment-grid {
  display: grid;
  gap: 10px;
}

.inline-form {
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) auto;
  align-items: end;
  margin-bottom: 14px;
}

.inline-form input,
.assignment-row select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  font: inherit;
}

.assignment-grid {
  max-width: 920px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.assignment-row span {
  font-weight: 800;
}

.matrix-hint {
  margin-bottom: 8px;
}

.matrix-wrap {
  max-height: min(70vh, 760px);
}

.judge-matrix {
  width: max-content;
  table-layout: fixed;
}

.judge-matrix th,
.judge-matrix td {
  padding: 5px 6px;
  vertical-align: middle;
}

.judge-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.judge-matrix .candidate-head-col {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 250px;
  background: #f8fafc;
}

.judge-matrix thead .candidate-head-col {
  z-index: 4;
}

.judge-matrix .judge-head {
  width: 102px;
  background: #f8fafc;
}

.judge-matrix .candidate-pin-head,
.judge-matrix .candidate-pin-cell {
  position: sticky;
  right: 0;
  width: 118px;
  min-width: 118px;
  box-shadow: -1px 0 0 var(--line);
}

.judge-matrix .candidate-pin-head {
  z-index: 5;
  background: #f8fafc;
}

.judge-matrix .candidate-pin-head span {
  display: block;
  margin-bottom: 4px;
  font-weight: 850;
}

.judge-matrix .candidate-pin-cell {
  z-index: 2;
  background: #fff;
  text-align: center;
}

.candidate-head {
  display: grid;
  gap: 3px;
  white-space: normal;
}

.candidate-head strong {
  color: var(--ink);
  font-size: 13px;
}

.candidate-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.judge-compact-head {
  display: grid;
  gap: 4px;
}

.judge-compact-head input {
  display: block;
  width: 100%;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.15;
}

.judge-pin-input {
  color: var(--muted);
  text-align: center;
}

.matrix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
}

.judge-matrix .matrix-actions .compact-btn {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

.matrix-cell {
  text-align: center;
}

.check-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.check-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.admin-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 6px;
  background: #fff;
}

.admin-card > div:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.admin-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-card .meta {
  gap: 4px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  margin-top: 0;
}

.admin-card .chip {
  min-height: 18px;
  padding: 0 6px;
  font-size: 11px;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 88px;
  white-space: nowrap;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 16px;
  border: 4px solid #dbe5e4;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .review-header {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 20px, 1240px);
    margin-top: 16px;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .inline-form,
  .assignment-row,
  .login-field-grid {
    grid-template-columns: 1fr;
  }

  .login-panel {
    margin: 24px auto;
    padding: 24px 22px 26px;
  }

  .login-title {
    font-size: 21px;
  }

  .update-hint-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .approval-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-standard-grid {
    grid-template-columns: 1fr;
  }
}
