/* Components: buttons, badges, panels, tables, forms, tabs, notices, dialogs and toasts. */

.dark {
  background: var(--ok-bg);
  color: var(--muted);
}

.person {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: none;
  text-align: left;
}

.person strong {
  display: block;
}

.person small {
  display: block;
  font-size: var(--text-small);
  color: var(--muted);
  margin-top: 5px;
}

.table-foot {
  padding: 15px 22px;
  color: var(--muted);
  font-size: var(--text-small);
}

.mobile-menu {
  display: none;
}

.card-icon {
  width: 14px;
  height: 19px;
  display: block;
  border-radius: 2px;
  transform: rotate(12deg);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  background: var(--ok-dot);
}

.panel-head .small {
  font-size: var(--text-small);
  letter-spacing: 1.2px;
  color: var(--muted);
}

.round-icon {
  display: flex;
  width: 37px;
  height: 37px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius);
}

.mint {
  background: #eaf0ff;
  color: #5476c9;
}

.avatar {
  background: var(--surface-3);
  color: var(--navy-3);
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-small);
  flex-shrink: 0;
  font-weight: 700;
}

.person small,
.table-foot {
  color: var(--muted);
}

.doc-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-small);
  color: var(--warn);
}

.doc-check.ok {
  color: var(--ok);
}

.card-icon.amarelo {
  background: var(--card-yellow);
}

.card-icon.vermelho {
  background: var(--card-red);
}

.sidebar nav a.active {
  background: var(--blue);
  color: white;
}

.sidebar nav a.active:before {
  content: '';
  position: absolute;
  left: -19px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--yellow);
}

/* A pitch's measured lines (shared/_pitch_markings) over whatever draws the
   grass: they fill their frame and keep a hairline at any size. */
.pitch-markings { position: absolute; inset: 0; width: 100%; height: 100%; }
.pitch-markings * { vector-effect: non-scaling-stroke; }

/* A switch between two views of one page (e.g. "Bills" | "Who owes"):
   a segmented control, so it doesn't look like the filter tabs below it. */
.view-switch {
  display: inline-flex;
  flex-direction: row;
  gap: var(--space-1);
  padding: var(--space-1);
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.view-switch a {
  padding: 9px 18px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 700;
  text-align: center;
}

.view-switch a:hover {
  color: var(--ink);
  background: var(--bg);
}

.view-switch a.selected {
  color: var(--on-navy);
  background: var(--navy);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.inline-form input:not([type=submit]) {
  font-size: var(--text-small);
  width: 110px;
  padding: var(--space-2);
}

.inline-form select {
  font-size: var(--text-small);
  width: 155px;
  padding: var(--space-2);
}

.inline-form input[type=submit] {
  width: auto;
}

.document-field {
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin: var(--space-3) 0;
}

.document-field .checkbox {
  margin: 0 0 10px;
}

.document-field input[type=file] {
  font-size: var(--text-small);
  padding: var(--space-2);
  background: var(--surface);
}

@media (max-width: 1200px) {

  .panel-head .small {
    display: none;
  }

  .sidebar nav a.active:before {
    left: -15px;
  }
}

@media (max-width: 700px) {
  .mobile-menu {
    display: inline-flex;
  }

}

@media (max-width: 700px) {
  .view-switch {
    display: flex;
  }

  .view-switch a {
    flex: 1;
  }

}

/* Player import preview: every row of the file, editable, with its problems under the cells. */
.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.import-preview td {
  padding: var(--space-2) 10px;
  vertical-align: top;
}

.import-preview input[type=text] {
  min-width: 110px;
}

.import-preview [aria-invalid=true] {
  border-color: var(--card-red);
  background: var(--problem-bg);
}

/* The contents, not the cells: a sticky cell keeps its background over the columns scrolled under it. */
.import-preview tr.excluded td > * {
  opacity: .55;
}

/* Line, result, exclude and athlete stay in view while the other columns scroll. */
@media (min-width: 760px) {
  .import-preview :is(th, td):nth-child(-n+4) {
    position: sticky;
    z-index: 1;
    background: white;
  }

  .import-preview :is(th, td):nth-child(-n+3) {
    box-sizing: border-box;
    width: var(--w);
    min-width: var(--w);
    max-width: var(--w);
    white-space: normal;
  }

  .import-preview :is(th, td):nth-child(1) { --w: 64px; left: 0; }
  .import-preview :is(th, td):nth-child(2) { --w: 128px; left: 64px; }
  .import-preview :is(th, td):nth-child(3) { --w: 76px; left: 192px; }

  .import-preview :is(th, td):nth-child(4) {
    left: 268px;
    box-shadow: inset -1px 0 var(--line);
  }
}

/* The problems above the preview, each leading to its cell. */
.import-problems {
  margin: 0 0 var(--space-4);
  padding: 14px 18px;
}

.import-problems h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-heading);
}

.import-problems ul {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-small);
  line-height: 1.7;
}

.import-problems a {
  color: var(--problem);
}

.cell-suggested {
  display: block;
  margin-top: var(--space-1);
  color: var(--blue);
  font-size: var(--text-small);
}

.cell-problem {
  display: block;
  max-width: 220px;
  margin-top: var(--space-1);
  color: var(--problem);
  font-size: var(--text-small);
  white-space: normal;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--space-4);
}

.import-hint {
  color: var(--muted);
  font-size: var(--text-small);
  text-align: right;
}

tr.muted td {
  opacity: .6;
}

/* The payments lists (By athlete, By charge). Below the list breakpoint
   (1100px) each row is a card: the athlete first, then each value beside its
   label (the td's data-label), then the row's button across the card, so
   nothing sits off-screen. */
/* On a wide screen a row is one line: the team's badge stays beside the name. */
@media (min-width: 701px) {
  .money-table .team-line { flex-wrap: nowrap; white-space: nowrap; }
}

.money-table .row-actions {
  text-align: right;
}

@media (max-width: 1100px) {
  .money-table {
    overflow: visible;
  }

  .money-table thead {
    display: none;
  }

  .money-table table,
  .money-table tbody,
  .money-table tr,
  .money-table td {
    display: block;
  }

  .money-table table {
    white-space: normal;
  }

  .money-table tr {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
  }

  .money-table td {
    padding: 3px 0;
    border: 0;
  }

  .money-table td[data-label] {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    text-align: right;
  }

  .money-table td[data-label]>.block {
    flex-basis: 100%;
  }

  .money-table td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--text-small);
    text-align: left;
  }

  .money-table .row-actions:not(:empty) {
    padding-top: 10px;
  }

  .money-table .row-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* One semantic table on wide screens; complete, labelled record cards below
   the list breakpoint (1100px), where an open sidebar leaves too little room.
   Keep the header available to assistive technology and retain a single set
   of links/forms, so filters and dialogs work identically at either size. */
@media screen and (max-width: 1100px) {
  .record-table {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .record-table table,
  .record-table tbody {
    display: block;
    width: 100%;
    white-space: normal;
  }

  .record-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .record-table tbody {
    display: grid;
    gap: var(--space-3);
  }

  .record-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    padding: 18px var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .record-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--ink);
    font-size: var(--text-body);
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .record-table td:first-child,
  .record-table .record-actions {
    grid-column: 1 / -1;
  }

  .record-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: var(--text-small);
    font-weight: 500;
  }

  .record-table td strong,
  .record-table td .text-btn {
    font-size: var(--text-control);
  }

  .record-table td:first-child strong,
  .record-table td:first-child > .text-btn {
    font-size: var(--text-control);
  }

  .record-table td small {
    font-size: var(--text-small);
    line-height: 1.5;
  }

  .record-table .person,
  .record-table .kit-product {
    min-width: 0;
    white-space: normal;
  }

  .record-table .person > span:last-child {
    min-width: 0;
  }

  .record-table .badge,
  .record-table .doc-check {
    font-size: var(--text-small);
    line-height: 1.4;
  }

  .record-table td .badge {
    max-width: 100%;
    white-space: normal;
  }

  .record-table .record-actions > .text-btn,
  .record-table .record-actions > form > .text-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    padding: 10px var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: var(--text-control);
  }

  .record-table .record-actions > form + * {
    margin-top: var(--space-2);
  }

  .record-table .table-foot {
    margin-top: var(--space-3);
    white-space: normal;
  }
}

/* The athlete form (enrollments/_form) in the form panel (blocks.css): the
   panel's head stays at the top and the actions at the foot while the
   form's body scrolls, edge to edge. Each part under a small grey heading
   over a thin line; the season's documents one line each, with their state
   and "Anexar" as chips. On a phone links to each part under the title,
   one column and the save button across the foot. */
.modal .athlete-form { display: flex; flex: 1; flex-direction: column; gap: 0; min-height: 0; margin: 0 -32px -28px; }
.athlete-form-body { position: relative; flex: 1; min-height: 0; overflow: auto; padding: var(--space-1) 32px var(--space-5); }
.athlete-form label { margin: 0; font-weight: 600; gap: 6px; }
.athlete-form .checkbox { color: var(--ink); font-weight: 400; }
.athlete-form .form-grid { gap: 14px; }
.athlete-form .helper { margin: 0; }
.athlete-part { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: var(--space-2); }
.part-heading { margin: 26px 0 -2px; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.athlete-part:first-of-type .part-heading { margin-top: 20px; padding-top: 0; border-top: 0; }
.team-hint { margin: 8px 0 0; color: var(--muted); font-size: var(--text-small); line-height: 1.5; }
.team-hint:not(:has(small:not([hidden]))) { display: none; }
.kit-grid, .contact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.guardian-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.guardian-fields + .guardian-fields { margin-top: var(--space-2); }
.guardian-fields legend { margin-bottom: 6px; padding: 0; color: var(--ink); font-size: var(--text-label); font-weight: 600; }
.guardian-fields .helper { overflow-wrap: anywhere; }
.more-guardians > summary { display: inline-flex; align-items: center; min-height: 36px; color: var(--blue); font-size: var(--text-label); font-weight: 600; list-style: none; cursor: pointer; }
.more-guardians > summary::-webkit-details-marker { display: none; }
.more-guardians > summary:hover { color: var(--blue-deep); }
.more-guardians[open] > summary { display: none; }
.athlete-part > .more-guardians:not([open]) { margin-top: -6px; }

.doc-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line-soft); font-size: var(--text-label); }
.doc-line + .doc-line { margin-top: -14px; }
.part-heading + .doc-line { border-top: 0; }
.doc-name { display: flex; flex: 1 1 10rem; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.doc-name :is(small, label, a) { color: var(--muted); font-size: var(--text-small); font-weight: 400; }
.doc-name a { color: var(--blue); }
.doc-name .checkbox { margin-top: var(--space-1); color: var(--ink); }
.athlete-form .doc-date { width: 150px; min-height: 38px; padding: 6px 10px; }
.doc-chip { display: inline-flex; flex: none; flex-direction: row; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); font-size: var(--text-small); font-weight: 600; white-space: nowrap; cursor: pointer; }
.athlete-form .doc-chip { gap: 6px; }
.doc-chip:hover { background: var(--blue-soft); }
.doc-chip:has(:focus-visible) { outline: 3px solid var(--blue-line); outline-offset: 1px; }
.doc-chip:has([aria-invalid="true"]) { outline: 2px solid var(--problem); outline-offset: 1px; }
/* "Confirmada": the chip holds a real checkbox, so the box shows the state
   and the words stay the same. The state under the paper's name is
   ink-coloured while the paper still needs the office. */
.doc-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }
.doc-name .doc-status { color: var(--ink); font-weight: 600; }
.doc-line[data-state=confirmed] .doc-status { color: var(--muted); font-weight: 400; }
/* The exam's line: its name on top, then the date and the chips on the
   right, like the other lines' chips. */
.doc-line:has(.doc-date) .doc-name { flex-basis: 100%; }
.athlete-form .doc-line .doc-date { margin-left: auto; }
.doc-line > .field-error { flex-basis: 100%; margin: 0; }
[data-attach-target=name] { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }

.athlete-tabs { display: none; }
.athlete-form .form-actions { justify-content: flex-end; gap: 10px; margin: 0; padding: var(--space-4) 32px var(--space-5); border-top: 1px solid var(--line-soft); background: var(--surface); }

@media (max-width: 700px) {
  .modal .athlete-form { margin: 0 -20px -28px; }
  .athlete-form-body { padding: 0 20px var(--space-5); }
  .athlete-tabs { display: flex; gap: var(--space-4); margin: 10px 20px 0; border-bottom: 1px solid var(--line); }
  .athlete-tabs a { display: flex; align-items: center; min-height: 32px; margin-bottom: -1px; padding-bottom: 6px; border-bottom: 2px solid transparent; color: var(--muted); font-size: var(--text-small); font-weight: 600; white-space: nowrap; }
  .athlete-form:not(:has(.athlete-part:target)) .athlete-tabs a:first-child,
  .athlete-form:has(#athlete-part:target) .athlete-tabs a[href="#athlete-part"],
  .athlete-form:has(#family-part:target) .athlete-tabs a[href="#family-part"],
  .athlete-form:has(#emergency-part:target) .athlete-tabs a[href="#emergency-part"],
  .athlete-form:has(#documents-part:target) .athlete-tabs a[href="#documents-part"] { border-bottom-color: var(--ink); color: var(--ink); }
  .part-heading, .athlete-part:first-of-type .part-heading { margin: 22px 0 -4px; padding-top: 0; border-top: 0; }
  .kit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kit-grid > :last-child { grid-column: 1 / -1; }
  .contact-grid, .guardian-fields .form-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-name { flex-basis: 100%; }
  .avatar + .doc-name { flex-basis: calc(100% - 47px); }
  .athlete-form .doc-date { flex: 1; width: auto; }
  .athlete-form .form-actions { padding: var(--space-3) 20px var(--space-5); }
  .athlete-form .form-actions > .btn:not(.primary) { display: none; }
  .athlete-form .form-actions > .btn.primary { flex: 1; min-height: 52px; font-size: var(--text-input); }
}

.document-form.section-card { padding: var(--space-5); }
.document-form .form-actions { margin-top: var(--space-2); }
@media (max-width: 700px) {

  .document-form.section-card { padding: var(--space-4); }
}

/* On phones and small tablets a plain text link in a heading, a fact list or
   a line of text gets a 24px-tall tap area. Inline padding grows the area
   without moving the text. */
@media (max-width: 800px) {
  :where(h2, h3, dt, dd, p, small, strong, .fact-missing)>a:not([class]) { padding-block: 5px; }
  /* A disclosure's summary line is a tap target too. */
  summary { min-height: 24px; }

}
