/* ==========================================================================
   TEF & SMARTPOS MOBILE - ULTRA MODERN DESIGN SYSTEM
   Optimized for iOS Safari, Android Chrome & PWA Standalone
   ========================================================================== */

:root {
  --bg-body: #070a14;
  --bg-card: #0e1424;
  --bg-card-hover: #151e36;
  --bg-surface: #18223c;
  --bg-input: #12192d;
  
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: rgba(139, 92, 246, 0.16);
  --primary-glow: rgba(139, 92, 246, 0.35);

  --secondary: #0ea5e9;
  --secondary-light: rgba(14, 165, 233, 0.16);

  --teal: #14b8a6;
  --teal-light: rgba(20, 184, 166, 0.16);

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.16);

  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.16);

  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.5);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(139, 92, 246, 0.25);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* Light Mode Overrides (Optional / Automatic) */
body.light-theme {
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #e2e8f0;
  --bg-input: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(139, 92, 246, 0.6);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100%;
  line-height: 1.45;
  overflow-x: hidden;
  padding-bottom: calc(76px + var(--safe-bottom));
  padding-top: var(--safe-top);
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout */
.app-container {
  max-width: 580px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #0ea5e9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title span {
  background: linear-gradient(90deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--teal);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.header-btn:active {
  transform: scale(0.92);
  background: var(--bg-surface);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

/* Quick Search Header (Expandable or always visible on list tabs) */
.mobile-search-bar {
  padding: 10px 16px;
  background: var(--bg-body);
  position: sticky;
  top: 61px;
  z-index: 35;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Componente Unificado de Busca (Mobile) */
.unified-search-mobile {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  height: 44px;
  width: 100%;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.unified-search-mobile:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.unified-search-mobile .unified-search-select {
  flex-shrink: 0;
  width: auto;
  min-width: 110px;
  max-width: 135px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 24px 0 10px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  appearance: none;
  -webkit-appearance: none;
}

.unified-search-mobile .unified-search-select option {
  background: var(--bg-card);
  color: var(--text-main);
}

.unified-search-mobile .unified-search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.unified-search-mobile .unified-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.unified-search-mobile .unified-search-input {
  width: 100%;
  height: 100%;
  padding: 0 32px 0 34px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.86rem;
  font-family: inherit;
  outline: none;
}

.unified-search-mobile .unified-search-input::placeholder {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.unified-search-mobile .unified-search-clear {
  position: absolute;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
}

.unified-search-mobile .unified-search-clear:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  height: 42px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 40px 0 42px;
  font-size: 0.9rem;
  color: var(--text-main);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
}

/* Horizontal Chip Scroller (Quick Filter Tabs) */
.chip-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chip-scroller::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.filter-chip .chip-count {
  background: rgba(255, 255, 255, 0.18);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

/* View Sections */
.mobile-view {
  display: none;
  padding: 16px 16px calc(88px + var(--safe-bottom, 0px)) 16px;
  flex: 1;
  animation: fadeIn 0.25s ease-out;
}

.mobile-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Banner / Greetings */
.dashboard-welcome {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18) 0%, rgba(14, 165, 233, 0.12) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.dashboard-welcome::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.dashboard-welcome h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.dashboard-welcome p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* KPI Summary Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:active {
  transform: scale(0.97);
}

.kpi-card.kpi-tef { border-left: 4px solid var(--primary); }
.kpi-card.kpi-spos { border-left: 4px solid var(--secondary); }
.kpi-card.kpi-active { border-left: 4px solid var(--success); }
.kpi-card.kpi-pending { border-left: 4px solid var(--warning); }

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

.kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kpi-icon {
  font-size: 1.1rem;
}

.kpi-number {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  font-family: var(--font-mono);
}

.kpi-footer-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Quick Action Shortcuts */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 6px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-action-link {
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.action-shortcut-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, background-color 0.2s;
}

.action-shortcut-btn:active {
  transform: scale(0.94);
  background: var(--bg-surface);
}

.action-shortcut-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.icon-purple { background: rgba(139, 92, 246, 0.16); color: #a78bfa; }
.icon-blue { background: rgba(14, 165, 233, 0.16); color: #38bdf8; }
.icon-teal { background: rgba(20, 184, 166, 0.16); color: #2dd4bf; }
.icon-green { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }

/* Mobile Ticket / Record Cards */
.records-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: calc(88px + var(--safe-bottom, 0px));
}

.mobile-ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.mobile-ticket-card:active {
  transform: scale(0.985);
  background: var(--bg-card-hover);
  border-color: rgba(139, 92, 246, 0.4);
}

.mobile-ticket-card.card-tef {
  border-left: 3.5px solid var(--primary);
}

.mobile-ticket-card.card-smartpos {
  border-left: 3.5px solid var(--secondary);
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.ticket-client-block {
  flex: 1;
  min-width: 0;
}

.ticket-code-tag {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.ticket-fantasia {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ticket-razao {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Status Badges */
.status-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-pill.status-ativo,
.status-pill.status-baixado {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.status-pendente {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.status-cancelado,
.status-pill.status-inativo {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Ticket Info Details Grid */
.ticket-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item span {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 600;
}

.detail-item strong {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-pending-reason {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.74rem;
  color: #fef08a;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Ticket Action Bar */
.ticket-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ticket-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ticket-btn-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

.btn-pill-action {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-pill-action:active {
  transform: scale(0.92);
}

.btn-pill-whatsapp {
  background: rgba(37, 211, 102, 0.12);
  color: #25D366;
  border-color: rgba(37, 211, 102, 0.35);
}

.btn-pill-activate {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-pill-edit {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
}

/* Empty State */
.mobile-empty-state {
  text-align: center;
  padding: 42px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
}

.mobile-empty-state svg {
  margin-bottom: 12px;
  color: var(--text-dim);
}

.mobile-empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.mobile-empty-state p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Bottom Sheet Modal */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.bottom-sheet-backdrop.open {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 580px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: calc(16px + var(--safe-bottom));
}

.bottom-sheet-backdrop.open .bottom-sheet {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 44px;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  margin: 10px auto 4px;
  cursor: grab;
}

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

.sheet-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.sheet-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

/* Bottom Sheet Form Controls */
.mobile-form-group {
  margin-bottom: 14px;
}

.mobile-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.mobile-form-control {
  width: 100%;
  height: 46px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.mobile-form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.mobile-form-control {
  height: 80px;
  padding: 10px 14px;
  resize: vertical;
}

/* Button Component Styles */
.btn-mobile-primary {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: transform 0.15s, opacity 0.15s;
}

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

.btn-mobile-secondary {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

/* Floating Action Button (FAB) */
.mobile-fab {
  position: fixed;
  right: 18px;
  bottom: calc(84px + var(--safe-bottom));
  z-index: 50;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
  cursor: pointer;
  font-size: 1.4rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-fab:active {
  transform: scale(0.88) rotate(45deg);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 55;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  max-width: 580px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s, transform 0.15s;
  position: relative;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  transform: translateY(-2px);
  color: var(--primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px var(--primary);
}

/* Toast Notifications */
.mobile-toast {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  transform: translateY(-120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-toast.show {
  transform: translateY(0);
}

.mobile-toast.toast-success {
  border-left: 4px solid var(--success);
}

.mobile-toast.toast-error {
  border-left: 4px solid var(--danger);
}

.mobile-toast.toast-info {
  border-left: 4px solid var(--primary);
}

.toast-msg {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
}

/* ==========================================================================
   MOBILE REPORT ACTIONS & PDF / WHATSAPP EXPORT
   ========================================================================== */

.report-top-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.btn-report-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  min-height: 58px;
}

.btn-report-action:active {
  transform: scale(0.97);
}

.btn-report-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.btn-report-pdf {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

.report-btn-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.report-btn-text {
  display: flex;
  flex-direction: column;
}

.report-btn-text strong {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
}

.report-btn-text small {
  font-size: 0.68rem;
  opacity: 0.85;
}

.section-sublabel {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Expandable Custom Date Range Filter */
.rep-custom-date-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease-out;
}

.custom-date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-date-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mobile-date-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  color-scheme: dark;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.mobile-date-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.btn-today-badge {
  background: rgba(20, 184, 166, 0.16);
  border: 1px solid rgba(20, 184, 166, 0.4);
  color: #2dd4bf;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.btn-today-badge:active {
  background: rgba(20, 184, 166, 0.35);
  color: #ffffff;
}

.custom-date-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn-clear-date {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-clear-date:active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Report KPI Strip */
.report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.rep-kpi-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rep-kpi-num {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #ffffff;
  line-height: 1.2;
}

.rep-kpi-lbl {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segment-btn.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* ==========================================================================
   AUTOFILL SEARCH & DROPDOWN (INFOBRASIL LOOKUP)
   ========================================================================== */

.mobile-autofill-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
}

.autofill-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.autofill-input-wrap {
  position: relative;
}

.mobile-autofill-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  display: none;
}

.mobile-autofill-dropdown.show {
  display: block;
}

.autofill-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.autofill-item:active,
.autofill-item:hover {
  background: var(--primary-light);
}

.autofill-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.autofill-item-fantasia {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.autofill-item-code {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--primary);
  background: rgba(139, 92, 246, 0.2);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.autofill-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ==========================================================================
   GLOBAL SEARCH RESULTS PANEL & PRODUCT BADGES
   ========================================================================== */

.global-search-results-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 12px;
  right: 12px;
  max-height: calc(85vh - 120px);
  background: #090d1c;
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(139, 92, 246, 0.2);
  overflow-y: auto;
  z-index: 150;
  backdrop-filter: blur(20px);
  padding: 12px;
  animation: mobileSlideDown 0.2s ease-out;
}

@keyframes mobileSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.search-panel-spinner {
  animation: spin 1s infinite linear;
  display: inline-block;
}

.btn-close-search {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-close-search:hover,
.btn-close-search:active {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Client Result Cards */
.client-search-card {
  background: rgba(18, 24, 48, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.client-search-card:active {
  transform: scale(0.99);
  background: rgba(24, 32, 64, 0.95);
  border-color: var(--primary);
}

.client-card-badges-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.client-badges-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Product Badges (TEF / SmartPOS / Nenhum) */
.client-prod-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.client-prod-pill.prod-tef {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.client-prod-pill.prod-spos {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.45);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.client-prod-pill.prod-none {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-weight: 700;
}

.client-prod-pill.prod-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
  font-weight: 700;
}

.client-code-tag {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.2);
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.client-fantasia {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 2px;
  line-height: 1.3;
}

.client-razao {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 10px;
}

.grid-col-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.grid-col-val {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-installed-summary {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  font-size: 0.74rem;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.installed-item.tef {
  color: #fbbf24;
}

.installed-item.spos {
  color: #22d3ee;
}

.client-installed-none {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.client-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-client-action {
  flex: 1;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

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

.btn-client-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  text-decoration: none;
  color: #ffffff;
}

.btn-client-action-icon.whatsapp {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.4);
}

.btn-client-action-icon.whatsapp:active {
  background: rgba(37, 211, 102, 0.3);
}



/* ==========================================
 * BOTAO DE CHECKLIST DOCX & AJUSTES NETLIFY
 * ========================================== */

.btn-pill-docx {
  background: rgba(139, 92, 246, 0.15) !important;
  color: #c4b5fd !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.btn-pill-docx:active {
  transform: scale(0.95) !important;
  background: rgba(139, 92, 246, 0.3) !important;
}

/* Protecao estrita da barra inferior para nao ser coberta por selos Netlify */
body {
  padding-bottom: calc(92px + var(--safe-bottom, 0px)) !important;
}

.app-main {
  padding-bottom: calc(92px + var(--safe-bottom, 0px)) !important;
}

.bottom-nav {
  z-index: 99999 !important;
}

[data-netlify-badge],
.netlify-badge,
#netlify-badge {
  display: none !important;
}
