/* 方案1 本场核对台；业务权限、保存范围与账号关联状态由原组件决定。 */
body.tf-management .workspace-shell.tp-active {
  display: grid !important;
  --tp-success: #a7c7b4;
  --tp-danger: #ff958b;
  --tp-danger-bg: #3b2428;
  --tp-paper: #19232b;
  grid-template-columns: minmax(0, 1.58fr) minmax(320px, 1fr);
  column-gap: 18px; row-gap: 18px;
  align-items: start;
}
body.tf-management .workspace-shell.tp-active > * { margin-top: 0 !important; }
.tp-active { font-family: system-ui, 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }
html.light-mode body.tf-management .workspace-shell.tp-active {
  --tp-success: #34694a; --tp-danger: #af3e34;
  --tp-danger-bg: #fbede6; --tp-paper: #fcfbf7;
}
.tp-active > .tf-checklist, .tp-active > .tf-task-title { display: none !important; }
.tp-active > .tf-workflow { grid-column: 1/-1 !important; margin-bottom: 0 !important; }
body.tf-management .tp-active > app-tournament-match-planning {
  display: block !important; grid-column: 1 !important; grid-row: 2 !important;
  min-width: 0; padding: 18px; background: var(--tp-paper); border: 1px solid var(--tf-line); border-radius: 5px;
}
body.tf-management .tp-active > #tournament-judge-links {
  display: block !important; grid-column: 2 !important; grid-row: 2/4 !important;
  padding: 20px !important; border-radius: 5px !important; background: var(--tp-paper) !important;
}
body.tf-management .tp-active > .jl-aux {
  display: block !important; grid-column: 1 !important; grid-row: 3 !important;
  padding: 18px; margin: 0; border: 1px solid var(--tf-line); border-radius: 5px; background: var(--tp-paper);
}
.tp-active .jl-aux > summary { display: none; }
body.tf-management .tp-active > .tp-footer {
  grid-column: 1/-1 !important; grid-row: 4 !important; display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--tf-panel); border: 1px solid var(--tf-line); border-radius: 5px;
}
.tp-footer p { flex: 1; color: var(--tf-muted); font-size: 13px; margin: 0; line-height: 1.6; }
.tp-footer button { padding: 9px 20px; min-height: 44px; border: 1px solid var(--tf-line); border-radius: 4px; font-size: 14px; color: var(--tf-ink); background: var(--tp-paper); }
.tp-footer .tp-save:not(:disabled) { background: var(--tf-accent); color: white; border-color: var(--tf-accent); }
.tp-footer button:disabled { opacity: .5; cursor: not-allowed; }
.tp-active .tp-roster-head { margin-bottom: 14px; }
.tp-roster-head > div { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tp-roster-head h2, #tournament-judge-links .tp-detail-heading {
  font: 650 21px/1.5 'Noto Serif SC', 'Source Han Serif SC', serif; margin: 0;
}
.tp-lock { color: var(--tf-warm); font-size: 12px; background: color-mix(in srgb, var(--tf-warm) 10%, transparent); padding: 5px 8px; border-radius: 4px; }
.tp-muted { color: var(--tf-muted); font-size: 12px; line-height: 1.7; margin: 7px 0 0; }
.tp-active [data-testid=match-judges-editor] > .flex,
.tp-active.tp-synced [data-testid=judge-match-select] { display: none !important; }
.tp-active [data-testid=match-judges-editor] > .grid > label:not(:last-child) { display: none; }
.tp-active [data-testid=match-judges-editor] > .grid { display: block; margin-bottom: 14px; }
.tp-active.tp-judges-locked [data-testid=match-judges-editor] > .grid { display: none; }
.tp-active:not(.tp-synced) [data-testid=match-judges-editor] > .grid > label { display: block; }
.tp-active [data-testid=match-judges-editor] { display: flex; flex-direction: column; gap: 0; }
.tp-active [data-testid=match-judges-editor] > * { margin-top: 0 !important; }
.tp-active [data-testid=match-judges-editor] > .planning-card { padding: 0 !important; border: 0 !important; background: transparent !important; }
.tp-active [data-testid=match-judges-editor] > .planning-card > .flex > div > p:not(:last-child) { display: none; }
.tp-active [data-testid=match-judges-editor] > .planning-card > .flex:has(p:only-child) { display: none; }
.tp-active [data-testid=match-judges-editor] > .planning-card > .flex { margin-bottom: 10px; }
.tp-active.tp-judges-locked [data-testid=match-judges-editor] > .planning-card > .flex { display: none; }
.tp-active [data-testid=match-judges-editor] > .planning-card > .flex p { font-size: 12px; line-height: 1.6; color: var(--tf-warm); }
.tp-active [data-testid=match-judges-editor] > .planning-card > .space-y-3 { display: flex; flex-direction: column; gap: 10px; margin: 0 !important; }
.tp-active [data-testid^=judge-row-] {
  display: grid; grid-template-columns: minmax(100px, 1fr) 90px 78px; gap: 7px;
  background: transparent !important; border: 1px solid var(--tf-line); border-radius: 4px !important; padding: 12px !important; margin: 0 !important;
}
.tp-active [data-testid^=judge-row-][data-tp-state=mismatch] { border-left: 3px solid var(--tp-danger); background: var(--tp-danger-bg) !important; }
.tp-active [data-testid^=judge-row-][data-tp-selected=true] { box-shadow: inset 0 0 0 1px var(--tf-accent); }
.tp-active [data-testid^=judge-row-] > .field { min-height: 34px; padding: 5px 8px; border: 0; background: color-mix(in srgb, var(--tf-line) 23%, transparent); font-size: 12px; color: var(--tf-ink); }
.tp-active [data-testid^=judge-row-] > div.field { padding-left: 0; background: transparent; font-size: 15px; font-weight: 650; }
.tp-active [data-testid^=judge-row-] > select:disabled { opacity: 1; appearance: none; cursor: default; }
.tp-row-evidence { grid-column: 1/-1; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 4px 10px; }
.tp-kind { font-size: 11px; padding: 3px 6px; color: var(--tf-muted); background: color-mix(in srgb,var(--tf-line) 35%,transparent); border-radius: 3px; }
.tp-row-check { text-align: left; border: 0; background: transparent; color: var(--tf-muted); padding: 5px 0; font-size: 12px; line-height: 1.5; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; min-height: 30px; }
[data-tp-state=mismatch] .tp-row-check { color: var(--tp-danger); font-weight: 650; }
[data-tp-state=matched] .tp-row-check { color: var(--tp-success); }
.tp-row-check:disabled { cursor: default; text-decoration: none; opacity: 1; }
.tp-row-evidence small { grid-column: 2; font-size: 11px; color: var(--tf-muted); overflow-wrap: anywhere; }
.tp-row-evidence small:empty { display: none; }
.tp-account { grid-column: 3; grid-row: 1/3; font-size: 11px; color: var(--tf-muted); text-align: right; }
.tp-active .tf-judge-pool { order: 9; margin: 12px 0 0 !important; padding: 0; border: 0; }
.tp-active .tf-judge-pool > summary { font-size: 12px; min-height: 36px; padding: 8px 0; }
.tp-active:not(.tp-synced) [data-testid=match-judges-editor] > .planning-card { visibility: hidden; }
#tournament-judge-links .tp-profile-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 14px 0 18px; }
#tournament-judge-links .tp-profile-tab { font-size: 12px; min-height: 34px; padding: 5px 12px; border-radius: 4px; }
#tournament-judge-links .tp-profile-tab[aria-pressed=true] { border-color: var(--tf-accent); color: var(--tf-accent); background: var(--tf-active); }
.tp-active #tournament-judge-links > h3,
.tp-active #tournament-judge-links > p:first-of-type:not(.tp-empty),
.tp-active #tournament-judge-links > .jl-controls,
.tp-active #tournament-judge-links > .jl-directory,
.tp-active #tournament-judge-links > .jl-context,
.tp-active #tournament-judge-links > p:nth-of-type(2):not(.tp-empty) { display: none !important; }
.tp-active #tournament-judge-links .jl-cards { display: block; margin: 0; }
.tp-active #tournament-judge-links .jl-card { display: flex; flex-direction: column; border: 0; padding: 0; border-radius: 0; }
.tp-active #tournament-judge-links .jl-card[hidden] { display: none !important; }
.tp-active #tournament-judge-links .jl-card > strong { order: 0; font-size: 16px; margin-bottom: 6px; }
.tp-active #tournament-judge-links .jl-card[data-tp-evidence=true] > strong { display: none; }
.tp-active #tournament-judge-links [data-jl-profile-info] { order: 1; padding: 12px; line-height: 1.9; margin: 5px 0 12px; background: var(--tf-panel); border: 1px solid var(--tf-line); border-radius: 4px; font-size: 13px; color: var(--tf-ink); }
.tp-active #tournament-judge-links[data-tp-detail-state=mismatch] [data-jl-profile-info] { background: var(--tp-danger-bg); border-color: color-mix(in srgb,var(--tp-danger) 55%,var(--tf-line)); color: var(--tp-danger); }
.tp-active #tournament-judge-links [data-jl-profile-note] { order: 2; font-size: 12px; margin: 0 0 10px; line-height: 1.8; }
.tp-active #tournament-judge-links .jl-card > .jl-actions { order: 3; margin: 0 0 10px; gap: 8px; }
.tp-active #tournament-judge-links .jl-preview { color: white; background: #b34436; border-color: #b34436; text-decoration: none; }
.tp-active #tournament-judge-links .jl-card > details { order: 4; margin-bottom: 10px; border-top: 1px solid var(--tf-line); }
.tp-active #tournament-judge-links .jl-card > details summary { font-size: 12px; color: var(--tf-ink); }
.tp-active #tournament-judge-links .jl-card > .jl-actions > details { flex: 1; border: 0; margin: 0; }
.tp-active #tournament-judge-links .jl-card > .jl-actions > details[open] { flex-basis: 100%; }
.tp-active #tournament-judge-links .jl-card > .jl-actions > details > summary {
  border: 1px solid var(--tf-line); border-radius: 4px; padding: 9px 12px; min-height: 42px; font-size: 12px; text-align: center; color: var(--tf-ink);
}
.tp-active #tournament-judge-links .tp-criteria-more { order: 4; margin: 4px 0 0; border: 0; }
.tp-active #tournament-judge-links .tp-criteria-more > summary,
.tp-active #tournament-judge-links .tp-global-more > summary { font-size: 12px; font-weight: 400; color: var(--tf-muted); min-height: 36px; padding: 8px 0; }
.tp-active #tournament-judge-links .tp-criteria-more > button { margin: 6px 6px 0 0; }
.tp-active #tournament-judge-links .tp-global-more { border-top: 1px solid var(--tf-line); margin-top: 12px; padding-top: 6px; }
.tp-active #tournament-judge-links form > label,
.tp-active #tournament-judge-links form > .jl-actions { display: none; }
.tp-active #tournament-judge-links:has(.jl-card details.tp-criteria-edit[open]) form > label,
.tp-active #tournament-judge-links:has(.jl-card details.tp-criteria-edit[open]) form > .jl-actions,
.tp-active #tournament-judge-links:has(.jl-dirty:not(:empty)) .jl-dirty { display: block; }
.tp-active #tournament-judge-links:has(.jl-card details.tp-criteria-edit[open]) form > label { display: grid; }
.tp-active #tournament-judge-links:has(.jl-card details.tp-criteria-edit[open]) form > .jl-actions { display: flex; }
.tp-active #tournament-judge-links[data-tp-dirty=true] form > label { display: grid; }
.tp-active #tournament-judge-links[data-tp-dirty=true] form > .jl-actions { display: flex; }
.tp-active #tournament-judge-links > .jl-actions { border-top: 1px solid var(--tf-line); padding-top: 12px; margin-top: 14px; }
.tp-active #tournament-judge-links > p[role=status] { font-size: 11px; line-height: 1.8; }
.tp-active #tournament-judge-links .tp-empty { line-height: 1.8; }
.tp-active #tournament-judge-links.tp-no-criteria > form { display: none !important; }
.tp-active .tp-empty:empty { display: none; }
.tp-active #tournament-judge-links > p.jl-muted { display: none; }
.tp-active #tournament-judge-links .jl-dirty { font-size: 11px; font-weight: 400; color: var(--tf-muted); margin: 0 0 10px; }
.tp-active #tournament-judge-links[data-tp-dirty=false] .jl-dirty { display: none !important; }
.tp-active #tournament-judge-links > .jl-state { font-weight: 400; }
.tp-active #tournament-judge-links[data-tp-idle=true] > .jl-state { display: none; }
.tp-active #tournament-judge-links [data-tp-evidence=true] > [data-jl-profile-info] { display: none; }
.tp-active #tournament-judge-links .tp-profile-evidence { order: 1; margin: 7px 0 14px; }
.tp-profile-evidence dl { display: grid; grid-template-columns: 84px minmax(0,1fr); gap: 10px; margin: 0; font-size: 13px; line-height: 1.8; }
.tp-profile-evidence dt { color: var(--tf-muted); }
.tp-profile-evidence dd { margin: 0; color: var(--tf-ink); overflow-wrap: anywhere; }
#tournament-judge-links .tp-identity-message { padding: 8px 12px; margin: 12px 0 14px; border-radius: 4px; background: var(--tf-panel); color: var(--tp-success); font-weight: 600; }
#tournament-judge-links[data-tp-detail-state=mismatch] .tp-identity-message { background: var(--tp-danger-bg); color: var(--tp-danger); border-left: 3px solid var(--tp-danger); }
.tp-active #personal-time-management-extension .tw-manage-head > div > span,
.tp-active #personal-time-management-extension .tw-manage-field:has([data-tw-manage-match]),
.tp-active #personal-time-management-extension .tw-manage-grid + .tw-manage-note,
.tp-active #personal-time-management-extension.tp-time-locked .tw-manage-field:has([data-tw-manage-end]),
.tp-active #personal-time-management-extension.tp-time-locked .tw-manage-save { display: none !important; }
.tp-active #personal-time-management-extension .tw-manage-grid { grid-template-columns: minmax(0,1fr); }
.tp-active #personal-time-management-extension .tw-manage-head h3 { font: 650 20px/1.5 'Noto Serif SC','Source Han Serif SC',serif; margin: 0; }
.tp-active #personal-time-management-extension .tw-manage-head button { min-height: 34px; padding: 5px 9px; font-size: 11px; }
.tp-active #personal-time-management-extension .tw-manage-note { margin: 7px 0; font-size: 11px; line-height: 1.7; }
.tp-active #personal-time-management-extension .tw-manage-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 7px 0; }
.tp-active #personal-time-management-extension .tw-manage-schedule span { font-size: 13px; color: var(--tf-ink); }
.tp-active #personal-time-management-extension .tw-manage-schedule strong { font-size: 12px; }
.tp-active #personal-time-management-extension .tw-manage-judges { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 7px 0; }
.tp-active #personal-time-management-extension .tw-manage-judges > strong { grid-column: 1/-1; font-size: 12px; }
.tp-active #personal-time-management-extension .tw-manage-judges label { display: flex; gap: 7px; align-items: center; min-height: 42px; padding: 8px 10px; border: 1px solid var(--tf-line); border-radius: 4px; background: transparent; }
.tp-active #personal-time-management-extension .tw-manage-actions { margin: 10px 0 0; }
.tp-active #personal-time-management-extension .tw-manage-actions button { min-height: 42px; font-size: 12px; }
.tp-active #personal-time-management-extension .tw-manage-head { flex-wrap: wrap; gap: 10px; }
.tp-active #personal-time-management-extension .tw-manage-head > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tp-active #personal-time-management-extension .tw-manage-head h3 { font-size: 18px; }
.tp-active #personal-time-management-extension .tw-manage-head .tp-lock { display: inline-block !important; }
.tp-active #personal-time-management-extension .tw-manage-head > [data-tw-manage-check] { min-height: 42px; font-size: 12px; padding: 8px 12px; }
.tp-active #personal-time-management-extension.tp-time-locked > .tw-manage-note,
.tp-active #personal-time-management-extension .tw-manage-judges > strong { display: none; }
.tp-active #personal-time-management-extension .tp-time-more > summary { font-size: 11px; color: var(--tf-muted); cursor: pointer; padding: 6px 0; min-height: 30px; }
.tp-active #personal-time-management-extension .tw-manage-actions:has(.tp-time-more) { margin: 4px 0 0; }
@media(min-width:900px) {
  .tp-active #tournament-judge-links .tp-profile-tabs { display: none; }
  .tp-active #tournament-judge-links.tp-unmatched-profiles .tp-profile-tabs { display: flex; }
  .tp-active #tournament-judge-links .tp-detail-heading { margin-bottom: 18px; }
}
@media(min-width:900px) {
  .tp-active [data-testid^=judge-row-] { grid-template-columns: minmax(95px,.9fr) 80px 67px minmax(190px,1.3fr); align-items: center; gap: 6px; min-height: 60px; }
  .tp-active [data-testid^=judge-row-] > .tp-row-evidence { grid-column: 4; grid-row: 1; grid-template-columns: auto minmax(0,1fr) 66px; gap: 0 4px; }
  .tp-active .tp-row-evidence small { grid-column: 2; }
  .tp-active .tp-account { grid-column: 3; grid-row: 1/3; text-align: right; margin-top: 0; }
  .tp-active [data-testid^=judge-row-] > .field { font-size: 11px; padding: 4px 6px; }
  .tp-active [data-testid^=judge-row-] > div.field { font-size: 14px; }
}
.tp-active #personal-time-management-extension { display: block; padding: 0; margin: 0; border: 0; background: transparent; }
.tp-active .tw-manage-head { margin-bottom: 8px; }
.tp-active .tw-manage-head h3 { font: 650 20px/1.5 'Noto Serif SC','Source Han Serif SC',serif; }
.tp-active .tw-manage-head > div > span,
.tp-active .tw-manage-field:has([data-tw-manage-match]),
.tp-active .tw-manage-grid + .tw-manage-note { display: none; }
.tp-active .tw-manage-head button { font-size: 11px; padding: 5px 9px; min-height: 34px; }
.tp-active .tw-manage-note { font-size: 11px; line-height: 1.7; }
.tp-active .tw-manage-grid { grid-template-columns: minmax(0,1fr); }
.tp-active .tw-manage-schedule { padding: 8px 0; display: flex; gap: 10px; flex-wrap: wrap; background: transparent; }
.tp-active .tw-manage-schedule strong { font-size: 12px; }
.tp-active .tw-manage-schedule span { font-size: 13px; color: var(--tf-ink); }
.tp-active .tp-time-locked .tw-manage-field:has([data-tw-manage-end]),
.tp-active .tp-time-locked .tw-manage-save { display: none; }
.tp-active .tw-manage-judges { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.tp-active .tw-manage-judges > strong { grid-column: 1/-1; font-size: 12px; }
.tp-active .tw-manage-judges label { padding: 8px 10px; border: 1px solid var(--tf-line); border-radius: 4px; background: transparent; flex-wrap: wrap; }
.tp-active .tw-manage-judges label span { font-size: 12px; }
.tp-active .tw-manage-judges label small { font-size: 11px; }
.tp-active .tw-manage-actions button { background: color-mix(in srgb,var(--tf-warm) 15%,var(--tp-paper)); color: var(--tf-warm); border-color: var(--tf-line); min-height: 42px; }
.tp-active :is(button,input,select,summary,a):focus-visible { outline: 3px solid var(--tf-accent); outline-offset: 3px; }
@media(min-width:900px) {
  .tp-active .tp-row-check { min-height: 24px; padding: 2px 0; font-size: 12px; }
  .tp-active .tp-row-evidence small, .tp-active .tp-account { font-size: 11px; line-height: 1.5; }
  .tp-active [data-testid^=judge-row-] { padding: 6px 8px !important; }
}
@media(max-width:1000px) {
  body.tf-management .workspace-shell.tp-active { grid-template-columns: minmax(0,1.58fr) minmax(300px,1fr); column-gap: 14px; }
  .tp-row-evidence { grid-template-columns: auto minmax(0,1fr); }
  .tp-account { grid-column: 1/-1; grid-row: auto; text-align: left; }
}
@media(max-width:760px) {
  body.tf-management .workspace-shell.tp-active { grid-template-columns: minmax(0,1fr); gap: 14px; }
  body.tf-management .tp-active > app-tournament-match-planning { padding: 16px; grid-row: 2 !important; }
  body.tf-management .tp-active > #tournament-judge-links { grid-column: 1 !important; grid-row: 3 !important; padding: 16px !important; }
  body.tf-management .tp-active > .jl-aux { grid-column: 1 !important; grid-row: 4 !important; padding: 16px; }
  body.tf-management .tp-active > .tp-footer { grid-row: 5 !important; padding: 12px; gap: 8px; }
  .tp-footer p { flex-basis: 100%; }
  .tp-footer button { flex: 1; padding: 9px 12px; }
  .tp-footer { align-items: stretch !important; }
  .tp-active [data-testid^=judge-row-] select:not(:disabled),
  .tp-active #tournament-judge-links :is(button,.jl-preview) { min-height: 44px; }
  .tp-active #personal-time-management-extension :is(button,summary),
  .tp-active .tf-judge-pool > summary { min-height: 44px !important; }
  .tp-active [data-testid^=judge-row-] { grid-template-columns: minmax(0,1fr) 85px 74px; padding: 10px !important; gap: 5px; }
  .tp-active .tp-roster-head h2, #tournament-judge-links .tp-detail-heading { font-size: 19px; }
  #tournament-judge-links .tp-profile-tab { min-height: 44px; }
  .tp-row-check { min-height: 44px; }
  .tp-active .tw-manage-judges { grid-template-columns: minmax(0,1fr); }
  .tp-active #personal-time-management-extension .tw-manage-judges { grid-template-columns: minmax(0,1fr); }
  .tp-active .tw-manage-judges label { min-height: 44px; }
  .tp-active .tf-context { padding: 16px !important; }
}
