/* ═══════════════════════════════════════════
   CAMPAIGN TRACKER v2 — Command Center Dark
   ═══════════════════════════════════════════ */

:root {
  --bg: #0a0a14;
  --surface: #12121e;
  --surface-2: #1a1a2e;
  --surface-3: #22223a;
  --border: #2a2a3e;
  --border-light: #33334a;

  --text: #f0f0f5;
  --text-2: #8888a0;
  --text-3: #555570;

  --accent: #5b8def;
  --accent-glow: rgba(91, 141, 239, 0.15);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.12);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, 0.12);

  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ═══ ANIMATIONS ═══ */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ═══ LOGIN PAGE ═══ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 20%, transparent 70%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.login-logo h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.login-sub {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
}
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
  text-align: center;
}

/* ═══ FORM ELEMENTS ═══ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
input, select, textarea {
  font-family: var(--font);
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-3); }
input[type="password"] { font-family: var(--mono); letter-spacing: 2px; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-light); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #4a7ce0; border-color: #4a7ce0; }

.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--xs { padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.btn--full { width: 100%; }

.btn--green { border-color: var(--green); color: var(--green); background: transparent; }
.btn--green:hover { background: var(--green-bg); }
.btn--red { border-color: var(--red); color: var(--red); background: transparent; }
.btn--red:hover { background: var(--red-bg); }
.btn--orange { border-color: var(--orange); color: var(--orange); background: transparent; }
.btn--orange:hover { background: var(--orange-bg); }
.btn--purple { border-color: var(--purple); color: var(--purple); }
.btn--purple:hover { background: var(--purple-bg); }

/* ═══ APP LAYOUT ═══ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 50;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar__logo { flex-shrink: 0; }
.sidebar__title { display: block; font-size: 14px; font-weight: 700; letter-spacing: -0.3px; }
.sidebar__subtitle { display: block; font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 2px; font-weight: 500; }

.sidebar__nav { flex: 1; padding: 8px 12px; }
.sidebar__footer { padding: 8px 12px; border-top: 1px solid var(--border); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.nav-item.active svg { stroke: var(--accent); }
.nav-item--logout { color: var(--text-3); }
.nav-item--logout:hover { color: var(--red); background: var(--red-bg); }

/* ═══ COLLAPSIBLE SIDEBAR ═══ */
.sidebar__toggle { color: var(--text-3); }
.sidebar__toggle:hover { color: var(--accent); background: var(--accent-glow); }
.sidebar--collapsed { width: 60px !important; }
.sidebar--collapsed .sidebar__title,
.sidebar--collapsed .sidebar__subtitle,
.sidebar--collapsed .nav-item span { display: none; }
.sidebar--collapsed .sidebar__brand { padding: 0 14px 24px; justify-content: center; }
.sidebar--collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar--collapsed .sidebar__nav { padding: 8px 6px; }
.sidebar--collapsed .sidebar__footer { padding: 8px 6px; }
.sidebar--collapsed .sidebar__toggle-icon { transform: rotate(180deg); }
.app--collapsed { grid-template-columns: 60px 1fr; }

/* ═══ MOBILE BAR ═══ */
.mobile-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobile-bar__title { font-size: 15px; font-weight: 700; }

.hamburger {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-2);
  border-radius: 1px;
  transition: all var(--transition);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 45;
}

/* ═══ MAIN CONTENT ═══ */
.main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══ TOPBAR ═══ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
.topbar__left { flex-shrink: 0; }
.topbar__left .select { width: 200px; padding: 8px 36px 8px 12px; font-size: 13px; }
.topbar__center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; flex-wrap: wrap; }
.topbar__right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar__time { display: flex; flex-direction: column; align-items: flex-end; margin-left: 4px; }
.topbar__time-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.topbar__time-value { font-size: 12px; color: var(--text-2); font-weight: 600; font-family: var(--mono); }

.topbar__countdown {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: default;
  transition: all var(--transition);
}
.topbar__countdown svg { color: var(--text-3); }
.topbar__countdown.soon { color: var(--orange); border-color: var(--orange); }
.topbar__countdown.soon svg { color: var(--orange); }
.topbar__countdown.syncing { color: var(--green); border-color: var(--green); animation: pulse 1s infinite; }
.topbar__countdown.syncing svg { color: var(--green); }

.date-presets { display: flex; gap: 4px; }
.preset {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.preset:hover { border-color: var(--accent); color: var(--text); }
.preset.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input {
  width: 130px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--mono);
}
.date-sep { color: var(--text-3); font-size: 12px; }

/* ═══ PAGES ═══ */
.page { display: none; padding: 24px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }

/* ═══ METRIC CARDS ═══ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.metric-card[data-metric="revenue"]::before { background: var(--green); }
.metric-card[data-metric="spend"]::before { background: var(--orange); }
.metric-card[data-metric="roas"]::before { background: var(--accent); }
.metric-card[data-metric="leads"]::before { background: var(--purple); }
.metric-card[data-metric="qualified"]::before { background: var(--green); }
.metric-card[data-metric="sales"]::before { background: var(--orange); }

.metric-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.metric-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.metric-card__label { font-size: 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-card__value { font-size: 26px; font-weight: 700; letter-spacing: -1px; display: block; font-family: var(--font); }

.metric-card__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--mono);
}
.metric-card__badge.up { background: var(--green-bg); color: var(--green); }
.metric-card__badge.down { background: var(--red-bg); color: var(--red); }
.metric-card__badge.neutral { background: rgba(136,136,160,0.1); color: var(--text-3); }

/* ═══ SECTION CARD ═══ */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══ FUNNEL ═══ */
.funnel {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}
.funnel-step {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-align: center;
}
.funnel-step__bar {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 10px;
  min-height: 12px;
  transition: all 0.4s ease;
  position: relative;
}
.funnel-step__value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.funnel-step__label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}
.funnel-step__rate {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: var(--mono);
}
.funnel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
  color: var(--text-3);
  font-size: 14px;
  padding-top: 0;
}

/* ═══ TABLE ═══ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead { position: sticky; top: 0; z-index: 2; }
.table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table .th-name { min-width: 240px; }

.mono { font-family: var(--mono); font-size: 12px; }

/* Drill-down rows */
.row-campaign { cursor: pointer; }
.row-campaign:hover { background: var(--surface-2) !important; }
.row-campaign td:first-child { font-weight: 600; }

.row-adset { background: rgba(0,0,0,0.15); }
.row-adset td:first-child { padding-left: 36px; }

.row-ad { background: rgba(0,0,0,0.25); }
.row-ad td:first-child { padding-left: 56px; }

.row-best td:first-child { border-left: 3px solid var(--green); padding-left: 11px; }
.row-worst td:first-child { border-left: 3px solid var(--red); padding-left: 11px; }

.table--metrics { min-width: 1600px; }
.ad-thumb { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; vertical-align: middle; margin-right: 8px; }

.drill-arrow {
  display: inline-block;
  width: 16px;
  font-size: 10px;
  color: var(--text-3);
  transition: transform var(--transition);
  margin-right: 6px;
}
.drill-arrow.open { transform: rotate(90deg); }

.row-loading td { text-align: center; color: var(--text-3); padding: 12px; }

/* ═══ BADGES ═══ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--orange { background: var(--orange-bg); color: var(--orange); }
.badge--gray { background: rgba(136,136,160,0.1); color: var(--text-2); }
.badge--purple { background: var(--purple-bg); color: var(--purple); }
.badge--blue { background: var(--accent-glow); color: var(--accent); }

/* ═══ LEAD IDENTITY ═══ */
.lead-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.lead-avatar-wrap {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  position: relative;
  border-radius: 50%;
  overflow: hidden;
}
.lead-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.lead-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══ CRM LINK ═══ */
.crm-link {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--accent);
  opacity: 0.6;
  transition: opacity 0.15s;
  vertical-align: middle;
}
.crm-link:hover { opacity: 1; }

/* ═══ TOAST / ALERTAS ═══ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast--warning { border-left: 3px solid #f59e0b; }
.toast--info { border-left: 3px solid var(--accent); }
.toast--error { border-left: 3px solid #ef4444; }
.toast__icon { flex-shrink: 0; margin-top: 2px; }
.toast__body { flex: 1; }
.toast__title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.toast__msg { font-size: 12px; color: var(--text-2); }
.toast__close { cursor: pointer; opacity: 0.5; background: none; border: none; color: var(--text-1); font-size: 16px; padding: 0 4px; }
.toast__close:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ═══ VIDEO MODAL ═══ */
.video-modal__player { width: 100%; border-radius: 8px; overflow: hidden; background: #000; }
.video-modal__player iframe { display: block; min-height: 350px; }

/* ═══ RANKING CARDS ═══ */
.rank-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.rank-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.rank-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.rank-card__pos { font-size: 15px; font-weight: 700; color: var(--text-2); min-width: 28px; }
.rank-card__title { flex: 1; min-width: 0; }
.rank-card__name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-card__sub { font-size: 11px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-card__signal { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.rank-card__body { display: flex; padding: 16px 20px; }
.rank-card__section { flex: 1; }
.rank-card__section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); font-weight: 600; margin-bottom: 10px; }
.rank-card__metrics { display: flex; gap: 20px; }
.rank-card__metric { display: flex; flex-direction: column; align-items: center; min-width: 60px; }
.rank-card__metric-val { font-size: 18px; font-weight: 700; line-height: 1.2; }
.rank-card__metric-lbl { font-size: 10px; color: var(--text-2); margin-top: 2px; text-align: center; }
.rank-card__metric-bar { width: 100%; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin: 4px 0 2px; }
.rank-card__metric-bar > div { height: 100%; border-radius: 2px; }
.rank-card__divider { width: 1px; background: var(--border); margin: 0 20px; align-self: stretch; }
@media (max-width: 768px) {
  .rank-card__body { flex-direction: column; gap: 14px; }
  .rank-card__divider { width: 100%; height: 1px; margin: 0; }
}

/* ═══ TOP ADS GRID ═══ */
.top-ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.top-ad-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.top-ad-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.top-ad-card__rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.top-ad-card__preview { position: relative; width: 100%; aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; }
.top-ad-card__thumb-link { display: block; width: 100%; height: 100%; }
.top-ad-card__thumb { width: 100%; height: 100%; object-fit: cover; }
.top-ad-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0,0,0,.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.top-ad-card__thumb-link:hover .top-ad-card__play { background: rgba(0,0,0,.8); }
.top-ad-card__no-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 12px; }
.top-ad-card__info { padding: 12px 14px; }
.top-ad-card__name { font-weight: 600; font-size: 13px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-ad-card__campaign { font-size: 11px; color: var(--text-2); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-ad-card__metrics { display: flex; gap: 12px; }
.top-ad-card__metric { display: flex; flex-direction: column; align-items: center; }
.top-ad-card__metric-value { font-size: 16px; font-weight: 700; }
.top-ad-card__metric-label { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.3px; }

/* ═══ RANKING TABS ═══ */
.ranking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface-1);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}
.ranking-tab {
  padding: 6px 16px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.ranking-tab:hover { color: var(--text-1); }
.ranking-tab.active {
  background: var(--accent);
  color: #fff;
}

/* ═══ LEAD DETAIL MODAL ═══ */
.lead-detail__header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.lead-detail__name { font-size: 16px; font-weight: 600; }
.lead-detail__phone { font-size: 13px; margin-top: 2px; }
.lead-detail__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 16px; }
.lead-detail__item { display: flex; flex-direction: column; gap: 2px; }
.lead-detail__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); font-weight: 500; }
.lead-detail__item > span:last-child { font-size: 13px; }
.lead-detail__summary { font-size: 13px; padding: 10px 12px; background: var(--surface-1); border-radius: 6px; margin-bottom: 10px; line-height: 1.5; }
.lead-detail__messages { margin-top: 12px; }
.lead-detail__chat { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--surface-1); border-radius: 8px; }
.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg--lead { align-self: flex-start; }
.chat-msg--vendor { align-self: flex-end; }
.chat-msg__bubble { padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-wrap: break-word; }
.chat-msg--lead .chat-msg__bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-msg--vendor .chat-msg__bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg__time { font-size: 10px; color: var(--text-2); margin-top: 2px; padding: 0 4px; }
.chat-msg--vendor .chat-msg__time { text-align: right; }

/* ═══ LEADS ═══ */
.leads-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box svg { color: var(--text-3); flex-shrink: 0; }
.search-box input {
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 13px;
}
.search-box input:focus { box-shadow: none; }

.leads-toolbar .select { width: 180px; padding: 10px 36px 10px 12px; }

/* ═══ PAGINATION ═══ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0 4px;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.3; pointer-events: none; }
.pagination .page-info { font-size: 12px; color: var(--text-3); margin: 0 8px; }

/* ═══ CLIENTS ═══ */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.client-card:hover { border-color: var(--border-light); }

.client-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
}
.client-card__info { flex: 1; }
.client-card__name { font-weight: 600; font-size: 15px; margin-bottom: 4px; display: block; }
.client-card__meta { font-size: 12px; color: var(--text-2); display: flex; gap: 12px; flex-wrap: wrap; }
.client-card__actions { display: flex; gap: 6px; }

.client-card__body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}
.client-card__body.open { display: block; animation: slideUp 0.2s ease; }

.client-card__webhook {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin: 12px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
}
.client-card__webhook button {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10px;
  cursor: pointer;
  font-family: var(--font);
}
.client-card__webhook button:hover { color: var(--accent); border-color: var(--accent); }

.token-grid { display: grid; gap: 12px; margin-top: 12px; }
.token-group { }
.token-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.token-group input { font-family: var(--mono); font-size: 12px; }
.token-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.token-indicator.on { background: var(--green); }
.token-indicator.off { background: var(--text-3); }

.token-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ═══ CONFIG ═══ */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.config-info__row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}
.config-info__row:last-child { border-bottom: none; }

/* ═══ ACTIVITY LOG ═══ */
.activity-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.activity-stat {
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
}
.activity-stat strong { color: var(--text); font-family: var(--mono); margin-right: 4px; }

.activity-feed { display: flex; flex-direction: column; gap: 2px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  transition: background var(--transition);
}
.activity-item:hover { background: var(--surface-2); }
.activity-item.type-success { border-left-color: var(--green); }
.activity-item.type-error { border-left-color: var(--red); }
.activity-item.type-warning { border-left-color: var(--orange); }
.activity-item.type-info { border-left-color: var(--accent); }

.activity-item__time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  min-width: 90px;
}
.activity-item__cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.activity-item__msg { flex: 1; color: var(--text); line-height: 1.4; }
.activity-item__client { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ═══ INTELIGENCIA ═══ */
.intel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* ═══ CRM ROW ═══ */
.crm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.section-card--half { margin-bottom: 0; }
.section-title svg { vertical-align: -2px; margin-right: 6px; }

.empty-state-sm { text-align: center; padding: 24px 12px; color: var(--text-3); font-size: 13px; }

/* Pipeline */
.pipeline-view { display: flex; flex-direction: column; gap: 8px; }
.pipeline-stage {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
  transition: all var(--transition);
}
.pipeline-stage:hover { background: var(--surface-3); }
.pipeline-stage__name { flex: 1; font-size: 13px; font-weight: 500; }
.pipeline-stage__count {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--mono);
  min-width: 32px;
  text-align: right;
}
.pipeline-stage__value { font-size: 11px; color: var(--text-2); font-family: var(--mono); }
.pipeline-stage__bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent-glow);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  z-index: 0;
}

/* Response Time */
.response-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.response-card {
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  text-align: center;
}
.response-card__value { font-size: 22px; font-weight: 700; font-family: var(--mono); display: block; }
.response-card__label { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-top: 2px; }
.response-card--best .response-card__value { color: var(--green); }
.response-card--worst .response-card__value { color: var(--red); }

.response-list { max-height: 200px; overflow-y: auto; }
.response-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.response-item:last-child { border-bottom: none; }
.response-item__name { color: var(--text-2); }
.response-item__time { font-family: var(--mono); font-weight: 600; }
.response-item__time.fast { color: var(--green); }
.response-item__time.medium { color: var(--orange); }
.response-item__time.slow { color: var(--red); }

@media (max-width: 900px) {
  .crm-row { grid-template-columns: 1fr; }
}

/* ═══ DOMAIN SETUP ═══ */
.section-card--full { grid-column: 1 / -1; }
.config-desc { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.6; }
.domain-input-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.domain-guide { margin-top: 8px; }
.domain-step {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
}
.domain-step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}
.domain-step__title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}
.domain-step__body { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.domain-step__body strong { color: var(--text); }
.domain-code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--green);
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  overflow-x: auto;
}
.domain-code .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  cursor: pointer;
  font-family: var(--font);
}
.domain-code .copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.domain-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(91,141,239,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}
.domain-note svg { flex-shrink: 0; margin-top: 2px; }

/* CRM Test Results */
.test-results { margin-top: 16px; }
.test-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.test-step:last-child { border-left-color: transparent; }
.test-step__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  margin-left: -17px;
}
.test-step__icon.ok { background: var(--green-bg); color: var(--green); }
.test-step__icon.error { background: var(--red-bg); color: var(--red); }
.test-step__icon.info { background: var(--accent-glow); color: var(--accent); }
.test-step__icon.creating { background: var(--orange-bg); color: var(--orange); }
.test-step__icon.found { background: var(--green-bg); color: var(--green); }
.test-step__icon.created { background: var(--purple-bg); color: var(--purple); }

@media (max-width: 480px) {
  .domain-input-row { flex-direction: column; }
  .domain-input-row .btn { width: 100%; }
}

/* ═══ CHART ═══ */
.chart-wrap { height: 300px; position: relative; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  animation: cardReveal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 20px 24px; }
.modal__footer { display: flex; gap: 8px; justify-content: flex-end; padding: 0 24px 20px; }

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  animation: toastIn 0.3s ease forwards;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--red); }
.toast--info { border-left: 3px solid var(--accent); }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* ═══ ANALYTICS GRID ═══ */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.analytics-chart { background: var(--surface-1, var(--surface-2)); border-radius: 8px; padding: 16px; }
.analytics-chart__title { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-2); }

/* ═══ LOADING SKELETON ═══ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ═══ RESPONSIVE ═══ */
/* ═══ RESPONSIVE — TABLET (≤900px) ═══ */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .mobile-bar { display: flex; }
  .main { grid-column: 1; }

  .topbar { flex-direction: column; gap: 10px; padding: 12px 16px; }
  .topbar__left { width: 100%; }
  .topbar__left .select { width: 100%; }
  .topbar__center { width: 100%; justify-content: flex-start; }
  .topbar__right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .topbar__time { display: none; }

  .page { padding: 12px; }

  .metrics-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .metric-card { padding: 14px 16px; }
  .metric-card__value { font-size: 20px; }

  /* Funnel vertical on mobile */
  .funnel { flex-direction: column; align-items: stretch; gap: 0; }
  .funnel-step {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    text-align: left;
  }
  .funnel-step__bar {
    width: 48px;
    min-height: auto;
    height: 48px;
    border-radius: 10px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .funnel-step__value { font-size: 18px; }
  .funnel-arrow { transform: rotate(90deg); width: auto; height: 16px; font-size: 12px; }

  /* Tabela com scroll horizontal */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .table-wrap::-webkit-scrollbar { height: 4px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 10px; }
  .table .th-name { min-width: 180px; position: sticky; left: 0; z-index: 3; background: var(--surface-2); }
  .table tbody .row-campaign td:first-child,
  .table tbody .row-adset td:first-child,
  .table tbody .row-ad td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
  }
  .table tbody tr:hover td:first-child { background: var(--surface-2); }

  .crm-row { grid-template-columns: 1fr; }
  .clients-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }

  /* Modal */
  .modal { max-width: 95vw; margin: 16px; }
  .modal__body { padding: 16px; }
  .modal__footer { padding: 0 16px 16px; }

  .section-card { padding: 16px; }
  .section-title { font-size: 13px; }
}

/* ═══ RESPONSIVE — MOBILE (≤480px) ═══ */
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .metric-card { padding: 12px; }
  .metric-card__value { font-size: 18px; }
  .metric-card__label { font-size: 10px; }
  .metric-card__badge { font-size: 9px; padding: 1px 6px; }

  .date-range { display: none; }
  .date-presets { width: 100%; }
  .preset { flex: 1; text-align: center; padding: 8px 6px; font-size: 11px; }

  .leads-toolbar { flex-direction: column; }
  .leads-toolbar .select { width: 100%; }
  .search-box { min-width: unset; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .topbar__right .btn { padding: 6px 10px; font-size: 11px; }

  .response-cards { grid-template-columns: 1fr 1fr; gap: 6px; }
  .response-card__value { font-size: 18px; }

  .login-card { margin: 12px; padding: 28px 20px; }

  .pagination { flex-wrap: wrap; }
  .pagination button { padding: 6px 10px; font-size: 11px; }

  /* Bottom safe area for iOS */
  .sidebar__footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* === Conversation Summary Row === */
.summary-row td { padding: 0 !important; border-top: none !important; }
.summary-cell { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.summary-content {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 16px; margin: 0 12px 8px 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--text-2);
  background: var(--surface-3); border-radius: 8px; border-left: 3px solid var(--accent);
}
.summary-content svg { flex-shrink: 0; margin-top: 2px; }
.lead-row:hover { background: var(--surface-2); }
.btn--ghost { background: none; border: none; color: var(--text-3); padding: 2px 4px; cursor: pointer; }
.btn--ghost:hover { color: var(--accent); }

/* ════════════════════════════════════════
   COPILOT
   ════════════════════════════════════════ */
.copilot-status { font-size: 12px; color: var(--text-3); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.copilot-status--ok { color: #22c55e; background: rgba(34,197,94,0.1); }
.copilot-status--warn { color: #f59e0b; background: rgba(245,158,11,0.1); }

.copilot-shell {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 16px; height: calc(100vh - 200px); min-height: 400px;
}
.copilot-history {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.copilot-history-empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 16px 8px; }
.copilot-history-item {
  background: none; border: 1px solid transparent; color: var(--text-2);
  text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; line-height: 1.4; display: flex; flex-direction: column; gap: 2px;
}
.copilot-history-item:hover { background: var(--surface-2); border-color: var(--border); }
.copilot-history-item.active { background: var(--surface-3); border-color: var(--accent); color: var(--text-1); }
.copilot-history-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copilot-history-pending { color: #f59e0b; font-size: 11px; }

.copilot-chat {
  display: flex; flex-direction: column;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
.copilot-messages { flex: 1; overflow-y: auto; padding: 16px 20px; }
.copilot-welcome { padding: 24px 8px; }
.copilot-welcome h3 { color: var(--text-1); margin: 0 0 8px; font-size: 18px; }
.copilot-welcome p { color: var(--text-2); margin: 0 0 16px; }
.copilot-examples { display: flex; flex-direction: column; gap: 8px; max-width: 540px; }
.copilot-example {
  text-align: left; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-2); cursor: pointer; font-size: 13px;
  font-family: inherit;
}
.copilot-example:hover { border-color: var(--accent); color: var(--text-1); background: var(--surface-3); }

.copilot-msg {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; max-width: 85%;
  font-size: 13.5px; line-height: 1.55; color: var(--text-1);
}
.copilot-msg--user { background: var(--accent); color: white; margin-left: auto; }
.copilot-msg--assistant { background: var(--surface-2); border: 1px solid var(--border); }
.copilot-msg--system { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.3); color: #f59e0b; font-style: italic; }
.copilot-tool-call {
  font-size: 11.5px; color: var(--text-3); padding: 4px 8px; margin: 6px 0;
  background: var(--surface-3); border-radius: 4px; font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}
.copilot-tool-call--mcp { border-left: 2px solid #1877f2; }
.copilot-tool-call code { color: var(--accent); }

.copilot-thinking { display: inline-flex; gap: 4px; padding: 14px 18px; }
.copilot-thinking .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-3);
  animation: copilot-pulse 1.2s infinite;
}
.copilot-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.copilot-thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes copilot-pulse { 0%, 80% { opacity: 0.3 } 40% { opacity: 1 } }

.copilot-input-row {
  border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px;
  background: var(--surface-1);
}
.copilot-input-row textarea {
  flex: 1; resize: none; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-1); padding: 10px 12px; border-radius: 8px; font-family: inherit;
  font-size: 13.5px; line-height: 1.5; max-height: 120px;
}
.copilot-input-row textarea:focus { border-color: var(--accent); outline: none; }

/* Modal de confirmação */
.modal-content--md { max-width: 600px; }
.modal-warn { color: #f59e0b; font-size: 13px; margin-bottom: 14px; padding: 10px 14px; background: rgba(245,158,11,0.08); border-radius: 6px; border-left: 3px solid #f59e0b; }
.pending-action {
  display: flex; gap: 12px; padding: 12px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.pending-action-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.pending-action-body { flex: 1; min-width: 0; }
.pending-action-tool { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; margin-bottom: 4px; }
.pending-action-tool code { color: var(--accent); }
.pending-action-reason { color: var(--text-2); font-size: 12.5px; margin-bottom: 6px; }
.pending-action-params {
  font-size: 11px; color: var(--text-3); background: var(--surface-3); padding: 8px;
  border-radius: 4px; overflow-x: auto; margin: 0; max-height: 120px;
}

@media (max-width: 768px) {
  .copilot-shell { grid-template-columns: 1fr; height: auto; }
  .copilot-history { max-height: 160px; }
}
