/* Design system â€” cores oficiais Drogaria Atual (drogariaatual.com.br) */
:root {
  /* ===== CORES DA MARCA (MANTIDAS) ===== */
  --brand-dark: #1f4f74;
  --brand-blue: #216da3;
  --brand-blue-deep: #0d4f84;
  --brand-blue-light: #2f86c7;
  --brand-blue-soft: #7cc4f2;
  --brand-green: #2eac4b;
  --brand-green-deep: #178238;
  --brand-green-soft: #7bdc8d;
  --brand-orange: #ff9326;
  --brand-orange-light: #ffbb65;
  --brand-text: #34495e;
  --background: #f2f8fc;
  --foreground: #17324a;
  --card: #ffffff;
  --card-foreground: #17324a;
  --popover: #ffffff;
  --muted: #6b8798;
  --muted-foreground: #425d70;
  --border: #d5e6f1;
  --border-strong: #a9cce0;
  --input: #ffffff;
  --ring: #2eac4b;
  --primary: #216da3;
  --primary-foreground: #ffffff;
  --secondary: #e8f4fb;
  --accent: #ff9326;
  --accent-foreground: #1a1208;
  --destructive: #d64545;
  --success: #178238;
  --warning: #d67a18;
  --chart-1: #2f86c7;
  --chart-2: #ff9326;
  --chart-3: #2eac4b;
  --chart-4: #7cc4f2;
  --chart-bar-top: #2f86c7;
  --chart-bar-bottom: #0d4f84;
  --chart-line: #ff9326;
  --sidebar: #216da3;
  --sidebar-border: rgba(255, 255, 255, 0.16);
  --sidebar-accent: rgba(255, 255, 255, 0.18);

  /* ===== 1. TIPOGRAFIA FLUIDA E MODERNA ===== */
  --text-xs:    clamp(0.69rem, 0.65rem + 0.2vw, 0.75rem);   /* 11-12px */
  --text-sm:    clamp(0.81rem, 0.76rem + 0.25vw, 0.88rem);  /* 13-14px */
  --text-base:  clamp(0.94rem, 0.88rem + 0.3vw, 1rem);      /* 15-16px */
  --text-lg:    clamp(1.13rem, 1.02rem + 0.5vw, 1.25rem);   /* 18-20px */
  --text-xl:    clamp(1.35rem, 1.18rem + 0.8vw, 1.56rem);   /* 22-25px */
  --text-2xl:   clamp(1.62rem, 1.36rem + 1.3vw, 2rem);      /* 26-32px */
  --text-3xl:   clamp(2rem, 1.6rem + 2vw, 2.5rem);          /* 32-40px */

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  --leading-tight:   1.15;
  --leading-snug:    1.35;
  --leading-normal:  1.55;
  --leading-relaxed: 1.7;

  /* ===== 2. ESCALA DE ESPAÃ‡AMENTO UNIFICADA ===== */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;

  /* Aliases semÃ¢nticos vinculados Ã s suas classes atuais */
  --padding-card:       var(--space-5);   /* 24px */
  --padding-panel:      var(--space-5);
  --gap-grid:           var(--space-4);   /* 16px */
  --padding-table-cell: var(--space-3) var(--space-4); /* 12px 16px */

  /* ===== 3. SUAVIZAÃ‡ÃƒO VISUAL (BORDAS E SOMBRAS) ===== */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius:    12px;  /* mantido para compatibilidade */

  /* Sombras modernas (suaves, baseadas em preto com baixa opacidade â€” sem "sujeira" azul) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);

  /* Mantidos para compatibilidade com cÃ³digo existente */
  --shadow: 0 8px 24px rgba(33, 109, 163, 0.12);

  /* Bordas suaves baseadas em preto (neutras) */
  --border-light: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);

  /* ===== TOKENS SEMÃ‚NTICOS DE AÃ‡ÃƒO E STATUS (NOVOS) ===== */
  /* AÃ‡Ã•ES â€” reservados exclusivamente para botÃµes de aÃ§Ã£o (CTAs) */
  --action-primary:         var(--brand-orange);
  --action-primary-hover:   #e6841e;
  --action-secondary:       var(--brand-blue);
  --action-secondary-hover: var(--brand-blue-deep);
  --action-danger:          var(--destructive);
  --action-danger-hover:    #c0392b;

  /* STATUS â€” para badges, indicadores, alertas */
  --status-success:        var(--brand-green-deep);
  --status-success-bg:     rgba(46, 172, 75, 0.1);
  --status-warning:        var(--warning);
  --status-warning-bg:     rgba(255, 147, 38, 0.1);
  --status-error:          var(--destructive);
  --status-error-bg:       rgba(214, 69, 69, 0.1);
  --status-info:           var(--brand-blue);
  --status-info-bg:        rgba(33, 109, 163, 0.1);

  /* GRÃFICOS â€” paleta fixa para consistÃªncia visual */
  --chart-primary:   var(--brand-blue);
  --chart-secondary: var(--brand-orange);
  --chart-tertiary:  var(--brand-green);
  --chart-positive:  var(--brand-green);
  --chart-negative:  var(--destructive);

  /* Tipografia e layout */
  --font: "Rubik", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-width: 248px;
  --transition: 0.18s ease;
}

.cubx-date-row {
  grid-template-columns: auto 150px 1fr auto;
  align-items: center;
  cursor: pointer;
}

.cubx-date-row input {
  width: 18px;
  height: 18px;
}

.cubx-date-done {
  opacity: 0.55;
}

.cubx-month-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.cubx-month-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.cubx-month-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--foreground);
  min-width: 120px;
}

.cubx-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.cubx-badge-done {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.cubx-badge-pending {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.hint-ok      { color: var(--status-success); }
.hint-warn    { color: var(--status-warning); }
.hint-partial { color: var(--status-info); }
.hint-missing { color: var(--muted); }

.diag-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.diag-kpi {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--secondary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 140px;
  flex: 1;
}

.diag-kpi > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.diag-kpi strong {
  font-size: 0.82rem;
  color: var(--foreground);
}

.diag-kpi small {
  font-size: 0.74rem;
  color: var(--muted);
}

.diag-kpi-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand-blue);
  min-width: 32px;
  text-align: center;
}

.diag-warn {
  color: var(--warning);
}

.diag-latest-import {
  padding: 6px 0 12px;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}

.diag-event-error {
  border-left: 3px solid var(--destructive);
}

.diag-event-slow {
  border-left: 3px solid var(--warning);
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 110px;
  align-items: center;
  gap: 14px;
  min-height: 34px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-blue));
}

.analytics-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.analytics-period-field--a span { color: var(--brand-orange); }
.analytics-period-field--b span { color: var(--brand-blue); }

.period-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.period-badge--a {
  border: 1px solid rgba(255, 147, 38, 0.45);
  background: rgba(255, 147, 38, 0.12);
  color: var(--brand-orange);
}

.period-badge--b {
  border: 1px solid rgba(43, 108, 176, 0.45);
  background: rgba(43, 108, 176, 0.1);
  color: var(--brand-blue);
}

.period-group--a {
  background: rgba(255, 147, 38, 0.08);
  color: var(--brand-orange);
}

.period-group--b {
  background: rgba(43, 108, 176, 0.08);
  color: var(--brand-blue);
}

.period-cell--a { background: rgba(255, 147, 38, 0.04); }
.period-cell--b { background: rgba(43, 108, 176, 0.04); }

.compare-row-period-a td:first-child strong { color: var(--brand-orange); }
.compare-row-period-b td:first-child strong { color: var(--brand-blue); }

.analytics-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.analytics-sortable:hover {
  background: rgba(43, 108, 176, 0.08);
}

.analytics-sortable.active {
  color: var(--primary);
  background: rgba(43, 108, 176, 0.12);
}

.drill-table .analytics-sortable.active {
  background: rgba(43, 108, 176, 0.1);
}

.period-text-a { color: var(--brand-orange); }
.period-text-b { color: var(--brand-blue); }

.legend-bar--period-a { background: linear-gradient(180deg, #ffb347, var(--brand-orange)); }
.legend-bar--period-b { background: linear-gradient(180deg, var(--brand-blue-light), var(--brand-blue-deep)); }
.legend-item--period-a { color: var(--brand-orange); }
.legend-item--period-b { color: var(--brand-blue); }

.svg-bar--period-a { fill: var(--brand-orange); opacity: 0.88; }
.svg-bar--period-b { fill: var(--brand-blue); opacity: 0.88; }
.svg-line--period-a { stroke: var(--brand-orange); stroke-width: 2.5; }
.svg-line--period-b { stroke: var(--brand-blue); stroke-width: 2.5; }
.svg-point--period-a { fill: #fff; stroke: var(--brand-orange); stroke-width: 2; }
.svg-point--period-b { fill: #fff; stroke: var(--brand-blue); stroke-width: 2; }
.svg-period-divider { stroke: var(--border-strong); stroke-dasharray: 4 4; opacity: 0.7; }

.analytics-period-summary span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.analytics-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.analytics-filters select {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--foreground);
  padding: 0 12px;
}

.analytics-period-summary {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-period-summary .period-badge--a,
.analytics-period-summary .period-badge--b {
  /* cores definidas em .period-badge--a / .period-badge--b */
}

.analytics-filters p {
  grid-column: 1 / -1;
  margin: 0;
}

.analytics-breakdowns {
  display: grid;
  gap: 20px;
}

.analytics-breakdown-table td:first-child {
  min-width: 260px;
}

.analytics-breakdown-table td:first-child strong,
.analytics-breakdown-table td:first-child small {
  display: block;
}

.analytics-breakdown-table td:first-child small {
  color: var(--muted);
  font-size: 11px;
}

.analytics-breakdown-body--loading {
  min-height: 120px;
}

.analytics-breakdown-body--loading::after {
  content: "Carregando linhasâ€¦";
  display: block;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
}

button, input, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error {
  color: var(--destructive);
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(242, 248, 252, 0.72);
  backdrop-filter: blur(3px);
}

.loading-box {
  width: min(360px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.loading-box strong {
  color: var(--brand-blue-deep);
  font-size: 16px;
}

.loading-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #d9edf7;
  border-top-color: var(--brand-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* —— Indicador global de atualização FTP (admin) —— */
.ftp-global-progress {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  width: min(400px, calc(100vw - 32px));
  pointer-events: auto;
}

.ftp-global-progress.hidden {
  display: none;
}

.ftp-global-progress-inner {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(33, 109, 163, 0.45);
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff 0%, #f0f8ff 100%);
  box-shadow: 0 16px 40px rgba(15, 52, 80, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  animation: ftp-global-enter 0.28s ease-out;
}

.ftp-global-progress.is-done .ftp-global-progress-inner {
  border-color: rgba(46, 172, 75, 0.45);
  background: linear-gradient(160deg, #ffffff 0%, #f2fbf5 100%);
}

.ftp-global-progress.is-error .ftp-global-progress-inner {
  border-color: rgba(214, 69, 69, 0.45);
  background: linear-gradient(160deg, #ffffff 0%, #fff5f5 100%);
}

.ftp-global-progress-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.ftp-global-progress-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(33, 109, 163, 0.12);
  position: relative;
  flex-shrink: 0;
}

.ftp-global-progress-icon::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 3px solid rgba(33, 109, 163, 0.25);
  border-top-color: #216da3;
  animation: spin 0.75s linear infinite;
}

.ftp-global-progress.is-done .ftp-global-progress-icon {
  background: rgba(46, 172, 75, 0.14);
}

.ftp-global-progress.is-done .ftp-global-progress-icon::before {
  content: "✓";
  inset: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  animation: none;
  color: #2eac4b;
  font-size: 18px;
  font-weight: 800;
  line-height: 36px;
  text-align: center;
}

.ftp-global-progress.is-error .ftp-global-progress-icon {
  background: rgba(214, 69, 69, 0.14);
}

.ftp-global-progress.is-error .ftp-global-progress-icon::before {
  content: "!";
  inset: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  animation: none;
  color: #c83434;
  font-size: 18px;
  font-weight: 800;
  line-height: 36px;
  text-align: center;
}

.ftp-global-progress-titles {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ftp-global-progress-titles strong {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.ftp-global-progress-titles span {
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.ftp-global-progress-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin-top: -2px;
}

.ftp-global-progress-close:hover {
  color: var(--foreground);
}

.ftp-global-progress-bar-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.ftp-global-progress-bar-wrap .ftp-progress-bar {
  height: 10px;
}

.ftp-global-progress-pct {
  min-width: 36px;
  text-align: right;
  color: #216da3;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ftp-global-progress.is-done .ftp-global-progress-pct,
.ftp-global-progress.is-error .ftp-global-progress-pct {
  color: var(--muted);
}

.ftp-global-progress-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  word-break: break-word;
}

.ftp-global-progress.is-complete-hide .ftp-global-progress-bar-wrap {
  opacity: 0.55;
}

@keyframes ftp-global-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .ftp-global-progress {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }
}

/* â€”â€” Buttons â€”â€” */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--brand-orange);
  color: var(--primary-foreground);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition), opacity var(--transition);
}
.btn-primary:hover { background: #e6841e; }
.btn-primary:active { opacity: 0.9; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--brand-blue-deep);
  font-weight: 500;
  font-size: 13px;
  transition: background var(--transition), border-color var(--transition);
}
.btn-ghost:hover {
  background: rgba(33, 109, 163, 0.1);
  border-color: rgba(46, 172, 75, 0.48);
}
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12px; gap: 5px; }
.btn-ghost svg, .btn-sm svg { flex-shrink: 0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(214, 69, 69, 0.34);
  border-radius: var(--radius-sm);
  background: rgba(214, 69, 69, 0.1);
  color: var(--destructive);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--transition), border-color var(--transition);
}

.btn-danger:hover {
  border-color: rgba(214, 69, 69, 0.55);
  background: rgba(214, 69, 69, 0.16);
}

/* â€”â€” Login â€” split screen â€”â€” */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--background);
}

/* Painel esquerdo â€” branding */
.login-brand-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  background:
    linear-gradient(145deg, var(--brand-blue-deep) 0%, var(--brand-dark) 55%, #0a2e4a 100%);
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(46, 172, 75, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(33, 109, 163, 0.35) 0%, transparent 50%);
  pointer-events: none;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  max-width: 400px;
}

.login-brand-logo {
  display: block;
  height: 52px;
  width: auto;
  object-fit: contain;
  margin-bottom: 36px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.login-brand-panel h1 {
  margin: 0 0 16px;
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.login-brand-panel > .login-brand-content > p {
  margin: 0 0 32px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}

.login-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.login-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.login-features li::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(46, 172, 75, 0.3);
  border: 1px solid rgba(46, 172, 75, 0.6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232eac4b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 11px;
  background-repeat: no-repeat;
  background-position: center;
}

/* Painel direito â€” formulÃ¡rio */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  background: #ffffff;
}

.login-form-inner {
  width: 100%;
  max-width: 360px;
}

.login-form-logo {
  display: block;
  height: 44px;
  width: auto;
  object-fit: contain;
  margin-bottom: 36px;
}

.login-form-inner h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.01em;
}

.login-form-subtitle {
  margin: 0 0 28px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.login-form-inner .btn-primary {
  width: 100%;
  margin-top: 8px;
  min-height: 46px;
  font-size: 15px;
}

/* Compatibilidade retroativa */
.login-panel { display: none; }
.brand-mark { display: none; }

.login-panel label,
.login-form-inner label,
.admin-form label,
.import-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.login-panel label,
.login-form-inner label { margin-bottom: 16px; }

input, select {
  height: 40px;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--input);
  color: var(--foreground);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus {
  border-color: var(--brand-blue-soft);
  box-shadow: 0 0 0 3px rgba(46, 172, 75, 0.2);
}

input::placeholder { color: var(--muted); }

.login-panel .btn-primary { width: 100%; margin-top: 4px; }

/* Inputs de login ocupam 100% da largura */
.login-form-inner input {
  width: 100%;
}

/* â€”â€” App shell â€”â€” */
.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--background);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  background: var(--brand-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--sidebar-border);
}

.nav-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--brand-blue-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu-btn:hover {
  background: rgba(33, 109, 163, 0.1);
}

.nav-menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 109, 163, 0.2);
}

.nav-menu-close {
  display: none;
  margin-left: auto;
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-menu-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-overlay {
  display: none;
  appearance: none;
  background: transparent;
}

.sidebar-logo {
  flex-shrink: 0;
  display: block;
  width: 72px;
  height: 42px;
  object-fit: contain;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 50, 74, 0.14);
}

.sidebar-brand strong {
  display: block;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.sidebar-brand strong::before { content: none; }

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  display: block;
  margin: 20px 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav-item::before { content: none; }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: none;
}

.nav-item.active .nav-icon {
  color: var(--brand-green-soft);
  opacity: 1;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* â€”â€” Workspace â€”â€” */
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #ffffff 0, var(--background) 260px),
    var(--background);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: none;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-green-deep);
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.user-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-deep));
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 2px rgba(33, 109, 163, 0.25);
}

.topbar-actions {
  margin-left: auto;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

/* Hub de abas de rankings */
.rankings-hub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.rankings-hub.hidden {
  display: none !important;
}

.rankings-hub-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-foreground);
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.rankings-hub-tab:hover {
  background: var(--secondary);
  color: var(--brand-blue-deep);
}

.rankings-hub-tab.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}

.rankings-hub-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 109, 163, 0.2);
}

/* Toasts (Sprint 2) — não sobrepor progresso FTP (bottom-right) */
.toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 52, 80, 0.14);
  animation: toast-enter 0.22s ease-out;
}

.toast-item.is-leaving {
  animation: toast-leave 0.18s ease-in forwards;
}

.toast-item--success {
  border-color: rgba(46, 172, 75, 0.35);
  background: linear-gradient(160deg, #f4fbf6 0%, #ffffff 70%);
}

.toast-item--error {
  border-color: rgba(214, 69, 69, 0.35);
  background: linear-gradient(160deg, #fff6f6 0%, #ffffff 70%);
}

.toast-item--warning {
  border-color: rgba(255, 147, 38, 0.4);
  background: linear-gradient(160deg, #fff8ed 0%, #ffffff 70%);
}

.toast-item--info {
  border-color: rgba(33, 109, 163, 0.3);
  background: linear-gradient(160deg, #f2f8fd 0%, #ffffff 70%);
}

.toast-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.toast-copy strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--foreground);
  line-height: 1.3;
}

.toast-copy span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}

.toast-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  align-self: start;
}

.toast-close:hover {
  color: var(--foreground);
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-leave {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

@media (max-width: 900px) {
  .toast-host {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
    width: auto;
  }
  /* Em mobile, toast sobe um pouco se FTP progress estiver visível */
  body:has(.ftp-global-progress:not(.hidden)) .toast-host {
    bottom: 110px;
  }
}

.user-meta { text-align: right; }

.user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}

.user-meta small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-logout:hover {
  background: rgba(214, 69, 69, 0.08);
  color: var(--destructive);
  border-color: rgba(214, 69, 69, 0.3);
}

.content {
  flex: 1;
  padding: 20px 32px 32px;
  display: grid;
  gap: 20px;
}

/* â€”â€” Cards â€”â€” */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(23, 50, 74, 0.06);
  transition: box-shadow var(--transition);
}

.panel { padding: 24px; min-width: 0; }

.filter-shell { padding: 18px 20px; }

.filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.filter-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.filter-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-cnpj-settings {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.admin-cnpj-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.admin-cnpj-label {
  color: var(--muted);
  font-weight: 600;
}

.admin-cnpj-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title.tight { margin-bottom: 12px; }

.section-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 52ch;
}

/* â€”â€” Filters â€”â€” */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.field { display: grid; gap: 6px; }

.field-advanced { display: none; }

.filters.show-advanced .field-advanced { display: grid; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #b8d7ef;
  border-radius: 6px;
  background: #f4faff;
  box-shadow: 0 2px 6px rgba(0, 64, 112, 0.1);
  color: var(--brand-blue-deep);
  font-size: 12px;
  line-height: 1.2;
}

.active-filter-chip small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.active-filter-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand-blue);
}

.active-filter-chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-blue);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.active-filter-chip button:hover {
  background: rgba(33, 109, 163, 0.12);
}

.field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.field select {
  width: 100%;
  height: 36px;
  font-size: 13px;
}

.filter-combo {
  position: relative;
}

.filter-combo-input {
  width: 100%;
  height: 36px;
  padding-right: 34px;
  font-size: 13px;
  background: #ffffff;
}

.filter-combo-clear {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.filter-combo-clear:hover {
  background: #e7f3fb;
  color: var(--brand-blue);
}

.filter-combo-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  display: none;
  max-height: 240px;
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(0, 64, 112, 0.14);
}

.filter-combo.open .filter-combo-list {
  display: grid;
  gap: 3px;
}

.filter-combo-option {
  min-height: 32px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--foreground);
  font-size: 12px;
  text-align: left;
}

.filter-combo-option[data-filter-option="lojista"] {
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
}

.filter-combo-option:hover {
  background: #e7f3fb;
  color: var(--brand-blue-deep);
}

.filter-combo-empty {
  padding: 8px 9px;
  color: var(--muted);
  font-size: 12px;
}

.filter-combo-skeleton .filter-combo-input {
  opacity: .65;
  cursor: wait;
  background: linear-gradient(90deg, var(--surface) 0%, var(--border) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: filter-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes filter-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.field-period-main select {
  border-color: rgba(46, 172, 75, 0.56);
  background: rgba(46, 172, 75, 0.14);
  color: var(--brand-green-deep);
  font-weight: 600;
}

.view-panel { display: grid; gap: 20px; }

/* â€”â€” Context ranking â€”â€” */
.context-ranking {
  display: grid;
  gap: 8px;
}

.context-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.4fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.context-row-clickable {
  transition: background var(--transition), border-color var(--transition);
}

.context-row-clickable:hover {
  background: rgba(33, 109, 163, 0.05);
  border-color: rgba(33, 109, 163, 0.3);
}

.context-rank {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.context-rank b {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(33, 109, 163, 0.1);
  color: var(--brand-blue);
  font-size: 12px;
}

.context-rank strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.context-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.context-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.context-metrics small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.context-metrics b {
  color: var(--foreground);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trend-text.positive { color: var(--success); }
.trend-text.negative { color: var(--destructive); }
.trend-text.neutral { color: var(--muted); }

.trend-neutral { color: var(--muted); font-style: italic; }

.ranking-sort-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--border);
  vertical-align: middle;
}

/* â€”â€” KPIs â€”â€” */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  display: grid;
  padding: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover {
  box-shadow: 0 2px 8px rgba(23, 50, 74, 0.1);
}

/* Barra de acento superior */
.kpi-card::before {
  content: "";
  display: block;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--kpi-accent, var(--brand-blue));
}

.kpi-card::after { content: none; }

.kpi-card--qty  { --kpi-accent: var(--brand-green); }
.kpi-card--value { --kpi-accent: var(--brand-orange); }
.kpi-card--products { --kpi-accent: var(--brand-blue); }

/* Layout interno do KPI */
.kpi-icon {
  display: none; /* removido â€” Ã­cone ocupa espaÃ§o sem agregar no design moderno */
}

.kpi-body {
  padding: 20px 22px 18px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-body > span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.kpi-body .kpi-label.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.kpi-body .kpi-label.legend-item i {
  display: inline-block;
  width: 22px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}

.kpi-body .kpi-label.legend-item em {
  font-style: normal;
  font-weight: 600;
}

.filters-loading {
  padding: 18px 4px;
  font-size: 13px;
}

.kpi-body strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* KPI principal (primeiro card) com valor mais proeminente */
.kpis .kpi-card:first-child .kpi-body strong {
  font-size: clamp(28px, 2.8vw, 40px);
}

.kpi-body small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  flex-wrap: wrap;
  min-height: 22px;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
  color: var(--muted);
  background: var(--secondary);
}

.kpi-body small.positive {
  color: var(--success);
  background: rgba(46, 172, 75, 0.1);
}

.kpi-body small.negative {
  color: var(--destructive);
  background: rgba(214, 69, 69, 0.1);
}

.kpi-body small.positive::before {
  content: "\25B2";
  font-size: 9px;
}

.kpi-body small.negative::before {
  content: "\25BC";
  font-size: 9px;
}

.kpi-compare-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.kpi-period-value {
  min-width: 0;
}

.kpi-period-value em {
  display: block;
  margin-bottom: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
}

.kpi-period-value--a em { color: var(--primary); }
.kpi-period-value--b em { color: var(--muted); }

.kpi-period-value strong {
  display: block;
  margin-top: 0;
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.kpi-period-value--b strong {
  color: #5f7d92;
}

.analytics-kpis {
  margin-bottom: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  transition: opacity 0.25s ease;
}

.analytics-kpis.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.analytics-kpis,
.analytics-kpis .kpi-card {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.analytics-kpis,
.analytics-kpis .kpi-card {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#dashboardKpis {
  margin-bottom: 20px;
}

/* â€”â€” Dashboard layout â€”â€” */
.dashboard-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.dashboard-stack > .chart-panel,
.dashboard-stack > .panel:not(.compact-panel) {
  grid-column: 1 / -1;
}

.dashboard-stack .chart-panel { min-height: auto; }
.dashboard-stack .compact-panel { min-height: 280px; }

.mini-title {
  margin: -8px 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--primary);
}

/* â€”â€” Chart â€”â€” */
.chart {
  min-height: 400px;
  position: relative;
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 14px 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fcff;
  transition: opacity 0.2s ease;
}

.chart-loading svg {
  opacity: 0.5;
}

.chart svg {
  display: block;
  min-width: 800px;
  width: 100%;
  height: 372px;
  transition: opacity 0.2s ease;
}

.chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-item em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.legend-item--qty { color: var(--brand-blue); }
.legend-item--value { color: var(--brand-orange); }
.legend-item--gross { color: #1f6b45; }
.legend-item--net { color: #3b82c4; }

.legend-line--gross {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2.5px solid #1f6b45;
  vertical-align: middle;
  margin-right: 6px;
}

.legend-line--net {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2.5px solid #3b82c4;
  vertical-align: middle;
  margin-right: 6px;
}

.chart-legend i {
  display: inline-block;
  width: 22px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-bar { background: linear-gradient(180deg, var(--brand-blue-light), var(--brand-blue-deep)); }
.legend-line {
  background: var(--brand-orange);
  height: 3px !important;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 147, 38, 0.35);
}

.chart-compare-note {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 147, 38, 0.38);
  background: rgba(255, 147, 38, 0.1);
  font-size: 12px;
  color: var(--brand-orange);
}

.chart-compare-note strong { color: var(--foreground); font-weight: 600; }

.chart-empty { padding: 24px; text-align: center; }

.svg-grid {
  stroke: #d8eaf4;
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.svg-axis-line {
  stroke-width: 1.5;
}

.svg-axis-line--qty { stroke: rgba(33, 109, 163, 0.55); }
.svg-axis-line--value { stroke: rgba(255, 147, 38, 0.55); }
.svg-axis-line--base { stroke: #b8d3e4; stroke-width: 1; }

.svg-bar { fill: url(#barGradient); }

.svg-bar--highlight { fill: url(#barGradientHighlight); }

.svg-bar-group:hover .svg-bar { opacity: 0.92; }

.svg-area { fill: url(#areaGradient); }

.svg-line {
  fill: none;
  stroke: var(--brand-orange);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-point {
  fill: var(--card);
  stroke: var(--brand-orange);
  stroke-width: 2.5;
}

.svg-hit-area { cursor: help; }

.svg-bar-group:hover + .svg-line,
.svg-line:hover { stroke-width: 3; }

.svg-line--gross { stroke: #1f6b45; stroke-width: 2.5; }
.svg-line--net { stroke: #3b82c4; stroke-width: 2.5; }
.svg-point--gross { fill: #fff; stroke: #1f6b45; stroke-width: 2; }
.svg-point--net { fill: #fff; stroke: #3b82c4; stroke-width: 2; }
.svg-trend-value { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.svg-trend-value--gross { fill: #1f6b45; }
.svg-trend-value--net { fill: #3b82c4; }
.svg-zero-line { stroke: #e05252; stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.85; }
.svg-quarter-band { fill: rgba(59, 130, 196, 0.04); }
.svg-quarter-label { font-size: 11px; font-weight: 700; fill: var(--muted-foreground); letter-spacing: 0.04em; }

.svg-label,
.svg-axis {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
}

.svg-axis--qty { fill: var(--brand-blue); }
.svg-axis--value { fill: var(--brand-orange); }

.svg-axis-zero { fill: var(--success); font-weight: 700; }

.svg-axis-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font);
}

.svg-axis-title--qty { fill: var(--brand-blue); }
.svg-axis-title--value { fill: var(--brand-orange); }

.svg-label--highlight {
  fill: var(--brand-orange-light);
  font-weight: 700;
}

.svg-period-tag {
  fill: var(--muted-foreground);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.svg-axis-zero {
  font-weight: 600;
  fill: var(--destructive);
}

.svg-bar-group {
  transition: transform 0.15s ease;
}

.svg-bar-group:hover {
  transform: scaleY(1.02);
}

.svg-bar-group:hover .svg-label {
  font-weight: 600;
  fill: var(--brand-blue-deep);
}

/* â€”â€” Rankings â€”â€” */
.ranking { display: grid; gap: 4px; }

.ranking-full {
  gap: 8px;
}

.ranking-full .rank-row {
  padding: 12px 10px;
}

.ranking-full .rank-row strong {
  font-size: 14px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 10px 14px;
  align-items: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.rank-row:hover { background: rgba(33, 109, 163, 0.16); }

.rank-row:last-of-type { border-bottom: none; }

.rank-row strong {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
}

.rank-row strong em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.rank-label {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.rank-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
}

.rank-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(88px, auto));
  gap: 6px 12px;
  justify-content: end;
  text-align: right;
}

.rank-metrics span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.rank-metrics small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rank-metric-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.rank-row--product {
  grid-template-columns: minmax(0, 1fr) minmax(210px, auto);
  align-items: start;
}

.rank-row--product .rank-track {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .rank-row,
  .rank-row--product {
    grid-template-columns: 1fr;
  }
  .rank-metrics {
    justify-content: start;
    text-align: left;
  }
}

.rank-row strong b {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 700;
}

.rank-row:nth-child(1) strong b {
  background: rgba(255, 147, 38, 0.2);
  border-color: rgba(255, 147, 38, 0.48);
  color: var(--brand-orange-light);
}

.rank-row:nth-child(2) strong b {
  background: rgba(33, 109, 163, 0.12);
  border-color: rgba(33, 109, 163, 0.28);
  color: var(--brand-blue);
}

.rank-row:nth-child(3) strong b {
  background: rgba(46, 172, 75, 0.12);
  border-color: rgba(46, 172, 75, 0.28);
  color: var(--brand-green-deep);
}

.rank-metrics {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 16px;
  justify-content: end;
  align-items: end;
}

.rank-metrics span {
  display: grid;
  gap: 1px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  white-space: nowrap;
}

.rank-metrics small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.rank-metrics .rank-metric-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-blue-deep);
  font-variant-numeric: tabular-nums;
}

.rank-track {
  grid-column: 1 / -1;
  height: 6px;
  background: #e1edf5;
  border-radius: 999px;
  overflow: hidden;
}

.rank-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-green), var(--brand-blue-light));
  transition: width 0.4s ease;
}

.rank-more {
  margin: 8px 8px 0;
  font-size: 12px;
  color: var(--muted);
}

/* â€”â€” Year compare â€” painel compacto â€”â€” */
.year-compare {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.year-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
}

.year-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.year-card-head:hover { background: var(--secondary); }

.year-card-head strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--foreground);
  min-width: 48px;
}

.year-card-head-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  flex-wrap: wrap;
}

.year-card-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.year-card-metric small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.year-card-metric strong {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

.year-card-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.year-card-months-badge {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.year-card-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  white-space: nowrap;
}

.year-card-toggle:hover {
  background: var(--secondary);
  color: var(--primary);
  border-color: var(--primary);
}

.year-card-toggle svg {
  width: 12px;
  height: 12px;
  transition: transform var(--transition);
}

.year-card.open .year-card-toggle svg {
  transform: rotate(180deg);
}

.year-card-detail {
  display: none;
  border-top: 1px solid var(--border);
}

.year-card.open .year-card-detail {
  display: block;
}

.year-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 16px;
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

.year-metrics > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  min-width: 0;
}

.year-metrics small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.year-metrics strong {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.year-metrics em {
  font-style: normal;
  min-height: 20px;
}

.yearly-wrap .data-table {
  min-width: 820px;
}

.yearly-table td {
  vertical-align: middle;
}

/* â€”â€” Date hierarchy filter â€”â€” */
.filters .date-hierarchy.field-period-main {
  grid-column: 1 / -1;
}

.date-hierarchy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.date-hierarchy-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.date-year-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.date-year-item {}

.date-year-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  background: var(--secondary);
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  transition: background var(--transition);
  text-align: left;
}

.date-year-btn:hover { background: #daeef8; }
.date-year-btn.active { background: var(--primary); color: #fff; }

.date-year-btn svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.date-year-item.open .date-year-btn svg { transform: rotate(180deg); }
.date-year-item.open .date-year-btn:not(.active) { background: #daeef8; }

.date-months-grid {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 8px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.date-year-item.open .date-months-grid { display: grid; }

.svg-area--period-a { fill: rgba(255, 147, 38, 0.16); stroke: none; }
.svg-area--period-b { fill: rgba(43, 108, 176, 0.14); stroke: none; }

/* ── Visão Analítica — barras A/B + linha de valor ── */
#analyticsChart.chart,
#analyticsChart {
  background: #ffffff !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 12px !important;
  min-height: 440px;
  overflow-x: auto;
}

.ac-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.ac-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.ac-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}

.ac-leg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #4a6578;
}

.ac-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ac-swatch-a { background: var(--brand-orange); }
.ac-swatch-b { background: var(--brand-blue); }
.ac-swatch-a-line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--brand-orange);
  box-shadow: 0 0 0 1px rgba(255, 147, 38, 0.25);
}
.ac-swatch-b-line {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--brand-blue);
  box-shadow: 0 0 0 1px rgba(33, 109, 163, 0.25);
}

.ac-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.ac-note span {
  margin: 0 6px;
  font-weight: 600;
}

.ac-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ac-kpi {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ac-kpi-a {
  background: linear-gradient(135deg, rgba(255, 147, 38, 0.1), #fff 55%);
  border-color: rgba(255, 147, 38, 0.35);
}

.ac-kpi-b {
  background: linear-gradient(135deg, rgba(33, 109, 163, 0.08), #fff 55%);
  border-color: rgba(33, 109, 163, 0.3);
}

.ac-kpi-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ac-kpi-a .ac-kpi-tag { color: var(--brand-orange); }
.ac-kpi-b .ac-kpi-tag { color: var(--brand-blue); }

.ac-kpi strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.ac-kpi em {
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: #5f7a8c;
  font-variant-numeric: tabular-nums;
}

.ac-svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 300px;
}

.ac-grid {
  stroke: #e6eef4;
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

.ac-base {
  stroke: #b7c9d8;
  stroke-width: 1.25;
}

.ac-axis {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ac-axis-qty { fill: var(--brand-blue-deep); }
.ac-axis-val { fill: var(--brand-orange); }

.ac-bar-a { fill: var(--brand-orange); opacity: 0.92; }
.ac-bar-b { fill: var(--brand-blue); opacity: 0.92; }
.ac-bar-g:hover .ac-bar { opacity: 1; filter: brightness(1.05); }

.ac-bar-lbl {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ac-bar-lbl-a { fill: var(--brand-orange); }
.ac-bar-lbl-b { fill: var(--brand-blue); }

.ac-line {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 5 4;
}
.ac-line-a { stroke: var(--brand-orange); }
.ac-line-b { stroke: var(--brand-blue); }

.ac-dot {
  stroke: #fff;
  stroke-width: 2;
}
.ac-dot-a { fill: var(--brand-orange); }
.ac-dot-b { fill: var(--brand-blue); }

.ac-val-lbl {
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ac-val-lbl-a { fill: var(--brand-orange); }
.ac-val-lbl-b { fill: var(--brand-blue); }

.ac-xlabel {
  font-size: 11px;
  font-weight: 600;
  fill: #2a4558;
}
.ac-xlabel-a { fill: var(--brand-orange); font-size: 10.5px; }
.ac-xlabel-b { fill: var(--brand-blue); font-size: 10.5px; }

.ac-hints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  padding: 0 2px;
}

@media (max-width: 720px) {
  .ac-kpis { grid-template-columns: 1fr; }
  .ac-top { flex-direction: column; align-items: flex-start; }
}

.analytics-compare-inline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(43, 108, 176, 0.04), rgba(255, 255, 255, 0.9));
}

.analytics-compare-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.analytics-compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.analytics-pick-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.analytics-pick-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 11px;
  font-weight: 700;
}

.analytics-period-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.analytics-period-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.analytics-period-card--a { border-color: rgba(255, 147, 38, 0.35); }
.analytics-period-card--b { border-color: rgba(43, 108, 176, 0.35); }

.analytics-period-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.analytics-period-card-head .btn-link {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.analytics-period-card-head .btn-link:hover { text-decoration: underline; }

.analytics-period-card .period-badge {
  width: 100%;
  justify-content: flex-start;
  min-height: auto;
  padding: 8px 10px;
  line-height: 1.35;
  white-space: normal;
}

@media (max-width: 720px) {
  .analytics-period-summary { grid-template-columns: 1fr; }
  .analytics-compare-toolbar { align-items: stretch; }
  .analytics-pick-targets { width: 100%; }
  .analytics-pick-btn { flex: 1; justify-content: center; }
}

.analytics-compare-picker .analytics-compare-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.analytics-pick-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.analytics-pick-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.analytics-pick-btn--a.active {
  border-color: rgba(255, 147, 38, 0.55);
  background: rgba(255, 147, 38, 0.14);
  color: var(--brand-orange);
}

.analytics-pick-btn--b.active {
  border-color: rgba(43, 108, 176, 0.55);
  background: rgba(43, 108, 176, 0.12);
  color: var(--brand-blue);
}

.analytics-compare-picker .analytics-period-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.analytics-clear-periods {
  margin-top: 12px;
}

.date-month-btn--period-a {
  border-color: rgba(255, 147, 38, 0.55);
  background: rgba(255, 147, 38, 0.14);
  color: var(--brand-orange);
}

.date-month-btn--period-b {
  border-color: rgba(43, 108, 176, 0.55);
  background: rgba(43, 108, 176, 0.12);
  color: var(--brand-blue);
}

.date-month-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.date-month-tag--a { background: var(--brand-orange); }
.date-month-tag--b { background: var(--brand-blue); }

.svg-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.svg-group-label--a { fill: var(--brand-orange); }
.svg-group-label--b { fill: var(--brand-blue); }

.chart-loading,
.analytics-breakdowns.is-loading {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.panel-loading {
  position: relative;
}

.panel-loading::after {
  content: "Atualizando...";
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.date-month-btn {
  padding: 5px 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--foreground);
  text-align: center;
  transition: all var(--transition);
  white-space: nowrap;
}

.date-month-btn:hover { background: var(--secondary); border-color: var(--primary); color: var(--primary); }
.date-month-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.date-period-range {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.filters.show-advanced .date-period-range {
  display: grid;
}

/* â€”â€” Modal drill-down â€”â€” */
.drill-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.drill-modal.hidden { display: none; }

.drill-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 37, 55, 0.45);
  backdrop-filter: blur(2px);
}

.drill-modal-panel {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 740px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drill-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
  flex-shrink: 0;
}

.drill-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drill-modal-header strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
}

.drill-modal-header small {
  font-size: 12px;
}

.drill-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.drill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.drill-table th {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.drill-table th.num { text-align: right; }

.drill-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.drill-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.drill-table tr:last-child td { border-bottom: none; }

.drill-table tr:hover td { background: var(--secondary); }

.drill-owner-name {
  text-transform: uppercase;
}

.drill-rank-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 6px;
  flex-shrink: 0;
}

.drill-share-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drill-share-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 50px;
}

.drill-share-fill {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.drill-loading {
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

/* Tabelas analÃ­ticas â€” linha clicÃ¡vel */
.drill-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.drill-link:hover {
  color: var(--brand-blue-deep);
  text-decoration: underline;
}

.rank-row-clickable:hover {
  cursor: pointer;
  background: rgba(33, 109, 163, 0.08);
}

.rank-drill-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.rank-drill-link:hover {
  color: var(--brand-blue-deep);
  text-decoration: underline;
}

.drill-owner-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.drill-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drill-kpi small {
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.drill-kpi strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.drill-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 700px) {
  .drill-two-cols { grid-template-columns: 1fr; }
  .drill-owner-kpis { grid-template-columns: 1fr 1fr; }
}

.drill-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin: 0 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.drill-section-block {
  margin-bottom: 20px;
}

.drill-section-block:last-child {
  margin-bottom: 0;
}

.drill-modal-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drill-modal-panel--expanded {
  max-width: min(96vw, 1180px);
  max-height: 92vh;
}

.drill-modal-panel--compact {
  max-width: min(92vw, 520px);
  max-height: 68vh;
}

#drillModalBack:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.owner-stores-list {
  overflow-x: auto;
}

.owner-stores-table .drill-link {
  font-weight: 600;
}

@media (max-width: 860px) {
  .drill-modal-header {
    flex-wrap: wrap;
  }

  .drill-modal-window-actions {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
  }
}

.trend-pill {
  display: inline-grid;
  gap: 1px;
  min-width: 104px;
  font-variant-numeric: tabular-nums;
}

.trend-pill b {
  font-size: 12px;
  font-weight: 700;
}

.trend-pill small {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.trend-pill.positive b { color: var(--success); }
.trend-pill.negative b { color: var(--destructive); }
.trend-pill.neutral b,
.trend-pill.neutral { color: var(--muted); }

/* â€”â€” Tables â€”â€” */
.search-input {
  width: min(320px, 100%);
  height: 38px;
}

.search-hint {
  margin: -8px 0 14px;
}

.compact-list {
  max-width: 360px;
}

.compact-list-open {
  max-width: 420px;
}

.compact-list summary {
  cursor: pointer;
  color: var(--brand-blue);
  font-weight: 600;
}

.compact-list ul {
  margin-top: 6px;
  margin-bottom: 0;
  padding-left: 16px;
  max-width: 46ch;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.compact-list li + li {
  margin-top: 3px;
}

.ranking-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ranking-sort .btn-ghost.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #ffffff;
}

.product-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -6px 0 14px;
}

.product-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.product-group-btn {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--brand-blue-deep);
  font-weight: 600;
  font-size: 12px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.product-group-btn:hover {
  border-color: rgba(33, 109, 163, 0.44);
  background: #f0f8fd;
}

.product-group-btn.active {
  border-color: rgba(46, 172, 75, 0.5);
  background: rgba(46, 172, 75, 0.12);
  color: var(--brand-green-deep);
}

.table-wrap {
  position: relative;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

/* Fade à direita quando há colunas ocultas (scroll horizontal) */
.table-wrap.has-overflow::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.97) 15%, transparent);
  opacity: 1;
  transition: opacity 0.2s ease;
}

.table-wrap.has-overflow.scrolled-end::before {
  opacity: 0;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.monthly-wrap .data-table { min-width: 780px; }

.monthly-table-total td {
  border-top: 2px solid var(--border);
  background: rgba(37, 99, 235, 0.06);
  font-weight: 600;
  padding-top: 12px;
  padding-bottom: 12px;
}

.data-table th,
.data-table td,
table th,
table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
}

.data-table th,
table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f9fc;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.data-table td,
table td {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:hover td,
table tbody tr:hover td {
  background: rgba(33, 109, 163, 0.06);
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(242, 248, 252, 0.5);
}

.data-table tbody tr:nth-child(even):hover td,
table tbody tr:nth-child(even):hover td {
  background: rgba(33, 109, 163, 0.06);
}

.data-table tbody tr:last-child td,
table tbody tr:last-child td {
  border-bottom: none;
}

.num { text-align: right; }

/* ==========================================================================
   OVERRIDES FINAIS â€” Alta Especificidade (vence regras originais)
   ========================================================================== */

/* Cards & Panels â€” sem bordas, sombras suaves */
.table-wrap .card,
.table-wrap .panel,
.card:not(.multi-block-card):not(.kpi-card),
.panel:not(.multi-block-panel) {
  border: none !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  background: var(--card, #ffffff) !important;
  padding: var(--padding-card) !important;
  transition: box-shadow 0.2s ease-in-out !important;
}

.table-wrap .card:hover,
.table-wrap .panel:hover,
.card:hover:not(.multi-block-card):not(.kpi-card),
.panel:hover:not(.multi-block-panel) {
  box-shadow: var(--shadow-lg) !important;
}

/* Section titles */
.section-title h2 {
  font-size: var(--text-lg) !important;
  font-weight: var(--weight-semibold) !important;
  line-height: var(--leading-tight) !important;
  letter-spacing: -0.01em !important;
}

.section-title h3 {
  font-size: var(--text-base) !important;
  font-weight: var(--weight-medium) !important;
  color: var(--muted-foreground, #64748b) !important;
}

/* KPI Hero */
.kpi-card .kpi-body strong {
  font-size: var(--text-2xl) !important;
  font-weight: var(--weight-bold) !important;
  line-height: var(--leading-tight) !important;
  letter-spacing: -0.02em !important;
  display: block !important;
  margin-top: var(--space-2) !important;
}

/* Filter labels â€” sem uppercase */
.filters .field label {
  font-size: var(--text-xs) !important;
  font-weight: var(--weight-medium) !important;
  text-transform: none !important;
  color: var(--muted-foreground, #64748b) !important;
  letter-spacing: normal !important;
}

/* Rank rows */
.rank-row {
  padding: var(--space-3) var(--space-4) !important;
  border-bottom: 1px solid var(--border-light) !important;
}

/* Drill modal body */
.drill-modal-body {
  padding: var(--space-5) var(--space-6) !important;
}

/* Sidebar nav items */
.sidebar-nav .nav-item {
  padding: 10px var(--space-4) !important;
  border-radius: var(--radius-sm) !important;
  margin-bottom: var(--space-1) !important;
}

/* ==========================================================================
   DATA TABLE MODERNIZAÃ‡ÃƒO â€” Especificidade mÃ¡xima
   ========================================================================== */
.table-wrap table.data-table,
div.table-wrap table.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
}

.table-wrap table.data-table thead th,
div.table-wrap table.data-table thead th {
  padding: var(--padding-table-cell) !important;
  font-size: var(--text-xs) !important;
  font-weight: var(--weight-semibold) !important;
  color: var(--muted-foreground, #64748b) !important;
  background: transparent !important;
  border-bottom: 2px solid var(--border-strong) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1 !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
}

.table-wrap table.data-table tbody td,
div.table-wrap table.data-table tbody td {
  padding: var(--padding-table-cell) !important;
  font-size: var(--text-sm) !important;
  border-bottom: 1px solid var(--border-light) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  background: transparent !important;
  color: var(--foreground) !important;
  font-variant-numeric: tabular-nums !important;
}

.table-wrap table.data-table tbody tr:hover td,
div.table-wrap table.data-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.02) !important;
}

/* Remover zebra striping original */
.table-wrap table.data-table tbody tr:nth-child(even) td,
div.table-wrap table.data-table tbody tr:nth-child(even) td {
  background: transparent !important;
}

.table-wrap table.data-table tbody tr:nth-child(even):hover td,
div.table-wrap table.data-table tbody tr:nth-child(even):hover td {
  background: rgba(0, 0, 0, 0.02) !important;
}

/* Linha total mensal */
.monthly-table-total td {
  border-top: 2px solid var(--border-strong) !important;
  background: var(--surface-hover) !important;
  font-weight: var(--weight-semibold) !important;
  padding-top: var(--space-3) !important;
  padding-bottom: var(--space-3) !important;
}

.table-metric {
  display: grid;
  gap: 2px;
}

.table-metric strong {
  font-weight: 700;
}

.table-metric small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.trend {
  display: inline-grid;
  gap: 2px;
  min-width: 150px;
  font-variant-numeric: tabular-nums;
}

.trend strong {
  font-size: 12px;
  font-weight: 700;
}

.trend small {
  font-size: 11px;
  color: var(--muted);
}

.trend.positive strong { color: var(--success); }
.trend.negative strong { color: var(--destructive); }
.trend.neutral strong,
.trend.neutral { color: var(--muted); }

.comparison-table .positive,
.data-table .positive { color: var(--success); font-weight: 600; }
.comparison-table .negative,
.data-table .negative { color: var(--destructive); font-weight: 600; }

.data-table .compare-row td {
  background: rgba(255, 147, 38, 0.09);
  border-bottom-color: rgba(255, 147, 38, 0.22);
}

.data-table .compare-row td:first-child {
  font-weight: 600;
  color: var(--brand-orange);
}

.data-table .compare-summary td {
  background: rgba(46, 172, 75, 0.12);
  border-top: 2px solid rgba(46, 172, 75, 0.42);
  font-weight: 600;
  font-size: 12px;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pager-info {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* â€”â€” Modos de importaÃ§Ã£o (FTP / Local) â€”â€” */
.import-mode-block {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fbfd;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(33, 109, 163, 0.05);
}

.import-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.import-mode-label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--text);
}

.import-mode-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
  color: var(--text-muted);
  font-size: .8rem;
}

.import-mode-divider::before,
.import-mode-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* â€”â€” FTP mode controls (migrado de inline style) â€”â€” */
.import-mode-block.ftp-updating {
  border-color: rgba(33, 109, 163, 0.55);
  background: #f1f8fd;
  box-shadow: 0 0 0 3px rgba(33, 109, 163, 0.08), 0 12px 28px rgba(33, 109, 163, 0.10);
}

.import-mode-block.ftp-updating .import-mode-label::after {
  content: "Atualização em andamento";
  display: inline-flex;
  margin-left: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(33, 109, 163, 0.12);
  color: #216da3;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  vertical-align: middle;
}
.ftp-active-banner {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(33, 109, 163, 0.42);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #eef8ff 0%, #ffffff 100%);
  box-shadow: 0 12px 28px rgba(33, 109, 163, 0.12);
}

.ftp-active-pulse {
  width: 56px;
  height: 50px;
  border-radius: 12px;
  background: rgba(33, 109, 163, 0.12);
  position: relative;
}

.ftp-active-pulse::before,
.ftp-active-pulse::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #216da3;
}

.ftp-active-pulse::after {
  inset: 10px;
  background: transparent;
  border: 2px solid #216da3;
  animation: ftp-active-pulse 1.15s ease-out infinite;
}

.ftp-active-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ftp-active-copy strong {
  color: var(--foreground);
  font-size: 17px;
  font-weight: 800;
}

.ftp-active-copy span {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.ftp-active-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@keyframes ftp-active-pulse {
  0% { opacity: .65; transform: scale(.8); }
  100% { opacity: 0; transform: scale(1.75); }
}
.ftp-mode-controls {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* â€”â€” Affordance: hint de clique em linhas de ranking â€”â€” */
.rank-hint {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 1px;
  letter-spacing: 0;
}

.rank-drill-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rank-drill-link::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23216da3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
}

/* â€”â€” Badge de contagem de filtros ocultos â€”â€” */
.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 4px;
}

/* Spinner pequeno para uso inline em textos de feedback */
.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* FTP status colors */
.ftp-status-ok     { color: #065f46; font-weight: 600; }
.ftp-status-new    { color: #1d4ed8; font-weight: 600; }
.ftp-status-error  { color: #b91c1c; font-weight: 600; }
.ftp-status-warning { color: #a95d10; font-weight: 700; }

.ftp-notice {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.ftp-notice-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e7f2fb;
  position: relative;
}

.ftp-notice-icon::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 3px solid #216da3;
}

.ftp-notice-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ftp-notice-body strong {
  color: var(--foreground);
  font-size: 14px;
}

.ftp-notice-body span,
.ftp-notice-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ftp-notice--success {
  border-color: rgba(46, 172, 75, 0.35);
  background: #f4fbf6;
}

.ftp-notice--success .ftp-notice-icon {
  background: rgba(46, 172, 75, 0.14);
}

.ftp-notice--success .ftp-notice-icon::after {
  border-color: #2eac4b;
}

.ftp-notice--warning {
  border-color: rgba(255, 147, 38, 0.42);
  background: #fff8ed;
}

.ftp-notice--warning .ftp-notice-icon {
  background: rgba(255, 147, 38, 0.16);
}

.ftp-notice--warning .ftp-notice-icon::after {
  border-color: #ff8a00;
}

.ftp-notice--error {
  border-color: rgba(214, 69, 69, 0.35);
  background: #fff5f5;
}

.ftp-notice--error .ftp-notice-icon {
  background: rgba(214, 69, 69, 0.13);
}

.ftp-notice--error .ftp-notice-icon::after {
  border-color: #c83434;
}

.ftp-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0;
  padding: 0;
  list-style: none;
}

.ftp-steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.ftp-steps li span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: #ffffff;
  flex: none;
}

.ftp-steps li.done,
.ftp-steps li.active {
  color: var(--foreground);
}

.ftp-steps li.done span {
  border-color: #2eac4b;
  background: #2eac4b;
}

.ftp-steps li.active span {
  border-color: #216da3;
  box-shadow: 0 0 0 4px rgba(33, 109, 163, 0.12);
}

.ftp-file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.ftp-sync-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 10px;
}

.ftp-sync-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.ftp-progress-bar {
  width: 100%;
  max-width: none;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.ftp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  border-radius: 999px;
  transition: width .25s ease;
}

.ftp-progress-indeterminate .ftp-progress-fill {
  width: 35% !important;
  animation: ftp-progress-slide 1.2s ease-in-out infinite;
}

@keyframes ftp-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.ftp-sync-report {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.ftp-sync-report-title {
  margin: 0 0 .5rem;
  font-size: .95rem;
}

.ftp-sync-report-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.ftp-sync-report-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.ftp-sync-report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.ftp-sync-report-details {
  margin: .35rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: .85rem;
}

.ftp-sync-report-details li + li {
  margin-top: .15rem;
}

/* â€”â€” RÃ³tulo de sub-seÃ§Ã£o dentro de card (Base de dados) â€”â€” */
.data-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.data-section-label::before {
  content: "";
  flex: none;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand-blue);
}

/* â€”â€” Import â€”â€” */
.import-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.import-form input,
.import-form select { min-height: 40px; }

.import-form p { grid-column: 1 / -1; margin: 0; }

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 16px;
}

.imports-list { display: grid; gap: 10px; }

.import-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.import-row strong { color: var(--foreground); font-weight: 600; }

.import-row small,
.import-row p {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--secondary);
  color: var(--muted-foreground);
}

.status.success {
  color: var(--brand-green-deep);
  background: rgba(46, 172, 75, 0.18);
}

.status.failed {
  color: #b83030;
  background: rgba(214, 69, 69, 0.12);
}

.status.running {
  color: #a95d10;
  background: rgba(255, 147, 38, 0.14);
}

/* â€”â€” Admin â€”â€” */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
  gap: 20px;
  align-items: start;
}

.admin-layout > .panel,
#dataView > .panel {
  border-color: #cfe1ee;
  box-shadow: 0 10px 28px rgba(33, 109, 163, 0.07);
}

.admin-layout .panel-header,
#dataView .panel-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.users-list { display: grid; gap: 8px; }

.user-card {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  transition: border-color var(--transition), background var(--transition);
}

.user-card:hover {
  border-color: rgba(46, 172, 75, 0.45);
  background: rgba(33, 109, 163, 0.18);
}

.user-card strong { font-weight: 600; }

.user-card span,
.user-card small,
.user-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-actions,
.admin-form .form-feedback { grid-column: 1 / -1; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.optional-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.form-feedback {
  margin: 0;
  min-height: 18px;
}

.primary-action { width: auto; min-width: 160px; }

.postgres-config-panel {
  display: grid;
  gap: 16px;
}

.postgres-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f7fbfe;
}

.postgres-config-head strong,
.postgres-config-head small {
  display: block;
}

.postgres-config-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.postgres-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.postgres-config-grid h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--foreground);
}

.table-scroll {
  overflow-x: auto;
}

.compact-table {
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
  vertical-align: top;
}

.postgres-config-copy {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.postgres-config-copy textarea {
  min-height: 210px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0f2638;
  color: #f5fbff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  text-transform: none;
}

.postgres-config-notes {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ftp-schedule-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #cfe1ee;
  border-radius: var(--radius-sm);
  background: #f5fafe;
}

.ftp-schedule-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.ftp-schedule-head strong,
.ftp-schedule-head small {
  display: block;
}

.ftp-schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ftp-schedule-grid label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

/* â€”â€” Polish: Product toolbar, filters, search â€”â€” */
.product-tools {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

@media (max-width: 900px) {
  .product-tools {
    gap: 8px;
    padding: 10px 0 12px;
  }
}

.product-tools > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px;
  margin-left: 4px;
}

.product-tools > span:first-child { margin-left: 0; }

.product-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.product-group-btn:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: rgba(33, 109, 163, 0.06);
}

.product-group-btn.active {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
  color: #ffffff;
  font-weight: 600;
}

/* Melhorias no filtro */
.filter-shell {
  padding: 16px 20px;
}

.filter-shell-highlight {
  box-shadow: 0 0 0 3px rgba(33, 109, 163, 0.2), var(--shadow-sm);
  border-color: rgba(33, 109, 163, 0.45);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.filter-head h2 {
  font-size: 13px;
}

/* Search input */
.search-input {
  height: 36px;
  min-width: 220px;
  max-width: 320px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--secondary);
  font-size: 13px;
  transition: all var(--transition);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--brand-blue-soft);
  box-shadow: 0 0 0 3px rgba(33, 109, 163, 0.12);
  outline: none;
}

/* Pager moderno */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.pager-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  padding: 0 8px;
}

/* Sidebar footer com versÃ£o */
.sidebar::after {
  content: "Atual BI";
  display: block;
  margin-top: auto;
  padding: 16px 10px 4px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
}

/* BotÃ£o primÃ¡rio mais refinado */
.btn-primary {
  letter-spacing: 0.01em;
}

/* Section heading sem sublinhado */
.section-title h2 {
  color: var(--foreground);
}

/* â€”â€” Blocos empilhados: comparativo multi-fornecedor/fabricante â€”â€” */
.multi-block-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.multi-block-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.multi-block-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
}

.multi-block-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0 0 4px;
}

.multi-block-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.multi-block-rows {
  padding: 4px 0;
}

.multi-block-rows .context-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.multi-block-rows .context-row:last-child {
  border-bottom: none;
}

.no-data-msg {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* —— Estados UI padronizados (Sprint 1) —— */
.ui-state {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  text-align: left;
}

.ui-state--compact {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
}

.ui-state-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
  background: var(--status-info-bg, rgba(33, 109, 163, 0.1));
}

.ui-state--compact .ui-state-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.ui-state-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2.5px solid var(--status-info, #216da3);
  opacity: 0.85;
}

.ui-state--compact .ui-state-icon::after {
  inset: 7px;
}

.ui-state-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ui-state-body strong {
  color: var(--foreground);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.ui-state-body span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ui-state-actions {
  grid-column: 2;
  margin-top: 4px;
}

.ui-state--compact .ui-state-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.ui-state--empty {
  border-color: rgba(33, 109, 163, 0.18);
  background: linear-gradient(160deg, #f8fbfd 0%, #ffffff 100%);
}

.ui-state--empty .ui-state-icon {
  background: rgba(33, 109, 163, 0.08);
}

.ui-state--empty .ui-state-icon::after {
  border-color: var(--brand-blue);
  border-style: dashed;
}

.ui-state--error {
  border-color: rgba(214, 69, 69, 0.28);
  background: linear-gradient(160deg, #fff8f8 0%, #ffffff 100%);
}

.ui-state--error .ui-state-icon {
  background: var(--status-error-bg, rgba(214, 69, 69, 0.1));
}

.ui-state--error .ui-state-icon::after {
  content: "!";
  inset: 0;
  border: none;
  border-radius: 0;
  color: var(--status-error, #d64545);
  font-size: 16px;
  font-weight: 800;
  line-height: 36px;
  text-align: center;
}

.ui-state--compact.ui-state--error .ui-state-icon::after {
  line-height: 28px;
  font-size: 14px;
}

.ui-state--loading {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-template-columns: none;
  border-color: rgba(33, 109, 163, 0.2);
  background: #f7fbfe;
  color: var(--muted-foreground);
  font-size: 13px;
}

.ui-state--loading .ui-state-icon {
  display: none;
}

.drill-loading.ui-state--loading {
  flex-direction: column;
  justify-content: center;
  min-height: 140px;
  text-align: center;
  gap: 12px;
}

.drill-loading.ui-state--loading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ftp-feedback-line {
  margin: 0.25rem 0 0.5rem;
}

/* Segmented control (ordenação / modos) */
.seg-control,
.ranking-sort.seg-control {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--secondary);
  overflow: hidden;
}

.seg-control .btn-ghost,
.ranking-sort.seg-control .btn-ghost {
  border: none;
  border-radius: 999px;
  background: transparent;
  min-height: 30px;
  box-shadow: none;
}

.seg-control .btn-ghost:hover,
.ranking-sort.seg-control .btn-ghost:hover {
  background: rgba(33, 109, 163, 0.08);
  border-color: transparent;
}

.seg-control .btn-ghost.active,
.ranking-sort.seg-control .btn-ghost.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
}

.seg-control .btn-ghost.active:hover,
.ranking-sort.seg-control .btn-ghost.active:hover {
  background: var(--brand-blue-deep);
  color: #ffffff;
}

.cmp-rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--secondary);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-right: 6px;
  flex-shrink: 0;
}

/* â€”â€” Dica inline de drill-down nos subtÃ­tulos de ranking â€”â€” */
.drill-tip-inline {
  font-style: italic;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 500;
}

/* â€”â€” BotÃ£o fechar com Ã­cone â€”â€” */
.btn-icon-close {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* â€”â€” Responsive â€”â€” */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-stack { grid-template-columns: 1fr; }
  .year-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-filters { grid-template-columns: repeat(2, minmax(160px, 1fr)) auto; }
}

@media (max-width: 1024px) {
  /* Login: empilha em telas menores */
  .login-view {
    grid-template-columns: 1fr;
  }
  .login-brand-panel {
    display: none; /* oculta painel de branding em tablets/mobile */
  }
  .login-form-panel {
    min-height: 100vh;
  }
}

@media (max-width: 900px) {
  .app-view {
    grid-template-columns: 1fr !important;
  }

  .nav-menu-btn {
    display: inline-flex !important;
    position: relative;
    z-index: 20;
  }

  /* Fechar só quando o drawer está aberto */
  .nav-menu-close {
    display: none;
    align-items: center;
    justify-content: center;
  }
  .sidebar.is-open .nav-menu-close,
  body.nav-open .sidebar .nav-menu-close {
    display: inline-flex !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1300;
    width: min(288px, 88vw);
    max-width: 88vw;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    transform: translate3d(-100%, 0, 0);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s ease, visibility 0.22s ease;
    box-shadow: 8px 0 28px rgba(15, 30, 45, 0.28);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Aberto: classe no aside OU body (compat) */
  .sidebar.is-open,
  body.nav-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .sidebar-overlay {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1250;
    width: 100%;
    height: 100%;
    background: rgba(15, 30, 45, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  body.nav-open .sidebar-overlay,
  .sidebar-overlay.is-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-height: 0;
  }

  .sidebar-nav .nav-item {
    pointer-events: auto;
    cursor: pointer;
  }

  .nav-label { display: block; }

  .sidebar-brand {
    flex-wrap: nowrap;
    align-items: center;
  }

  .sidebar-brand-text {
    min-width: 0;
    flex: 1;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 14px 16px;
  }

  .topbar-titles {
    flex: 1;
    min-width: 0;
  }

  .topbar-actions {
    margin-left: auto;
    justify-content: flex-start;
  }

  .user-box {
    border-left: none;
    padding-left: 0;
  }

  .content { padding: 16px 20px 24px; }
  .admin-layout,
  .import-form { grid-template-columns: 1fr; }
  .postgres-config-grid { grid-template-columns: 1fr; }
  .ftp-schedule-grid { grid-template-columns: 1fr; }
  .analytics-filters { grid-template-columns: 1fr; }
  .filter-head { flex-direction: column; }
  .context-row { grid-template-columns: 1fr; }
  .context-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 1fr; }
  .rank-metrics {
    justify-content: start;
    grid-template-columns: repeat(2, minmax(0, max-content));
  }
  .rank-metrics span { text-align: left; }
  .admin-form { grid-template-columns: 1fr; }
  .year-metrics { grid-template-columns: 1fr; }
  .year-card-head { flex-direction: column; align-items: flex-start; }
  .section-title { flex-direction: column; }
  .context-metrics { grid-template-columns: 1fr; }
  .primary-action { width: 100%; }
  .nav-menu-btn span { display: none; }
  .nav-menu-btn { min-width: 40px; padding: 0 10px; justify-content: center; }
}

/* ==========================================================================
   SKELETON LOADING â€” Shimmer Components
   ========================================================================== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-light) 0%,
    var(--border-strong) 50%,
    var(--border-light) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.view-panel.loading-state {
  position: relative;
}

.view-panel.loading-state::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.24) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  opacity: 0.45;
}

.skeleton-text {
  height: 1em;
  width: 100%;
  border-radius: 4px;
}
.skeleton-text.short { width: 60%; }
.skeleton-text.long { width: 90%; }

.skeleton-title {
  height: 1.5rem;
  width: 40%;
  border-radius: 4px;
  margin-bottom: var(--space-2);
}

.skeleton-kpi {
  min-height: 120px;
  border-radius: var(--radius);
  width: 100%;
}

.skeleton-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}
.skeleton-table-row > div { height: 16px; border-radius: 4px; }

.skeleton-chart {
  min-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   BADGES DE STATUS â€” Tokens SemÃ¢nticos
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(46, 172, 75, 0.3);
}

.badge--warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(255, 147, 38, 0.3);
}

.badge--error {
  background: var(--status-error-bg);
  color: var(--status-error);
  border: 1px solid rgba(214, 69, 69, 0.3);
}

.badge--info {
  background: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid rgba(33, 109, 163, 0.3);
}

.badge--neutral {
  background: rgba(107, 135, 152, 0.1);
  color: var(--muted);
}

/* ── Produtos unificados + dashboard polish (2026-07) ─────────────────── */
#dashboardKpis {
  margin-bottom: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#dashboardKpis .kpi-card {
  min-height: 118px;
}

#dashboardKpis .kpi-body strong {
  font-size: clamp(26px, 2.6vw, 36px);
}

.dashboard-stack > .chart-panel {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.dashboard-stack .chart {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9fd 100%);
  border-color: #d7e7f2;
  min-height: 380px;
}

.dashboard-stack .section-title h2 {
  font-size: 1.05rem;
}

.dashboard-stack .section-title p {
  max-width: 62ch;
  line-height: 1.45;
}

.monthly-wrap {
  margin-top: 4px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.year-compare {
  gap: 8px;
}

.year-card {
  border-color: #d7e7f2;
  box-shadow: 0 1px 2px rgba(23, 50, 74, 0.04);
}

.year-card-head {
  padding: 12px 16px;
}

.year-card-metric strong {
  font-size: 15px;
}

.products-data-table .product-name-cell {
  min-width: 220px;
  max-width: 360px;
}

.product-name-link {
  font-weight: 600;
  color: var(--brand-blue-deep);
  text-decoration: none;
}

.product-name-link:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.product-row--multi {
  background: linear-gradient(90deg, rgba(46, 172, 75, 0.03), transparent 42%);
}

.product-single-value {
  display: inline-block;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* —— Confirm modal (Sprint 3) —— */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 20px;
}

.confirm-modal.hidden { display: none !important; }

.confirm-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 30, 45, 0.48);
}

.confirm-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 30, 45, 0.2);
}

.confirm-modal-panel strong {
  font-size: 16px;
  font-weight: 800;
  color: var(--foreground);
}

.confirm-modal-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* Prefer reduced motion — preserva spinners essenciais, reduz decorativos */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .loading-spinner,
  .spinner-inline,
  .ftp-global-progress-icon::before {
    animation-duration: 0.8s !important;
    animation-iteration-count: infinite !important;
  }

  .ftp-active-pulse::after,
  .skeleton,
  .filter-combo-skeleton .filter-combo-input,
  .ftp-progress-indeterminate .ftp-progress-fill {
    animation: none !important;
  }
}

/* Expandir / retrair EAN, lab e distribuidora */
.product-expand {
  min-width: 120px;
  max-width: 260px;
}

.product-expand-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.product-expand-primary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.product-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
  min-width: 36px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(33, 109, 163, 0.28);
  border-radius: 999px;
  background: rgba(33, 109, 163, 0.08);
  color: var(--brand-blue-deep);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.product-expand-btn:hover {
  background: rgba(33, 109, 163, 0.16);
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.product-expand.is-open .product-expand-btn {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}

.product-expand-icon {
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}

.product-expand-count {
  font-variant-numeric: tabular-nums;
}

.product-expand-list {
  margin: 6px 0 0;
  padding: 6px 8px 6px 16px;
  list-style: disc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fcff;
  max-height: 160px;
  overflow: auto;
}

.product-expand-list li {
  font-size: 11.5px;
  color: var(--muted-foreground);
  line-height: 1.4;
  word-break: break-word;
}

.product-expand-list li + li {
  margin-top: 3px;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.drill-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fcff;
}

.drill-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 14px;
}

.drill-kpi-row .drill-kpi small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.drill-kpi-row .drill-kpi strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  #dashboardKpis {
    grid-template-columns: 1fr;
  }

  .products-data-table .product-name-cell {
    min-width: 160px;
    max-width: none;
  }
}

@media print {
  body { font-family: Roboto, Inter, Arial, sans-serif; font-size: 10pt; }
  .export-document { padding: 12mm; }
  table { font-size: 9pt; page-break-inside: avoid; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  .kpi-card, .rank-row { break-inside: avoid; }
  .sidebar, .topbar, .loading-overlay, .ftp-global-progress { display: none !important; }
}




/* --- Acordos --- */
.agreements-panel {
  overflow: visible;
}

.agreement-month-control {
  display: grid;
  grid-template-columns: auto minmax(132px, 170px);
  align-items: center;
  gap: 10px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
}

.agreement-month-control select {
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 34px 7px 10px;
  background: #ffffff;
  color: var(--foreground);
  font-weight: 700;
}

.agreement-reference-field {
  grid-column: 1 / -1;
  max-width: 220px;
}

.agreement-reference-field input:disabled {
  background: #eef4f8;
  color: var(--muted-foreground);
  cursor: not-allowed;
}
.agreements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.agreement-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #d9e6f0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(33, 109, 163, 0.08);
}

.agreement-card-head {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.agreement-logo {
  width: 56px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #edf5fc;
  color: var(--brand-blue);
  font-weight: 800;
  overflow: hidden;
}

.agreement-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.agreement-card-head small,
.agreement-card-head span,
.agreement-metrics span,
.agreement-diff span,
.agreement-progress-label span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.agreement-card-head strong {
  display: block;
  margin-top: 3px;
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.25;
}

.agreement-percent {
  text-align: right;
  min-width: 76px;
}

.agreement-percent strong {
  font-size: 18px;
}

.agreement-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.agreement-metrics > div {
  min-height: 84px;
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #fbfdff;
}

.agreement-metrics strong {
  display: block;
  min-width: 0;
  color: var(--foreground);
  font-size: 17px;
  line-height: 1.25;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.agreement-diff {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 147, 38, 0.35);
  border-radius: 12px;
  background: rgba(255, 147, 38, 0.07);
}

.agreement-card--complete .agreement-diff {
  border-color: rgba(46, 172, 75, 0.35);
  background: rgba(46, 172, 75, 0.08);
}

.agreement-diff strong {
  color: #d94f15;
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.agreement-card--complete .agreement-diff strong {
  color: var(--brand-green-deep);
}

.agreement-progress-wrap {
  display: grid;
  gap: 8px;
}

.agreement-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.agreement-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebef;
}

.agreement-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f04438 0%, #ff9f1c 48%, #2eac4b 100%);
}

.admin-layout {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.admin-compact-card .section-title {
  gap: 12px;
}

.admin-summary-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.admin-summary-row {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.admin-summary-row span,
.admin-summary-row small {
  color: var(--muted);
  font-size: 12px;
}

#postgresConfigPanel,
#activityList,
#onlineUsersList,
#usersList {
  max-height: 420px;
  overflow: auto;
}

.agreement-modal.hidden {
  display: none;
}

.agreement-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.agreement-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 26, 42, 0.42);
}

.agreement-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #cfe1ee;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(7, 26, 42, 0.22);
}

.agreement-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.agreement-modal-header strong {
  display: block;
  font-size: 18px;
}

.agreement-modal-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 22px;
}

.agreement-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.agreement-form label {
  display: grid;
  gap: 6px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
}

.agreement-form input,
.agreement-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #ffffff;
  color: var(--foreground);
}


.agreement-logo-preview {
  grid-column: 1 / -1;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fbfdff;
  font-size: 12px;
}

.agreement-logo-preview img {
  width: 68px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: #edf5fc;
  padding: 4px;
}

.agreement-active-row,
.agreement-form-actions,
.agreement-form .form-feedback {
  grid-column: 1 / -1;
}

.agreement-active-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
}

.agreement-active-row input {
  width: auto;
  min-height: auto;
}

.agreement-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.agreement-admin-list-wrap {
  min-width: 0;
}

.agreement-admin-list-wrap h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.agreement-admin-list {
  display: grid;
  gap: 10px;
}

.agreement-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfdff;
}

.agreement-admin-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.agreement-admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.agreement-admin-main span,
.agreement-admin-main small {
  color: var(--muted);
  font-size: 12px;
}



.agreements-group {
  display: grid;
  gap: 14px;
}

.agreements-group + .agreements-group {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.agreements-view-tabs {
  align-self: flex-start;
  margin: 2px 0 20px;
}

.agreements-view-tabs .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  justify-content: center;
  padding-inline: 16px;
}

.agreement-view-count {
  display: inline-grid;
  min-width: 22px;
  min-height: 20px;
  place-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(33, 109, 163, 0.1);
  color: var(--brand-blue);
  font-size: 11px;
  font-weight: 800;
}

.agreements-view-tabs .active .agreement-view-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.agreements-group.agreements-view-panel {
  min-width: 0;
  min-height: 260px;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.agreements-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.agreements-group-title h3,
.agreements-summary-title h3 {
  margin: 0;
  color: var(--foreground);
  font-size: 15px;
}

.agreements-group-title span {
  color: var(--muted);
  font-size: 12px;
}

.distributor-agreements-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.distributor-agreement-card {
  --agreement-accent: var(--brand-blue);
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #cfe1ee;
  border-top: 4px solid var(--agreement-accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(7, 57, 92, 0.08);
}

.distributor-agreement-card--level-0 {
  --agreement-accent: #f28c18;
}

.distributor-agreement-card--level-1,
.distributor-agreement-card--level-2 {
  --agreement-accent: #1680bd;
}

.distributor-agreement-card--level-3,
.distributor-agreement-card--level-4 {
  --agreement-accent: #249a4a;
}


.distributor-agreement-card--color-1 { --agreement-accent: #0b63a5; }
.distributor-agreement-card--color-2 { --agreement-accent: #dc6b19; }
.distributor-agreement-card--color-3 { --agreement-accent: #17834f; }
.distributor-agreement-card--color-4 { --agreement-accent: #7a4bb7; }
.distributor-agreement-card--color-5 { --agreement-accent: #087f8c; }
.distributor-agreement-card--color-6 { --agreement-accent: #bd3f4a; }
.distributor-agreement-head {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.distributor-agreement-card .agreement-logo {
  width: 68px;
  height: 58px;
}

.distributor-agreement-card .agreement-logo img {
  padding: 3px;
}
.distributor-agreement-name {
  min-width: 0;
}

.distributor-agreement-name small,
.distributor-agreement-name span,
.distributor-agreement-metrics span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.distributor-agreement-name strong {
  display: block;
  margin: 3px 0;
  overflow-wrap: anywhere;
  color: var(--foreground);
  font-size: 17px;
}

.agreement-level-badge {
  align-self: start;
  padding: 6px 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--agreement-accent) 12%, white);
  color: var(--agreement-accent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.distributor-agreement-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.distributor-agreement-metrics > div {
  min-width: 0;
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #e5edf4;
  border-radius: 8px;
  background: #f7fafc;
}

.distributor-agreement-metrics strong {
  overflow: hidden;
  color: var(--foreground);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.distributor-levels {
  display: grid;
  gap: 9px;
}

.agreement-level-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #dbe6ef;
  border-radius: 8px;
  background: #f9fbfd;
}

.agreement-level-row.is-reached {
  border-color: rgba(36, 154, 74, 0.35);
  background: rgba(36, 154, 74, 0.06);
}

.agreement-level-row.is-next {
  border-color: color-mix(in srgb, var(--agreement-accent) 45%, white);
  background: color-mix(in srgb, var(--agreement-accent) 6%, white);
}

.agreement-level-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--foreground);
  font-size: 12px;
}

.agreement-level-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.agreement-level-head span {
  color: var(--agreement-accent);
  font-weight: 800;
  white-space: nowrap;
}

.agreement-level-progress,
.agreement-summary-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf2;
}

.agreement-level-progress span,
.agreement-summary-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--agreement-accent, var(--brand-green));
}

.agreement-level-row.is-reached .agreement-level-progress span {
  background: #2eac4b;
}

.agreement-level-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.distributor-next-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.distributor-next-meta strong {
  color: var(--agreement-accent);
}

.distributor-summary {
  margin-top: 8px;
}

.agreements-summary-title {
  margin: 20px 0 10px;
}

.distributor-summary-table {
  min-width: 900px;
}

.distributor-summary-name strong,
.distributor-summary-level,
.distributor-summary-table .agreement-summary-bonus {
  color: var(--agreement-accent);
  font-weight: 800;
}

.distributor-summary-level {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--agreement-accent) 10%, white);
  white-space: nowrap;
}

.distributor-summary-table .agreement-summary-progress span {
  background: var(--agreement-accent);
}

.agreement-summary-progress {
  width: 150px;
}

.agreement-bonus-levels {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid #cfe1ee;
  border-radius: 8px;
  background: #f8fbfd;
}

.agreement-bonus-levels legend {
  padding: 0 6px;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 800;
}

.agreement-bonus-levels > p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.agreement-level-inputs {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(0, 0.75fr);
  gap: 10px;
  align-items: end;
}

.agreement-level-inputs > strong {
  align-self: center;
  color: var(--brand-blue);
  font-size: 12px;
}
@media (max-width: 1180px) and (min-width: 761px) {
  .distributor-agreements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .agreements-panel > .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .agreement-month-control {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .agreement-month-control select,
  .agreement-reference-field {
    max-width: none;
    width: 100%;
  }
}
@media (max-width: 760px) {
  .agreements-grid {
    grid-template-columns: 1fr;
  }

  .agreement-card {
    padding: 16px;
  }


  .agreements-view-tabs {
    display: flex;
    width: 100%;
  }

  .agreements-view-tabs .btn-ghost {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
  }

  .agreements-group-title,
  .distributor-next-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .distributor-agreements-grid {
    grid-template-columns: 1fr;
  }

  
.distributor-agreement-card--color-1 { --agreement-accent: #0b63a5; }
.distributor-agreement-card--color-2 { --agreement-accent: #dc6b19; }
.distributor-agreement-card--color-3 { --agreement-accent: #17834f; }
.distributor-agreement-card--color-4 { --agreement-accent: #7a4bb7; }
.distributor-agreement-card--color-5 { --agreement-accent: #087f8c; }
.distributor-agreement-card--color-6 { --agreement-accent: #bd3f4a; }
.distributor-agreement-head {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .distributor-agreement-card .agreement-logo {
    width: 58px;
    height: 50px;
  }
  .agreement-level-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .distributor-agreement-metrics {
    grid-template-columns: 1fr;
  }

  .agreement-level-inputs {
    grid-template-columns: 1fr;
  }

  .agreement-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .agreement-card-head,
  .agreement-admin-row,
  .agreement-modal-body {
    grid-template-columns: 1fr;
  }
  .agreement-percent {
    text-align: left;
  }
  .agreement-form {
    grid-template-columns: 1fr;
  }
}


.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-menu {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #cfe1ee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(33, 109, 163, 0.07);
}

.admin-menu-item {
  min-height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--foreground);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.admin-menu-item:hover {
  border-color: #cfe1ee;
  background: #f4f9fd;
}

.admin-menu-item.active {
  border-color: var(--primary);
  background: #e8f4ff;
  color: var(--primary-strong);
}

.admin-content {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.admin-panel {
  min-width: 0;
}

.admin-panel.hidden,
.admin-menu-item.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-menu {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}


.agreement-company-picker {
  align-content: start;
}

.agreement-company-picker input[type="search"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #ffffff;
  color: var(--foreground);
}

.agreement-company-picker small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
}
