:root {
    color-scheme: dark;
    --bg: #0a0f1c;
    --bg-elevated: #111a2c;
    --bg-card: #16213a;
    --bg-card-hover: #1b2844;
    --border: #263252;
    --border-soft: rgba(255, 255, 255, 0.07);
    --text: #f3f5fa;
    --text-muted: #8b95ab;
    --text-faint: #5c6883;
    --accent: #3ba55c;
    --accent-strong: #2e8a4b;
    --danger: #e5484d;
    --held: #a78bfa;
    --seat-free: #e5e7eb;
    --seat-selected: #3ba55c;
    --seat-held: #f59e0b;
    --seat-taken: #7f1d1d;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 26px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    background: radial-gradient(circle at top, #121d38 0%, var(--bg) 55%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 96px;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 12px;
}

.hidden {
    display: none !important;
}

a {
    color: inherit;
}

::selection {
    background: color-mix(in srgb, var(--accent) 45%, transparent);
    color: #fff;
}

/* Scrollbar discreta, a juego con el tema */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

*::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Spinner de carga ---------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -3px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 32px 0;
    justify-content: center;
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(10, 15, 28, 0.82);
    backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.topbar__brand {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar__event {
    display: flex;
    flex-direction: column;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    gap: 4px;
}

.topbar__event strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

#admin-user-info.topbar__event {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

/* ---------- Layout general ---------- */
#app,
#admin-app {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 20px;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0;
    font-size: 0.95rem;
}

/* ---------- Listado de eventos ---------- */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}

.event-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(180deg, var(--bg-card-hover) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px 24px 20px 28px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    overflow: hidden;
}

.event-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent), var(--held));
    opacity: 0.85;
}

.event-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border-soft));
}

.event-card__competition {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
}

.event-card__teams {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.event-card__teams span {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.85rem;
    margin: 0 2px;
}

.event-card__meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.event-card__meta .meta-sep {
    color: var(--text-faint);
}

.event-card__meta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.8;
}

.event-card__action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.event-card__price {
    color: var(--text-muted);
    font-size: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    padding: 4px 10px;
    border-radius: 999px;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 48px 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

/* ---------- Footer ---------- */
.site-footer {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 20px 110px;
    text-align: center;
}

.site-footer a {
    color: var(--text-faint);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer a:hover {
    color: var(--text-muted);
    text-decoration: underline;
}

/* ---------- Mapa del estadio (SVG tipo grada de anillo) ---------- */
.stadium-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 18px;
    align-items: start;
    margin: 28px 0 22px;
}

.stadium-wrap {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

@media screen and (min-width: 720px) {
    .stadium-wrap {
        padding: 34px;
    }
}

.map-zoom-controls {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-pan-controls {
    position: absolute;
    left: 24px;
    bottom: 24px;
    z-index: 5;
    display: grid;
    grid-template-columns: 30px 30px 30px;
    grid-template-rows: 30px 30px 30px;
    grid-template-areas:
        ".    up    ."
        "left .     right"
        ".    down  .";
    gap: 3px;
}

.map-pan-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.map-pan-btn--up {
    grid-area: up;
}

.map-pan-btn--left {
    grid-area: left;
}

.map-pan-btn--right {
    grid-area: right;
}

.map-pan-btn--down {
    grid-area: down;
}

.map-pan-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
}

.map-pan-btn:active:not(:disabled) {
    transform: scale(0.94);
}

.map-pan-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.map-zoom-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.map-zoom-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
}

.map-zoom-btn:active:not(:disabled) {
    transform: scale(0.94);
}

.map-zoom-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.stadium-filters-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.stadium-filters {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-card-hover) 0%, var(--bg-elevated) 60%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 18px;
    gap: 18px;
}

.stadium-filters__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: -6px -6px -4px 0;
}

.stadium-filters__title {
    font-size: 0.95rem;
    margin: 0;
}

.filters-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.filters-close:hover,
.filters-close:focus-visible {
    background: var(--bg-card);
    color: var(--text);
}

.filters-backdrop {
    display: none;
}

.filter-group {
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group + .filter-group {
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.filter-group legend {
    padding: 0;
    margin-bottom: 2px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
}

.price-range {
    position: relative;
    height: 18px;
    margin: 14px 2px 6px;
}

.price-range__track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    transform: translateY(-50%);
}

.price-range__fill {
    position: absolute;
    top: 50%;
    height: 5px;
    background: var(--accent);
    border-radius: 3px;
    transform: translateY(-50%);
}

.price-range__input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.price-range__input--min {
    z-index: 1;
}

.price-range__input--max {
    z-index: 2;
}

.price-range__input:focus {
    outline: none;
}

.price-range__input::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    background: transparent;
    height: 18px;
}

.price-range__input::-moz-range-track {
    background: transparent;
    height: 18px;
    border: none;
}

.price-range__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 17px;
    height: 17px;
    margin-top: 0.5px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-elevated);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.price-range__input::-moz-range-thumb {
    pointer-events: auto;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-elevated);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.price-range__input:hover::-webkit-slider-thumb,
.price-range__input:focus-visible::-webkit-slider-thumb {
    transform: scale(1.1);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow-sm);
}

.price-range__input:hover::-moz-range-thumb,
.price-range__input:focus-visible::-moz-range-thumb {
    transform: scale(1.1);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow-sm);
}

.price-range__labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.price-range__labels span {
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 3px 10px;
}

.stadium-scroll {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
    border-radius: var(--radius-sm);
}

.stadium-svg {
    display: block;
    width: 100%;
    height: auto;
}

.pitch-field {
    fill: #1e7a35;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2.5;
}

.pitch-line {
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
}

.pitch-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
}

.pitch-label {
    fill: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 3px;
    text-anchor: middle;
}

.stadium-stand {
    --zone-color: #3ba55c;
}

.stadium-section {
    cursor: pointer;
    outline: none;
}

.stadium-section-rect {
    fill: color-mix(in srgb, var(--zone-color) 78%, var(--bg-card));
    stroke: var(--bg-elevated);
    stroke-width: 2;
    stroke-linejoin: miter;
    transition: fill 0.15s ease, transform 0.15s ease;
    transform-box: fill-box;
    transform-origin: center;
}

.stadium-section-text {
    fill: #ffffff;
    font-size: 15px;
    font-weight: 700;
    dominant-baseline: central;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.3);
    stroke-width: 2.5px;
    stroke-linejoin: round;
}

.stadium-section:hover .stadium-section-rect,
.stadium-section:focus-visible .stadium-section-rect {
    fill: color-mix(in srgb, var(--zone-color) 95%, white 10%);
    transform: scale(1.035);
}

.stadium-section--full .stadium-section-rect {
    opacity: 0.5;
}

.stadium-section--filtered .stadium-section-rect {
    opacity: 0.25;
}

.stadium-section--hidden {
    visibility: hidden;
    pointer-events: none;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    margin: 0 -8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.legend li:hover,
.legend li:focus-visible {
    background: color-mix(in srgb, var(--dot) 12%, var(--bg-card));
    color: var(--text);
}

.legend li.legend__item--active {
    color: var(--text);
    font-weight: 700;
    background: color-mix(in srgb, var(--dot) 16%, var(--bg-card));
    border-color: color-mix(in srgb, var(--dot) 45%, transparent);
}

.legend__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--dot);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent);
    display: inline-block;
    flex-shrink: 0;
    transition: box-shadow 0.15s ease;
}

.legend li.legend__item--active .legend__dot {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 32%, transparent);
}

/* ---------- Botones y chips ---------- */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, white 15%), var(--accent-strong));
    color: #06210f;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn--primary:hover:not(:disabled) {
    box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 85%, transparent);
    transform: translateY(-1px);
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.btn--ghost:hover {
    color: var(--text);
    border-color: var(--text-faint);
    background: var(--bg-card);
}

.link-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: underline;
    padding: 0;
    font-family: inherit;
}

/* Usado en el panel de administración (zoom del editor de sectores) */
.chip {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chip:hover {
    color: var(--text);
    border-color: var(--text-faint);
}

.chip--active {
    background: var(--text);
    color: #0b1220;
    border-color: var(--text);
    font-weight: 700;
}

.section-sector-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 2px;
    padding: 5px 14px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--zone-color) 18%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--zone-color) 40%, transparent);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
}

/* ---------- Mapa de asientos ---------- */
.seatmap-wrap {
    margin-top: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.seatmap-legend {
    display: flex;
    gap: 20px;
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.seatmap-legend span {
    display: inline-flex;
    align-items: center;
}

.seatmap-legend .dot {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    display: inline-block;
    margin-right: 7px;
    vertical-align: middle;
}

.dot--free {
    border: 1.5px solid var(--seat-free);
}

.dot--selected {
    background: var(--seat-selected);
}

.dot--held {
    background: var(--seat-held);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--seat-held) 25%, transparent);
}

.dot--taken {
    background: var(--seat-taken);
}

.seatmap-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
    text-align: center;
}

.seat-grid {
    display: inline-grid;
    gap: 4px;
    min-width: max-content;
    margin: 0 auto;
    align-items: center;
    justify-items: center;
}

.row-label {
    text-align: right;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    align-self: center;
    justify-self: end;
    padding-right: 4px;
}

.seat {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--seat-free);
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-size: 9px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--text-muted);
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.seat:hover:not(:disabled) {
    background: color-mix(in srgb, var(--seat-free) 30%, transparent);
    transform: scale(1.15);
}

.seat--selected {
    background: var(--seat-selected);
    border-color: var(--seat-selected);
    color: var(--text);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5) inset, 0 0 10px -2px var(--seat-selected);
}

.seat--taken {
    background: var(--seat-taken);
    border-color: var(--seat-taken);
    color: var(--text);
    cursor: not-allowed;
    opacity: 0.7;
}

.seat--held {
    background: color-mix(in srgb, var(--seat-held) 55%, transparent);
    border-color: var(--seat-held);
    color: var(--text);
    cursor: not-allowed;
    animation: heldPulse 1.6s ease-in-out infinite;
}

@keyframes heldPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--seat-held) 55%, transparent);
    }
    50% {
        box-shadow: 0 0 0 4px color-mix(in srgb, var(--seat-held) 0%, transparent);
    }
}

/* ---------- Checkout ---------- */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 20px;
    align-items: start;
}

.checkout-summary,
.checkout-form {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.checkout-seat-list,
.confirmation-seat-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.checkout-seat-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 8px;
}

.confirmation-seat-list li {
    font-size: 0.9rem;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.checkout-total {
    font-size: 1.1rem;
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.checkout-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.checkout-form input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.checkout-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.error {
    color: var(--danger);
    font-size: 0.85rem;
    margin: 0 0 12px;
}

/* ---------- Confirmación ---------- */
.confirmation-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    max-width: 480px;
    margin: 24px auto;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.confirmation-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.confirmation-icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--accent);
}

.confirmation-card #confirm-code {
    color: var(--accent);
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.confirmation-card .btn {
    margin-top: 20px;
}

/* ---------- Carrito flotante ---------- */
.cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 28px;
    background: rgba(15, 22, 38, 0.9);
    border-top: 1px solid var(--border-soft);
    backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 -12px 32px -12px rgba(0, 0, 0, 0.5);
    z-index: 30;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cart-bar__info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cart-bar__info strong {
    color: var(--text);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text);
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 40;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.2s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.toast--error {
    border-color: color-mix(in srgb, var(--danger) 55%, var(--border-soft));
    color: #ffb3b5;
}

.toast--success {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border-soft));
    color: #a6e6bb;
}

/* ---------- Tooltip de sector (mapa del estadio) ---------- */
.sector-tooltip {
    position: fixed;
    z-index: 45;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 12px));
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.sector-tooltip.hidden {
    display: none;
}

.sector-tooltip__price {
    margin-left: 8px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---------- Admin: login ---------- */
.login-card {
    max-width: 380px;
    margin: 64px auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    margin-bottom: 20px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.login-card input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--text-faint);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--text-muted);
}

/* ---------- Admin: dashboard ---------- */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
    align-items: start;
    margin-top: 22px;
}

.admin-form-card,
.admin-list-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.admin-form-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 20px 0 10px;
}

.admin-form-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.admin-form-card input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.admin-form-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.form-row {
    display: flex;
    gap: 14px;
}

.form-row label {
    flex: 1;
}

.price-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}

.sector-unblock-hint {
    font-size: 0.8rem;
    color: var(--text-faint);
    margin: -4px 0 10px;
}

.admin-form-card label.checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.admin-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-event-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    flex-wrap: wrap;
    transition: border-color 0.15s ease;
}

.admin-event-row:hover {
    border-color: var(--border);
}

.admin-event-row__meta {
    margin: 2px 0 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: capitalize;
}

.admin-event-row__prices {
    margin: 0;
    color: var(--text-faint);
    font-size: 0.78rem;
}

.admin-event-row__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn--small {
    padding: 6px 14px;
    font-size: 0.8rem;
    margin-bottom: 0;
}

.btn--danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn--danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ---------- Admin: pestañas del dashboard ---------- */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border-soft);
}

.admin-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 4px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.admin-tab:hover {
    color: var(--text);
}

.admin-tab--active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ---------- Admin: Grada (orientaciones + sectores) ---------- */
.orientation-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-top: 4px;
}

.orientation-card {
    --orientation-color: var(--accent);
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.orientation-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--orientation-color);
    opacity: 0.85;
}

.orientation-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.orientation-color-input {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--border-soft);
    border-radius: 50%;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.orientation-color-input:hover,
.orientation-color-input:focus-visible {
    border-color: var(--orientation-color);
}

.orientation-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 50%;
}

.orientation-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.orientation-color-input::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

.orientation-cards__subheading {
    grid-column: 1 / -1;
    margin: 8px 0 -6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.corner-shape-select {
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: inherit;
}

.ring-align-select {
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: inherit;
}

.orientation-name-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    padding: 4px 2px 8px;
    transition: border-color 0.15s ease;
}

.orientation-name-input:focus {
    outline: none;
    border-color: var(--orientation-color);
}

.sector-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sector-list__empty {
    color: var(--text-faint);
    font-size: 0.85rem;
    padding: 8px 0;
}

.sector-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 10px 12px;
    flex-wrap: wrap;
}

.sector-row__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sector-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 0 0 2px;
    min-width: 80px;
    transition: border-color 0.15s ease;
}

.sector-name-input:hover {
    border-bottom-color: var(--border);
}

.sector-name-input:focus {
    outline: none;
    border-bottom-color: var(--orientation-color);
}

.sector-row__count {
    color: var(--text-faint);
    font-size: 0.76rem;
}

.sector-row__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sector-row--blocked {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, var(--bg-card));
}

.sector-row__width {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-faint);
    white-space: nowrap;
}

.sector-width-input {
    width: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 4px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
    text-align: center;
}

.sector-width-input:focus {
    outline: none;
    border-color: var(--orientation-color);
}

.sector-row__blocked {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-faint);
    cursor: pointer;
    white-space: nowrap;
}

.sector-row__blocked input {
    accent-color: var(--danger);
    cursor: pointer;
}

.new-sector-form,
.new-ring-form {
    display: flex;
    gap: 8px;
}

.new-sector-form input,
.new-ring-form input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}

.new-sector-form input:focus,
.new-ring-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.ring-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 12px;
}

.ring-block {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
}

.ring-block--unassigned {
    border: 1px dashed var(--warning, #e0a83e);
    background: color-mix(in srgb, var(--warning, #e0a83e) 8%, transparent);
    margin-top: 12px;
}

.ring-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ring-block__actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ring-name-input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    padding: 2px 2px 6px;
    transition: border-color 0.15s ease;
}

.ring-name-input:focus {
    outline: none;
    border-color: var(--orientation-color);
}

.sector-row__actions select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
}

.sector-editor {
    margin-top: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.sector-editor__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sector-editor__zoom {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.sector-editor__hint {
    color: var(--text-faint);
    font-size: 0.82rem;
    margin: 6px 0 16px;
}

.sector-canvas-wrap {
    display: flex;
    align-items: flex-start;
    max-height: 65vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.sector-row-ruler {
    position: sticky;
    left: 0;
    z-index: 1;
    flex-shrink: 0;
    background: var(--bg-card);
    box-shadow: 1px 0 0 var(--border);
}

#sector-canvas {
    display: block;
    flex-shrink: 0;
    cursor: crosshair;
}

/* ---------- Responsive ---------- */
/* En móvil los filtros del mapa dejan de ser una barra lateral fija y pasan a
   ser un panel lateral (drawer) que se abre con un botón, con fondo oscuro
   detrás para poder cerrarlo tocando fuera. */
@media (max-width: 768px) {
    .stadium-layout {
        grid-template-columns: 1fr;
    }

    .stadium-filters-toggle {
        display: inline-flex;
    }

    .stadium-filters {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: min(320px, 85vw);
        border-radius: 0;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 60;
        overflow-y: auto;
    }

    .stadium-filters.is-open {
        transform: translateX(0);
    }

    .filters-close {
        display: inline-flex;
    }

    .filters-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 55;
    }

    /* El D-pad de flechas se oculta: en móvil el mapa se mueve arrastrando
       con el dedo (scroll táctil nativo del contenedor), no con flechas. */
    .map-pan-controls {
        display: none;
    }
}

@media (max-width: 720px) {
    .checkout-grid,
    .admin-grid,
    .orientation-cards {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar__event {
        text-align: left;
    }

    .price-fields {
        grid-template-columns: 1fr;
    }

    .event-card {
        padding: 18px 20px 18px 24px;
    }

    .event-card__action {
        align-items: flex-start;
        width: 100%;
    }
}
