/* ── Design tokens ───────────────────────────────────────────── */
:root {
  --brand-yellow: #FFE500;
  --brand-black: #000000;
  --sidebar-bg: #030303;
  --surface-page: #F4F6FA;
  --surface-card: #FFFFFF;
  --surface-soft: #F8FAFC;
  --border: #E4EAF2;
  --text: #0F172A;
  --muted: #64748B;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --danger: #EF4444;
  --danger-soft: #FEE2E2;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --info: #2563EB;
  --info-soft: #DBEAFE;
  --purple: #7C3AED;
  --purple-soft: #EDE9FE;
  --orange: #F97316;
  --orange-soft: #FFEDD5;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(15,23,42,0.04);
  /* legacy compat */
  --sidebar: #030303;
  --sidebar-2: #030303;
  --active: #FFE500;
  --active-text: #000;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --yellow: #FFE500;
  --yellow-dark: #E6CF00;
  --bg: #F4F6FA;
  --panel: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(15,23,42,0.04);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--surface-page); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #030303;
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
  padding: 20px 14px;
}
.sidebar-logo {
  padding: 8px 4px 24px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}
.sidebar-logo-img {
  height: 42px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: #FFE500;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #000; stroke: #000; }
.sidebar-logo-text { font-size: 16px; font-weight: 900; color: #fff; white-space: nowrap; transition: opacity .15s, width .22s; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.28);
  padding: 18px 12px 6px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s, color .12s;
  text-decoration: none;
  overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: #FFE500; color: #000; font-weight: 800; }
.nav-item.active svg { stroke: #000; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item--admin { border-top: 1px solid rgba(255,255,255,.07); padding-top: 12px; margin-top: 4px; }

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.plan-card-sb {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;
}
.plan-card-sb-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.plan-card-sb-name { font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap; transition: opacity .15s; }
.plan-card-sb-date { font-size: 11px; color: rgba(255,255,255,.45); white-space: nowrap; transition: opacity .15s; }
.plan-card-sb-link { font-size: 11px; color: #FFE500; font-weight: 700; text-decoration: none; white-space: nowrap; transition: opacity .15s; }
.user-card-sb {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
}
.user-avatar-sb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.user-name-sb { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; }
.user-role-sb { font-size: 11px; color: rgba(255,255,255,.4); transition: opacity .15s; }

/* ── Main content ────────────────────────────────────────────── */
.main {
  margin-left: 260px;
  min-height: 100vh;
  background: #F4F6FA;
  padding: 28px 24px;
  transition: margin-left .22s ease;
  max-width: 100%;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-hdr-left h1 { font-size: 26px; font-weight: 900; color: #0F172A; margin: 0; line-height: 1.1; }
.page-hdr-left p { margin: 4px 0 0; color: #64748B; font-size: 14px; }
.page-hdr-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* legacy page-header alias */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header h1 { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 900; color: #0F172A; }
.page-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-yellow, .btn.primary {
  background: #FFE500; color: #000; border: none; border-radius: 10px; height: 40px; padding: 0 18px;
  font-weight: 800; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .15s;
}
.btn-yellow:hover, .btn.primary:hover { background: #E6CF00; }
.btn-secondary, .btn.secondary {
  background: #fff; color: #374151; border: 1.5px solid #E4EAF2; border-radius: 10px; height: 40px; padding: 0 16px;
  font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: border-color .15s;
}
.btn-secondary:hover, .btn.secondary:hover { border-color: #000; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 10px;
  padding: 0 14px; border: 1px solid var(--border); background: #fff; color: #111827; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.btn-outline-sm {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
  font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; transition: border-color .15s;
}
.btn-outline-sm:hover { border-color: #000; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #E4EAF2;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}
.card-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 800; color: #0F172A; }
.card-body { padding: 20px; }

/* legacy panel alias */
.panel, .metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 20px; overflow: hidden; }
.panel h2 { margin: 0 0 14px; font-size: 17px; font-weight: 800; color: #0F172A; }
.metric { padding: 18px; position: relative; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin-top: 12px; font-size: 28px; letter-spacing: 0; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }

/* ── KPI Cards ───────────────────────────────────────────────── */
.kpi-card {
  background: #fff; border: 1px solid #E4EAF2; border-radius: 16px; padding: 20px;
  display: flex; align-items: flex-start; gap: 16px; box-shadow: var(--shadow-card);
}
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-label { font-size: 12px; color: #64748B; font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; color: #0F172A; line-height: 1.1; margin-top: 4px; }
.kpi-change { font-size: 12px; font-weight: 700; }
.kpi-change.up { color: #16A34A; }
.kpi-change.down { color: #EF4444; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-yellow { background: #FEF9C3; color: #A16207; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-gray { background: #F1F5F9; color: #475569; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 0; border-bottom: 1.5px solid #E4EAF2; margin-bottom: 24px; }
.tab-item {
  padding: 12px 20px; font-size: 14px; font-weight: 600; color: #64748B;
  border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1.5px; transition: color .15s;
}
.tab-item.active { color: #0F172A; border-bottom-color: #FFE500; font-weight: 800; }

/* legacy tabs */
.tabs { display: flex; gap: 10px; margin: 13px 0 18px; }
.tabs button { border: 0; background: transparent; padding: 8px 0; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs .active { color: #000; border-color: var(--yellow); }

/* ── Product Cards ───────────────────────────────────────────── */
.prod-card { background: #fff; border: 1px solid #E4EAF2; border-radius: 16px; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.prod-card:hover { box-shadow: 0 8px 32px rgba(15,23,42,.1); transform: translateY(-2px); }
.prod-card-img { aspect-ratio: 1; overflow: hidden; background: #F8FAFC; position: relative; }
.prod-card-img img { width: 100%; height: 100%; object-fit: contain; }
.prod-score { position: absolute; top: 8px; right: 8px; background: #fff; border: 1.5px solid #E4EAF2; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.prod-score.excellent { border-color: #22C55E; color: #15803D; }
.prod-score.very-good { border-color: #86EFAC; color: #166534; }
.prod-score.good { border-color: #FDE047; color: #A16207; }
.prod-cat-tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.prod-card-body { padding: 12px; }
.prod-name { font-size: 13px; font-weight: 700; color: #0F172A; line-height: 1.4; margin: 6px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-price { font-size: 17px; font-weight: 800; color: #0F172A; }
.prod-old-price { font-size: 12px; color: #94A3B8; text-decoration: line-through; }
.prod-discount { background: #FEE2E2; color: #991B1B; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
.prod-commission { font-size: 12px; color: #64748B; margin-top: 4px; }
.prod-commission span { color: #16A34A; font-weight: 800; }
.prod-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 12px; }
.prod-btn-queue { height: 36px; border: 1.5px solid #E4EAF2; border-radius: 8px; background: #fff; color: #374151; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s; }
.prod-btn-queue:hover { border-color: #000; background: #F8FAFC; }
.prod-btn-offer { height: 36px; border: none; border-radius: 8px; background: #FFE500; color: #000; font-size: 12px; font-weight: 800; cursor: pointer; transition: background .15s; }
.prod-btn-offer:hover { background: #E6CF00; }

/* ── Grids & Layout ──────────────────────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }

/* ── Flash messages ──────────────────────────────────────────── */
.flash { position: fixed; top: 16px; right: 16px; z-index: 50; background: #052e16; color: #dcfce7; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); }

/* ── Form elements ───────────────────────────────────────────── */
label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; color: #374151; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; background: #fff; color: #111827; outline: none; min-height: 42px; transition: border-color .12s ease; }
input:focus, select:focus, textarea:focus { border-color: #000; box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
textarea { line-height: 1.45; }

/* ── Login page ──────────────────────────────────────────────── */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #000; position: relative; }
.login-screen::before { content: ''; position: absolute; inset: 0; background: url('/assets/img/bgafiliaplace.png') center/cover no-repeat; opacity: .45; pointer-events: none; }
.login-wrap { position: relative; z-index: 1; }
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 28px; width: min(420px, 100%); }
.login-brand { width: 200px; height: auto; display: block; }
.login-card { width: 100%; background: #111; border-radius: 20px; padding: 32px 28px; box-shadow: 0 24px 64px rgba(0,0,0,.7); display: flex; flex-direction: column; gap: 18px; border: 1px solid rgba(255,255,255,.08); }
.login-card-header h1 { margin: 0 0 4px; font-size: 22px; color: #fff; }
.login-card-header p { margin: 0; color: #6b7280; font-size: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: 13px; font-weight: 700; color: #9ca3af; }
.login-pwd-wrap { position: relative; display: flex; align-items: center; }
.login-pwd-wrap input { flex: 1; padding-right: 44px; }
.login-eye { position: absolute; right: 12px; background: none; border: none; cursor: pointer; color: #6b7280; padding: 0; display: flex; align-items: center; transition: color .15s; }
.login-eye:hover { color: #FEE603; }
.login-eye svg { width: 18px; height: 18px; }
.login-field input { height: 44px; border: 1.5px solid #2a2a2a; border-radius: 10px; padding: 0 14px; font-size: 14px; color: #fff; background: #1a1a1a; outline: none; transition: border-color .15s; min-height: unset; width: 100%; }
.login-field input:focus { border-color: #FEE603; box-shadow: 0 0 0 3px rgba(254,230,3,.12); }
.login-btn { height: 46px; border: none; border-radius: 10px; background: #FEE603; color: #000; font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity .15s; }
.login-btn:hover { opacity: .88; }
.login-error { margin: 0; color: #f87171; font-size: 13px; font-weight: 600; }
.error { color: #b91c1c; font-weight: 700; }

/* ── Data tables ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.data-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 12px; border-bottom: 1px solid var(--border); background: #f8fafc; font-weight: 900; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: 0; }
.empty-cell { color: var(--muted); text-align: center; padding: 30px 16px !important; }
.table-panel { padding: 0; overflow: hidden; border-radius: var(--radius); }
.actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.actions a, .actions button { border: 0; background: transparent; color: #047857; padding: 0; cursor: pointer; font-weight: 700; min-height: 32px; border-radius: 8px; padding: 0 9px; color: #166534; background: #f0fdf4; display: inline-flex; align-items: center; }
.actions button { color: #991b1b; background: #fef2f2; }

/* ── Status badges ───────────────────────────────────────────── */
.status-badge { display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:700;padding:4px 12px;border-radius:999px;margin-left:12px;vertical-align:middle; white-space: nowrap; }
.status-badge.connected { background:#dcfce7;color:#166634; }
.status-badge.disconnected { background:#fee2e2;color:#991b1b; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 14px; padding: 18px 0 4px; flex-wrap: wrap; }
.pag-info { font-size: 12px; color: var(--muted); margin-left: 4px; }
.pag-btns { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pag-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text); background: #fff; border: 1.5px solid var(--border); text-decoration: none; transition: border-color .12s, background .12s, color .12s; line-height: 1; }
.pag-btn:hover { border-color: #000; background: #f1f5f9; }
.pag-btn.active { background: #000; color: #fff; border-color: #000; }
.pag-btn.pag-arrow { font-size: 15px; color: var(--muted); border-color: transparent; background: transparent; }
.pag-btn.pag-arrow:hover { background: #f1f5f9; border-color: var(--border); color: var(--text); }

/* ── WA / Evolution styles ───────────────────────────────────── */
.wa-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.wa-instance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.wa-instance-card { display: grid; gap: 14px; min-width: 0; }
.wa-instance-card.is-on { border-color: rgba(22, 163, 74, .36); }
.wa-instance-head, .wa-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.wa-instance-head h2, .wa-card-head h2, .wa-qr-panel h2, .wa-test-panel h2 { margin: 0; font-size: 20px; line-height: 1.15; }
.wa-instance-head p, .wa-empty-qr p { margin: 6px 0 0; color: var(--muted); line-height: 1.35; }
.wa-kicker { display: block; font-size: 11px; color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.wa-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.wa-meta div { min-width: 0; border: 1px solid #e5e7eb; border-radius: 10px; background: #f8fafc; padding: 9px 10px; }
.wa-meta dt { color: #64748b; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.wa-meta dd { margin: 4px 0 0; color: #0f172a; font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.wa-action-buttons form { margin: 0; }
.wa-empty-qr { min-height: 224px; display: grid; place-items: center; text-align: center; align-content: center; gap: 8px; color: var(--text); border: 1px dashed #cbd5e1; border-radius: 14px; background: #f8fafc; }
.wa-phone-icon { width: 74px; height: 74px; border-radius: 20px; background: #dcfce7; color: #166534; display: grid; place-items: center; font-weight: 900; }
.wa-instance-settings { border-top: 1px solid var(--border); padding-top: 12px; }
.wa-instance-settings summary { cursor: pointer; font-weight: 900; color: #334155; }
.wa-instance-settings .form-grid { margin-top: 14px; }
.wa-form-actions, .wa-delete-form { display: flex; gap: 8px; align-items: center; }
.wa-delete-form { margin-top: 8px; }
.wa-test-panel { max-width: 780px; }
.wa-test-form { display: grid; gap: 12px; margin-top: 14px; }

/* ── Utility boxes ───────────────────────────────────────────── */
.result-box { max-height: 320px; overflow: auto; background: #0b1624; color: #d1fae5; border-radius: 14px; padding: 14px; font-size: 12px; line-height: 1.5; }
.setup-box { display: grid; gap: 7px; border: 1px solid #bbf7d0; background: #f0fdf4; color: #14532d; border-radius: 14px; padding: 13px; margin: 12px 0; }
.setup-box code { display: block; color: #052e16; background: #dcfce7; border-radius: 9px; padding: 8px 10px; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.error-box { display: grid; gap: 5px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; border-radius: 14px; padding: 13px; margin: 12px 0; }
.error-box span, .error-box small { color: #7f1d1d; line-height: 1.4; }
.success-box { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 800; margin: 0 0 14px; }
.qr-box { display: grid; gap: 12px; justify-items: start; border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-top: 14px; }
.qr-box img, #qrCode { width: 220px; min-height: 220px; background: #fff; padding: 10px; border: 1px solid var(--border); border-radius: 14px; }

/* ── Bot/Automation styles ───────────────────────────────────── */
.automation-top { display: grid; grid-template-columns: 1fr auto auto auto; }
.autosave { display: inline-flex; align-items: center; gap: 7px; color: #047857; background: #ecfdf5; border: 1px solid #bbf7d0; border-radius: 999px; padding: 9px 12px; font-size: 13px; font-weight: 800; }
.automation-shell { height: calc(100vh - 128px); min-height: 660px; display: grid; grid-template-rows: auto 1fr; background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.flow-header { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.flow-header a { color: #047857; font-weight: 800; }
.flow-header strong { font-size: 16px; outline: none; }
.status { margin-left: auto; border-radius: 999px; background: #f3f4f6; color: #374151; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.canvas-wrap { position: relative; display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
.canvas-grid { position: relative; overflow: hidden; background-color: #fff; background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 18px 18px; }
#edgesLayer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.node { position: absolute; width: 238px; min-height: 104px; background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--node-color, var(--green)); border-radius: 18px; padding: 13px 14px 13px 16px; box-shadow: 0 14px 35px rgba(15,23,42,.13); cursor: grab; user-select: none; }
.node:active { cursor: grabbing; }
.node small { display: block; color: var(--node-color, var(--green)); text-transform: uppercase; font-size: 11px; font-weight: 900; letter-spacing: .05em; }
.node strong { display: block; margin-top: 7px; font-size: 14px; }
.node p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.handle { position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: var(--node-color, var(--green)); border: 3px solid #fff; border-radius: 999px; box-shadow: 0 0 0 1px var(--border); }
.handle.in { left: -7px; right: auto; background: #94a3b8; }
.canvas-toolbar { position: absolute; left: 18px; top: 70px; z-index: 5; display: grid; gap: 7px; background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 16px; padding: 7px; box-shadow: var(--shadow); }
.canvas-toolbar button, .bottom-center button { width: 34px; height: 34px; border: 0; border-radius: 11px; background: #fff; color: #334155; font-weight: 900; cursor: pointer; }
.canvas-toolbar button:first-child { background: var(--green-soft); color: #047857; }
.components-panel { border-left: 1px solid var(--border); padding: 18px; overflow: auto; background: #f8fafc; }
.component-group { margin-bottom: 18px; }
.component-group h4 { margin: 0 0 8px; font-size: 11px; color: #94a3b8; letter-spacing: .08em; }
.component { width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 11px 12px; margin-bottom: 8px; cursor: grab; }
.component strong { display: block; font-size: 13px; }
.component span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.template-card { width: 100%; border: 1px solid #bbf7d0; border-radius: 16px; background: #f0fdf4; padding: 14px; text-align: left; cursor: pointer; }
.template-card span { display: block; color: #166534; font-size: 12px; margin-top: 4px; }
.bottom-left, .bottom-center, .zoom { position: absolute; z-index: 6; }
.bottom-left { left: 18px; bottom: 18px; }
.bottom-center { left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 4px; padding: 7px; border-radius: 15px; border: 1px solid var(--border); background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.zoom { right: 340px; bottom: 18px; display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); background: #fff; border-radius: 13px; padding: 9px 12px; font-weight: 900; box-shadow: var(--shadow); }
dialog { border: 0; border-radius: 18px; box-shadow: var(--shadow); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15,23,42,.36); }
dialog h3 { margin: 0 0 14px; }
dialog form { display: grid; gap: 12px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }

/* ── Lists & misc ────────────────────────────────────────────── */
.clean-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.clean-list li { display: flex; align-items: center; gap: 9px; color: #334155; font-size: 14px; }
.clean-list li::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--green); flex-shrink: 0; }
.muted-copy { color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.bars div { margin: 14px 0; }
.bars span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 7px; }
.bars i { display: block; height: 9px; border-radius: 999px; background: var(--green); }

/* ── Dashboard special styles ────────────────────────────────── */
.dash-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; padding: 22px 24px; border: 1px solid rgba(255,229,0,.3); border-radius: 16px; background: linear-gradient(135deg, #FFFCE0, #FFF9CC); }
.dash-hero h2 { margin: 0; color: #0f172a; font-size: clamp(22px,3vw,32px); font-weight: 900; line-height: 1; }
.dash-hero p { margin: 8px 0 0; color: #475569; font-size: 14px; font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.dash-panel h2 { margin-bottom: 12px; }
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dash-panel-head h2 { margin: 0; }
.dash-panel-head a { color: #047857; font-size: 12px; font-weight: 900; }
.dash-status-list, .dash-send-list { display: grid; gap: 8px; }
.dash-status { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; min-height: 46px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; text-decoration: none; }
.dash-status > span { width: 10px; height: 10px; border-radius: 999px; }
.dash-status > span.ok { background: #22c55e; }
.dash-status > span.warn { background: #f59e0b; }
.dash-status strong { font-size: 13px; }
.dash-status em { color: #64748b; font-size: 12px; font-style: normal; font-weight: 800; text-align: right; }
.dash-send { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 54px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.market-mini { width: 46px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #f8fafc; }
.market-mini img { width: 40px; height: 24px; object-fit: contain; }
.dash-send strong, .dash-send small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-send strong { font-size: 13px; }
.dash-send small { margin-top: 3px; color: #64748b; font-size: 11px; font-weight: 700; }
.send-state { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 900; }
.state-sent { background: #dcfce7; color: #166534; }
.state-failed { background: #fee2e2; color: #991b1b; }
.state-pending { background: #fef3c7; color: #92400e; }
.dash-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dashboard-header { align-items: flex-start; }
.dash-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-metric { min-height: 106px; }

/* ── Checklist items ─────────────────────────────────────────── */
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist-item:last-child { border-bottom: none; }
.checklist-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.checklist-check.done { background: #16A34A; border-color: #16A34A; color: #fff; }
.checklist-label { flex: 1; font-size: 14px; color: var(--text); font-weight: 600; }
.checklist-label.done { text-decoration: line-through; color: var(--muted); }
.checklist-action { font-size: 12px; color: var(--info); font-weight: 700; text-decoration: none; }
.checklist-action:hover { text-decoration: underline; }

/* ── Market chips ────────────────────────────────────────────── */
.market-chip { display: inline-flex; align-items: center; gap: 7px; width: max-content; max-width: 100%; padding: 5px 9px; border: 1px solid #e5e7eb; border-radius: 999px; background: #fff; color: #334155; font-size: 12px; font-weight: 800; white-space: nowrap; min-width: 94px; min-height: 30px; }
.market-chip img { width: 96px; height: 24px; object-fit: contain; flex: 0 0 auto; }

/* ── Marketplace / Produtos styles ───────────────────────────── */
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(270px,1fr)); gap: 20px; padding: 24px 0; }
.mkt-card { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 16px; padding: 24px; transition: border-color .2s; }
.mkt-card--connected { border-color: #22c55e; }
.mkt-card--soon { opacity: .7; pointer-events: none; }
.mkt-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mkt-plat-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 8px; }
.mkt-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.mkt-status-ok { background: #dcfce7; color: #15803d; }
.mkt-status-off { background: #f1f5f9; color: #64748b; }
.mkt-status-soon { background: #fef9c3; color: #a16207; }
.mkt-help { font-size: 13px; color: #64748b; margin-bottom: 16px; line-height: 1.5; }
.mkt-form { display: flex; flex-direction: column; gap: 12px; }
.mkt-field { display: flex; flex-direction: column; gap: 4px; }
.mkt-field label { font-size: 12px; font-weight: 700; color: #374151; }
.mkt-field input { height: 38px; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 0 12px; font-size: 13px; outline: none; min-height: unset; }
.mkt-field input:focus { border-color: #FFE500; box-shadow: none; }
.mkt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-primary { background: #FFE500; color: #000; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background .15s; }
.btn-primary:hover:not([disabled]) { background: #e6cf00; }
.btn-ghost { background: #f1f5f9; color: #374151; border: 1.5px solid #e2e8f0; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.mkt-oauth-btn { display: flex; align-items: center; gap: 10px; justify-content: center; background: #ffe600; color: #2d3277; font-weight: 800; font-size: 14px; padding: 12px 20px; border-radius: 10px; text-decoration: none; margin-top: 4px; transition: background .15s; }
.mkt-oauth-btn:hover { background: #e6cf00; }
.mkt-tracking-notice { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.mkt-tracking-notice strong { font-size: 13px; color: #15803d; display: block; margin-bottom: 4px; }
.mkt-tracking-notice p { font-size: 12px; color: #166534; margin: 0; }

/* ML Browser */
.ml-setup-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: #fffbeb; border: 1.5px solid #fde68a; border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ml-setup-banner div { display: flex; flex-direction: column; gap: 4px; }
.ml-setup-banner strong { font-size: 14px; color: #92400e; }
.ml-setup-banner span { font-size: 13px; color: #78350f; }
.ml-browser { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-top: 16px; }
.ml-browser-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.ml-browser-head p { font-size: 13px; color: #64748b; }
.ml-controls { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.ml-select { flex: 1; min-width: 200px; height: 40px; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 0 12px; font-size: 14px; outline: none; background: #fff; min-height: unset; }
.ml-select:focus { border-color: #FFE500; }
.ml-prod-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 16px; }
.ml-prod-card { border: 1.5px solid #f0f0f0; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; background: #fff; }
.ml-prod-card:hover { border-color: #FFE500; }
.ml-prod-card img { width: 100%; height: 160px; object-fit: contain; background: #fafafa; padding: 8px; }
.ml-prod-info { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ml-prod-title { font-size: 12px; font-weight: 600; color: #1e293b; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.ml-prod-price { font-size: 14px; font-weight: 800; color: #059669; }
.ml-aff-link { font-size: 11px; color: #6366f1; text-decoration: none; margin-top: auto; }
.ml-aff-link:hover { text-decoration: underline; }
.ml-add-btn { margin: 8px 12px 12px; width: calc(100% - 24px); background: #FFE500; color: #000; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background .15s; padding: 8px; }
.ml-add-btn:hover:not([disabled]) { background: #e6cf00; }
.ml-loading { grid-column: 1/-1; text-align: center; padding: 40px; color: #64748b; font-size: 14px; }
.ml-empty { grid-column: 1/-1; text-align: center; padding: 40px; color: #64748b; }
.ml-status-msg { margin-top: 12px; font-size: 13px; color: #dc2626; text-align: center; }
.ml-load-more { display: block; width: 100%; margin-top: 20px; padding: 12px; background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 14px; font-weight: 700; color: #374151; cursor: pointer; transition: all .15s; }
.ml-load-more:hover { border-color: #000; background: #fff; }

/* ── Bot/automation card styles ──────────────────────────────── */
.page-sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.auto-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; background: #fff; border: 1px solid var(--border); border-radius: 16px; text-align: center; }
.auto-empty-icon { font-size: 48px; }
.auto-empty h3 { margin: 0; font-size: 18px; font-weight: 800; }
.auto-empty p { margin: 0; color: var(--muted); font-size: 14px; }

/* ── Platform / plat cards ───────────────────────────────────── */
.platform-card { border-radius: 12px; }
.platform-card--soon { opacity: .55; cursor: not-allowed; position: relative; }
.platform-card--soon:hover { opacity: .65; transform: none !important; }
.plat-soon-badge { position: absolute; top: -8px; right: -8px; background: #f97316; color: #fff; font-size: 9px; font-weight: 900; padding: 2px 6px; border-radius: 999px; white-space: nowrap; letter-spacing: .04em; text-transform: uppercase; }

/* ── Admin legacy ────────────────────────────────────────────── */
.admin-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.panel-title { font-size: 15px; font-weight: 800; margin-bottom: 18px; color: var(--text); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-plan-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-plan-row:last-child { border-bottom: none; }
.admin-plan-info { min-width: 120px; }
.admin-plan-info strong { display: block; font-size: 14px; }
.admin-plan-info span { font-size: 12px; color: var(--muted); }
.admin-plan-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.admin-plan-bar { height: 100%; background: #000; border-radius: 999px; transition: width .4s; }
.admin-bar-chart { display: flex; align-items: flex-end; gap: 12px; padding: 16px 0 0; min-height: 148px; }
.admin-bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.admin-bar { background: #000; border-radius: 6px 6px 0 0; width: 100%; min-height: 4px; transition: height .4s; }
.admin-bar-value { font-size: 12px; font-weight: 700; color: var(--text); }
.admin-bar-label { font-size: 11px; color: var(--muted); }

/* ── Investor Admin KPI ──────────────────────────────────────── */
.adm-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: .05em; border-radius: 999px; padding: 2px 10px; }
.adm-badge--live { background: #dcfce7; color: #166534; animation: adm-pulse 2s infinite; }
@keyframes adm-pulse { 0%,100%{opacity:1} 50%{opacity:.6} }
.adm-notif { display: inline-flex; align-items: center; justify-content: center; background: #ef4444; color: #fff; font-size: 10px; font-weight: 900; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; }
.adm-kpi-grid { display: grid; gap: 16px; margin-bottom: 20px; }
.adm-kpi-grid--4 { grid-template-columns: repeat(4, 1fr); }
.adm-kpi-grid--5 { grid-template-columns: repeat(5, 1fr); }
.adm-kpi { background: #fff; border: 1.5px solid var(--border); border-radius: 16px; padding: 18px 20px; display: flex; align-items: flex-start; gap: 14px; transition: box-shadow .15s; }
.adm-kpi:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.adm-kpi--hero { background: #000; border-color: #000; }
.adm-kpi--hero .adm-kpi-label { color: rgba(255,255,255,.55); }
.adm-kpi--hero .adm-kpi-value { color: #fff; }
.adm-kpi--hero .adm-kpi-sub { color: rgba(255,255,255,.45); }
.adm-kpi--warn { border-color: #fbbf24; background: #fffbeb; }
.adm-kpi-icon { font-size: 22px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.adm-kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.adm-kpi-value { font-size: 26px; font-weight: 900; color: var(--text); letter-spacing: -.03em; line-height: 1.1; }
.adm-kpi-sub { font-size: 12px; color: var(--muted); }
.adm-kpi-sub--green { color: #16a34a; font-weight: 700; }
.adm-charts-row { display: grid; grid-template-columns: 1.8fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.adm-chart-panel { overflow: hidden; }
.adm-area-chart { width: 100%; height: auto; display: block; overflow: visible; }
.adm-donut-wrap { display: flex; align-items: center; gap: 20px; }
.adm-donut-legend { display: flex; flex-direction: column; gap: 10px; }
.adm-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.adm-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.adm-legend-name { flex: 1; font-weight: 600; }
.adm-legend-val { font-size: 12px; color: var(--muted); font-weight: 700; }
.adm-health-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.adm-health-item { text-align: center; padding: 16px 8px; border-radius: 12px; background: #f8fafc; border: 1.5px solid var(--border); }
.adm-health-item--warn { background: #fffbeb; border-color: #fbbf24; }
.adm-health-icon { font-size: 22px; margin-bottom: 6px; }
.adm-health-num { font-size: 22px; font-weight: 900; color: var(--text); letter-spacing: -.02em; line-height: 1; }
.adm-health-total { font-size: 14px; color: var(--muted); font-weight: 600; }
.adm-health-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.adm-empty-support { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px; color: var(--muted); }
.adm-ticket-thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.adm-reply { max-width: 78%; padding: 14px 18px; border-radius: 14px; }
.adm-reply--user { align-self: flex-start; background: #f1f5f9; border-bottom-left-radius: 4px; }
.adm-reply--admin { align-self: flex-end; background: #000; color: #fff; border-bottom-right-radius: 4px; }
.adm-reply-author { font-size: 11px; font-weight: 700; margin-bottom: 6px; opacity: .6; }
.adm-reply-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.adm-reply-time { font-size: 10px; margin-top: 8px; opacity: .5; text-align: right; }

/* ── Support Chat Drawer ─────────────────────────────────────── */
.chat-fab { position: fixed; bottom: 28px; right: 28px; z-index: 1000; width: 56px; height: 56px; border-radius: 50%; background: #000; color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 32px rgba(0,0,0,.28); transition: transform .18s, box-shadow .18s; }
.chat-fab svg { width: 22px; height: 22px; }
.chat-fab:hover { transform: scale(1.07); box-shadow: 0 12px 40px rgba(0,0,0,.36); }
.chat-fab.is-open { transform: scale(.95); }
.chat-fab-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 900; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid #fff; }
.chat-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 998; opacity: 0; pointer-events: none; transition: opacity .22s; }
.chat-overlay.is-visible { opacity: 1; pointer-events: all; }
.chat-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 95vw; background: #fff; z-index: 999; display: flex; flex-direction: column; box-shadow: -8px 0 48px rgba(0,0,0,.16); transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1); }
.chat-drawer.is-open { transform: translateX(0); }
.chat-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.chat-drawer-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: #0f172a; }
.chat-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: #f1f5f9; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.chat-close svg { width: 16px; height: 16px; stroke: #64748b; }
.chat-close:hover { background: #e2e8f0; }
.chat-tabs { display: flex; gap: 0; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.chat-tab { flex: 1; padding: 10px; font-size: 13px; font-weight: 600; color: #64748b; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: color .15s, border-color .15s; }
.chat-tab.is-active { color: #000; border-bottom-color: #000; }
.chat-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.chat-threads-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.chat-thread-item { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 10px; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, background .15s; }
.chat-thread-item:hover { background: #f8fafc; border-color: #000; }
.chat-thread-item.has-unread { border-color: #000; background: #fafafa; }
.chat-thread-info { flex: 1; min-width: 0; }
.chat-thread-subj { display: block; font-size: 13px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-meta { display: block; font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-thread-badge { min-width: 20px; height: 20px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 900; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; }
.chat-thread-status { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex-shrink: 0; }
.chat-status-open { background: #fee2e2; color: #991b1b; }
.chat-status-closed { background: #dcfce7; color: #166534; }
.chat-status-pending { background: #fef3c7; color: #92400e; }
.chat-conv-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
.chat-back { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: #64748b; background: none; border: none; cursor: pointer; padding: 4px 0; }
.chat-back:hover { color: #000; }
.chat-conv-title { font-size: 12px; font-weight: 700; color: #0f172a; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #f8fafc; }
.chat-msg { max-width: 80%; }
.chat-msg--user { align-self: flex-start; }
.chat-msg--admin { align-self: flex-end; }
.chat-msg-author { font-size: 10px; font-weight: 700; color: #94a3b8; margin-bottom: 4px; }
.chat-msg--admin .chat-msg-author { text-align: right; }
.chat-msg-body { padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.55; }
.chat-msg--user .chat-msg-body { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; color: #0f172a; }
.chat-msg--admin .chat-msg-body { background: #000; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg-time { font-size: 9px; color: #94a3b8; margin-top: 3px; }
.chat-msg--admin .chat-msg-time { text-align: right; }
.chat-reply-input { flex: 1; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 8px 12px; font-size: 13px; resize: none; outline: none; font-family: inherit; transition: border-color .15s; min-height: unset; }
.chat-reply-input:focus { border-color: #000; box-shadow: none; }
.chat-reply-send { width: 36px; height: 36px; border-radius: 8px; background: #000; color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: flex-end; transition: background .15s; }
.chat-reply-send svg { width: 15px; height: 15px; }
.chat-reply-send:hover { background: #222; }
.chat-input { border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; font-size: 13px; outline: none; transition: border-color .15s; font-family: inherit; }
.chat-input:focus { border-color: #000; box-shadow: none; }
.chat-textarea { border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; font-size: 13px; resize: vertical; outline: none; transition: border-color .15s; font-family: inherit; }
.chat-textarea:focus { border-color: #000; box-shadow: none; }
.chat-send-btn { padding: 10px; border-radius: 10px; background: #000; color: #fff; font-size: 14px; font-weight: 700; border: none; cursor: pointer; transition: background .15s; }
.chat-send-btn:hover { background: #222; }
.chat-loading { text-align: center; padding: 24px; font-size: 13px; color: #64748b; margin: auto; }
.chat-empty { text-align: center; padding: 24px 16px; font-size: 13px; color: #64748b; line-height: 1.6; }

/* ── Dispatch grid ───────────────────────────────────────────── */
.dispatch-grid { display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start; }

/* ── App list panels ─────────────────────────────────────────── */
.app-list-panel { padding: 0; overflow: hidden; border-radius: 12px; }
.list-search { min-height: 42px; background: #fff; border-radius: 10px; }
.compact-actions { display: flex; gap: 8px; }
.btn.compact { min-height: 34px; padding: 0 10px; font-size: 12px; }
.gtl-item, .lead-item, .hist-item { min-height: 64px; }
.gtl-name, .lead-name, .hist-title { color: #111827; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .metrics-grid, .dash-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wa-instance-grid { grid-template-columns: 1fr; }
  .adm-kpi-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .adm-kpi-grid--5 { grid-template-columns: repeat(3, 1fr); }
  .adm-charts-row { grid-template-columns: 1fr; }
  .adm-health-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 980px) {
  .content-grid, .form-grid, .dash-grid { grid-template-columns: 1fr; }
  .automation-top { grid-template-columns: 1fr; align-items: stretch; }
  .automation-shell { height: auto; min-height: 880px; }
  .canvas-wrap { grid-template-columns: 1fr; grid-template-rows: 560px auto; }
  .components-panel { border-left: 0; border-top: 1px solid var(--border); }
  .zoom { right: 18px; }
}

/* ── Mobile overlay ──────────────────────────────────────────── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 25;
  opacity: 0;
  transition: opacity .25s;
}
.mobile-overlay.visible { opacity: 1; }

/* ── Mobile hamburger (fixed, no header bar) ─────────────────── */
.burger-btn {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; flex-shrink: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.burger-btn:active { background: rgba(255,255,255,.16); }
.burger-btn svg { width: 18px; height: 18px; }
/* Fixed hamburger in top-left when no header */
.mobile-burger-fixed {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  z-index: 40;
}

/* Sidebar close btn - visible only on mobile */
.sidebar-mobile-close {
  display: none;
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  align-items: center; justify-content: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-mobile-close svg { width: 14px; height: 14px; }

/* ── Sidebar locked nav item ─────────────────────────────────── */
.nav-item--locked {
  opacity: .45;
  cursor: default;
  pointer-events: auto;
}
.nav-item--locked:hover { background: transparent !important; color: rgba(255,255,255,.45) !important; }
.nav-lock-icon {
  width: 13px; height: 13px;
  margin-left: auto;
  opacity: .6;
  flex-shrink: 0;
}
.plan-card-sb--upgrade {
  display: block;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid rgba(255,229,0,.3) !important;
}
.plan-card-sb--upgrade:hover { border-color: rgba(255,229,0,.6) !important; }

/* ── Responsive: medium (≤1100px) ────────────────────────────── */
@media (max-width: 1100px) {
  .dash-main { grid-template-columns: minmax(0,1.1fr) minmax(0,0.9fr) !important; }
  .dash-right-col { grid-column: 1 / -1 !important; display: grid !important; grid-template-columns: repeat(3,1fr) !important; flex-direction: row !important; }
}

/* ── Responsive: mobile (≤760px) ────────────────────────────── */
@media (max-width: 760px) {
  .burger-btn { display: flex; }
  .sidebar-mobile-close { display: flex; }
  .sidebar-edge-btn { display: none !important; }

  /* ── Sidebar: slide-in, fixo, altura total iOS-safe ── */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: auto !important;
    width: 260px !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    min-height: 100vh !important;
    transform: translateX(-260px) !important;
    transition: transform .3s cubic-bezier(.4,0,.2,1) !important;
    z-index: 30 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    /* logo visible in sidebar, padding from top for safe area + close btn */
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 14px 24px !important;
    flex-direction: column !important;
    display: flex !important;
  }
  body.sidebar-open .sidebar { transform: translateX(0) !important; }
  body.sidebar-open .mobile-overlay { display: block; }

  /* Nav items: empilhados, sem esticar */
  .sidebar-nav {
    flex: 0 0 auto !important;
    overflow-y: visible !important;
  }
  .sidebar-logo {
    display: flex !important;
    margin-bottom: 12px !important;
    padding-top: 32px !important; /* space for close button */
  }
  .sidebar-bottom {
    margin-top: auto;
  }

  /* ── Main: no header, just safe area + padding ── */
  .main {
    margin-left: 0 !important;
    padding: 14px !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 60px) !important;
  }

  /* ── Dashboard mobile ── */
  .dash-page-hdr { flex-direction: column !important; gap: 10px !important; margin-bottom: 14px !important; }
  .dash-page-hdr h1 { font-size: 21px !important; }
  .dash-hdr-actions { display: none !important; }

  .dash-hero {
    padding: 16px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .dash-hero-icon { width: 44px !important; height: 44px !important; font-size: 22px !important; }
  .dash-hero-right { display: none !important; }
  .dash-hero-title { font-size: 14px !important; flex-wrap: wrap !important; }
  .dash-hero-sub { font-size: 12px !important; }

  .dash-kpi-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }
  .dash-kpi { padding: 12px 14px !important; }
  .dash-kpi-value { font-size: 22px !important; }
  .dash-kpi-header { margin-bottom: 6px !important; }
  .dash-sparkline { display: none !important; }

  .dash-main {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 12px !important;
  }
  .dash-col-check, .dash-col-offers, .dash-col-results, .dash-right-col {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  .dash-card-hdr { padding: 14px 16px 10px !important; }
  .dash-card-body { padding: 0 16px 14px !important; }
  .dash-card-title { font-size: 13px !important; }

  .dash-top-offers-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 0 12px 12px !important;
  }
  .dash-prod-thumb { height: 80px !important; }
  .dash-prod-thumb-emoji { font-size: 30px !important; }
  .dash-prod-body { padding: 6px 8px 8px !important; }
  .dash-prod-name { font-size: 10px !important; height: 26px !important; }

  /* Resultados: scroll horizontal */
  .dash-rt-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }

  /* Checklist condensado */
  .dash-check-item { padding: 8px 0 !important; }
  .dash-check-name { font-size: 12px !important; }
  .dash-check-desc { display: none !important; }

  /* General */
  .page-header, .page-hdr { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .page-header h1, .page-hdr-left h1 { font-size: 20px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric, .panel { border-radius: 12px; }
  .panel { padding: 14px; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .adm-kpi-grid--4, .adm-kpi-grid--5 { grid-template-columns: repeat(2, 1fr); }
  .adm-health-grid { grid-template-columns: repeat(2, 1fr); }
  .dispatch-grid { grid-template-columns: 1fr; }
  .admin-row-2 { grid-template-columns: 1fr; }
  .wa-summary-grid, .wa-meta { grid-template-columns: 1fr; }
  .wa-action-buttons { display: grid; grid-template-columns: 1fr; }
  .wa-action-buttons .btn, .wa-action-buttons form { width: 100%; }
  /* View-specific grids: 2col → 1col */
  .co-grid, .pa-grid, .cns-grid, .res-grid, .ig-grid, .sup-grid, .cfg-grid, .prd-grid { grid-template-columns: 1fr !important; }
  /* KPI bars */
  .kpi-bar { grid-template-columns: repeat(2, 1fr) !important; }
  /* Buttons / actions full-width */
  .co-grid .btn, .pa-grid .btn { width: 100%; }
  /* Produto cards 2col on small mobile */
  .prd-cards { grid-template-columns: 1fr 1fr !important; }
}

/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM ADDITIONS — Icon boxes, empty states, loaders
   ═══════════════════════════════════════════════════════════════ */

/* ── Icon box (replaces emoji wrapper divs) ──────────────────── */
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
}
.icon-box svg { display: block; }
.icon-box--sm  { width: 32px; height: 32px; border-radius: 8px; }
.icon-box--md  { width: 38px; height: 38px; border-radius: 10px; }
.icon-box--lg  { width: 44px; height: 44px; border-radius: 12px; }
.icon-box--xl  { width: 52px; height: 52px; border-radius: 14px; }
.icon-box--circle { border-radius: 50%; }

/* colour variants */
.icon-box--yellow  { background: #FEF9C3; color: #A16207; }
.icon-box--yellow-strong { background: #FFE500; color: #000; }
.icon-box--green   { background: #DCFCE7; color: #16A34A; }
.icon-box--red     { background: #FEE2E2; color: #DC2626; }
.icon-box--blue    { background: #DBEAFE; color: #2563EB; }
.icon-box--purple  { background: #EDE9FE; color: #7C3AED; }
.icon-box--gray    { background: #F1F5F9; color: #64748B; }
.icon-box--black   { background: #0F172A; color: #fff; }
.icon-box--white   { background: #fff; border: 1.5px solid #E4EAF2; color: #0F172A; }

/* ── Loader / spinner ────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid #E4EAF2;
  border-top-color: #0F172A;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner--sm  { width: 14px; height: 14px; border-width: 2px; }
.spinner--lg  { width: 26px; height: 26px; border-width: 3px; }
.spinner--yellow { border-color: rgba(255,229,0,.3); border-top-color: #E6CF00; }
.spinner--white  { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

/* Skeleton shimmer */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 24px;
  gap: 10px;
}
.empty-state__icon {
  width: 52px; height: 52px;
  background: #F1F5F9;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #94A3B8;
  margin-bottom: 2px;
}
.empty-state__icon svg { width: 24px; height: 24px; }
.empty-state__title  { font-size: 14px; font-weight: 800; color: #0F172A; margin: 0; }
.empty-state__desc   { font-size: 13px; color: #64748B; line-height: 1.5; margin: 0; max-width: 280px; }

/* ── Status dot ──────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--green  { background: #22C55E; box-shadow: 0 0 0 3px #DCFCE7; }
.status-dot--red    { background: #EF4444; box-shadow: 0 0 0 3px #FEE2E2; }
.status-dot--yellow { background: #F59E0B; box-shadow: 0 0 0 3px #FEF3C7; }
.status-dot--gray   { background: #CBD5E1; }

/* ── Financial value highlight ───────────────────────────────── */
.val-money  { color: #16A34A; font-weight: 800; }
.val-muted  { color: #64748B; }
.val-danger { color: #DC2626; font-weight: 700; }

/* ── Section header (page blocks) ───────────────────────────── */
.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.section-hdr__title { font-size: 14px; font-weight: 800; color: #0F172A; }
.section-hdr__sub   { font-size: 12px; color: #64748B; margin-top: 2px; }

/* ── Active filter chip ──────────────────────────────────────── */
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: #F1F5F9; color: #64748B;
  border: 1.5px solid transparent;
  cursor: pointer; transition: all .15s;
}
.filter-chip:hover  { border-color: #CBD5E1; color: #0F172A; }
.filter-chip.active { background: #FFE500; color: #000; border-color: #E6CF00; }

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar {
  width: 100%; height: 6px;
  background: #F1F5F9; border-radius: 6px; overflow: hidden;
}
.progress-bar__fill {
  height: 100%; border-radius: 6px;
  background: #FFE500; transition: width .4s;
}
.progress-bar__fill--green  { background: #22C55E; }
.progress-bar__fill--red    { background: #EF4444; }

/* ── Connection badge (inline status) ───────────────────────── */
.conn-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 700;
}
.conn-badge--ok   { background: #DCFCE7; color: #15803D; }
.conn-badge--off  { background: #F1F5F9; color: #64748B; }
.conn-badge--err  { background: #FEE2E2; color: #991B1B; }
.conn-badge--sync { background: #DBEAFE; color: #1D4ED8; }
