/* ==========================================================
   AfiliAI Dashboard v2 — visual light premium
   Escopo: body[data-dashboard-v2] (nao afeta outras telas)
   Tokens extraidos de login.html (paleta clara editorial)
   ========================================================== */

body[data-dashboard-v2] {
  --dv2-bg:           #f8fafc;
  --dv2-surface:      #ffffff;
  --dv2-surface-soft: #f1f5f9;
  --dv2-text:         #0f172a;
  --dv2-muted:        #64748b;
  --dv2-faint:        #94a3b8;
  --dv2-border:       #e2e8f0;
  --dv2-border-soft:  #f1f5f9;
  --dv2-brand:        #f97316;
  --dv2-brand-hover:  #ea580c;
  --dv2-brand-soft:   #fff7ed;
  --dv2-success:      #10b981;
  --dv2-success-soft: #ecfdf5;
  --dv2-warning:      #f59e0b;
  --dv2-warning-soft: #fffbeb;
  --dv2-danger:       #ef4444;
  --dv2-info:         #3b82f6;
  --dv2-shopee:       #ee4d2d;
  --dv2-shopee-soft:  #fef2f2;
  --dv2-radius-sm:    10px;
  --dv2-radius:       14px;
  --dv2-radius-lg:    20px;
  --dv2-radius-pill:  999px;
  --dv2-shadow-sm:    0 1px 2px rgba(15, 23, 42, .06);
  --dv2-shadow-card:  0 12px 32px rgba(15, 23, 42, .08);
  --dv2-shadow-brand: 0 8px 24px rgba(249, 115, 22, .22);
  --dv2-font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --dv2-font-body:    'Inter', 'DM Sans', system-ui, sans-serif;
}

/* O operational-shell injeta .md-content dentro do <main>.
   Tratamos esse container como nosso canvas claro. */
body[data-dashboard-v2] .md-content {
  background: var(--dv2-bg);
  color: var(--dv2-text);
  font-family: var(--dv2-font-body);
  padding: 28px 28px 80px;
}

body[data-dashboard-v2] .md-content * {
  box-sizing: border-box;
}

/* ----- Page header ---------------------------------------------------- */
.dv2-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dv2-header-title h1 {
  font-family: var(--dv2-font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dv2-text);
  margin: 0 0 4px;
  line-height: 1.2;
}

.dv2-header-title p {
  font-size: .9375rem;
  color: var(--dv2-muted);
  margin: 0;
  max-width: 560px;
  line-height: 1.5;
}

.dv2-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ----- Buttons -------------------------------------------------------- */
.dv2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-family: var(--dv2-font-body);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s cubic-bezier(.2, .8, .2, 1);
  white-space: nowrap;
}

.dv2-btn-primary {
  background: var(--dv2-brand);
  color: #fff;
  box-shadow: var(--dv2-shadow-brand);
}

.dv2-btn-primary:hover {
  background: var(--dv2-brand-hover);
  transform: translateY(-1px);
}

.dv2-btn-ghost {
  background: var(--dv2-surface);
  color: var(--dv2-text);
  border-color: var(--dv2-border);
}

.dv2-btn-ghost:hover {
  background: var(--dv2-surface-soft);
  border-color: var(--dv2-faint);
}

.dv2-btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: .8125rem;
  border-radius: 10px;
}

/* ----- KPI grid ------------------------------------------------------- */
.dv2-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.dv2-kpi-card {
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: var(--dv2-radius);
  padding: 20px;
  box-shadow: var(--dv2-shadow-sm);
  transition: box-shadow .2s, transform .2s;
}

.dv2-kpi-card:hover {
  box-shadow: var(--dv2-shadow-card);
  transform: translateY(-2px);
}

.dv2-kpi-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--dv2-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.dv2-kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--dv2-brand-soft);
  color: var(--dv2-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9375rem;
}

.dv2-kpi-icon.is-shopee  { background: var(--dv2-shopee-soft); color: var(--dv2-shopee); }
.dv2-kpi-icon.is-success { background: var(--dv2-success-soft); color: var(--dv2-success); }
.dv2-kpi-icon.is-info    { background: #eff6ff; color: var(--dv2-info); }

.dv2-kpi-value {
  font-family: var(--dv2-font-display);
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--dv2-text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.dv2-kpi-sub {
  font-size: .8125rem;
  color: var(--dv2-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dv2-kpi-sub.is-up   { color: var(--dv2-success); }
.dv2-kpi-sub.is-down { color: var(--dv2-danger); }

/* ----- Section row (2 col) ------------------------------------------- */
.dv2-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  min-width: 0;
}

.dv2-row.is-equal {
  grid-template-columns: 1fr 1fr;
}

.dv2-section {
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: var(--dv2-radius);
  padding: 22px;
  box-shadow: var(--dv2-shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.dv2-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dv2-section-title {
  font-family: var(--dv2-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--dv2-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dv2-section-link {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--dv2-brand);
  text-decoration: none;
}

.dv2-section-link:hover { text-decoration: underline; }

/* ----- Chart wrapper ------------------------------------------------- */
.dv2-chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

/* ----- Top list (produtos/grupos/links) ----------------------------- */
.dv2-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dv2-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--dv2-surface-soft);
  transition: background .15s;
  min-width: 0;
}

.dv2-list-row:hover { background: #e2e8f0; }

.dv2-list-rank {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--dv2-brand-soft);
  color: var(--dv2-brand);
  font-weight: 700;
  font-size: .8125rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dv2-list-row.is-product {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(74px, max-content);
  gap: 12px;
  padding: 10px;
}

.dv2-product-thumb,
.dv2-product-fallback {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
}

.dv2-product-thumb {
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--dv2-border);
}

.dv2-product-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dv2-brand-soft);
  color: var(--dv2-brand);
  font-weight: 800;
  font-size: .8125rem;
}

.dv2-list-main {
  flex: 1;
  min-width: 0;
}

.dv2-list-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--dv2-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dv2-list-sub {
  font-size: .75rem;
  color: var(--dv2-muted);
  margin-top: 2px;
}

.dv2-list-value {
  flex-shrink: 0;
  font-family: var(--dv2-font-display);
  font-size: .9375rem;
  font-weight: 700;
  color: var(--dv2-text);
  min-width: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  white-space: nowrap;
}

.dv2-list-value.is-brand { color: var(--dv2-brand); }

/* ----- Empty state --------------------------------------------------- */
.dv2-empty {
  text-align: center;
  padding: 28px 20px;
  color: var(--dv2-muted);
}

.dv2-empty-icon {
  font-size: 1.875rem;
  margin-bottom: 8px;
  opacity: .7;
}

.dv2-empty-title {
  font-weight: 600;
  font-size: .9375rem;
  color: var(--dv2-text);
  margin-bottom: 4px;
}

.dv2-empty-text {
  font-size: .8125rem;
  margin-bottom: 12px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ----- Insights card ------------------------------------------------- */
.dv2-insights {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--dv2-radius);
  padding: 22px;
  box-shadow: var(--dv2-shadow-sm);
  margin-bottom: 24px;
}

.dv2-insights-title {
  font-family: var(--dv2-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--dv2-text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dv2-insights-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
}

.dv2-insights-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .875rem;
  color: var(--dv2-text);
  line-height: 1.5;
}

.dv2-insights-list li::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dv2-brand);
  margin-top: 8px;
}

.dv2-insights-list b { font-weight: 700; }

/* ----- Quick actions (reduzido a 4) --------------------------------- */
.dv2-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dv2-quick-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--dv2-surface-soft);
  border: 1px solid var(--dv2-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--dv2-text);
  transition: all .18s;
  position: relative;
}

.dv2-quick-btn:hover {
  background: var(--dv2-brand-soft);
  border-color: var(--dv2-brand);
  transform: translateY(-1px);
}

.dv2-quick-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}

.dv2-quick-text {
  flex: 1;
  min-width: 0;
}

.dv2-quick-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--dv2-text);
  line-height: 1.2;
}

.dv2-quick-sub {
  font-size: .75rem;
  color: var(--dv2-muted);
  margin-top: 2px;
}

.dv2-quick-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: .625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--dv2-success-soft);
  color: var(--dv2-success);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dv2-quick-badge.is-warn { background: var(--dv2-warning-soft); color: var(--dv2-warning); }
.dv2-quick-badge.is-info { background: #eff6ff; color: var(--dv2-info); }

/* ----- CTA stack (acesso rapido) ------------------------------------ */
.dv2-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dv2-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 600;
  border: 1px solid var(--dv2-border);
  background: var(--dv2-surface);
  color: var(--dv2-text);
  transition: all .18s;
}

.dv2-cta:hover {
  background: var(--dv2-surface-soft);
  border-color: var(--dv2-faint);
}

.dv2-cta.is-brand {
  background: var(--dv2-brand);
  color: #fff;
  border-color: var(--dv2-brand);
  box-shadow: var(--dv2-shadow-brand);
}

.dv2-cta.is-brand:hover {
  background: var(--dv2-brand-hover);
}

/* ----- Skeleton (loading) ------------------------------------------- */
.dv2-skel {
  display: inline-block;
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-size: 200% 100%;
  animation: dv2-shimmer 1.4s linear infinite;
  border-radius: 6px;
  height: 1em;
  min-width: 60px;
  vertical-align: middle;
}

@keyframes dv2-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ----- Range tabs (24h / 7d / 30d) ----------------------------------- */
.dv2-range {
  display: inline-flex;
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
  height: 44px;
  align-items: center;
}

.dv2-range-btn {
  border: none;
  background: transparent;
  color: var(--dv2-muted);
  padding: 0 16px;
  height: 36px;
  font-size: .875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--dv2-font-body);
  transition: all .15s;
}

.dv2-range-btn:hover { color: var(--dv2-text); }

.dv2-range-btn.is-active {
  background: var(--dv2-brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(249, 115, 22, .25);
}

/* ----- Pill (badge inline) ------------------------------------------- */
.dv2-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--dv2-surface-soft);
  color: var(--dv2-text);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid var(--dv2-border);
}

.dv2-pill.is-brand   { background: var(--dv2-brand-soft); color: var(--dv2-brand); border-color: #fed7aa; }
.dv2-pill.is-info    { background: #eff6ff; color: var(--dv2-info); border-color: #bfdbfe; }
.dv2-pill.is-success { background: var(--dv2-success-soft); color: var(--dv2-success); border-color: #a7f3d0; }
.dv2-pill.is-shopee  { background: var(--dv2-shopee-soft); color: var(--dv2-shopee); border-color: #fecaca; }
.dv2-pill.is-warn    { background: var(--dv2-warning-soft); color: var(--dv2-warning); border-color: #fde68a; }
.dv2-pill.is-magalu  { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.dv2-pill.is-natura  { background: #fdf2f8; color: #db2777; border-color: #fbcfe8; }

/* ----- Sparkline bars (vertical) ------------------------------------- */
.dv2-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--dv2-border-soft);
}

.dv2-bar-wrap {
  flex: 1;
  min-width: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dv2-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--dv2-brand) 0%, #fbbf24 100%);
  transition: filter .15s, transform .15s;
  cursor: default;
}

.dv2-bar:hover { filter: brightness(1.08); transform: translateY(-2px); }

.dv2-bar-label {
  color: var(--dv2-muted);
  font-size: .6875rem;
  white-space: nowrap;
  font-weight: 500;
}

/* ----- Source list (origens) ----------------------------------------- */
.dv2-source-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--dv2-border-soft);
}

.dv2-source-row:last-child { border-bottom: 0; }

.dv2-source-row .dv2-pill {
  font-size: .8125rem;
  padding: 6px 12px;
}

.dv2-source-row strong {
  font-family: var(--dv2-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dv2-text);
  line-height: 1;
}

/* Igualar altura ao card de gráfico vizinho */
.dv2-section.is-match-bars {
  min-height: 282px;
}

/* Bar zero — visualmente discreta mas presente */
.dv2-bar.is-zero {
  background: var(--dv2-border);
  opacity: .5;
}

.dv2-bar-label.is-active {
  color: var(--dv2-text);
  font-weight: 700;
}

/* Expand "Ver todos" */
.dv2-expand-row {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
  border-top: 1px dashed var(--dv2-border);
  margin-top: 8px;
}

.dv2-expand-btn {
  background: transparent;
  border: 1px solid var(--dv2-border);
  color: var(--dv2-brand);
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--dv2-font-body);
}

.dv2-expand-btn:hover {
  background: var(--dv2-brand-soft);
  border-color: var(--dv2-brand);
}

/* ----- Table light --------------------------------------------------- */
.dv2-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: -4px;
  padding: 4px;
}

.dv2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.dv2-table thead th {
  text-align: left;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--dv2-muted);
  padding: 12px;
  border-bottom: 1px solid var(--dv2-border);
  background: var(--dv2-surface-soft);
  white-space: nowrap;
}

.dv2-table thead th:first-child { border-radius: 10px 0 0 0; }
.dv2-table thead th:last-child  { border-radius: 0 10px 0 0; text-align: right; }

.dv2-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--dv2-border-soft);
  color: var(--dv2-text);
  vertical-align: middle;
}

.dv2-table tbody tr:last-child td { border-bottom: 0; }
.dv2-table tbody tr:hover td { background: var(--dv2-surface-soft); }

.dv2-table .dv2-cell-num {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  font-family: var(--dv2-font-display);
}

.dv2-table .dv2-cell-num.is-brand { color: var(--dv2-brand); }

.dv2-table .dv2-cell-url {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dv2-muted);
  font-size: .8125rem;
}

.dv2-table .dv2-cell-time {
  color: var(--dv2-muted);
  font-size: .8125rem;
  white-space: nowrap;
}

.dv2-table a {
  color: var(--dv2-brand);
  text-decoration: none;
  font-weight: 600;
}

.dv2-table a:hover { text-decoration: underline; }

/* ----- Back link ----------------------------------------------------- */
.dv2-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dv2-muted);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.dv2-back:hover { color: var(--dv2-brand); }

/* ----- Error state --------------------------------------------------- */
.dv2-error {
  text-align: center;
  padding: 28px 20px;
  color: var(--dv2-danger);
  font-size: .875rem;
  background: #fef2f2;
  border-radius: 10px;
  border: 1px solid #fecaca;
}

/* ----- Hero (extensão / banner editorial) ---------------------------- */
.dv2-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 50%, #fef2f2 100%);
  border: 1px solid #fed7aa;
  border-radius: var(--dv2-radius-lg);
  box-shadow: var(--dv2-shadow-sm);
  margin-bottom: 24px;
  flex-wrap: wrap;
  overflow: hidden;
}

.dv2-hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(249, 115, 22, .15) 0%, transparent 65%);
  pointer-events: none;
}

.dv2-hero-icon {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  box-shadow: var(--dv2-shadow-sm);
}

.dv2-hero-body {
  flex: 1;
  min-width: 220px;
}

.dv2-hero-title {
  font-family: var(--dv2-font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--dv2-text);
  margin: 0 0 6px;
  line-height: 1.2;
}

.dv2-hero-text {
  font-size: .9375rem;
  color: var(--dv2-muted);
  margin: 0 0 14px;
  line-height: 1.5;
  max-width: 580px;
}

.dv2-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dv2-hero-meta {
  margin-top: 12px;
  font-size: .8125rem;
  color: var(--dv2-warning);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--dv2-warning-soft);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 12px;
}

/* ----- Integração card (marketplace) --------------------------------- */
.dv2-int-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dv2-int-card {
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: var(--dv2-radius);
  padding: 20px;
  box-shadow: var(--dv2-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 280px;
  transition: box-shadow .2s, transform .2s;
}

.dv2-int-card:hover {
  box-shadow: var(--dv2-shadow-card);
  transform: translateY(-2px);
}

.dv2-int-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.dv2-int-mark {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--dv2-surface-soft);
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--dv2-text);
  font-size: .8125rem;
  font-family: var(--dv2-font-display);
}

.dv2-int-mark.is-shopee  { background: var(--dv2-shopee-soft); color: var(--dv2-shopee); border-color: #fecaca; }
.dv2-int-mark.is-amazon  { background: var(--dv2-warning-soft); color: var(--dv2-warning); border-color: #fde68a; }
.dv2-int-mark.is-ml      { background: #eff6ff; color: var(--dv2-info); border-color: #bfdbfe; }
.dv2-int-mark.is-magalu  { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.dv2-int-mark.is-natura  { background: #fdf2f8; color: #db2777; border-color: #fbcfe8; }

.dv2-int-info { flex: 1; min-width: 0; }

.dv2-int-name {
  font-family: var(--dv2-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--dv2-text);
  margin: 0 0 2px;
}

.dv2-int-desc {
  font-size: .8125rem;
  color: var(--dv2-muted);
  margin: 0;
  line-height: 1.4;
}

.dv2-int-msg {
  font-size: .8125rem;
  color: var(--dv2-muted);
  line-height: 1.45;
  min-height: 38px;
}

.dv2-int-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--dv2-border-soft);
  margin-top: auto;
}

.dv2-int-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--dv2-muted);
}

.dv2-int-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--dv2-danger);
}

.dv2-int-dot.is-ok { background: var(--dv2-success); }

.dv2-int-dates {
  font-size: .6875rem;
  color: var(--dv2-faint);
  line-height: 1.5;
}

/* ----- Formulário inline (credenciais manuais) ----------------------- */
.dv2-int-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin-top: 10px;
  background: var(--dv2-surface-soft);
  border-radius: 10px;
  border: 1px solid var(--dv2-border);
}

.dv2-int-form.is-open { display: flex; }

.dv2-int-form-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--dv2-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}

.dv2-int-form-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-size: .875rem;
  font-family: var(--dv2-font-body);
  color: var(--dv2-text);
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}

.dv2-int-form-input:focus {
  outline: none;
  border-color: var(--dv2-brand);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .15);
}

.dv2-int-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dv2-int-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.dv2-int-form-msg {
  font-size: .75rem;
  padding: 6px 0;
  display: none;
}

.dv2-int-form-msg.is-ok    { color: var(--dv2-success); display: block; }
.dv2-int-form-msg.is-error { color: var(--dv2-danger); display: block; }

.dv2-int-form-help {
  font-size: .6875rem;
  color: var(--dv2-muted);
  line-height: 1.4;
}

.dv2-int-form-help a {
  color: var(--dv2-brand);
  text-decoration: none;
  font-weight: 600;
}

.dv2-int-form-help a:hover { text-decoration: underline; }

/* ----- Callout (dica/cross-link inline) ------------------------------ */
.dv2-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--dv2-brand-soft);
  border: 1px solid #fed7aa;
  border-radius: 12px;
  font-size: .875rem;
  color: var(--dv2-text);
  margin-bottom: 16px;
  line-height: 1.45;
}

.dv2-callout-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.dv2-callout-body { flex: 1; }

.dv2-callout a {
  color: var(--dv2-brand);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
}

.dv2-callout a:hover { border-bottom-style: solid; }

/* ----- Toast (notificação flutuante) --------------------------------- */
.dv2-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--dv2-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .25);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 9999;
  max-width: 360px;
}

.dv2-toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

.dv2-toast.is-success {
  background: var(--dv2-success);
}

.dv2-toast.is-error {
  background: var(--dv2-danger);
}

/* ====================================================================
   Workspace components (capturas / produtos / bulk actions / modais)
   ==================================================================== */

/* ----- Filter tabs ---------------------------------------------------- */
.dv2-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0 0;
  border-bottom: 1px solid var(--dv2-border);
  overflow-x: auto;
  margin: 0 0 16px;
}

.dv2-tab {
  border: 0;
  background: transparent;
  color: var(--dv2-muted);
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--dv2-font-body);
  font-size: .9375rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s;
}

.dv2-tab:hover { color: var(--dv2-text); }

.dv2-tab.is-active {
  color: var(--dv2-brand);
  border-bottom-color: var(--dv2-brand);
}

.dv2-tab-count {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--dv2-surface-soft);
  color: var(--dv2-muted);
  font-size: .6875rem;
  font-weight: 700;
  padding: 0 7px;
}

.dv2-tab.is-active .dv2-tab-count {
  background: var(--dv2-brand-soft);
  color: var(--dv2-brand);
}

/* ----- Bulk bar (seleção em massa) ----------------------------------- */
.dv2-bulkbar {
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: var(--dv2-radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  box-shadow: var(--dv2-shadow-sm);
}

.dv2-bulk-left,
.dv2-bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dv2-bulk-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dv2-surface-soft);
}

.dv2-bulk-box input {
  width: 18px;
  height: 18px;
  accent-color: var(--dv2-brand);
  cursor: pointer;
}

.dv2-bulk-title {
  font-weight: 700;
  color: var(--dv2-text);
  font-size: .9375rem;
}

.dv2-bulk-sub {
  color: var(--dv2-muted);
  font-size: .75rem;
  margin-top: 2px;
}

.dv2-bulk-pill {
  border-radius: 10px;
  background: var(--dv2-brand-soft);
  border: 1px solid #fed7aa;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dv2-text);
  font-size: .8125rem;
  font-weight: 700;
}

.dv2-bulk-pill strong {
  font-size: 1.0625rem;
  color: var(--dv2-brand);
  font-family: var(--dv2-font-display);
}

/* ----- Product grid (cards de produto capturado) --------------------- */
.dv2-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 16px;
}

.dv2-product-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: var(--dv2-radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--dv2-shadow-sm);
  transition: box-shadow .2s, border-color .2s, transform .2s;
}

.dv2-product-card:hover {
  box-shadow: var(--dv2-shadow-card);
  transform: translateY(-1px);
}

.dv2-product-card.is-selected {
  border-color: var(--dv2-brand);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, .15), var(--dv2-shadow-card);
}

.dv2-product-media {
  position: relative;
  aspect-ratio: 1.18 / 1;
  background: #f1f5f9;
  overflow: hidden;
}

.dv2-product-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #ffffff;
}

.dv2-product-thumb-fallback {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dv2-surface-soft);
  color: var(--dv2-faint);
  font-size: .8125rem;
  font-weight: 700;
}

.dv2-product-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
}

.dv2-product-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--dv2-brand);
  cursor: pointer;
}

.dv2-product-discount {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--dv2-danger);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(239, 68, 68, .35);
}

.dv2-product-age {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(15, 23, 42, .8);
  color: #fff;
  font-size: .6875rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: .02em;
}

.dv2-product-open {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--dv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dv2-brand);
  text-decoration: none;
  font-weight: 700;
  font-size: .875rem;
  transition: background .15s;
}

.dv2-product-open:hover { background: #fff; }

.dv2-product-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  min-height: 190px;
}

.dv2-product-row1 {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dv2-mp-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid var(--dv2-border);
  background: var(--dv2-surface-soft);
  color: var(--dv2-muted);
}

.dv2-mp-badge.is-amazon       { background: var(--dv2-warning-soft); color: var(--dv2-warning); border-color: #fde68a; }
.dv2-mp-badge.is-mercado_livre,
.dv2-mp-badge.is-mercadolivre  { background: #eff6ff; color: var(--dv2-info); border-color: #bfdbfe; }
.dv2-mp-badge.is-shopee        { background: var(--dv2-shopee-soft); color: var(--dv2-shopee); border-color: #fecaca; }
.dv2-mp-badge.is-magalu        { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.dv2-mp-badge.is-natura        { background: #fdf2f8; color: #db2777; border-color: #fbcfe8; }

.dv2-product-status {
  color: var(--dv2-success);
  font-size: .75rem;
  font-weight: 700;
}

.dv2-product-title {
  margin: 0 0 8px;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--dv2-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.6em;
}

.dv2-product-price-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

.dv2-product-price {
  color: var(--dv2-success);
  font-size: 1.375rem;
  font-weight: 800;
  font-family: var(--dv2-font-display);
  line-height: 1;
}

.dv2-product-price-original {
  color: var(--dv2-muted);
  font-size: .8125rem;
  text-decoration: line-through;
  font-weight: 600;
}

.dv2-product-coupon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--dv2-brand-soft);
  color: var(--dv2-brand);
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 700;
  margin-top: 6px;
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dv2-product-id {
  color: var(--dv2-faint);
  font-size: .6875rem;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dv2-product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
}

.dv2-product-actions .dv2-mini-btn.is-wide { grid-column: 1 / -1; }

/* ----- Modal --------------------------------------------------------- */
.dv2-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.dv2-modal-backdrop.is-open { display: flex; }

.dv2-modal {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .25);
  display: flex;
  flex-direction: column;
}

.dv2-modal.is-wide { width: min(760px, 100%); }

.dv2-modal-head {
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--dv2-border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dv2-modal-title {
  margin: 0;
  font-family: var(--dv2-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dv2-text);
  line-height: 1.2;
}

.dv2-modal-sub {
  margin: 4px 0 0;
  color: var(--dv2-muted);
  font-size: .8125rem;
  line-height: 1.45;
}

.dv2-modal-close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--dv2-border);
  background: var(--dv2-surface);
  color: var(--dv2-muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.dv2-modal-close:hover {
  background: var(--dv2-surface-soft);
  color: var(--dv2-text);
}

.dv2-modal-body {
  padding: 18px 22px;
  flex: 1;
  overflow-y: auto;
}

.dv2-modal-actions {
  border-top: 1px solid var(--dv2-border-soft);
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dv2-modal-message {
  color: var(--dv2-danger);
  font-size: .8125rem;
  min-height: 18px;
  margin-top: 10px;
}

.dv2-modal-message.is-ok { color: var(--dv2-success); }
.dv2-modal-message.is-info { color: var(--dv2-info); }

/* Linhas selecionáveis (radio/checkbox) dentro de modal */
.dv2-option-list { display: flex; flex-direction: column; gap: 8px; }

.dv2-option {
  border: 1px solid var(--dv2-border);
  border-radius: 12px;
  background: var(--dv2-surface);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dv2-option:hover {
  background: var(--dv2-surface-soft);
  border-color: var(--dv2-faint);
}

.dv2-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--dv2-brand);
  cursor: pointer;
  flex-shrink: 0;
}

.dv2-option-text { flex: 1; }
.dv2-option-name {
  font-weight: 700;
  color: var(--dv2-text);
  font-size: .9375rem;
}
.dv2-option-meta {
  color: var(--dv2-muted);
  font-size: .75rem;
  margin-top: 2px;
  line-height: 1.4;
}

.dv2-option-select {
  min-width: 170px;
  background: var(--dv2-surface);
  color: var(--dv2-text);
  border: 1px solid var(--dv2-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 600;
  font-family: var(--dv2-font-body);
  font-size: .875rem;
}

/* Queue list (fila de envio) */
.dv2-queue-list { display: flex; flex-direction: column; gap: 10px; }

.dv2-queue-item {
  border: 1px solid var(--dv2-border);
  border-radius: 12px;
  background: var(--dv2-surface);
  padding: 12px;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
}

.dv2-queue-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--dv2-surface-soft);
}

.dv2-queue-title {
  font-weight: 700;
  color: var(--dv2-text);
  line-height: 1.25;
  margin: 0 0 4px;
  font-size: .9375rem;
  overflow-wrap: anywhere;
}

.dv2-queue-meta {
  color: var(--dv2-muted);
  font-size: .75rem;
  line-height: 1.4;
}

/* Quick create wrap */
.dv2-quick-create {
  border: 1px solid var(--dv2-brand-soft);
  border-radius: 12px;
  background: #fffbf5;
  padding: 12px;
  margin-top: 10px;
}

/* ----- Workspace responsive ------------------------------------------ */
@media (max-width: 820px) {
  .dv2-product-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .dv2-bulkbar { align-items: flex-start; }
  .dv2-bulk-actions { width: 100%; }
  .dv2-bulk-actions .dv2-mini-btn { flex: 1 1 130px; justify-content: center; }
  .dv2-modal-actions .dv2-btn { flex: 1 1 150px; }
  .dv2-queue-item { grid-template-columns: 48px 1fr; }
  .dv2-queue-item button { grid-column: 1 / -1; }
}

/* ----- Mini actions (botões compactos em tabela) --------------------- */
.dv2-mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dv2-mini-btn {
  background: var(--dv2-surface);
  border: 1px solid var(--dv2-border);
  color: var(--dv2-text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--dv2-font-body);
  transition: all .15s;
  white-space: nowrap;
}

.dv2-mini-btn:hover {
  background: var(--dv2-surface-soft);
  border-color: var(--dv2-faint);
}

.dv2-mini-btn.is-danger {
  color: var(--dv2-danger);
  border-color: #fecaca;
}

.dv2-mini-btn.is-danger:hover {
  background: #fef2f2;
}

.dv2-mini-btn.is-brand {
  color: var(--dv2-brand);
  border-color: #fed7aa;
}

.dv2-mini-btn.is-brand:hover {
  background: var(--dv2-brand-soft);
}

/* ----- Responsivo ---------------------------------------------------- */
@media (max-width: 1100px) {
  .dv2-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  body[data-dashboard-v2] .md-content { padding: 20px 16px 80px; }
  .dv2-row,
  .dv2-row.is-equal { grid-template-columns: 1fr; }
  .dv2-insights-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dv2-header { flex-direction: column; align-items: flex-start; }
  .dv2-header-actions { width: 100%; flex-wrap: wrap; }
  .dv2-header-actions .dv2-btn { flex: 1; }
  .dv2-header-title h1 { font-size: 1.5rem; }
  .dv2-kpi-value { font-size: 1.5rem; }
  .dv2-kpi-grid { grid-template-columns: 1fr; }
  .dv2-quick-grid { grid-template-columns: 1fr; }
  .dv2-range { width: 100%; justify-content: stretch; }
  .dv2-range-btn { flex: 1; padding: 0 10px; font-size: .8125rem; }
  .dv2-table .dv2-cell-url { max-width: 140px; }
  .dv2-bars { height: 140px; gap: 4px; }
  .dv2-bar-label { font-size: .625rem; }
}
