/* ═══════════════════════════════════════════════════════════
   PORTER DB — DARK PREMIUM DASHBOARD
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES ───────────────────────────────────────── */
:root {
  --bg-base: #080c14;
  --bg-surface: #0f1623;
  --bg-card: #141d2e;
  --bg-card-hover: #1a2540;
  --bg-input: #0d1525;
  --bg-elevated: #1e293b;

  --accent: #4f8cff;
  --accent-dim: #3a6fd8;
  --accent-glow: rgba(79, 140, 255, 0.18);
  --accent-solid: #5b9aff;

  --green: #22c55e;
  --blue: #3b82f6;
  --yellow: #eab308;
  --red: #ef4444;
  --purple: #a855f7;
  --cyan: #06b6d4;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --border: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(79, 140, 255, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);

  --font: 'Inter', system-ui, sans-serif;
  --transition: 0.2s ease;
}

.item-line {
  margin-bottom: 2px;
}

.item-detalles {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.65;
  margin-top: 1px;
  margin-left: 14px;
  font-style: italic;
}

/* ─── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(79, 140, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.05) 0%, transparent 50%);
  overflow: hidden;
}

.login-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particle-float linear infinite;
}

@keyframes particle-float {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }

  10% {
    opacity: 0.3;
  }

  90% {
    opacity: 0.3;
  }

  100% {
    opacity: 0;
    transform: translateY(-100vh) scale(1);
  }
}

.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 48px 36px;
  background: rgba(15, 22, 35, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-lg);
  animation: login-appear 0.6s ease;
}

@keyframes login-appear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  box-shadow: 0 0 30px rgba(79, 140, 255, 0.25);
  animation: logo-glow 3s ease-in-out infinite alternate;
}

@keyframes logo-glow {
  from {
    box-shadow: 0 0 20px rgba(79, 140, 255, 0.2);
  }

  to {
    box-shadow: 0 0 40px rgba(79, 140, 255, 0.35);
  }
}

.login-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input,
.input-group textarea,
.input-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 12px;
}

.input-row .input-group {
  flex: 1;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--red);
  animation: shake 0.4s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

.login-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 140, 255, 0.3);
}

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

.login-btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 62px;
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

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

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-solid);
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.logo-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─── TABS ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
}

.tab .tab-label {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.3s ease, opacity 0.2s ease, margin-left 0.3s ease;
  margin-left: 0;
}

.tab:hover .tab-label,
.tab.active .tab-label {
  max-width: 160px;
  opacity: 1;
  margin-left: 7px;
}

.tab:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 14px;
}

.tab.active {
  background: var(--accent-glow);
  border-color: var(--border-focus);
  color: var(--accent-solid);
  font-weight: 600;
  padding: 8px 14px;
}

.tab-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  animation: badge-pulse 2s infinite;
}

.badge.new-flash {
  animation: badge-flash 0.6s ease 3;
}

@keyframes badge-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

@keyframes badge-flash {

  0%,
  100% {
    background: var(--red);
  }

  50% {
    background: var(--accent);
  }
}

/* ─── HEADER RIGHT ────────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

.role-admin {
  background: rgba(168, 85, 247, 0.2);
  color: var(--purple);
}

.role-operador,
.role-cocina,
.role-mozo {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

.btn-logout {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main {
  padding: 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fade-in 0.3s ease;
}

/* Chats tab needs no extra padding */
#content-chats {
  margin: -20px;
  margin-top: 0;
  padding: 0;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ─── SECTION HEADER ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.last-update-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn-refresh {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
  border-color: var(--border-focus);
}

.btn-refresh.spinning {
  animation: spin 0.7s linear;
}

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

.btn-primary {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.2);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-danger {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   KANBAN BOARD
   ═══════════════════════════════════════════════════════════ */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 1100px) {
  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kanban {
    grid-template-columns: 1fr;
  }
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.col-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.col-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Column colors */
.col-yellow {
  border-top: 3px solid var(--yellow);
}

.col-yellow .col-title {
  color: var(--yellow);
}

.col-yellow .col-count {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
}

.col-blue {
  border-top: 3px solid var(--blue);
}

.col-blue .col-title {
  color: var(--blue);
}

.col-blue .col-count {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

.col-purple {
  border-top: 3px solid var(--purple);
}

.col-purple .col-title {
  color: var(--purple);
}

.col-purple .col-count {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
}

.col-green {
  border-top: 3px solid var(--green);
}

.col-green .col-title {
  color: var(--green);
}

.col-green .col-count {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.kanban-col-body::-webkit-scrollbar {
  width: 4px;
}

.kanban-col-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ─── ORDER CARD ──────────────────────────────────────────── */
.order-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: all var(--transition);
  animation: card-in 0.25s ease;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.order-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79, 140, 255, 0.15);
}

.order-card.final {
  opacity: 0.55;
}

.card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  background: var(--accent-glow);
  padding: 2px 7px;
  border-radius: 4px;
}

.card-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card-time.urgent {
  color: var(--red);
  font-weight: 600;
}

.card-time.warning {
  color: var(--yellow);
  font-weight: 600;
}

.card-cliente {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-phone {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.card-address {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-items-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.card-notes {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 5px 8px;
  background: rgba(234, 179, 8, 0.08);
  border-radius: 4px;
  border-left: 2px solid var(--yellow);
}

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

.card-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.card-badges {
  display: flex;
  gap: 4px;
}

.card-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-weight: 500;
}

.tipo-delivery {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
}

.tipo-takeaway {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
}

.tipo-local {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.card-actions {
  display: flex;
  gap: 6px;
}

.card-btn {
  flex: 1;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

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

.card-btn.btn-advance {
  background: rgba(79, 140, 255, 0.12);
  color: var(--accent);
  border-color: rgba(79, 140, 255, 0.25);
  flex: 2;
}

.card-btn.btn-advance:hover {
  background: rgba(79, 140, 255, 0.25);
}

.card-btn.btn-cancelar {
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.2);
}

.card-btn.btn-cancelar:hover {
  background: rgba(239, 68, 68, 0.2);
}

.empty-col {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.btn-rapiboy {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 600;
}

.btn-rapiboy:hover {
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════
   DATA TABLE (Reservas, Productos)
   ═══════════════════════════════════════════════════════════ */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  vertical-align: middle;
}

.cell-center {
  text-align: center;
}

.cell-money {
  font-weight: 600;
  color: var(--green);
}

.cell-image {
  width: 56px;
  text-align: center;
}

.cell-image img,
.cell-image div {
  display: block;
  margin: 0 auto;
}

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

.cell-actions {
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

.cell-actions .action-btn + .action-btn {
  margin-left: 6px;
}

/* Today highlight */
.row-today {
  background: rgba(234, 179, 8, 0.06) !important;
}

.row-today td:first-child {
  border-left: 3px solid var(--yellow);
}

/* Inactive row */
.row-inactive {
  opacity: 0.45;
}

.action-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.action-btn:hover {
  background: var(--bg-card-hover);
}

.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Estado badges */
.estado-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

.estado-PENDIENTE {
  background: rgba(234, 179, 8, 0.15);
  color: var(--yellow);
}

.estado-CONFIRMADA {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.estado-CANCELADA {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.estado-COMPLETADA {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

/* ─── FILTERS ─────────────────────────────────────────────── */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.filter-group input[type="date"],
.filter-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  padding: 6px 10px;
  outline: none;
  transition: border-color var(--transition);
}

.filter-group input[type="date"]:focus,
.filter-group select:focus {
  border-color: var(--border-focus);
}

/* ─── TOGGLE SWITCH ───────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked+.toggle-slider {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--green);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(18px);
  background: var(--green);
}

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

.toggle-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   MENU UPLOAD
   ═══════════════════════════════════════════════════════════ */
.menu-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-surface);
  max-width: 600px;
  margin: 0 auto;
}

.menu-upload-area:hover,
.menu-upload-area.drag-over {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.04);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.upload-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-types {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}

.preview-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  max-width: 600px;
  margin: 0 auto 16px;
}

.preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.preview-pdf-icon {
  font-size: 2.5rem;
}

.preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.preview-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.preview-remove {
  flex-shrink: 0;
}

.menu-progress {
  max-width: 600px;
  margin: 16px auto;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

.btn-upload {
  display: none;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

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

.modal-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-form {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  font-size: 0.82rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  animation: toast-in 0.3s ease;
  pointer-events: all;
  box-shadow: var(--shadow-card);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

.toast.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.toast.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.toast.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--blue);
}

.toast.warning {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
  color: var(--yellow);
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   LOADING / SKELETON
   ═══════════════════════════════════════════════════════════ */
.loading-state,
.error-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

.skeleton-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.skeleton-header {
  width: 60%;
  height: 16px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  margin-bottom: 14px;
  animation: shimmer 1.5s infinite;
}

.skeleton-card {
  width: 100%;
  height: 100px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  animation: shimmer 1.5s infinite;
}

.skeleton-table {
  padding: 14px;
}

.skeleton-row {
  width: 100%;
  height: 44px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet 10"
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  .tabs {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .tab {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .main {
    padding: 14px;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .user-info {
    display: none;
  }
}

@media (max-width: 600px) {
  .login-container {
    margin: 16px;
    padding: 32px 24px;
  }

  .login-logo {
    width: 64px;
    height: 64px;
  }

  .login-title {
    font-size: 1.4rem;
  }

  .header-left {
    display: none;
  }

  .data-table {
    font-size: 0.75rem;
  }

  .data-table thead th {
    padding: 8px 10px;
  }

  .data-table tbody td {
    padding: 8px 10px;
  }
}

/* ═══════════════════════════════════════════════════════════
   CONFIGURACION & NEGOCIO
   ═══════════════════════════════════════════════════════════ */
.config-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.config-column {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.config-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.config-card-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.config-card-body {
  padding: 20px;
}

.demora-alert {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
  transition: all var(--transition);
}

.demora-alert.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.demora-text strong {
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════
   SEDE SELECTOR (ADMIN)
   ═══════════════════════════════════════════════════════════ */
.sede-selector {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 24px 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px;
  transition: all var(--transition);
  margin-right: 12px;
}

.sede-selector:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(79, 140, 255, 0.3);
}

.sede-selector:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* BOTONES TURNOS DINAMICOS */
.btn-turno-action {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-turno-action:hover {
  background: var(--bg-card-hover);
}

.btn-turno-action.add {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.3);
}

.btn-turno-action.add:hover {
  background: rgba(34, 197, 94, 0.1);
}

.btn-turno-action.delete {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-turno-action.delete:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ═══════════════════════════════════════════════════════════
   CRM / WHATSAPP CHAT
   ═══════════════════════════════════════════════════════════ */

/* Force chats tab to fill available height */
#content-chats.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 82px);
  overflow: hidden;
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  gap: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

/* ─── Column Base ─────────────────────────────────────────── */
.chat-col-left,
.chat-col-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-surface);
}

.chat-col-left {
  border-right: 1px solid var(--border);
}

.chat-col-right {
  border-left: 1px solid var(--border);
}

.chat-col-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-base);
}

.chat-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-crm-config {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-crm-config:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

/* Password with eye toggle */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap input {
  flex: 1;
  padding-right: 42px;
}

.btn-eye {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.btn-eye:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* Embedded Signup */
.embedded-signup-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-embedded-signup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-embedded-signup:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.btn-embedded-signup:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.embedded-signup-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  min-height: 20px;
}

.modal-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.modal-separator::before,
.modal-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-separator span {
  white-space: nowrap;
}

.chat-col-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* ─── Conversation List (Left Column) ─────────────────────── */
.chat-conv-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.chat-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.chat-section-header.sala-espera {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
  border-bottom: 1px solid rgba(234, 179, 8, 0.2);
}

.chat-section-header.activas {
  background: rgba(79, 140, 255, 0.08);
  color: var(--accent);
  border-bottom: 1px solid rgba(79, 140, 255, 0.15);
}

.chat-section-count {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-conv-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition);
}

.chat-conv-item:hover {
  background: var(--bg-card-hover);
}

.chat-conv-item.active {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

.conv-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-item-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.conv-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.conv-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.conv-item-preview {
  font-size: 0.76rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conv-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bot-icon {
  font-size: 0.85rem;
  opacity: 0.4;
  filter: grayscale(1);
  transition: all var(--transition);
}

.bot-icon.bot-active {
  opacity: 1;
  filter: none;
}

.conv-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  animation: badge-pulse 2s infinite;
}

.chat-empty-list {
  text-align: center;
  padding: 24px 14px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.chat-loading,
.chat-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Messages Panel (Center Column) ──────────────────────── */
.chat-messages-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  color: var(--text-muted);
}

.chat-empty-icon {
  font-size: 3rem;
  opacity: 0.3;
}

.chat-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chat-empty-sub {
  font-size: 0.82rem;
}

/* Assign sede banner */
.chat-assign-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(234, 179, 8, 0.1);
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.assign-label {
  font-size: 0.82rem;
  color: var(--yellow);
  font-weight: 600;
}

.assign-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assign-sede-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 6px 10px;
  outline: none;
  min-width: 160px;
}

.assign-sede-select:focus {
  border-color: var(--border-focus);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

/* Control bar */
.chat-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
  gap: 12px;
}

.chat-control-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.chat-contact-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-bot-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.chat-bot-status.bot-on {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.chat-bot-status.bot-off {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.chat-control-right {
  flex-shrink: 0;
}

.btn-chat-action {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-chat-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-tomar {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
  border-color: rgba(234, 179, 8, 0.3);
}

.btn-tomar:hover:not(:disabled) {
  background: rgba(234, 179, 8, 0.25);
}

.btn-devolver {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.3);
}

.btn-devolver:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.25);
}

/* Messages scroll area */
.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.chat-no-messages {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Chat Bubbles ────────────────────────────────────────── */
.chat-bubble {
  max-width: 65%;
  padding: 9px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.5;
  position: relative;
  animation: bubble-in 0.2s ease;
  word-wrap: break-word;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-bubble.bubble-in {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble.bubble-out {
  align-self: flex-end;
  background: #054d29;
  color: #e8f5e9;
  border-bottom-right-radius: 4px;
}

.bubble-sender {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.7;
}

.bubble-text {
  white-space: pre-wrap;
}

.bubble-time {
  font-size: 0.62rem;
  text-align: right;
  margin-top: 4px;
  opacity: 0.55;
}

/* ─── Input Bar ───────────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.chat-msg-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 10px 18px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-msg-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.chat-msg-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-msg-input::placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3);
}

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

/* ─── Client Info (Right Column) ──────────────────────────── */
.chat-client-info {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.client-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.client-empty-icon {
  font-size: 2rem;
  opacity: 0.3;
}

.client-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.client-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-glow), rgba(168, 85, 247, 0.15));
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.client-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin: 0;
}

.client-detail {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.client-detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.client-detail-value {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
}

.client-phone-link {
  color: var(--green);
  text-decoration: none;
  transition: color var(--transition);
}

.client-phone-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ─── Chat Responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .chat-layout {
    grid-template-columns: 260px 1fr;
  }

  .chat-col-right {
    display: none;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-col-left {
    border-right: none;
    max-height: 200px;
  }

  #content-chats.active {
    height: calc(100vh - 120px);
  }
}

/* ═══════════════════════════════════════════════════════════
   MESAS MODULE — Fudo-style
   ═══════════════════════════════════════════════════════════ */

/* CRITICAL: override block display for mesas tab */
#content-mesas.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 80px);
  padding: 0 !important;
}

/* ─── Pisos Tab Bar ──────────────────────────────────────── */
.pisos-tabs-bar {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: nowrap;
  flex-shrink: 0;
  align-items: center;
}

.piso-tab {
  padding: 7px 16px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-bottom: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.piso-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.piso-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
  font-weight: 600;
  margin-bottom: -1px;
  padding-bottom: 8px;
}

.piso-tab-config {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 7px 10px;
}

.piso-tab-config:hover {
  color: var(--accent-solid);
}

/* ─── 2-Column Layout ────────────────────────────────────── */
.mesas-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── Floor Plan Grid ────────────────────────────────────── */
.mesas-grid-wrapper,
.edit-grid-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  container-type: size;
  padding: 16px;
}

.mesas-floor-plan {
  width: min(100cqw, 100cqh * var(--grid-cols, 8) / var(--grid-rows, 6));
  height: min(100cqh, 100cqw * var(--grid-rows, 6) / var(--grid-cols, 8));
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 8), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 6), 1fr);
  background-color: var(--bg-surface);
}

.fp-empty {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.fp-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.edit-grid .fp-cell {
  border: 1px dashed rgba(255, 255, 255, 0.06);
}

.fp-cell-empty {
  cursor: default;
}

/* ─── Mesa Card (in grid) ────────────────────────────────── */
.fp-mesa {
  width: 86%;
  height: 86%;
  margin: auto;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 10;
}

.fp-mesa.shape-round {
  border-radius: 50%;
}

.fp-mesa:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.fp-mesa:active {
  transform: scale(0.96);
}

.fp-mesa.selected {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.fp-mesa.fp-dragging {
  opacity: 0.5;
}

.fp-mesa-num {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

/* Edit mode mesa */
.fp-mesa-edit {
  cursor: grab;
}

.fp-mesa-edit:active {
  cursor: grabbing;
}

.fp-mesa-edit.edit-selected {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

/* Edit cell plus */
.fp-cell-editable {
  cursor: pointer;
}

.fp-cell-editable:hover {
  background: rgba(255, 255, 255, 0.04);
}

.fp-cell-plus {
  font-size: 1.2rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.fp-cell-editable:hover .fp-cell-plus {
  opacity: 0.6;
}

/* ─── Info Panel (right, operational) ────────────────────── */
.mesas-info-panel {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mip-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
}

/* Panel header */
.mip-header {
  padding: 12px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

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

.mip-mesa-title {
  font-size: 1rem;
  font-weight: 700;
}

.mip-header-actions {
  display: flex;
  gap: 6px;
}

.mip-btn-sm {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.mip-btn-sm:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.mip-props {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mip-prop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.mip-prop-label {
  color: var(--text-muted);
  font-weight: 500;
}

.mip-estado-badge {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Body empty (libre/reservada) */
.mip-body-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px;
}

.mip-btn-open {
  padding: 11px 28px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.mip-btn-open:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.mip-estado-change {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mip-estado-change label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mip-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 5px 8px;
  outline: none;
}

.mip-elapsed {
  padding: 4px 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Comanda Wrap — OVERFLOW FIX ─────────────────────────── */
.mip-comanda-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Product search section */
.mip-prod-section {
  display: flex;
  flex-direction: column;
  max-height: 42%;
  min-height: 100px;
  border-bottom: 1px solid var(--border);
}

.mip-add-bar {
  flex-shrink: 0;
}

.mip-search {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
}

.mip-search::placeholder {
  color: var(--text-muted);
}

.mip-categories {
  display: flex;
  gap: 4px;
  padding: 5px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.mip-cat-chip {
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.mip-cat-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.mip-cat-chip.active {
  background: var(--accent-glow);
  color: var(--accent-solid);
  border-color: rgba(79, 140, 255, 0.25);
}

.mip-prod-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.mip-prod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.1s;
}

.mip-prod-row:hover {
  background: rgba(34, 197, 94, 0.08);
}

.mip-prod-name {
  font-size: 0.78rem;
  font-weight: 500;
}

.mip-prod-price {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Comanda items section */
.mip-comanda-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mip-comanda-label {
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mip-items-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Comanda item row (Fudo-style) */
.mip-comanda-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(239, 68, 68, 0.06);
}

.mip-ci-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.mip-ci-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}

.mip-ci-btn:hover {
  background: var(--bg-card-hover);
}

.mip-ci-qty {
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.mip-ci-name {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 4px;
}

.mip-ci-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mip-ci-price {
  font-size: 0.78rem;
  font-weight: 600;
}

.mip-ci-del {
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s;
}

.mip-ci-del:hover {
  color: var(--red);
}

/* Footer (total + cerrar) — ALWAYS VISIBLE */
.mip-footer {
  border-top: 2px solid var(--border);
  padding: 10px 12px;
  flex-shrink: 0;
  background: var(--bg-card);
}

.mip-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mip-total-row span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.mip-total-amount {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.mip-footer-actions {
  display: flex;
  gap: 6px;
}

.mip-btn-cerrar {
  flex: 1;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--red);
  color: #fff;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.mip-btn-cerrar:hover {
  background: #dc2626;
}

/* ═══════════════════════════════════════════════════════════
   EDIT LAYOUT MODAL
   ═══════════════════════════════════════════════════════════ */
.edit-layout-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.edit-grid {
  width: min(100cqw, 100cqh * var(--grid-cols, 8) / var(--grid-rows, 6));
  height: min(100cqh, 100cqw * var(--grid-rows, 6) / var(--grid-cols, 8));
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 8), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 6), 1fr);
  background-color: var(--bg-surface);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: calc(100% / var(--grid-cols, 8)) calc(100% / var(--grid-rows, 6));
  position: relative;
}

.edit-props-panel {
  width: 260px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.edit-prop-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-prop-fields {
  padding: 12px 16px;
}

.edit-prop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.edit-prop-label {
  color: var(--text-muted);
  font-weight: 500;
}

.edit-prop-value {
  font-weight: 600;
}

.fp-mesa-edit {
  position: relative;
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #000;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  user-select: none;
}

.resize-handle:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ─── Pisos Modal ─────────────────────────────────────────── */
.piso-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.piso-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 7px 10px;
  outline: none;
}

.piso-input:focus {
  border-color: var(--border-focus);
}

.piso-row-actions {
  display: flex;
  gap: 4px;
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon-sm:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-icon-sm:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-danger-sm {
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger-sm:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

/* ─── Shared modal form ───────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.btn-danger {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-right: auto;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .mesas-info-panel {
    width: 280px;
  }

  .edit-props-panel {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .mesas-layout {
    flex-direction: column;
  }

  #content-mesas.active {
    height: auto !important;
  }

  .mesas-floor-plan {
    min-height: 50vh;
  }

  .mesas-info-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 50vh;
  }
}

/* ═══════════════════════════════════════════════════════════
   MESA PANEL (slide-in width)
   ═══════════════════════════════════════════════════════════ */
.mesa-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transition: opacity 0.25s ease;
}

.mesa-panel-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.mesa-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 60vw;
  max-width: 860px;
  min-width: 500px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 1010;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.mesa-panel.open {
  transform: translateX(0);
}

.mesa-panel.hidden {
  display: none !important;
}

/* Modal split layout (Productos left, Comanda right) */
.mp-split-layout {
  display: flex;
  height: calc(100% - 60px);
  min-height: 0;
  overflow: hidden;
}

.mp-col-productos {
  flex: 1;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mp-col-comanda {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  overflow: hidden;
}

.mp-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  height: 60px;
  box-sizing: border-box;
}

@media (max-width: 800px) {
  .mesa-panel {
    width: 100vw;
    max-width: none;
    min-width: 0;
  }

  .mp-split-layout {
    flex-direction: column;
  }

  .mp-col-productos {
    border-right: none;
    height: 45vh;
    flex: none;
    border-bottom: 1px solid var(--border);
  }

  .mp-col-comanda {
    width: 100%;
    flex: 1;
  }
}

/* ═══════════════════════════════════════════════════════════
   PROMOCIONES
   ═══════════════════════════════════════════════════════════ */

/* ─── Filter pills ─────────────────────────────────────── */
.promo-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

.promo-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.promo-pill:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.promo-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.promo-toggle-inactive {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.promo-toggle-inactive input {
  cursor: pointer;
}

/* ─── Badges ──────────────────────────────────────────── */
.promo-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.promo-badge-descuento {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.promo-badge-cantidad {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.promo-badge-sm {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}

.promo-badge-vencida {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.cell-prods {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-dimmed {
  opacity: 0.5;
}

/* ─── Tipo selection cards ─────────────────────────────── */
.promo-tipo-section {
  margin-top: 16px;
}

.promo-tipo-cards {
  display: flex;
  gap: 12px;
}

.promo-tipo-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.promo-tipo-card:hover {
  border-color: var(--border-focus);
}

.promo-tipo-card.selected {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.08);
}

.promo-tipo-icon {
  font-size: 1.5rem;
}

.promo-tipo-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Presets ──────────────────────────────────────────── */
.promo-presets {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.promo-preset-btn {
  padding: 6px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.promo-preset-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Days checkboxes ─────────────────────────────────── */
.promo-dias-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.promo-dia-check {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.promo-dia-check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
  color: var(--text-primary);
}

.promo-dia-check input {
  display: none;
}

/* ─── Details collapsible ─────────────────────────────── */
.promo-details {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.promo-details summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  transition: color var(--transition);
}

.promo-details summary:hover {
  color: var(--text-primary);
}

.promo-details summary::-webkit-details-marker {
  display: none;
}

.promo-details[open] summary {
  border-bottom: 1px solid var(--border);
}

.promo-details>div {
  padding: 0 14px;
}

/* ─── Product selector ────────────────────────────────── */
.promo-prod-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.promo-prod-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background var(--transition);
}

.promo-prod-row:hover {
  background: var(--bg-card-hover);
}

.promo-prod-row.selected {
  background: rgba(79, 140, 255, 0.08);
}

.promo-prod-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
}

.promo-prod-cat {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.promo-prod-price {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── Selected chips ──────────────────────────────────── */
.promo-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.promo-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.25);
  font-size: 0.78rem;
  color: var(--text-primary);
}

.promo-chip-price {
  font-size: 0.72rem;
}

.promo-chip-x {
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.promo-chip-x:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.15);
}

/* ═══════════════════════════════════════════════════════════
   RESERVAS SECTION
   ═══════════════════════════════════════════════════════════ */
.reservas-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  align-items: flex-end;
}

.reservas-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reservas-filter-group label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reservas-filter-group input,
.reservas-filter-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  min-width: 130px;
}

.reserva-estado-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.reserva-estado-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 4px 24px 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.reserva-estado-select:focus {
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.reserva-mesas-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.reserva-mesa-check {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}

.reserva-mesa-check:has(input:checked) {
  background: rgba(79, 140, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.reserva-mesa-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

/* Action buttons for table rows */
.cell-actions {
  white-space: nowrap;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cell-center {
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   MESAS — Date/time picker + reservation dot
   ═══════════════════════════════════════════════════════════ */
.mesa-date-pick,
.mesa-time-pick {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.78rem;
  color-scheme: dark;
}

.mesa-date-pick {
  max-width: 140px;
}

.mesa-time-pick {
  max-width: 90px;
}

.fp-mesa-reserva-dot {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.6rem;
  line-height: 1;
}

.fp-mesa {
  position: relative;
}

/* Pisos pills in reserva modal */
.rv-piso-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rv-piso-pill {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}

.rv-piso-pill:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.rv-piso-pill.active {
  background: rgba(79, 140, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.rv-piso-group {
  width: 100%;
  margin-bottom: 12px;
}

.rv-piso-group-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.rv-piso-group-mesas {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE GLOBAL — TABLET Y MÓVIL (v2 agresivo)
   Diseñado para no eliminar nada, solo ajustar layout/flujo.
   ═══════════════════════════════════════════════════════════ */

html, body { max-width: 100vw; }

/* ── TABLET (≤1024px) ─────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Header: dos filas — logo+user, tabs scroll horizontal abajo */
  .header {
    height: auto !important;
    min-height: 56px;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center;
  }
  .logo { flex: 0 0 auto; }
  .logo-text { font-size: 0.9rem; }
  .logo-sub { font-size: 0.6rem; }
  .header-right { margin-left: auto; gap: 8px !important; flex: 0 0 auto; }
  .tabs {
    order: 99 !important;
    width: 100% !important;
    margin: 4px 0 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0 !important; }
  .tab .tab-label {
    max-width: 160px !important;
    opacity: 1 !important;
    margin-left: 7px !important;
  }
  .user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main { padding: 16px !important; }

  /* Mesas */
  #content-mesas.active { height: calc(100dvh - 130px) !important; }
  .mesas-layout { flex-direction: column !important; }
  .mesas-info-panel {
    width: 100% !important;
    max-height: 38vh;
    border-left: none !important;
    border-top: 1px solid var(--border);
  }

  /* Chats */
  #content-chats.active { height: calc(100dvh - 130px) !important; }
  .chat-layout { grid-template-columns: 260px 1fr !important; }
  .chat-col-right { display: none !important; }

  /* Mesa panel modal */
  .mesa-panel { min-width: 0 !important; width: 80vw !important; }

  /* Edit layout modal */
  .edit-layout-body { flex-direction: column !important; }
  .edit-props-panel { width: 100% !important; max-height: 35vh; border-left: none !important; border-top: 1px solid var(--border); }

  /* Section title */
  .section-title { font-size: 1.15rem; }

  /* Marketing campañas */
  .campana-layout { grid-template-columns: 1fr !important; }
}

/* ── MÓVIL (≤768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root { font-size: 14px; }

  .header { padding: 8px 10px !important; gap: 6px !important; }
  .logo-img { width: 30px !important; height: 30px !important; }
  .logo-text { font-size: 0.82rem; }
  .logo-sub { font-size: 0.56rem; }

  .tab { padding: 7px 9px !important; font-size: 0.76rem !important; }
  .tab-icon { font-size: 1rem; }
  .tab .tab-label { font-size: 0.72rem !important; max-width: 140px !important; }

  .user-info { gap: 6px; }
  .user-name { display: none; }
  .user-role-badge { font-size: 0.58rem; padding: 2px 6px; }
  .btn-logout { width: 32px !important; height: 32px !important; font-size: 1rem; }
  .sede-selector { max-width: 130px; font-size: 0.74rem; padding: 4px 8px !important; }

  .main { padding: 12px !important; }

  /* Tab content height ajustado a header de 2 filas (~110px) */
  #content-mesas.active,
  #content-chats.active { height: calc(100dvh - 120px) !important; }

  /* Section header / actions */
  .section-header {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column !important;
  }
  .section-title { font-size: 1.05rem; }
  .section-actions {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
  }
  .section-actions > * { min-width: 0; }
  .section-actions input[type="date"],
  .section-actions input[type="text"],
  .section-actions input[type="search"],
  .section-actions select {
    flex: 1 1 130px;
    min-width: 0;
  }

  /* Botones */
  .btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 14px;
    font-size: 0.78rem;
  }

  /* Modales: pantalla completa */
  .modal-overlay { padding: 0 !important; }
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  .modal-header { padding: 14px 16px !important; }
  .modal-header h2 { font-size: 1rem; }
  .modal-body {
    max-height: calc(100dvh - 130px);
    overflow-y: auto;
    padding: 14px 16px !important;
  }
  .modal-actions {
    flex-wrap: wrap;
    padding: 12px 16px !important;
  }
  .modal-actions > * { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .modal-form { gap: 12px !important; }

  /* Mesa panel: full screen */
  .mesa-panel {
    width: 100vw !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  .mp-split-layout { flex-direction: column !important; height: calc(100dvh - 60px) !important; }
  .mp-col-productos { border-right: none !important; height: 50vh; }
  .mp-col-comanda { width: 100% !important; }

  /* Mesas info panel */
  .mesas-info-panel { max-height: 50vh; }
  #content-mesas.active { height: calc(100dvh - 120px) !important; }
  .pisos-tabs-bar { padding: 8px 10px 0 !important; }

  /* Chats */
  .chat-layout { grid-template-columns: 1fr !important; }
  .chat-col-left { border-right: none !important; max-height: 200px; }

  /* Configuración */
  .config-grid { gap: 14px !important; }
  .config-column { min-width: 0 !important; flex: 1 1 100% !important; }
  .config-card-header { padding: 12px 14px !important; }
  .config-card-header h2 { font-size: 0.88rem !important; }

  /* Tablas con scroll horizontal */
  .costos-table,
  table.data-table,
  .table-wrap > table,
  .config-card table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Grids genéricos a 1 col */
  .metricas-kpi-grid,
  .metricas-charts-grid,
  .metricas-charts-grid.secondary,
  .caja-kpi-grid,
  .caja-kpi-grid-2,
  .caja-kpi-grid-3,
  .caja-form-row,
  .productos-grid,
  .promociones-grid,
  .reservas-grid,
  .templates-grid,
  .campana-layout {
    grid-template-columns: 1fr !important;
  }

  /* Marketing tabs scrollables */
  .marketing-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .marketing-tabs::-webkit-scrollbar { display: none; }
  .m-tab { flex-shrink: 0; padding: 8px 12px !important; font-size: 0.86rem !important; }

  /* Costos subtabs scrollables */
  .costos-subtabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .costos-subtabs::-webkit-scrollbar { display: none; }
  .costos-subtab { flex-shrink: 0; }

  /* Login screen */
  .login-container {
    width: calc(100vw - 20px) !important;
    max-width: 420px;
    padding: 24px 18px !important;
  }
  .login-title { font-size: 1.4rem; }
  .login-logo { width: 60px !important; height: 60px !important; }

  /* Toast */
  .toast {
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    width: calc(100vw - 24px);
    margin: 0 12px;
    font-size: 0.78rem;
  }
  .toast-container { left: 0 !important; right: 0 !important; padding: 10px !important; }

  /* Card de pedido (kanban) */
  .card-items-text { font-size: 0.82rem; }
  .item-adicionales { font-size: 0.72rem; opacity: 0.85; padding-left: 10px; }

  /* Reservas */
  .reserva-mesas-grid { gap: 6px; }
}

/* ── MÓVIL CHICO (≤480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  .logo-text-wrap { display: none !important; }
  .header { padding: 6px 8px !important; }

  .tab { padding: 6px 8px !important; }
  .tab-icon { font-size: 0.92rem; }
  .tab .tab-label { font-size: 0.68rem !important; max-width: 120px !important; }

  .main { padding: 10px !important; }

  .section-title { font-size: 0.98rem; }
  .modal-header h2 { font-size: 0.95rem; }

  .login-container { padding: 20px 14px !important; }
  .login-title { font-size: 1.2rem; }

  /* Botones de acciones modales en columna */
  .modal-actions > * { flex: 1 1 100%; }

  /* Cards más compactas */
  .config-card-body { padding: 14px !important; }
}

/* ── Configuración: toggle de sidebar (siempre oculto en desktop) ── */
.config-mobile-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}
.config-mobile-toggle-arrow {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

/* ── Configuración responsive: sidebar como drawer ─────────── */
@media (max-width: 1024px) {
  .config-layout { flex-direction: column !important; height: auto !important; }
  .config-mobile-toggle { display: flex !important; }
  .config-sidebar {
    width: 100% !important;
    max-height: 0;
    overflow: hidden;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    padding: 0 !important;
    transition: max-height 0.25s ease, padding 0.25s ease;
    margin-bottom: 0;
  }
  .config-sidebar.open {
    max-height: 80vh;
    overflow-y: auto;
    padding: 12px 8px !important;
    margin-bottom: 12px;
  }
  .config-main {
    padding: 0 !important;
    overflow: visible !important;
  }
}

/* ── Edit-layout modal (mesas) responsive ──────────────────── */
@media (max-width: 1024px) {
  /* La modal usa inline width:95vw — respetamos pero apilamos cuerpo */
  .modal .modal-header > div {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .modal-header h2 { font-size: 0.92rem !important; }
}

@media (max-width: 768px) {
  /* Pisar inline styles del edit-layout modal */
  #modal-content[style] {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
  .edit-layout-body {
    flex-direction: column !important;
    height: calc(100dvh - 110px) !important;
  }
  .edit-grid-wrapper {
    flex: 1 1 auto !important;
    min-height: 50vh;
    padding: 8px !important;
  }
  .edit-props-panel {
    width: 100% !important;
    max-height: 38vh;
    border-left: none !important;
    border-top: 1px solid var(--border);
  }
  .modal-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .modal-header > div {
    width: 100%;
    justify-content: space-between;
  }
  .modal-header input[type="number"] { width: 56px !important; }

  /* Pisos tab bar más compacto */
  .pisos-tabs-bar { font-size: 0.78rem; }
  .piso-tab { padding: 6px 12px !important; font-size: 0.78rem !important; }
}

/* ── HERO / LOGIN refinado ────────────────────────────────── */
@media (max-width: 768px) {
  .login-screen { padding: 16px; align-items: flex-start; padding-top: 6vh; }
  .login-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 28px 22px !important;
    border-radius: var(--radius-lg) !important;
  }
  .login-logo-wrap { margin-bottom: 20px; }
  .login-logo { width: 64px !important; height: 64px !important; margin-bottom: 10px; }
  .login-title { font-size: 1.35rem; }
  .login-subtitle { font-size: 0.78rem; }
  .login-form { gap: 14px; }
  .input-group input,
  .input-group textarea,
  .input-group select { padding: 11px 13px; font-size: 16px; }
  .login-btn { padding: 12px !important; font-size: 0.95rem !important; }
}

@media (max-width: 480px) {
  .login-screen { padding: 12px; padding-top: 4vh; }
  .login-container { padding: 22px 16px !important; }
  .login-logo { width: 56px !important; height: 56px !important; }
  .login-title { font-size: 1.15rem; }
}

/* ── Touch targets accesibles ────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .tab,
  .btn-refresh,
  .btn-logout,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .modal-close,
  .piso-tab,
  .m-tab,
  .costos-subtab {
    min-height: 40px;
  }
  /* Inputs no zoom en iOS */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}