/* ============================================================
   EJUVV — Design System & Stylesheet Modular
   Eixos:
   1. Tipografia: data-font="inter | geist | mono | rounded"
   2. Geometria:   data-radius="sharp | modern | pill"
   3. Modo Base:   data-mode="light | dark"
   4. Destaque:    data-accent="indigo | emerald | ocean | amber | crimson | violet"
   ============================================================ */

/* ---------- 1. Tipografia ---------- */
:root, [data-font="inter"] {
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
[data-font="geist"] {
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}
[data-font="mono"] {
  --font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}
[data-font="rounded"] {
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* ---------- 2. Geometria / Raio ---------- */
:root, [data-radius="modern"] {
  --radius-btn: 9px;
  --radius-card: 14px;
  --radius-input: 9px;
  --radius-badge: 20px;
  --radius-modal: 16px;
  --radius-icon: 10px;
}
[data-radius="sharp"] {
  --radius-btn: 2px;
  --radius-card: 4px;
  --radius-input: 3px;
  --radius-badge: 2px;
  --radius-modal: 4px;
  --radius-icon: 3px;
}
[data-radius="pill"] {
  --radius-btn: 9999px;
  --radius-card: 22px;
  --radius-input: 9999px;
  --radius-badge: 9999px;
  --radius-modal: 24px;
  --radius-icon: 50%;
}

/* ---------- 3. Modo Base (Light / Dark) ---------- */
:root, [data-mode="light"] {
  --bg: #f8fafc;
  --fg: #0f172a;
  --card: #ffffff;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --black: #0f172a;
  --white: #ffffff;
  --green: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --backdrop: rgba(15, 23, 42, 0.6);
  --alert-bg: #fffbeb;
  --alert-fg: #92400e;
  --alert-border: #fde68a;
  --status-ok-bg: #ecfdf5;
  --status-ok-fg: #059669;
  --status-warn-bg: #fffbeb;
  --status-warn-fg: #d97706;
  --status-danger-bg: #fef2f2;
  --status-danger-fg: #dc2626;
  --toast-bg: #1e293b;
  --toast-fg: #ffffff;
}

[data-mode="dark"] {
  --bg: #090d16;
  --fg: #f8fafc;
  --card: #111827;
  --muted: #94a3b8;
  --border: #1f2937;
  --border-subtle: #1e293b;
  --black: #030712;
  --white: #111827;
  --green: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --backdrop: rgba(3, 7, 18, 0.8);
  --alert-bg: rgba(120, 53, 15, 0.25);
  --alert-fg: #fde68a;
  --alert-border: #78350f;
  --status-ok-bg: rgba(6, 78, 59, 0.4);
  --status-ok-fg: #6ee7b7;
  --status-warn-bg: rgba(120, 53, 15, 0.4);
  --status-warn-fg: #fde68a;
  --status-danger-bg: rgba(127, 29, 29, 0.4);
  --status-danger-fg: #fca5a5;
  --toast-bg: #0f172a;
  --toast-fg: #f8fafc;
}

/* ---------- 4. Cores de Destaque ---------- */
:root, [data-accent="indigo"] {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --soft: rgba(99, 102, 241, 0.12);
  --soft-hover: rgba(99, 102, 241, 0.2);
}
[data-accent="emerald"] {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --soft: rgba(5, 150, 105, 0.12);
  --soft-hover: rgba(5, 150, 105, 0.2);
}
[data-accent="ocean"] {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #0ea5e9;
  --soft: rgba(2, 132, 199, 0.12);
  --soft-hover: rgba(2, 132, 199, 0.2);
}
[data-accent="amber"] {
  --primary: #d97706;
  --primary-dark: #b45309;
  --primary-light: #f59e0b;
  --soft: rgba(217, 119, 6, 0.14);
  --soft-hover: rgba(217, 119, 6, 0.24);
}
[data-accent="crimson"] {
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --primary-light: #ef4444;
  --soft: rgba(220, 38, 38, 0.12);
  --soft-hover: rgba(220, 38, 38, 0.2);
}
[data-accent="violet"] {
  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --primary-light: #a78bfa;
  --soft: rgba(139, 92, 246, 0.14);
  --soft-hover: rgba(139, 92, 246, 0.24);
}

/* ---------- Global Reset & Box Sizing ---------- */
* { box-sizing: border-box; }
html {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('./images/04a_padrao_textura_cacau.png');
  background-repeat: repeat;
  background-size: 380px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}
[data-mode="dark"] body::before {
  opacity: 0.03;
  filter: invert(1);
}
.app-shell {
  position: relative;
  z-index: 1;
}
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}
button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--soft);
}

/* ---------- Layout Core ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; position: relative; }
.sidebar {
  width: 250px;
  padding: 26px 14px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.brand, .mobile-brand { display: flex; align-items: center; gap: 10px; }
.brand { padding: 0 12px 34px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-icon);
  background: var(--primary);
  color: #fff;
  font-weight: bold;
  font-size: 19px;
  flex-shrink: 0;
}
.brand strong { font-size: 22px; letter-spacing: -0.5px; }
.brand small { display: block; color: var(--muted); font-size: 11px; }

.sidebar nav, .nav-drawer { display: grid; gap: 4px; }
.sidebar nav button, .nav-drawer button {
  min-height: 44px;
  padding: 12px 14px;
  display: flex;
  gap: 13px;
  align-items: center;
  text-align: left;
  color: var(--muted);
  border-radius: var(--radius-btn);
  width: 100%;
  transition: background .15s, color .15s;
  font-weight: 500;
}
.sidebar nav button span, .nav-drawer button span { width: 20px; text-align: center; font-size: 17px; flex-shrink: 0; }
.sidebar nav button:hover, .nav-drawer button:hover { background: var(--soft); color: var(--primary); }
.sidebar nav button.active, .nav-drawer button.active { background: var(--soft); color: var(--primary); font-weight: bold; }
.sidebar-bottom { margin-top: auto; padding: 16px 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.sidebar-bottom button { display: block; color: var(--primary); margin-bottom: 20px; font-weight: bold; min-height: 36px; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 72px;
  padding: 0 36px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}
.mobile-brand { display: none; }
.menu-toggle {
  display: none;
  font-size: 22px;
  margin-right: auto;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-btn);
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { font-size: 20px; color: var(--muted); }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--primary);
  font-weight: bold;
  font-size: 13px;
}
.user-name { font-weight: 600; font-size: 13px; }

.content {
  max-width: 1170px;
  margin: auto;
  padding: 36px 36px max(120px, env(safe-area-inset-bottom, 120px));
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
}
.eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: bold; letter-spacing: 1.2px; color: var(--primary); text-transform: uppercase; }
h1 { margin: 0; font-size: 30px; letter-spacing: -0.8px; font-weight: 700; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Buttons & Touch Targets ---------- */
.primary, .btn-primary, .btn-action, button.primary, .page-heading button.primary, .card-title button.primary, .modal-card button.primary {
  min-height: 44px;
  padding: 12px 20px;
  background: var(--primary) !important;
  color: #ffffff !important;
  border-radius: var(--radius-btn);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s, opacity .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.primary:hover, .btn-primary:hover, button.primary:hover {
  background: var(--primary-dark) !important;
  color: #ffffff !important;
}
.primary:active, button.primary:active { transform: scale(0.98); }
.primary.small { min-height: 36px; padding: 8px 14px; font-size: 12.5px; color: #ffffff !important; }
.primary *, .btn-primary *, button.primary * { color: #ffffff !important; }

.secondary-btn {
  min-height: 44px;
  padding: 10px 16px;
  background: var(--soft);
  color: var(--primary);
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s;
}
.secondary-btn:hover { background: var(--soft-hover); }

.danger-btn {
  min-height: 44px;
  padding: 10px 16px;
  background: var(--status-danger-bg);
  color: var(--danger);
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s;
}
.danger-btn:hover { opacity: 0.85; }

.text-btn { color: var(--primary); font-size: 12.5px; font-weight: 600; }
.file-btn { cursor: pointer; }

/* ---------- Hero & Banner ---------- */
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  margin-bottom: 20px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-card);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: 0;
  bottom: 0;
  width: 260px;
  background-image: url('./images/ponto_certo_padroes.png');
  background-repeat: no-repeat;
  background-position: right center;
  background-size: contain;
  opacity: 0.12;
  pointer-events: none;
}
.hero-card > * {
  position: relative;
  z-index: 1;
}
.hero-card .light { color: rgba(255, 255, 255, 0.85); font-size: 12px; }
.hero-card h2 { margin: 0; font-size: 28px; font-weight: 700; }
.hero-card h2 span { font-size: 16px; font-weight: 400; opacity: .8; }
.hero-card p { margin: 8px 0 0; opacity: .95; font-size: 13px; }
.hero-progress { width: 42%; align-self: center; flex-shrink: 0; }
.progress-label, .card-title, .stock-row, .sale-row, .product-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.progress-label { font-size: 12px; margin-bottom: 8px; }
.progress { height: 8px; background: rgba(0, 0, 0, 0.25); border-radius: var(--radius-badge); overflow: hidden; }
.progress i { display: block; height: 100%; background: #ffffff; border-radius: inherit; transition: width .3s ease; }

.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--alert-bg);
  color: var(--alert-fg);
  border: 1px solid var(--alert-border);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13.5px;
}

/* ---------- Metrics & Cards ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.card {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: border-color .15s;
}
.metric { display: flex; flex-direction: column; gap: 8px; }
.metric small, .stock-row small, .sale-row small, .product-line small { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.metric em { font-size: 11px; font-style: normal; color: var(--muted); }
.green { color: var(--green) !important; }
.danger-text { color: var(--danger) !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-title { margin-bottom: 18px; }
.card-title h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-title button { color: var(--primary); font-size: 12.5px; font-weight: 600; min-height: 32px; }

.sale-row, .product-line, .stock-row { padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sale-row:last-child, .product-line:last-child, .stock-row:last-child { border-bottom: 0; }
.sale-row > div, .product-line > div, .stock-row > div { flex: 1; min-width: 120px; }
.sale-row b, .product-line b, .stock-row b { display: block; margin-bottom: 4px; font-size: 13.5px; }
.product-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-icon);
  background: var(--soft);
  color: var(--primary);
  font-weight: bold;
  flex-shrink: 0;
}
.status {
  padding: 5px 10px;
  border-radius: var(--radius-badge);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status.ok { color: var(--status-ok-fg); background: var(--status-ok-bg); }
.status.warn { color: var(--status-warn-fg); background: var(--status-warn-bg); }
.status.danger { color: var(--status-danger-fg); background: var(--status-danger-bg); }

.row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-action {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon);
  background: var(--soft);
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-action:hover { background: var(--soft-hover); }
.icon-action.danger { background: var(--status-danger-bg); color: var(--danger); }
.icon-action.danger:hover { opacity: 0.85; }

.page-card { max-width: 900px; }
.finance-metrics { max-width: 900px; }
.search {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
.empty { padding: 36px 0; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 14px; }

/* ---------- Filters Bar ---------- */
.filters-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.filters-bar .search { grid-column: 1 / -1; margin-bottom: 0; }
.filters-bar select, .filters-bar input[type="date"] {
  min-height: 44px;
  padding: 10px 14px;
}
.sales-summary { margin-bottom: 12px; color: var(--muted); }

/* ---------- Charts ---------- */
.charts-grid { grid-template-columns: 1fr 1fr; }
.chart-box { position: relative; height: 240px; }
.full-span { grid-column: 1 / -1; }

/* ---------- Settings Forms ---------- */
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; }
.inline-form input { min-height: 44px; padding: 11px 14px; width: 220px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Design System Customization UI ---------- */
.pref-section {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}
.pref-group {
  display: grid;
  gap: 10px;
}
.pref-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
}
.segmented-btn {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: calc(var(--radius-btn) - 2px);
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented-btn:hover { color: var(--fg); }
.segmented-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  font-weight: 700;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.color-btn {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  transition: transform .15s, border-color .15s;
  padding: 8px 4px;
}
.color-btn:hover { transform: translateY(-2px); border-color: var(--primary); }
.color-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--soft);
}
.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
}
.color-label { font-size: 11px; font-weight: 600; }

.radius-grid, .font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.pref-card {
  min-height: 52px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  transition: transform .15s, border-color .15s;
}
.pref-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.pref-card.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--soft);
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-bottom, 16px));
  z-index: 100;
}
.hidden { display: none !important; }
.modal-card {
  position: relative;
  width: min(100%, 450px);
  max-height: calc(90dvh - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 28px;
  background: var(--card);
  border-radius: var(--radius-modal);
  border: 1px solid var(--border);
  display: grid;
  gap: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}
.modal-card h2 { margin: 0 0 6px; font-size: 20px; }
.modal-card label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; }
.modal-card input, .modal-card select { min-height: 44px; padding: 11px 14px; width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-hint { color: var(--muted); font-size: 11.5px; margin-top: -6px; }
.total-preview {
  margin: 0;
  padding: 12px 14px;
  background: var(--soft);
  color: var(--primary);
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 13.5px;
}
.close {
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 24px;
  color: var(--muted);
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-btn);
}
.close:hover { color: var(--fg); background: var(--soft); }
.confirm-card { text-align: left; }
.confirm-message { color: var(--muted); margin: 0; font-size: 13.5px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom, 22px));
  padding: 14px 20px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  border-radius: var(--radius-btn);
  transform: translateY(120px);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 150;
  max-width: calc(100vw - 44px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-weight: 500;
}
.toast.show { transform: translateY(0); }
.toast.error { background: #7f1d1d; color: #fff; }
.toast.warning { background: #78350f; color: #fff; }

/* ---------- FAB (Mobile) ---------- */
.fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  z-index: 25;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s;
}
.fab:active { transform: scale(0.95); }

/* ---------- Drawer Mobile ---------- */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 270px;
  background: var(--card);
  padding: 24px 16px;
  z-index: 51;
  transform: translateX(-100%);
  transition: transform .25s ease;
  overflow-y: auto;
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.25);
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.app-shell.drawer-open .nav-drawer { transform: translateX(0); }
.app-shell.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

/* ---------- Branding & Whitelabel Elements ---------- */
.brand-mark {
  overflow: hidden;
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.avatar {
  overflow: hidden;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.branding-card-box {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  display: grid;
  gap: 12px;
}
.branding-preview-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.branding-preview-box {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-icon);
  background: var(--card);
  border: 2px dashed var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.branding-preview-box.circle {
  border-radius: 50%;
}
.branding-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.branding-file-btn {
  font-size: 12px;
  padding: 8px 12px;
  min-height: 38px;
}

/* ---------- Responsividade: Tablets & Telas Médias (768px a 1024px) ---------- */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .topbar { padding: 0 24px; }
  .content { padding: 28px 24px max(110px, env(safe-area-inset-bottom, 110px)); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .color-grid { grid-template-columns: repeat(3, 1fr); }
  .branding-grid { grid-template-columns: 1fr; }
}

/* ---------- Responsividade: Mobile (<= 800px) ---------- */
@media (max-width: 800px) {
  .sidebar { display: none; }
  .topbar { height: 62px; padding: 0 16px; justify-content: space-between; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .mobile-brand { display: flex; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; font-size: 16px; }
  .user-name { display: none; }
  .content { padding: 20px 14px max(110px, env(safe-area-inset-bottom, 110px)); }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .page-heading h1 { font-size: 24px; }
  .page-heading .primary { display: none; }
  .fab { display: flex; }
  .hero-card { align-items: flex-start; flex-direction: column; padding: 20px; }
  .hero-card h2 { font-size: 24px; }
  .hero-progress { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 18px; }
  .grid-2, .charts-grid { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 16px; }
  .product-line { gap: 8px; }
  .product-line > strong { margin-left: auto; }
  .filters-bar { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .inline-form input { width: 100%; }
  .modal { padding: 12px; align-items: center; }
  .modal-card { width: min(100%, 420px); border-radius: var(--radius-modal); max-height: calc(88dvh - env(safe-area-inset-bottom, 0px)); }
  .toast { left: 14px; right: 14px; max-width: none; }
  .color-grid { grid-template-columns: repeat(3, 1fr); }
  .branding-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .metrics { grid-template-columns: 1fr; }
  .segmented-control { grid-template-columns: 1fr; }
}
