/* Shared visual primitives, loaded after the module styles. */
:root {
  --fdp-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fdp-ink: #17354d;
  --fdp-muted: #526a7d;
  --fdp-primary: #096b9f;
  --fdp-primary-hover: #075581;
  --fdp-line: #cfdee8;
  --fdp-field-line: #a9c0d0;
  --fdp-surface: #fff;
  --fdp-soft: #edf5f9;
  --fdp-danger: #a82737;
  --fdp-radius-control: 8px;
  --fdp-radius-card: 12px;
  --fdp-shadow: 0 3px 14px #17354d08;
  --fdp-space-1: 8px;
  --fdp-space-2: 12px;
  --fdp-space-3: 16px;
  --fdp-space-4: 24px;
  --fdp-space-5: 32px;
  --fdp-text-title: clamp(26px, 2.5vw, 36px);
  --fdp-text-section: clamp(20px, 1.8vw, 24px);
  --fdp-text-subsection: 18px;
  --fdp-text-body: 15px;
  --fdp-text-label: 14px;
  --fdp-text-help: 13px;
}
:root body { font-family: var(--fdp-font); font-size: 15px; line-height: 1.5; color: var(--fdp-ink); }
:root body :is(.import-center, .sport-tools, .fdp-install-dialog) { font-family: var(--fdp-font); }
:root body :is(main, .message-card, .import-center) h1 {
  font-family: var(--fdp-font); font-size: var(--fdp-text-title);
  font-weight: 750; line-height: 1.2; letter-spacing: -.025em; text-transform: none;
  margin: 4px 0 12px;
}
:root body :is(main, .message-card, .import-center, .fdp-install-dialog) h2 {
  font: 700 var(--fdp-text-section)/1.3 var(--fdp-font); letter-spacing: -.015em; text-transform: none;
}
:root body :is(main, .message-card, .import-center, .fdp-install-dialog) h3 {
  font: 650 var(--fdp-text-subsection)/1.4 var(--fdp-font); letter-spacing: normal; text-transform: none;
}
:root body :is(main, .message-card, .import-center) :is(h4, h5, h6) {
  font: 650 16px/1.4 var(--fdp-font); letter-spacing: normal; text-transform: none;
}
:root body :is(h1, h2, h3, h4, h5, h6) { overflow-wrap: anywhere; }
:root body :is(main, .message-card, .import-center) p { font-size: var(--fdp-text-body); line-height: 1.6; }
:root body :is(main, .import-center) :is(label, .helptext, .field-error) { font-family: var(--fdp-font); }
:root body :is(main, .import-center) label { font-size: var(--fdp-text-label); line-height: 1.5; font-weight: 600; text-transform: none; letter-spacing: normal; }
:root body :is(main, .import-center) :is(small, .helptext, .field-error) { font-size: var(--fdp-text-help); line-height: 1.5; }
:root body :is(.auth-card, .message-card) h2 { font-size: var(--fdp-text-title); line-height: 1.2; }
:root body :is(.panel-header, .platform-header, .import-header, .public-detail) > p { max-width: 75ch; }
:root body :is(.panel-header, .platform-header, .auth-card) > div > p:last-child { font-size: var(--fdp-text-body); line-height: 1.6; }
:root body :is(.overline, .import-eyebrow) { font: 700 12px/1.5 var(--fdp-font); letter-spacing: .09em; }
:root body :is(main, .import-center) p:is(.overline, .eyebrow, .import-eyebrow),
:root body .public-section-title > p { font: 700 12px/1.5 var(--fdp-font); letter-spacing: .09em; }
:root body :is(.summary-grid, .tournament-quick, .stat-grid) article > span {
  font: 500 var(--fdp-text-help)/1.5 var(--fdp-font); letter-spacing: normal; text-transform: none;
}
:root body .summary-grid article > strong {
  font: 650 var(--fdp-text-subsection)/1.4 var(--fdp-font); overflow-wrap: anywhere;
}
:root body :is(.form-row, .import-field, .create-user, .sport-card, .auth-form) label {
  font: 600 14px/1.5 var(--fdp-font); color: var(--fdp-ink);
  text-transform: none; letter-spacing: normal;
}
:root body :is(.form-row, .import-field, .sport-card) :is(small, .helptext) {
  font: 400 13px/1.5 var(--fdp-font); color: var(--fdp-muted);
}

/* Preserve specialized controls (scores, checkboxes, file pickers) explicitly. */
:root body :is(input, select, textarea) { box-sizing: border-box; max-width: 100%; min-width: 0; font-family: var(--fdp-font); }
:root body :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=range]):not([type=submit]):not([type=button]), select, textarea) {
  min-height: 44px; padding: 10px 12px; border: 1px solid var(--fdp-field-line);
  border-radius: var(--fdp-radius-control); background: var(--fdp-surface);
  color: var(--fdp-ink); font-size: 16px; line-height: 1.4;
}
:root body textarea { min-height: 112px; resize: vertical; }
:root body :is(.form-row, .import-field, .create-user, .sport-card form, .auth-form) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { width: 100%; }
:root body :is(input[type=checkbox], input[type=radio]) { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--fdp-primary); vertical-align: middle; flex-shrink: 0; }
:root body input[type=file] { width: 100%; padding: 12px; border: 1px dashed var(--fdp-field-line); border-radius: 8px; background: var(--fdp-soft); color: var(--fdp-ink); font-size: 14px; }
:root body input::file-selector-button { min-height: 44px; margin: 0 12px 8px 0; padding: 10px 14px; border: 1px solid var(--fdp-line); border-radius: 8px; background: #fff; color: var(--fdp-primary); font: 600 14px var(--fdp-font); cursor: pointer; }
:root body :is(input, textarea)::placeholder { color: #63798a; opacity: 1; }
:root body :is(input, select, textarea)[aria-invalid=true] { border-color: var(--fdp-danger); background: #fffafb; }
:root body .score-team input { width: 76px; min-height: 64px; font-size: 32px; font-weight: 750; text-align: center; }
:root body .import-field textarea { font-family: ui-monospace, Consolas, monospace; }

/* Primary and secondary actions share geometry and readable sentence case. */
:root body :is(button, input[type=submit], .public-button, .primary-action, .excel-button, .secondary-action, .admin-link, .block-title > a, .entity-actions a, .entity-shortcuts a, .player-actions a, .form-actions > a, .fdp-button) {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; max-width: 100%; padding: 10px 16px; gap: 8px;
  border: 1px solid var(--fdp-primary); border-radius: var(--fdp-radius-control);
  background: var(--fdp-primary); color: #fff; font: 600 14px/1.4 var(--fdp-font);
  text-align: center; text-decoration: none; text-transform: none; letter-spacing: normal;
  white-space: normal; cursor: pointer; box-shadow: none;
}
:root body :is(.excel-button, .secondary-action, .entity-actions a, .entity-shortcuts a, .player-actions a, .form-actions > a, .fdp-button-secondary) {
  border-color: var(--fdp-line); background: #fff; color: var(--fdp-primary);
}
:root body :is(button, .public-button, .primary-action, .admin-link, .fdp-button):hover:not(:disabled) { background: var(--fdp-primary-hover); border-color: var(--fdp-primary-hover); color: #fff; }
:root body :is(.excel-button, .secondary-action, .entity-actions a, .entity-shortcuts a, .player-actions a, .form-actions > a, .fdp-button-secondary):hover { background: var(--fdp-soft); border-color: #8aadc4; color: var(--fdp-primary-hover); }
:root body :is(a.danger-link, a.player-release) { color: var(--fdp-danger); border-color: #dfb5bd; background: #fff; }
:root body :is(a.danger-link, a.player-release):hover { color: #84202d; border-color: #bf6a79; background: #fff1f3; }
:root body :is(.danger-button, button[name=action][value^=delete], .fdp-button-danger) { background: var(--fdp-danger); border-color: var(--fdp-danger); color: #fff; }
:root body :is(.danger-button, button[name=action][value^=delete], .fdp-button-danger):hover { background: #84202d; border-color: #84202d; }
:root body :is(button, input, select, textarea):disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
:root body :is(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid #087ca3; outline-offset: 3px; }
:root body .sidebar :is(a, button, summary):focus-visible { outline-color: #62dded; }
:root body :is(.workspace-menu-toggle, .sidebar-user button) { background: #15435f; border-color: #ffffff45; color: #fff; }
:root body button.workspace-menu-toggle { display: none; }
:root body .tournament-tabs button { background: transparent; color: #526a7d; border: 0; border-bottom: 3px solid transparent; border-radius: 0; box-shadow: none; white-space: nowrap; }
:root body .tournament-tabs button:is(.active, :hover) { color: var(--fdp-primary); border-bottom-color: var(--fdp-primary); background: #edf5f9; }
:root body .fdp-app-tools button { background: #0b2942; border-color: #217b9c; }
:root body :is(.player-team-grid, .sport-card, .import-center) a:not([class]) { color: var(--fdp-primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:root body .player-team-grid strong a { color: var(--fdp-ink); text-decoration: none; font-weight: 650; }
:root body .player-team-grid strong a:hover { color: var(--fdp-primary); text-decoration: underline; }

/* Surface and spacing scale, without changing navigation or business flows. */
:root body :is(.panel-block, .entity-table, .entity-form-card, .stat-grid article, .team-tournament-group, .match-tournament-group, .match-filters, .player-category, .player-team-grid > section, .sport-card, .import-card, .statistics-card, .data-card, .summary-grid article, .match-control-header, .match-scoreboard) {
  border: 1px solid var(--fdp-line); border-radius: var(--fdp-radius-card); background-color: var(--fdp-surface); box-shadow: var(--fdp-shadow);
}
/* Apply the same card edges to public, administrative and match surfaces.
   Keep their existing backgrounds and status colors. */
:root body :is(.public-card, .public-scoreboard, .score-card, .empty-card,
  .fixtures article, .venue-block, .squad-grid > article, .portal-search,
  .platform-metrics article, .organization-admin-card, .role-guide article,
  .message-card, .statistics-tournament-grid > article, .honor-card,
  .match-settings-card, .event-form-section, .request-card, .tie-card) {
  border: 1px solid var(--fdp-line);
  border-radius: var(--fdp-radius-card);
  box-shadow: var(--fdp-shadow);
}
:root body .organization-admin-card:hover { box-shadow: var(--fdp-shadow); transform: none; }
/* Inner headers follow the outer corners without clipping menus or focus rings. */
:root body :is(.panel-block, .match-settings-card) > :first-child,
:root body .venue-block > h3 {
  border-top-left-radius: calc(var(--fdp-radius-card) - 1px);
  border-top-right-radius: calc(var(--fdp-radius-card) - 1px);
}
:root body :is(.entity-form-card, .sport-card, .import-card) { padding: var(--fdp-space-4); margin-top: var(--fdp-space-4); }
:root body .sport-card { margin-right: 0; margin-left: 0; }
:root body .sport-card form > p { display: grid; gap: 8px; margin: 0 0 16px; }
:root body .sport-card form { max-width: 760px; }
:root body .sport-card form label { margin: 0; }
:root body .sport-card form :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { max-width: 100%; }
:root body .sport-card h2 { margin: 0 0 20px; }
:root body .sport-card details { margin-top: 16px; }
:root body :is(.form-row, .import-field) { min-width: 0; }
:root body :is(.form-row, .import-field) label { margin-bottom: 8px; }
:root body :is(.header-actions, .entity-actions, .entity-shortcuts, .player-actions, .form-actions, .fdp-actions) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fdp-space-2); }
:root body .fdp-actions { margin: 16px 0; }
:root body .form-actions { margin-top: 16px; padding-top: 16px; }
:root body .panel-header { margin-bottom: 24px; }
:root body .panel-main { padding-top: 32px; padding-bottom: 32px; }
:root body .panel-header + .entity-shortcuts:empty { display: none; }
:root body :is(.panel-list article, .entity-table article) { padding: 16px 20px; gap: 16px; }
:root body.entity-torneos .entity-table article { grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); }
:root body.entity-torneos .entity-actions { justify-content: flex-end; }
:root body .player-team-grid section > article { gap: 12px; padding: 16px; }
:root body .player-team-grid article > div:first-child { min-width: 0; overflow-wrap: anywhere; }
:root body .player-actions { flex-shrink: 0; margin-left: 0; }
:root body .player-filter-bar { border-radius: 12px; gap: 12px; padding: 16px; }
:root body .tournament-config-section { padding: 20px; margin-bottom: 24px; border-color: var(--fdp-line); border-radius: 12px; background: #fbfdfe; }
:root body .tournament-config-section > p { margin-bottom: 16px; }
:root body .tournament-config-section legend { font: 650 18px/1.4 var(--fdp-font); }
:root body .tournament-config-grid { gap: 16px; }
:root body .tournament-checkbox { padding: 12px; border-radius: 8px; }
:root body :is(.panel-message, .import-success, .form-error, .import-errors, .errorlist) { border-radius: 8px; padding: 12px 16px; font-size: 14px; line-height: 1.5; }
:root body .field-error { margin-top: 8px; color: var(--fdp-danger); font-size: 13px; }
:root body .errorlist { padding-left: 32px; }
:root body :is(.panel-empty, .public-empty) { border-radius: 12px; padding: 24px; }
/* Shared rhythm: 8px within a field, 12px between actions, 16px between
   controls and cards, 24px between sections. */
:root body :is(.entity-form-card form, .import-fields, .match-settings-grid,
  .event-main-fields, .participant-fields, .report-fields, .tournament-config-grid) { gap: var(--fdp-space-3); }
:root body :is(.form-row, .import-field) > :is(small, .helptext, .field-error) { margin-top: var(--fdp-space-1); }
:root body :is(.panel-columns, .stat-grid, .summary-grid, .player-team-grid,
  .statistics-tournament-grid, .organization-admin-grid, .platform-metrics,
  .squad-grid, .import-metrics) { gap: var(--fdp-space-3); }
:root body :is(.stat-grid, .platform-metrics, .import-steps, .import-fields, .import-metrics) { margin-block: var(--fdp-space-4); }
:root body :is(.team-tournament-group, .match-tournament-group, .player-category,
  .public-card, .match-settings-card, .event-form-section) { margin-block: var(--fdp-space-4); }
:root body :is(.block-title, .match-settings-card > header, .match-settings-grid,
  .match-settings-card > footer) { padding: var(--fdp-space-3) var(--fdp-space-4); }
:root body :is(.block-title, .import-section-heading, .public-section-title) h2 { margin: 0; }
:root body :is(.import-section-heading, .public-section-title) { margin-block: 0 var(--fdp-space-3); }
:root body :is(.sport-card, .public-card, .import-card) > p { margin-block: 0 var(--fdp-space-3); }
:root body :is(.sport-card, .public-card, .import-card) > :last-child { margin-bottom: 0; }
:root body :is(.header-actions, .entity-shortcuts, .share-actions, .hero-actions,
  .import-action-bar, .match-settings-card > footer) { gap: var(--fdp-space-2); }
:root body .entity-shortcuts:not(:empty) { margin-block: 0 var(--fdp-space-4); }
:root body .form-actions { margin-top: 0; padding-top: var(--fdp-space-3); }
:root body .tournament-form-intro { margin-bottom: var(--fdp-space-4); }
:root body .sport-card h2 { margin-bottom: var(--fdp-space-3); }
:root body .hero { min-height: 0; padding-block: var(--fdp-space-5); gap: var(--fdp-space-5); }
:root body .tournament-hero { padding-block: var(--fdp-space-5); gap: var(--fdp-space-4); }
@media (max-width: 900px) {
  :root body .sidebar:has(.workspace-menu-toggle) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; }
  :root body .sidebar:has(.workspace-menu-toggle) .panel-brand img { width: 112px; }
  :root body button.workspace-menu-toggle { display: flex; justify-content: center; grid-column: 2; grid-row: 1; width: auto; margin: 0; }
  :root body .sidebar:has(.workspace-menu-toggle) .organization-identity { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; gap: 8px; }
  :root body .sidebar:has(.workspace-menu-toggle) .organization-identity small { display: none; }
  :root body .sidebar:has(.workspace-menu-toggle) .organization-identity strong { margin: 0; font-size: 13px; line-height: 1.4; }
  :root body .sidebar:has(.workspace-menu-toggle) :is(.organization-identity img, .organization-initial) { width: 28px; height: 28px; flex-shrink: 0; }
  :root body .sidebar:has(.workspace-menu-toggle) :is(.grouped-nav, .sidebar-user, .organization-switcher) { grid-column: 1 / -1; margin: 0; }
  :root body .sidebar:has(.workspace-menu-toggle):not(.workspace-menu-open) :is(.sidebar-user, .organization-switcher) { display: none; }
  :root body .sidebar .grouped-nav[hidden] { display: none; }
  :root body .panel-main { padding: 24px 16px; }
  :root body.entity-torneos .entity-table article { grid-template-columns: 1fr; }
  :root body.entity-torneos .entity-actions { justify-content: flex-start; }
}
@media (max-width: 650px) {
  :root body :is(.public-card, .block-title, .match-settings-card > header,
    .match-settings-grid, .match-settings-card > footer) { padding: var(--fdp-space-3); }
  :root body :is(.hero, .tournament-hero) { padding-block: var(--fdp-space-4); gap: var(--fdp-space-4); }
  :root body :is(.entity-form-card, .sport-card, .import-card) { padding: 16px; }
  :root body .tournament-config-section { padding: 16px 12px; }
  :root body .player-team-grid section > article { flex-wrap: wrap; }
  :root body .player-actions { width: 100%; justify-content: flex-start; }
  :root body .fdp-actions > a { flex: 1 1 200px; }
  :root body .form-actions { gap: 12px; }
}
@media print { :root { --fdp-shadow: none; } }
