:root {
      /* Paleta Numia - https://numia.co/ */
      --primary-purple: #863DFF;
      --primary-purple-hover: #7c3aed;
      --primary-purple-light: #a78bfa;
      --primary-purple-dark: #6d28d9;
      --text-dark: #1e1b4b;
      --text-light: #6b7280;
      --bg-light: #faf5ff;
      --bg-white: #ffffff;
      --border-color: #e9d5ff;
    }
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background:
        radial-gradient(ellipse at 50% 0%, #eceaef 0%, #d8d5dc 55%, #cfcbd4 100%);
      color: var(--text-dark);
      padding: 2.5rem 1rem;
      margin: 0;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    /* Contenido dentro del marco — misma pantalla que app-cliente */
    .mobile-container {
      width: 100%;
      max-width: none;
      height: 100%;
      margin: 0;
      background: transparent;
      border-radius: 0;
      padding: 0;
      box-shadow: none;
    }
    
    .mobile-screen {
      background: var(--bg-white);
      border-radius: 0;
      overflow: hidden;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      position: relative;
    }
    
    .mobile-screen-wrapper {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }
    
    /* Status Bar legacy — mantenida vacía; se usa .phone-status-bar */
    .status-bar {
      display: none;
    }
    
    .status-left,
    .status-center,
    .status-right {
      display: none;
    }
    
    /* Header */
    .app-header {
      background: var(--bg-white);
      padding: 12px 16px;
      text-align: center;
      border-bottom: 1px solid var(--border-color);
      position: sticky;
      top: 0;
      z-index: 100;
    }
    
    .app-header h1 {
      font-size: 1.125rem;
      font-weight: 600;
      color: var(--text-dark);
    }
    
    /* Main Content */
    .main-content {
      flex: 1;
      overflow-y: auto;
      padding-bottom: 16px;
      background: var(--bg-light);
      min-height: 0;
    }
    
    /* COVID Banner */
    .covid-banner {
      background: var(--bg-white);
      margin: 16px;
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      display: flex;
      align-items: center;
      padding: 16px;
      gap: 16px;
    }
    
    .covid-image {
      width: 80px;
      height: 80px;
      border-radius: 8px;
      background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    
    .covid-image i {
      font-size: 2rem;
      color: var(--primary-purple);
    }
    
    .covid-content {
      flex: 1;
    }
    
    .covid-title {
      font-size: 1.125rem;
      font-weight: 700;
      color: var(--text-dark);
      margin-bottom: 8px;
    }
    
    .covid-button {
      background: var(--primary-purple);
      color: white;
      border: none;
      padding: 8px 16px;
      border-radius: 6px;
      font-size: 0.875rem;
      font-weight: 500;
      cursor: pointer;
      margin-top: 8px;
    }
    
    .carousel-indicators {
      display: flex;
      justify-content: center;
      gap: 6px;
      margin-top: 8px;
      margin-bottom: 16px;
    }
    
    .indicator {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--border-color);
    }
    
    .indicator.active {
      background: var(--primary-purple);
    }
    
    /* Section Header */
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 16px;
      margin-bottom: 12px;
    }
    
    .section-title {
      font-size: 1rem;
      font-weight: 700;
      color: var(--primary-purple);
    }
    
    .section-arrow {
      color: var(--text-light);
      font-size: 1.25rem;
    }
    
    /* Credentials Card */
    .credentials-card {
      background: var(--bg-white);
      margin: 0 16px 16px;
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .user-info {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 16px;
    }
    
    .user-avatar {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    
    .user-avatar i {
      font-size: 1.5rem;
      color: white;
    }
    
    .user-details {
      flex: 1;
    }
    
    .user-name {
      font-size: 0.9375rem;
      font-weight: 600;
      color: var(--text-dark);
      margin-bottom: 4px;
    }
    
    .user-dni {
      font-size: 0.875rem;
      color: var(--text-dark);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    .user-code {
      font-size: 1rem;
      font-weight: 700;
      color: var(--primary-purple);
      margin-top: 8px;
      letter-spacing: 0.5px;
    }
    
    .token-button {
      width: 100%;
      background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-purple-light) 100%);
      color: white;
      border: none;
      padding: 12px;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin-top: 16px;
    }
    
    /* Favorites Card */
    .favorites-card {
      background: var(--bg-white);
      margin: 0 16px 16px;
      border-radius: 12px;
      padding: 24px 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      text-align: center;
    }
    
    .favorites-icon {
      font-size: 2.5rem;
      color: var(--text-light);
      margin-bottom: 12px;
    }
    
    .favorites-text {
      font-size: 0.875rem;
      color: var(--text-light);
      margin-bottom: 12px;
    }
    
    .favorites-link {
      color: var(--primary-purple);
      font-size: 0.875rem;
      font-weight: 500;
      text-decoration: none;
    }
    
    /* Branch Card */
    .branch-card {
      background: var(--bg-white);
      margin: 0 16px 16px;
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    /* Bottom Navigation */
    .bottom-nav {
      position: relative;
      width: 100%;
      background: var(--bg-white);
      border-top: 1px solid var(--border-color);
      display: flex;
      justify-content: space-around;
      padding: 8px 0 24px;
      z-index: 1000;
      flex-shrink: 0;
    }
    
    .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      cursor: pointer;
      padding: 4px 12px;
      flex: 1;
      text-decoration: none;
    }
    
    .nav-item i {
      font-size: 1.25rem;
    }
    
    .nav-item.active i,
    .nav-item.active span {
      color: var(--primary-purple);
    }
    
    .nav-item:not(.active) i,
    .nav-item:not(.active) span {
      color: var(--text-light);
    }
    
    .nav-item span {
      font-size: 0.6875rem;
      font-weight: 500;
    }
    
    /* El indicator lo aporta phone-frame (igual que app-cliente) */
    .home-indicator {
      display: none;
    }
    
    /* Responsive */
    @media (max-width: 480px) {
      body {
        padding: 0;
        background: var(--bg-light);
        display: block;
      }

      .phone-frame {
        --phone-screen-w: 100%;
        --phone-screen-h: 100dvh;
        width: 100%;
      }

      .bottom-nav {
        width: 100%;
      }
    }
    
    /* User Selector */
    .user-selector-container {
      padding: 16px;
      background: var(--bg-white);
      border-bottom: 1px solid var(--border-color);
    }
    
    .user-selector {
      width: 100%;
      padding: 0.75rem 1rem;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 500;
      color: var(--text-dark);
      background: var(--bg-white);
      cursor: pointer;
    }
    
    /* Appointments Section */
    .appointments-section {
      margin: 16px;
    }
    
    .appointment-card {
      background: var(--bg-white);
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      margin-bottom: 16px;
    }
    
    .appointment-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }
    
    .appointment-title {
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-dark);
    }
    
    .appointment-date {
      font-size: 0.875rem;
      color: var(--text-light);
      margin-bottom: 8px;
    }
    
    .appointment-details {
      font-size: 0.875rem;
      color: var(--text-dark);
      margin-bottom: 16px;
    }
    
    .appointment-actions {
      display: flex;
      gap: 8px;
    }
    
    .btn-confirm {
      flex: 1;
      padding: 0.75rem;
      background: var(--primary-purple);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }
    
    .btn-cancel-appointment {
      flex: 1;
      padding: 0.75rem;
      background: var(--bg-light);
      color: var(--text-dark);
      border: 1px solid var(--border-color);
      border-radius: 8px;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
    }
    
    .btn-agendar {
      width: 100%;
      padding: 0.75rem;
      background: var(--primary-purple);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      margin-top: 16px;
    }
    
    /* Modal */
    .modal-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 2000;
      align-items: center;
      justify-content: center;
    }
    
    .modal-overlay.active {
      display: flex;
    }
    
    .modal-content {
      background: var(--bg-white);
      border-radius: 16px;
      padding: 24px;
      max-width: 90%;
      width: 400px;
      max-height: 90vh;
      overflow-y: auto;
    }
    
    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
    }
    
    .modal-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--text-dark);
    }
    
    .modal-close {
      background: none;
      border: none;
      font-size: 1.5rem;
      color: var(--text-light);
      cursor: pointer;
      padding: 0;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .form-group {
      margin-bottom: 20px;
    }
    
    .form-label {
      display: block;
      font-size: 0.875rem;
      font-weight: 500;
      color: var(--text-dark);
      margin-bottom: 8px;
    }
    
    .form-select,
    .form-input {
      width: 100%;
      padding: 0.75rem;
      border: 1px solid var(--border-color);
      border-radius: 8px;
      font-size: 0.9375rem;
      color: var(--text-dark);
      background: var(--bg-white);
    }
    
    .no-availability {
      background: #faf5ff;
      border: 1px solid #e9d5ff;
      color: var(--primary-purple-dark);
      padding: 12px;
      border-radius: 8px;
      font-size: 0.875rem;
      text-align: center;
      margin-top: 16px;
    }
    
    .btn-submit {
      width: 100%;
      padding: 0.75rem;
      background: var(--primary-purple);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      margin-top: 20px;
    }
    
    /* Botón flotante fuera de la app */
    .btn-numiabot {
      position: fixed;
      bottom: 24px;
      right: 24px;
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background: var(--primary-purple);
      color: white;
      border: none;
      box-shadow: 0 4px 12px rgba(134, 61, 255, 0.4);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      transition: all 0.2s;
      text-decoration: none;
    }
    
    .btn-numiabot:hover {
      background: var(--primary-purple-hover);
      transform: scale(1.05);
      box-shadow: 0 6px 16px rgba(134, 61, 255, 0.5);
    }
    
    .btn-numiabot i {
      font-size: 1.5rem;
    }
    
    /* Maria's received appointments */
    .maria-appointment-card {
      background: var(--bg-white);
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      margin-bottom: 16px;
    }
    
    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 0.75rem;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 12px;
    }
    
    .status-badge.pending-auth {
      background: #fef3c7;
      color: #b45309;
    }
    
    .status-badge.authorized {
      background: #d1fae5;
      color: #047857;
    }
    
    .btn-checkin {
      width: 100%;
      padding: 0.75rem;
      background: #059669;
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: background 0.15s;
    }
    
    .btn-checkin:hover { background: #047857; }
    
    .turn-info-card {
      background: #f0fdf4;
      border: 1px solid #bbf7d0;
      border-radius: 10px;
      padding: 14px;
      margin-top: 8px;
    }
    
    .turn-info-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 0;
    }
    
    .turn-info-row:not(:last-child) {
      border-bottom: 1px solid #dcfce7;
    }
    
    .turn-info-label {
      font-size: 0.8125rem;
      color: #166534;
      font-weight: 500;
    }
    
    .turn-info-value {
      font-size: 0.875rem;
      color: #047857;
      font-weight: 700;
    }
    
    .turn-number {
      font-size: 1.5rem;
      font-weight: 800;
      color: #047857;
      text-align: center;
      padding: 8px 0 4px;
    }
    
    .btn-checkin:disabled {
      background: #9ca3af;
      cursor: not-allowed;
    }
    
    .appointment-user-origin {
      font-size: 0.8125rem;
      color: var(--text-light);
      margin-top: 8px;
    }
    
    /* Authorization modal */
    .auth-modal-body {
      text-align: center;
    }
    
    .auth-icon {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 16px;
    }
    
    .auth-icon i {
      font-size: 1.75rem;
      color: var(--primary-purple);
    }
    
    .auth-description {
      font-size: 0.9375rem;
      color: var(--text-dark);
      margin-bottom: 20px;
      line-height: 1.5;
    }
    
    .file-upload-area {
      border: 2px dashed var(--border-color);
      border-radius: 12px;
      padding: 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s;
      margin-bottom: 16px;
      background: var(--bg-light);
    }
    
    .file-upload-area:hover {
      border-color: var(--primary-purple-light);
      background: #faf5ff;
    }
    
    .file-upload-area.has-file {
      border-color: #22c55e;
      background: #f0fdf4;
    }
    
    .file-upload-icon {
      font-size: 2rem;
      color: var(--primary-purple-light);
      margin-bottom: 8px;
    }
    
    .file-upload-text {
      font-size: 0.875rem;
      color: var(--text-light);
    }
    
    .file-upload-text strong {
      color: var(--primary-purple);
    }
    
    .file-name-display {
      font-size: 0.8125rem;
      color: #22c55e;
      font-weight: 600;
      margin-top: 8px;
      display: none;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
    
    .file-name-display.visible {
      display: flex;
    }
    
    .btn-authorize {
      width: 100%;
      padding: 0.75rem;
      background: var(--primary-purple);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    
    .auth-success-message {
      display: none;
      background: #f0fdf4;
      border: 1px solid #bbf7d0;
      border-radius: 12px;
      padding: 16px;
      text-align: center;
      margin-top: 16px;
    }
    
    .auth-success-message.visible {
      display: block;
    }
    
    .auth-success-message i {
      font-size: 2rem;
      color: #22c55e;
      margin-bottom: 8px;
    }
    
    .auth-success-message p {
      font-size: 0.875rem;
      color: #166534;
      font-weight: 500;
    }

:root {
  --checkin-success-bg: #047857;
}
