/* ============================================================================
   CHISMOSA · Sistema Visual de Reservas de Mesas
   Diseño adaptable (Móvil / Tablet / Escritorio) + Plano Interactivo a Medida
   ============================================================================ */

:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-card: #263349;
    --bg-floor: #3f4d63;
    --bg-floor-inner: #3b495e;
    --structure-color: #5e6f88;
    --stool-color: #7c8da6;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-subtle: rgba(255, 255, 255, 0.1);

    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;

    --free-bg: #ffffff;
    --free-text: #1e293b;
    --free-border: #e2e8f0;

    --pending-bg: #fffbeb;
    --pending-border: #f59e0b;
    --pending-badge: #d97706;
    --pending-text: #78350f;

    --seated-bg: #ecfdf5;
    --seated-border: #10b981;
    --seated-badge: #059669;
    --seated-text: #064e3b;

    --danger: #ef4444;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

.hidden {
    display: none !important;
}

/* ============================================================================
   PANTALLA DE LOGIN
   ============================================================================ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, #1e1b4b 0%, #0f172a 55%, #090d16 100%);
}

.login-card {
    width: 100%;
    max-width: 410px;
    background: rgba(30, 41, 59, 0.92);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 34px 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
}

.login-brand {
    text-align: center;
    margin-bottom: 26px;
}

.brand-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.login-brand h1 {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.form-group .req {
    color: #f59e0b;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-main);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.96rem;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, filter 0.15s;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

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

.btn-block {
    width: 100%;
    padding: 13px;
    font-size: 0.98rem;
    margin-top: 6px;
}

.login-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================================
   LAYOUT PRINCIPAL DE LA APLICACIÓN
   ============================================================================ */
.app-body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* BARRA SUPERIOR */
.topbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.8);
}

.brand-title {
    display: block;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.06em;
    line-height: 1.1;
}

.brand-subtitle {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Selector rápido de fecha */
.date-quick-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.65);
    padding: 4px 6px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.date-current-pill {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.92rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    text-transform: capitalize;
}

.date-current-pill:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* KPIs Superiores */
.topbar-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stat-free .stat-dot { background: #ffffff; }
.stat-pending .stat-dot { background: #f59e0b; }
.stat-seated .stat-dot { background: #10b981; }
.stat-guests { color: #cbd5e1; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-switcher {
    display: flex;
    background: #0f172a;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.view-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.user-name {
    color: #cbd5e1;
    font-weight: 500;
}

.btn-logout {
    color: #fca5a5;
    text-decoration: none;
    font-weight: 600;
}

.btn-logout:hover {
    text-decoration: underline;
}

/* ============================================================================
   WORKSPACE: SIDEBAR (CALENDARIO + LISTA) Y ÁREA DEL PLANO
   ============================================================================ */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.sidebar-panel {
    width: 325px;
    min-width: 325px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    overflow-y: auto;
    z-index: 20;
}

/* Calendario Mensual Interactivo */
.calendar-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.calendar-month-title {
    font-size: 0.94rem;
    font-weight: 700;
    text-transform: capitalize;
}

.btn-cal-nav {
    background: rgba(255, 255, 255, 0.07);
    border: none;
    color: var(--text-main);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.05rem;
}

.btn-cal-nav:hover {
    background: rgba(255, 255, 255, 0.16);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.14s;
}

.cal-day:hover:not(.cal-empty) {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.cal-day.cal-empty {
    background: transparent;
    cursor: default;
}

.cal-day.is-today {
    border-color: #6366f1;
    color: #a5b4fc;
}

.cal-day.is-selected {
    background: var(--accent-primary) !important;
    color: #fff !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
}

.cal-day-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 99px;
    margin-top: 1px;
    background: rgba(245, 158, 11, 0.25);
    color: #fcd34d;
    line-height: 1.1;
}

.cal-day.is-selected .cal-day-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.calendar-shortcuts {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.chip-shortcut {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.chip-shortcut:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Lista lateral de reservas del día */
.day-bookings-card {
    flex: 1;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.day-bookings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.day-bookings-header h3 {
    font-size: 0.88rem;
    font-weight: 700;
}

.badge-count {
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.search-box {
    margin-bottom: 8px;
}

.search-box input {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.day-bookings-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.booking-mini-item {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: transform 0.12s, background 0.12s;
}

.booking-mini-item.is-seated {
    border-left-color: #10b981;
}

.booking-mini-item:hover {
    background: rgba(51, 65, 85, 0.9);
    transform: translateX(2px);
}

.booking-mini-left {
    min-width: 0;
}

.booking-mini-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.booking-mini-code {
    font-weight: 800;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

.booking-mini-name {
    font-weight: 600;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-mini-obs {
    font-size: 0.73rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.booking-mini-pax {
    font-size: 0.76rem;
    font-weight: 700;
    color: #e2e8f0;
    white-space: nowrap;
}

.empty-day-msg {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
    padding: 24px 10px;
}

/* ============================================================================
   ÁREA DEL PLANO DE MESAS (STAGE)
   ============================================================================ */
.stage-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #141c2b;
}

.stage-toolbar {
    padding: 10px 18px;
    background: rgba(30, 41, 59, 0.7);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.legend-group {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.8rem;
    color: #cbd5e1;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

.dot-free { background: #ffffff; border: 1px solid #94a3b8; }
.dot-pending { background: #f59e0b; }
.dot-seated { background: #10b981; }

.zone-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.zone-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.zone-chip.active,
.zone-chip:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ============================================================================
   EL PLANO INTERACTIVO (REPRODUCCIÓN EXACTA DEL PLANO ADJUNTO)
   ============================================================================ */
.floorplan-wrapper {
    flex: 1;
    display: flex;
    padding: 12px 16px;
    overflow: hidden;
}

.floorplan-scroll {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: auto;
    padding: 6px;
}

.floorplan-canvas {
    position: relative;
    /* Ajustado automáticamente al alto disponible de la ventana para que nunca se corte por arriba ni abajo */
    width: var(--fp-custom-width, min(100%, calc((100vh - 165px) * 1.58)));
    max-width: 960px;
    min-width: 600px;
    aspect-ratio: 1182 / 720;
    margin: auto;
    flex-shrink: 0;
    background: var(--bg-floor);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 0 50px rgba(15, 23, 42, 0.25);
    user-select: none;
    overflow: visible;
}

/* Controles de Zoom en la barra del plano */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-subtle);
    padding: 3px 6px;
    border-radius: 8px;
}

.btn-zoom {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    width: 24px;
    height: 24px;
    border-radius: 5px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom:hover {
    background: var(--accent-primary);
}

.zoom-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: #cbd5e1;
    min-width: 40px;
    text-align: center;
    cursor: pointer;
}

/* Muros, barras y pilares grises del plano original */
.fp-structure {
    position: absolute;
    background: var(--structure-color);
    border-radius: 3px;
    pointer-events: none;
}

.fp-wall-vip-top {
    left: 4.8%;
    top: 3.3%;
    width: 17.0%;
    height: 4.4%;
}

.fp-wall-vip-bottom {
    left: 4.8%;
    top: 30.0%;
    width: 17.0%;
    height: 4.4%;
}

.fp-pillar-b {
    left: 32.1%;
    top: 45.8%;
    width: 7.4%;
    height: 11.8%;
}

.fp-wall-b-bottom {
    left: 8.8%;
    top: 73.6%;
    width: 30.6%;
    height: 4.7%;
}

.fp-pillar-a12 {
    left: 56.2%;
    top: 83.5%;
    width: 6.4%;
    height: 10.0%;
}

.fp-wall-sofa-top {
    left: 71.5%;
    top: 63.9%;
    width: 25.0%;
    height: 3.8%;
}

/* ============================================================================
   MESAS DEL PLANO Y TABURETES / SOFÁS
   ============================================================================ */
.fp-table {
    position: absolute;
    background: var(--free-bg);
    color: var(--free-text);
    border: 2px solid var(--free-border);
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3px 4px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.28);
    transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s, border-color 0.16s, opacity 0.2s;
    z-index: 5;
}

.fp-table:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
    z-index: 15;
}

.fp-table.is-dimmed {
    opacity: 0.22;
    pointer-events: none;
}

/* Formas especiales */
.fp-table.shape-round {
    border-radius: 50%;
}

.fp-table.shape-vip {
    border-radius: 10px;
}

.fp-table.shape-sofa {
    border-radius: 10px;
}

/* Taburetes / Asientos decorativos alrededor de cada mesa (fiel al plano) */
.stool {
    position: absolute;
    background: var(--stool-color);
    border-radius: 4px;
    pointer-events: none;
    z-index: -1;
    transition: background-color 0.15s;
}

/* Mesas rectangulares estándar: 1 asiento arriba y 1 abajo */
.shape-rect .stool-top {
    top: -11%;
    left: 18%;
    width: 64%;
    height: 10%;
    border-radius: 4px 4px 0 0;
}

.shape-rect .stool-bottom {
    bottom: -11%;
    left: 18%;
    width: 64%;
    height: 10%;
    border-radius: 0 0 4px 4px;
}

/* Mesa VIP: 3 asientos a la izquierda y 3 a la derecha */
.shape-vip .stool-l1, .shape-vip .stool-l2, .shape-vip .stool-l3 {
    left: -13%;
    width: 12%;
    height: 22%;
    border-radius: 4px 0 0 4px;
}
.shape-vip .stool-r1, .shape-vip .stool-r2, .shape-vip .stool-r3 {
    right: -13%;
    width: 12%;
    height: 22%;
    border-radius: 0 4px 4px 0;
}
.shape-vip .stool-l1, .shape-vip .stool-r1 { top: 8%; }
.shape-vip .stool-l2, .shape-vip .stool-r2 { top: 39%; }
.shape-vip .stool-l3, .shape-vip .stool-r3 { top: 70%; }

/* Mesa redonda E1: 4 asientos (arriba, abajo, izq, der) */
.shape-round .stool-top {
    top: -10%;
    left: 28%;
    width: 44%;
    height: 12%;
    border-radius: 4px;
}
.shape-round .stool-bottom {
    bottom: -10%;
    left: 28%;
    width: 44%;
    height: 12%;
    border-radius: 4px;
}
.shape-round .stool-left {
    left: -9%;
    top: 28%;
    width: 12%;
    height: 44%;
    border-radius: 4px;
}
.shape-round .stool-right {
    right: -9%;
    top: 28%;
    width: 12%;
    height: 44%;
    border-radius: 4px;
}

/* Sofá Salida: 3 asientos arriba y 3 abajo */
.shape-sofa .stool-t1, .shape-sofa .stool-t2, .shape-sofa .stool-t3 {
    top: -12%;
    width: 23%;
    height: 11%;
    border-radius: 4px 4px 0 0;
}
.shape-sofa .stool-b1, .shape-sofa .stool-b2, .shape-sofa .stool-b3 {
    bottom: -12%;
    width: 23%;
    height: 11%;
    border-radius: 0 0 4px 4px;
}
.shape-sofa .stool-t1, .shape-sofa .stool-b1 { left: 6%; }
.shape-sofa .stool-t2, .shape-sofa .stool-b2 { left: 38.5%; }
.shape-sofa .stool-t3, .shape-sofa .stool-b3 { left: 71%; }

/* ESTADOS DE COLOR DE LAS MESAS EN EL PLANO */
.fp-table.estado-pendiente {
    background: var(--pending-bg);
    border-color: var(--pending-border);
    color: var(--pending-text);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), 0 6px 14px rgba(0, 0, 0, 0.3);
}

.fp-table.estado-pendiente .stool {
    background: #d97706;
}

.fp-table.estado-en_mesa {
    background: var(--seated-bg);
    border-color: var(--seated-border);
    color: var(--seated-text);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 6px 14px rgba(0, 0, 0, 0.3);
}

.fp-table.estado-en_mesa .stool {
    background: #059669;
}

/* Contenido interno de cada mesa en el plano */
.fp-code {
    font-weight: 800;
    font-size: clamp(0.68rem, 0.95vw, 0.88rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.fp-client {
    font-size: clamp(0.55rem, 0.72vw, 0.68rem);
    font-weight: 700;
    max-width: 96%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    line-height: 1.1;
}

.fp-pax-badge {
    margin-top: 2px;
    font-size: clamp(0.52rem, 0.65vw, 0.63rem);
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1.1;
}

/* ============================================================================
   VISTA 2: LISTA / TARJETAS POR ZONA
   ============================================================================ */
.listview-wrapper {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
}

.tables-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.table-card-item {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-top: 4px solid #ffffff;
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.12s, box-shadow 0.12s;
}

.table-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.table-card-item.estado-pendiente {
    border-top-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.table-card-item.estado-en_mesa {
    border-top-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.tc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tc-code {
    font-size: 1.05rem;
    font-weight: 800;
}

.tc-status-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}

.tc-status-libre { background: rgba(255, 255, 255, 0.1); color: #e2e8f0; }
.tc-status-pendiente { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.tc-status-en_mesa { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

.tc-body {
    font-size: 0.86rem;
    color: #cbd5e1;
}

.tc-obs {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.5);
    padding: 6px 8px;
    border-radius: 6px;
}

/* ============================================================================
   MODAL DE RESERVA
   ============================================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.76);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-dialog {
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    animation: modalIn 0.16s ease-out;
}

/* Autocompletado de nombres utilizados anteriormente */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.55);
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.65);
    max-height: 195px;
    overflow-y: auto;
    z-index: 60;
}

.autocomplete-item {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    padding: 9px 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    transition: background 0.12s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: rgba(99, 102, 241, 0.25);
}

.ac-name {
    font-weight: 600;
}

.ac-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.6);
    padding: 2px 7px;
    border-radius: 99px;
}

/* Selector para reservar dos o más mesas juntas */
.join-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.join-header-row label {
    margin-bottom: 0;
}

.btn-link-toggle {
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.14s;
}

.btn-link-toggle:hover {
    background: var(--accent-primary);
    color: #fff;
}

.selected-tables-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.table-pill-selected {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.22);
    border: 1px solid #6366f1;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
}

.table-pill-remove {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-pill-remove:hover {
    background: #ef4444;
}

.join-tables-picker {
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px;
}

.join-picker-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.join-tables-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 130px;
    overflow-y: auto;
}

.join-table-btn {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
}

.join-table-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.2);
}

.join-table-btn.is-joined {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.join-table-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
}

.fp-joined-tag {
    font-size: clamp(0.48rem, 0.58vw, 0.56rem);
    font-weight: 800;
    background: rgba(99, 102, 241, 0.9);
    color: #fff;
    padding: 1px 4px;
    border-radius: 4px;
    margin-top: 1px;
    line-height: 1.05;
    max-width: 96%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-dialog.modal-lg {
    max-width: 680px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 18px 22px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.modal-zone-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 8px;
    border-radius: 99px;
    margin-bottom: 4px;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 800;
}

.modal-subtitle {
    font-size: 0.83rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 2px;
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.07);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.modal-body {
    padding: 20px 22px;
}

/* Botones rápidos de Nº de personas */
.personas-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.personas-quick-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.pax-btn {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
}

.pax-btn.active,
.pax-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

#formNumPersonas {
    width: 82px;
    text-align: center;
    font-weight: 700;
}

/* Selector visual de estado en el modal */
.status-segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.status-option input {
    display: none;
}

.status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: #0f172a;
    color: var(--text-muted);
    transition: all 0.15s;
}

.status-option input:checked + .status-box-pending {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fcd34d;
}

.status-option input:checked + .status-box-seated {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #6ee7b7;
}

.modal-meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding: 7px 10px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 6px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.modal-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.28);
    color: #fff;
}

/* Modal de Usuarios */
.user-create-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr auto auto;
    gap: 8px;
    margin-bottom: 16px;
}

.user-create-grid input,
.user-create-grid select {
    background: #0f172a;
    border: 1px solid var(--border-subtle);
    color: #fff;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.users-table-wrap {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.users-table th,
.users-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.users-table th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-muted);
    font-weight: 600;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 200;
}

.toast {
    background: #1e293b;
    color: #fff;
    border-left: 4px solid #10b981;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.88rem;
    font-weight: 600;
    animation: modalIn 0.18s ease-out;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

/* ============================================================================
   RESPONSIVE: MÓVIL Y TABLET
   ============================================================================ */
@media (max-width: 980px) {
    .app-body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .workspace {
        flex-direction: column;
        overflow: visible;
    }

    .sidebar-panel {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        display: none;
    }

    .sidebar-panel.mobile-open {
        display: flex;
    }

    .floorplan-wrapper {
        padding: 10px;
        justify-content: flex-start;
    }

    .floorplan-scroll {
        justify-content: flex-start;
    }

    .user-create-grid {
        grid-template-columns: 1fr 1fr;
    }
}
