@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Cores principais (design system DivulgAfiliados) */
  --primary: #10b981;
  --primary-dark: #0b8f63;
  --primary-soft: #ecfdf5;
  --success: #22c55e;
  --success-soft: #dcfce7;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --error: #ef4444;
  --error-soft: #fee2e2;
  --text: #0f172a;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;

  /* Mantidos por compatibilidade com nomes antigos usados em regras legadas */
  --green: var(--primary);
  --green-dark: var(--primary-dark);
  --card: var(--surface);
  --muted: var(--text-muted);
  --danger: var(--error);
  --warn: var(--warning);

  /* Espaçamento */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

h1, h2, h3, h4 { font-family: inherit; color: var(--text); }
h1 { font-size: 32px; font-weight: 600; margin: 0; }
h2 { font-size: 20px; font-weight: 600; margin: 0; }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 var(--sp-3); }
h4 { font-size: 14px; font-weight: 600; margin: var(--sp-4) 0 var(--sp-2); }
p { margin: 0; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-box { background: var(--surface); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow-card); border: 1px solid var(--border); width: 280px; text-align: center; }
.login-box h1 { font-size: 18px; margin: 0 0 20px; }
.login-box input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; font-family: inherit; }
.login-box button { width: 100%; margin-top: 0; }
.login-link { display: block; margin-top: 14px; font-size: 0.85rem; color: var(--text-muted); text-decoration: none; }
.login-link:hover { text-decoration: underline; }

.billing-banner { background: var(--error); color: #fff; padding: 10px 16px; text-align: center; font-size: 0.9rem; }

/* ---------- App shell (sidebar + conteúdo) ---------- */
.app-shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: var(--sp-4) 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-4);
  margin-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-name { font-size: 16px; font-weight: 700; color: var(--text); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-2); flex: 1; overflow-y: auto; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border: none;
  background: none;
  padding: 10px var(--sp-3);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-align: left;
  width: 100%;
}
.tab-btn svg { flex-shrink: 0; width: 18px; height: 18px; }
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 600;
}

.sidebar-footer { padding: var(--sp-3) var(--sp-4) 0; border-top: 1px solid var(--border); margin-top: var(--sp-2); }
.sidebar-support { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--text-muted); text-decoration: none; }
.sidebar-support:hover { color: var(--primary-dark); }
.sidebar-support strong { color: var(--text); font-size: 0.85rem; }
.sidebar-support:hover strong { color: var(--primary-dark); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.content-header-left h2 { margin: 0; }
.page-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.content-header-right { display: flex; align-items: center; gap: var(--sp-3); }

.wa-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.wa-status.ready { background: var(--success-soft); color: #14532d; border-color: transparent; }
.wa-status.connecting { background: var(--warning-soft); color: #7c4a03; border-color: transparent; }

.logout-btn { background: var(--bg); color: var(--text); border: 1px solid var(--border); font-size: 0.85rem; padding: 7px 14px; }
.logout-btn:hover { background: var(--border); opacity: 1; }
.logout-btn.hidden { display: none; }

main { padding: var(--sp-6); max-width: 1100px; width: 100%; margin: 0 auto; flex: 1; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Stats row (Monitorar Grupos) ---------- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon--total { background: var(--primary-soft); color: var(--primary-dark); }
.stat-icon--active { background: var(--success-soft); color: #15803d; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap input { width: 100%; padding: 9px 12px 9px 36px; }
.filter-bar select { min-width: 170px; }
.filter-bar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

/* ---------- Inputs / selects / textarea genéricos ---------- */
input, select, textarea, button { font-family: inherit; }
input[type="text"], input[type="number"], input[type="time"], input[type="password"], input[type="email"], select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.accounts-list { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: var(--sp-4); }
.account-card-header { display: flex; align-items: center; gap: var(--sp-3); }
.account-card-header strong { flex: 1; }
.account-qr { width: 200px; height: 200px; margin-top: var(--sp-3); display: block; }
.account-tag { color: var(--text-muted); font-size: 0.85em; font-weight: 400; }

.mode-toggle { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.mode-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.mode-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.form-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.form-row input { flex: 1; }
.form-row.hidden { display: none; }

button {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary-dark);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
button:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.primary-btn { background: var(--primary); font-weight: 600; margin-top: var(--sp-3); }
.back-btn { background: transparent; color: var(--primary-dark); border: 1px solid var(--primary-dark); margin-bottom: var(--sp-3); }
.secondary-btn { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.secondary-btn:hover { background: var(--bg); }
.danger-btn { background: var(--error); }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn--reexibir { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn--reexibir:hover { background: var(--primary); color: white; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 10px;
  cursor: pointer;
  text-align: left;
}
.result-card:hover { border-color: var(--primary); }
.result-card img { width: 100%; height: 120px; object-fit: contain; margin-bottom: 8px; }
.result-card .title { font-size: 0.85rem; margin: 0 0 4px; }
.result-card .price { font-size: 0.9rem; font-weight: 600; color: var(--primary-dark); margin: 0; }
.result-card .price-original { font-size: 0.78rem; color: var(--text-muted); text-decoration: line-through; margin: 0; }
.result-card .deal-discount { display: inline-block; font-size: 0.75rem; font-weight: 700; color: white; background: var(--primary-dark); border-radius: 4px; padding: 1px 6px; margin: 0 0 4px; }
.result-card .deal-commission { display: inline-block; font-size: 0.75rem; font-weight: 700; color: #7a4a00; background: var(--warning-soft); border-radius: 4px; padding: 1px 6px; margin: 0 0 4px 4px; }

.product-preview {
  display: flex;
  gap: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.product-preview.hidden { display: none; }
.product-preview img { width: 140px; height: 140px; object-fit: contain; }
.product-info h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; }
.product-info .price { color: var(--primary-dark); font-weight: 700; font-size: 1.1rem; margin: 0 0 8px; }
.product-info .description { color: var(--text-muted); font-size: 0.9rem; }

.groups-section.hidden { display: none; }
.groups-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 10px 0 var(--sp-4); }
.groups-list label {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
}
.groups-list label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.priority-check { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0; font-size: 0.95rem; }

.field-label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: var(--sp-3); }
.field-label input { font-size: 0.95rem; color: var(--text); }
.message-preview-input { font-size: 0.95rem; font-family: inherit; color: var(--text); resize: vertical; max-width: 480px; }
#messagePreviewHint { margin-top: -6px; }

.auto-coupons-label { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 var(--sp-2); }
.auto-coupons-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 14px; }
.auto-coupon-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
}
.auto-coupon-btn strong { color: var(--primary-dark); font-size: 0.95rem; }
.auto-coupon-btn.selected { background: var(--primary); color: white; }
.auto-coupon-btn.selected strong { color: white; }

.feedback { margin-top: 10px; font-size: 0.9rem; }
.feedback.error { color: var(--error); }
.feedback.success { color: var(--primary-dark); }

.queue-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  font-weight: 600;
}

.queue-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.queue-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.queue-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 10px 14px;
}
.queue-item .item-select { width: 18px; height: 18px; flex-shrink: 0; }
.queue-item img { width: 50px; height: 50px; object-fit: contain; }
.queue-item .info { flex: 1; }
.queue-item .info .title { font-size: 0.9rem; margin: 0 0 4px; }
.queue-item .badges { display: flex; gap: 6px; flex-wrap: wrap; }

.badge, .status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
}
.badge.pending { background: var(--warning-soft); color: #92400e; }
.badge.sending { background: #dbeafe; color: #1e40af; }
.badge.sent { background: var(--success-soft); color: #065f46; }
.badge.failed { background: var(--error-soft); color: #991b1b; }
.badge.priority { background: var(--error-soft); color: #b91c1c; font-weight: 700; }

.status-badge--active { background: var(--success-soft); color: #15803d; }
.status-badge--paused { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.status-badge--warn { background: var(--error-soft); color: #b91c1c; }

.remove-btn { background: var(--error); font-size: 0.8rem; padding: 6px 10px; }

/* ---------- Cards de grupo monitorado ---------- */
.monitor-groups-list { display: flex; flex-direction: column; gap: var(--sp-3); margin: var(--sp-3) 0; }
.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}
.group-card--hidden-row { background: var(--bg); }
.group-card--hidden-row .group-card-name,
.group-card--hidden-row .group-card-platform,
.group-card--hidden-row .switch-row,
.group-card--hidden-row .group-card-clean-image { color: var(--text-muted); }

.group-card-top { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.group-card-select { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; cursor: pointer; }
.group-card-select input { width: 16px; height: 16px; flex-shrink: 0; }
.group-card-name { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.group-card-body { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-4); align-items: center; margin-bottom: var(--sp-3); }
.group-card-platform label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }
.group-card-platform select { min-width: 150px; }
.group-card-automation { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.switch-row { display: flex; align-items: center; gap: var(--sp-2); font-size: 0.8rem; color: var(--text-muted); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 999px; transition: background 0.15s;
}
.switch-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--success); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }
.switch input:disabled + .switch-slider { opacity: 0.5; cursor: not-allowed; }

.group-card-targets-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.group-card-targets-summary.hidden { display: none; }
.avatar-stack { display: flex; align-items: center; }
.avatar-chip {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: white;
  border: 2px solid var(--surface);
  margin-left: -6px;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-chip:first-child { margin-left: 0; }
.avatar-chip img { width: 100%; height: 100%; object-fit: cover; }
.avatar-chip--more { background: var(--bg); color: var(--text-muted); border-color: var(--surface); }
.group-card-targets-summary .chevron { margin-left: auto; transition: transform 0.15s; }
.group-card-targets-summary.expanded .chevron { transform: rotate(90deg); }

.monitor-group-targets { width: 100%; padding-top: var(--sp-3); margin-top: var(--sp-2); }
.monitor-group-targets.hidden { display: none; }

.group-card-clean-image { display: flex; align-items: center; gap: var(--sp-2); font-size: 0.8rem; color: var(--text-muted); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }

#showHiddenGroupsRow { margin-bottom: var(--sp-3); }
.monitor-group-check { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; }

/* ---------- Entradas e Saídas ---------- */
.membership-total-balance { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px 20px; margin: var(--sp-3) 0; }
.membership-total-value { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.membership-total-value.positive { color: var(--primary-dark); }
.membership-total-value.negative { color: var(--error); }
.membership-total-value.neutral { color: var(--text); }
.membership-total-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

.membership-chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 18px 6px; margin-bottom: var(--sp-4); }
.membership-chart-legend { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 10px; }
.legend-swatch:first-child { margin-left: 0; }
.legend-swatch--green { background: var(--success); }
.legend-swatch--red { background: var(--error); }

.membership-chart-wrap { position: relative; }
.membership-bar-hit { fill: transparent; cursor: pointer; outline: none; }
.membership-bar-hit:hover, .membership-bar-hit:focus-visible { fill: rgba(15, 23, 42, 0.05); }
.membership-chart-tooltip {
  position: absolute; transform: translateY(-100%); background: var(--text); color: #fff;
  padding: 6px 10px; border-radius: 6px; font-size: 0.8rem; white-space: nowrap; pointer-events: none; z-index: 5;
}
.membership-chart-tooltip strong { font-size: 0.95rem; margin: 0 2px; }
.membership-tooltip-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.membership-group-summary { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 var(--sp-4); }
.membership-group-summary p { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0; }

.membership-history-list { display: flex; flex-direction: column; gap: 6px; margin: var(--sp-3) 0; max-height: 320px; overflow-y: auto; }
.membership-history-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.9rem; }
.membership-history-icon { flex-shrink: 0; }

/* ---------- Detalhes/resumo expansíveis (ex: passo a passo do cookie do ML) ---------- */
.ml-credentials-help {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: var(--sp-4);
  max-width: 460px;
}
.ml-credentials-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
  list-style: none;
}
.ml-credentials-help summary::-webkit-details-marker { display: none; }
.ml-credentials-help summary::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  transition: transform 0.15s;
}
.ml-credentials-help[open] summary::before { transform: rotate(90deg); }
.ml-credentials-help summary:hover { color: var(--primary); }
.ml-credentials-help ol, .ml-credentials-help p { font-size: 0.85rem; color: var(--text-muted); margin-top: 10px; }
.ml-credentials-help li { margin-bottom: 6px; }

.group-filter { margin-left: 8px; }
.found-offers-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.found-offer-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: var(--sp-4); }
.found-offer-header { display: flex; gap: var(--sp-3); }
.found-offer-header img { width: 70px; height: 70px; object-fit: contain; flex-shrink: 0; }
.found-offer-header .title { margin: 2px 0; font-size: 0.95rem; }
.found-offer-header .price { color: var(--primary-dark); font-weight: 700; margin: 0; }
.found-offer-actions { display: flex; gap: var(--sp-2); margin-top: 10px; }
.found-offer-actions button { font-size: 0.85rem; padding: 6px 12px; }
.found-offer-actions .ignore-offer-btn { background: var(--error); }
.found-offer-editor { margin-top: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.found-offer-editor.hidden { display: none; }
.found-offer-editor textarea { width: 100%; padding: 10px; font-family: inherit; font-size: 0.9rem; resize: vertical; }

.history-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.history-table th, .history-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.history-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; background: var(--bg); }

.settings-form {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: var(--sp-6); max-width: 460px;
}
.settings-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.settings-form .priority-check { flex-direction: row; }
.message-template-input { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.85rem; resize: vertical; }
.auto-coupons-label code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 0.85em; }

.send-window-fields { display: flex; gap: 14px; margin: -6px 0 4px; }
.send-window-fields label { flex: 1; }

.vitrine-auto-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 18px; margin-bottom: var(--sp-4); }
.vitrine-auto-fields { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }

/* ---------- Planos (Assinatura) ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.plan-card--current { border-color: var(--primary); background: var(--primary-soft); }
.plan-card h4 { margin: 0; font-size: 1rem; font-weight: 700; }
.plan-card-price { font-size: 1.3rem; font-weight: 700; color: var(--primary-dark); margin: 0; }
.plan-card-price span { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.plan-card-groups { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 4px; }
.plan-card-unavailable { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.plan-card .secondary-btn, .plan-card .status-badge { margin-top: auto; }

.hidden { display: none !important; }

@media (max-width: 860px) {
  .sidebar { width: 68px; }
  .sidebar-brand-name, .tab-btn span, .sidebar-support { display: none; }
  .tab-btn { justify-content: center; }
  main { padding: var(--sp-4); }
  .content-header { padding: var(--sp-3) var(--sp-4); }
}
