/* 方案2：扁平流程带，兼容现有纸本晨光 / 水墨夜色。 */
body.tf-management {
  --tf-bg: #0b1320;
  --tf-panel: #17212e;
  --tf-ink: #eaeef4;
  --tf-muted: #abb6c6;
  --tf-line: #324152;
  --tf-accent: #f17d75;
  --tf-active: #3c262e;
  --tf-warm: #e3bb79;
}
html.light-mode body.tf-management {
  --tf-bg: #f6f5f0;
  --tf-panel: #fff;
  --tf-ink: #282c29;
  --tf-muted: #666f66;
  --tf-line: #dedfd7;
  --tf-accent: #aa382d;
  --tf-active: #f8ece5;
  --tf-warm: #916919;
}
body.tf-management .management-shell {
  background: var(--tf-bg) !important;
  color: var(--tf-ink);
}
body.tf-management .management-header {
  padding: 0 !important;
  gap: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}
body.tf-management .management-header > div {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  align-items: center !important;
}
body.tf-management .management-header .page-kicker,
body.tf-management .management-header .status-line {
  display: none;
}
body.tf-management .header-actions button:not(.secondary-button),
body.tf-management .header-actions .more-menu {
  display: none;
}
body.tf-management:has([data-tf-phase='finish']) .header-actions button,
body.tf-management:has([data-tf-phase='finish']) .header-actions .more-menu {
  display: inline-flex;
}
body.tf-management .management-header h1 {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: clamp(22px, 2.2vw, 32px) !important;
  line-height: 1.4;
}
body.tf-management .page-kicker {
  font-size: 11px !important;
  letter-spacing: 0.08em;
}
body.tf-management main {
  padding-top: 0 !important;
}
body.tf-management .workspace-card {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.tf-management .workspace-shell {
  display: grid !important;
  grid-template-columns: minmax(230px, 25%) minmax(0, 1fr);
  column-gap: 36px;
  row-gap: 0;
  align-items: start;
  color: var(--tf-ink);
}
body.tf-management .workspace-shell > * {
  min-width: 0;
  margin-top: 0 !important;
}
body.tf-management .workspace-shell > .workspace-heading,
body.tf-management .workspace-shell > .workspace-nav {
  display: none !important;
}
body.tf-management .tf-workflow {
  grid-column: 1/-1;
  grid-row: 1;
  margin-bottom: 10px !important;
}
.tf-workflow *,
.tf-checklist *,
.tf-share * {
  box-sizing: border-box;
  min-width: 0;
}
.tf-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  color: var(--tf-muted);
  font-size: 12px;
}
.tf-caption > span:first-child {
  font-weight: 700;
  color: var(--tf-ink);
}
.tf-phase-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--tf-line);
  background: transparent;
}
.tf-phase-nav button {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 8px;
  color: var(--tf-muted);
  cursor: pointer;
}
.tf-phase-nav button span {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.tf-phase-nav button strong {
  font-weight: 600;
  font-size: 17px;
}
.tf-phase-nav button[aria-current='step'] {
  color: var(--tf-accent);
  background: var(--tf-active);
  border-bottom-color: var(--tf-accent);
}
.tf-phase-nav button:hover {
  color: var(--tf-ink);
  background: color-mix(in srgb, var(--tf-line) 30%, transparent);
}
.tf-context {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  background: var(--tf-panel);
  border-bottom: 1px solid var(--tf-line);
}
.tf-context strong {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--tf-muted);
}
.tf-context h1 {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 20px;
  font-weight: 550;
  color: var(--tf-warm);
  margin: 0 0 10px;
  line-height: 1.5;
}
.tf-context h2 {
  font-size: clamp(17px, 1.65vw, 23px);
  font-weight: 650;
  margin: 5px 0 8px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tf-context span {
  font-size: 12px;
  color: var(--tf-muted);
}
.tf-context .tf-match-state {
  display: inline-block;
  margin-left: 12px;
  color: var(--tf-warm);
  font-weight: 600;
}
.tf-match-picker {
  position: relative;
  flex: 0 0 120px;
}
.tf-match-picker summary {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--tf-line);
  border-radius: 6px;
  padding: 8px;
  color: var(--tf-ink);
  font-size: 13px;
}
.tf-match-picker label {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 20;
  width: min(510px, calc(100vw - 48px));
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--tf-panel);
  border: 1px solid var(--tf-line);
  box-shadow: 0 8px 22px #0002;
  border-radius: 6px;
  color: var(--tf-ink);
  font-size: 13px;
}
.tf-match-picker select {
  width: 100%;
  padding: 10px;
  min-height: 44px;
  background: var(--tf-bg);
  border: 1px solid var(--tf-line);
  color: var(--tf-ink);
  border-radius: 4px;
}
.tf-status {
  margin: 8px 0 0;
  min-height: 0;
  font-size: 13px;
  color: var(--tf-accent);
  overflow-wrap: anywhere;
}
.tf-status:empty {
  display: none;
}
.tf-checklist {
  grid-column: 1;
  grid-row: 2/6;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 16px 0;
  border-right: 1px solid var(--tf-line);
}
.tf-checklist button {
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 14px 12px 14px 40px;
  position: relative;
  min-height: 64px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--tf-muted);
  cursor: pointer;
  border-radius: 0 4px 4px 0;
}
.tf-checklist button strong {
  font-size: 16px;
  font-weight: 550;
  line-height: 1.5;
  color: var(--tf-ink);
}
.tf-checklist button span {
  font-size: 12px;
  line-height: 1.6;
}
.tf-checklist {counter-reset: tf-task;}
.tf-checklist button::before {counter-increment: tf-task;content: counter(tf-task);position: absolute;left: 12px;top: 18px;width: 18px;height: 18px;border: 1px solid var(--tf-muted);border-radius: 50%;font: 12px/18px sans-serif;text-align: center;}
.tf-checklist button[aria-current='true']::before {background: var(--tf-accent);border-color: var(--tf-accent);color: var(--tf-bg);}
.tf-checklist button[aria-current='true'] strong {color: var(--tf-accent);}
.tf-checklist button[aria-current='true'] {
  border-color: var(--tf-accent);
  color: var(--tf-accent);
  background: var(--tf-active);
}
.tf-checklist button:hover {
  background: color-mix(in srgb, var(--tf-line) 30%, transparent);
  color: var(--tf-ink);
}
.tf-task-title {
  grid-column: 2;
  grid-row: 2;
  margin-bottom: 18px !important;
}
.tf-task-title p {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--tf-muted);
  margin: 0 0 6px;
}
.tf-task-title h2 {
  font-size: 23px;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-weight: 650;
  line-height: 1.5;
  margin: 0;
}
body.tf-management
  .workspace-shell
  > :not(.tf-workflow):not(.tf-checklist):not(.workspace-heading):not(.workspace-nav) {
  grid-column: 2;
}
body.tf-management .workspace-shell > app-tournament-match-planning,
body.tf-management .workspace-shell > section:not(.tf-workflow),
body.tf-management .workspace-shell > #tournament-judge-links {
  grid-row: 3;
}
body.tf-management .workspace-shell > .tf-share {
  grid-row: 3 !important;
}
.tf-share {
  padding: 0 0 24px;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.tf-share h3 {
  font-size: clamp(26px, 2.4vw, 34px);
  line-height: 1.45;
  font-weight: 650;
  margin: 0 0 18px;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
}
.tf-eyebrow {
  font-size: 17px;
  font-weight: 600;
  color: var(--tf-ink);
  letter-spacing: 0.035em;
  margin: 0 0 14px;
}
.tf-share .tf-eyebrow {
  order: 1;
}
.tf-muted {
  font-size: 15px;
  color: var(--tf-muted);
  line-height: 1.8;
  margin: 8px 0;
}
.tf-judges {
  display: flex;
  align-items: center;
  padding: 18px;
  margin: 14px 0 24px;
  background: var(--tf-panel);
  border: 0;
  border-radius: 5px;
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.tf-share label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--tf-muted);
}
.tf-share input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--tf-line);
  padding: 10px 14px;
  border-radius: 5px;
  background: var(--tf-bg);
  color: var(--tf-ink);
  font-size: 13px;
  text-overflow: ellipsis;
}
.tf-share-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.tf-primary,
.tf-secondary {
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 5px;
  border: 1px solid var(--tf-line);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tf-primary {
  background: var(--tf-accent);
  color: #fff;
  border-color: var(--tf-accent);
}
html:not(.light-mode) .tf-primary {
  background: #b84e40;
  border-color: #b84e40;
}
.tf-secondary {
  background: transparent;
  color: var(--tf-ink);
}
.tf-primary:disabled,
.tf-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tf-text-button {
  background: transparent;
  color: var(--tf-accent);
  font-size: 13px;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 8px 0;
  min-height: 40px;
}
.tf-empty {
  font-size: 21px;
  color: var(--tf-ink);
  text-align: center;
  line-height: 1.7;
  padding: 32px 12px 12px;
  border-top: 1px solid var(--tf-line);
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-weight: 600;
}
.tf-policy {
  font-size: 12px;
  color: var(--tf-muted);
  line-height: 1.9;
  border-top: 1px solid var(--tf-line);
  padding-top: 18px;
  margin-top: 14px;
}
body.tf-management :is(.tf-workflow, .tf-checklist, .tf-share) :is(button, input, select, summary, a):focus-visible {
  outline: 3px solid var(--tf-accent);
  outline-offset: 4px;
}
body.tf-management .registration-panel {
  display: none !important;
}
body.tf-management:has([data-tf-phase='roster']) .registration-panel {
  display: block !important;
  margin-bottom: 20px;
}
body.tf-management .tf-share {
  display: none;
}
body.tf-management .tf-published-records {
  display: none;
  grid-column: 2;
  grid-row: 3;
  padding: 24px;
  background: var(--tf-panel);
  border: 1px solid var(--tf-line);
  border-radius: 6px;
}
body.tf-management
  [data-tf-published='true']:is([data-tf-task='lineup'], [data-tf-task='ballots'])
  > .tf-published-records {
  display: block;
}
body.tf-management
  [data-tf-published='true']:is([data-tf-task='lineup'], [data-tf-task='ballots'])
  > section:not(.tf-workflow):not(.tf-published-records):not(.tf-share) {
  display: none !important;
}
.tf-published-records h3 {
  font-size: 22px;
  margin: 0 0 20px;
}
.tf-record-row {
  font-size: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--tf-line);
  line-height: 1.8;
}
.tf-published-records summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  font-size: 14px;
}
body.tf-management [data-tf-task='share'] > .tf-share {
  display: block;
}
body.tf-management [data-tf-task='share'] > .tf-task-title {
  display: none;
}
body.tf-management .workspace-shell > .jl-aux,
body.tf-management .workspace-shell > #tournament-judge-links {
  display: none !important;
}
body.tf-management [data-tf-task='criteria'][data-tf-criteria-match='true'] > #tournament-judge-links {
  display: block !important;
}
body.tf-management [data-tf-task='availability'] > .jl-aux {
  display: block !important;
  grid-row: 3;
}
body.tf-management .workspace-shell > app-tournament-match-planning {
  display: none !important;
}
body.tf-management :is([data-tf-task='judges'], [data-tf-task='attendance']) > app-tournament-match-planning {
  display: block !important;
}
body.tf-management
  :is([data-tf-task='share'], [data-tf-task='verify'], [data-tf-task='criteria'], [data-tf-task='availability'])
  > app-tournament-match-planning {
  display: none !important;
}
body.tf-management [data-tf-phase='schedule'] app-tournament-match-planning[mode='pairings'] {
  display: block;
}
body.tf-management [data-tf-phase='schedule'] .tf-result-part {
  display: none !important;
}
body.tf-management [data-tf-phase='after'] app-tournament-match-planning[mode='pairings'] {
  display: none !important;
}
body.tf-management
  :is([data-tf-task='workbook'], [data-tf-task='operations'])
  app-tournament-match-planning[mode='pairings'] {
  display: none !important;
}
body.tf-management :is([data-tf-task='workbook'], [data-tf-task='operations']) .tf-result-part {
  display: none !important;
}
body.tf-management :is([data-tf-task='lineup'], [data-tf-task='ballots']) .tf-result-part {
  display: block;
}
body.tf-management .workspace-shell > [data-testid='judge-evaluation-summary'] {
  display: none !important;
}
body.tf-management [data-tf-task='verify'] > [data-testid='judge-evaluation-summary'],
body.tf-management [data-tf-task='audit'] > [data-testid='judge-evaluation-summary'] {
  display: block !important;
  grid-row: auto;
  position: static !important;
  width: 100% !important;
  margin: 0 !important;
}
body.tf-management .workspace-shell > [data-testid='judge-evaluation-summary'] > .je-card {
  max-height: none !important;
  overflow: visible !important;
  border-radius: 6px !important;
  background: var(--tf-panel) !important;
  border-color: var(--tf-line) !important;
  padding: 24px !important;
}
body.tf-management [data-tf-task='verify'] .je-summary-section {
  display: none;
}
body.tf-management [data-tf-task='audit'] .je-summary-body {
  display: none;
}
body.tf-management .je-summary-match[hidden] {
  display: none !important;
}
body.tf-management #yuncheng-schedule-editor,
body.tf-management #yuncheng-workbook-editor {
  display: none !important;
  max-width: none;
  min-width: 0;
  grid-column: 2;
}
body.tf-management:has([data-tf-task='operations']) #yuncheng-schedule-editor {
  display: block !important;
}
body.tf-management:has([data-tf-task='workbook']) #yuncheng-workbook-editor {
  display: block !important;
}
body.tf-management .je-manager {
  z-index: 2147483000 !important;
  inset: 0 !important;
  position: fixed !important;
  padding: 24px !important;
  background: #000a !important;
  overflow-y: auto !important;
}
body.tf-management .je-manager-panel {
  background: var(--tf-panel) !important;
  color: var(--tf-ink) !important;
  margin: auto !important;
  max-width: 900px !important;
}
.tf-judge-pool {
  border-bottom: 1px solid var(--tf-line);
  margin-bottom: 20px;
  padding-bottom: 12px;
}
.tf-judge-pool > summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--tf-accent);
}
body.tf-management
  :is(.data-card, .rules-panel, .summary-item, .stat-card, .planning-card, #tournament-judge-links, .yc-op-panel) {
  border-radius: 6px !important;
  box-shadow: none !important;
}
body.tf-management #tournament-judge-links {
  margin: 0 !important;
  background: var(--tf-panel) !important;
  padding: 24px !important;
}
body.tf-management .primary-button {
  background: var(--tf-accent) !important;
  color: #fff !important;
  border-radius: 5px !important;
}
@media (max-width: 1000px) {
  body.tf-management .workspace-shell {
    grid-template-columns: 200px minmax(0, 1fr);
    column-gap: 20px;
  }
  .tf-phase-nav button {
    gap: 4px;
  }
  .tf-phase-nav button strong {
    font-size: 13px;
  }
  .tf-share {
    padding: 22px;
  }
  .tf-share h3 {
    font-size: 23px;
  }
}
@media (max-width: 700px) {
  body.tf-management .management-header {
    padding: 18px 16px !important;
  }
  body.tf-management main {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  body.tf-management .workspace-shell {
    display: flex !important;
    flex-direction: column;
    gap: 0;
  }
  body.tf-management .workspace-shell > * {
    width: 100%;
  }
  .tf-caption {
    font-size: 11px;
    align-items: start;
  }
  .tf-caption > span:last-child {
    max-width: 190px;
    text-align: right;
  }
  .tf-phase-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tf-phase-nav button {
    min-height: 48px;
    padding: 8px 4px;
    gap: 5px;
  }
  .tf-phase-nav button strong {
    font-size: 13px;
  }
  .tf-context {
    display: block;
    padding: 18px 16px;
  }
  .tf-context h2 {
    font-size: 18px;
  }
  .tf-match-picker {
    margin-top: 14px;
  }
  .tf-match-picker summary {
    justify-content: flex-start;
    padding: 10px;
  }
  .tf-match-picker label {
    position: static;
    width: 100%;
    box-shadow: none;
    margin-top: 10px;
    padding: 12px 0;
    border: 0;
  }
  .tf-match-picker select {
    font-size: 12px;
  }
  .tf-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 0 20px;
    border-right: 0;
  }
  .tf-checklist button {
    padding: 12px 10px;
    min-height: 68px;
  }
  .tf-checklist button strong {
    font-size: 13px;
  }
  .tf-checklist button span {
    font-size: 11px;
  }
  .tf-task-title {
    margin-bottom: 14px !important;
  }
  .tf-task-title h2 {
    font-size: 21px;
  }
  .tf-share {
    padding: 0 0 22px;
  }
  .tf-share h3 {
    font-size: 24px;
  }
  .tf-share-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tf-share label {
    font-size: 11px;
  }
  .tf-judges {
    font-size: 13px;
  }
  .tf-empty {
    font-size: 15px;
    padding-top: 22px;
  }
  body.tf-management #tournament-judge-links {
    padding: 16px !important;
  }
  body.tf-management .je-manager {
    padding: 12px !important;
  }
  .tf-context .tf-match-state {
    margin-left: 0;
    display: block;
    margin-top: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.tf-management * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.tf-link-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:end}
.tf-link-row .tf-share-actions{margin:0;flex-wrap:nowrap}
.tf-empty-icon{display:block;width:44px;height:44px;margin:36px auto 12px;padding:7px;background:var(--tf-panel);border-radius:50%}
.tf-empty-icon+.tf-empty{border-top:0;padding-top:0}
@media(max-width:1000px){.tf-link-row{grid-template-columns:1fr}.tf-link-row .tf-share-actions{margin-top:0}}
.tf-context-empty{display:none;color:var(--tf-muted);line-height:1.8;font-size:14px;padding:24px;background:var(--tf-panel);grid-row:3}
body.tf-management [data-tf-criteria-match=false]:is([data-tf-task=criteria],[data-tf-task=availability])>.tf-context-empty{display:block}
body.tf-management [data-tf-criteria-match=false][data-tf-task=availability]>.jl-aux{display:none!important}
body.tf-management .management-header{display:none}
body.tf-management:has([data-tf-phase=finish]) .management-header{display:block}
.tf-caption{display:none}
.tf-phase-nav button[aria-current=step]{background:transparent}
.tf-context{padding:8px 22px;background:var(--tf-panel)}
html.light-mode .tf-context{background:#f1ede5}
.tf-context h1{font-size:18px;margin-bottom:8px}
.tf-context h2{display:inline;font-size:17px;margin:0;line-height:1.65}
.tf-context strong{font-size:16px;margin-right:18px;color:var(--tf-ink)}
.tf-match-meta{margin-top:8px;line-height:1.5}
.tf-context-tools{flex:0 0 160px}
.tf-context-actions{display:flex;gap:10px;align-items:center;justify-content:flex-end;margin-top:4px}
.tf-context-actions :is(button,a){font-size:11px;min-height:32px!important;padding:4px!important;color:var(--tf-muted);background:transparent;border:0;white-space:nowrap}
.tf-eligibility{display:flex;gap:16px;flex-wrap:wrap;align-items:center}
.tf-eligibility .tf-muted{margin:0}
.tf-link-row{padding-bottom:24px;border-bottom:1px solid var(--tf-line)}
@media(max-width:700px){.tf-context strong{display:block;margin:0 0 6px}.tf-context h2{font-size:18px}.tf-context-tools{margin-top:12px}.tf-context-actions{justify-content:flex-start}.tf-context-actions :is(button,a){min-height:40px!important;font-size:12px}.tf-eligibility{gap:4px}.tf-context h1{font-size:16px}.tf-checklist button{padding-left:32px}.tf-checklist button::before{left:6px;top:14px}}
.tf-share h3{margin-bottom:6px}.tf-eyebrow{margin-bottom:8px}.tf-eligibility .tf-text-button{min-height:32px}
.tf-judges{padding:12px 18px;margin:10px 0 16px;line-height:1.5}
.tf-share input{min-height:42px;padding:8px 12px}.tf-link-row{padding-bottom:14px}
.tf-empty-icon{margin-top:12px;margin-bottom:8px}.tf-empty-icon+.tf-empty{padding-bottom:4px;line-height:1.5;margin:0}
.tf-share>.tf-muted{font-size:12px;line-height:1.6;text-align:center;margin:4px 0}
.tf-policy{border:0;padding-top:8px;margin-top:8px;text-align:center;line-height:1.7}
@media(max-width:700px){.tf-eligibility .tf-text-button,.tf-context-actions :is(button,a){min-height:44px!important}}
