:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #687083;
  --line: #dce2eb;
  --accent: #0f9f6e;
  --accent-dark: #08724f;
  --danger: #c24141;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

.shell {
  min-height: 100vh;
  padding: 12px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 24px;
  max-width: 1280px;
}

.stats {
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: right;
}

.stats span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.stats small {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.2)),
    url("./img/logo.jpg") center / contain no-repeat #fff;
  background-attachment: fixed;
}

.login-shell {
  width: min(460px, 100%);
}

.login-card {
  display: grid;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form input {
  width: 100%;
}

.user-page {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgba(245, 247, 251, 0.72), rgba(245, 247, 251, 0.86)),
    url("./img/logo.jpg") center / contain no-repeat #fff;
  background-attachment: fixed;
}

.user-shell {
  display: grid;
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.1);
}

.user-header h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.user-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
}

.user-welcome,
.user-note {
  margin: 0;
}

.user-welcome {
  font-size: 1.1rem;
  font-weight: 900;
}

.user-note {
  color: var(--muted);
  line-height: 1.5;
}

.user-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.user-stat-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.user-stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.user-stat-card strong {
  color: var(--accent-dark);
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 1000;
  line-height: 0.95;
}

.user-stat-card p {
  min-height: 42px;
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.user-stat-card button {
  justify-self: start;
  margin-top: auto;
}

.user-history-panel h2 {
  margin: 0;
}

.user-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.user-section-head h2,
.user-section-head p {
  margin: 0;
}

.user-section-head p {
  color: var(--muted);
  font-weight: 800;
}

.user-last-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 190px;
  border: 1px solid #172033;
  border-radius: 8px;
  padding: 20px;
  background: linear-gradient(180deg, #10213a, #1f3657);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.user-score-team,
.user-score-center {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  text-align: center;
}

.user-score-flag {
  display: grid;
  place-items: center;
  width: 86px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 3rem;
  line-height: 1;
}

.user-score-team strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 1000;
}

.user-score-center > strong {
  display: block;
  min-width: 180px;
  border-radius: 8px;
  padding: 14px 18px;
  color: #fff;
  background: #111827;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  font-weight: 1000;
  line-height: 0.95;
}

.user-score-center > span:last-child {
  color: #a7f3d0;
  font-weight: 900;
}

.user-last-detail-button {
  justify-self: center;
  min-width: 220px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent-dark);
  font-weight: 1000;
  cursor: pointer;
}

.user-last-detail-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.user-last-result,
.user-match-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.user-last-result.won,
.user-match-pill.won {
  color: #08724f;
  background: #a7f3d0;
}

.user-last-result.draw,
.user-match-pill.draw {
  color: #176c9e;
  background: #eef6ff;
}

.user-last-result.lost,
.user-match-pill.lost {
  color: #ad2e2e;
  background: #ffe2e2;
}

.user-last-result.not_played,
.user-match-pill.not_played {
  color: #374151;
  background: #e5e7eb;
}

.user-match-history {
  display: grid;
  gap: 10px;
}

.user-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.user-match-row strong,
.user-match-row span {
  display: block;
}

.user-match-row strong {
  font-weight: 1000;
}

.user-match-row > div > span {
  color: var(--muted);
  font-weight: 800;
}

.user-card-history {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-card-history > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid #f2d35d;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff8d7;
  color: #8a6700;
  font-weight: 900;
}

.user-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.inactive-user-message p {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.2rem;
  font-weight: 1000;
  line-height: 1.4;
}

.user-ranking-dialog {
  width: min(860px, calc(100vw - 12px));
  max-height: min(720px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}

.user-ranking-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.user-ranking-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: #fff;
}

.user-ranking-head strong {
  font-size: 1.05rem;
  font-weight: 1000;
}

.user-ranking-table-wrap {
  overflow: auto;
  max-height: 620px;
}

.user-ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.user-ranking-table th,
.user-ranking-table td {
  border-bottom: 1px solid #edf2f7;
  padding: 10px 8px;
  text-align: left;
}

.user-ranking-table th:not(:nth-child(2)),
.user-ranking-table td:not(:nth-child(2)) {
  width: 58px;
  text-align: center;
  white-space: nowrap;
}

.user-ranking-table th:nth-child(2),
.user-ranking-table td:nth-child(2) {
  min-width: 170px;
}

.user-ranking-table .current-user td {
  background: #e8f8ef;
  color: var(--accent-dark);
  font-weight: 1000;
}

.user-match-dialog {
  width: min(980px, calc(100vw - 28px));
}

.user-match-detail-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.user-match-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 900;
}

.user-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.user-detail-grid > article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.user-detail-grid h3,
.user-detail-grid h4 {
  margin: 0 0 10px;
}

.user-detail-grid h4 {
  margin-top: 14px;
  color: var(--accent-dark);
}

.user-detail-role {
  border-top: 1px solid #edf2f7;
  padding-top: 10px;
  margin-top: 10px;
}

.user-detail-role h4 {
  margin-top: 0;
}

.user-detail-role > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.user-detail-role strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.user-detail-role ul,
.user-event-list {
  margin: 0;
  padding-left: 18px;
}

.user-detail-role li {
  margin: 3px 0;
}

.user-event-list {
  display: grid;
  gap: 6px;
  padding-left: 0;
  list-style: none;
}

.user-event-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #edf2f7;
  padding-bottom: 6px;
}

.user-event-list strong {
  color: var(--accent-dark);
}

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 12px;
  max-width: 1500px;
  margin: 0 auto;
}

.agenda-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.agenda-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 170px 130px minmax(180px, 1fr);
  gap: 12px;
  align-items: end;
}

.agenda-form label {
  display: grid;
  gap: 7px;
}

.agenda-form label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.agenda-notes-field {
  grid-column: 1 / -1;
}

.agenda-form textarea {
  min-height: 84px;
  resize: vertical;
}

.agenda-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.agenda-board {
  display: grid;
  gap: 12px;
}

.agenda-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.agenda-date {
  display: grid;
  justify-items: center;
  gap: 4px;
  border-radius: 8px;
  padding: 12px;
  color: var(--accent-dark);
  background: #e8f8ef;
  text-align: center;
}

.agenda-date strong {
  font-size: 1.05rem;
  font-weight: 1000;
}

.agenda-date span {
  font-size: 0.82rem;
  font-weight: 900;
}

.agenda-info {
  min-width: 0;
}

.agenda-info h3,
.agenda-info p {
  margin: 0;
}

.agenda-info h3 {
  overflow-wrap: anywhere;
  font-size: 1.08rem;
}

.agenda-info p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.agenda-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.sidebar,
.content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar {
  align-self: start;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(15, 159, 110, 0.08), rgba(255, 255, 255, 0) 160px),
    var(--panel);
}

label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.side-brand {
  display: grid;
  gap: 3px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.side-brand span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-brand strong {
  font-size: 1.08rem;
  line-height: 1;
}

.side-nav {
  display: grid;
  gap: 8px;
  padding: 14px 0 0;
}

.side-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  text-align: left;
}

.side-link span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: #e4f6ee;
  font-size: 0.72rem;
  font-weight: 900;
}

.side-link:hover,
.side-link.active {
  border-color: rgba(15, 159, 110, 0.28);
  color: var(--accent-dark);
  background: #eefaf4;
  box-shadow: inset 3px 0 0 var(--accent);
}

.side-link:hover span,
.side-link.active span {
  color: #fff;
  background: var(--accent);
}

.side-link.active:hover {
  background: #e2f6ec;
}

.logout-button {
  width: 100%;
  margin-top: 14px;
  color: var(--danger);
  background: #fdecec;
}

.logout-button:hover {
  color: #fff;
  background: var(--danger);
}

input[type="file"],
input[type="search"],
th input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

input[type="date"],
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

input[type="date"],
input[type="text"],
input[type="password"],
input[type="number"],
select {
  min-height: 44px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.formation-select {
  min-height: 138px;
}

.status,
.field-list p,
.empty {
  color: var(--muted);
  line-height: 1.5;
}

.status {
  min-height: 22px;
  margin: 0;
  font-size: 0.92rem;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.icon-button:hover {
  background: var(--accent-dark);
}

.icon-button.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.ghost {
  color: var(--ink);
  background: #eef2f7;
}

.ghost:hover {
  background: #dfe6f0;
}

.danger {
  width: 100%;
  margin-top: 20px;
  background: var(--danger);
}

.danger:hover {
  background: #9f3333;
}

.inline-danger {
  width: auto;
  margin-top: 0;
  margin-right: auto;
}

.content {
  min-width: 0;
  overflow: hidden;
}

.page-panel {
  display: none;
}

.page-panel.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.page-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.page-head .eyebrow {
  margin-bottom: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-form {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.report-form label {
  display: grid;
  gap: 8px;
}

.report-form input,
.report-form select,
.report-form textarea {
  min-height: 50px;
  border-color: #cad5e3;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.report-full {
  max-width: 560px;
}

.result-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: none;
}

.result-box {
  display: grid;
  gap: 8px;
  min-height: 118px;
  align-content: center;
  justify-items: center;
  border: 1px solid #cad5e3;
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #eefaf4);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  text-align: center;
}

.result-box span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-box output {
  color: var(--accent-dark);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.report-finish {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 4px 0 0;
}

.report-finish button {
  min-width: 220px;
  background: var(--accent-dark);
}

.report-finish button.ghost {
  color: var(--accent-dark);
  background: #fff;
}

.report-finish button:hover {
  background: #075f43;
}

.report-finish button.ghost:hover {
  background: #e8f8ef;
}

.summary-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.68);
}

.summary-preview {
  display: grid;
  gap: 12px;
  width: min(520px, 100%);
  max-height: 92vh;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  overflow: auto;
}

.summary-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-preview-head strong {
  font-size: 1rem;
  font-weight: 900;
}

.summary-preview-head button {
  min-height: 36px;
  padding: 0 12px;
}

.summary-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.summary-preview img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.report-team {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fafc);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.team-flag-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 88px;
  border: 1px solid #cad5e3;
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f3f7fb);
}

.team-flag {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  font-size: 2.5rem;
  line-height: 1;
}

.team-flag-card span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-team textarea,
.report-team input,
.report-team select {
  min-height: 50px;
  border-color: #cad5e3;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.report-team textarea:focus,
.report-team input:focus,
.report-team select:focus,
.report-full input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 159, 110, 0.14);
}

.formation-group {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.formation-group summary {
  cursor: pointer;
  list-style-position: inside;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.formation-group[open] {
  display: grid;
  gap: 14px;
}

.formation-group[open] summary {
  margin-bottom: 2px;
}

.formation-group label {
  font-size: 0.88rem;
}

.formation-group select {
  background: #fff;
}

.role-card {
  border-radius: 8px;
  padding: 10px;
  border: 1px solid transparent;
}

.role-card > span,
.role-card label > span,
.formation-slot span {
  font-weight: 900;
}

.role-goalkeeper {
  border-color: #f2d35d;
  background: #fff8d7;
}

.role-goalkeeper > span,
.role-goalkeeper label > span {
  color: #8a6700;
}

.role-defenders {
  border-color: #9bd7a7;
  background: #effaf0;
}

.role-defenders > label > span,
.role-defenders .formation-slot span {
  color: #176f2c;
}

.role-midfielders {
  border-color: #9fd4f5;
  background: #eef8ff;
}

.role-midfielders > label > span,
.role-midfielders .formation-slot span {
  color: #176c9e;
}

.role-forwards {
  border-color: #f4a5a5;
  background: #fff1f1;
}

.role-forwards > label > span,
.role-forwards .formation-slot span {
  color: #ad2e2e;
}

.formation-role {
  display: grid;
  gap: 10px;
}

.formation-role > label {
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: center;
}

.formation-slots {
  display: grid;
  gap: 10px;
}

.formation-slot {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.formation-module {
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--accent-dark);
  background: #e8f8ef;
  font-size: 0.88rem;
  font-weight: 900;
}

.formation-half {
  min-width: 0;
  border: 1px solid #d8e2ed;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.formation-half summary {
  cursor: pointer;
  list-style-position: inside;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.formation-half[open] {
  display: grid;
  gap: 12px;
}

.formation-half[open] summary {
  margin-bottom: 2px;
}

.match-event-group {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.match-event-group summary {
  cursor: pointer;
  list-style-position: inside;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.match-event-group[open] summary {
  margin-bottom: 10px;
}

.match-event-list {
  display: grid;
  gap: 10px;
}

.match-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.match-event-player {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-event-row label {
  gap: 5px;
}

.match-event-row label span {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--muted);
}

.event-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.total-goals {
  min-height: 44px;
  min-width: 104px;
  display: grid;
  align-content: center;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  text-align: right;
}

.total-goals span {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.total-goals small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.scorer-tools {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.match-entry {
  display: grid;
  grid-template-columns: minmax(180px, 240px) auto;
  gap: 8px;
  align-items: end;
}

.match-entry label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.match-entry input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.presence-tools {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.presence-tools input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

#match-points-import-form {
  grid-template-columns: minmax(220px, 420px) auto minmax(180px, 1fr);
}

.presence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.presence-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: #fff;
}

.presence-table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

.table-scroll-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-scroll-controls button {
  min-width: 76px;
}

.scroll-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.scroll-toggle input {
  width: 16px;
  height: 16px;
}

.floating-table-scroll-controls {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 80;
  display: none;
  transform: translateX(-50%);
  margin: 0;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
}

body[data-active-page="field-presences"] .floating-table-scroll-controls[data-floating-scroll="field-presence"],
body[data-active-page="match-points"] .floating-table-scroll-controls[data-floating-scroll="match-points"] {
  display: flex;
}

body[data-hide-floating-scroll-field-presence="1"] .floating-table-scroll-controls[data-floating-scroll="field-presence"],
body[data-hide-floating-scroll-match-points="1"] .floating-table-scroll-controls[data-floating-scroll="match-points"] {
  display: none;
}

.presence-table {
  min-width: 1120px;
  width: max-content;
}

.presence-table th:first-child,
.presence-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 190px;
  background: #fff;
}

.presence-table th:first-child {
  z-index: 5;
  background: #fafbfc;
}

.presence-table.ranking-table {
  min-width: 0;
  width: 100%;
}

.presence-table.ranking-table th,
.presence-table.ranking-table td {
  width: auto;
  min-width: 44px;
  padding-inline: 4px;
  text-align: center;
  vertical-align: middle;
}

.presence-table.ranking-table th:first-child,
.presence-table.ranking-table td:first-child {
  width: auto;
  min-width: 150px;
  text-align: left;
}

.presence-table.ranking-table .presence-total {
  min-width: 44px;
  text-align: center;
}

.presence-table .date-col {
  width: 68px;
  max-width: 68px;
  min-width: 68px;
  height: 54px;
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
}

.presence-table .date-col > span {
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.05;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.presence-table .date-col > span > span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.presence-cell {
  text-align: center;
}

.presence-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-height: 28px;
  border-radius: 999px;
  color: var(--muted);
  background: #eef2f7;
  font-size: 0.76rem;
  font-weight: 900;
}

.presence-badge.one {
  color: #7a4b00;
  background: #fff3cf;
}

.presence-badge.two {
  color: var(--accent-dark);
  background: #dff7ea;
}

.presence-badge.loss {
  color: #525866;
  background: #e5e9f0;
}

.presence-badge.win {
  color: #075f3f;
  background: #c9f5db;
}

.presence-badge.absent {
  color: var(--danger);
  background: #fde8e8;
}

.presence-total {
  min-width: 58px;
  text-align: center;
  font-weight: 900;
}

.presence-actions {
  min-width: 126px;
  text-align: right;
}

.presence-actions button + button {
  margin-left: 4px;
}

.presence-select {
  width: 42px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 4px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.scorer-table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

.match-history-board {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.match-card {
  display: grid;
  gap: 12px;
  border: 1px solid #cdd8e6;
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(15, 159, 110, 0.08), transparent 22%, transparent 78%, rgba(15, 159, 110, 0.08)),
    #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.match-card-date {
  justify-self: center;
  border: 1px solid #dce2eb;
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--accent-dark);
  background: #f8fafc;
  font-size: 0.82rem;
  font-weight: 900;
}

.match-scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.match-team {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
}

.match-flag {
  display: grid;
  place-items: center;
  width: 76px;
  height: 56px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 2.6rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.03);
}

.match-team-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-result {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 12px;
  min-width: 132px;
  border: 2px solid #172033;
  border-radius: 8px;
  padding: 10px 16px;
  color: #fff;
  background: linear-gradient(180deg, #26364f, #101827);
  font-size: 2.35rem;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.match-result-separator {
  color: #a7f3d0;
  font-size: 1.6rem;
}

.match-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #e7edf5;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.match-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.user-management-panel {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.user-management-note {
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.user-management-note {
  color: var(--muted);
  line-height: 1.5;
  background: #f8fafc;
}

.user-management-note strong {
  color: var(--ink);
}

.user-credentials-wrap {
  width: 100%;
  overflow-x: auto;
}

.user-credentials-table {
  width: 100%;
  min-width: 760px;
}

.user-credentials-table th:nth-child(4),
.user-credentials-table td:nth-child(4) {
  width: 96px;
  text-align: right;
}

.user-credentials-table input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
}

.scorer-table {
  width: 100%;
  min-width: 720px;
}

.scorer-table th,
.scorer-table td {
  text-align: center;
  vertical-align: middle;
}

.scorer-table th:nth-child(1),
.scorer-table td:nth-child(1) {
  width: 54px;
}

.scorer-table th:nth-child(3),
.scorer-table td:nth-child(3) {
  width: 72px;
}

.scorer-table th:nth-child(4),
.scorer-table td:nth-child(4) {
  width: 92px;
}

.scorer-table th:nth-child(5),
.scorer-table td:nth-child(5) {
  width: 120px;
}

.scorer-table th:nth-child(2),
.scorer-table td:nth-child(2) {
  text-align: left;
}

.rank,
.goal-total {
  font-weight: 900;
}

.goal-total {
  color: var(--accent-dark);
  font-size: 1rem;
}

.goal-history {
  display: none;
  margin-top: 8px;
  white-space: normal;
}

.goal-history.visible {
  display: block;
  max-width: 430px;
}

.card-history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  white-space: normal;
}

.card-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #f0d46b;
  border-radius: 8px;
  padding: 5px 8px;
  color: #6f5200;
  background: #fff7cf;
  font-size: 0.78rem;
  font-weight: 900;
}

.card-entry strong {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #5b4300;
  background: #f7d84a;
}

.scorer-actions {
  display: flex;
  gap: 6px;
}

.goal-history-panel {
  overflow: hidden;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.goal-history-head,
.goal-entry {
  display: grid;
  grid-template-columns: minmax(108px, 1fr) 78px 78px;
  align-items: center;
  width: 100%;
}

.goal-history-head {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: #f3f6f9;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.goal-entry {
  min-height: 38px;
  padding: 0 10px;
  border-top: 1px solid #e8edf3;
  color: var(--ink);
  background: #fff;
  font-size: 0.78rem;
  text-align: left;
}

.goal-entry:hover {
  background: #f8fafc;
}

.goal-entry-date {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.goal-entry-count {
  justify-self: start;
  min-width: 54px;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--accent-dark);
  background: #e8f8ef;
  font-weight: 900;
  text-align: center;
}

.goal-delete {
  justify-self: end;
  min-height: 26px;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--danger);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 900;
}

.goal-delete:hover {
  color: #fff;
  background: var(--danger);
}

.compact-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  background: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.toolbar-actions button {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

table {
  width: max-content;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: #454b57;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fafbfc;
}

.filters th {
  padding: 4px 4px;
  background: #ffffff;
}

.filters input {
  min-height: 26px;
  padding: 3px 4px;
  font-size: 0.78rem;
}

td {
  font-size: 0.88rem;
}

.name {
  font-weight: 800;
  white-space: nowrap;
}

[data-column-key="full_name"] {
  white-space: nowrap;
}

[data-column-key="sign"] {
  padding-right: 22px;
}

[data-column-key="role"] {
  padding-left: 14px;
  padding-right: 3px;
}

[data-column-key="grade"] {
  padding-left: 3px;
  padding-right: 3px;
}

[data-column-key="age"] {
  text-align: center;
}

.muted {
  color: var(--muted);
}

.empty {
  display: none;
  margin: 0;
  padding: 28px 18px;
}

.empty.visible {
  display: block;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(22, 24, 29, 0.28);
}

dialog::backdrop {
  background: rgba(22, 24, 29, 0.38);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.edit-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.edit-grid input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.view-help {
  padding: 12px 16px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.view-list {
  display: grid;
  gap: 8px;
  max-height: min(560px, 62vh);
  overflow: auto;
  padding: 16px;
}

.view-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.view-move {
  display: flex;
  gap: 4px;
}

.view-row label {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 96px;
  gap: 8px;
  align-items: center;
  font-size: 0.88rem;
}

.view-row input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
}

@media (max-width: 840px) {
  .login-page {
    align-items: end;
    background-position: center top;
    background-size: contain;
    background-attachment: scroll;
    padding-top: 46vh;
  }

  .login-card {
    padding: 22px;
  }

  .shell {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    text-align: left;
  }

  .user-page {
    padding: 14px;
  }

  .user-header {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .user-header .logout-button {
    width: 100%;
  }

  .user-stats-grid {
    grid-template-columns: 1fr;
  }

  .user-stat-card {
    min-height: 160px;
  }

  .user-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .user-last-match {
    grid-template-columns: 1fr;
  }

  .user-score-center {
    order: -1;
  }

  .user-match-row {
    grid-template-columns: 1fr;
  }

  .user-match-row button,
  .user-section-head button {
    width: 100%;
  }

  .user-detail-grid,
  .user-detail-role > div {
    grid-template-columns: 1fr;
  }

  .user-ranking-dialog {
    width: calc(100vw - 6px);
  }

  .user-ranking-head {
    padding: 10px;
  }

  .user-ranking-head strong {
    font-size: 0.95rem;
  }

  .user-ranking-table {
    min-width: 520px;
    font-size: 0.82rem;
  }

  .user-ranking-table th,
  .user-ranking-table td {
    padding: 8px 5px;
  }

  .user-ranking-table th:not(:nth-child(2)),
  .user-ranking-table td:not(:nth-child(2)) {
    width: 44px;
    min-width: 38px;
  }

  .user-ranking-table th:nth-child(2),
  .user-ranking-table td:nth-child(2) {
    min-width: 155px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .agenda-form,
  .agenda-card {
    grid-template-columns: 1fr;
  }

  .agenda-actions {
    justify-content: stretch;
  }

  .agenda-actions button,
  .agenda-form-actions button {
    flex: 1 1 140px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }

  .view-row,
  .view-row label {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .total-goals {
    text-align: left;
  }

  .match-entry {
    grid-template-columns: 1fr;
  }

  .presence-tools {
    grid-template-columns: 1fr;
  }

  .user-management-panel {
    grid-template-columns: 1fr;
  }

  .report-teams {
    grid-template-columns: 1fr;
  }

  .report-full {
    max-width: none;
  }

  .result-board {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .match-history-board {
    padding: 12px;
  }

  .match-scoreboard {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .match-result {
    justify-self: center;
    order: 2;
  }

  .match-team-away {
    order: 3;
  }

  .match-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .match-card-actions {
    justify-content: stretch;
  }

  .match-card-actions button {
    flex: 1 1 160px;
  }

  .formation-role > label,
  .formation-slot,
  .match-event-row {
    grid-template-columns: 1fr;
  }
}
