      :root {
        /* Tope solo para scroll interno de partidos (sin forzar altura de fila) */
        --dash-match-col-max-h: min(360px, 48vh);
        --bg: #070b14;
        --panel: #0e1528;
        --panel-soft: #0a101f;
        --border: #243152;
        --border-subtle: rgba(100, 130, 200, 0.12);
        --text: #f0f3ff;
        --muted: #8b9dc4;
        --primary: #5b8aff;
        --primary-soft: rgba(91, 138, 255, 0.14);
        --ok: #34d399;
        --danger: #f87171;
        --warning: #fbbf24;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
        --radius: 12px;
        --radius-lg: 16px;
      }
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        font-family: "DM Sans", system-ui, -apple-system, sans-serif;
        line-height: 1.45;
        background: var(--bg);
        color: var(--text);
        font-size: 15px;
        -webkit-font-smoothing: antialiased;
      }
      .container {
        max-width: 1120px;
        margin: 0 auto;
        padding: 0 22px 28px;
      }
      .app-shell {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
      }
      .app-topbar {
        position: sticky;
        top: 0;
        z-index: 100;
        display: grid;
        grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
        align-items: center;
        gap: 14px 20px;
        padding: 10px 22px;
        background: rgba(7, 11, 20, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: var(--shadow-sm);
      }
      .app-topbar__brand {
        flex-shrink: 0;
      }
      .topbar-brand {
        font-size: 1.15rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        color: var(--text);
        user-select: none;
      }
      .app-topbar__center {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-width: 0;
      }
      .tournament-label {
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--muted);
        white-space: nowrap;
      }
      .tournament-select {
        max-width: 280px;
        width: 100%;
        min-width: 0;
        font-size: 0.88rem !important;
        padding: 8px 12px !important;
        border-radius: 10px !important;
      }
      .app-topbar__right {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: nowrap;
        justify-content: flex-end;
        min-width: 0;
      }
      .user-menu {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }
      .user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: linear-gradient(145deg, var(--primary-soft), rgba(91, 138, 255, 0.06));
        border: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1rem;
        color: var(--primary);
        flex-shrink: 0;
      }
      .user-avatar.admin {
        background: linear-gradient(145deg, rgba(52, 211, 153, 0.2), rgba(52, 211, 153, 0.05));
        color: var(--ok);
      }
      .user-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
      }
      .user-name {
        font-weight: 600;
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
      }
      .user-role {
        font-size: 0.75rem;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-weight: 500;
      }
      .btn-logout {
        background: transparent !important;
        color: var(--muted) !important;
        border: 1px solid var(--border) !important;
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
        font-weight: 500;
      }
      .btn-logout:hover {
        color: var(--text) !important;
        border-color: #4a5f8f !important;
        background: var(--panel-soft) !important;
        filter: none !important;
      }
      .btn-topbar-secondary {
        background: transparent !important;
        color: var(--muted) !important;
        border: 1px solid var(--border) !important;
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
        font-weight: 500;
        white-space: nowrap;
      }
      .btn-topbar-secondary:hover {
        color: var(--text) !important;
        border-color: #4a5f8f !important;
        background: var(--panel-soft) !important;
        filter: none !important;
      }
      .tl-dialog {
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 0;
        max-width: min(420px, calc(100vw - 32px));
        background: var(--panel);
        color: var(--text);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
      }
      .tl-dialog::backdrop {
        background: rgba(4, 8, 16, 0.72);
      }
      .tl-dialog__inner {
        padding: 22px 20px 18px;
      }
      .tl-dialog__inner h2 {
        margin: 0 0 14px;
        font-size: 1.15rem;
      }
      .tl-dialog__inner label {
        display: block;
        font-size: 0.8rem;
        color: var(--muted);
        margin: 10px 0 4px;
      }
      .tl-dialog__actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 16px;
        justify-content: flex-end;
      }
      .app-header-stack {
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(7, 11, 20, 0.97);
      }
      .app-activity-bar {
        margin: 0;
        padding: 8px 22px;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-subtle);
        background: rgba(10, 16, 31, 0.75);
        font-size: 0.86rem;
        line-height: 1.35;
        min-height: 2.5rem;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .app-activity-bar.status-bar.ok {
        background: rgba(16, 51, 34, 0.35);
      }
      .app-activity-bar.status-bar.error {
        background: rgba(80, 20, 20, 0.35);
      }
      .app-main {
        padding-top: 12px;
        flex: 1;
      }
      .dashboard-top-grid {
        display: grid;
        gap: 16px;
        grid-template-columns: 1fr;
        margin-bottom: 20px;
      }
      .dashboard-top-grid .dashboard-col {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: auto;
        max-height: none;
        box-sizing: border-box;
      }
      @media (min-width: 960px) {
        .dashboard-top-grid {
          grid-template-columns: repeat(3, minmax(0, 1fr));
          align-items: stretch;
        }
      }
      .dashboard-top-grid .dashboard-col > h3 {
        flex-shrink: 0;
      }
      .dashboard-col-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
      }
      .dashboard-col--match-list .dashboard-col-scroll {
        max-height: var(--dash-match-col-max-h);
        overflow-y: auto;
      }
      @media (min-width: 960px) {
        .dashboard-col--match-list .dashboard-col-scroll {
          max-height: none;
        }
      }
      .dashboard-col h3 {
        margin: 0 0 12px;
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: var(--text);
      }
      .dash-mini-match {
        padding: 8px 0;
        border-bottom: 1px solid var(--border-subtle);
      }
      .dash-mini-match:first-of-type {
        padding-top: 2px;
      }
      .dash-mini-match:last-child {
        border-bottom: none;
        padding-bottom: 2px;
      }
      .dash-mini-meta {
        font-size: 0.78rem;
        color: var(--muted);
        margin-top: 6px;
      }
      .dash-summary-line {
        margin: 0 0 10px;
        font-size: 0.88rem;
        line-height: 1.45;
      }
      .dash-summary-line:last-child {
        margin-bottom: 0;
      }
      .dash-rank-list {
        margin: 0;
        padding: 0 0 0 18px;
        font-size: 0.88rem;
      }
      .dash-rank-list li {
        margin-bottom: 8px;
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: baseline;
      }
      .dash-rank-list li:last-child {
        margin-bottom: 0;
      }
      .dash-rank-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .dash-rank-pts {
        font-weight: 700;
        color: var(--primary);
        flex-shrink: 0;
      }
      .dash-my-stats {
        margin: 0;
        font-size: 0.88rem;
        line-height: 1.45;
      }
      .dash-my-stat-hero {
        text-align: center;
        padding: 14px 12px 16px;
        margin: 0 0 12px;
        border-radius: var(--radius-lg);
        background: linear-gradient(
          165deg,
          rgba(102, 140, 255, 0.18) 0%,
          rgba(11, 18, 39, 0.85) 55%,
          rgba(7, 11, 20, 0.95) 100%
        );
        border: 1px solid rgba(102, 140, 255, 0.4);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
      }
      .dash-my-stat-hero-label {
        display: block;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--muted);
        margin-bottom: 8px;
      }
      .dash-my-stat-hero-value {
        display: block;
        font-size: 2.1rem;
        font-weight: 800;
        line-height: 1;
        color: var(--primary);
        letter-spacing: -0.03em;
        text-shadow: 0 0 24px rgba(102, 140, 255, 0.35);
      }
      .dash-my-stat-row {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-subtle);
      }
      .dash-my-stat-row:first-child {
        padding-top: 2px;
      }
      .dash-my-stat-row:last-child {
        border-bottom: none;
        padding-bottom: 2px;
      }
      .dash-my-stat-label {
        color: var(--muted);
        min-width: 0;
      }
      .dash-my-stat-value {
        font-weight: 700;
        text-align: right;
        flex-shrink: 0;
      }
      .dash-my-breakdown {
        margin: 0 0 12px;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 10px 12px;
        background: rgba(10, 16, 31, 0.5);
      }
      .dash-my-breakdown-title {
        margin: 0 0 8px;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--muted);
      }
      .dash-my-breakdown-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 10px;
      }
      .dash-my-breakdown-grid span {
        font-size: 0.82rem;
      }
      .dash-my-gap {
        margin: 0 0 12px;
        font-size: 0.84rem;
        color: var(--muted);
      }
      .dash-inline-error {
        margin: 0;
        color: #fecaca;
        font-size: 0.84rem;
      }
      .dashboard-stack {
        display: flex;
        flex-direction: column;
        gap: 0;
      }
      .match-teams-row {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        width: 100%;
      }
      .match-teams-row--compact {
        gap: 8px;
      }
      .match-teams-row--compact .team-crest,
      .match-teams-row--compact .team-initial {
        width: 22px;
        height: 16px;
        font-size: 0.65rem;
      }
      .match-team {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
      }
      .match-team__name {
        font-weight: 600;
        font-size: 0.95rem;
        line-height: 1.25;
        min-width: 0;
        word-break: break-word;
      }
      .match-teams-row--compact .match-team__name {
        font-size: 0.82rem;
      }
      .match-vs {
        font-size: 0.75rem;
        font-weight: 700;
        color: var(--muted);
        flex-shrink: 0;
        text-transform: lowercase;
      }
      .team-crest {
        width: 32px;
        height: 24px;
        object-fit: contain;
        object-position: center;
        background: rgba(10, 16, 31, 0.85);
        border-radius: 4px;
        box-shadow: 0 0 0 1px var(--border-subtle);
        flex-shrink: 0;
      }
      .team-initial {
        width: 32px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        background: var(--panel-soft);
        border: 1px solid var(--border);
        font-size: 0.78rem;
        font-weight: 700;
        flex-shrink: 0;
        color: var(--muted);
      }
      .match-title-block {
        flex: 1;
        min-width: 0;
      }
      .app-footer {
        margin-top: auto;
        padding: 14px 22px 18px;
        border-top: 1px solid var(--border-subtle);
        background: rgba(7, 11, 20, 0.94);
      }
      .app-footer__inner {
        max-width: 1120px;
        margin: 0 auto;
        text-align: center;
        font-size: 0.84rem;
        color: var(--muted);
      }
      .app-footer-betting {
        margin: 0 0 12px;
        font-size: 0.82rem;
        line-height: 1.55;
        color: var(--muted);
        text-align: center;
      }
      .app-footer-meta {
        margin: 0;
        font-size: 0.8rem;
        opacity: 0.9;
      }
      .auth-shell {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
      }
      .auth-card {
        width: 100%;
        max-width: 430px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 18px;
      }
      .auth-card h1 {
        margin: 0 0 10px;
        font-size: 1.4rem;
      }
      .auth-card p {
        margin: 0 0 14px;
      }
      .auth-card .form-row {
        grid-template-columns: 1fr;
      }
      .auth-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
      }
      .status-bar {
        margin-top: 16px;
        padding: 11px 14px;
        border-radius: var(--radius);
        border: 1px solid var(--border-subtle);
        background: rgba(10, 16, 31, 0.65);
        color: var(--muted);
        font-size: 0.9rem;
      }
      .status-bar.ok {
        border-color: #1f7a45;
        color: #b5f6cf;
      }
      .status-bar.error {
        border-color: #7f1d1d;
        color: #fecaca;
      }
      .grid {
        display: grid;
        gap: 14px;
      }
      .grid-2 {
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
      }
      .grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      }
      .panel {
        background: var(--panel);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        padding: 18px 20px;
        box-shadow: var(--shadow-sm);
      }
      .panel h2 {
        margin: 0 0 14px;
        font-size: 1.02rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--text);
      }
      .panel-lead {
        margin: -6px 0 14px;
        font-size: 0.9rem;
        color: var(--muted);
        line-height: 1.5;
      }
      select {
        border-radius: var(--radius);
        border: 1px solid #3a4e81;
        padding: 9px 11px;
        font-size: 0.92rem;
        width: 100%;
        background: #0b1227;
        color: var(--text);
      }
      .row {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: wrap;
      }
      .form-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 8px;
      }
      input,
      button {
        border-radius: var(--radius);
        border: 1px solid #3a4e81;
        padding: 9px 11px;
        font-size: 0.92rem;
      }
      input {
        width: 100%;
        background: #0b1227;
        color: var(--text);
      }
      button {
        background: var(--primary);
        border-color: #668cff;
        color: white;
        cursor: pointer;
        transition: all 0.15s ease;
      }
      button:hover {
        filter: brightness(1.08);
      }
      button.secondary {
        background: #25375f;
      }
      button.danger {
        background: var(--danger);
        border-color: #f87171;
      }
      button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }
      .muted {
        color: var(--muted);
        font-size: 0.9rem;
      }
      .session-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: var(--panel-soft);
        padding: 6px 12px;
        color: var(--muted);
        font-size: 0.9rem;
      }
      .session-pill.admin {
        border-color: #266c46;
        color: #bbf7d0;
      }
      .section {
        margin-top: 18px;
      }
      .section-tight {
        margin-top: 14px;
      }
      .dashboard-grid {
        display: grid;
        gap: 18px;
        grid-template-columns: 1fr;
      }
      @media (min-width: 900px) {
        .dashboard-grid--split {
          grid-template-columns: 1fr 1fr;
          align-items: stretch;
        }
      }
      /* Mis apuestas / Ranking: altura fija, tabla con scroll */
      .panel.panel--scroll-list {
        display: flex;
        flex-direction: column;
        min-height: 0;
        height: 380px;
        max-height: 380px;
        box-sizing: border-box;
      }
      .panel.panel--scroll-list > h2,
      .panel.panel--scroll-list > .row {
        flex-shrink: 0;
      }
      .panel-scroll-body {
        flex: 1 1 auto;
        min-height: 0;
        margin-top: 12px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
      }
      .panel-scroll-body table {
        margin: 0;
      }
      .panel-scroll-body thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--panel);
        box-shadow: 0 1px 0 var(--border-subtle);
      }
      .status-pill-mini {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 2px 7px;
        border-radius: 999px;
        border: 1px solid #405789;
        font-size: 0.75rem;
        line-height: 1.2;
      }
      .status-pill-mini.scheduled {
        background: #122247;
      }
      .status-pill-mini.in_progress {
        background: #3a2d0e;
        border-color: #7a5a18;
      }
      .status-pill-mini.finished {
        background: #103322;
        border-color: #1f7a45;
      }
      table {
        width: 100%;
        border-collapse: collapse;
      }
      th,
      td {
        border-bottom: 1px solid #24345b;
        padding: 9px 6px;
        text-align: left;
        font-size: 0.92rem;
      }
      th {
        color: var(--muted);
        font-weight: 600;
      }
      .td-match-with-flags {
        vertical-align: middle;
        min-width: 220px;
      }
      .pill {
        display: inline-block;
        padding: 3px 9px;
        border-radius: 999px;
        font-size: 12px;
        border: 1px solid #405789;
      }
      .pill.scheduled {
        background: #122247;
      }
      .pill.in_progress {
        background: #3a2d0e;
        border-color: #7a5a18;
      }
      .pill.finished {
        background: #103322;
        border-color: #1f7a45;
      }
      .phase-section {
        margin-top: 18px;
        padding: 16px 16px 14px;
        border-radius: 14px;
        border: 1px solid var(--border);
        background: linear-gradient(165deg, #0f1830 0%, #0a1022 100%);
        border-left: 4px solid var(--primary);
      }
      .phase-section:first-of-type {
        margin-top: 0;
      }
      .phase-title {
        margin: 0 0 14px;
        font-size: 1.12rem;
        font-weight: 700;
      }
      .group-section {
        margin-bottom: 20px;
      }
      .group-section:last-child {
        margin-bottom: 0;
      }
      .group-title {
        margin: 0 0 10px;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--muted);
        letter-spacing: 0.03em;
        text-transform: uppercase;
      }
      .group-matches {
        display: grid;
        gap: 12px;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      }
      .match-card {
        border: 1px solid #2a3b63;
        border-radius: 12px;
        padding: 12px;
        background: var(--panel-soft);
        margin-bottom: 10px;
      }
      .group-matches .match-card {
        margin-bottom: 0;
      }
      .phase-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0 16px;
        padding: 4px 0;
        border-bottom: 1px solid var(--border);
      }
      .phase-tab {
        border-radius: 999px;
        padding: 8px 14px;
        font-size: 0.88rem;
        border: 1px solid var(--border);
        background: var(--panel-soft);
        color: var(--muted);
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
      }
      .phase-tab:hover {
        border-color: #4d64a3;
        color: var(--text);
      }
      .phase-tab.active {
        background: var(--primary-soft);
        border-color: #668cff;
        color: var(--text);
      }
      .phase-tab .tab-count {
        opacity: 0.75;
        font-size: 0.82em;
      }
      .phase-tab.is-empty:not(.active) {
        opacity: 0.55;
      }
      .phase-panel {
        display: none;
      }
      .phase-panel.active {
        display: block;
      }
      .phase-panel-empty {
        padding: 16px;
        border-radius: 12px;
        border: 1px dashed var(--border);
        color: var(--muted);
        font-size: 0.92rem;
      }
      .match-title {
        font-weight: 700;
      }
      @media (max-width: 680px) {
        .container {
          padding: 0 14px 20px;
        }
        .app-activity-bar {
          padding: 8px 14px;
        }
        .app-topbar {
          padding: 10px 14px;
          grid-template-columns: 1fr;
          justify-items: stretch;
        }
        .app-topbar__center {
          justify-content: flex-start;
          order: 3;
        }
        .app-topbar__right {
          order: 2;
          justify-content: space-between;
          width: 100%;
        }
        .app-topbar__brand {
          order: 1;
        }
        .tournament-select {
          max-width: none;
        }
        .user-name {
          max-width: 140px;
        }
        .panel-scroll-body {
          overflow-x: auto;
        }
        .panel-scroll-body table {
          min-width: 620px;
        }
      }
      .user-payment-summary__grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px 16px;
      }
      @media (max-width: 640px) {
        .user-payment-summary__grid {
          grid-template-columns: 1fr;
        }
      }
      .user-payment-summary__item {
        padding: 10px 12px;
        border-radius: 8px;
        background: var(--panel-soft);
        border: 1px solid var(--border);
      }
      .user-payment-summary__label {
        display: block;
        font-size: 13px;
        color: var(--muted);
        margin-bottom: 4px;
      }
      .user-payment-summary__amount {
        font-size: 1.15rem;
        font-weight: 600;
        color: var(--text);
      }
      :focus-visible {
        outline: 2px solid #7aa3ff;
        outline-offset: 2px;
