@import url('./design-tokens.css');

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html { color: var(--ink); background: var(--surface); font-family: var(--font-sans); }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue-dark); }

.topline { height: 7px; background: var(--cyan); }
.shell { width: min(var(--container-shell), calc(100% - 40px)); margin: 0 auto; }
.header { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 18px; text-decoration: none; color: var(--ink); }
.brand img { width: 205px; height: auto; display: block; }
.brand-title { border-left: 1px solid var(--line); padding-left: 18px; font-size: 14px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 20px; font-size: 14px; }
.header-actions > a:not(.button):not(.ds-text-button), .link-button { border: 0; background: none; color: var(--blue-dark); padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

main { width: min(var(--container-reading), calc(100% - 40px)); margin: 58px auto 90px; }
.wide { width: min(var(--container-wide), calc(100% - 40px)); }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--blue-dark); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
h1 { font-size: var(--text-display-existing); line-height: 1.03; letter-spacing: -.035em; margin: 0 0 14px; max-width: 850px; }
h1[tabindex="-1"]:focus { outline: none; }
h2 { font-size: var(--text-heading); letter-spacing: -.02em; margin: 0 0 10px; }
h3 { font-size: var(--text-title); margin: 0 0 8px; }
p { line-height: var(--leading-body); }
.lead { font-size: 19px; color: #42546a; margin: 0 0 34px; max-width: 670px; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }
.space-top-sm { margin-top: 12px; }
.space-top { margin-top: 20px; }
.space-top-lg { margin-top: 28px; }
.space-top-xl { margin-top: 38px; }
.nowrap { flex-wrap: nowrap; }

.card { border: 1px solid var(--line); background: white; padding: 28px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card.soft { background: var(--soft); box-shadow: none; }
.card.board { border-top: 5px solid var(--yellow); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card + .card { margin-top: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 18px; }
.weighting-help summary, .matrix-reference-help summary { cursor: pointer; color: var(--blue-dark); font-weight: 700; }
.weighting-diagram { margin: 20px 0 0; }
.weighting-parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.weighting-parts > div { border: 1px solid var(--line); padding: 16px 8px; text-align: center; }
.weighting-parts span { font-size: 13px; color: var(--muted); }
.weighting-parts p { margin: 10px 0; }
.weighting-parts strong { color: var(--blue-dark); font-size: 24px; }
.weighting-total { text-align: center; padding: 12px; background: var(--soft); margin-top: 12px; }
.weighting-total > span { font-size: 26px; }
.weighting-total p { margin: 4px 0 10px; }
.weighting-diagram figcaption { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
@media (max-width: 600px) { .weighting-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.prompt-guide { margin: 20px 0; padding: 20px; border-left: 4px solid var(--cyan); background: var(--soft); }
.prompt-guide ul { margin: 12px 0; padding-left: 20px; }
.prompt-guide li { margin: 10px 0; line-height: 1.5; }
.decision-matrix-reference { margin: 24px 0; }
.decision-matrix-reference img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.decision-matrix-reference figcaption { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.individual-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; gap: 28px; margin-top: 24px; }
.individual-main { min-width: 0; }
.prompt-composer > label { margin: 22px 0 8px; }
#individual-context, #team-context { height: 230px; background: var(--soft); font-size: 14px; }
#individual-prompt { min-height: 150px; }
.prompt-execution .work-actions { margin-bottom: 0; }
#individual-prompt-status:empty { display: none; }
.role-guide { position: sticky; top: 24px; }
.role-guide figure { margin: 0; }
.role-guide img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.role-guide figcaption { margin-top: 12px; font-size: 13px; line-height: 1.5; }
@media (max-width: 900px) {
  .individual-workspace { grid-template-columns: 1fr; }
  .role-guide { position: static; grid-row: 1; max-width: 500px; width: 100%; margin: 0 auto; }
}
.score-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.score-summary span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.score-summary strong { font-size: 23px; }
@media (max-width: 600px) { .score-summary { grid-template-columns: 1fr; gap: 16px; } }
.inline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

label { display: grid; gap: 8px; font-size: var(--text-label); font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--field-border); border-radius: var(--radius-control); padding: 13px 14px; color: var(--ink); background: var(--surface); outline: none; font-weight: 400; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: var(--focus-ring); }
textarea { min-height: 126px; resize: vertical; line-height: var(--leading-field); }
.field-help { font-size: var(--text-xs); color: var(--muted); font-weight: 400; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

.button { border: 1px solid var(--blue); border-radius: var(--radius-control); background: var(--blue); color: white; min-height: var(--control-height); padding: 0 22px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button:hover { background: var(--blue-dark); }
.button.secondary { color: var(--blue-dark); background: #fff; }
.button.secondary:hover { background: #eff7fc; }
.button.quiet { border-color: var(--line); color: var(--ink); background: #fff; }
.button.danger { border-color: var(--danger); color: var(--danger); background: white; }
.button.full { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.steps { display: flex; gap: 34px; margin: 24px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.steps li { padding-bottom: 13px; border-bottom: 3px solid transparent; white-space: nowrap; }
.steps li.active { color: var(--blue-dark); border-color: var(--blue); font-weight: 700; }
.steps li.done { color: var(--ink); }

.ranking { display: grid; gap: 9px; margin: 18px 0 26px; }
.rank-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; min-height: 64px; border: 1px solid var(--line); padding: 10px 12px; background: white; cursor: grab; }
.rank-item.dragging { opacity: .45; }
.rank-number { display: grid; place-items: center; width: 34px; height: 34px; background: var(--soft); font-weight: 700; }
.rank-name strong { display: block; margin-bottom: 3px; }
.rank-name span { font-size: 13px; color: var(--muted); }
.rank-actions { display: flex; gap: 4px; }
.rank-actions button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }

.team-card { border: 1px solid var(--line); padding: 18px; min-height: 144px; display: flex; flex-direction: column; justify-content: space-between; }
.team-card.full { opacity: .6; }
.code { font-family: var(--font-mono); font-size: 22px; letter-spacing: .12em; font-weight: 700; }
.member-list { list-style: none; padding: 0; margin: 14px 0 0; }
.member-list li { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; font-size: 14px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 13px; background: #eaf5fc; color: var(--blue-dark); font-size: 12px; font-weight: 700; }
.badge.ok { color: var(--ok); background: #eaf7f1; }
.badge.closed { color: #774949; background: #f9eeee; }

.notice { border-left: 4px solid var(--cyan); background: var(--soft); padding: 16px 18px; margin: 22px 0; line-height: 1.5; }
.feedback { border-top: 5px solid var(--yellow); background: #fffdf1; padding: 24px; margin-top: 26px; }
.score { font-size: 52px; line-height: 1; letter-spacing: -.04em; font-weight: 700; }
.feedback-grid { display: grid; grid-template-columns: 100px 1fr; gap: 10px 18px; margin-top: 22px; }
.feedback-grid dt { font-size: 13px; font-weight: 700; color: var(--muted); }
.feedback-grid dd { margin: 0; line-height: 1.45; }
.rubric { margin-top: 22px; }
.rubric summary { cursor: pointer; color: var(--blue-dark); font-weight: 700; }
.submission-details { margin-top: 18px; }
.submission-details .card { box-shadow: none; padding: 18px 20px; }
.submission-details summary { cursor: pointer; color: var(--blue-dark); }
.review-block { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.stage5-test { margin-top: 16px; }
.stage5-email { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; background: var(--soft); border-left: 3px solid var(--cyan); padding: 16px; }

.matrix-wrap { overflow-x: auto; margin-top: 20px; }
.matrix { border-collapse: collapse; width: 100%; min-width: 760px; }
.matrix th { text-align: left; font-size: 12px; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line); }
.matrix td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.matrix input, .matrix select { padding: 10px; font-size: 13px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.choice { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); padding: 15px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--blue); background: #f1f8fd; }
.choice input { width: auto; margin-top: 2px; }
.comparison { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; margin: 24px 0; }
.comparison .side { padding: 22px; border: 1px solid var(--line); text-align: center; }
.comparison .arrow { text-align: center; font-size: 24px; color: var(--blue); }

.stat { border-top: 4px solid var(--cyan); padding: 18px 0; }
.stat strong { font-size: 30px; display: block; margin-bottom: 5px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table.data { border-collapse: collapse; width: 100%; min-width: 700px; }
table.data th, table.data td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.data th { color: var(--muted); font-size: 12px; background: var(--soft); }
table.data tr:last-child td { border-bottom: 0; }
.cohort-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.cohort-row:last-child { border-bottom: 0; }
.admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-control { display: flex; padding: 4px; background: var(--soft); }
.stage-control button { min-width: 92px; border: 0; background: transparent; padding: 10px 12px; cursor: pointer; }
.stage-control button.active { color: white; background: var(--blue); }
.stage-control button.enabled { color: var(--blue-dark); box-shadow: inset 0 -2px var(--blue); }

.modal { position: fixed; inset: 0; background: rgba(4, 19, 35, .58); z-index: 20; display: grid; place-items: center; padding: 20px; }
.modal-panel { width: min(860px, 100%); max-height: 88vh; overflow: auto; background: white; padding: 34px; box-shadow: 0 22px 70px rgba(0,0,0,.25); }
.modal-panel.compact { max-width: 520px; text-align: center; }
.modal-panel.compact .lead { margin-left: auto; margin-right: auto; }
.access-code { font-size: 36px; margin: 28px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 12px 18px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }
.empty { border: 1px dashed #b9c7d4; padding: 36px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .shell, main, .wide, .stage-one { width: min(100% - 28px, 100%); }
  .header { height: 78px; }
  .brand img { width: 165px; }
  .brand-title { display: none; }
  .header-actions { gap: 12px; }
  main { margin-top: 38px; }
  h1 { font-size: 36px; }
  .grid-2, .grid-3, .choice-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; overflow: visible; }
  .steps li { white-space: normal; padding-bottom: 5px; }
  .steps button { text-align: left; font-size: 12px; line-height: 1.25; }
  .comparison { grid-template-columns: 1fr; gap: 8px; }
  .comparison .arrow { transform: rotate(90deg); }
  .between { align-items: flex-start; flex-direction: column; }
  .stage-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .stage-control button { min-width: 0; }
  .cohort-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}

/* Keep the UTDT visual language; expose detail only when it is useful. */
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 4px; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { font-size: 20px; font-weight: 700; }
summary { cursor: pointer; line-height: 1.5; color: var(--blue-dark); }
.preserve, blockquote { white-space: pre-wrap; overflow-wrap: anywhere; }
blockquote { margin: 16px 0; padding-left: 18px; border-left: 3px solid var(--line); line-height: 1.55; }
.steps button { color: inherit; background: none; border: 0; padding: 5px 0; cursor: pointer; }
.steps button:disabled { color: var(--muted); cursor: default; }
.team-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 18px 0; border-block: 1px solid var(--line); font-size: 14px; margin-bottom: 24px; }
.role-choice { padding: 16px 0; border-bottom: 1px solid var(--line); }
.role-choice select { width: min(100%, 320px); }
.context-section { margin: 32px 0; }
.context-section p { max-width: 680px; }
.work-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin: 18px 0 26px; }
.before-submit { margin-bottom: 26px; }
.before-submit li { margin-bottom: 15px; line-height: 1.5; }
.before-submit p { margin-top: 5px; }
.individual-decisions details, .participants-list details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.individual-decisions summary strong { margin-left: 16px; color: var(--ink); }
.review-steps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 18px; }
.review-steps button { color: var(--blue-dark); border: 0; background: transparent; padding: 8px 0; cursor: pointer; }
.review-steps button[aria-current] { font-weight: 700; border-bottom: 2px solid var(--blue); }
.review-steps button:disabled { color: var(--muted); cursor: default; }
.step-back { margin-top: 28px; }
.bias-summary { border: 1px solid var(--line); background: var(--soft); padding: 18px 20px; }
.bias-summary summary { font-weight: 700; }
.bias-summary ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; list-style: none; margin: 14px 0 0; padding: 0; }
.bias-summary li { display: grid; gap: 3px; border-top: 1px solid var(--line); padding: 12px 0; line-height: 1.45; }
.bias-summary li strong { font-size: 14px; }
.bias-summary li span { color: var(--muted); font-size: 14px; }
.correction-steps { margin: 20px 0; padding-left: 24px; }
.correction-steps li { margin: 10px 0; padding-left: 4px; line-height: 1.5; }
.validation-help { display: grid; grid-template-columns: 140px 1fr; gap: 12px; line-height: 1.5; }
.validation-help dt { font-weight: 700; }
.validation-help dd { margin: 0; }
.matrix { min-width: 0; table-layout: fixed; }
.matrix th:nth-child(1) { width: 76px; }
.matrix th:nth-child(2) { width: 30%; }
.matrix th:nth-child(3) { width: 25%; }
.matrix th:nth-child(4) { width: auto; }
.matrix td { padding: 10px 5px; }
.matrix textarea, .matrix select { font-size: 14px; padding: 10px 8px; min-width: 0; }
.matrix textarea { min-height: 100px; resize: vertical; overflow-wrap: anywhere; }
.matrix td:last-child textarea { margin-top: 10px; min-height: 76px; }
.matrix-read section { border-bottom: 1px solid var(--line); padding: 18px 0; }
.matrix-read p, .source-review span { overflow-wrap: anywhere; }
.evidence-toolbar { gap: 16px; flex-wrap: wrap; }
.evidence-row { margin: 14px 0; overflow-wrap: anywhere; }
.evidence-row .between { align-items: flex-start; gap: 16px; }
.evidence-row h3 { margin: 0; }
.evidence-row [data-delete-evidence] { flex-shrink: 0; }
.danger-text { color: var(--red, #a12727); }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .evidence-row .between { flex-direction: column; gap: 8px; }
  .evidence-toolbar .button { width: 100%; }
}
.grade-criteria { display: grid; gap: 20px; }
.source-review { margin: 18px 0; }
.modal-panel { border: 0; width: min(860px, calc(100% - 32px)); max-height: 90dvh; padding: 30px; color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
dialog .work-actions { margin-bottom: 20px; }
dialog details { margin: 16px 0; }
dialog .between { flex-direction: row; align-items: flex-start; }
dialog [data-close] { min-width: 44px; min-height: 40px; }
.cohort-url { overflow-wrap: anywhere; }
.feedback h2 { font-size: 26px; }
.feedback td, .feedback dd { overflow-wrap: anywhere; }
.rank-actions button { min-width: 40px; min-height: 40px; }
.rank-actions button:disabled { opacity: .35; cursor: default; }
@media (max-width: 760px) {
  .header { height: auto; min-height: 80px; gap: 12px; padding-block: 15px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
  .brand img { width: 148px; }
  .header-actions button { min-height: 30px; }
  main { margin-top: 28px; }
  h1 { font-size: 34px; line-height: 1.08; }
  .matrix, .matrix tbody, .matrix tr, .matrix td { display: block; width: 100%; }
  .matrix thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .matrix tr { border-block: 1px solid var(--line); padding: 18px 0; }
  .matrix td { border: 0; padding: 8px 0; }
  .matrix td::before { content: attr(data-label); display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; }
  .matrix textarea { min-height: 76px; }
  .matrix td:first-child select { max-width: 130px; }
  .validation-help { grid-template-columns: 1fr; gap: 5px; }
  .validation-help dd { margin-bottom: 14px; }
  .rank-item { grid-template-columns: 30px 1fr auto; gap: 8px; padding-inline: 8px; }
  .rank-number { width: 28px; height: 30px; }
  .rank-name strong { font-size: 14px; line-height: 1.4; }
  .rank-actions { flex-direction: column; }
  .feedback { padding: 20px; }
  .feedback-grid { grid-template-columns: 1fr; gap: 6px; }
  .feedback-grid dd { margin-bottom: 12px; }
  .modal-panel { padding: 20px; }
  .access-code { font-size: 27px; margin: 24px 0; }
  .review-steps { gap: 4px 14px; }
  .bias-summary ul { grid-template-columns: 1fr; }
  .work-actions { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
