/* ==========================================================================
   MOBILE-FIRST DESIGN SYSTEM — Graduación CCP José Coronel Urtecho
   Base styles: Mobile (320px+) -> Tablet (>=768px) -> Desktop (>=1024px)
   ========================================================================== */

:root {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #e2e8f0;
  --border: #dbe3ee;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --brand-navy: #0f2a52;
  --brand-blue: #1d4ed8;
  --brand-blue-hover: #1e40af;
  --brand-blue-soft: #eff6ff;

  --gold: #d97706;
  --gold-soft: #fef3c7;
  --gold-glow: rgba(245, 158, 11, 0.35);

  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  /* Map surface tokens (light default) */
  --map-bg: #e8eef6;
  --plazoleta-bg: #ffffff;
  --plazoleta-border: rgba(220, 38, 38, 0.28);
  --plazoleta-shadow: 0 16px 40px rgba(15, 42, 82, 0.10);
  --aisle-bg: linear-gradient(180deg, rgba(245, 158, 11, 0.09) 0%, rgba(37, 99, 235, 0.05) 50%, rgba(15, 23, 42, 0.03) 100%);
  --aisle-border: rgba(37, 99, 235, 0.18);
  --row-label-bg: #f1f5f9;
  --row-label-text: #334155;
  --seat-free-bg: #f8fafc;
  --seat-free-border: #cbd5e1;
  --seat-free-text: #64748b;
  --seat-free-back: #cbd5e1;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-nav-h: 60px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.18);
}

/* Dark Cinema Mode for the map panel */
.map-panel.cinema-dark {
  --map-bg: #0b1220;
  --plazoleta-bg: #111c32;
  --plazoleta-border: rgba(248, 113, 113, 0.35);
  --plazoleta-shadow: 0 22px 54px rgba(0, 0, 0, 0.55);
  --aisle-bg: linear-gradient(180deg, rgba(251, 191, 36, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  --aisle-border: rgba(148, 163, 184, 0.18);
  --row-label-bg: rgba(255, 255, 255, 0.08);
  --row-label-text: #cbd5e1;
  --seat-free-bg: rgba(30, 41, 59, 0.85);
  --seat-free-border: #334155;
  --seat-free-text: #94a3b8;
  --seat-free-back: #475569;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, a, select, input {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.print-only {
  display: none;
}

/* Mobile-First visibility helpers */
.desktop-only {
  display: none !important;
}

.mobile-only {
  display: flex;
}

/* ==================== APP SHELL (MOBILE BASE) ==================== */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-top: var(--safe-top);
}

/* ==================== TOPBAR (MOBILE BASE) ==================== */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 35;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.brand-emblem {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-emblem svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text h1 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-pill {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  background: var(--emerald-soft);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Mobile Check-in quick badge in header */
.mobile-checkin-pill {
  align-items: center;
  gap: 6px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.mcp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

/* MODE SWITCHER (full-width segmented bar on mobile) */
.mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  background: var(--bg-app);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--border);
  gap: 3px;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
  min-height: 36px;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--bg-surface);
  color: var(--brand-blue);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.09);
}

.topbar-actions {
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

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

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

.btn-primary {
  background: var(--brand-blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-blue-hover);
}

.btn-secondary {
  background: var(--brand-navy);
  color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
  background: #173a70;
}

.btn-ghost {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-muted);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}

.btn-emerald:hover:not(:disabled) {
  background: #047857;
}

.btn-emerald-soft {
  background: var(--emerald-soft);
  color: #065f46;
  border-color: #a7f3d0;
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.btn-sm {
  font-size: 12.5px;
  padding: 7px 11px;
  min-height: 36px;
  border-radius: 8px;
}

.btn-full {
  width: 100%;
}

/* ==================== SUBBAR: SEARCH & STATS (MOBILE BASE) ==================== */
.subbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 30;
}

.search-row-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.search-box-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* 16px on mobile prevents iOS Safari auto-zoom on focus! */
.search-input {
  width: 100%;
  padding: 9px 34px 9px 36px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--bg-surface);
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  min-height: 40px;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--bg-muted);
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.mobile-filter-trigger {
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--brand-navy);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.mobile-filter-trigger.is-open,
.mobile-filter-trigger.has-filters {
  background: var(--brand-blue-soft);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 55dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 95;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-app);
  min-height: 54px;
}

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

.search-result-item:active,
.search-result-item:hover {
  background: var(--brand-blue-soft);
}

.sr-main {
  min-width: 0;
}

.sr-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}

.sr-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sr-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.seat-code-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg-app);
  color: var(--brand-navy);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Stats strip hidden on compact mobile to maximize map viewport (shown >=768px) */
.stats-strip {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 11px;
}

.stat-chip-accent {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-navy);
}

.stat-chip-accent .stat-value {
  color: var(--emerald);
}

/* ==================== FILTER BAR (COLLAPSIBLE ON MOBILE) ==================== */
.career-bar {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 26;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.career-bar.is-mobile-open {
  display: flex;
}

.filter-left-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.filter-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.mini-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-height: 38px;
}

.mini-select-wide {
  grid-column: span 2;
}

.mini-select:focus {
  border-color: var(--brand-blue);
  background: var(--bg-surface);
}

.mini-clear-btn {
  grid-column: span 2;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #dc2626;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
}

.career-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.career-pills::-webkit-scrollbar {
  display: none;
}

.career-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 32px;
  transition: all 0.14s ease;
}

.career-pill.active {
  background: var(--brand-navy);
  color: #ffffff;
  border-color: var(--brand-navy);
}

.career-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.career-pill-count {
  font-size: 11px;
  opacity: 0.78;
}

.map-quick-controls {
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.icon-chip.active {
  background: var(--brand-navy);
  color: #ffffff;
  border-color: var(--brand-navy);
}

.icon-chip-compact {
  width: 34px;
  padding: 0;
}

.zoom-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-subtle);
  overflow: hidden;
  min-height: 34px;
}

.zoom-btn {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 4px 10px;
  min-height: 32px;
  cursor: pointer;
}

.zoom-btn:active {
  background: var(--bg-muted);
}

.zoom-reset,
.zoom-fit-mini {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text-secondary);
}

.zoom-reset {
  border-right: none;
}

.zoom-value {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

/* ==================== ACTION BANNER ==================== */
.action-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
  z-index: 25;
}

.action-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.action-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fef08a;
  flex-shrink: 0;
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(254, 240, 138, 0.8); }
  70% { box-shadow: 0 0 0 9px rgba(254, 240, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(254, 240, 138, 0); }
}

.btn-banner-cancel {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  min-height: 32px;
  padding: 4px 10px;
}

/* ==================== MAIN WORKSPACE (MOBILE BASE) ==================== */
.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ==================== MOBILE MAP QUICK BAR ==================== */
.mobile-map-bar {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 15;
}

.block-focus-group {
  display: inline-flex;
  background: var(--bg-app);
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--border);
  gap: 2px;
}

.bf-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  min-height: 28px;
}

.bf-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
}

.mobile-map-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==================== MAP PANEL & VIEWPORT ==================== */
.map-panel {
  display: flex;
  flex-direction: column;
  background: var(--map-bg);
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  transition: background 0.25s ease;
}

.map-viewport {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  touch-action: pan-x pan-y;
}

/* Exact scaled bounding box wrapper -> eliminates ghost whitespace on mobile scroll! */
.map-scale-sizer {
  position: relative;
  margin: 0 auto;
  flex-shrink: 0;
}

.map-canvas {
  transform-origin: top left;
  transition: transform 0.14s ease-out;
  display: inline-block;
}

.map-canvas.is-pinching {
  transition: none;
}

/* PLAZOLETA RECTANGULAR FRAME */
.plazoleta-frame {
  position: relative;
  background: var(--plazoleta-bg);
  border: 2.5px solid var(--plazoleta-border);
  border-radius: 20px;
  padding: 18px 20px 16px;
  box-shadow: var(--plazoleta-shadow);
  transition: background 0.25s ease, border-color 0.25s ease;
  display: inline-block;
}

.pair-connector-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: visible;
}

/* STAGE / TARIMA */
.stage-area {
  position: relative;
  margin-bottom: 18px;
}

.stage-curve {
  height: 8px;
  margin: 0 36px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), #f59e0b 25%, #fbbf24 50%, #f59e0b 75%, rgba(245, 158, 11, 0.15));
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45);
}

.stage-box {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 48%, #fde68a 100%);
  border: 2px solid #f59e0b;
  color: #78350f;
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.16);
}

.cinema-dark .stage-box {
  background: linear-gradient(135deg, #451a03 0%, #78350f 50%, #92400e 100%);
  border-color: #f59e0b;
  color: #fef3c7;
}

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

.stage-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.15);
  color: #92400e;
  margin-bottom: 4px;
}

.cinema-dark .stage-badge {
  background: rgba(254, 243, 199, 0.16);
  color: #fde68a;
}

.stage-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.stage-podium {
  font-size: 11.5px;
  opacity: 0.85;
  margin-top: 2px;
}

.stage-flow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.85;
}

.stage-flow-right {
  justify-content: flex-end;
}

.flow-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(180, 83, 9, 0.15);
  font-size: 13px;
}

/* BLOCK HEADERS */
.blocks-header {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.block-header-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.cinema-dark .block-header-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.block-header-card strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--brand-navy);
}

.cinema-dark .block-header-card strong {
  color: #f1f5f9;
}

.block-header-card small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.cinema-dark .block-header-card small {
  color: #94a3b8;
}

.block-dot {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex-shrink: 0;
}

.dot-grad { background: var(--brand-blue); }
.dot-comp { background: var(--gold); }

.aisle-header-badge {
  text-align: center;
  padding: 6px 4px;
  border-radius: 10px;
  background: var(--aisle-bg);
  border: 1px dashed var(--aisle-border);
}

.aisle-header-badge span {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand-blue);
}

.cinema-dark .aisle-header-badge span {
  color: #93c5fd;
}

.aisle-header-badge small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

/* ==================== SEATING ROWS & CHAIRS ==================== */
.seating-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 5;
}

.seat-row {
  display: grid;
  grid-template-columns: 30px 1fr 90px 1fr 30px;
  align-items: center;
  gap: 8px;
}

.row-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 8px;
  background: var(--row-label-bg);
  color: var(--row-label-text);
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

.seat-block {
  display: flex;
  align-items: center;
  gap: 6px;
}

.seat-block-left { justify-content: flex-end; }
.seat-block-right { justify-content: flex-start; }

.center-aisle-cell {
  height: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.center-aisle-cell::before {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 12px;
  right: 12px;
  background: var(--aisle-bg);
  border-left: 1px dashed var(--aisle-border);
  border-right: 1px dashed var(--aisle-border);
}

.aisle-row-tag {
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.75;
}

/* Cinema Seat Component */
.seat-btn {
  --seat-color: var(--brand-blue);
  position: relative;
  width: 44px;
  height: 46px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: transform 0.14s ease, opacity 0.18s ease, filter 0.14s ease;
  user-select: none;
}

@media (hover: hover) and (pointer: fine) {
  .seat-btn:hover {
    transform: translateY(-2px) scale(1.06);
    z-index: 8;
  }
}

.seat-back {
  width: 34px;
  height: 11px;
  border-radius: 6px 6px 2px 2px;
  background: var(--seat-free-back);
  margin-bottom: 2px;
}

.seat-body {
  position: relative;
  width: 40px;
  height: 30px;
  border-radius: 8px 8px 10px 10px;
  background: var(--seat-free-bg);
  border: 1.8px solid var(--seat-free-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.seat-code {
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  color: var(--seat-free-text);
  letter-spacing: -0.02em;
}

.seat-initials {
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
  opacity: 0.92;
  max-width: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Assigned Graduate */
.seat-btn.is-assigned.is-graduate .seat-back {
  background: var(--seat-color);
  filter: brightness(0.86);
}

.seat-btn.is-assigned.is-graduate .seat-body {
  background: var(--seat-color);
  border-color: var(--seat-color);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
}

.seat-btn.is-assigned.is-graduate .seat-code,
.seat-btn.is-assigned.is-graduate .seat-initials {
  color: #ffffff;
}

/* Assigned Companion */
.seat-btn.is-assigned.is-companion .seat-back {
  background: var(--seat-color);
  opacity: 0.75;
}

.seat-btn.is-assigned.is-companion .seat-body {
  background: color-mix(in srgb, var(--seat-color) 16%, var(--plazoleta-bg));
  border-color: var(--seat-color);
  border-width: 2px;
}

.seat-btn.is-assigned.is-companion .seat-code {
  color: var(--seat-color);
}

.seat-btn.is-assigned.is-companion .seat-initials {
  color: var(--text-primary);
}

.cinema-dark .seat-btn.is-assigned.is-companion .seat-initials {
  color: #f8fafc;
}

/* Blocked / Reserved */
.seat-btn.is-blocked .seat-back {
  background: #94a3b8;
  opacity: 0.45;
}

.seat-btn.is-blocked .seat-body {
  background: repeating-linear-gradient(
    -45deg,
    rgba(148, 163, 184, 0.15),
    rgba(148, 163, 184, 0.15) 4px,
    rgba(148, 163, 184, 0.30) 4px,
    rgba(148, 163, 184, 0.30) 8px
  );
  border-color: #94a3b8;
  border-style: dashed;
}

.seat-btn.is-blocked .seat-code {
  color: #64748b;
  text-decoration: line-through;
}

.seat-check-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  border: 2px solid var(--plazoleta-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  z-index: 3;
}

.seat-btn.is-selected {
  transform: translateY(-3px) scale(1.09);
  z-index: 12;
}

.seat-btn.is-selected .seat-body {
  box-shadow: 0 0 0 3px #f59e0b, 0 8px 18px rgba(245, 158, 11, 0.45);
}

.seat-btn.is-paired-highlight {
  transform: translateY(-2px) scale(1.07);
  z-index: 11;
}

.seat-btn.is-paired-highlight .seat-body {
  box-shadow: 0 0 0 3px #fbbf24, 0 6px 16px rgba(245, 158, 11, 0.35);
}

.seat-btn.is-dimmed {
  opacity: 0.22;
  filter: grayscale(0.6);
}

.seat-btn.is-pick-target .seat-body {
  animation: targetPulse 1.3s infinite;
  border-color: #f59e0b;
}

@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.08); }
}

/* Compact grid mode for 10+ columns per block */
.plazoleta-frame.is-compact-grid {
  padding: 16px 18px 14px;
}

.plazoleta-frame.is-compact-grid .seating-rows { gap: 6px; }
.plazoleta-frame.is-compact-grid .seat-row { grid-template-columns: 28px 1fr 80px 1fr 28px; gap: 6px; }
.plazoleta-frame.is-compact-grid .blocks-header { grid-template-columns: 1fr 80px 1fr; }
.plazoleta-frame.is-compact-grid .seat-block { gap: 4px; }
.plazoleta-frame.is-compact-grid .seat-btn { width: 38px; height: 40px; }
.plazoleta-frame.is-compact-grid .seat-back { width: 28px; height: 9px; }
.plazoleta-frame.is-compact-grid .seat-body { width: 35px; height: 27px; border-radius: 7px 7px 8px 8px; }
.plazoleta-frame.is-compact-grid .seat-code { font-size: 9.5px; }
.plazoleta-frame.is-compact-grid .seat-initials { font-size: 7.5px; max-width: 31px; }
.plazoleta-frame.is-compact-grid .center-aisle-cell { min-height: 40px; }

/* Hover tooltip (only shown on fine-pointer desktop via JS) */
.seat-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 190;
  background: #0f172a;
  color: #f8fafc;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  max-width: 260px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.seat-tooltip strong { display: block; font-size: 12.5px; }
.seat-tooltip .tt-meta { color: #cbd5e1; font-size: 11px; }
.seat-tooltip .tt-pair {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #fde68a;
  font-size: 11px;
  font-weight: 600;
}

.plazoleta-footer {
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.cinema-dark .plazoleta-footer {
  border-top-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

/* LEGEND BAR (compact horizontal scroll on mobile) */
.map-legend {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-legend::-webkit-scrollbar { display: none; }

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.legend-seat {
  width: 14px;
  height: 13px;
  border-radius: 4px;
  display: inline-block;
  border: 1.5px solid transparent;
}

.seat-demo-free { background: #f8fafc; border-color: #94a3b8; }
.seat-demo-assigned { background: var(--brand-blue); border-color: var(--brand-blue); }
.seat-demo-checked { background: var(--brand-blue); box-shadow: inset 0 0 0 2px #10b981; }
.seat-demo-selected { background: #fef3c7; border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35); }
.seat-demo-blocked { background: repeating-linear-gradient(-45deg, #e2e8f0, #e2e8f0 3px, #cbd5e1 3px, #cbd5e1 6px); border-color: #94a3b8; border-style: dashed; }

/* ==================== MOBILE BOTTOM SHEET (INSPECTOR) ==================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.inspector-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  background: var(--bg-surface);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -14px 44px rgba(15, 23, 42, 0.24);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
}

.inspector-panel.is-sheet-open {
  transform: translateY(0);
}

.sheet-grab-bar {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
  flex-shrink: 0;
}

.sheet-grab-bar span {
  width: 42px;
  height: 4.5px;
  border-radius: 999px;
  background: var(--border-strong);
}

.inspector-empty,
.inspector-detail {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-empty-head-mobile {
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.inspector-empty-head-mobile h3 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16px;
  color: var(--brand-navy);
}

.empty-illustration {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  align-items: center;
  justify-content: center;
  margin: 4px auto 0;
}

.quick-summary-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
}

.quick-summary-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 9px;
}

.career-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.cb-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cb-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cb-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.quick-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.seat-badge-lg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 5px;
}

.seat-badge-grad { background: var(--brand-blue-soft); color: var(--brand-blue); }
.seat-badge-comp { background: var(--gold-soft); color: #b45309; }

.inspector-head h3 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16.5px;
  color: var(--brand-navy);
  line-height: 1.25;
}

.inspector-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-close-inspector {
  border: none;
  background: var(--bg-app);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* PAIR CARD & CHECK-IN */
.pair-visual-card {
  background: linear-gradient(135deg, #0f2a52 0%, #1e3a8a 100%);
  color: #ffffff;
  border-radius: 15px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 10px 24px rgba(15, 42, 82, 0.2);
}

.pair-career-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  align-self: flex-start;
}

.pair-slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.pair-slot {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
}

.pair-slot-role { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #bfdbfe; }
.pair-slot-code { font-size: 17px; font-weight: 800; color: #fde68a; margin: 2px 0; }
.pair-slot-name { font-size: 11.5px; font-weight: 600; color: #ffffff; }
.pair-link-icon { font-size: 16px; color: #fde68a; font-weight: 800; }

.checkin-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkin-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.checkin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.checkin-person { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.checkin-person small { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); }

/* Institutional Metadata Grid */
.meta-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
}

.meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meta-item.span-2 { grid-column: span 2; }
.meta-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.meta-value { font-size: 12.5px; font-weight: 700; color: var(--text-primary); word-break: break-word; }

.turno-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
}

.turno-matutino { background: #dbeafe; color: #1d4ed8; }
.turno-vespertino { background: #fef3c7; color: #b45309; }
.turno-sabatino { background: #f3e8ff; color: #7e22ce; }
.turno-dominical { background: #d1fae5; color: #047857; }

/* Forms inside Inspector & Modals */
.inspector-form { display: flex; flex-direction: column; gap: 11px; }

.form-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand-blue);
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.form-section-title:first-child { border-top: none; padding-top: 0; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-surface);
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  min-height: 40px;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.form-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inspector-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.companion-link-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 12.5px;
  color: #78350f;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 30px;
}

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

/* ==================== MOBILE BOTTOM NAVIGATION DOCK ==================== */
.mobile-bottom-nav {
  align-items: stretch;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 4px 6px calc(4px + var(--safe-bottom));
  z-index: 45;
  flex-shrink: 0;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.mbn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 2px;
  min-height: 48px;
  border-radius: 10px;
  cursor: pointer;
}

.mbn-item.active {
  color: var(--brand-blue);
}

.mbn-item:active {
  background: var(--brand-blue-soft);
}

/* MOBILE TOOLS GRID */
.mobile-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tool-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.tool-tile:active {
  background: var(--brand-blue-soft);
  border-color: var(--brand-blue);
}

.tool-tile strong { font-size: 14px; color: var(--brand-navy); }
.tool-tile small { font-size: 11.5px; color: var(--text-muted); }

.tool-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tti-purple { background: #f3e8ff; color: #7c3aed; }
.tti-blue { background: #dbeafe; color: #1d4ed8; }
.tti-emerald { background: #d1fae5; color: #059669; }
.tti-amber { background: #fef3c7; color: #d97706; }

/* ==================== MODALS (MOBILE-FIRST BOTTOM SHEETS) ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 150;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetSlideUp {
  from { transform: translateY(36px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16.5px;
  color: var(--brand-navy);
}

.modal-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.modal-close {
  border: none;
  background: var(--bg-app);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 21px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.modal-footer-split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.modal-footer-left {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* CAREER EDITOR MODAL */
.career-list-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.career-edit-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-subtle);
}

.career-edit-row input[type="color"] { width: 32px; height: 32px; border: none; background: none; padding: 0; }
.career-edit-row input[type="text"] {
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
}

.career-order-btns { display: flex; gap: 4px; }

.icon-mini-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 700;
}

.add-career-form {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.add-career-form input[type="color"] { width: 38px; height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 2px; }
.add-career-form input[type="text"] {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 16px;
}

/* LAYOUT CONFIG MODAL */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: span 2; }

.capacity-preview {
  background: var(--brand-blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--brand-navy);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* DATA MODAL */
.data-modal-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.data-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.data-card h3 { margin: 0; font-size: 14.5px; color: var(--brand-navy); }
.data-card p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }

.dropzone {
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  background: var(--bg-surface);
  color: var(--brand-blue);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.dropzone.dragover { background: var(--brand-blue-soft); border-color: var(--brand-blue); }
.dropzone strong { font-size: 13px; color: var(--brand-navy); }
.dropzone small { font-size: 11px; color: var(--text-muted); }

.data-actions-col { display: flex; flex-direction: column; gap: 8px; }
.file-btn { cursor: pointer; }
.danger-zone { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.danger-zone h4 { margin: 0 0 8px; font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.danger-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ROSTER & GROUPS MODAL (MOBILE CARDS -> DESKTOP TABLE) */
.roster-body { display: flex; flex-direction: column; gap: 10px; }

.roster-toolbar-5 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.roster-toolbar-5 input {
  grid-column: span 2;
}

.roster-toolbar-5 select {
  padding: 8px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-surface);
  min-height: 38px;
}

.table-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 58dvh;
}

/* Mobile-First Card View for Tables (<768px) */
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.roster-table thead {
  display: none;
}

.roster-table tbody {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.roster-table tbody tr {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  cursor: pointer;
}

.roster-table tbody tr:active {
  background: var(--brand-blue-soft);
  border-color: var(--brand-blue);
}

.roster-table tbody td {
  padding: 0;
  border: none;
}

.groups-table tbody tr {
  cursor: default;
  grid-template-columns: 1fr 1fr;
}

.groups-table tbody tr:active {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.group-docente-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-surface);
}

.career-tag-inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ==================== PREMIUM TOASTS (TOP ON MOBILE, BOTTOM-RIGHT ON DESKTOP) ==================== */
.toast-container {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 260;
  pointer-events: none;
}

.p-toast {
  --toast-accent: #2563eb;
  --toast-bg-icon: #eff6ff;
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 13px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(203, 213, 225, 0.85);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.p-toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--toast-accent);
}

.p-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.p-toast.is-leaving { opacity: 0; transform: translateY(-14px) scale(0.95); }

.p-toast-success { --toast-accent: #059669; --toast-bg-icon: #d1fae5; }
.p-toast-warn { --toast-accent: #d97706; --toast-bg-icon: #fef3c7; }
.p-toast-error { --toast-accent: #dc2626; --toast-bg-icon: #fee2e2; }
.p-toast-info { --toast-accent: #2563eb; --toast-bg-icon: #dbeafe; }

.p-toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--toast-bg-icon);
  color: var(--toast-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p-toast-content { flex: 1; min-width: 0; }
.p-toast-title { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; font-size: 13px; font-weight: 800; color: var(--brand-navy); }
.p-toast-msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.38; }

.p-toast-action {
  margin-top: 7px;
  border: 1px solid color-mix(in srgb, var(--toast-accent) 30%, transparent);
  background: var(--toast-bg-icon);
  color: var(--toast-accent);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.p-toast-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.p-toast-progress {
  position: absolute;
  left: 4px;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(15, 23, 42, 0.06);
}

.p-toast-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--toast-accent);
  transform-origin: left center;
  animation: toastProgress linear forwards;
}

.p-toast.is-paused .p-toast-progress span { animation-play-state: paused; }

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ==================== PREMIUM DIALOGS ==================== */
.p-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 320;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.p-dialog-backdrop.is-open { opacity: 1; }

.p-dialog-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border-radius: 22px;
  padding: 24px 22px 20px;
  text-align: center;
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.28);
  transform: translateY(14px) scale(0.93);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.p-dialog-backdrop.is-open .p-dialog-card { transform: translateY(0) scale(1); }

.p-dialog-icon-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p-ring-danger { background: #fee2e2; color: #dc2626; box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.10); }
.p-ring-warn { background: #fef3c7; color: #d97706; box-shadow: 0 0 0 8px rgba(217, 119, 6, 0.11); }
.p-ring-info { background: #dbeafe; color: #1d4ed8; box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.10); }
.p-ring-success { background: #d1fae5; color: #059669; box-shadow: 0 0 0 8px rgba(5, 150, 105, 0.10); }

.p-dialog-title { margin: 0; font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; font-size: 17.5px; font-weight: 800; color: var(--brand-navy); }
.p-dialog-msg { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }

.p-dialog-pill {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-navy);
}

.p-dialog-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 13px; }

.p-preset-chip {
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.p-dialog-input {
  width: 100%;
  margin-top: 13px;
  padding: 10px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
}

.p-dialog-input:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.p-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.btn-dialog-danger { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #ffffff; }
.btn-dialog-warn { background: linear-gradient(135deg, #d97706, #b45309); color: #ffffff; }

/* ==========================================================================
   TABLET ENHANCEMENTS (>= 768px)
   ========================================================================== */
@media (min-width: 768px) {
  .brand-emblem { width: 36px; height: 36px; }
  .brand-text h1 { font-size: 15.5px; }
  .save-pill { display: inline-flex; }

  .subbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
  }

  .search-row-mobile {
    max-width: 480px;
  }

  .stats-strip {
    display: flex;
  }

  .filter-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .mini-select {
    width: auto;
    max-width: 240px;
    font-size: 12.5px;
    padding: 6px 10px;
    min-height: 34px;
  }

  .mini-select-wide { max-width: 330px; }

  .mini-clear-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .map-legend {
    justify-content: center;
    gap: 18px;
    font-size: 12px;
    padding: 9px 18px;
  }

  /* Centered modals on tablet+ */
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }

  .modal-card {
    border-radius: 18px;
    max-height: 90vh;
  }

  .modal-md { max-width: 580px; }
  .modal-lg { max-width: 780px; }
  .modal-xl { max-width: 1020px; }

  .modal-header { padding: 18px 22px; }
  .modal-header h2 { font-size: 18px; }
  .modal-body { padding: 18px 22px; }
  .modal-footer { padding: 14px 22px; }

  .data-modal-grid { grid-template-columns: 1fr 1fr; }
  .capacity-preview { flex-direction: row; justify-content: space-between; }

  .career-edit-row { grid-template-columns: 34px 1fr auto auto auto; }

  .roster-toolbar-5 {
    grid-template-columns: 1.5fr 1fr 0.9fr 1.2fr 0.9fr;
  }

  .roster-toolbar-5 input { grid-column: auto; }

  /* Restore crisp desktop tables >= 768px */
  .table-scroll {
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 480px;
  }

  .roster-table thead { display: table-header-group; }
  .roster-table tbody { display: table-row-group; }
  .roster-table tbody tr {
    display: table-row;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }

  .roster-table th {
    position: sticky;
    top: 0;
    background: var(--bg-subtle);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    z-index: 2;
  }

  .roster-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--bg-app);
    vertical-align: middle;
  }

  .roster-table tbody tr:hover {
    background: var(--brand-blue-soft);
  }

  .groups-table tbody tr:hover {
    background: var(--bg-subtle);
  }

  .sr-badges {
    flex-direction: row;
  }
}

/* ==========================================================================
   DESKTOP ENHANCEMENTS (>= 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
  .desktop-only { display: flex !important; }
  .mobile-only { display: none !important; }

  .topbar {
    flex-wrap: nowrap;
    padding: 10px 20px;
    gap: 16px;
  }

  .brand-emblem { width: 38px; height: 38px; }
  .brand-text h1 { font-size: 16px; }
  .brand-subtitle { font-size: 12px; }

  .mode-switcher {
    width: auto;
    display: inline-flex;
  }

  .mode-btn {
    padding: 7px 14px;
    font-size: 13px;
    min-height: 34px;
  }

  .btn {
    font-size: 13px;
    padding: 8px 13px;
    min-height: 36px;
  }

  .btn-sm {
    font-size: 12px;
    padding: 6px 10px;
    min-height: 30px;
  }

  .search-input,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 13.5px;
    min-height: 36px;
  }

  .career-bar {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 20px;
    box-shadow: none;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr 375px;
  }

  .map-viewport {
    padding: 20px;
  }

  /* Inspector becomes static right-hand sidebar on Desktop */
  .sheet-backdrop { display: none !important; }

  .inspector-panel {
    position: static;
    transform: none !important;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    border-left: 1px solid var(--border);
    padding-bottom: 0;
    z-index: 10;
  }

  .inspector-empty,
  .inspector-detail {
    padding: 18px 20px 26px;
  }

  .inspector-empty h3 {
    margin: 0;
    text-align: center;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 17px;
    color: var(--brand-navy);
    display: block !important;
  }

  .inspector-empty p {
    margin: 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    display: block !important;
  }

  /* Toasts anchor cleanly at bottom-right on Desktop */
  .toast-container {
    top: auto;
    left: auto;
    bottom: 22px;
    right: 22px;
    width: auto;
  }

  .p-toast {
    min-width: 320px;
    max-width: 400px;
    transform: translateY(14px) scale(0.96);
  }

  .p-toast.is-leaving {
    transform: translateX(28px) scale(0.95);
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  @page { size: landscape; margin: 10mm; }
  body {
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  .app-shell, .workspace, .map-panel, .map-viewport, .map-scale-sizer {
    display: block !important;
    height: auto !important;
    width: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  .map-canvas {
    transform: scale(0.68) !important;
    transform-origin: top left !important;
  }
  .plazoleta-frame {
    box-shadow: none !important;
    border-color: #dc2626 !important;
    background: #ffffff !important;
  }
  .print-header { text-align: center; margin-bottom: 10px; }
  .print-header h2 { margin: 0; font-size: 17px; color: #0f2a52; }
  .print-header p { margin: 2px 0 8px; font-size: 11.5px; color: #475569; }
  .print-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 10.5px; }
}
