/*
 * Public "Últimos ganhadores" page.
 *
 * This page ships its own <head> and loads no other stylesheet — it is the one
 * screen a listener sees after a draw, so it stays self-contained and light.
 * The only station-specific value is `--ow-brand`, set inline on <body>; every
 * tint below is derived from it, so the sheet itself is white-label.
 */

:root {
  --ow-surface: #fff;
  --ow-surface-alt: #f7f5f2;
  --ow-field: #f2efea;
  --ow-ink: #17140f;
  --ow-ink-2: #4a443b;
  --ow-ink-3: #6b6459;
  /*
   * Warmed-down greys rather than the mock's: at #8b8377/#a29a8d the phone,
   * the city and the footnote sat at 2.6-3.7:1 against their backgrounds, under
   * the 4.5:1 WCAG AA asks for. This page is read by anyone, on a phone, often
   * outdoors — these two tones carry the second line of every row.
   */
  --ow-muted: #6f6759;
  --ow-faint: #797265;
  --ow-line: rgba(0, 0, 0, 0.07);
  --ow-line-soft: rgba(0, 0, 0, 0.05);
}

.ow {
  --ow-brand-soft: rgba(0, 0, 0, 0.06);
  --ow-brand-soft: color-mix(in srgb, var(--ow-brand) 10%, transparent);
  /* Safety net: the view always sets this inline, and inline wins over this rule. */
  --ow-brand-ink: var(--ow-brand);
  --ow-on-brand: #fff;

  margin: 0;
  background: var(--ow-surface-alt);
  color: var(--ow-ink);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.ow *,
.ow *::before,
.ow *::after {
  box-sizing: border-box;
}

.ow-icon {
  flex: none;
}

.ow-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
 * Every control here is a pill on a tinted field, so the browser's default ring
 * reads as an artefact. One brand-tinted halo, used everywhere, keyboard-only.
 */
.ow *:focus-visible {
  outline: 2px solid var(--ow-brand-ink);
  outline-offset: 2px;
}

.ow-topbar *:focus-visible {
  outline-color: var(--ow-on-brand);
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */

.ow-topbar {
  background-color: var(--ow-brand);
  background-image:
    radial-gradient(circle at 12% 120%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(circle at 88% -40%, rgba(255, 255, 255, 0.1), transparent 50%);
  /*
   * Not a hardcoded white: a pale primary_color would swallow it. The helper
   * hands back white, or a deepened brand tone for the stations where it would not read.
   */
  color: var(--ow-on-brand);
}

.ow-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
}

/*
 * `auto` and not `space-between`: these buttons are the bar's only child, and
 * they belong on the right.
 */
.ow-topbar__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.ow-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.ow-btn:active {
  transform: translateY(1px);
}

.ow-btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--ow-on-brand);
}

.ow-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ow-btn--solid {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #fff;
  color: var(--ow-brand-ink);
  font-weight: 600;
}

.ow-btn--solid:hover {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ow-brand-ink);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

.ow-main {
  padding-bottom: 56px;
}

/*
 * The sticky filter bar has to bleed to the viewport edges, so the column width
 * lives on this wrapper rather than on <main>.
 */
.ow-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.ow-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 0 30px;
  border-bottom: 1px solid var(--ow-line);
}

.ow-hero__text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
}

/* The station's mark leads the page again, as it did on the retired screen. */
.ow-hero__logo {
  width: 96px;
  height: 96px;
  margin-bottom: 6px;
  overflow: hidden;
  border-radius: 14px;
}

.ow-hero__logo img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
}

.ow-hero__kicker {
  color: var(--ow-brand-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/*
 * The headline stays near-black; the station's colour carries the kicker above
 * it and the day titles below, through the darkened variant so a pale brand is
 * still legible.
 */
.ow-hero__title {
  margin: 0;
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.ow-hero__lead {
  margin: 0;
  color: var(--ow-ink-3);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.ow-stats {
  display: flex;
  flex: none;
  gap: 32px;
  padding-bottom: 6px;
}

.ow-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ow-stat__value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ow-stat__label {
  color: var(--ow-muted);
  font-size: 12px;
  line-height: 1;
}

.ow-stat__divider {
  width: 1px;
  background: rgba(0, 0, 0, 0.1);
}

/* ── Filters ───────────────────────────────────────────────────────────────── */

.ow-filters {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ow-line);
}

.ow-filters__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ow-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  background: var(--ow-field);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  color: var(--ow-muted);
  cursor: text;
}

.ow-search:focus-within {
  border-color: var(--ow-brand);
  box-shadow: 0 0 0 3px var(--ow-brand-soft);
}

.ow-search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ow-ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  appearance: none;
}

.ow-search input::placeholder {
  color: var(--ow-faint);
}

.ow-search input::-webkit-search-cancel-button {
  appearance: none;
}

.ow-select {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  max-width: 260px;
  height: 44px;
  padding: 0 34px 0 16px;
  background: var(--ow-field);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  color: var(--ow-muted);
}

.ow-select select {
  max-width: 100%;
  background: none;
  border: 0;
  color: var(--ow-ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  text-overflow: ellipsis;
}

.ow-select .ow-icon {
  position: absolute;
  right: 14px;
  pointer-events: none;
}

.ow-period {
  display: flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  background: var(--ow-field);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

.ow-period__option {
  padding: 8px 16px;
  background: none;
  border: 0;
  border-radius: 9px;
  color: var(--ow-ink-3);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ow-period__option.is-active {
  background: var(--ow-brand);
  color: #fff;
  font-weight: 600;
}

.ow-chips {
  display: none;
  gap: 8px;
  margin-top: 10px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ow-chips::-webkit-scrollbar {
  display: none;
}

.ow-chip {
  flex: none;
  max-width: 62vw;
  overflow: hidden;
  padding: 9px 15px;
  text-overflow: ellipsis;
  background: var(--ow-surface);
  border: 1px solid var(--ow-line);
  border-radius: 999px;
  color: var(--ow-ink-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.ow-chip.is-active {
  background: var(--ow-brand);
  border-color: var(--ow-brand);
  color: #fff;
  font-weight: 600;
}

/* ── Day sections ──────────────────────────────────────────────────────────── */

.ow-list {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding-top: 32px;
}

.ow-day[hidden] {
  display: none;
}

.ow-day__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ow-day__title {
  margin: 0;
  color: var(--ow-brand-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.ow-day__date {
  color: var(--ow-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.ow-day__count {
  padding: 4px 9px;
  background: var(--ow-brand-soft);
  border-radius: 999px;
  color: var(--ow-brand-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* ── Rows ──────────────────────────────────────────────────────────────────── */

.ow-table {
  --ow-cols: 38px minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, 2fr) 92px;

  overflow: hidden;
  background: var(--ow-surface);
  border: 1px solid var(--ow-line);
  border-radius: 18px;
}

.ow-table--no-time {
  --ow-cols: 38px minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, 2fr);
}

.ow-table__head {
  display: grid;
  grid-template-columns: var(--ow-cols);
  column-gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--ow-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* The first label sits over the avatar and the name together. */
.ow-table__head span:first-child {
  grid-column: 1 / 3;
}

.ow-table__head-time {
  text-align: right;
}

.ow-row {
  display: grid;
  grid-template-columns: var(--ow-cols);
  grid-template-areas:
    "avatar name  place promo time"
    "avatar phone place promo time";
  /*
   * The avatar hugs the name; the columns after it get their breathing room from
   * the padding below, so the grid gap can stay tight.
   */
  column-gap: 12px;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--ow-line-soft);
  transition: background-color 0.12s ease;
}

.ow-table__head span:nth-child(n + 2),
.ow-row__place,
.ow-row__promo,
.ow-row__time {
  padding-left: 8px;
}

.ow-table--no-time .ow-row {
  grid-template-areas:
    "avatar name  place promo"
    "avatar phone place promo";
}

.ow-row:last-child {
  border-bottom: 0;
}

.ow-row:hover {
  background: #faf8f5;
}

.ow-row[hidden] {
  display: none;
}

.ow-row__avatar {
  display: flex;
  grid-area: avatar;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 38px;
  height: 38px;
  background: var(--ow-brand-soft);
  border-radius: 11px;
  color: var(--ow-brand-ink);
  font-size: 14px;
  font-weight: 700;
}

.ow-row__name {
  grid-area: name;
  align-self: end;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
}

.ow-row__phone {
  grid-area: phone;
  align-self: start;
  color: var(--ow-faint);
  font-size: 12.5px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.ow-row__place {
  display: flex;
  grid-area: place;
  flex-direction: column;
  gap: 2px;
  align-self: center;
  min-width: 0;
}

.ow-row__hood {
  color: var(--ow-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
}

.ow-row__hood--empty {
  color: var(--ow-faint);
  font-weight: 400;
  font-style: italic;
}

.ow-row__city {
  color: var(--ow-faint);
  font-size: 12px;
  line-height: 1.2;
}

.ow-row__promo {
  grid-area: promo;
  align-self: center;
  min-width: 0;
}

.ow-tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--ow-field);
  border-radius: 999px;
  color: var(--ow-ink-2);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.ow-row__time {
  grid-area: time;
  align-self: center;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Empty states and footnote ─────────────────────────────────────────────── */

.ow-empty {
  padding: 48px 24px;
  background: var(--ow-surface);
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: 18px;
  text-align: center;
}

.ow-empty[hidden] {
  display: none;
}

.ow-empty--page {
  margin-top: 32px;
}

.ow-empty__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.ow-empty__hint {
  margin: 0;
  color: var(--ow-muted);
  font-size: 13.5px;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .ow-topbar__inner {
    padding: 12px 16px;
  }

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

  .ow-btn--ghost {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }

  .ow-main {
    padding-bottom: 40px;
  }

  .ow-shell {
    padding: 0 16px;
  }

  .ow-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
    padding: 26px 0 22px;
  }

  .ow-hero__lead {
    font-size: 13.5px;
  }

  .ow-stats {
    gap: 22px;
    padding-bottom: 0;
  }

  .ow-stat__value {
    font-size: 26px;
  }

  .ow-filters {
    padding: 12px 0;
  }

  .ow-filters__row {
    flex-wrap: wrap;
  }

  .ow-search {
    flex: 1 0 100%;
    background: var(--ow-surface);
    border-color: var(--ow-line);
  }

  .ow-select {
    display: none;
  }

  .ow-chips {
    display: flex;
  }

  .ow-list {
    gap: 22px;
    padding-top: 22px;
  }

  .ow-day__title {
    font-size: 17px;
  }

  .ow-day__date {
    display: none;
  }

  /* The table dissolves into cards: same DOM, different grid. */
  .ow-table,
  .ow-table--no-time {
    background: none;
    border: 0;
    border-radius: 0;
  }

  .ow-table__head {
    display: none;
  }

  .ow-row,
  .ow-table--no-time .ow-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "avatar name  time"
      "avatar phone phone"
      "avatar place place"
      "avatar promo promo";
    gap: 4px 12px;
    align-items: start;
    margin-bottom: 10px;
    padding: 14px;
    background: var(--ow-surface);
    border: 1px solid var(--ow-line);
    border-bottom: 1px solid var(--ow-line);
    border-radius: 16px;
  }

  .ow-row__place,
  .ow-row__promo,
  .ow-row__time {
    padding-left: 0;
  }

  .ow-row:last-child {
    margin-bottom: 0;
    border-bottom: 1px solid var(--ow-line);
  }

  .ow-row:hover {
    background: var(--ow-surface);
  }

  .ow-row__avatar {
    align-self: start;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 15px;
  }

  .ow-row__name {
    align-self: center;
  }

  .ow-row__phone {
    align-self: center;
  }

  .ow-row__place {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 6px;
    align-self: center;
  }

  .ow-row__hood,
  .ow-row__city {
    font-size: 12.5px;
  }

  .ow-row__city:not(:first-child)::before {
    margin-right: 6px;
    content: "·";
  }

  .ow-row__promo {
    margin-top: 5px;
  }

  .ow-tag {
    padding: 5px 11px;
    font-size: 12px;
  }

  .ow-row__time {
    align-self: center;
    color: var(--ow-brand-ink);
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ow * {
    transition: none !important;
  }
}
