:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687188;
  --line: #dfe4ec;
  --surface: #ffffff;
  --background: #f4f6f9;
  --blue: #246bfd;
  --green: #1d9a6c;
  --amber: #d8830b;
  --red: #d94655;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  max-width: 1320px;
  margin: 0 auto;
  padding: 38px 24px 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; }
.subtitle { margin: 9px 0 0; color: var(--muted); }

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 18px;
}
.current-user {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}
.current-user > span { color: var(--ink); font-weight: 800; }
.current-user > strong { padding: 4px 7px; border-radius: 999px; background: #eef3ff; color: var(--blue); font-size: 10px; }
.current-user form { margin: 0; }
.current-user a { color: var(--blue); font-weight: 800; text-decoration: none; }
.header-user { flex: 0 0 100%; justify-content: flex-end; }
.header-actions a {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.airflow-toggle-form { display: flex; align-items: center; }
.airflow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #d5dbe7;
  background: #eef1f6;
  color: #687188;
  font-size: 12px;
}
.airflow-toggle:hover { background: #e5e9f1; }
.airflow-toggle.enabled { border-color: #9bd5c0; background: #e8f8f1; color: #14724f; }
.airflow-toggle.enabled:hover { background: #dcf3e9; }
.airflow-toggle-track {
  display: inline-flex;
  width: 28px;
  height: 16px;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: #a8b0bf;
}
.airflow-toggle-track span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
}
.airflow-toggle.enabled .airflow-toggle-track { background: #1d9a6c; }
.airflow-toggle.enabled .airflow-toggle-track span { transform: translateX(12px); }

.bulk-refresh-form { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.bulk-refresh-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.bulk-refresh-sources label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.bulk-refresh-sources input { margin: 0; }

.notice {
  max-width: 1272px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border: 1px solid #a8dfc9;
  border-radius: 10px;
  background: #eaf8f2;
  color: #126847;
}
.notice-error { border-color: #f1b5bc; background: #fff0f1; color: #a82937; }
.parser-status {
  max-width: 1272px;
  margin: 0 auto 16px;
  padding: 9px 14px;
  border-radius: 10px;
  background: #edf1f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.parser-status.state-running { background: #fff6df; color: #8a5707; }
.parser-status.state-completed { background: #eaf8f2; color: #126847; }
.parser-status.state-failed, .parser-status.state-unavailable { background: #fff0f1; color: #a82937; }

.parser-errors { margin-top: 8px; }
.parser-errors summary { cursor: pointer; font-weight: 700; }
.parser-errors ul { margin: 8px 0 0; padding-left: 20px; }
.parser-errors li { margin-top: 4px; white-space: pre-wrap; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 24px 22px;
}

.summary article {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.summary strong { font-size: 26px; }
.summary span { color: var(--muted); font-size: 13px; }
.summary small { color: var(--blue); font-size: 11px; font-weight: 700; }
.clickhouse-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-top: 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  max-width: 1272px;
  margin: 0 auto 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.create-panel,
.sports-import-panel {
  max-width: 1272px;
  margin: 0 auto 22px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.create-panel > summary,
.sports-import-panel > summary { padding: 15px 0; color: var(--blue); cursor: pointer; font-weight: 800; }
.sports-import-panel { max-width: 1272px; margin-bottom: 12px; }
.sports-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 12px;
  padding: 2px 0 18px;
}
.sports-import-form label { display: flex; flex-direction: column; gap: 6px; }
.sports-import-form label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.sports-import-form p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.create-match-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; padding: 2px 0 18px; }
.create-match-form label { display: flex; flex-direction: column; gap: 6px; }
.create-match-form label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.create-match-form .wide { grid-column: span 2; }
.create-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; grid-column: 1 / -1; padding-top: 4px; }
.create-form-footer span { color: var(--muted); font-size: 12px; }

.filters > label { display: flex; flex: 1 1 150px; flex-direction: column; gap: 5px; min-width: 150px; }
.filters > label > span, .filter-result { color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-result { margin-left: auto; padding-bottom: 10px; }

.filters > .tag-filter {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  margin: 2px 0 0;
  padding: 11px 13px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faff;
}
.filters .tag-filter legend { margin: 0; padding: 0 5px; color: #34415d; font-size: 12px; font-weight: 800; }
.tag-filter-content { display: grid; grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); gap: 12px; align-items: end; }
.tag-mode-control { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tag-mode-control > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.tag-filter-options, .match-tag-options { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 7px; min-height: 40px; }
.filters .tag-choice, .match-tags .tag-choice {
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  min-width: 0;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid #cad6f1;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.tag-choice input { margin: 0; accent-color: var(--blue); }
.filters .tag-choice span, .match-tags .tag-choice span { color: #34415d; font-size: 11px; }
.tag-empty { color: var(--muted); font-size: 12px; line-height: 1.4; }
.tag-management {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(360px, 1.25fr);
  align-items: end;
  gap: 24px;
  max-width: 1272px;
  margin: 0 auto 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.tag-management-copy h2 { margin: 0 0 5px; font-size: 15px; }
.tag-management-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.tag-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}
.tag-create-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tag-create-form label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.tag-management-list {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.tag-management-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px 6px 10px;
  border: 1px solid #cad6f1;
  border-radius: 10px;
  background: #f8faff;
}
.tag-management-name { color: #34415d; font-size: 12px; font-weight: 800; }
.tag-management-count { color: var(--muted); font-size: 11px; }
.tag-delete-button {
  padding: 5px 8px;
  border: 1px solid #f1b5bc;
  background: #fff0f1;
  color: #a82937;
  font-size: 11px;
}
.tag-delete-button:hover { background: #fbdde1; }

.assignee-management {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(360px, 1.25fr);
  align-items: end;
  gap: 24px;
  max-width: 1272px;
  margin: 0 auto 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.assignee-management-copy h2 { margin: 0 0 5px; font-size: 15px; }
.assignee-management-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.assignee-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}
.assignee-create-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.assignee-create-form label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.assignee-management-list {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}
.assignee-management-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #cad6f1;
  border-radius: 10px;
  background: #f8faff;
}
.assignee-management-name { color: #34415d; font-size: 12px; font-weight: 800; }
.assignee-management-count { color: var(--muted); font-size: 11px; }

.match-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

.match-view-toolbar { max-width: 1320px; margin: 0 auto; padding: 8px 24px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.match-view-toolbar > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.match-view-toolbar > div > span { color: var(--muted); font-size: 12px; }
.match-view-switch { display: flex; gap: 4px; background: #e9edf5; padding: 4px; border-radius: 10px; }
.match-view-switch button { background: transparent; color: #52617a; border-radius: 7px; padding: 8px 14px; font-size: 12px; }
.match-view-switch button[aria-pressed="true"] { background: #fff; color: #2459c4; box-shadow: 0 1px 5px #17203316; }
.match-view-switch button:focus-visible, .match-row-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#match-view-toolbar[hidden], #match-cards[hidden], #match-table-view[hidden], .match-detail-row[hidden] { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.match-table-shell { max-width: 1320px; margin: 0 auto; padding: 0 24px 48px; }
.match-table-hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.match-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
.match-table { width: 100%; min-width: 1040px; border-collapse: collapse; text-align: left; font-size: 12px; }
.match-table thead { background: #f3f6fc; color: #52617a; }
.match-table th, .match-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.match-table thead th { font-size: 11px; font-weight: 800; white-space: nowrap; }
.match-summary-row small { display: block; margin-top: 7px; font-size: 11px; line-height: 1.5; color: var(--muted); font-weight: 400; }
.match-summary-row { cursor: pointer; }
.match-summary-row:hover, .match-summary-row.is-expanded { background: #f4f7ff; }
.match-table-teams { min-width: 220px; max-width: 340px; font-size: 13px; line-height: 1.5; }
.match-table-teams > span { color: #9aa3b5; }
.match-table-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.match-table-tags:empty { display: none; }
.match-table-tags > span { padding: 2px 6px; border: 1px solid #dbe3f7; border-radius: 6px; background: #f0f4ff; color: #445c91; font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
[data-summary-sports-id] { white-space: nowrap; }
[data-summary-sports-id] .copy-value { width: auto; font-size: 12px; }
.match-table-date, .match-table-score { white-space: nowrap; }
.match-table-score { font-size: 15px; font-weight: 800; }
.match-row-toggle { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 7px; background: #edf2ff; color: #2459c4; font-size: 24px; }
.match-row-toggle:hover { background: #dde7ff; }
.match-row-toggle > span { transition: transform .15s; }
.match-row-toggle[aria-expanded="true"] > span { transform: rotate(90deg); }
.match-table-stages { display: flex; gap: 4px; }
.table-stage { display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 21px; min-height: 24px; padding: 3px 4px; border-radius: 5px; background: #edf0f5; color: #8a94a5; font-size: 11px; white-space: nowrap; }
.clickhouse-version { font-size: 10px; font-weight: 700; white-space: nowrap; }
.pipeline-stage .clickhouse-version { margin-left: 5px; border-left: 1px solid #1d9a6c44; padding-left: 6px; }
.table-stage.is-ready { background: #e8f8f1; color: #14724f; }
.match-detail-row > td { padding: 16px 24px 24px; background: #f4f7ff; }
.match-detail-slot { max-width: 1100px; margin: 0 auto; }
.match-detail-slot .match-card { text-align: left; font-size: 16px; }
@media (max-width: 720px) {
  .match-view-toolbar, .match-table-shell { padding-left: 14px; padding-right: 14px; }
}

.match-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(29, 40, 70, .06);
}

.match-card.status-done { border-top-color: var(--green); }
.match-card.status-new { border-top-color: #9aa3b5; }

.match-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.match-heading h2 { margin: 5px 0 0; font-size: 21px; letter-spacing: -.02em; }
.match-heading h2 span { color: #9aa3b5; font-weight: 400; }
.match-meta { color: var(--muted); font-size: 12px; }
.match-result { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.match-result strong { font-size: 24px; white-space: nowrap; }
.match-result-top { display: flex; align-items: center; gap: 9px; }
.pipeline-play-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(36, 89, 196, .22);
}
.pipeline-play-button:hover { background: #1558dc; }
.pipeline-play-button.disabled {
  background: #e5e9f1;
  color: #9aa3b5;
  box-shadow: none;
  cursor: not-allowed;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2ff;
  color: #2459c4;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-done .status-badge { background: #e8f8f1; color: #14724f; }

.progress-row { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.progress-track { flex: 1; height: 7px; overflow: hidden; border-radius: 999px; background: #edf0f5; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }

.source-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #d8e2f8;
  border-radius: 11px;
  background: #f7f9ff;
}
.source-ids, .source-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.source-ids span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.source-ids .copy-value { display: inline; width: auto; color: var(--ink); }
.source-links { justify-content: flex-end; }
.source-links a { color: var(--blue); font-size: 12px; font-weight: 800; text-decoration: none; }
.source-links .transfermarkt-link { color: #13693b; }
.source-links .sofascore-link { color: #6b35c9; }
.source-links .video-link {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 8px;
  background: #1f5bd8;
  color: #fff;
}
.source-links .public-video-link { background: #14724f; }
.dataset-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
}
.dataset-details div { display: grid; grid-template-columns: minmax(115px, .75fr) minmax(0, 1.25fr); gap: 10px; padding: 8px 10px; background: #fff; }
.dataset-details dt { color: var(--muted); font-size: 11px; font-weight: 800; }
.dataset-details dd { margin: 0; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.copy-value {
  width: 100%;
  margin: -5px -7px;
  padding: 5px 7px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: copy;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  overflow-wrap: anywhere;
}
.copy-value:hover { background: #eaf0ff; color: #174fb6; }
.copy-value.is-copied { background: #e3f7ee; color: #126847; }
.copy-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 9px;
  background: #172033;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
}
.copy-toast.is-visible { opacity: 1; transform: translateY(0); }
.copy-toast.is-error { background: var(--red); }

.formation-preview {
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f7fa;
}
.formation-preview a { display: block; }
.formation-preview img { display: block; width: 100%; height: auto; }
.formation-preview figcaption { padding: 8px 11px; color: var(--muted); font-size: 11px; }

.sofascore-panel {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #ded4f6;
  border-radius: 12px;
  background: #fbf9ff;
}
.sofascore-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sofascore-heading h3 { margin: 0; font-size: 13px; }
.sofascore-heading a { color: #6b35c9; font-size: 11px; font-weight: 800; text-decoration: none; }
.sofascore-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sofascore-grid figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.sofascore-grid a, .sofascore-grid img { display: block; width: 100%; }
.sofascore-grid img { height: auto; }
.sofascore-grid figcaption { padding: 7px 9px; color: var(--muted); font-size: 10px; font-weight: 700; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; font-size: 13px; font-weight: 800; }
.pipeline-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.pipeline-checklist legend { grid-column: 1 / -1; }
.pipeline-stage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 12px; }
.pipeline-stage strong { color: #8a93a5; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; background: #c4cad4; }
.pipeline-stage.is-ready { border-color: #a8dfc9; background: #eefaf5; color: #126847; }
.pipeline-stage.is-ready strong { color: #126847; }
.pipeline-stage.is-ready .stage-dot { background: var(--green); }
.pipeline-source { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; grid-column: 1 / -1; color: var(--muted); font-size: 11px; }

.match-extra-details {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8faff;
}
.match-extra-details > summary {
  cursor: pointer;
  padding: 12px 14px;
  color: #2459c4;
  font-size: 12px;
  font-weight: 800;
}
.match-extra-details[open] > summary { border-bottom: 1px solid var(--line); }
.match-extra-content { padding: 14px; }
.match-extra-content > :last-child { margin-bottom: 0; }

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.details-grid label { display: flex; flex-direction: column; gap: 6px; }
.details-grid label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.details-grid .wide { grid-column: 1 / -1; }
.match-tags {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faff;
}
.match-tags legend { margin: 0; padding: 0 5px; color: var(--muted); font-size: 12px; }
.visible-match-tags { margin: 15px 0 0; }
.visible-match-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}
.visible-match-controls label { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.visible-match-controls label > span { color: var(--muted); font-size: 12px; font-weight: 700; }

input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%;
  border: 1px solid #ccd3df;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 9px 11px;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36, 107, 253, .14); border-color: var(--blue); }

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}

.card-footer div { display: flex; flex-direction: column; gap: 5px; }
.card-footer .card-footer-actions { flex-direction: row; align-items: center; gap: 8px; }
.card-footer span { color: var(--muted); font-size: 11px; }
.source-editor { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 13px; }
.source-editor summary { color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; }
.source-editor-grid { display: grid; grid-template-columns: minmax(120px, .45fr) minmax(0, 1.55fr); gap: 12px; margin-top: 12px; }
.source-editor-grid label { display: flex; flex-direction: column; gap: 6px; }
.source-editor-grid label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.source-editor-grid .wide { grid-column: 1 / -1; }
.empty-result { padding: 30px; border-radius: 14px; background: var(--surface); color: var(--muted); }
button {
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 15px;
}
button:hover { background: #1558dc; }
.secondary-button { padding: 7px 10px; background: #eaf0ff; color: #2459c4; }
.secondary-button:hover { background: #dce7ff; }
.danger-button { background: #fff0f1; color: #aa2e3c; }
.danger-button:hover { background: #fbdde0; }
.refresh-button { padding: 7px 10px; background: #1d9a6c; }
.refresh-button:hover { background: #147b56; }
.match-refresh-button { background: #eaf0ff; color: #2459c4; }
.match-refresh-button:hover { background: #dce7ff; }
button:disabled { cursor: not-allowed; opacity: .55; }

.launch-page { min-height: 100vh; background: var(--background); }
.launch-shell { max-width: 920px; margin: 0 auto; padding: 30px 20px 60px; }
.launch-back { display: inline-block; color: var(--blue); font-weight: 800; text-decoration: none; }
.launch-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.launch-card { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 30px rgba(29, 40, 70, .08); }
.launch-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.launch-heading h1 { margin-top: 6px; font-size: clamp(25px, 4vw, 36px); }
.launch-heading h1 span { color: #9aa3b5; font-weight: 400; }
.launch-airflow-label { padding: 7px 11px; border-radius: 999px; background: #eef3ff; color: var(--blue); font-size: 12px; font-weight: 900; }
.launch-notice { margin: 0 0 14px; }
.launch-success { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid #a9dfc9; border-radius: 11px; background: #edfbf5; color: #126a4a; }
.launch-success a { color: #126a4a; font-weight: 800; }
.launch-required-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.launch-required-grid label { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.launch-required-grid label > span { color: #34415d; font-size: 12px; font-weight: 800; }
.launch-required-grid label small { color: var(--muted); line-height: 1.35; }
.launch-required-grid .wide { grid-column: 1 / -1; }
.worker-field { min-width: 0; }
.kit-section { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f8faff; }
.kit-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.kit-heading h2 { font-size: 18px; margin: 0; }
.kit-heading > span, .kit-help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.kit-toggle { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.kit-toggle input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--blue); }
#kit-fields[hidden] { display: none; }
.kit-role { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.kit-role h3 { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; font-size: 13px; }
.kit-role h3 span { color: var(--muted); font-weight: 400; }
.kit-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.kit-picker { min-width: 0; padding: 0; border: 0; margin: 0; }
.kit-picker legend { padding: 0; margin-bottom: 10px; font-size: 12px; font-weight: 700; }
.kit-selection { display: block; min-height: 18px; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 400; }
.kit-swatches { display: grid; grid-template-columns: repeat(7, 32px); gap: 8px; }
.kit-swatch { position: relative; width: 32px; height: 32px; cursor: pointer; }
.kit-swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.kit-square { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 5px; border: 1px solid #0002; background: var(--kit-color); color: var(--kit-ink); pointer-events: none; }
.kit-square > span { visibility: hidden; font-size: 20px; font-weight: 800; }
.kit-swatch input:checked + .kit-square { outline: 2px solid var(--blue); outline-offset: 2px; }
.kit-swatch input:checked + .kit-square > span { visibility: visible; }
.kit-swatch input:focus-visible + .kit-square { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (max-width: 760px) {
  .kit-parts { grid-template-columns: 1fr; gap: 16px; }
  .kit-section { padding: 12px; }
  .kit-role { padding: 10px; }
  .kit-swatches { grid-template-columns: repeat(7, minmax(0, 32px)); gap: 6px; }
  .kit-swatch, .kit-square { width: 100%; }
}
.worker-load { margin-top: 10px; padding: 12px; border: 1px solid #dae3f3; border-radius: 12px; background: #f7f9fd; display: grid; gap: 9px; }
.worker-load-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: #34415d; }
.worker-load-heading button { padding: 5px 9px; font-size: 11px; }
.worker-load-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.worker-load-counts span { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 8px; font-size: 12px; }
.worker-load-counts b { font-size: 18px; }
.worker-load-in-progress { background: #e7edff; color: #244cba; }
.worker-load small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.launch-required-grid input[readonly] { background: #f3f5f9; color: #677188; }
.preset-save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 3px; }
.preset-save-row[hidden] { display: none; }
.preset-save-row button { padding: 8px 11px; white-space: nowrap; }
.launch-metadata { margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; }
.launch-metadata summary { padding: 13px 15px; color: var(--blue); cursor: pointer; font-weight: 800; }
.launch-metadata dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.launch-metadata dl div { min-width: 0; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.launch-metadata dl .wide { grid-column: 1 / -1; }
.launch-metadata dt { color: var(--muted); font-size: 11px; font-weight: 800; }
.launch-metadata dd { overflow-wrap: anywhere; margin: 4px 0 0; font-size: 13px; font-weight: 700; }
.launch-footer { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-top: 22px; }
.launch-footer span { color: var(--muted); font-size: 12px; }

.auth-page { min-height: 100vh; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 12px 38px rgba(29, 40, 70, .09); }
.auth-card h1 { font-size: 32px; }
.auth-description { margin: 9px 0 22px; color: var(--muted); }
.auth-notice { margin: 0 0 16px; }
.auth-form { display: grid; gap: 15px; }
.auth-form label, .user-create-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label > span, .user-create-form label > span { color: #34415d; font-size: 12px; font-weight: 800; }

.users-shell { max-width: 1120px; margin: 0 auto; padding: 34px 24px 60px; }
.users-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.users-header .launch-back { margin-bottom: 22px; }
.users-header h1 { font-size: 38px; }
.users-page .notice { max-width: none; }
.user-management-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(420px, 1.3fr); gap: 18px; }
.user-create-card, .user-list-card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.user-create-card h2, .user-list-card h2 { margin: 0 0 18px; font-size: 18px; }
.user-create-form { display: grid; gap: 14px; }
.user-create-form small { color: var(--muted); }
.user-list { display: grid; gap: 9px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; }
.user-row > div { display: grid; gap: 3px; }
.user-row span, .user-row small { color: var(--muted); font-size: 11px; }
.user-current-label { padding: 5px 8px; border-radius: 999px; background: #eaf8f2; color: #126847 !important; font-weight: 800; }

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .match-list { grid-template-columns: 1fr; }
  .create-match-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tag-management, .assignee-management { grid-template-columns: 1fr; gap: 12px; }
  .user-management-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page-header { align-items: flex-start; flex-direction: column; }
  .summary, .match-list { padding-left: 14px; padding-right: 14px; }
  .tag-filter-content, .tag-create-form, .assignee-create-form { grid-template-columns: 1fr; }
  .tag-management, .assignee-management { align-items: stretch; margin-left: 14px; margin-right: 14px; }
  .filters { align-items: stretch; flex-direction: column; margin-left: 14px; margin-right: 14px; }
  .filter-result { margin-left: 0; }
  .details-grid, .visible-match-controls, .pipeline-checklist, .create-match-form { grid-template-columns: 1fr; }
  .details-grid .wide { grid-column: auto; }
  .match-heading, .card-footer { align-items: flex-start; flex-direction: column; }
  .card-footer .card-footer-actions { width: 100%; flex-wrap: wrap; }
  .match-result { align-items: flex-start; }
  .source-panel { align-items: flex-start; flex-direction: column; }
  .source-links { justify-content: flex-start; }
  .source-editor-grid { grid-template-columns: 1fr; }
  .source-editor-grid .wide { grid-column: auto; }
  .dataset-details { grid-template-columns: 1fr; }
  .sofascore-grid { grid-template-columns: 1fr; }
  .create-match-form .wide { grid-column: auto; }
  .create-form-footer { align-items: stretch; flex-direction: column; }
  .launch-card { padding: 20px 16px; }
  .launch-heading, .launch-footer { align-items: stretch; flex-direction: column; }
  .launch-required-grid, .launch-metadata dl { grid-template-columns: 1fr; }
  .launch-required-grid .wide, .launch-metadata dl .wide { grid-column: auto; }
  .preset-save-row { grid-template-columns: 1fr; }
  .users-header, .launch-topbar { align-items: flex-start; flex-direction: column; }
  .current-user { flex-wrap: wrap; }
  .auth-card { padding: 26px 20px; }
}
