/* ===== Matches page (team sheet -> portal players, one team at a time) ===== */
main.ms-main { max-width: 1240px; }
.ms-narrow { max-width: 720px; margin: 0 auto; }

/* stepper */
.ms-stepper { list-style: none; margin: 0 auto 22px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; max-width: 720px; }
.ms-step {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.ms-step-n {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 700;
}
.ms-step.active { border-color: var(--accent); color: var(--ink); }
.ms-step.active .ms-step-n { background: var(--accent); color: #fff; }
.ms-step.done { color: var(--ink-2); }
.ms-step.done .ms-step-n { background: var(--lime); color: #fff; }

/* upload */
.ms-dropzone { margin-bottom: 14px; }
.ms-file-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--tint-accent); border: 1px solid var(--tint-accent-border); font-size: 14px;
}
.ms-file-name { font-weight: 600; }
.ms-file-meta { color: var(--muted); font-size: 12.5px; }
.ms-file-row > div { flex: 1; min-width: 0; }
.ms-file-remove {
  flex: none; width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--tint-accent-border);
  background: var(--card); color: var(--muted); cursor: pointer; font-size: 13px; font-family: inherit;
}
.ms-file-remove:hover { color: var(--red); border-color: var(--tint-danger-border); background: var(--tint-danger); }
.ms-progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.ms-progress .spinner { width: 20px; height: 20px; margin: 0; }

/* shared question header */
.ms-q { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ms-q-sub { font-size: 14px; color: var(--muted); margin: 6px 0 18px; }

.ms-num-badge {
  display: inline-block; font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 17px;
  background: var(--navy); color: #fff; border-radius: 7px; padding: 1px 9px; margin-right: 6px;
}

.ms-cands { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ms-cand {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-sm); text-align: left;
  border: 2px solid var(--line); background: var(--card); cursor: pointer; font-family: inherit; transition: .12s;
}
.ms-cand:hover { border-color: var(--accent); background: var(--tint-accent); }
.ms-cand.primary { border-color: var(--accent); background: var(--tint-accent); }
.ms-cand-name { font-size: 16px; font-weight: 700; display: block; }
.ms-cand-sub { font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; }
.ms-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
  justify-content: center; color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .02em;
}
.ms-avatar.sm { width: 28px; height: 28px; font-size: 10px; }

.ms-alt { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.ms-alt .ms-spacer { flex: 1; }
.ms-link-btn { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13.5px; cursor: pointer; font-family: inherit; padding: 6px 4px; }
.ms-link-btn:hover { text-decoration: underline; }
.ms-link-btn.muted { color: var(--muted); }

.ms-summary-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.ms-inline-btn { margin-top: 0; width: auto; padding: 12px 22px; }

/* ===== v3: real data ===== */
.ms-narrow.error-card { margin-bottom: 20px; }
.ms-file-thumb { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--card); flex: none; }
.ms-avatar.has-photo { background: var(--surface-3) !important; overflow: hidden; }
.ms-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.ms-cand .ms-avatar { width: 56px; height: 56px; }
.ms-cand .ms-avatar.has-photo { width: 64px; height: 64px; }
.ms-warn { font-size: 12.5px; color: var(--tint-warning-ink); background: var(--tint-warning); border-radius: 999px; padding: 2px 9px; display: inline-block; margin-left: 6px; }

/* ===== v4: saved matches, duplicate warning, reopen modal ===== */
.ms-saved-list { display: flex; flex-direction: column; gap: 8px; }
.ms-saved-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  cursor: pointer; font: inherit; color: inherit;
}
.ms-saved-row:hover { border-color: var(--accent); background: var(--tint-accent); }
.ms-saved-teams { font-weight: 700; font-size: 14px; }
.ms-saved-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ms-saved-count { font-size: 12.5px; color: var(--muted); margin-left: auto; text-align: right; white-space: nowrap; }
.ms-saved-evidence { color: var(--accent); font-size: 12px; margin-left: 8px; }

.ms-dup-warning {
  background: var(--tint-warning); border: 1px solid var(--tint-warning-border); color: var(--tint-warning-ink);
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 14px;
}
.ms-dup-warning b { color: var(--tint-warning-ink); }
.ms-dup-warning button { margin-left: auto; flex: none; }

.ms-modal-backdrop {
  position: fixed; inset: 0; background: rgba(14, 23, 38, .5); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.ms-modal { position: relative; width: 100%; max-width: 640px; margin: 0 auto; }
.ms-modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: 14px;
}
.ms-modal-close:hover { color: var(--ink); border-color: var(--muted); }
.ms-modal-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; padding-right: 32px; }
.ms-modal-title-row { display: flex; align-items: center; gap: 8px; }
.ms-modal-title-row .ms-modal-title { padding-right: 0; }
.ms-modal-rename-btn {
  flex: none; width: 26px; height: 26px; border-radius: 999px; border: 1px solid transparent;
  background: none; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
}
.ms-modal-rename-btn:hover { border-color: var(--line); color: var(--ink); background: var(--card); }
.ms-modal-rename { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 32px; }
.ms-rename-input {
  flex: 1 1 140px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  font: inherit; font-size: 15px; font-weight: 700;
}
.ms-rename-input:focus { outline: none; border-color: var(--accent); }
.ms-modal-vs { flex: none; font-size: 13px; color: var(--muted); font-weight: 600; }
.ms-rename-save, .ms-rename-cancel { flex: none; padding: 7px 12px; font-size: 13px; }
.ms-modal-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ms-modal-section { margin-top: 18px; }
.ms-modal-section-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.ms-modal-players { display: flex; flex-direction: column; gap: 6px; }
.ms-modal-player { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.ms-modal-player .ms-num-badge { flex: none; }
.ms-modal-evidence { display: flex; gap: 10px; flex-wrap: wrap; }
.ms-modal-evidence a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.ms-modal-evidence a:hover { border-color: var(--accent); color: var(--accent); }
.ms-modal-actions { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.ms-modal-delete { color: var(--red); }
.ms-modal-delete:hover { border-color: var(--red); background: var(--tint-danger); }

/* ===== v9: one team at a time -- team / parse / link ===== */
.ms-stepper { max-width: none; }
.ms-step-subs { display: inline-flex; gap: 4px; margin-left: 6px; }
.ms-step-sub { font-size: 11px; font-weight: 600; color: var(--muted); padding: 1px 7px; border-radius: 999px; background: var(--surface-3); }
.ms-step-sub.on { background: var(--accent); color: #fff; }
.ms-step-sub.done { background: var(--tint-success); color: var(--tint-success-ink); }
.ms-step-sub.skipped { text-decoration: line-through; opacity: .6; }

/* upload: new match / saved matches toggle */
.ms-mode { display: flex; gap: 6px; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-3); margin-bottom: 14px; }
.ms-mode-btn {
  flex: 1; padding: 9px 12px; border-radius: 9px; border: none; background: none; font: inherit; font-size: 14px;
  font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.ms-mode-btn.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(14,23,38,.12); }
.ms-mode-count { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.ms-mode-btn.on .ms-mode-count { background: var(--accent); color: #fff; }
#savedMatchesCard { margin-top: 0; }

/* upload: video url */
.ms-video { margin: 16px 0 4px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.ms-video-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.ms-video-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.ms-choice {
  flex: 1; min-width: 180px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--card);
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: left;
}
.ms-choice:hover { border-color: var(--accent); }
.ms-choice.on { border-color: var(--accent); background: var(--tint-accent); color: var(--ink); }
.ms-video-input { width: 100%; margin-top: 10px; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-family: 'JetBrains Mono', monospace; font-size: 13.5px; }
.ms-video-input:focus { outline: none; border-color: var(--accent); }
.ms-video-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.ms-video-link { color: var(--accent); word-break: break-all; }
/* Veo link -> "Download video" (streams the standard 1080p file to disk) */
.ms-veo { margin-top: 12px; }
.ms-veo-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ms-veo .ghost-btn:disabled { opacity: .5; cursor: not-allowed; }
.ms-veo-status { font-size: 12.5px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.ms-veo-status.err { color: var(--tint-danger-ink); }
.ms-veo-bar { height: 6px; border-radius: 999px; background: var(--line); margin-top: 10px; overflow: hidden; }
.ms-veo-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }

/* upload match video tab */
.ms-file-row > .ms-vid-icon { width: 44px; height: 58px; border-radius: 6px; background: var(--surface-3); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; font-weight: 800; }
.ms-vid-progress { margin-top: 14px; }
.ms-vu-sec { margin-bottom: 22px; }
.ms-vu-h { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 12px; color: var(--ink); }
.ms-vu-n {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
}
/* 1 -- full match / two halves */
.ms-vu-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-vu-kind {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px 16px; text-align: left;
  border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--card); color: var(--ink-2);
  font: inherit; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.ms-vu-kind:hover:not(:disabled) { border-color: var(--accent); }
.ms-vu-kind:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tint-accent-border); }
.ms-vu-kind.on { border-color: var(--accent); background: var(--tint-accent); color: var(--ink); }
.ms-vu-kind:disabled { cursor: default; }
.ms-vu-kind:disabled:not(.on) { opacity: .45; }
.ms-vu-kind-art { width: 64px; height: 20px; margin-bottom: 6px; fill: var(--surface-3); stroke: var(--muted); stroke-width: 1.5; }
.ms-vu-kind.on .ms-vu-kind-art { fill: var(--accent); stroke: var(--accent); }
.ms-vu-kind-title { font-size: 15px; font-weight: 800; }
.ms-vu-kind-sub { font-size: 12.5px; color: var(--muted); }
/* 2 -- date + teams */
.ms-vu-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ms-vu-flabel { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.ms-vu-input, .ms-vu-date {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-size: 14.5px;
}
.ms-vu-input:focus, .ms-vu-date:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint-accent); }
.ms-vu-input:disabled, .ms-vu-date:disabled { opacity: .7; cursor: default; }
.ms-vu-datefield { position: relative; margin-bottom: 12px; }
.ms-vu-date { display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; font-weight: 600; }
.ms-vu-date svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.ms-vu-date span { flex: 1; min-width: 0; }
.ms-vu-date .ms-vu-date-ph { color: var(--muted); font-weight: 500; }
.ms-vu-date .ms-vu-date-chev { stroke: var(--muted); transition: transform .15s; }
.ms-vu-date[aria-expanded="true"] { border-color: var(--accent); }
.ms-vu-date[aria-expanded="true"] .ms-vu-date-chev { transform: rotate(180deg); }
.ms-vu-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.ms-vu-vs { padding-bottom: 12px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ms-vu-name { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); }
.ms-vu-name.ready { border-style: solid; border-color: var(--tint-accent-border); background: var(--tint-accent); }
.ms-vu-name-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ms-vu-name-val { margin-top: 3px; font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.ms-vu-err { margin-top: 8px; font-size: 13px; color: var(--tint-danger-ink); }
/* the calendar popover */
.ms-cal {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 316px; max-width: 100%; padding: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-hover);
}
.ms-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ms-cal-title { font-weight: 800; font-size: 14.5px; }
.ms-cal-nav {
  width: 32px; height: 32px; border-radius: 999px; border: none; background: none; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink-2);
}
.ms-cal-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-cal-nav:hover:not(:disabled) { background: var(--surface-3); }
.ms-cal-nav:disabled { opacity: .3; cursor: default; }
.ms-cal-wd, .ms-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.ms-cal-wd span { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.ms-cal-day {
  aspect-ratio: 1; min-height: 34px; border-radius: 999px; border: none; background: none; font: inherit; font-size: 13.5px;
  color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums;
}
.ms-cal-day:hover:not(:disabled) { background: var(--surface-3); }
.ms-cal-day:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.ms-cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }
.ms-cal-day.sel, .ms-cal-day.sel:hover { background: var(--accent); color: #fff; font-weight: 700; }
.ms-cal-day:disabled { color: var(--muted); opacity: .35; cursor: default; }
.ms-cal-quick { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.ms-cal-chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ms-cal-chip:hover { border-color: var(--accent); color: var(--ink); }
/* 3 -- the file slot(s) */
.ms-vu-slots { display: flex; flex-direction: column; gap: 10px; }
.ms-vu-drop { margin-bottom: 0; padding: 20px 16px; }
.ms-vu-drop .dropzone-icon { width: 38px; height: 38px; font-size: 18px; margin-bottom: 8px; }
#videoUploadCard > .ms-vu-sec { margin-bottom: 0; }
#vidRest { margin-top: 22px; }
#videoUploadCard.finished .ms-vu-sec, #videoUploadCard.finished #vidMissing, #videoUploadCard.finished #vidUploadBtn { display: none; }
#videoUploadCard.finished #vidRest { margin-top: 0; }
#videoUploadCard.finished .ms-vid-done { margin-top: 0; }
.ms-vu-drop.want { border-color: var(--accent); }
.ms-vu-slot-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.ms-vu-drop .ms-vu-slot-label { margin-bottom: 6px; }
.ms-vu-file .ms-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-vu-slot-state.ok { color: var(--tint-success-ink); font-weight: 600; }
.ms-vu-missing { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ms-veo-bar-fill.processing {
  background-image: linear-gradient(45deg, rgba(255,255,255,.28) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.28) 50%, rgba(255,255,255,.28) 75%, transparent 75%);
  background-size: 18px 18px; animation: ms-vu-stripes 1s linear infinite;
}
@keyframes ms-vu-stripes { to { background-position: 18px 0; } }
@media (prefers-reduced-motion: reduce) { .ms-veo-bar-fill.processing { animation: none; } }
#vidAnotherBtn { margin-top: 6px; }
@media (max-width: 560px) {
  .ms-vu-kinds { grid-template-columns: 1fr; }
  .ms-vu-teams { grid-template-columns: 1fr; }
  .ms-vu-vs { display: none; }
  .ms-cal { width: 100%; }
}
#videoUploadCard .primary-btn, #videoUploadCard .ghost-btn#vidCancelBtn { margin-top: 4px; }
.ms-vid-done { margin-top: 16px; padding: 14px; border-radius: var(--radius-sm); background: var(--tint-success); border: 1px solid var(--tint-success-border); }
.ms-vid-done-title { font-weight: 700; color: var(--tint-success-ink); }
.ms-vid-done-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.ms-vid-done-row .ms-video-link { flex: 1; min-width: 0; font-size: 13px; }

/* team view: sheet left, panel right */
.ms-team-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.ms-team-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.ms-substeps { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ms-substep { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.ms-substep.on { border-color: var(--accent); color: var(--accent); background: var(--tint-accent); }
.ms-substep.skipped { text-decoration: line-through; opacity: .6; }

.ms-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ms-sheet-col { position: sticky; top: 12px; }
.ms-sheet-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.ms-scan-frame {
  position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: auto;
  background: var(--card); max-height: calc(100vh - 140px);
}
.ms-scan-frame img { display: block; width: 100%; height: auto; }
.ms-box { position: absolute; border-radius: 4px; box-sizing: border-box; }
.ms-box-label {
  position: absolute; left: -2px; top: -2px; transform: translate(-100%, 0); font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700; color: #fff; padding: 1px 6px; border-radius: 5px; white-space: nowrap; line-height: 16px;
}
/* Frames are outlines only -- nothing is ever painted over the sheet's own
   text, and labels sit outside the frame (above / below), not on the names. */
.ms-box-region { border: 2px dashed rgba(47,109,246,.5); pointer-events: none; }
.ms-box-region .ms-box-label { transform: none; left: auto; right: -2px; top: auto; bottom: -20px; background: rgba(47,109,246,.85); }
.ms-box-header { border: 2px solid var(--accent); pointer-events: none; }
.ms-box-header .ms-box-label { transform: none; left: -2px; top: -20px; background: var(--accent); }
/* Invisible by default -- just a hit area over the name, sized/positioned
   like any other frame -- so the sheet reads clean until the operator asks
   a question of it. Colour (and the approx dashing) only appears on `.hl`:
   hovering/focusing the matching row in the list on the right, or the name
   on the sheet itself (both ways, see setHighlight()). */
.ms-box-row { --c: var(--accent); border: 2px solid transparent; cursor: pointer; transition: box-shadow .12s, background .12s, border-color .12s; }
.ms-box-row.hl { border-color: var(--c); background: color-mix(in srgb, var(--c) 28%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent); z-index: 2; }
.ms-box-row.hl.approx { border-style: dashed; }

.ms-panel { padding: 22px 24px; }
.ms-panel .ms-q { font-size: 20px; }
.ms-panel .ms-q-sub { margin-bottom: 14px; }
.ms-panel-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.ms-panel-actions .primary-btn { width: 100%; }
.ms-field { display: block; margin-bottom: 14px; }
.ms-field span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.ms-field input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; }
.ms-field input:focus { outline: none; border-color: var(--accent); }

/* which phone: the Captures page's chips (style.css .device-chip / .device-ready) */
.ms-phone-row { margin-bottom: 14px; }
.ms-phone-row .device-chip.active .device-ready-all { background: var(--accent); color: #fff; }
.ms-new-team { border-style: dashed; }
.ms-new-team-hint { font-size: 13px; color: var(--muted); line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); }
.ms-new-team-hint b { color: var(--ink-2); }
/* parsed rows / link rows */
/* minmax(0,1fr): a bare implicit column sizes to the widest row's content (the one carrying two flag chips), pushing every row past the panel */
.ms-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ms-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.ms-row.hl { background: var(--tint-accent); border-color: var(--tint-accent-border); }
.ms-row.bad { background: var(--tint-danger); border-color: var(--tint-danger-border); }
.ms-row.added { background: var(--tint-warning); }
.ms-row-n {
  --c: var(--accent); flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--c); color: #fff;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.ms-row input, .ms-row select { font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-width: 0; }
.ms-row input:focus, .ms-row select:focus { outline: none; border-color: var(--accent); }
/* which kind of number: "match" = the shirt number on the team sheet, never the phone roster's physical-test number */
.ms-num-kind { font-family: inherit; font-size: .62em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .75; margin-right: 4px; vertical-align: .12em; }
.ms-row-numwrap { flex: none; display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 18px; }
.ms-row-numwrap .ms-num-kind { opacity: 1; margin-right: 2px; }
.ms-row-num { width: 54px; font-family: 'JetBrains Mono', monospace !important; font-weight: 700; text-align: center; }
.ms-row-name { flex: 1; font-weight: 600; }
.ms-row select option { background: var(--card); color: var(--ink); }
.ms-row-role { width: 92px; }
.ms-row .ms-row-pos { width: 80px; padding-left: 7px; padding-right: 4px; }
.ms-row-flags { display: flex; gap: 4px; flex: none; }
.ms-row-flags .ms-warn { margin-left: 0; font-size: 11px; padding: 1px 7px; }
.ms-row-del { flex: none; width: 26px; height: 26px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-family: inherit; }
.ms-row-del:hover { color: var(--red); border-color: var(--tint-danger-border); background: var(--tint-danger); }

.ms-link-row { align-items: center; }
.ms-link-sheet { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-link-sheet b { color: var(--ink); }
.ms-link-sheet .ms-role { color: var(--muted); font-size: 12px; }
.ms-num-badge.sm { font-size: 13px; padding: 0 7px; margin-right: 2px; }
.ms-link-arrow { color: var(--muted); flex: none; }
.ms-pick-wrap { flex: 1.15; min-width: 0; position: relative; }
.ms-pick {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 10px; text-align: left;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font: inherit; color: inherit; min-width: 0; overflow: hidden;
}
.ms-pick:hover { border-color: var(--accent); }
.ms-pick.has { border-color: var(--tint-success-border); background: var(--tint-success); }
.ms-pick.empty { border-color: var(--tint-danger-border); background: var(--tint-danger); color: var(--muted); }
.ms-pick.none { color: var(--muted); }
.ms-pick-name { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-pick-sub { flex: 0 1 auto; min-width: 0; max-width: 45%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-pick-caret { margin-left: auto; color: var(--muted); font-size: 12px; flex: none; }
.ms-picker { position: absolute; z-index: 5; left: 0; right: 0; top: 0; background: var(--card); border: 1.5px solid var(--accent); border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px rgba(14,23,38,.18); }
.ms-picker input { width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.ms-picker input:focus { outline: none; border-color: var(--accent); }
.ms-picker-list { display: grid; gap: 4px; margin-top: 6px; max-height: 320px; overflow: auto; }
.ms-picker-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 6px 4px 2px; }
.ms-picker-list .ms-cand { padding: 7px 9px; border-width: 1px; border-radius: 10px; }
.ms-picker-list .ms-cand .ms-avatar { width: 32px; height: 32px; }
.ms-picker-list .ms-cand .ms-avatar.has-photo { width: 36px; height: 36px; }
.ms-picker-list .ms-cand.taken { opacity: .55; }
.ms-picker-list .ms-cand-name { font-size: 14px; }
.ms-link-row.open { z-index: 6; position: relative; }

.ms-gate-line { margin-top: 14px; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 8px; }
.ms-gate-line.ok { background: var(--tint-success); color: var(--tint-success-ink); }
.ms-gate-line.bad { background: var(--tint-danger); color: var(--tint-danger-ink); }

.ms-modal-player.unlinked { color: var(--muted); }
.ms-modal-player.unlinked b { color: var(--ink-2); font-weight: 600; }

@media (max-width: 900px) {
  .ms-split { grid-template-columns: 1fr; }
  .ms-sheet-col { position: static; }
  .ms-scan-frame { max-height: 46vh; }
  .ms-panel { padding: 16px; }
  .ms-row { flex-wrap: wrap; }
  .ms-row-name { flex-basis: 100%; order: 5; }
}

/* ===== Analysis section of the saved-match modal (2026-11-03) ===== */
.ms-an-table td, .ms-an-table th { padding: 6px 10px; }
.ms-an-table select { max-width: 210px; }
.ms-an-table th { white-space: nowrap; }
.ms-an-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
