/* Reusable pieces. «М» — ported from the approved mockup A; «новое» — designed at
 * S3 in the mockup's language (same tokens, 2px radius, mono labels, gate box).
 * Every interactive piece carries hover / focus / active / disabled. */

/* ── buttons (М) ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 700 1rem/1 var(--font-body); text-decoration: none; text-align: center;
  border: 1.5px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.btn .icon { width: 18px; height: 18px; transition: transform var(--dur-base) var(--ease); }
.btn:hover .icon--go { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--color-brand); color: var(--color-on-brand); }
.btn--primary:hover { background: var(--color-brand-hover); }
.btn--primary:active { background: var(--color-brand-active); }
.btn--ghost { border-color: var(--line-dark-strong); color: var(--color-text); background: transparent; }
.btn--ghost:hover { border-color: var(--color-text); background: var(--color-surface); }
.btn--ink { background: var(--color-ink); color: var(--color-text); }
.btn--ink:hover { background: var(--color-ink-hover); }
.btn--line-light { border-color: var(--line-light-strong); color: var(--color-ink); background: transparent; }
.btn--line-light:hover { border-color: var(--color-ink); background: var(--color-surface-white); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: var(--fs-small); }
.btn.is-loading { pointer-events: none; opacity: .7; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── tag / status label (М) ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  font: 600 var(--fs-label)/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
  padding: 8px 10px; border: 1px solid currentColor; white-space: nowrap;
}
.tag .icon { width: 15px; height: 15px; }
.tag--data { color: var(--color-data); }
.tag--accent { color: var(--color-brand); }
.tag--muted { color: var(--color-muted); }
.tag--ok, .sec--light .tag--data { color: var(--color-data-light); }
.sec--light .tag--accent { color: #B8440F; }                 /* orange as text on light: 4.9:1 */
.sec--light .tag--muted { color: var(--color-muted-light); }

/* ── gate box — signature 1 (М) ───────────────────────────────────────── */
.box {
  display: grid; place-items: center; width: var(--box); height: var(--box); flex: none;
  border: 1.5px solid var(--color-text); font: 600 1.375rem/1 var(--font-mono);
  color: var(--color-text); background: transparent; position: relative;
}
.box::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 5px; height: 2px; background: currentColor; opacity: .35; }
.box--on { background: var(--color-brand); border-color: var(--color-brand); color: var(--color-on-brand); }
.box--sm { width: 40px; height: 40px; font-size: 1rem; }
.box--md { width: 52px; height: 52px; font-size: 1.125rem; }
.box--lg { width: 84px; height: 84px; font-size: 1.75rem; }
.sec--light .box, .on-light .box { border-color: var(--color-ink); color: var(--color-ink); }
.sec--light .box--on { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-surface-light); }

/* ── lanes — signature 2 (М) ──────────────────────────────────────────── */
.gate__head, .lane {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1.3fr) 150px 44px; gap: var(--space-24);
}
.gate__head {
  padding: 0 0 10px; font: .75rem var(--font-mono); color: var(--color-muted);
  letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line-dark-strong);
}
.gate__list li { border-bottom: 1px solid var(--line-dark); }
.lane { align-items: center; min-height: 92px; padding: 14px 0; text-decoration: none; position: relative; transition: background var(--dur-base); }
.lane::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  background: var(--color-brand); transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur-slow) var(--ease);
}
.lane:hover { background: linear-gradient(90deg, var(--color-surface), transparent 85%); }
.lane:hover::after, .lane:focus-visible::after { transform: scaleX(1); }
.lane__title {
  font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: var(--fs-lane);
  line-height: 1.05; text-transform: uppercase; letter-spacing: .005em;
}
.lane__data { font-family: var(--font-mono); font-size: var(--fs-small); line-height: 1.45; }
.lane__data b { font-weight: 600; }
.lane__go {
  display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-dark-strong);
  transition: background var(--dur-base), color var(--dur-base), border-color var(--dur-base);
}
.lane__go .icon { transition: transform var(--dur-base) var(--ease); }
.lane:hover .lane__go, .mr:hover .lane__go, .row-link:hover .lane__go {
  background: var(--color-brand); border-color: var(--color-brand); color: var(--color-on-brand);
}
.lane:hover .lane__go .icon { transform: translateX(2px); }
.sec--light .lane__go { border-color: var(--line-light-strong); }

/* ── next reunião card (М) ────────────────────────────────────────────── */
.next { background: var(--color-surface); border-top: 3px solid var(--color-brand); }
.next__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding: 20px 28px; border-bottom: 1px solid var(--line-dark);
}
.next__head h2, .next__head h3 {
  font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.5rem;
  text-transform: uppercase; line-height: 1.1;
}
.next__head h2 span, .next__head h3 span { color: var(--color-muted); font-weight: 600; }
.next__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.stat { padding: 24px 28px 26px; border-right: 1px solid var(--line-dark); }
.stat:last-child { border-right: 0; }
.stat dt {
  font: var(--fs-label) var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted); display: flex; align-items: center; gap: 8px;
}
.stat dt .icon { width: 16px; height: 16px; }
.stat dd { margin: 14px 0 0; font: 500 var(--fs-stat)/1 var(--font-mono); letter-spacing: -.02em; }
.stat dd small { display: block; text-transform: none; font-size: var(--fs-small); letter-spacing: 0; color: var(--color-muted); margin-top: 10px; font-weight: 400; }
.stat dd.stat__status {
  font: 800 clamp(1.75rem, 1.2rem + 1.4vw, 2.5rem)/1 var(--font-display); font-stretch: 80%;
  text-transform: uppercase; letter-spacing: 0; color: var(--color-data);
}
.next__docs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-dark); }
.doc {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px;
  padding: 12px 28px; text-decoration: none; border-right: 1px solid var(--line-dark);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.doc:last-child { border-right: 0; }
.doc span { display: flex; flex-direction: column; gap: 3px; font-weight: 600; font-size: var(--fs-small); line-height: 1.25; }
.doc small { font: 400 var(--fs-label) var(--font-mono); color: var(--color-muted); }
.doc .icon { width: 18px; height: 18px; color: var(--color-muted); transition: transform var(--dur-base) var(--ease), color var(--dur-base); }
.doc:hover { background: var(--color-surface-2); }
.doc:hover .icon { color: var(--color-brand); transform: translate(2px, -2px); }

/* ── modalidades chips (М) ────────────────────────────────────────────── */
.mods { display: flex; flex-wrap: wrap; gap: 6px; max-width: 520px; justify-content: flex-end; }
.mods li { font: 500 var(--fs-label)/1 var(--font-mono); padding: 8px 10px; border: 1px solid var(--line-light-strong); color: var(--color-ink); }
.mods .mods__lbl {
  width: 100%; text-align: right; font-size: var(--fs-micro); letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted-light); border: 0; padding: 0 0 4px;
}

/* ── tabs + panels (М) ────────────────────────────────────────────────── */
.tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-light-strong); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 12px 26px 12px 0; margin-right: 26px;
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer;
  color: var(--color-muted-light); font: inherit; text-align: left; flex: none;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.tab .box { width: 44px; height: 44px; font-size: 1.0625rem; border-color: currentColor; color: inherit; }
.tab__txt { display: flex; flex-direction: column; gap: 4px; }
.tab__txt strong { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.25rem; text-transform: uppercase; line-height: 1; }
.tab__txt span { font-family: var(--font-mono); font-size: .875rem; }
.tab__dist { font-style: normal; }
.tab:hover { color: var(--color-ink); }
.tab[aria-selected="true"] { color: var(--color-ink); border-bottom-color: var(--color-brand); }
.tab:focus-visible { outline-offset: -3px; }   /* .tabs scrolls sideways and would clip an outer ring */
.tab[aria-selected="true"] .box { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-surface-light); }
.tabs__more {
  margin-left: auto; align-self: stretch; display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-weight: 600; font-size: var(--fs-small); color: var(--color-ink); text-decoration: none; white-space: nowrap; padding-left: 12px; flex: none;
}
.tabs__more:hover { color: var(--color-data-light); }
.tabs__more .icon { width: 18px; height: 18px; }
/* text tabs (new): same rule, no box — for Próximas / Hoje / Realizadas */
.tabs--text .tab { min-height: 56px; font: 800 1.125rem/1 var(--font-display); font-stretch: 80%; text-transform: uppercase; }
.tabs--text .tab .count { font: 500 var(--fs-label)/1 var(--font-mono); color: var(--color-muted-light); }
.tabs--dark .tab .count { color: var(--color-muted); }
.tabs--dark { border-bottom-color: var(--line-dark-strong); }
.tabs--dark .tab { color: var(--color-muted); }
.tabs--dark .tab:hover, .tabs--dark .tab[aria-selected="true"] { color: var(--color-text); }

.panel { padding-top: 28px; }
.panel__meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: end; margin-bottom: 22px; }
.panel__meta h3 { font-family: var(--font-display); font-stretch: 85%; font-weight: 800; font-size: var(--fs-h3); line-height: 1.1; }
.panel__meta p { margin: 8px 0 0; color: var(--color-muted-light); }
.panel__note { margin: 16px 0 0; font-size: var(--fs-small); color: var(--color-muted-light); display: flex; gap: 8px; align-items: flex-start; }
.panel__note .icon { width: 18px; height: 18px; margin-top: 2px; }
.sec:not(.sec--light) .panel__note { color: var(--color-muted); }
.spec { display: flex; flex-wrap: wrap; font: var(--fs-small) var(--font-mono); border: 1px solid var(--line-light-strong); background: var(--color-surface-white); }
.spec span { padding: 10px 14px; border-right: 1px solid var(--line-light); white-space: nowrap; }
.spec span:last-child { border-right: 0; }
.spec b { font-weight: 600; }
.remate {
  display: inline-flex; align-items: center; gap: 8px; font: 600 var(--fs-label)/1 var(--font-mono);
  text-transform: uppercase; letter-spacing: .04em; color: var(--color-data-light);
}
.spec .remate { border-left: 0; }

/* ── entries / results table (М) → cards ≤ 860 ────────────────────────── */
.tbl-wrap { background: var(--color-surface-white); border: 1px solid var(--line-light); }
.tbl { width: 100%; border-collapse: collapse; font-size: 1rem; color: var(--color-ink); }
.tbl th {
  font: 500 var(--fs-micro)/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-muted-light); text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line-light-strong); white-space: nowrap;
}
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line-light); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--dur-fast); }
.tbl tbody tr:hover { background: var(--color-row-hover); }
.tbl .num { width: 72px; }
.tbl .box { width: 40px; height: 40px; font-size: 1rem; border-color: var(--color-ink); color: var(--color-ink); }
.horse { font-family: var(--font-display); font-stretch: 85%; font-weight: 800; font-size: 1.0625rem; letter-spacing: .01em; display: block; }
.fil { display: block; font-size: .875rem; color: var(--color-muted-light); margin-top: 2px; }
.tbl .m { font-family: var(--font-mono); font-size: var(--fs-small); }
.tbl .r { text-align: right; }
.camp { font-family: var(--font-mono); font-size: var(--fs-small); letter-spacing: .04em; }
.tbl .pos { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid var(--color-ink); font: 600 var(--fs-small)/1 var(--font-mono); }
.tbl tr.win .pos { background: var(--color-brand); border-color: var(--color-brand); color: var(--color-on-brand); }
.tbl tr.win .horse { font-size: 1.1875rem; }
.hn { display: none; }

/* ── retrospecto: issue, archive, horse form (М) ──────────────────────── */
.retro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.retro__issue { display: flex; align-items: center; gap: 18px; margin: 28px 0; }
.retro__issue .box { border-color: var(--color-brand); color: var(--color-brand); }
.retro__issue b { display: block; font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.375rem; text-transform: uppercase; }
.retro__issue span { font-family: var(--font-mono); color: var(--color-muted); font-size: var(--fs-small); }
.retro__fields { margin: 0 0 28px; color: var(--color-muted); max-width: 46ch; }
.archive { margin: 28px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line-dark); }
.archive a {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px 0 0;
  text-decoration: none; font: var(--fs-small) var(--font-mono); border-bottom: 1px solid var(--line-dark); transition: color var(--dur-fast);
}
.archive li:nth-child(odd) a { margin-right: 20px; }
.archive a span { color: var(--color-muted); }
.archive a:hover { color: var(--color-brand); }
.form { border: 1px solid var(--line-dark-strong); background: var(--color-bg); }
.form__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; padding: 20px 24px; border-bottom: 1px solid var(--line-dark-strong); }
.form__head b { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1; }
.form__head span { font: .875rem var(--font-mono); color: var(--color-muted); }
.form__meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line-dark); margin: 0; }
.form__meta div { padding: 14px 24px; border-right: 1px solid var(--line-dark); }
.form__meta div:last-child { border-right: 0; }
.form__meta dt { font: 500 var(--fs-micro)/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted); }
.form__meta dd { margin: 6px 0 0; font-size: var(--fs-small); }
.run { display: grid; grid-template-columns: 110px 56px 80px minmax(0, 1fr) auto; gap: 16px; align-items: stretch; padding: 16px 24px; border-bottom: 1px solid var(--line-dark); font: var(--fs-small) var(--font-mono); }
.run:last-child { border-bottom: 0; }
.run > :not(.pos) { display: flex; align-items: center; }   /* equal cells: one visual row */
.run .pos { display: grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid var(--color-text); font-weight: 600; }
.run .pos--1 { background: var(--color-brand); border-color: var(--color-brand); color: var(--color-on-brand); }
.run .t { font-size: 1.25rem; font-weight: 500; }

/* ── results card + rateios (М) ───────────────────────────────────────── */
.res { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.res__card { background: var(--color-surface-white); border: 1px solid var(--line-light); color: var(--color-ink); }
.res__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 24px; padding: 22px 24px; border-bottom: 1px solid var(--line-light-strong); }
.res__top h3 { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1; }
.res__top p { margin: 8px 0 0; font: var(--fs-small) var(--font-mono); color: var(--color-muted-light); }
.res__card .tbl-wrap { border: 0; }
.time { text-align: right; }
.time small { display: block; font: 500 var(--fs-micro)/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted-light); }
.time b { display: block; font: 500 2.5rem/1 var(--font-mono); letter-spacing: -.02em; margin-top: 8px; }
.rateios { background: var(--color-ink); color: var(--color-text); border-top: 3px solid var(--color-brand); }
.rateios__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line-dark); }
.rateios__head h3 { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.5rem; text-transform: uppercase; line-height: 1; }
.rateios__head p { margin: 6px 0 0; font: var(--fs-label) var(--font-mono); color: var(--color-muted); }
.rateios .tag--data { color: var(--color-data); }
.rateios dl { margin: 0; }
.rt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line-dark); }
.rt dt { font-weight: 600; }
.rt dt span { font-family: var(--font-mono); font-weight: 400; color: var(--color-muted); margin-left: 6px; }
.rt dd { margin: 0; font: 500 1.375rem/1 var(--font-mono); }
.rt dd::before { content: "R$ "; font-size: var(--fs-label); color: var(--color-muted); }
.rateios__foot { padding: 16px 22px; font-size: var(--fs-small); color: var(--color-muted); display: flex; gap: 10px; align-items: flex-start; }
.rateios__foot .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--color-data); }

/* results strip row (М .mr) */
.more-races { margin-top: 24px; border-top: 1px solid var(--line-light-strong); }
.mr {
  display: grid; grid-template-columns: 72px minmax(0, 1.1fr) minmax(0, 1.2fr) 120px minmax(0, 1.4fr) 44px; gap: 20px;
  align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line-light); text-decoration: none; color: var(--color-ink);
  transition: background var(--dur-fast);
}
.mr:hover { background: var(--color-surface-white); }
.mr .box { width: 52px; height: 52px; border-color: var(--color-ink); color: var(--color-ink); font-size: 1.125rem; }
.mr__p b { display: block; font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.25rem; text-transform: uppercase; line-height: 1.1; }
.mr__p span { font: .875rem var(--font-mono); color: var(--color-muted-light); }
.mr__w small, .mr__t small, .mr__r small { display: block; font: 500 var(--fs-micro)/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted-light); margin-bottom: 4px; }
.mr__w .horse { font-size: 1.125rem; }
.mr__w span:not(.horse) { display: block; font-size: .875rem; color: var(--color-muted-light); }
.mr__t b { font: 500 1.375rem/1 var(--font-mono); }
.mr__r { font: .875rem/1.6 var(--font-mono); }
.mr .lane__go { border-color: var(--line-light-strong); }
.res__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }
.pending { display: flex; align-items: center; gap: 12px; font-size: var(--fs-small); color: var(--color-muted-light); }
.pending .icon { color: var(--color-data-light); }
.pending b { color: var(--color-ink); }

/* ── fields (новое) ───────────────────────────────────────────────────── */
.field { display: grid; gap: 8px; }
.field__label { font: 500 var(--fs-micro)/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted); }
.field input:not(.visually-hidden):not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line-dark-strong); border-radius: var(--radius-sm);
  background-color: var(--color-bg); color: var(--color-text); font-size: 1rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.field select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field textarea { min-height: 140px; padding-block: 12px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-brand); box-shadow: var(--focus-ring); outline: none; }
.field input:disabled, .field select:disabled { color: var(--color-disabled); cursor: not-allowed; }
.field__hint { font-size: var(--fs-label); color: var(--color-muted); }
.field__error { color: var(--color-error); font-size: var(--fs-small); }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field [aria-invalid="true"] { border-color: var(--color-error); }
.field--check { grid-template-columns: auto 1fr; align-items: start; gap: 12px; }
.field--check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--color-brand); }
.field--check .field__label { font: inherit; letter-spacing: 0; text-transform: none; color: inherit; font-size: var(--fs-small); }
.on-light .field__label, .sec--light .field__label { color: var(--color-muted-light); }
.on-light .field input:not([type="checkbox"]):not([type="radio"]), .on-light .field select, .on-light .field textarea,
.sec--light .field input:not([type="checkbox"]):not([type="radio"]), .sec--light .field select, .sec--light .field textarea {
  background-color: var(--color-surface-white); color: var(--color-ink); border-color: var(--line-light-strong);
}
.on-light .field input:hover, .sec--light .field input:hover, .sec--light .field select:hover, .sec--light .field textarea:hover { border-color: var(--color-ink); }
.sec--light .field__error, .on-light .field__error { color: var(--color-error-light); }
.sec--light .field [aria-invalid="true"] { border-color: var(--color-error-light); }
.form__error { color: var(--color-error); font-size: var(--fs-small); }
.form__success { color: var(--color-success); }
.sec--light .form__error { color: var(--color-error-light); }
.sec--light .form__success { color: var(--color-success-light); }

/* ── filter bar (новое) ───────────────────────────────────────────────── */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px 16px; align-items: end;
  padding: 18px 20px; border: 1px solid var(--line-light); background: var(--color-surface-white); margin-bottom: 24px;
}
.filters .field { gap: 6px; }
.filters__reset { justify-self: start; }
.filters__count { grid-column: 1 / -1; order: -1; font: var(--fs-label) var(--font-mono); color: var(--color-muted-light); }   /* the count heads the filter box */
.sec:not(.sec--light) .filters { background: var(--color-surface); border-color: var(--line-dark); }
.sec:not(.sec--light) .filters__count { color: var(--color-muted); }

/* ── accordion (новое) — FAQ, glossário ───────────────────────────────── */
.acc { border-top: 1px solid var(--line-light-strong); }
.acc__item { border-bottom: 1px solid var(--line-light); }
.acc__btn {
  display: grid; grid-template-columns: minmax(0, 1fr) 24px; gap: 16px; align-items: center; width: 100%; min-height: 60px;
  padding: 16px 0; background: none; border: 0; text-align: left; cursor: pointer; font: 700 1.0625rem/1.35 var(--font-body);
  transition: color var(--dur-fast);
}
.acc__btn:hover { color: var(--color-data-light); }
.acc__btn .icon { transition: transform var(--dur-base) var(--ease); }
.acc__btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.acc__body > div > div { padding: 0 0 20px; max-width: 72ch; color: var(--color-muted-light); }
.acc__body p + p { margin-top: .8em; }
.acc__body a { color: var(--color-ink); text-decoration: underline; text-underline-offset: 3px; }
.sec:not(.sec--light) .acc { border-top-color: var(--line-dark-strong); }
.sec:not(.sec--light) .acc__item { border-bottom-color: var(--line-dark); }
.sec:not(.sec--light) .acc__btn:hover { color: var(--color-brand); }
.sec:not(.sec--light) .acc__body > div > div { color: var(--color-muted); }
.sec:not(.sec--light) .acc__body a { color: var(--color-text); }

/* ── steps (новое) — Apostas, Como Apostar, Ouvidoria ─────────────────── */
.steps { display: grid; grid-template-columns: repeat(var(--steps, 6), minmax(0, 1fr));
}
.steps--4 { --steps: 4; }
.steps { border-top: 1px solid var(--line-light-strong); counter-reset: step; }
.step { display: grid; gap: 14px; align-content: start; padding: 22px 20px 24px 0; border-bottom: 1px solid var(--line-light); }
.step + .step { padding-left: 20px; border-left: 1px solid var(--line-light); }
.step b { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 1.25rem; text-transform: uppercase; line-height: 1.1; }
.step p { font-size: var(--fs-small); color: var(--color-muted-light); }
.sec:not(.sec--light) .steps { border-top-color: var(--line-dark-strong); }
.sec:not(.sec--light) .step { border-color: var(--line-dark); }
.sec:not(.sec--light) .step p { color: var(--color-muted); }

/* ── notice / empty state (новое) ─────────────────────────────────────── */
.notice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 18px 20px; border: 1px solid var(--line-dark-strong); border-left: 3px solid var(--color-data); background: var(--color-surface);
}
.notice .icon { color: var(--color-data); margin-top: 2px; }
.notice b { display: block; margin-bottom: 4px; }
.notice p { color: var(--color-muted); font-size: var(--fs-small); }
.sec--light .notice { background: var(--color-surface-white); border-color: var(--line-light); border-left-color: var(--color-data-light); }
.sec--light .notice .icon { color: var(--color-data-light); }
.sec--light .notice p { color: var(--color-muted-light); }
.notice--warn { border-left-color: var(--color-brand); }
.notice--warn .icon { color: var(--color-brand); }
.empty { padding: 40px 24px; text-align: center; border: 1px dashed var(--line-light-strong); color: var(--color-muted-light); }
.empty .box { margin: 0 auto 16px; }
.sec:not(.sec--light) .empty { border-color: var(--line-dark-strong); color: var(--color-muted); }

/* photo slot until the generated photo arrives: sand texture in CSS, not a grey box */
.ph {
  position: relative; overflow: hidden; background: var(--color-surface);
  background-image: repeating-linear-gradient(-24deg, rgba(233, 238, 236, .05) 0 2px, transparent 2px 11px),
                    linear-gradient(160deg, #1D292E, #0E1315 70%);
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph__cap {
  position: absolute; left: 0; bottom: 0; background: var(--color-bg); color: var(--color-text);
  font: var(--fs-micro) var(--font-mono); padding: 6px 12px 6px 0;
}

/* ── overlays: dialog, cookie banner, age gate (новое) ────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px;
  background: rgb(8 11 12 / .78); opacity: 0; transition: opacity var(--dur-slow) var(--ease);
}
.overlay.is-open { opacity: 1; }
.overlay__panel {
  width: min(100%, 560px); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--color-surface); border: 1px solid var(--line-dark-strong); border-top: 3px solid var(--color-brand);
  padding: clamp(22px, 4vw, 36px); transform: translateY(8px); transition: transform var(--dur-slow) var(--ease);
}
.overlay.is-open .overlay__panel { transform: none; }
.overlay__title { font-family: var(--font-display); font-stretch: 80%; font-weight: 850; font-size: 1.75rem; line-height: 1.05; text-transform: uppercase; }
.overlay__close {
  float: right; display: grid; place-items: center; width: 44px; height: 44px; margin: -8px -8px 0 12px;
  background: none; border: 1px solid var(--line-dark-strong); color: var(--color-text); cursor: pointer;
}
.overlay__close:hover { border-color: var(--color-brand); color: var(--color-brand); }

.agegate .overlay__panel { text-align: left; }
.agegate__mark { display: grid; place-items: center; width: 72px; height: 72px; border: 2px solid var(--color-brand); color: var(--color-brand); font: 600 1.5rem/1 var(--font-mono); margin-bottom: 22px; }
.agegate p { color: var(--color-muted); margin-top: 12px; }
.agegate__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.agegate__no[hidden] { display: none; }

.cookiebar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: var(--z-overlay);
  max-width: 980px; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 28px; align-items: center;
  padding: 20px 22px; background: var(--color-surface); border: 1px solid var(--line-dark-strong); border-top: 3px solid var(--color-data);
  box-shadow: var(--shadow-pop);
}
.cookiebar p { font-size: var(--fs-small); color: var(--color-muted); }
.cookiebar p b { color: var(--color-text); display: block; margin-bottom: 4px; }
.cookiebar a { text-decoration: underline; text-underline-offset: 3px; color: var(--color-text); }
.cookiebar .cta { flex-wrap: nowrap; }
.cookie-cats { display: grid; gap: 0; margin: 20px 0; border-top: 1px solid var(--line-dark); }
.cookie-cat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-dark); }
.cookie-cat b { font-weight: 700; }
.cookie-cat p { grid-column: 1; font-size: var(--fs-label); color: var(--color-muted); }
.cookie-cat input { width: 22px; height: 22px; accent-color: var(--color-brand); grid-row: 1 / span 2; grid-column: 2; }
.cookie-cat .tag { grid-row: 1 / span 2; grid-column: 2; }

/* toast (new): honest "received" answers */
.toast {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 16px 18px;
  border: 1px solid var(--line-light); border-left: 3px solid var(--color-data-light); background: var(--color-surface-white); color: var(--color-ink);
}
.toast .icon { color: var(--color-data-light); }
.toast b { display: block; }
.toast .mono { font-size: 1.125rem; }

/* ── responsive for components (М) ────────────────────────────────────── */
@media (max-width: 1100px) {
  .gate__head { display: none; }
  .lane { grid-template-columns: 64px minmax(0, 1fr) 44px; grid-template-areas: "box title go" "box data go" "box tag go"; gap: 6px 18px; padding: 18px 0; }
  .lane .box { grid-area: box; align-self: start; }
  .lane__title { grid-area: title; }
  .lane__data { grid-area: data; }
  .lane .tag { grid-area: tag; margin-top: 6px; }
  .lane__go { grid-area: go; }
  .next__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line-dark); }
  .next__docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc:nth-child(2) { border-right: 0; }
  .doc:nth-child(-n+2) { border-bottom: 1px solid var(--line-dark); }
  .res { grid-template-columns: minmax(0, 1fr); }
  .retro { grid-template-columns: minmax(0, 1fr); }
  .mr { grid-template-columns: 60px minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "box p w go" "box t r go"; }
  .mr .box { grid-area: box; align-self: start; } .mr__p { grid-area: p; } .mr__w { grid-area: w; } .mr__t { grid-area: t; } .mr__r { grid-area: r; } .mr .lane__go { grid-area: go; }
}
@media (max-width: 860px) {
  .panel__meta { grid-template-columns: minmax(0, 1fr); }
  .mods { justify-content: flex-start; }
  .mods .mods__lbl { text-align: left; }
  /* entries → cards */
  .tbl-wrap { background: transparent; border: 0; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tbody { display: grid; gap: 12px; }
  .tbl tbody tr { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; background: var(--color-surface-white); border: 1px solid var(--line-light); border-left: 3px solid var(--color-ink); padding: 16px; }
  .tbl td { display: block; padding: 0; border: 0; }
  .tbl td.num { grid-row: 1 / span 4; width: auto; }
  .tbl td.num::before { display: none !important; }
  .tbl td.cav { grid-column: 2 / -1; padding-bottom: 12px; margin-bottom: 10px; border-bottom: 1px solid var(--line-light); }
  .tbl td[data-label]:not(.cav)::before { content: attr(data-label); display: block; font: 500 .6875rem/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted-light); margin-bottom: 3px; }
  .tbl td[data-label]:not(.cav):not(.num) { padding-bottom: 10px; }
  .tbl .r { text-align: left; }
  .tbl td.wide { grid-column: 2 / -1; }
  .tbl tbody tr:hover { background: var(--color-surface-white); }
  .tbl--res tbody { gap: 0; }
  .tbl--res tbody tr { border: 0; border-bottom: 1px solid var(--line-light); padding: 16px 18px; }
  .tbl--res tbody tr:last-child { border-bottom: 0; }
  .tbl--res td.resn { display: none; }
  .tbl--res .hn { display: block; font-size: var(--fs-label); color: var(--color-muted-light); margin-bottom: 2px; }
  .tbl--res td.cav { padding-bottom: 8px; margin-bottom: 8px; }
  .run { grid-template-columns: auto 44px minmax(0, 1fr); grid-template-areas: "d p t" "x x x"; gap: 8px 14px; }
  .run .d { grid-area: d; } .run .pos { grid-area: p; } .run .t { grid-area: t; justify-content: flex-end; } .run .x { grid-area: x; }
  .run .dist { display: none; }
  .form__meta { grid-template-columns: minmax(0, 1fr); }
  .form__meta div { border-right: 0; border-bottom: 1px solid var(--line-dark); }
  .form__meta div:last-child { border-bottom: 0; }
  .step + .step { padding-left: 0; border-left: 0; }
  .cookiebar { grid-template-columns: minmax(0, 1fr); }
  .cookiebar .cta { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .lane { grid-template-columns: 48px minmax(0, 1fr) 44px; gap: 6px 14px; }
  .lane .box { width: 44px; height: 44px; font-size: 1.0625rem; }
  .lane__data { font-size: .875rem; }
  .lane__go { width: 40px; height: 40px; border: 0; }
  .next__head { padding: 18px; }
  .stat { padding: 18px; }
  .stat dd { font-size: 2.25rem; }
  .stat dd.stat__status { font-size: 1.5rem; }
  .next__docs { grid-template-columns: minmax(0, 1fr); }
  .doc { padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line-dark); }
  .doc:last-child { border-bottom: 0; }
  .tabs:not(.tabs--text) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .tabs:not(.tabs--text) .tab { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 0; margin-right: 0; }
  .tabs--text .tab { padding-right: 16px; margin-right: 16px; }
  .tab__dist { display: none; }
  .tab .box { width: 40px; height: 40px; }
  .tab__txt strong { font-size: 1.0625rem; }
  .tabs__more { display: none; }
  .tbl tbody tr { padding: 14px; gap: 0 12px; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); }
  .tbl .box { width: 36px; height: 36px; }
  .spec { width: 100%; }
  .spec span { flex: 1 1 auto; }
  .res__top { padding: 18px; }
  .time { text-align: left; }
  .mr { grid-template-columns: 48px minmax(0, 1fr) 40px; grid-template-areas: "box p go" "box w go" "box t go" "box r go"; gap: 8px 14px; }
  .mr .box { width: 44px; height: 44px; }
  .mr .lane__go { width: 40px; height: 40px; border: 0; }
  .archive { grid-template-columns: minmax(0, 1fr); }
  .archive li:nth-child(odd) a { margin-right: 0; }
  .rateios__head { flex-wrap: wrap; }
  .cta .btn { flex: 1 1 100%; }
  .cookiebar { left: 8px; right: 8px; bottom: 8px; padding: 16px; }
}

@media (max-width: 1100px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } .step:nth-child(3n+1) { padding-left: 0; border-left: 0; }
  .steps--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps--4 .step:nth-child(n) { padding-left: 20px; border-left: 1px solid var(--line-dark); } .steps--4 .step:nth-child(odd) { padding-left: 0; border-left: 0; }
}
@media (max-width: 600px) { .steps { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 389px) { .tag { white-space: normal; } .lane .tag { max-width: 100%; } .stat dd.stat__status { font-size: 1.25rem; overflow-wrap: anywhere; } }

/* one regulatory layer at a time: the cookie bar waits until the age is confirmed */
body:has(.agegate.is-open) .cookiebar { display: none; }
