:root {
    --red: #8B1A1A;
    --green: #1C3A2A;
    --green-mid: #2E5E42;
    --cream: #F5F0E8;
    --gold: #C4A44A;
    --ink: #2C1810;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    /* Reserva siempre el hueco de la barra de scroll → sin saltos al cambiar de pestaña */
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

body {
    font-family: 'Lato', system-ui, sans-serif;
    background: #ece6db;
    color: var(--ink);
    line-height: 1.5;
}

.admin-wrap {
    max-width: 1360px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Flash */
.a-flash {
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 700;
}
.a-flash-ok { background: #e3f1e8; color: var(--green); border: 1px solid var(--green-mid); }
.a-flash-err { background: #f8e6e6; color: var(--red); border: 1px solid var(--red); }

/* Login */
.login-box {
    max-width: 380px;
    margin: 8vh auto 0;
    background: #fff;
    border: 1px solid #ddd2bd;
    border-top: 5px solid var(--gold);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}
.login-box h1 { font-size: 1.4rem; color: var(--green); }
.login-sub { color: #8a7d6a; font-size: 0.9rem; margin-top: 0.25rem; }
.login-box form { margin-top: 1.5rem; text-align: left; }
.login-box label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.login-box input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 1rem;
}

/* Buttons */
.a-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.7rem 1.4rem;
    background: var(--green);
    color: var(--cream);
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
.a-btn:hover { background: var(--green-mid); }
.a-btn-ghost { background: transparent; color: var(--green); border: 1px solid var(--green); margin: 0; }
.a-btn-sm { margin: 0; padding: 0.5rem 1rem; font-size: 0.85rem; }
.a-error { display: block; color: var(--red); margin-top: 0.4rem; font-size: 0.85rem; }

/* Header */
.a-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.a-header h1 { font-size: 1.5rem; color: var(--green); }

/* Nav tabs */
.a-nav {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #ddd2bd;
}
.a-nav a {
    padding: 0.6rem 1.1rem;
    text-decoration: none;
    color: var(--green-mid);
    font-weight: 700;
    border-radius: 8px 8px 0 0;
    border: 2px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}
.a-nav a:hover { background: #fff; }
.a-nav a.active {
    background: #fff;
    color: var(--red);
    border-color: #ddd2bd;
}

/* Accesos rápidos */
.a-quick {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Paginador */
.a-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}
.a-pager-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--green-mid);
    border-radius: 6px;
    color: var(--green);
    text-decoration: none;
    font-weight: 700;
}
.a-pager-btn:hover { background: #fff; }
.a-pager-btn.disabled {
    color: #b9b0a0;
    border-color: #ddd2bd;
    cursor: not-allowed;
}
.a-pager-info { color: #8a7d6a; font-size: 0.9rem; }

/* Stats */
.a-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.85rem;
    margin-bottom: 2rem;
}
.a-stat {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a7d6a;
}
.a-stat span {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--green);
}
.a-stat-big { border-color: var(--gold); border-width: 2px; }
.a-stat-big span { color: var(--red); }

/* Sections */
.a-section { margin-bottom: 2.5rem; }
.a-section > h2,
.a-section-head h2 { color: var(--red); font-size: 1.2rem; margin-bottom: 1rem; }
.a-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.a-empty { color: #8a7d6a; font-style: italic; }

/* Sub-stats (bus / alergias) */
.a-substats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.a-substat {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}
.a-substat h3 { color: var(--green); font-size: 1rem; margin-bottom: 0.6rem; }
.a-substat ul { list-style: none; }
.a-substat li { padding: 0.2rem 0; border-bottom: 1px solid #f1ece1; font-size: 0.9rem; }
.a-substat li:last-child { border-bottom: none; }
.a-substat strong { color: var(--red); }
.a-bus-peak { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 2px solid var(--gold); font-size: 0.9rem; }

/* Buscador */
.a-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.inv-search { align-items: center; }
.inv-search .a-hint { margin: 0; white-space: nowrap; }
.a-search input[type="search"] {
    flex: 1;
    min-width: 220px;
    padding: 0.6rem 0.85rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 1rem;
}
.a-spinner {
    align-self: center;
    color: #8a7d6a;
    font-size: 0.85rem;
}
.hidden { display: none; }
.a-alias { color: #8a7d6a; font-style: italic; }
.a-t-alias { margin-top: 0.25rem; }

/* RSVP cards */
.a-card {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-left: 4px solid var(--green-mid);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.a-card-no { border-left-color: #b9b0a0; opacity: 0.85; }
.a-card-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.a-card-head strong { font-size: 1.05rem; }
.a-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
}
.a-badge-yes { background: var(--green); color: var(--cream); }
.a-badge-no { background: #cfc6b6; color: var(--ink); }
.a-when {
    margin-left: auto;
    color: #8a7d6a;
    font-size: 0.82rem;
    white-space: nowrap;
}
.a-edit {
    margin-left: 0.6rem;
    border: none;
    background: #e7eef0;
    color: var(--green);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
}
.a-edit:hover { background: var(--green); color: #fff; }
.a-del {
    margin-left: 0.6rem;
    border: none;
    background: #f3e2e2;
    color: var(--red);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
}
.a-del:hover { background: var(--red); color: #fff; }
.a-meta { font-size: 0.88rem; color: var(--green-mid); margin-bottom: 0.6rem; }

.a-people {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.a-people th, .a-people td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #efe9dd;
    vertical-align: top;
}
.a-people th { color: #8a7d6a; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; }
.a-people em { color: #8a7d6a; }
.a-msg { margin-top: 0.6rem; font-style: italic; color: #5a4a3a; }

/* Music rows */
.a-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.6rem;
}
.a-votes { font-weight: 700; color: var(--green); min-width: 44px; }
.a-cover { width: 40px; height: 40px; border-radius: 5px; object-fit: cover; }
.a-row-main { flex: 1; }
.a-row-main small { color: #8a7d6a; }
.a-link { margin-left: 0.5rem; color: #1DB954; font-size: 0.8rem; font-weight: 700; text-decoration: none; }

/* Photos */
.a-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.a-photo {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 8px;
    overflow: hidden;
}
.a-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.a-photo figcaption {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
}
.a-photo .a-del { margin-left: auto; }

@media (max-width: 640px) {
    .a-people { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Modal de edición */
.a-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(28, 24, 16, 0.6);
    padding: 2rem 1rem;
    overflow-y: auto;
}
.a-modal.hidden { display: none; }
.a-modal-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border-top: 5px solid var(--gold);
    max-width: 640px;
    width: 100%;
    margin: auto;
    padding: 1.75rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.a-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.9rem;
    width: 34px;
    height: 34px;
    border: none;
    background: var(--cream);
    color: var(--red);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}
.a-modal-close:hover { background: var(--red); color: #fff; }

/* Modal de confirmación / aviso */
.a-modal-confirm { max-width: 420px; text-align: center; }
.a-modal-confirm p { font-size: 1.05rem; color: var(--ink); margin-bottom: 1.25rem; }
.a-modal-actions { display: flex; gap: 0.6rem; justify-content: center; }
.a-modal-actions .a-btn { margin: 0; }

/* Formulario de edición */
.a-form-title { color: var(--green); margin-bottom: 1rem; font-size: 1.15rem; }
.a-form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.a-form-row .a-field { flex: 1; min-width: 160px; }
.a-field { display: block; margin-bottom: 0.85rem; }
.a-field > span { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 0.25rem; }
.a-field input, .a-field select, .a-field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
.a-person {
    border: 1px solid #ddd2bd;
    border-radius: 8px;
    padding: 0.85rem 1rem 0.25rem;
    margin-bottom: 1rem;
}
.a-person legend { font-weight: 700; color: var(--green-mid); padding: 0 0.4rem; }
.a-person-remove {
    margin-left: 0.5rem;
    border: 1px solid var(--red);
    background: #fff;
    color: var(--red);
    border-radius: 12px;
    padding: 0.1rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}
.a-person-remove:hover { background: var(--red); color: #fff; }
.a-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.a-checks label { font-weight: 400; display: flex; align-items: center; gap: 0.3rem; }
.a-form-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; }

/* Tabla plana de asistentes (edición en vivo) */
.a-hint { color: #8a7d6a; font-size: 0.88rem; margin-bottom: 1rem; }
.a-table-wrap { background: #fff; border: 1px solid #ddd2bd; border-radius: 10px; }
.a-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.a-table th, .a-table td {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid #efe9dd;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.a-table thead th {
    color: #8a7d6a;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: #faf7f1;
    position: sticky;
    top: 0;
}
.a-table tbody tr:hover { background: #fbf9f4; }
.a-table th.a-sortable { cursor: pointer; user-select: none; }
.a-table th.a-sortable:hover { color: var(--green); }
.a-table th.a-sortable::after { content: '⇅'; opacity: 0.35; margin-left: 0.25rem; font-size: 0.85em; }
.a-table th.a-sort-asc::after { content: '▲'; opacity: 1; color: var(--green); }
.a-table th.a-sort-desc::after { content: '▼'; opacity: 1; color: var(--green); }
.a-table .a-t-id { font-weight: 700; color: var(--green); }
.a-table .a-t-bus { color: var(--green-mid); }
.a-table .a-t-actions { text-align: right; }
.a-table .a-t-na { color: #b9b0a0; }
.a-table em { color: #8a7d6a; }

/* Fila en modo edición */
.a-table tr.a-t-editing { background: #f3f7f4; }
.a-table tr.a-t-editing td { vertical-align: top; }
.a-table tr.a-t-editing input[type="text"],
.a-table tr.a-t-editing input[type="email"],
.a-table tr.a-t-editing input[type="tel"],
.a-table tr.a-t-editing input[type="number"] {
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid #c9bfae;
    border-radius: 5px;
    font-size: 0.85rem;
    font-family: inherit;
}
.a-table tr.a-t-editing select {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.4rem;
    border: 1px solid #c9bfae;
    border-radius: 5px;
    font-size: 0.82rem;
    font-family: inherit;
}
.a-t-bus-edit label { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.a-t-bus-edit label span { font-size: 0.72rem; color: #8a7d6a; min-width: 42px; }
.a-t-bus-edit em { display: block; font-size: 0.72rem; color: #8a7d6a; margin-top: 0.2rem; }
.a-t-checks { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.35rem; }
.a-t-checks label { font-weight: 400; display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; font-size: 0.8rem; }
.a-t-save { background: var(--green); }
.a-t-save:disabled { opacity: 0.6; cursor: default; }

/* Buses */
.a-bus {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-left: 4px solid var(--green-mid);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.a-bus-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.a-bus-head strong { color: var(--green); font-size: 1.05rem; }
.a-bus-dest { color: var(--green-mid); font-weight: 700; font-size: 0.9rem; }
.a-bus-occ {
    margin-left: auto;
    background: #e7eef0;
    color: var(--green);
    padding: 0.15rem 0.7rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
}
.a-bus-over { background: #f3e2e2; color: var(--red); }
.a-bus-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.a-bus-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #f1ece1;
    vertical-align: top;
}
.a-bus-table tr:last-child td { border-bottom: none; }
.a-bus-cnt { white-space: nowrap; color: #8a7d6a; }
.a-bus-baja { white-space: nowrap; color: var(--green-mid); font-size: 0.8rem; }

/* ===== Plano de mesas (seating) ===== */
.a-stat-inline { font-size: 0.9rem; color: #8a7d6a; }
.a-stat-inline strong { color: var(--red); font-size: 1.1rem; }

.seat-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.seat-toolbar input[type="text"], .seat-toolbar input[type="number"], .seat-toolbar select {
    padding: 0.5rem 0.6rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}
.seat-toolbar input[type="number"] { width: 70px; }
.seat-toolbar .a-hint { margin: 0; }

.seat-wrap { display: flex; gap: 1rem; align-items: flex-start; }
.seat-side {
    flex: 0 0 240px;
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 10px;
    padding: 0.9rem;
    position: sticky;
    top: 1rem;
    max-height: 80vh;
    overflow-y: auto;
}
.seat-side h3 { color: var(--green); font-size: 1rem; margin-bottom: 0.6rem; }
.seat-side input[type="search"] {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    margin-bottom: 0.7rem;
    font-size: 0.9rem;
}
.seat-chips { display: flex; flex-direction: column; gap: 0.5rem; }
.seat-group {
    border: 1px solid hsl(var(--g, 140) 40% 80%);
    border-left: 5px solid hsl(var(--g, 140) 45% 50%);
    border-radius: 8px;
    padding: 0.35rem;
    background: hsl(var(--g, 140) 45% 97%);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.seat-dropzone { min-height: 40px; border-radius: 8px; transition: background 0.15s; }
.seat-dropzone.over { background: #e3f1e8; outline: 2px dashed var(--green-mid); }

.seat-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3rem;
    background: hsl(var(--g, 140) 45% 94%);
    border: 1px solid hsl(var(--g, 140) 40% 78%);
    border-left: 4px solid hsl(var(--g, 140) 45% 50%);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    cursor: grab;
    user-select: none;
}
.seat-chip:active { cursor: grabbing; }
.seat-chip.dragging { opacity: 0.45; }
.seat-chip-child { font-style: italic; }
.seat-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-chip-x {
    border: none; background: transparent; color: var(--red);
    cursor: pointer; font-size: 0.75rem; padding: 0 0.1rem; flex: 0 0 auto;
}

.seat-canvas {
    position: relative;
    flex: 1;
    min-height: 1000px;
    background: #fff;
    background-image: radial-gradient(#e7e0d2 1px, transparent 1px);
    background-size: 22px 22px;
    border: 1px solid #ddd2bd;
    border-radius: 10px;
    overflow: auto;
}

.seat-table { position: absolute; }
.seat-table.moving { z-index: 50; }
.seat-table.moving .seat-shape { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); }

.seat-table-cfg {
    position: absolute;
    top: 1px; right: 1px;
    border: none;
    background: transparent;
    color: var(--green-mid);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
    z-index: 4;
}
.seat-table-cfg:hover { opacity: 1; }

.seat-shape {
    position: relative;
    margin: 22px;
    background: #f3efe6;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}
.seat-shape:active { cursor: grabbing; }
.seat-round { border-radius: 50%; }
.seat-rect { border-radius: 10px; }
.seat-shape.full { border-color: var(--red); }
.seat-shape.over { background: #e3f1e8; }

.seat-handle {
    position: absolute;
    width: 16px; height: 16px;
    background: #fff;
    border: 2px solid var(--green-mid);
    z-index: 5;
    opacity: 0.85;
}
.seat-handle:hover { opacity: 1; background: var(--green-mid); }
.seat-resize {
    right: -8px; bottom: -8px;
    border-radius: 3px;
    cursor: nwse-resize;
}
.seat-rotate {
    left: 50%; top: -26px;
    transform: translateX(-50%);
    border-radius: 50%;
    cursor: grab;
}
.seat-rotate::before {
    content: '';
    position: absolute;
    left: 50%; top: 100%;
    width: 2px; height: 12px;
    background: var(--green-mid);
    transform: translateX(-50%);
}
.seat-rotate:active { cursor: grabbing; }

.seat-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    max-width: 80%;
    pointer-events: none;
}
.seat-name {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--green);
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.seat-occ { font-weight: 700; color: var(--green-mid); font-size: 0.82rem; }
.seat-shape.full .seat-occ { color: var(--red); }

.seat-dots { position: absolute; inset: 0; }
.seat-dot {
    position: absolute;
    width: 9px; height: 9px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #cfc6b6;
}
.seat-person {
    position: absolute;
    width: 26px; height: 26px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: hsl(var(--g, 140) 45% 42%);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    cursor: grab;
    z-index: 3;
}
.seat-person:active { cursor: grabbing; }
.seat-person.dragging { opacity: 0.45; }

.seat-tip {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    min-width: 170px;
    max-width: 240px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd2bd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 0.4rem;
    z-index: 200;
}
.seat-table:hover .seat-tip,
.seat-tip.open { display: flex; }
.seat-tip-empty { color: #8a7d6a; font-size: 0.82rem; font-style: italic; }

.a-del-btn {
    border: 1px solid var(--red);
    background: #fff;
    color: var(--red);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    cursor: pointer;
}
.a-del-btn:hover { background: var(--red); color: #fff; }

/* ===== Invitados (grupos / subgrupos) ===== */
.inv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd2bd;
}
.inv-mini {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.inv-mini input[type="text"], .inv-mini select {
    padding: 0.45rem 0.55rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}

.inv-tree { display: flex; flex-direction: column; gap: 0.75rem; }
.inv-group {
    background: #fff;
    border: 1px solid #ddd2bd;
    border-left: 4px solid var(--green-mid);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
}
.inv-ungrouped { border-left-color: #b9b0a0; }
.inv-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.inv-group-head:hover { color: var(--green); }
.inv-group-head strong { color: var(--green); font-size: 1rem; }
.inv-count { color: #8a7d6a; font-size: 0.85rem; }
.inv-actions { margin-left: auto; display: flex; align-items: center; gap: 0.35rem; }
.inv-actions .a-edit { margin-left: 0; width: 34px; height: 34px; font-size: 1.1rem; line-height: 1; }
.inv-actions form { display: flex; }
.inv-drag {
    cursor: grab;
    color: #b9b0a0;
    font-size: 1rem;
    line-height: 1;
    user-select: none;
    touch-action: none;
}
.inv-drag:hover { color: var(--green-mid); }
.inv-group.inv-dragging { opacity: 0.5; outline: 2px dashed var(--green-mid); }
.inv-drag-p { font-size: 0.8rem; margin-right: 0.2rem; }
.inv-person.inv-dragging { opacity: 0.5; background: #f3f7f4; }
.inv-caret {
    border: none;
    background: transparent;
    color: var(--green-mid);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 0.2rem;
    transition: transform 0.15s;
}
.inv-group.collapsed .inv-caret { transform: rotate(-90deg); }
.inv-panel { margin: 0.6rem 0 0; }
.inv-panel.hidden, .inv-edit.hidden, .inv-adds.hidden, .inv-match.hidden { display: none; }

.inv-edit {
    margin: 0.6rem 0;
    padding: 0.6rem;
    background: #faf7f1;
    border: 1px solid #e7e0d2;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inv-people { list-style: none; margin: 0.5rem 0 0; }
.inv-person { padding: 0.25rem 0; border-bottom: 1px solid #f3efe6; }
.inv-person:last-child { border-bottom: none; }
.inv-person-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.inv-person-actions { display: flex; align-items: center; gap: 0.4rem; }
.inv-note { color: #8a7d6a; font-style: italic; }
.inv-sent { width: 16px; height: 16px; margin: 0 0.35rem 0 0.15rem; cursor: pointer; accent-color: var(--green-mid); vertical-align: -2px; }
.inv-person-sent > .inv-person-row > span:first-child { color: #6b7d6f; }
.inv-sent:disabled { cursor: default; opacity: 0.8; }

/* Paneles pendientes */
.inv-pending { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 720px) { .inv-pending { grid-template-columns: 1fr; } }
.inv-pend-box { background: #fff; border: 1px solid #eadfce; border-radius: 8px; padding: 0.6rem 0.85rem; }
.inv-pend-box > summary { cursor: pointer; font-weight: 700; color: var(--brown); list-style: none; display: flex; align-items: center; gap: 0.4rem; }
.inv-pend-box > summary::-webkit-details-marker { display: none; }
.inv-pend-box > summary::before { content: '▸'; color: var(--gold); transition: transform 0.15s; }
.inv-pend-box[open] > summary::before { transform: rotate(90deg); }
.inv-pend-n { margin-left: auto; background: #f3efe6; color: #6b5d48; border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.8rem; }
.inv-pend-list { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.inv-pend-list li { padding: 0.25rem 0; border-bottom: 1px solid #f3efe6; font-size: 0.92rem; }
.inv-pend-list li:last-child { border-bottom: none; }
.inv-pend-list em { color: #8a7d6a; font-style: italic; }
.inv-pend-grp { color: #8a7d6a; font-size: 0.85rem; }

/* Modal vista previa de auto-emparejado */
.mp-box { max-width: 640px; width: 92vw; text-align: left; }
.mp-box h3 { margin: 0 0 0.25rem; }
.mp-sub { margin: 0 0 0.75rem; color: #8a7d6a; font-size: 0.9rem; }
.mp-list { max-height: 50vh; overflow-y: auto; border: 1px solid #eadfce; border-radius: 6px; }
.mp-row { display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.6rem; border-bottom: 1px solid #f3efe6; cursor: pointer; }
.mp-row:last-child { border-bottom: none; }
.mp-row input { width: 16px; height: 16px; accent-color: var(--green-mid); cursor: pointer; }
.mp-inv { font-weight: 700; }
.mp-inv em { font-weight: 400; color: #8a7d6a; font-style: italic; }
.mp-arrow { color: var(--gold); }
.mp-att { color: var(--green-mid); }
.mp-score { font-size: 0.8rem; color: #8a7d6a; justify-self: end; }
.mp-row:has(input:not(:checked)) { opacity: 0.45; text-decoration: line-through; }
.inv-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.12rem 0.55rem;
    border-radius: 20px;
    margin-left: 0.5rem;
    white-space: nowrap;
    border: 1px solid transparent;
}
.inv-badge::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}
.inv-badge-ok { background: #e3f1e8; color: var(--green-mid); border-color: #bcdcc8; }
.inv-badge-no { background: #f7e8e8; color: var(--red); border-color: #e7c7c7; }
.inv-badge-pend { background: #f3efe6; color: #a99a82; border-color: #e3dac8; }
.inv-match-btn { background: #fff3d6 !important; }

.inv-match {
    margin: 0.4rem 0 0.4rem 1.5rem;
    padding: 0.5rem;
    background: #faf7f1;
    border: 1px solid #e7e0d2;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.inv-match-label { font-size: 0.8rem; color: #8a7d6a; width: 100%; }
.inv-cand { margin: 0; display: inline-flex; }
.inv-cand-btn {
    border: 1px solid var(--green-mid);
    background: #fff;
    color: var(--green);
    border-radius: 16px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    cursor: pointer;
}
.inv-cand-btn:hover { background: var(--green); color: #fff; }
.inv-cand-btn:hover em { color: #fff; }
.inv-cand-btn em { color: #8a7d6a; }
.inv-cand-score { font-weight: 700; margin-left: 0.3rem; }
.inv-manual { width: 100%; gap: 0.4rem; margin-top: 0.2rem; }
.inv-manual select {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid #c9bfae;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
}
.a-linked { font-size: 0.8rem; cursor: help; }

.inv-adds { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.6rem; }

.inv-children {
    margin-top: 0.7rem;
    margin-left: 1.1rem;
    padding-left: 0.6rem;
    border-left: 2px dashed #ddd2bd;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

@media (max-width: 760px) {
    .seat-wrap { flex-direction: column; }
    .seat-side { flex: 1 1 auto; width: 100%; position: static; max-height: none; }
}

/* ---------- Dashboard / Resumen ---------- */
.a-dash-countdown { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.a-cd { background: var(--green); color: var(--cream); border-radius: 12px; padding: 1.25rem 1rem; text-align: center; }
.a-cd-main { background: var(--red); }
.a-cd-warn { background: #9a6b14; }
.a-cd-off { background: #4a4a4a; }
.a-cd-num { display: block; font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--gold); }
.a-cd-lbl { display: block; margin-top: 0.35rem; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.a-cd-sub { display: block; margin-top: 0.25rem; font-size: 0.8rem; opacity: 0.8; }

.a-dash-alerts { background: #fcf3e3; border: 1px solid #e7c98b; border-left: 4px solid var(--gold); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1.5rem; }
.a-dash-alerts strong { color: #8a6a14; }
.a-dash-alerts ul { margin: 0.4rem 0 0; padding-left: 1.2rem; color: #6b5d48; font-size: 0.92rem; }

.a-funnel { display: flex; flex-direction: column; gap: 0.6rem; }
.a-funnel-row { display: grid; grid-template-columns: 160px 1fr 80px; align-items: center; gap: 0.75rem; }
.a-funnel-lbl { font-size: 0.9rem; color: #6b5d48; }
.a-funnel-bar { background: #efe7d7; border-radius: 999px; height: 16px; overflow: hidden; }
.a-funnel-bar > div { height: 100%; background: var(--gold); border-radius: 999px; min-width: 2px; transition: width 0.3s; }
.a-funnel-ok { background: var(--green-mid) !important; }
.a-funnel-pend { background: #c98b8b !important; }
.a-funnel-val { text-align: right; font-weight: 700; font-size: 0.9rem; color: var(--green); }

.a-dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.a-card { background: #fff; border: 1px solid #ddd2bd; border-radius: 10px; padding: 1rem 1.1rem; }
.a-card h3 { margin: 0 0 0.75rem; color: var(--green); font-size: 1rem; }
.a-mini-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.a-mini-table th, .a-mini-table td { padding: 0.35rem 0.5rem; text-align: center; border-bottom: 1px solid #f3efe6; }
.a-mini-table th:first-child, .a-mini-table td:first-child { text-align: left; color: #8a7d6a; }
.a-mini-table td { font-weight: 700; color: var(--green); }
.a-kv { list-style: none; margin: 0; padding: 0; }
.a-kv li { display: flex; justify-content: space-between; padding: 0.35rem 0; border-bottom: 1px solid #f3efe6; font-size: 0.92rem; }
.a-kv li:last-child { border-bottom: none; }
.a-kv span { color: #8a7d6a; }
.a-kv strong { color: var(--green); }
.a-warn { color: var(--red) !important; }

.a-top-list { margin: 0; padding-left: 1.2rem; }
.a-top-list li { padding: 0.25rem 0; font-size: 0.9rem; }
.a-top-votes { color: var(--gold); font-weight: 700; margin-right: 0.3rem; }
.a-top-name em { color: #8a7d6a; font-style: italic; }
.a-top-played { color: var(--green-mid); margin-left: 0.3rem; }
.a-winner { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; }
.a-recent { list-style: none; margin: 0; padding: 0; }
.a-recent li { padding: 0.4rem 0; border-bottom: 1px solid #f3efe6; font-size: 0.9rem; }
.a-recent li:last-child { border-bottom: none; }
.a-recent strong { display: block; color: var(--green); }
.a-recent-meta { color: #8a7d6a; font-size: 0.82rem; }
.a-recent-msg { display: block; color: #6b5d48; margin-top: 0.15rem; }
.a-tools { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.25rem; }
.a-tools .a-btn {
    margin: 0;
    flex: 1 1 170px;
    max-width: 230px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.2rem;
    background: #fff;
    color: var(--green);
    border: 1px solid #ddd2bd;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1;
    transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.a-tools .a-btn:hover {
    background: var(--cream);
    border-color: var(--green);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(28, 58, 42, 0.12);
}
.a-tools .a-btn span { font-size: 1.15rem; line-height: 1; }

@media (max-width: 560px) {
    .a-dash-countdown { grid-template-columns: 1fr; }
    .a-funnel-row { grid-template-columns: 110px 1fr 64px; gap: 0.5rem; }
}

/* Ajustes */
.a-settings { max-width: 480px; }
.a-set-field { margin-bottom: 1.5rem; }
.a-set-field label { display: block; font-weight: 700; color: var(--green); margin-bottom: 0.35rem; }
.a-set-field input { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid #ddd2bd; border-radius: 8px; font-size: 0.95rem; }
.a-set-field .a-hint { margin: 0.3rem 0 0; }

/* Lightbox admin */
.a-zoomable { cursor: zoom-in; }
.a-lightbox {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(20, 16, 12, 0.92);
    display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.a-lightbox.hidden { display: none; }
.a-lb-figure { max-width: min(92vw, 1100px); max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin: 0; }
.a-lb-figure img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 6px; border: 3px solid var(--gold); touch-action: none; user-select: none; -webkit-user-select: none; }
.a-lb-figure figcaption { color: var(--cream); text-align: center; font-size: 0.95rem; }
.a-lb-close, .a-lb-nav {
    position: fixed; border: none; background: rgba(245, 240, 232, 0.14); color: var(--cream);
    width: 48px; height: 48px; border-radius: 50%; font-size: 1.6rem; cursor: pointer; line-height: 1;
}
.a-lb-close:hover, .a-lb-nav:hover { background: rgba(245, 240, 232, 0.28); }
.a-lb-close { top: 1rem; right: 1rem; }
.a-lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.a-lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
