[hidden] {
  display: none !important;
}

:root {
  --blue: #174a7c;
  --blue-dark: #103654;
  --line: #d8dee6;
  --text: #17212b;
  --muted: #657181;
  --bg: #f4f6f8;
  --green: #176b45;
  --red: #a32929;
  --amber: #8a5b00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Arial, sans-serif;
}

a {
  color: var(--blue);
}

h1,
h2,
h3,
p,
td,
th {
  overflow-wrap: break-word;
}

h1 {
  font-size: 27px;
  margin: 6px 0 10px;
}

h2 {
  font-size: 20px;
  margin: 28px 0 12px;
}

h3 {
  font-size: 17px;
  margin: 20px 0 10px;
}

p {
  margin: 10px 0;
}

small,
.muted {
  color: var(--muted);
}

.topbar {
  min-height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 25px;
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 10px 18px;
  flex: 1;
  flex-wrap: wrap;
}

.topbar nav a {
  text-decoration: none;
}

.user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.user form,
.actions form {
  margin: 0;
}

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.wide-page {
  max-width: 1800px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin: 0 0 20px;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-heading > .status {
  margin-top: 6px;
}

button,
.button {
  display: inline-block;
  border: 1px solid #aab4bf;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 9px 15px;
  min-height: 39px;
  font: inherit;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: #eef3f8;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.primary:hover {
  background: var(--blue-dark);
}

.danger {
  color: var(--red);
  border-color: #d6a6a6;
}

.small {
  padding: 5px 9px;
  min-height: 31px;
  font-size: 13px;
}

.link-button {
  border: 0;
  padding: 0;
  min-height: 0;
  color: var(--blue);
  background: transparent;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.inline input:not([type="hidden"]),
.inline select {
  flex: 1 1 180px;
  min-width: 0;
}

.inline button {
  flex: 0 0 auto;
}

.stack {
  display: grid;
  gap: 15px;
}

.panel .stack > button,
.form-section .stack > button {
  justify-self: start;
}

label {
  font-weight: 600;
  min-width: 0;
}

input,
select,
textarea {
  font: inherit;
  border: 1px solid #9ca8b5;
  border-radius: 4px;
  padding: 8px;
  background: #fff;
  color: var(--text);
  max-width: 100%;
  min-width: 0;
}

label input:not([type="checkbox"]),
label select {
  display: block;
  width: 100%;
  margin-top: 5px;
}

input[type="file"] {
  width: 100%;
  padding: 7px;
}

textarea {
  width: 100%;
  resize: vertical;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

summary {
  cursor: pointer;
}

fieldset {
  min-width: 0;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
}

fieldset:last-child {
  margin-bottom: 0;
}

fieldset legend {
  max-width: 100%;
  padding: 0 6px;
  font-weight: 600;
}

fieldset legend input {
  width: 90px;
  margin-left: 5px;
}

fieldset > label {
  display: block;
  margin-top: 12px;
}

.notice {
  padding: 12px 15px;
  border-left: 4px solid;
  margin: 0 0 16px;
  background: #fff;
}

.notice.success {
  border-color: var(--green);
  color: var(--green);
}

.notice.error {
  border-color: var(--red);
  color: var(--red);
}

.notice ul {
  margin-bottom: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 0 0 24px;
}

.metrics > div {
  background: #fff;
  padding: 16px;
}

.metrics strong {
  display: block;
  font-size: 27px;
}

.metrics span {
  color: var(--muted);
}

.panel,
.form-section {
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px;
  margin: 16px 0;
}

.panel > summary {
  font-weight: 700;
}

.panel[open] > summary {
  margin-bottom: 16px;
}

.panel details {
  margin: 12px 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: #edf1f5;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 3;
}

tbody tr:hover {
  background: #f7f9fb;
}

td form {
  margin: 0;
}

td form input:not([type="hidden"]) {
  margin-bottom: 6px;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  background: #e6ebf0;
  font-size: 13px;
  white-space: nowrap;
}

.status-open,
.status-confirmed {
  background: #dff1e7;
  color: var(--green);
}

.status-approved {
  background: #dce9f6;
  color: var(--blue);
}

.status-paused,
.status-draft,
.status-current {
  background: #fff0cf;
  color: var(--amber);
}

.status-no_show,
.status-closed {
  background: #f7dfdf;
  color: var(--red);
}

.preliminary {
  display: block;
  color: var(--amber);
}

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

.hall-block {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px;
}

.hall-block h2 {
  margin: 0;
}

.hall-block > .page-heading {
  margin-bottom: 10px;
}

.hall-block > p.muted:empty {
  display: none;
}

.hall-meta {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  color: var(--muted);
  margin: 12px 0;
}

.progress {
  height: 8px;
  background: #e5e9ee;
  margin: 8px 0 14px;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.leaders {
  padding-left: 22px;
  margin: 12px 0 16px;
}

.leaders li {
  margin: 5px 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px 15px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar label select {
  margin: 0;
}

.score-summary {
  display: flex;
  gap: 12px 25px;
  flex-wrap: wrap;
  background: #fff;
  padding: 12px 16px;
  border: 1px solid var(--line);
}

.score-table-wrap {
  max-height: 67vh;
}

.score-table {
  width: auto;
  min-width: 100%;
  table-layout: fixed;
}

.score-table th,
.score-table td {
  padding: 8px;
}

.score-table .criterion-column {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 320px;
  min-width: 320px;
  background: #f4f6f8;
}

.score-table thead .criterion-column {
  z-index: 6;
  background: #edf1f5;
}

.score-table .expert-col {
  width: 170px;
  min-width: 170px;
  text-align: center;
}

.score-table thead th {
  top: 0;
}

.criterion-number {
  display: inline-block;
  color: var(--blue);
  font-size: 17px;
  margin-right: 8px;
}

.criterion-column > strong {
  display: block;
  color: var(--muted);
}

.criterion-column details {
  margin-top: 8px;
  font-weight: 400;
}

.score-cell input.score-input {
  width: 100%;
  height: 52px;
  text-align: center;
  font-size: 25px;
  font-weight: 700;
  padding: 4px;
}

.score-cell input:focus {
  outline: 3px solid #7db5e5;
}

.score-cell input.invalid {
  border: 3px solid var(--red);
  background: #fff0f0;
}

.score-cell label {
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 4px;
}

.score-cell label input {
  width: auto;
  margin: 0;
}

.score-cell:has(.not-evaluated:checked) {
  background: #fff0cf;
}

.totals-row td,
.totals-row th {
  background: #e7eef5;
}

.totals-row strong {
  font-size: 22px;
}

.sheet-comment {
  min-width: 150px;
  font-size: 13px;
}

.save-status {
  font-weight: 700;
  color: var(--green);
}

.save-status.saving {
  color: var(--amber);
}

.save-status.error {
  color: var(--red);
}

.confirm-box {
  margin-top: 18px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.confirm-box form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.login-page {
  max-width: none;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-box {
  width: min(420px, 92vw);
  padding: 35px;
  background: #fff;
  border: 1px solid var(--line);
}

.login-box h1 {
  font-size: 32px;
}

.login-box p {
  color: var(--muted);
  margin-bottom: 22px;
}

.login-box .stack > button {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid > label {
  min-width: 0;
}

.form-grid > button {
  align-self: end;
  justify-self: start;
}

.form-grid > div {
  align-self: end;
}

.form-grid > button.full {
  justify-self: stretch;
}

.form-grid label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.full {
  grid-column: 1/-1;
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  padding: 14px;
  border: 1px solid var(--line);
  margin: 16px 0;
}

.rank-current {
  font-weight: 700;
}

.eligible-yes {
  color: var(--green);
}

.eligible-no {
  color: var(--red);
}

.criterion-bar {
  height: 12px;
  background: #e2e7ed;
  min-width: 140px;
  margin-top: 6px;
}

.criterion-bar > i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.audit-old {
  color: var(--red);
}

.audit-new {
  color: var(--green);
}

.display-body {
  background: #0f2638;
  color: #fff;
}

.display-page {
  max-width: 1600px;
}

.display-body h1 {
  font-size: 42px;
}

.display-body a {
  color: #b9dafa;
}

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

.display-hall {
  min-width: 0;
  border: 1px solid #567083;
  padding: 22px;
}

.display-hall h2 {
  font-size: 27px;
  margin-top: 0;
}

.display-winner {
  font-size: 21px;
  padding: 12px 0;
  border-bottom: 1px solid #567083;
}

.display-winner strong {
  font-size: 28px;
}

.neutral {
  display: grid;
  place-items: center;
  min-height: 70vh;
  text-align: center;
}

.logos {
  display: flex;
  gap: 16px 25px;
  align-items: center;
  flex-wrap: wrap;
  max-height: 100px;
}

.logos img {
  max-height: 90px;
  max-width: 240px;
  object-fit: contain;
  background: #fff;
  padding: 5px;
}

.print-only {
  display: none;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}

.badge {
  display: inline-block;
  background: #e6ebf0;
  padding: 3px 7px;
  margin: 2px;
}

.snapshot-data {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  padding: 16px;
  border: 1px solid var(--line);
  font-size: 12px;
}

#correction-panel > label {
  display: block;
  margin: 14px 0;
}

#correction-save {
  margin-right: 10px;
}

@media (max-width: 900px) {
  .page {
    padding: 18px 14px;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    padding: 10px 14px;
    gap: 10px 14px;
    position: static;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar nav {
    grid-column: 1/-1;
    grid-row: 2;
    gap: 8px 14px;
  }

  .user {
    grid-column: 2;
    grid-row: 1;
    width: auto;
  }

  .hall-grid,
  .form-grid,
  .form-grid.three,
  .display-grid {
    grid-template-columns: 1fr;
  }

  .page-heading {
    display: block;
  }

  .page-heading > .status,
  .page-heading > .save-status {
    margin-top: 10px;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics strong {
    font-size: 22px;
  }

  .score-table .criterion-column {
    width: 230px;
    min-width: 230px;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 16px 12px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar nav {
    font-size: 14px;
    gap: 8px 12px;
  }

  .user {
    font-size: 13px;
    gap: 8px;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics > div {
    padding: 12px;
  }

  .panel,
  .form-section,
  .hall-block {
    padding: 12px;
  }

  fieldset {
    padding: 12px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar label,
  .filter-bar button {
    width: 100%;
  }

  .login-box {
    padding: 24px;
  }

  .display-body h1 {
    font-size: 30px;
  }

  .display-hall {
    padding: 16px;
  }

  .logos {
    margin-top: 16px;
  }

  .score-table .criterion-column {
    width: 200px;
    min-width: 200px;
  }
}

.hall-sheet-heading {
  align-items: center;
  margin-top: 24px;
}

.hall-sheet-heading h2 {
  margin: 0 0 6px;
}

.criteria-panel {
  margin-bottom: 12px;
}

.criteria-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.criteria-legend > div > span {
  display: block;
  margin: 6px 0;
}

.criteria-legend details {
  margin-top: 8px;
}

.hall-score-wrap {
  max-height: 72vh;
  margin-top: 0;
  overscroll-behavior: contain;
}

.hall-score-table {
  width: auto;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.hall-score-table th,
.hall-score-table td {
  padding: 6px;
  border-right: 1px solid var(--line);
  vertical-align: middle;
}

.hall-score-table .order-column,
.hall-score-table .team-column {
  position: sticky;
  z-index: 4;
  background: #fff;
}

.hall-score-table .order-column {
  left: 0;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  text-align: center;
}

.hall-score-table .team-column {
  left: 48px;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  box-shadow: 5px 0 5px -5px #657181;
}

.hall-score-table .team-column > span:not(.status),
.hall-score-table .team-column > small {
  display: block;
  margin-top: 5px;
}

.hall-score-table .team-column .status {
  margin-top: 8px;
}

.hall-score-table thead th {
  background: #edf1f5;
  text-align: center;
}

.hall-score-table thead tr:first-child th {
  top: 0;
  height: 58px;
}

.hall-score-table thead tr:nth-child(2) th {
  top: 58px;
}

.hall-score-table thead .order-column,
.hall-score-table thead .team-column {
  z-index: 7;
  background: #edf1f5;
}

.hall-score-table tbody tr:hover .order-column,
.hall-score-table tbody tr:hover .team-column {
  background: #f7f9fb;
}

.hall-score-table .criterion-heading,
.hall-score-table .matrix-score-cell {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  text-align: center;
}

.hall-score-table .criterion-heading small {
  display: block;
  margin-top: 3px;
  font-weight: 400;
}

.hall-score-table .expert-total-heading,
.hall-score-table .expert-total {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  text-align: center;
}

.hall-score-table .expert-total {
  background: #eef3f7;
}

.hall-score-table .expert-total strong,
.hall-score-table .expert-total small {
  display: block;
}

.hall-score-table .expert-total strong {
  font-size: 20px;
}

.hall-score-table .expert-total small {
  min-height: 15px;
  color: var(--muted);
  font-size: 10px;
}

.hall-score-table .expert-total.sheet-dirty {
  background: #fff0cf;
}

.hall-score-table .expert-total.sheet-complete {
  background: #dff1e7;
}

.hall-score-table .score-cell input.score-input {
  width: 54px;
  height: 42px;
  padding: 3px;
  font-size: 20px;
}

.hall-score-table .score-cell label {
  font-size: 10px;
  white-space: nowrap;
}

.hall-score-table .average-column {
  width: 135px;
  min-width: 135px;
  max-width: 135px;
  text-align: center;
  background: #f7f9fb;
}

.hall-score-table .average-column > strong,
.hall-score-table .average-column > small {
  display: block;
}

.hall-score-table .average-column > strong {
  margin-bottom: 6px;
  font-size: 22px;
}

.hall-score-table .status-column {
  width: 205px;
  min-width: 205px;
  max-width: 205px;
}

.team-status-form,
.team-confirm-form {
  display: grid;
  gap: 6px;
}

.team-status-form select,
.team-status-form button,
.team-confirm-form button {
  width: 100%;
  margin: 0;
}

.team-confirm-form {
  margin-top: 10px !important;
}

@media (max-width: 900px) {
  .hall-sheet-heading .primary {
    margin-top: 12px;
  }
}

@media (max-width: 600px) {
  .criteria-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .hall-score-wrap {
    max-height: 68vh;
  }

  .hall-score-table .order-column {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .hall-score-table .team-column {
    left: 40px;
    width: 165px;
    min-width: 165px;
    max-width: 165px;
  }

  .hall-score-table .status-column {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }
}

@media print {
  body {
    background: #fff;
    font-size: 11px;
  }

  .topbar,
  .no-print {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .print-only {
    display: block;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
  }

  thead th {
    position: static;
  }

  th,
  td {
    padding: 5px;
    border: 1px solid #999;
  }

  .signature {
    margin-top: 35px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
  }

  .status {
    border: 1px solid #aaa;
    background: #fff;
    color: #000;
  }
}
