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

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

main {
  min-width: 0;
  max-width: 100vw;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

input,
button,
textarea,
select {
  min-width: 0;
}

.tab-content,
.tab-content > *,
.tab-content .grid,
.tab-content .flex,
.tab-content .bg-surface {
  min-width: 0;
  max-width: 100%;
}

.safe-area-pb {
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

/* Sistema de tema: tokens globais e ajustes de compatibilidade para as utilitárias existentes. */
:root {
  color-scheme: dark;
  --theme-background: #09090b;
  --theme-surface: #18181b;
  --theme-surface-subtle: #101014;
  --theme-border: #27272a;
  --theme-text: #ffffff;
  --theme-text-muted: #a1a1aa;
  --theme-shadow: rgba(0, 0, 0, 0.32);
}

:root[data-theme="light"] {
  color-scheme: light;
  --theme-background: #f3f7f4;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #eaf0ec;
  --theme-border: #d8e3dc;
  --theme-text: #17231d;
  --theme-text-muted: #65746b;
  --theme-shadow: rgba(23, 35, 29, 0.1);
  --theme-primary-ink: #087a55;
  --theme-primary-soft: rgba(0, 174, 111, 0.1);
  --theme-primary-border: rgba(0, 139, 89, 0.26);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  width: 4rem;
  height: 2.25rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem;
  color: var(--theme-text-muted);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  box-shadow: 0 6px 18px var(--theme-shadow);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  border-color: #00a96f;
  box-shadow: 0 8px 22px var(--theme-shadow), 0 0 0 3px rgba(0, 245, 160, 0.12);
}

.theme-toggle:focus-visible {
  outline: 2px solid #00a96f;
  outline-offset: 3px;
}

.theme-menu-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  margin-bottom: 0.5rem;
  color: var(--theme-text);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 245, 160, 0.2);
}

.theme-menu-toggle:focus-visible {
  outline: 2px solid #00a96f;
  outline-offset: 2px;
}

.theme-toggle-icon {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  transition: color 0.2s ease;
}

.theme-toggle-moon { left: 0.5625rem; }
.theme-toggle-sun { right: 0.6875rem; }
.theme-toggle-moon { color: #f5b942; }
.theme-toggle-sun { color: #8792a2; }

.theme-toggle-thumb {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.625rem;
  height: 1.625rem;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s ease, background 0.22s ease;
}

:root[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(1.75rem);
  background: #edf1f4;
}

:root[data-theme="light"] .theme-toggle-moon { color: #8792a2; }
:root[data-theme="light"] .theme-toggle-sun { color: #d68a00; }

/* A aplicação usa Tailwind via CDN. Estas regras mantêm os componentes atuais coerentes
   até que suas classes sejam gradualmente substituídas pelos tokens acima. */
:root[data-theme="light"] body,
:root[data-theme="light"] .bg-background {
  color: var(--theme-text);
  background-color: var(--theme-background) !important;
  background-image:
    radial-gradient(circle at 12% -8%, rgba(0, 205, 133, 0.09), transparent 28rem),
    radial-gradient(circle at 96% 8%, rgba(68, 135, 103, 0.06), transparent 24rem);
}

:root[data-theme="light"] .bg-surface,
:root[data-theme="light"] [class*="bg-surface/"] {
  background-color: var(--theme-surface) !important;
}

:root[data-theme="light"] [class*="bg-background/"] {
  background-color: var(--theme-surface-subtle) !important;
}

:root[data-theme="light"] .bg-black,
:root[data-theme="light"] [class*="bg-black/"] {
  background-color: var(--theme-surface-subtle) !important;
}

:root[data-theme="light"] [class*="bg-zinc-"] {
  background-color: var(--theme-surface-subtle) !important;
}

:root[data-theme="light"] .text-white,
:root[data-theme="light"] .text-zinc-200,
:root[data-theme="light"] .text-zinc-300,
:root[data-theme="light"] .text-zinc-400 {
  color: var(--theme-text) !important;
}

:root[data-theme="light"] .text-text-muted,
:root[data-theme="light"] .text-zinc-500,
:root[data-theme="light"] .text-zinc-600 {
  color: var(--theme-text-muted) !important;
}

:root[data-theme="light"] .border-border,
:root[data-theme="light"] [class*="border-border/"] {
  border-color: var(--theme-border) !important;
}

:root[data-theme="light"] [class*="border-white/"] {
  border-color: rgba(24, 33, 47, 0.12) !important;
}

/* O verde neon é excelente sobre preto, mas precisa de mais profundidade em fundo branco. */
:root[data-theme="light"] .text-primary,
:root[data-theme="light"] [class*="hover:text-primary"]:hover {
  color: var(--theme-primary-ink) !important;
}

:root[data-theme="light"] [class*="bg-primary/"] {
  background-color: var(--theme-primary-soft) !important;
}

:root[data-theme="light"] [class*="border-primary/"] {
  border-color: var(--theme-primary-border) !important;
}

:root[data-theme="light"] [class*="bg-white/"] {
  background-color: rgba(23, 35, 29, 0.035) !important;
}

:root[data-theme="light"] [class*="hover:bg-white/"]:hover {
  background-color: rgba(0, 139, 89, 0.075) !important;
}

:root[data-theme="light"] [class*="hover:text-white"]:hover {
  color: var(--theme-text) !important;
}

:root[data-theme="light"] [class*="hover:bg-zinc-"]:hover {
  background-color: #dfe8e2 !important;
}

:root[data-theme="light"] .text-red-300,
:root[data-theme="light"] .text-red-400,
:root[data-theme="light"] .text-red-500 {
  color: #bc2d2d !important;
}

:root[data-theme="light"] .text-yellow-400,
:root[data-theme="light"] .text-yellow-500 {
  color: #a66500 !important;
}

:root[data-theme="light"] .text-blue-300,
:root[data-theme="light"] .text-blue-400,
:root[data-theme="light"] .text-blue-500 {
  color: #2563b8 !important;
}

:root[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  color: var(--theme-text) !important;
  background-color: #ffffff !important;
  border-color: #cfdcd4 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
  color: #93a198 !important;
}

:root[data-theme="light"] input:focus,
:root[data-theme="light"] select:focus,
:root[data-theme="light"] textarea:focus {
  border-color: #00aa6f !important;
  box-shadow: 0 0 0 3px rgba(0, 198, 128, 0.14) !important;
}

:root[data-theme="light"] #sidebar {
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow: 12px 0 32px rgba(23, 35, 29, 0.045);
}

:root[data-theme="light"] .bg-surface.border,
:root[data-theme="light"] [class*="rounded-xl"].border-border {
  box-shadow: 0 10px 28px rgba(23, 35, 29, 0.045);
}

:root[data-theme="light"] .shadow-lg,
:root[data-theme="light"] .shadow-xl,
:root[data-theme="light"] .shadow-2xl {
  box-shadow: 0 16px 34px rgba(23, 35, 29, 0.1) !important;
}

:root[data-theme="light"] .nav-item:hover,
:root[data-theme="light"] .nav-item.bg-white\/5 {
  color: var(--theme-text) !important;
  background: rgba(0, 139, 89, 0.075) !important;
}

:root[data-theme="light"] .products-table thead,
:root[data-theme="light"] .products-table tbody tr:hover {
  background-color: rgba(23, 35, 29, 0.025) !important;
}

/* Backdrops de modais precisam manter contraste no tema claro. */
:root[data-theme="light"] .fixed > .absolute.inset-0[class*="bg-black"] {
  background-color: rgba(15, 23, 42, 0.5) !important;
}

:root[data-theme="light"] ::-webkit-scrollbar-track { background: var(--theme-background); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #b6c0ca; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #8d9aa8; }

:root[data-theme="light"] .settings-switch span {
  background: #dce2e8;
  border-color: #c3ccd6;
}

:root[data-theme="light"] .settings-switch span::after { background: #ffffff; }

:root[data-theme="light"] .client-guide,
:root[data-theme="light"] .client-guide-toggle,
:root[data-theme="light"] .client-guide-bubble {
  color: var(--theme-text);
  background: var(--theme-surface);
  border-color: var(--theme-border);
  box-shadow: -18px 0 42px var(--theme-shadow);
}

:root[data-theme="light"] .client-guide-header {
  background: linear-gradient(180deg, rgba(0, 169, 111, 0.1), rgba(255, 255, 255, 0));
  border-color: var(--theme-border);
}

:root[data-theme="light"] .client-guide-title,
:root[data-theme="light"] .client-guide-section h3,
:root[data-theme="light"] .client-guide-bubble-close:hover,
:root[data-theme="light"] .client-guide-close:hover {
  color: var(--theme-text);
}

:root[data-theme="light"] .client-guide-subtitle,
:root[data-theme="light"] .client-guide-section li,
:root[data-theme="light"] .client-guide-bubble-close,
:root[data-theme="light"] .client-guide-close {
  color: var(--theme-text-muted);
}

:root[data-theme="light"] .client-guide-close,
:root[data-theme="light"] .client-guide-bubble-close {
  background: var(--theme-surface-subtle);
  border-color: var(--theme-border);
}

:root[data-theme="light"] .client-guide-section { border-color: var(--theme-border); }

#toast {
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #09090b;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Feedback Animations */
.feedback {
  @apply mt-4 p-4 rounded-lg text-sm font-medium text-center border animate-fade-in;
}

.feedback.success {
  @apply bg-primary/10 text-primary border-primary/20;
}

.feedback.error {
  @apply bg-red-500/10 text-red-400 border-red-500/20;
}

.feedback.hidden {
  display: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Utilitário para transição suave do modal lateral */
.translate-x-full {
  transform: translateX(100%);
}

/* Calendar Grid Fix */
#calendarGrid {
  min-height: 400px;
}

.settings-switch {
  position: relative;
  display: inline-flex;
  width: 3.25rem;
  height: 1.75rem;
  flex: 0 0 auto;
  cursor: pointer;
}

.settings-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-switch span {
  position: absolute;
  inset: 0;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-switch span::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  background: #a1a1aa;
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.settings-switch input:checked + span {
  background: rgba(0, 245, 160, 0.18);
  border-color: rgba(0, 245, 160, 0.65);
  box-shadow: 0 0 16px rgba(0, 245, 160, 0.18);
}

.settings-switch input:checked + span::after {
  background: #00f5a0;
  transform: translateX(1.48rem);
}

.settings-switch input:focus-visible + span {
  outline: 2px solid rgba(0, 245, 160, 0.7);
  outline-offset: 3px;
}

/* Right tutorial sidebar */
.client-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.client-guide-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.client-guide-launcher {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 90;
  width: 3.5rem;
  height: 3.5rem;
  transform: translateY(-50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.client-guide-launcher.is-open {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(100%);
}

.client-guide-toggle {
  position: relative;
  display: flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  color: #00f5a0;
  background: rgba(24, 24, 27, 0.96);
  border: 1px solid #27272a;
  border-right: 0;
  border-radius: 999px 0 0 999px;
  box-shadow: 0 0 24px rgba(0, 245, 160, 0.18);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.client-guide-toggle:hover {
  color: #09090b;
  background: #00f5a0;
  border-color: #00f5a0;
  transform: translateX(-4px);
}

.client-guide-bubble {
  position: absolute;
  right: calc(100% + 0.75rem);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  max-width: 11rem;
  padding: 0.55rem 0.55rem 0.55rem 0.75rem;
  color: #ffffff;
  background: rgba(24, 24, 27, 0.98);
  border: 1px solid rgba(0, 245, 160, 0.34);
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), 0 0 18px rgba(0, 245, 160, 0.14);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
  transform: translateY(-50%);
  white-space: normal;
}

.client-guide-bubble.is-hidden {
  display: none;
}

.client-guide-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.36rem;
  width: 0.65rem;
  height: 0.65rem;
  background: rgba(24, 24, 27, 0.98);
  border-top: 1px solid rgba(0, 245, 160, 0.34);
  border-right: 1px solid rgba(0, 245, 160, 0.34);
  transform: translateY(-50%) rotate(45deg);
}

.client-guide-bubble-close {
  position: relative;
  z-index: 1;
  display: flex;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  pointer-events: auto;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.client-guide-bubble-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(0, 245, 160, 0.32);
}

.client-guide-toggle.is-open {
  opacity: 0;
  pointer-events: none;
}

.client-guide {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  width: min(420px, calc(100vw - 1rem));
  max-width: 100vw;
  flex-direction: column;
  color: #e4e4e7;
  background: rgba(24, 24, 27, 0.97);
  border-left: 1px solid #27272a;
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.48);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.client-guide.is-open {
  transform: translateX(0);
}

.client-guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid #27272a;
  background: linear-gradient(180deg, rgba(0, 245, 160, 0.08), rgba(24, 24, 27, 0));
}

.client-guide-kicker {
  margin-bottom: 0.35rem;
  color: #00f5a0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.client-guide-title {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
}

.client-guide-subtitle {
  margin-top: 0.45rem;
  color: #a1a1aa;
  font-size: 0.9rem;
  line-height: 1.45;
}

.client-guide-close {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.client-guide-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 245, 160, 0.45);
}

.client-guide-content {
  overflow-y: auto;
  padding: 1.25rem;
}

.client-guide-section {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.client-guide-section:first-child {
  padding-top: 0;
}

.client-guide-section:last-child {
  border-bottom: 0;
}

.client-guide-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
}

.client-guide-section h3 i {
  color: #00f5a0;
}

.client-guide-section li {
  color: #c4c4cc;
  font-size: 0.875rem;
  line-height: 1.55;
}

.client-guide-section ol {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.15rem;
}

/* Prévia das datas do calendário ao passar o mouse. */
.calendar-hover-preview {
  position: fixed;
  z-index: 140;
  width: min(19.375rem, calc(100vw - 1.5rem));
  padding: 0.9rem;
  color: #e4e4e7;
  background: rgba(24, 24, 27, 0.98);
  border: 1px solid rgba(0, 245, 160, 0.3);
  border-radius: 0.8rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.calendar-hover-preview.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.calendar-hover-preview-date {
  color: #00f5a0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.calendar-hover-preview-title {
  margin-top: 0.3rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.3;
}

.calendar-hover-preview-type,
.calendar-hover-preview-copy {
  margin-top: 0.45rem;
  color: #a1a1aa;
  font-size: 0.76rem;
  line-height: 1.45;
}

.calendar-hover-preview-events {
  display: grid;
  gap: 0.32rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #d4d4d8;
  font-size: 0.76rem;
}

.calendar-hover-preview-events div {
  display: flex;
  align-items: flex-start;
  gap: 0.42rem;
}

.calendar-hover-preview-events span {
  width: 0.38rem;
  height: 0.38rem;
  flex: 0 0 auto;
  margin-top: 0.32rem;
  border-radius: 999px;
}

.calendar-hover-preview-events small {
  color: #8b8b96;
  font-size: 0.68rem;
}

.client-guide-note {
  margin-top: 0.9rem;
  padding: 0.85rem;
  color: #d4d4d8;
  font-size: 0.82rem;
  line-height: 1.5;
  background: rgba(0, 245, 160, 0.07);
  border: 1px solid rgba(0, 245, 160, 0.16);
  border-radius: 0.75rem;
}

/* Área de produtos: mantém os controles legíveis mesmo com o menu lateral aberto. */
.products-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.products-page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.products-view-toggle {
  display: flex;
  flex: 0 0 auto;
  gap: 0.15rem;
  padding: 0.25rem;
  background: rgba(24, 24, 27, 0.88);
  border: 1px solid #27272a;
  border-radius: 0.8rem;
}

.products-sync-button,
.products-create-button {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.products-sync-button {
  color: #f4f4f5;
  background: #18181b;
  border: 1px solid #3f3f46;
}

.products-sync-button:hover:not(:disabled) {
  border-color: rgba(0, 245, 160, 0.55);
  background: #242428;
}

.products-create-button {
  color: #071d16;
  background: #00e69a;
  border: 1px solid #00e69a;
  box-shadow: 0 8px 22px rgba(0, 245, 160, 0.18);
}

.products-create-button:hover,
.products-sync-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.products-create-button:hover {
  background: #00f5a0;
  box-shadow: 0 10px 26px rgba(0, 245, 160, 0.28);
}

.products-sync-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.products-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(215px, 260px);
  gap: 0.75rem;
  align-items: center;
}

.products-supplier-filter {
  min-width: 0;
}

.products-table th {
  font-size: 0.72rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.products-table td {
  vertical-align: middle;
}

/* O tooltip é filho de uma célula estreita. Sem esta regra, o max-width
   responsivo aplicado aos cards limita o painel ao tamanho do preço. */
.product-cost-tooltip {
  width: 14rem;
  max-width: none !important;
}

.product-cost-tooltip-rows {
  display: grid;
  gap: 0.3rem;
}

.product-cost-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
}

.product-cost-tooltip-row span:last-child {
  color: #ffffff;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.product-selection-bar {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 75;
  width: max-content;
  max-width: calc(100vw - 2rem);
  transform: translateX(-50%);
  animation: productSelectionBarIn 0.2s ease-out;
}

.product-selection-bar-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.65rem 0.6rem 0.75rem;
  color: #f4f4f5;
  background: rgba(24, 24, 27, 0.96);
  border: 1px solid rgba(0, 245, 160, 0.34);
  border-radius: 1rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.46), 0 0 24px rgba(0, 245, 160, 0.12);
  backdrop-filter: blur(14px);
}

.product-selection-summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-right: 0.8rem;
  border-right: 1px solid #3f3f46;
  white-space: nowrap;
}

.product-selection-count {
  display: inline-flex;
  width: 1.55rem;
  height: 1.55rem;
  align-items: center;
  justify-content: center;
  color: #071d16;
  background: #00f5a0;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.product-selection-label,
.product-selection-multi-hint {
  color: #d4d4d8;
  font-size: 0.8rem;
  font-weight: 650;
}

.product-selection-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.product-selection-action,
.product-selection-icon-action,
.product-selection-clear {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #d4d4d8;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.product-selection-action {
  padding: 0 0.75rem;
}

.product-selection-icon-action,
.product-selection-clear {
  width: 2.25rem;
}

.product-selection-action:hover,
.product-selection-icon-action:hover,
.product-selection-clear:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.product-selection-action-primary {
  color: #071d16;
  background: #00f5a0;
  border-color: #00f5a0;
}

.product-selection-action-primary:hover {
  color: #071d16;
  background: #38ffc0;
  border-color: #38ffc0;
}

.product-selection-delete,
.product-selection-delete-action {
  color: #fca5a5;
}

.product-selection-delete:hover,
.product-selection-delete-action:hover {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(248, 113, 113, 0.25);
}

@keyframes productSelectionBarIn {
  from { opacity: 0; transform: translate(-50%, 0.75rem); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 1279px) {
  .products-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .products-page-actions {
    width: 100%;
  }

  .products-filter-bar {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
  }
}

@media (max-width: 767px) {
  body,
  body.h-screen {
    height: 100dvh;
  }

  main {
    width: 100%;
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .tab-content {
    width: 100%;
    padding: 5.25rem 0.875rem calc(7rem + env(safe-area-inset-bottom)) !important;
  }

  .products-page-header {
    gap: 1rem;
  }

  .products-page-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
  }

  .products-sync-button,
  .products-create-button {
    min-width: 0;
    padding: 0.65rem 0.6rem;
    font-size: 0.8rem;
  }

  .products-filter-bar {
    grid-template-columns: 1fr;
  }

  .products-table {
    font-size: 0.8rem;
  }

  .product-selection-bar {
    bottom: calc(5.85rem + env(safe-area-inset-bottom));
    width: calc(100vw - 1.5rem);
  }

  .product-selection-bar-content {
    max-width: 100%;
    gap: 0.55rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .product-selection-bar-content::-webkit-scrollbar {
    display: none;
  }

  .product-selection-summary {
    padding-right: 0.55rem;
  }

  .product-selection-label,
  .product-selection-multi-hint {
    display: none;
  }

  .product-selection-actions {
    gap: 0.35rem;
  }

  .product-selection-action {
    padding: 0 0.6rem;
  }

  .client-guide-preference-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .client-guide-launcher {
    top: auto;
    right: 0.75rem;
    bottom: calc(5.9rem + env(safe-area-inset-bottom));
    transform: none;
  }

  .client-guide-toggle {
    width: 3rem;
    height: 3rem;
    border-right: 1px solid #27272a;
    border-radius: 999px;
  }

  .client-guide-bubble {
    right: 0;
    top: auto;
    bottom: calc(100% + 0.65rem);
    max-width: min(10.5rem, calc(100vw - 1.5rem));
    padding: 0.55rem 0.7rem;
    text-align: center;
    transform: none;
  }

  .client-guide-bubble::after {
    top: auto;
    right: 1.1rem;
    bottom: -0.36rem;
    transform: rotate(135deg);
  }

  .client-guide-launcher.is-open {
    transform: translateY(1rem);
  }

  .client-guide {
    width: 100vw;
    border-left: 0;
  }

  .client-guide-header {
    padding: calc(1rem + env(safe-area-inset-top)) 1rem 1rem;
  }

  .client-guide-content {
    padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  }
}
