:root {
  --bg: #fff8d6;
  --ink: #071a3d;
  --muted: #55627a;
  --panel: #ffffff;
  --line: #d8deea;
  --yellow: #fcd116;
  --blue: #003893;
  --red: #ce1126;
  --navy: #071a3d;
  --danger: #ce1126;
  --soft-blue: #e9f0ff;
  --soft-gold: #fff8d6;
  --soft-red: #fde8ed;
  --shadow: 0 14px 40px rgba(7, 26, 61, 0.08);
  --radius: 8px;
  --tap: 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(252, 209, 22, 0.22), transparent 34rem),
    linear-gradient(315deg, rgba(0, 56, 147, 0.12), transparent 28rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  box-shadow: inset 0 -3px 0 var(--blue), inset 0 -6px 0 var(--red);
}

.shell-header h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7vw, 2.35rem);
  line-height: 1.08;
}

.shell-header p,
.panel p {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-actions,
.button-row,
.match-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.shell {
  width: min(1240px, calc(100% - 1rem));
  margin: 0.75rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.panel,
.stat-card,
.match-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 1rem;
  min-width: 0;
}

.dashboard-grid > *,
.prize-grid > *,
.login-grid > *,
.two-column > *,
.admin-layout > *,
.match-list > * {
  min-width: 0;
}

.dashboard-grid,
.prize-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.stat-card {
  padding: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.stat-card span,
.hint,
label,
small {
  color: var(--muted);
}

.stat-card strong {
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.login-grid,
.two-column,
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.admin-layout {
  grid-template-columns: 1fr;
}

.login-card,
.prediction-form {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: var(--tap);
  padding: 0.72rem 0.78rem;
}

textarea {
  min-height: 12rem;
  resize: vertical;
}

button,
.link-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  min-height: var(--tap);
  padding: 0.75rem 0.95rem;
  text-decoration: none;
  text-align: center;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.gold {
  background: var(--yellow);
  color: var(--navy);
}

.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--blue);
}

.small {
  min-height: 38px;
  padding: 0.5rem 0.65rem;
}

.user-chip,
.badge {
  border-radius: 999px;
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--soft-blue);
  color: var(--blue);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.badge.danger {
  background: var(--soft-red);
  color: var(--danger);
}

.badge.success {
  background: var(--soft-blue);
  color: var(--blue);
}

.match-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.match-card {
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.match-card.selected {
  border-color: rgba(0, 56, 147, 0.5);
  box-shadow: 0 18px 48px rgba(0, 56, 147, 0.14);
}

.match-card h3 {
  margin: 0;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.match-result {
  color: var(--blue);
  font-size: 1.05rem;
  font-weight: 900;
}

.prediction-form {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.prediction-form input[name="userComment"] {
  grid-column: 1 / -1;
}

.prediction-form button {
  grid-column: 1 / -1;
}

.prediction-form select,
.form-note {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  max-width: 100%;
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-match {
  display: grid;
  gap: 0.45rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.results-grid {
  display: grid;
  gap: 0.75rem;
}

.inline-editor {
  min-width: 280px;
}

.inline-editor summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 900;
}

.table-edit-form {
  margin-top: 0.6rem;
  min-width: 360px;
}

.muted-panel {
  background: rgba(255, 255, 255, 0.65);
}

.payment-note {
  background: var(--soft-gold);
  border: 1px solid rgba(252, 209, 22, 0.45);
  border-radius: 8px;
  padding: 0.85rem;
}

.provider-box {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  border: 1px solid rgba(16, 42, 67, 0.16);
  border-radius: 8px;
  background: #f6f9fb;
  min-width: 0;
  overflow-wrap: anywhere;
}

.filter-grid,
.admin-correction-form,
.rate-summary {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}

.rules-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.rules-list li {
  margin: 0.45rem 0;
}

.compact-stack {
  margin-top: 1rem;
}

.filter-grid {
  grid-template-columns: 1fr;
  margin-bottom: 0.9rem;
}

.empty-state {
  display: grid;
  min-height: 5rem;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.landing-shell {
  align-content: start;
}

.landing-panel {
  border-top: 5px solid var(--yellow);
}

.admin-wide {
  grid-column: 1 / -1;
}

.warning {
  color: var(--red);
  font-weight: 800;
}

button:hover,
.link-button:hover {
  filter: brightness(0.96);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(252, 209, 22, 0.8);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .shell-header,
  .login-grid,
  .two-column,
  .admin-layout {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .shell-header {
    position: static;
  }

  .header-actions,
  .button-row,
  .match-top {
    width: 100%;
  }

  .header-actions > *,
  .button-row > * {
    flex: 1 1 100%;
  }

  .card-table table,
  .card-table thead,
  .card-table tbody,
  .card-table tr,
  .card-table th,
  .card-table td {
    display: block;
  }

  .card-table thead {
    display: none;
  }

  .card-table tr {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
  }

  .card-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(216, 222, 234, 0.65);
    padding: 0.55rem 0;
    white-space: normal;
  }

  .card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 900;
  }

  .card-table td:last-child {
    border-bottom: 0;
  }
}

@media (min-width: 640px) {
  .dashboard-grid,
  .prize-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .match-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .shell {
    width: min(1240px, calc(100% - 2rem));
    margin-top: 1rem;
  }

  .shell-header {
    align-items: center;
  }

  .login-grid,
  .two-column {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  }

  .admin-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr) minmax(280px, 0.9fr);
  }

  .dashboard-grid,
  .prize-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .match-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .prediction-form input[name="userComment"] {
    grid-column: 1 / -1;
  }

  .prediction-form button {
    grid-column: 1 / -1;
  }

  .filter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.app-tabs {
  width: min(1240px, calc(100% - 1rem));
  margin: 0.75rem auto 0;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--blue);
  min-height: var(--tap);
  white-space: nowrap;
}

.tab-button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: inset 0 -4px 0 var(--yellow);
}

.hero-panel {
  border-top: 5px solid var(--yellow);
}

.page-intro h2,
.hero-panel h2 {
  margin-top: 0;
}

.summary-card,
.compact-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.85rem;
}

.summary-card {
  display: grid;
  gap: 0.45rem;
}

.summary-card p {
  margin: 0;
}

.compact-details {
  margin-top: 0.75rem;
}

.compact-details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 900;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.accordion-list,
.mini-list {
  display: grid;
  gap: 0.75rem;
}

.mini-list > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.matchday-actions {
  margin-top: 1rem;
}

.whatsapp-panel textarea {
  min-height: 8rem;
}

@media (max-width: 700px) {
  body {
    padding-bottom: 5.25rem;
  }

  .user-bottom-nav {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    z-index: 30;
    width: auto;
    margin: 0;
    justify-content: space-between;
    border-color: rgba(0, 56, 147, 0.25);
  }

  .user-bottom-nav .tab-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.55rem 0.35rem;
    font-size: 0.78rem;
  }

  .admin-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    border-radius: 0;
    width: 100%;
  }

  .compact-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .app-tabs {
    width: min(1240px, calc(100% - 2rem));
  }

  .compact-dashboard {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
