    /* =============================================
       VARIABLES Y RESET
    ============================================= */
    :root {
      --bg-base:        #0f1117;
      --bg-card:        #1a1d27;
      --bg-card-hover:  #1f2333;
      --bg-input:       #13151f;
      --bg-sidebar:     #13151f;

      --blue:           #4f8ef7;
      --blue-dark:      #3a6fd8;
      --violet:         #8b5cf6;
      --violet-dark:    #7c3aed;
      --gradient:       linear-gradient(135deg, #4f8ef7 0%, #8b5cf6 100%);

      --green:          #22c55e;
      --red:            #ef4444;
      --orange:         #f97316;
      --yellow:         #eab308;

      /* colores por plataforma */
      --civitatis:      #f97316;
      --viavank:        #06b6d4;
      --web-propia:     #22c55e;

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

      --border:         #2a2d3e;
      --border-light:   #333652;

      --radius-sm:      8px;
      --radius-md:      12px;
      --radius-lg:      16px;
      --radius-xl:      20px;

      --shadow:         0 4px 24px rgba(0,0,0,0.4);
      --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
    }

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

    body {
      font-family: 'Inter', sans-serif;
      background: var(--bg-base);
      color: var(--text-primary);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    /* =============================================
       HEADER
    ============================================= */
    header {
      background: var(--bg-sidebar);
      border-bottom: 1px solid var(--border);
      padding: 0 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 64px;
      position: sticky;
      top: 0;
      z-index: 100;
    }

    .header-brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .header-logo {
      width: 36px;
      height: 36px;
      background: var(--gradient);
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .header-title {
      font-size: 16px;
      font-weight: 700;
      background: var(--gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .header-subtitle {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 1px;
    }

    .header-date {
      font-size: 12px;
      color: var(--text-muted);
      background: var(--bg-card);
      border: 1px solid var(--border);
      padding: 6px 12px;
      border-radius: var(--radius-sm);
    }

    /* =============================================
       NAVEGACIÓN DE PESTAÑAS
    ============================================= */
    nav {
      background: var(--bg-sidebar);
      border-bottom: 1px solid var(--border);
      display: flex;
      padding: 0 24px;
      gap: 4px;
      overflow-x: auto;
    }

    nav::-webkit-scrollbar { height: 0; }

    .tab-btn {
      background: none;
      border: none;
      color: var(--text-muted);
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 500;
      padding: 14px 16px;
      cursor: pointer;
      white-space: nowrap;
      border-bottom: 2px solid transparent;
      transition: color .2s, border-color .2s;
      display: flex;
      align-items: center;
      gap: 8px;
    }

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

    .tab-btn.active {
      color: var(--blue);
      border-bottom-color: var(--blue);
    }

    /* =============================================
       CONTENIDO PRINCIPAL
    ============================================= */
    main {
      flex: 1;
      padding: 28px 24px;
      max-width: 1100px;
      width: 100%;
      margin: 0 auto;
    }

    /* Pestañas ocultas por defecto */
    .tab-panel { display: none; }
    .tab-panel.active { display: block; }

    /* =============================================
       TIPOGRAFÍA SECCIONES
    ============================================= */
    .section-title {
      font-size: 20px;
      font-weight: 700;
      margin-bottom: 6px;
    }

    .section-desc {
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 24px;
    }

    /* =============================================
       TARJETAS GENERALES
    ============================================= */
    .card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 24px;
      box-shadow: var(--shadow-sm);
    }

    .card-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: .06em;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    /* =============================================
       FORMULARIOS
    ============================================= */
    .form-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
    }

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

    label {
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: .05em;
    }

    input, select {
      background: var(--bg-input);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-primary);
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      padding: 10px 14px;
      outline: none;
      transition: border-color .2s, box-shadow .2s;
      width: 100%;
    }

    input:focus, select:focus {
      border-color: var(--blue);
      box-shadow: 0 0 0 3px rgba(79,142,247,.15);
    }

    select option {
      background: var(--bg-card);
    }

    /* Vista previa de comisión calculada */
    .comision-preview {
      background: linear-gradient(135deg, rgba(79,142,247,.12) 0%, rgba(139,92,246,.12) 100%);
      border: 1px solid rgba(79,142,247,.3);
      border-radius: var(--radius-md);
      padding: 16px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 20px;
    }

    .comision-label {
      font-size: 13px;
      color: var(--text-secondary);
    }

    .comision-amount {
      font-size: 28px;
      font-weight: 700;
      background: var(--gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    /* =============================================
       BOTONES
    ============================================= */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-family: 'Inter', sans-serif;
      font-size: 13px;
      font-weight: 600;
      padding: 10px 20px;
      border-radius: var(--radius-sm);
      border: none;
      cursor: pointer;
      transition: opacity .2s, transform .1s;
    }

    .btn:active { transform: scale(.97); }
    .btn:hover { opacity: .9; }

    .btn-primary {
      background: var(--gradient);
      color: #fff;
    }

    .btn-success {
      background: linear-gradient(135deg, #16a34a, #22c55e);
      color: #fff;
    }

    .btn-danger {
      background: rgba(239,68,68,.15);
      color: var(--red);
      border: 1px solid rgba(239,68,68,.3);
    }

    .btn-ghost {
      background: var(--bg-input);
      color: var(--text-secondary);
      border: 1px solid var(--border);
    }

    .btn-sm {
      font-size: 12px;
      padding: 6px 12px;
    }

    .btn-full { width: 100%; justify-content: center; margin-top: 20px; }

    /* =============================================
       FILTROS
    ============================================= */
    .filtros-bar {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 16px 20px;
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: flex-end;
      margin-bottom: 20px;
    }

    .filtros-bar .form-group { flex: 1; min-width: 140px; }

    /* =============================================
       TABLA
    ============================================= */
    .table-wrapper {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      overflow: hidden;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    thead tr {
      background: var(--bg-input);
      border-bottom: 1px solid var(--border);
    }

    th {
      padding: 12px 16px;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: .06em;
      text-align: left;
    }

    tbody tr {
      border-bottom: 1px solid var(--border);
      transition: background .15s;
    }

    tbody tr:last-child { border-bottom: none; }
    tbody tr:hover { background: var(--bg-card-hover); }

    td {
      padding: 14px 16px;
      font-size: 13px;
      color: var(--text-primary);
    }

    /* Fila del total */
    .total-row td {
      font-weight: 700;
      font-size: 14px;
      background: linear-gradient(135deg, rgba(79,142,247,.08) 0%, rgba(139,92,246,.08) 100%);
      border-top: 2px solid var(--border-light);
    }

    .total-row .total-label { color: var(--text-secondary); }
    .total-row .total-amount {
      background: var(--gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      font-size: 18px;
    }

    /* =============================================
       BADGES / PILLS
    ============================================= */
    .badge {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 99px;
      font-size: 11px;
      font-weight: 600;
    }

    .badge-guia {
      background: rgba(139,92,246,.18);
      color: #c4b5fd;
    }

    .badge-civitatis {
      background: rgba(249,115,22,.18);
      color: #fdba74;
    }

    .badge-viavank {
      background: rgba(6,182,212,.18);
      color: #67e8f9;
    }

    .badge-web {
      background: rgba(34,197,94,.18);
      color: #86efac;
    }

    /* =============================================
       TARJETAS DE HISTORIAL DE PAGOS
    ============================================= */
    .pagos-grid {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .pago-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 20px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      transition: border-color .2s, box-shadow .2s;
    }

    .pago-card:hover {
      border-color: var(--border-light);
      box-shadow: var(--shadow);
    }

    .pago-card-left { display: flex; align-items: center; gap: 16px; }

    .pago-card-icon {
      width: 44px;
      height: 44px;
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .icon-fran  { background: rgba(79,142,247,.18); color: var(--blue); }
    .icon-teo   { background: rgba(139,92,246,.18); color: var(--violet); }
    .icon-noris { background: rgba(34,197,94,.18);  color: var(--green); }

    .pago-card-info { display: flex; flex-direction: column; gap: 4px; }

    .pago-guia {
      font-size: 15px;
      font-weight: 600;
    }

    .pago-periodo {
      font-size: 12px;
      color: var(--text-muted);
    }

    .pago-meta {
      font-size: 11px;
      color: var(--text-muted);
    }

    .pago-card-right { text-align: right; }

    .pago-total {
      font-size: 22px;
      font-weight: 700;
      background: var(--gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .pago-fecha {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* =============================================
       CONFIGURACIÓN
    ============================================= */
    .config-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
    }

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

    .config-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 16px;
    }

    .config-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--bg-input);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      gap: 12px;
    }

    .config-item-label {
      font-size: 14px;
      font-weight: 500;
      flex: 1;
    }

    .config-add-row {
      display: flex;
      gap: 8px;
    }

    .config-add-row input { flex: 1; }

    /* =============================================
       ESTADOS VACÍOS
    ============================================= */
    .empty-state {
      text-align: center;
      padding: 60px 20px;
      color: var(--text-muted);
    }

    .empty-state i {
      font-size: 40px;
      margin-bottom: 14px;
      opacity: .4;
    }

    .empty-state p {
      font-size: 14px;
    }

    /* =============================================
       TOAST / NOTIFICACIÓN
    ============================================= */
    #toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      background: var(--bg-card);
      border: 1px solid var(--border-light);
      border-left: 4px solid var(--green);
      border-radius: var(--radius-md);
      padding: 14px 18px;
      font-size: 13px;
      font-weight: 500;
      box-shadow: var(--shadow);
      z-index: 9999;
      display: flex;
      align-items: center;
      gap: 10px;
      transform: translateY(100px);
      opacity: 0;
      transition: transform .3s ease, opacity .3s ease;
    }

    #toast.show {
      transform: translateY(0);
      opacity: 1;
    }

    #toast i { color: var(--green); }

    /* =============================================
       FILAS DE PLATAFORMA — FORMULARIO NUEVO REGISTRO
    ============================================= */
    .plat-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

    .plat-row {
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--bg-input);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 10px 14px;
      transition: border-color .2s;
    }

    .plat-row:focus-within { border-color: var(--blue); }

    .plat-row-nombre {
      flex: 1;
      font-size: 13px;
      font-weight: 500;
      min-width: 80px;
    }

    .plat-row-rate {
      font-size: 12px;
      color: var(--text-muted);
      white-space: nowrap;
    }

    .plat-row input {
      width: 80px;
      flex-shrink: 0;
      text-align: center;
      background: var(--bg-card);
      border-color: var(--border-light);
    }

    .plat-row-comision {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-muted);
      min-width: 72px;
      text-align: right;
      white-space: nowrap;
      transition: color .2s;
    }

    .plat-row-comision.activo { color: var(--blue); }

    /* Desglose por plataforma en tarjeta de historial */
    .pago-desglose {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }

    .pago-desglose-item {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      padding: 3px 8px;
      border-radius: 99px;
      background: var(--bg-input);
      border: 1px solid var(--border);
      color: var(--text-secondary);
    }

    /* =============================================
       BADGE DE ESTADO FIREBASE
    ============================================= */
    .firebase-badge {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      font-weight: 600;
      padding: 5px 11px;
      border-radius: var(--radius-sm);
      border: 1px solid;
      white-space: nowrap;
    }

    .firebase-badge-ok {
      background: rgba(34,197,94,.1);
      border-color: rgba(34,197,94,.3);
      color: #4ade80;
    }

    .firebase-badge-error {
      background: rgba(239,68,68,.1);
      border-color: rgba(239,68,68,.3);
      color: #f87171;
    }

    .firebase-badge-connecting {
      background: rgba(234,179,8,.1);
      border-color: rgba(234,179,8,.3);
      color: #fbbf24;
    }

    .firebase-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: currentColor;
      flex-shrink: 0;
    }

    .firebase-badge-ok .firebase-dot {
      animation: pulso 2.4s ease-in-out infinite;
    }

    @keyframes pulso {
      0%, 100% { opacity: 1; }
      50%       { opacity: .35; }
    }

    /* =============================================
       MODAL DE CONFIRMACIÓN
    ============================================= */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.65);
      backdrop-filter: blur(3px);
      z-index: 2000;
      align-items: center;
      justify-content: center;
    }

    .modal-box {
      background: var(--bg-card);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-lg);
      padding: 28px 28px 24px;
      max-width: 420px;
      width: 90%;
      box-shadow: var(--shadow);
    }

    .modal-title {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .modal-body {
      font-size: 13px;
      color: var(--text-secondary);
      line-height: 1.6;
      margin-bottom: 24px;
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
    }

    /* Modal de resumen WhatsApp */
    .resumen-textarea {
      width: 100%;
      background: var(--bg-input);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-primary);
      font-family: monospace;
      font-size: 13px;
      line-height: 1.6;
      padding: 12px 14px;
      resize: none;
      outline: none;
      min-height: 220px;
    }

    .resumen-textarea:focus { border-color: var(--blue); }

    .btn-copiar {
      background: var(--gradient);
      color: #fff;
      width: 100%;
      justify-content: center;
      margin-top: 12px;
      padding: 11px;
      font-size: 14px;
    }

    .btn-copiar.copiado {
      background: linear-gradient(135deg, #16a34a, #22c55e);
    }

    /* Modal de edición */
    .edit-modal-box {
      background: var(--bg-card);
      border: 1px solid var(--border-light);
      border-radius: var(--radius-lg);
      padding: 24px 24px 20px;
      max-width: 480px;
      width: 94%;
      box-shadow: var(--shadow);
      max-height: 90vh;
      overflow-y: auto;
    }

    .edit-plat-row {
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--bg-input);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 8px 12px;
      margin-bottom: 8px;
    }

    .edit-plat-row:focus-within { border-color: var(--blue); }

    .edit-plat-nombre {
      flex: 1;
      font-size: 13px;
      font-weight: 500;
    }

    .edit-plat-rate {
      font-size: 11px;
      color: var(--text-muted);
      white-space: nowrap;
    }

    .edit-plat-row input {
      width: 70px;
      text-align: center;
      background: var(--bg-card);
      border-color: var(--border-light);
      padding: 7px 8px;
    }

    .edit-plat-subtotal {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      min-width: 56px;
      text-align: right;
      white-space: nowrap;
      transition: color .2s;
    }

    .edit-plat-subtotal.activo { color: var(--blue); }

    /* =============================================
       RESPONSIVE
    ============================================= */

    /* --- Tablet (≤ 600px) --- */
    @media (max-width: 600px) {
      main { padding: 14px 12px; }
      .form-grid { grid-template-columns: 1fr; }
      .card { padding: 18px 16px; }
      .section-title { font-size: 18px; }
      .section-desc  { margin-bottom: 18px; }

      /* Header: ocultar fecha, reducir badge */
      .header-date    { display: none; }
      .header-subtitle { display: none; }
      .firebase-badge { font-size: 10px; padding: 4px 9px; }

      /* Nav: las 4 pestañas ocupan el ancho completo por igual */
      nav {
        padding: 0;
        gap: 0;
      }

      .tab-btn {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        font-size: 10px;
        white-space: normal;
        text-align: center;
        line-height: 1.2;
      }

      .tab-btn i {
        font-size: 15px;
      }

      /* Filtros */
      .filtros-bar { padding: 12px 14px; gap: 10px; }

      /* Tabla */
      th, td { padding: 9px 8px; font-size: 12px; }

      /* Pago cards */
      .pago-card { flex-direction: column; align-items: flex-start; }
      .pago-card-right { align-self: flex-end; }
      .pago-total { font-size: 18px; }

      /* Vista previa comisión */
      .comision-preview { padding: 12px 14px; margin-top: 14px; }
      .comision-amount  { font-size: 22px; }
      .comision-label   { font-size: 12px; }

      /* Botón guardar */
      .btn-full { margin-top: 14px; }
    }

    /* --- Móvil chico (≤ 420px): filas de plataforma compactas --- */
    @media (max-width: 420px) {
      main { padding: 10px 8px; }
      .card { padding: 14px 12px; }
      .section-title { font-size: 16px; margin-bottom: 4px; }
      .section-desc  { font-size: 12px; margin-bottom: 14px; }

      /* Reducir gap entre filas */
      .plat-rows { gap: 6px; margin-top: 4px; }

      /* Cada fila más compacta */
      .plat-row {
        padding: 7px 10px;
        gap: 7px;
      }

      /* Badge más chico */
      .plat-row .badge {
        font-size: 10px;
        padding: 2px 7px;
      }

      /* Nombre de plataforma más pequeño */
      .plat-row-nombre {
        font-size: 12px;
        min-width: 0;
      }

      /* Ocultar "€X.XX/pax" — gana espacio sin perder info clave */
      .plat-row-rate { display: none; }

      /* Input de pasajeros más angosto */
      .plat-row input {
        width: 58px;
        padding: 7px 6px;
        font-size: 13px;
      }

      /* Comisión calculada */
      .plat-row-comision {
        font-size: 12px;
        min-width: 48px;
      }

      /* Etiqueta "Pasajeros por plataforma" */
      #tab-nuevo label[style] { font-size: 11px; }

      /* Vista previa */
      .comision-preview { padding: 10px 12px; }
      .comision-amount  { font-size: 20px; }

      /* Header mínimo */
      .header-logo { width: 30px; height: 30px; font-size: 14px; }
      .header-title { font-size: 14px; }

      /* Tabla de pendientes */
      th, td { padding: 8px 6px; font-size: 11px; }

      /* En pantallas muy chicas ocultar Tour y Plataformas; quedan Fecha, Guía, Total, Eliminar */
      thead tr th:nth-child(2),
      tbody tr td:nth-child(2),
      thead tr th:nth-child(4),
      tbody tr td:nth-child(4) { display: none; }
    }

    /* =============================================
       PANTALLA DE LOGIN
    ============================================= */
    #login-screen {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--bg-base);
      z-index: 9999;
      align-items: center;
      justify-content: center;
    }
    #login-screen.visible { display: flex; }

    .login-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 40px 36px;
      width: 100%;
      max-width: 380px;
      box-shadow: var(--shadow-lg);
    }

    .login-logo {
      width: 52px;
      height: 52px;
      border-radius: 14px;
      background: var(--gradient);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      margin: 0 auto 20px;
    }

    .login-title {
      text-align: center;
      font-size: 20px;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 6px;
    }

    .login-subtitle {
      text-align: center;
      font-size: 13px;
      color: var(--text-muted);
      margin-bottom: 28px;
    }

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

    #login-error {
      display: none;
      background: rgba(239,68,68,.12);
      border: 1px solid rgba(239,68,68,.3);
      border-radius: var(--radius-sm);
      color: #f87171;
      font-size: 13px;
      padding: 10px 14px;
      margin-bottom: 16px;
    }

    #btn-logout {
      background: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text-muted);
      cursor: pointer;
      font-size: 12px;
      padding: 5px 10px;
      transition: color .2s, border-color .2s;
    }
    #btn-logout:hover { color: var(--red); border-color: var(--red); }