/* Competition screens extend the shared court palettes. */
h3 { margin:0; font-family:var(--font-heading); font-weight:600; line-height:1.5; }
select, textarea, input { font:inherit; }
select:focus-visible, textarea:focus-visible, summary:focus-visible { outline:2px solid var(--color-primary); outline-offset:3px; }
summary { cursor:pointer; line-height:1.7; }
section[id] { scroll-margin-top:24px; }
.toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.toolbar.spread, .panel-heading { justify-content:space-between; }
.toolbar.spread { margin-bottom:24px; }
.toolbar form { margin:0; }
.back-link, .text-link { font-size:12px; color: var(--color-primary); text-decoration:none; line-height:1.7; }
.back-link { display:inline-block; margin:0 0 20px; }
.toolbar .back-link { margin:0; }
.text-link { font-weight:600; }
.text-link:hover, .back-link:hover, .link-button:hover { text-decoration:underline; }
.panel { min-width:0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding:25px; margin:0 0 24px; }
.panel-heading { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:22px; }
.panel-heading h2 { font-size:23px; letter-spacing:-.7px; }
.panel-heading .eyebrow { margin-bottom:6px; }
.panel-heading.compact { margin-top:24px; margin-bottom:12px; }
.section-note { font-size:12px; line-height:1.8; color: var(--color-muted); margin:0 0 20px; }
.panel > .muted { font-size:12px; }
.notices { margin-bottom:22px; }
.notice { padding:14px 17px; background: var(--color-soft); border: 1px solid var(--color-border); border-radius: 7px; font-size:12px; line-height:1.8; margin-bottom:12px; overflow-wrap:anywhere; }
.notice.success { border-color: #c2d8c7; background: #eff7ed; }
.notice.error { background: #fff0ee; border-color: #f1cbc3; color: #8d3428; }
.notice.warning { background: #fff9e9; border-color: #ecdca6; }
.notice ul { margin-top:5px; }
.warning-text { color: #8c5b10; max-width:220px; }
.tag-live { background: #e0f0d8; color: #164b35; }
.dashboard-heading.tournament-directory-heading {
  flex-direction:column; align-items:center; gap:8px;
  margin:clamp(24px, 5vw, 58px) 0 clamp(20px, 3vw, 32px); text-align:center;
}
.dashboard-heading.tournament-directory-heading h1 { font-size:clamp(26px, 4vw, 42px); }
.tournament-directory-heading > .button { margin-top:6px; }
.tournament-directory-empty { text-align:center; }
.tournament-directory-empty .collection-empty { padding-bottom:18px; }
.tournament-directory-more { display:flex; justify-content:center; margin-top:24px; }
.tournament-directory-more .button { min-height:44px; }
.tournament-directory + .live-filter-feedback { text-align:center; }
.tournament-grid {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:clamp(14px, 2vw, 24px); max-width:1024px; margin-inline:auto;
}
.tournament-grid > :only-child { grid-column:1/-1; justify-self:center; width:min(100%, 600px); }
.tournament-card {
  --collection-radius:12px;
  --collection-inset:clamp(14px, 3vw, 24px);
  container:tournament-card / inline-size;
  display:flex; flex-direction:column; border-radius:var(--collection-radius);
  border:1px solid var(--color-primary);
}
article.tournament-card { align-self:start; }
.collection-heading.tournament-card-heading {
  position:relative; isolation:isolate; overflow:hidden;
  display:grid; justify-content:stretch; justify-items:start; gap:12px; flex:1;
  padding:var(--collection-inset); border-radius:calc(var(--collection-radius) - 1px) calc(var(--collection-radius) - 1px) 0 0;
  color:var(--color-on-primary); background:var(--color-primary-surface);
}
article.tournament-card .tournament-card-heading {
  border:0; border-radius:inherit; color:var(--color-text); background:var(--color-soft);
}
.tournament-card-heading h2 {
  color:inherit; font-size:clamp(23px, 3vw, 34px); line-height:1.15; overflow-wrap:anywhere;
}
.tournament-card-heading p { font-size:13px; line-height:1.5; }
.tournament-card-court {
  position:absolute; z-index:-1; inset-inline-end:-42px; top:-52px;
  opacity:.12; pointer-events:none; transform:rotate(-17deg);
}
.tournament-card-heading .tournament-card-court .icon {
  display:block; width:240px; height:240px; stroke-width:.55;
}
.tournament-card-stats {
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px;
  margin:0; padding:16px var(--collection-inset); text-align:center;
}
.tournament-card-stats > div {
  display:flex; flex-direction:column-reverse; justify-content:start; gap:5px; min-width:0;
  padding:7px 2px; border:1px solid var(--color-border-accent); border-radius:var(--radius-button);
}
.tournament-card-stats dt {
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:3px 5px;
  color:var(--color-muted); font-size:12px; overflow-wrap:anywhere;
}
.tournament-card-stats .icon { width:14px; height:14px; color:var(--color-primary); }
.tournament-card-stats dd { margin:0; color:var(--color-text); font:700 23px/1.1 var(--font-heading); }
.collection-footer.tournament-card-footer {
  flex-wrap:nowrap; padding:10px var(--collection-inset);
  border-radius:0 0 calc(var(--collection-radius) - 1px) calc(var(--collection-radius) - 1px);
  color:var(--color-primary);
  font-size:14px; font-weight:700;
}
.tournament-card-footer .icon {
  width:32px; height:32px; padding:7px; border-radius:50%; background:var(--color-soft);
}
.tournament-card:hover .tournament-card-footer { background:var(--collection-hover); }
.tournament-card:hover .tournament-card-footer span { text-decoration:underline; }
@container tournament-card (width < 420px) {
  .tournament-card-stats dt { flex-direction:column; font-size:11px; }
}
@media (max-width:800px) {
  .tournament-grid { grid-template-columns:minmax(0,1fr); max-width:600px; }
}
.empty-inline { grid-column:1/-1; padding:22px 0; }
.empty-inline h3 { font-size:16px; }
.empty-inline p { font-size:12px; margin-top:8px; color: var(--color-muted); }
.form-panel { max-width:880px; }
.editor-form { display:grid; gap:24px; }
.field-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.editor-field { min-width:0; display:flex; flex-direction:column; gap:8px; }
.editor-form label, .inline-form label { font-size:12px; font-weight:500; line-height:1.6; }
.editor-form input:not([type=checkbox]):not([type=hidden]), .editor-form select, .editor-form textarea, .inline-form input, .inline-form select { width:100%; min-width:0; min-height:44px; border: 1px solid var(--color-border); background: var(--color-surface); border-radius: 6px; color: var(--color-text); padding:10px 12px; }
.editor-form > label { display:grid; gap:8px; }
.editor-form .button { justify-self:start; }
.required-mark { color: var(--color-primary); }
.check-label { display:flex; align-items:center; gap:8px; min-height:44px; }
.check-label input { width:18px; height:18px; accent-color:var(--color-primary); }
.field-help, .field-errors { font-size:11px; line-height:1.7; color: var(--color-muted); margin:0; font-weight:400; }
.field-errors { color: #a13825; }
.field-errors ul, .notice ul.errorlist { padding-left:16px; margin:0; }
.inline-form { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-top:16px; }
.inline-form label { display:grid; gap:7px; flex:1; min-width:160px; }
.search-form { margin:0; }
.search-form input { width:260px; }
.table-wrap { min-width:0; width:100%; overflow-x:auto; }
.sport-table { width:100%; border-collapse:collapse; text-align:left; font-size:12px; line-height:1.7; }
.sport-table th { color: var(--color-muted); font-weight:500; font-size:10px; letter-spacing:.4px; white-space:nowrap; padding:12px 10px; border-bottom: 1px solid var(--color-border); background: var(--color-bg); }
.sport-table td { vertical-align:top; padding:16px 10px; border-bottom: 1px solid var(--color-border); }
.sport-table tbody tr:last-child td { border-bottom: 0; }
.sport-table small { display:block; font-size:10px; color: var(--color-muted); line-height:1.6; margin-top:3px; }
.sport-table strong { font-weight:600; }
.sport-table .empty-cell { padding:35px 12px; text-align:center; color: var(--color-muted); }
.person { display:flex; align-items:center; gap:12px; min-width:180px; }
.person-avatar, .player-photo { width:38px; height:38px; flex-shrink:0; border-radius: 50%; object-fit:cover; }
.person-avatar { display:grid; place-items:center; color: var(--color-primary); background: var(--color-soft); font-family:var(--font-heading); font-size:18px; }
.rating { display:inline-block; padding:4px 9px; border: 1px solid var(--color-border); border-radius: 4px; font-weight:600; white-space:nowrap; }
.link-button { background: none; padding:0; border: none; font-size:11px; color: var(--color-primary); line-height:1.8; }
.workflow { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:28px; }
.workflow a { display:flex; gap:10px; padding:15px 10px; font-size:11px; line-height:1.6; text-decoration:none; border-bottom: 2px solid var(--color-border); color: var(--color-muted); }
.workflow b { color: var(--color-primary); font-weight:500; }
.workflow a:hover { border-color: var(--color-primary); }
.category-grid, .phase-grid, .group-grid, .pair-grid, .court-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.category-card { display:flex; align-items:center; gap:15px; padding:20px 15px; border: 1px solid var(--color-border); border-radius: 8px; text-decoration:none; }
.category-card:hover { background: var(--color-bg); }
.category-tile { min-width:0;    border: 1px solid var(--color-border);
 border-radius: 8px;
}
.category-tile .category-card { border: 0; }
.category-tile .category-actions { border-top: 1px solid var(--color-border); padding:12px 15px; }
.category-actions { gap:12px; }
.category-remove-action { padding:16px 24px; border-top: 1px solid var(--color-border); }
.category-letter { display:grid; place-items:center; width:40px; height:44px; flex-shrink:0; background: var(--color-primary-surface); color: var(--color-on-primary-accent); font-family:var(--font-heading); font-size:24px; border-radius: 5px; }
.category-letter-age { width:auto; min-width:44px; max-width:110px; padding:0 8px; font-size:16px; text-align:center; }
.category-card h3 { font-size:14px; }
.category-card p, .category-card small { display:block; color: var(--color-muted); font-size:11px; margin-top:5px; line-height:1.6; }
.category-card > span:last-child { margin-left:auto; color: var(--color-primary); }
.court-card {  padding:16px;  font-size:12px;  border: 1px solid var(--color-border);
 border-radius: 8px;
}
.court-card summary .muted { font-size:10px; margin-left:12px; }
.court-symbol { color: var(--color-primary); font-size:19px; }
.window-list { list-style:none; padding:0; margin:10px 0 0; }
.window-list li, .restriction { display:flex; gap:10px; flex-wrap:wrap; justify-content:space-between; align-items:center; padding:12px 0; border-top: 1px solid var(--color-border); line-height:1.8; font-size:11px; }
.window-list small { display:block; color: var(--color-muted); }
.blocked-window { color: #965938; }
.restriction { padding:13px 0; }
.status-tag { display:inline-block; padding:4px 8px; border-radius: 4px; font-size:10px; white-space:nowrap; background: var(--color-bg); color: var(--color-muted); }
.status-live { background: #d7f75b; color: #164b35; }
.status-finished { background: #e5f0e4; color: #164b35; }
.status-suspended { background: #fff0d7; color: #8a571d; }
.match-id { color: var(--color-primary); font-size:10px; }
.responsive-matches .matchup-side { font-weight: 650; }
.history summary { font-size:12px; }
.history-event { border-top: 1px solid var(--color-border); margin-top:15px; padding-top:15px; }
.history pre { max-height:360px; overflow:auto; font-size:11px; line-height:1.7; background: var(--color-bg); padding:18px; }
.phase-card, .group-card, .pair-card {  padding:18px;  min-width:0;  border: 1px solid var(--color-border);
 border-radius: 8px;
}
.phase-card h3, .group-card h3 { font-size:16px; margin-bottom:10px; }
.phase-card p { font-size:12px; line-height:1.8; }
.phase-card small, .phase-card a { display:block; font-size:11px; margin-top:10px; }
.phase-card small { color: var(--color-muted); }
.pair-card { display:flex; flex-wrap:wrap; align-items:center; gap:10px; justify-content:space-between; font-size:12px; }
.pair-editor, .tie-details { margin-top:20px; font-size:12px; }
.pair-editor .field-help, .tie-details .field-help { margin:12px 0; }
.tie-details .editor-form { margin-top:12px; gap:14px; }
.tie-details .field-grid { gap:10px; }
.compact-table th, .compact-table td { padding:10px 5px; font-size:10px; }
.group-grid { margin-bottom:24px; }
.qualifier-box { border-left: 3px solid var(--color-primary); padding:16px 20px; margin-bottom:24px; background: var(--color-bg); font-size:12px; line-height:1.8; }
.qualifier-box form { margin-top:14px; }
.status-actions { margin:20px 0 28px; }
.match-edit-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.match-edit-grid .field-grid { grid-template-columns:1fr; }
.winner { color: var(--color-primary); }
.winner::after { content:' ✓'; }
[hidden] { display:none !important; }
@media(max-width:850px) {
  .category-grid,.group-grid,.match-edit-grid { grid-template-columns:1fr; }
  .workflow { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:600px) {
  .panel { padding:18px 14px; margin-bottom:18px; }
  .panel-heading { align-items:flex-start; margin-bottom:18px; }
  .panel-heading h2 { font-size:21px; }
  .field-grid,.phase-grid,.pair-grid,.court-grid { grid-template-columns:1fr; }
  .field-grid { gap:20px; }
  .editor-form input,.editor-form select,.inline-form select,.inline-form input { font-size:16px; }
  .search-form { width:100%; flex-wrap:nowrap; }
  .search-form input { width:100%; }
  .table-wrap { border-radius: 5px; }
  .sport-table { min-width:600px; }
  .compact-table { min-width:400px; }
  .section-nav { overflow-x:auto; }
  .section-nav a { white-space:nowrap; }
}
@media print {
  body { background: #fff; }
  .skip-link,.page-footer,.dt-container .dt-layout-row:not(:has(table)) { display:none!important; }
  .panel { border-color: #aaa; padding:12px; break-inside:auto; }
  .sport-table { min-width:0; font-size:9px; }
  .sport-table tr { break-inside:avoid; }
  .table-wrap { overflow:visible; }
  .group-grid { grid-template-columns:1fr 1fr; }
}

@media screen {
  :root[data-court-theme^='dark-'] .notice.success,
  :root[data-court-theme^='dark-'] :is(.tag-live, .status-live, .status-finished) { color: var(--color-success-text); background: var(--color-success-bg); border-color: var(--color-success-border); }
  :root[data-court-theme^='dark-'] .notice.warning,
  :root[data-court-theme^='dark-'] .status-suspended { color: var(--color-warning-text); background: var(--color-warning-bg); border-color: var(--color-warning-border); }
  :root[data-court-theme^='dark-'] .notice.error { color: var(--color-danger-text); background: var(--color-danger-bg); border-color: var(--color-danger-border); }
  :root[data-court-theme^='dark-'] :is(.warning-text, .blocked-window) { color: var(--color-warning-text); }
  :root[data-court-theme^='dark-'] .field-errors { color: var(--color-danger-text); }
}
