/* =====================================================
   APP MOBILE - GESTÃO DE ORDENS DE SERVIÇO
   Premium UI Edition - Mobile-first | Bootstrap 5.3 + Custom CSS
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────── */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #3730a3;
  --primary-light:  #818cf8;
  --success:        #10b981;
  --danger:         #f43f5e;
  --warning:        #f59e0b;
  --info:           #3b82f6;

  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-2:      #f1f5f9;
  --border:         rgba(15, 23, 42, 0.06);
  --text:           #0f172a;
  --text-muted:     #64748b;

  --nav-h:          76px;
  --header-h:       64px;
  --radius:         24px;
  --radius-sm:      16px;
  --radius-pill:    100px;
  
  /* Sombras ultra-suaves (Premium Style) */
  --shadow-sm:      0 4px 12px -2px rgba(15, 23, 42, 0.03);
  --shadow:         0 12px 32px -4px rgba(15, 23, 42, 0.06), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg:      0 24px 48px -12px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
  --shadow-colored: 0 12px 28px -6px rgba(79, 70, 229, 0.4);
  
  --transition:     0.3s cubic-bezier(0.25, 1, 0.5, 1); /* Animação mais elástica/viva */
  --glass-bg:       rgba(255, 255, 255, 0.75);
  --glass-border:   rgba(255, 255, 255, 0.6);
  --glass-blur:     18px;
}

/* ── Dark Mode ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #0a0f1c; /* Deep slate, muito premium */
  --surface:        #131b2f;
  --surface-2:      #1e293b;
  --border:         rgba(255, 255, 255, 0.06);
  --text:           #f8fafc;
  --text-muted:     #94a3b8;
  
  --shadow-sm:      0 4px 12px -2px rgba(0, 0, 0, 0.3);
  --shadow:         0 12px 32px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg:      0 24px 48px -12px rgba(0, 0, 0, 0.6);
  --shadow-colored: 0 12px 28px -6px rgba(79, 70, 229, 0.3);
  
  --glass-bg:       rgba(19, 27, 47, 0.8);
  --glass-border:   rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .app-header {
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
}

[data-theme="dark"] .bottom-nav-inner {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

/* ── Reset & Base (Foco em Mobile/Touch) ───────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* Suporte nativo para notch do iOS */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 24px));
  transition: background var(--transition), color var(--transition);
  
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent; /* Remove flash azul no Android */
  -webkit-touch-callout: none; /* Previne menu de seleção nativo em links no iOS */
}

/* Tipografia de Destaque */
h1, h2, h3, h4, h5, h6, .page-title, .stat-value, .welcome-name, .brand {
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

/* Evita seleção acidental só nos controles (botões, menus, abas).
   O conteúdo (telefone, endereço, observação...) continua selecionável para copiar. */
a, button, label, .btn, .btn-icon, .pill, .fab, .nav-link,
.app-header, .bottom-nav, .desktop-sidebar, .offcanvas,
.order-item, .stat-card, .pagination-wrap, .badge-status {
  -webkit-user-select: none;
  user-select: none;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Feedback tátil universal (bouncy click) para botões e links */
a, button, .btn {
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), background 0.2s, box-shadow 0.2s;
}
a:active, button:active, .btn:active {
  transform: scale(0.96) !important;
}

/* ── Top Header (Glassmorphism) ────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 1rem;
  padding-right: 1rem;
  gap: .75rem;
  transition: background var(--transition);
}

.app-header .page-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, #3a32cc 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* ── Floating Sub-nav / Welcome Banner ─────────────── */
.welcome-banner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.2rem 1.2rem;
  margin: 1rem 1rem 1.5rem 1rem;
  border-radius: var(--radius);
  /* Premium Mesh Gradient Feel */
  /* Degradê fixo: a animação infinita pesava em Android mais simples */
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 50%, #4f46e5 100%);
  color: #fff;
  box-shadow: var(--shadow-colored);
}

.welcome-icon {
  font-size: 2rem;
  opacity: .9;
  flex-shrink: 0;
  background: rgba(255,255,255,0.2);
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome-greeting {
  font-size: .85rem;
  opacity: .9;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.welcome-name {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65vw;
}

[data-theme="dark"] .welcome-banner {
  background: linear-gradient(135deg, #3730a3 0%, #5b21b6 100%);
}

/* ── Bottom Navigation (Fixa Nativamente com Glassmorphism) ─────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: auto;
  padding: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.03); /* Sombra super leve */
}

.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 500px;
  padding: .6rem .25rem calc(env(safe-area-inset-bottom, 16px) + .6rem) .25rem; /* Respeita a barra home do iPhone */
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 600;
  padding: .5rem .75rem;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
  min-width: 60px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.bottom-nav a i {
  font-size: 1.35rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav a.active {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.bottom-nav a.active i {
  transform: translateY(-2px) scale(1.15);
}

/* Removed the dot below the icon for a cleaner look natively */
.bottom-nav a:hover, .bottom-nav a:active {
  color: var(--primary);
  background: rgba(79,70,229,.1);
}

/* ── Page Content ──────────────────────────────────── */
.page-content {
  padding: 0 1rem 1rem 1rem;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Cards (Premium style, soft shadows) ───────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border); /* Optional: remove border entirely if you only want shadows */
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
}

[data-theme="light"] .card {
  border: none;
  box-shadow: var(--shadow);
}

/* Efeitos de "levantar" só em aparelhos com mouse: no toque o :hover fica preso
   depois de tocar, deixando o item levantado */
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .stat-card:hover { transform: translateY(-3px) scale(1.01); box-shadow: var(--shadow-lg); }
  .order-item:hover, .list-item:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.15), 0 8px 10px -6px rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
  }
  .order-item:hover { color: var(--text); }
  .btn-primary:hover {
    background: linear-gradient(135deg, #3a32cc 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79,70,229,.4);
    color: #fff;
  }
  .fab:hover { transform: scale(1.1) translateY(-4px); box-shadow: 0 15px 30px rgba(79,70,229,.6); color: #fff; }
  .btn-icon:hover { background: var(--border); color: var(--text); }
}

.card-header {
  background: var(--surface); /* Keep surface to match card body seamlessly */
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 1.2rem;
  font-weight: 700;
  font-size: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.card-body { padding: 1.2rem; }

/* ── Dashboard Cards (Glass Icons) ─────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

[data-theme="light"] .stat-card { border: none; box-shadow: var(--shadow); }
a.stat-card { color: inherit; }

.stat-card:active {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  /* Glassmorphism approach inside icons */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stat-icon.blue   { background: linear-gradient(135deg, rgba(59,130,246,0.2) 0%, rgba(59,130,246,0.05) 100%); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }
.stat-icon.green  { background: linear-gradient(135deg, rgba(16,185,129,0.2) 0%, rgba(16,185,129,0.05) 100%); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.stat-icon.red    { background: linear-gradient(135deg, rgba(244,63,94,0.2) 0%, rgba(244,63,94,0.05) 100%); color: var(--danger); border: 1px solid rgba(244,63,94,0.2); }
.stat-icon.yellow { background: linear-gradient(135deg, rgba(245,158,11,0.2) 0%, rgba(245,158,11,0.05) 100%); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.stat-icon.purple { background: linear-gradient(135deg, rgba(79,70,229,0.2) 0%, rgba(79,70,229,0.05) 100%); color: var(--primary); border: 1px solid rgba(79,70,229,0.2); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Order List Items (Soft Ripple effect prep) ──────── */
.order-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden; /* For ripple effect bounds */
}

[data-theme="light"] .order-item { border: none; box-shadow: var(--shadow-sm); }

.order-item:active {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.15), 0 8px 10px -6px rgba(79, 70, 229, 0.1);
  color: var(--text);
  border-color: rgba(79, 70, 229, 0.3);
}

.order-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--surface-2);
}

.order-status-dot.aberta   { background: var(--success); box-shadow: 0 0 0 4px rgba(16,185,129,0.2); }
.order-status-dot.fechada  { background: var(--text-muted); box-shadow: 0 0 0 4px rgba(100,116,139,0.2);  }
.order-status-dot.cancelada{ background: var(--danger); box-shadow: 0 0 0 4px rgba(244,63,94,0.2); }

/* ── Status Badges ─────────────────────────────────── */
.badge-status {
  font-size: .75rem;
  font-weight: 700;
  padding: .35em .7em;
  border-radius: var(--radius-pill);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.badge-aberta    { background: rgba(16,185,129,0.15); color: #059669; border: 1px solid rgba(16,185,129,0.3); }
.badge-fechada   { background: rgba(100,116,139,0.15); color: #475569; border: 1px solid rgba(100,116,139,0.3); }
.badge-cancelada { background: rgba(244,63,94,0.15); color: #e11d48; border: 1px solid rgba(244,63,94,0.3); }

[data-theme="dark"] .badge-aberta    { color: #34d399; }
[data-theme="dark"] .badge-fechada   { color: #94a3b8; }
[data-theme="dark"] .badge-cancelada { color: #fb7185; }

/* ── Etapas da Ordem (O, P, A, G, F, E, C) ─────────── */
.badge-st-o, .badge-st-p, .badge-st-a, .badge-st-g,
.badge-st-f, .badge-st-e, .badge-st-c {
  background: color-mix(in srgb, var(--st) 14%, transparent);
  color: var(--st);
  border: 1px solid color-mix(in srgb, var(--st) 30%, transparent);
}
.badge-st-o, .order-status-dot.st-o { --st: #4f46e5; }  /* Orçamento */
.badge-st-p, .order-status-dot.st-p { --st: #0284c7; }  /* Aprovada */
.badge-st-a, .order-status-dot.st-a { --st: #d97706; }  /* Em andamento */
.badge-st-g, .order-status-dot.st-g { --st: #9333ea; }  /* Aguardando peça */
.badge-st-f, .order-status-dot.st-f { --st: #059669; }  /* Concluída */
.badge-st-e, .order-status-dot.st-e { --st: #475569; }  /* Entregue */
.badge-st-c, .order-status-dot.st-c { --st: #e11d48; }  /* Cancelada */
[data-theme="dark"] .badge-st-o, [data-theme="dark"] .order-status-dot.st-o { --st: #818cf8; }
[data-theme="dark"] .badge-st-p, [data-theme="dark"] .order-status-dot.st-p { --st: #38bdf8; }
[data-theme="dark"] .badge-st-a, [data-theme="dark"] .order-status-dot.st-a { --st: #fbbf24; }
[data-theme="dark"] .badge-st-g, [data-theme="dark"] .order-status-dot.st-g { --st: #c084fc; }
[data-theme="dark"] .badge-st-f, [data-theme="dark"] .order-status-dot.st-f { --st: #34d399; }
[data-theme="dark"] .badge-st-e, [data-theme="dark"] .order-status-dot.st-e { --st: #94a3b8; }
[data-theme="dark"] .badge-st-c, [data-theme="dark"] .order-status-dot.st-c { --st: #fb7185; }
.order-status-dot[class*="st-"] {
  background: var(--st);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 20%, transparent);
}
.pill .order-status-dot { width: 9px; height: 9px; }

/* Avisos de atraso e pagamento (lista, detalhe) */
.badge-atrasada, .badge-pg-pago, .badge-pg-parcial, .badge-pg-pendente {
  font-size: .68rem;
  font-weight: 700;
  padding: .25em .6em;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-atrasada    { background: rgba(244,63,94,0.15); color: #e11d48; }
.badge-pg-pago     { background: rgba(16,185,129,0.15); color: #059669; }
.badge-pg-parcial  { background: rgba(245,158,11,0.18); color: #b45309; }
.badge-pg-pendente { background: rgba(244,63,94,0.12); color: #be123c; }
[data-theme="dark"] .badge-atrasada    { color: #fb7185; }
[data-theme="dark"] .badge-pg-pago     { color: #34d399; }
[data-theme="dark"] .badge-pg-parcial  { color: #fbbf24; }
[data-theme="dark"] .badge-pg-pendente { color: #fda4af; }

/* ── FAB Button (Bigger, Glow effect) ──────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 24px);
  right: 1.2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #3a32cc 100%);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: var(--shadow-colored);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 150;
  text-decoration: none;
}

/* Brilho fixo (sem pulsar): desfoque animado sem parar pesa na bateria e na rolagem */
.fab::after {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: var(--primary);
  border-radius: 50%;
  z-index: -1;
  opacity: 0.5;
  filter: blur(12px);
}

.fab:active {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 15px 30px rgba(79,70,229,.6);
  color: #fff;
}

/* ── Search Bar ─────────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 1.25rem;
}

.search-bar input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .8rem 1.2rem .8rem 2.8rem !important; /* Override form-control padding */
  width: 100%;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .search-bar input { border: none; box-shadow: var(--shadow); }

.search-bar input:focus {
  outline: none;
  border: 1px solid var(--primary-light) !important;
  box-shadow: 0 0 0 4px rgba(79,70,229,.15) !important;
}

.search-bar i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ── Forms ──────────────────────────────────────────── */
.form-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .4rem;
  display: block;
}

.form-control, .form-select, .ts-control {
  background: var(--surface-2) !important; /* Fundo levemente cinza para destacar do fundo branco */
  border: 1px solid rgba(15, 23, 42, 0.08) !important; /* Borda mais visível */
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  font-size: 16px !important;
  padding: 0.75rem 1rem !important;
  transition: all var(--transition);
  font-weight: 500;
}

[data-theme="dark"] .form-control, 
[data-theme="dark"] .form-select, 
[data-theme="dark"] .ts-control {
  background: rgba(0,0,0,0.2) !important;
  border-color: rgba(255,255,255,0.08) !important;
}

/* Corrige o input invisível do TomSelect para não dar zoom */
.ts-control > input, .ts-dropdown {
  font-size: 16px !important;
}
.ts-dropdown {
  background: var(--surface) !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.ts-dropdown .active {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

.form-control:focus, .form-select:focus, .ts-control.focus {
  background: var(--surface) !important; /* Fica branco puro ao focar */
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 0 4px rgba(79,70,229,.15) !important;
}

/* Data/hora no iOS: o Safari centraliza e quebra o texto ("19 de out. de 2026")
   em duas linhas, cortando a segunda. Mantém em uma linha, alinhado à esquerda. */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
  -webkit-appearance: none;
  appearance: none;
  min-height: calc(1.5em + 1.5rem + 2px);
  white-space: nowrap;
  text-align: left;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

textarea.form-control { resize: vertical; min-height: 100px; border-radius: var(--radius-sm); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #3a32cc 100%);
  border: none;
  color: #fff;
  box-shadow: var(--shadow-colored);
}

.btn-primary:active {
  background: linear-gradient(135deg, #3a32cc 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79,70,229,.4);
  color: #fff;
}

.btn-outline-danger {
  border-radius: var(--radius-sm);
  border-width: 2px;
}

/* ── List items ─────────────────────────────────────── */
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease-out;
}

[data-theme="light"] .list-item { border: none; box-shadow: var(--shadow-sm); }

.list-item:active {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.15), 0 8px 10px -6px rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.3);
}

.list-item .item-name {
  font-weight: 700;
  font-size: .95rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.list-item .item-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

.item-actions { display: flex; gap: .5rem; }

/* ── Pagination ─────────────────────────────────────── */
.pagination-wrap {
  display: flex;
  justify-content: center;
  gap: .4rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination-wrap a,
.pagination-wrap span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 50%; /* Circle pagination is elegant */
  font-size: .85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
}

@media (hover: hover) { .pagination-wrap a:hover { background: var(--primary); color:#fff; border-color:var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-colored); } }
.pagination-wrap .active { background: var(--primary); color:#fff; border-color:var(--primary); box-shadow: var(--shadow-colored); }

/* ── Toast ──────────────────────────────────────────── */
.toast-container { z-index: 9999; }
.alert { border-radius: var(--radius-sm); font-weight: 500; border: none; box-shadow: var(--shadow); }

/* ── Ordem Show - Items ─────────────────────────────── */
.item-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: .5rem;
  transition: transform var(--transition);
}

@media (hover: hover) { .item-row:hover { transform: translateX(4px); } }

.item-row .nome { font-weight: 700; font-size: .9rem; font-family: 'Plus Jakarta Sans', sans-serif;}
.item-row .preco { font-size: .85rem; color: var(--text-muted); font-weight: 500; }
.item-row .liquido { font-weight: 800; color: var(--primary); font-size: 1.05rem; margin-top: 4px; }

/* ── Total Box ──────────────────────────────────────── */
.total-box {
  background: linear-gradient(135deg, var(--primary) 0%, #3a32cc 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-colored);
  position: relative;
  overflow: hidden;
}

.total-box::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.total-box .label { font-size: .85rem; font-weight: 500; opacity: .9; text-transform: uppercase; letter-spacing: 0.05em; }
.total-box .value { font-size: 2.2rem; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; text-shadow: 0 4px 10px rgba(0,0,0,0.2); margin-top: 4px; }

/* ── Auth Layout ────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%); /* Premium dark tech background */
  position: relative;
  overflow: hidden;
}

/* Ambient light in background auth */
.auth-wrapper::before {
  content: '';
  position: absolute;
  top: -20vh; right: -20vw;
  width: 70vw; height: 70vw;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.auth-wrapper::after {
  content: '';
  position: absolute;
  bottom: -20vh; left: -20vw;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(244, 63, 94, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 30px 60px rgba(0,0,0,.4);
  position: relative;
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.2);
}

.auth-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary) 0%, #3a32cc 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: #fff;
  box-shadow: var(--shadow-colored);
}

/* ── Filter Pills ───────────────────────────────────── */
.filter-pills {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  margin-bottom: 1.25rem;
  scrollbar-width: none;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  padding: .4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .pill { border: none; }

.pill.active, .pill:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-colored);
  transform: scale(0.95);
}

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp .4s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ── Dark mode toggle ───────────────────────────────── */
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
  font-size: 1.1rem;
}

.btn-icon:active { background: var(--border); color: var(--text); transform: scale(0.95); }

/* ── Empty State ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

[data-theme="light"] .empty-state { border: none; box-shadow: var(--shadow-sm); }

.empty-state i { font-size: 4rem; margin-bottom: 1rem; opacity:.2; color: var(--text); }
.empty-state p { font-size: .95rem; font-weight: 500; }

/* ── Formulários no celular ─────────────────────────── */
/* .form-card: sem "cartão" no celular, campos quase de ponta a ponta.
   .form-actions: Cancelar/Salvar fixos logo acima do menu de baixo.
   --bottom-nav-h é medida pelo app.js (0 com o teclado aberto). */
@media (max-width: 575.98px) {
  .card.form-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible; /* overflow:hidden impediria o position:sticky da barra */
  }
  .form-card > .card-body { padding: 1rem 0 0; }

  .form-actions {
    position: sticky;
    bottom: var(--bottom-nav-h, calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)));
    z-index: 50;
    margin: 1.5rem -1rem 0 !important;
    padding: .75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--border);
  }

  /* Teclado aberto: esconde o menu de baixo para não cobrir o campo (Android sobe o menu junto) */
  body.teclado-aberto .bottom-nav { display: none; }
}

/* Quem pediu "reduzir movimento" no aparelho não recebe animações */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Responsive ─────────────────────────────────────── */
/* 576px = breakpoint "sm" do Bootstrap, o mesmo usado por d-sm-none / d-sm-flex no layout */
@media (min-width: 576px) {
  body { padding-bottom: 8px; }
  .bottom-nav { display: none; }
  .fab { bottom: 2rem; right: 2rem; width: 64px; height: 64px; font-size: 2rem; }

  /* Sidebar for desktop */
  .desktop-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 100;
  }

  .desktop-sidebar .brand {
    padding: .75rem 1.5rem 1.5rem;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
  }

  .desktop-sidebar a {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .75rem 1.5rem;
    color: var(--text-muted);
    font-size: .95rem;
    font-weight: 600;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    margin: 0 .75rem;
  }

  .desktop-sidebar a:hover { background: var(--bg); color: var(--text); transform: translateX(4px); }
  .desktop-sidebar a.active { background: rgba(79,70,229,.1); color: var(--primary); font-weight: 700; }

  .with-sidebar { margin-left: 260px; }
  .page-content { max-width: 860px; padding: 2rem; }
  
  .welcome-banner { margin: 1rem 0 2rem 0; padding: 2rem; }
}

/* Page Transition */
.page-transition { transition: opacity 0.2s ease-out; opacity: 1; }
.page-fade-out { opacity: 0 !important; }
