/* Card Spacing & Grid Improvements for Desktop */
.page-body {
  padding: 32px 36px;
  max-width: 1680px;
  margin: 0 auto;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.grid {
  display: grid;
  gap: 26px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 22px 24px;
  background: var(--panel, #151917);
  border: 1px solid var(--line, #2a332d);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(36, 211, 102, 0.4);
}

.two-col {
  grid-template-columns: 1.25fr 0.75fr;
  gap: 26px;
  margin-bottom: 26px;
  align-items: stretch;
}

/* Fix for Pedidos Recentes & Dashboard Cards pushing table to bottom */
.two-col > .card,
.dashboard-card {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  gap: 16px !important;
  margin-bottom: 0 !important;
}

.card {
  margin-bottom: 24px;
  background: var(--panel, #151917);
  border: 1px solid var(--line, #2a332d);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 24px 26px;
}

.section-heading {
  margin: 0 0 12px 0;
}

/* Novo Pedido (Create Order Form) Centering */
.form-container {
  max-width: 960px;
  margin: 0 auto;
}

.form-card {
  padding: 32px;
  max-width: 960px;
  margin: 0 auto 32px auto;
  background: var(--panel, #151917);
  border: 1px solid var(--line, #2a332d);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow);
}

/* Filters bar spacing */
.filters {
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 28px;
}

/* Kanban column spacing on desktop */
.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(270px, 1fr));
  gap: 20px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.kanban-column {
  min-height: 400px;
  background: #101411;
  border: 1px solid var(--line, #2a332d);
  border-radius: 14px;
  padding: 16px;
}

.kanban-cards {
  display: grid;
  gap: 14px;
}

.order-card {
  padding: 16px 18px;
  border-radius: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Chart card height & interactive cursor */
.chart-card {
  padding: 24px;
  height: 380px;
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
}

canvas#finance-chart, canvas#stage-chart {
  cursor: pointer;
}

/* Notification dropdown */
.notification-item { padding: 0; overflow: hidden; }
.notification-button { display: block; width: 100%; text-align: left; color: inherit; background: transparent; border: 0; padding: 14px; }
.notification-button:hover { background: rgba(255, 255, 255, 0.025); }
.notification-area { margin-left: auto; position: relative; }
.notification-area .notification-bell { margin-left: 0; }
.notification-dropdown { display: none; position: absolute; right: 0; top: 48px; width: min(340px, 88vw); padding: 12px; background: #151917; border: 1px solid #2a332d; border-radius: 10px; box-shadow: 0 15px 35px rgba(0,0,0,0.4); z-index: 50; }
.notification-area:hover .notification-dropdown, .notification-area:focus-within .notification-dropdown { display: grid; gap: 7px; }
.notification-dropdown > a { padding: 8px; border-radius: 7px; display: grid; gap: 2px; font-size: 13px; }
.notification-dropdown > a:hover { background: #202821; }
.notification-dropdown > a.unread { border-left: 2px solid #24d366; }
.notification-dropdown small, .notification-dropdown p { color: #9da69f; margin: 0; font-size: 12px; }
.notification-dropdown .notification-see-all { color: #24d366; font-weight: 700; }

/* Quote URL break text fix */
.quote-url-link {
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Mobile & PWA WebApp Optimizations */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .two-col { grid-template-columns: 1fr; gap: 20px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

/* Quick download button on Kanban cards */
.kanban-quick-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.kanban-quick-download:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.catalog-tab-btn.active {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

.cart-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  color: var(--muted, #9ca3af);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.cart-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

/* Estilo do Botão Global de Reportar Bug */
.topbar-bug-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-bug-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fca5a5 !important;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .topbar-bug-btn span {
    display: none !important;
  }
  .topbar-bug-btn {
    padding: 8px 10px !important;
  }
}

@media (max-width: 760px) {
  /* Extra bottom padding on mobile so fixed bottom bar never hides page content */
  .page-body {
    padding: 16px 14px !important;
    padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Topbar header title wrapping fix for long order numbers */
  .topbar {
    padding: 10px 14px !important;
    min-height: 60px !important;
  }

  .topbar h1 {
    font-size: 15px !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: calc(100vw - 140px) !important;
  }

  .topbar-title p {
    font-size: 11px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: calc(100vw - 140px) !important;
  }

  .form-card { padding: 20px 16px; margin: 0; max-width: 100%; }
  .kanban { grid-template-columns: repeat(6, minmax(260px, 82vw)); gap: 14px; }
  .stat-card { padding: 16px; }
  .btn { min-height: 44px; }
  select, input, textarea { min-height: 44px; }

  /* Fixed Mobile Bottom Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    background: #101310 !important;
    border-top: 1px solid var(--line) !important;
    z-index: 100 !important;
    justify-content: space-around !important;
    align-items: center !important;
  }
}

/* Regras de impressão de alto contraste / preto puro para relatórios e páginas */
@media print {
  *, *::before, *::after {
    color: #000000 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body, .app-shell, .main-content, .page-body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sidebar, .topbar, .mobile-bottom-nav, .menu-overlay, .no-print, .btn, .filters, .notification-bell, .topbar-bug-btn {
    display: none !important;
  }

  .card, .stat-card, .form-card {
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .stat-card strong, .stat-card small {
    color: #000000 !important;
  }

  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 11px !important;
  }

  .data-table th, .data-table td {
    color: #000000 !important;
    border: 1px solid #333333 !important;
    padding: 6px 8px !important;
  }

  .data-table th {
    background: #f0f0f0 !important;
    font-weight: 700 !important;
  }

  .text-muted, .text-green, .text-danger, small, p, span, h1, h2, h3, strong, b {
    color: #000000 !important;
  }

  .badge {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    background: #ffffff !important;
    font-weight: 700 !important;
  }
}

/* --- Padronização de Espaçamento de Badges e Ícones --- */
.badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 4px 9px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
}

.badge i {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.95em !important;
  line-height: 1 !important;
  margin: 0 !important;
}

/* --- Ferramenta de Usuários Online & Sessões em Tempo Real --- */

.sidebar-online-users-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 9px;
  color: var(--muted, #9da69f);
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-align: left;
  cursor: pointer;
  margin-bottom: 4px;
}

.sidebar-online-users-btn:hover {
  background: rgba(36, 211, 102, 0.12);
  color: var(--green, #24d366);
  border-color: rgba(36, 211, 102, 0.25);
}

.sidebar-online-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(36, 211, 102, 0.15);
  border: 1px solid rgba(36, 211, 102, 0.35);
  color: #86f5ac;
  font-size: 0.76rem;
  font-weight: 700;
}

.online-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #24d366;
  box-shadow: 0 0 8px #24d366;
  display: inline-block;
  animation: pulseGreen 1.8s infinite;
}

.sidebar-user-session {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: #9da69f;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-user-session strong {
  color: #24d366;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); opacity: 0.7; box-shadow: 0 0 0 0 rgba(36, 211, 102, 0.7); }
  70% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 5px rgba(36, 211, 102, 0); }
  100% { transform: scale(0.95); opacity: 0.7; box-shadow: 0 0 0 0 rgba(36, 211, 102, 0); }
}

.live-pulse-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: rgba(36, 211, 102, 0.12);
  border: 1px solid rgba(36, 211, 102, 0.3);
  border-radius: 99px;
  color: #86f5ac;
  font-size: 0.76rem;
  font-weight: 600;
}

.pulse-dot-live {
  width: 8px;
  height: 8px;
  background: #24d366;
  border-radius: 50%;
  animation: pulseGreen 1.8s infinite;
}

.online-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.online-filter-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.online-filter-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.online-filter-tab.active {
  background: rgba(36, 211, 102, 0.16);
  border-color: rgba(36, 211, 102, 0.4);
  color: #86f5ac;
}

.tab-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 0.72rem;
  color: inherit;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator-dot.online {
  background: #24d366;
  box-shadow: 0 0 6px rgba(36, 211, 102, 0.6);
}

.status-indicator-dot.idle {
  background: #f5b942;
  box-shadow: 0 0 6px rgba(245, 185, 66, 0.6);
}

.status-indicator-dot.offline {
  background: #64748b;
}

.online-user-card {
  background: rgba(21, 25, 23, 0.85);
  border: 1px solid #232c26;
  border-radius: 12px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.online-user-card:hover {
  border-color: rgba(36, 211, 102, 0.3);
  background: rgba(27, 33, 30, 0.95);
}

.online-user-card.is-self {
  border-color: rgba(96, 165, 250, 0.35);
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.7), rgba(21, 25, 23, 0.85));
}

.online-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1c2420;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #f5f7f5;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.online-avatar-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #131815;
}

.online-avatar-status.online { background: #24d366; }
.online-avatar-status.idle { background: #f5b942; }
.online-avatar-status.offline { background: #64748b; }

.online-user-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.online-user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.online-user-name {
  font-weight: 700;
  font-size: 0.96rem;
  color: #f5f7f5;
  margin: 0;
}

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

.online-user-details-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.8rem;
  color: #9da69f;
  flex-wrap: wrap;
}

.online-user-details-row i {
  margin-right: 4px;
}

.online-user-timer-box {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 160px;
}

.stopwatch-digital-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stopwatch-digital-clock.online {
  background: rgba(36, 211, 102, 0.12);
  color: #86f5ac;
  border: 1px solid rgba(36, 211, 102, 0.25);
}

.stopwatch-digital-clock.idle {
  background: rgba(245, 185, 66, 0.12);
  color: #ffd678;
  border: 1px solid rgba(245, 185, 66, 0.25);
}

.stopwatch-digital-clock.offline {
  background: rgba(100, 116, 139, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.2);
  font-size: 0.85rem;
}

.stopwatch-label {
  font-size: 0.74rem;
  color: #7f8e82;
}

.icon-action-btn {
  background: transparent;
  border: none;
  color: #9da69f;
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.online-loading-state {
  text-align: center;
  padding: 50px 20px;
}

@media (max-width: 640px) {
  .online-user-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .online-user-timer-box {
    text-align: left;
    align-items: flex-start;
    min-width: unset;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
    width: 100%;
  }
}


