/* ═══════════════════════════════════════════════════════════════════
   IL Distribuidora — Design System v2
   Tokens · Reset · Navbar · Cards · Buttons · Tables · Modals · Pages
═══════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:          #1e3a8a;
  --brand-mid:      #1d4ed8;
  --brand-hover:    #1e40af;
  --brand-light:    #dbeafe;
  --brand-glow:     rgba(29,78,216,.14);

  /* Accent */
  --accent:         #1d4ed8;

  /* Surfaces */
  --bg-app:         #f0f4f9;
  --bg-card:        #ffffff;
  --bg-navbar:      #ffffff;
  --bg-input:       #f8fafc;
  --bg-icon:        #eff6ff;
  --bg-nav-active:  var(--brand);

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-nav:       #64748b;
  --text-nav-active:#ffffff;

  /* Borders */
  --border:         #e2e8f0;
  --border-card:    #eef2f7;
  --border-strong:  #cbd5e1;

  /* Semantic */
  --ok:             #059669;
  --ok-bg:          #d1fae5;
  --ok-border:      #6ee7b7;
  --warn:           #d97706;
  --warn-bg:        #fef3c7;
  --danger:         #dc2626;
  --danger-bg:      #fee2e2;
  --ia:             #7c3aed;
  --ia-bg:          #ede9fe;
  --ia-border:      #c4b5fd;
  --team:           #0369a1;
  --team-bg:        #e0f2fe;

  /* WhatsApp */
  --wa-green:       #22c55e;
  --wa-green-dark:  #16a34a;
  --wa-green-light: #dcfce7;
  --wa-amber:       #f59e0b;
  --wa-amber-light: #fef3c7;
  --wa-purple:      #7c3aed;
  --wa-purple-light:#ede9fe;

  /* Chart */
  --chart-blue:     #1e3a8a;
  --chart-sent:     #1d4ed8;
  --chart-recv:     #60a5fa;

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(15,23,42,.04);
  --shadow-card:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-card-hover: 0 8px 24px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.06);
  --shadow-navbar:  0 1px 0 #e2e8f0;
  --shadow-dropdown:0 12px 32px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.08);
  --shadow-modal:   0 24px 64px rgba(15,23,42,.22), 0 4px 16px rgba(15,23,42,.10);
  --shadow-btn:     0 1px 2px rgba(15,23,42,.10);

  /* Geometry */
  --radius-sm:      6px;
  --radius-btn:     8px;
  --radius-card:    12px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  /* Motion */
  --transition:     0.16s ease;
  --transition-md:  0.24s ease;

  /* Icon color alias */
  --icon-color:     var(--brand-mid);

  /* Primary alias (legacy) */
  --primary:        var(--brand);
  --primary-mid:    var(--brand-mid);
}

/* ── Dark Mode ───────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-app:         #0d1117;
  --bg-card:        #161b22;
  --bg-navbar:      #161b22;
  --bg-input:       #0d1117;
  --bg-icon:        #1c2a4a;
  --bg-nav-active:  #2563eb;

  --text-primary:   #e6edf3;
  --text-secondary: #8d96a0;
  --text-muted:     #4d5762;
  --text-nav:       #8d96a0;

  --border:         #21262d;
  --border-card:    #1e2530;
  --border-strong:  #30363d;

  --brand-light:    #1e3a5f;
  --brand-glow:     rgba(37,99,235,.18);

  --ok-bg:          #0f2d22;
  --ok-border:      #1a4731;
  --warn-bg:        #2d1f00;
  --danger-bg:      #2d0a0a;
  --ia-bg:          #1e1040;
  --ia-border:      #4a2f7c;
  --team-bg:        #0a1e2d;

  --wa-green-light: #052e16;
  --wa-amber-light: #1c1200;
  --wa-purple-light:#1e0a40;

  --shadow-xs:      0 1px 2px rgba(0,0,0,.20);
  --shadow-card:    0 1px 3px rgba(0,0,0,.30), 0 1px 2px rgba(0,0,0,.20);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,.40), 0 2px 6px rgba(0,0,0,.20);
  --shadow-navbar:  0 1px 0 #21262d;
  --shadow-dropdown:0 12px 32px rgba(0,0,0,.45);
  --shadow-modal:   0 24px 64px rgba(0,0,0,.55);

  --chart-blue:     #2563eb;
  --chart-sent:     #3b82f6;
  --chart-recv:     #93c5fd;
  --icon-color:     #60a5fa;
}

/* ── Reset + Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color var(--transition-md), color var(--transition-md);
}

button  { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar        { width: 5px; height: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.fade-up { animation: fadeUp .35s ease forwards; }


/* ══════════════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-navbar);
  box-shadow: var(--shadow-navbar);
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 28px;
  transition: background-color var(--transition-md), box-shadow var(--transition);
}

/* Brand */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 130px;
}
.brand-logo          { height: 36px; width: auto; object-fit: contain; }
.brand-logo-light    { display: block; }
.brand-logo-dark     { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark  { display: block; }

/* Nav links */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-nav);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  transition: background-color var(--transition), color var(--transition);
  position: relative;
}
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }

.nav-link:hover:not(.active) {
  background: var(--bg-app);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--bg-nav-active);
  color: var(--text-nav-active);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(30,58,138,.25);
}
.nav-link.active svg { color: var(--text-nav-active); }

.nav-chevron { width: 12px !important; height: 12px !important; opacity: .55; }

/* Dropdown */
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-dropdown);
  min-width: 196px;
  padding: 6px;
  z-index: 200;
  animation: fadeUp .16s ease;
}
.nav-item:hover .dropdown-menu,
.nav-item.open  .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.dropdown-item:hover { background: var(--bg-app); color: var(--text-primary); }
.dropdown-item svg   { width: 14px; height: 14px; flex-shrink: 0; }

/* Navbar right */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-btn);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg-app); color: var(--text-primary); }
.icon-btn svg   { width: 17px; height: 17px; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .5px;
  border: 2px solid var(--border);
}
[data-theme="dark"] .user-avatar { background: #1e3a5f; color: #93c5fd; border-color: var(--border); }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* User dropdown trigger */
.user-nav-item { display: flex; align-items: center; }
.user-nav-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color var(--transition);
}
.user-nav-trigger:hover { background: var(--bg-app); }
.user-nav-trigger .nav-chevron { color: var(--text-muted); }
.dropdown-menu-right { right: 0; left: auto; }
.dropdown-divider    { height: 1px; background: var(--border); margin: 4px 6px; }

.dropdown-item-danger { color: #ef4444 !important; }
.dropdown-item-danger svg { color: #ef4444 !important; }
.dropdown-item-danger:hover { background: var(--danger-bg) !important; }
[data-theme="dark"] .dropdown-item-danger:hover { background: #2d0a0a !important; }

/* WhatsApp nav icon */
.nav-wa-icon { flex-shrink: 0; }
.nav-link.active  .nav-wa-icon { color: #fff; }
.nav-link:not(.active) .nav-wa-icon { color: var(--wa-green-dark); }


/* ══════════════════════════════════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════════════════════════════════ */
.page {
  max-width: 1340px;
  margin: 0 auto;
  padding: 32px 28px 56px;
  animation: fadeUp .3s ease;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}


/* ══════════════════════════════════════════════════════════════════
   METRIC CARDS
══════════════════════════════════════════════════════════════════ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-mid), #60a5fa);
  opacity: 0;
  transition: opacity var(--transition-md);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.metric-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--border);
}
.metric-card:hover::before { opacity: 1; }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -.5px;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-icon) 0%, var(--brand-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(29,78,216,.12);
  transition: transform var(--transition), box-shadow var(--transition);
}
.metric-card:hover .metric-icon {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(29,78,216,.2);
}
.metric-icon svg { width: 22px; height: 22px; color: var(--brand-mid); }
[data-theme="dark"] .metric-icon { background: linear-gradient(135deg, #1c2a4a 0%, #1e3a5f 100%); }
[data-theme="dark"] .metric-icon svg { color: #60a5fa; }


/* ══════════════════════════════════════════════════════════════════
   CHART CARDS
══════════════════════════════════════════════════════════════════ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card,
.chart-card-full {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.chart-card:hover,
.chart-card-full:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border);
}
.chart-card-full { margin-bottom: 20px; }

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, var(--brand-mid), #60a5fa);
  border-radius: 2px;
  margin-right: 8px;
  flex-shrink: 0;
}

.chart-wrapper      { position: relative; height: 224px; }
.chart-wrapper-full { position: relative; height: 188px; }

.chart-empty {
  height: 224px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.chart-empty::before {
  content: '○';
  font-size: 28px;
  opacity: .25;
}


/* ══════════════════════════════════════════════════════════════════
   INSIGHT CARDS
══════════════════════════════════════════════════════════════════ */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
}
.insight-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.insight-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg-icon) 0%, var(--brand-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(29,78,216,.10);
}
.insight-icon svg { width: 18px; height: 18px; color: var(--brand-mid); }
[data-theme="dark"] .insight-icon { background: linear-gradient(135deg, #1c2a4a 0%, #1e3a5f 100%); }
[data-theme="dark"] .insight-icon svg { color: #60a5fa; }

.insight-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.insight-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 3px;
  letter-spacing: -.3px;
}
.insight-sub { font-size: 11px; color: var(--text-muted); }


/* ══════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--brand-mid) 0%, var(--brand) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(30,58,138,.30), 0 1px 2px rgba(30,58,138,.20);
  letter-spacing: .1px;
}
.btn-primary:hover {
  opacity: .92;
  box-shadow: 0 4px 12px rgba(30,58,138,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(30,58,138,.25); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary svg { width: 15px; height: 15px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-app);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}
.btn-secondary svg { width: 15px; height: 15px; }


/* ══════════════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════════════ */
.mkt-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.mkt-tab-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.mkt-tab-btn:hover { color: var(--text-primary); }
.mkt-tab-btn.active {
  color: var(--brand-mid);
  border-bottom-color: var(--brand-mid);
  font-weight: 700;
}


/* ══════════════════════════════════════════════════════════════════
   SECTION HEADER (above tables/panels)
══════════════════════════════════════════════════════════════════ */
.mkt-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}


/* ══════════════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════════════ */
.mkt-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  transition: box-shadow var(--transition);
}
.mkt-table-wrap:hover { box-shadow: var(--shadow-card-hover); }

.mkt-table { width: 100%; border-collapse: collapse; }

.mkt-table thead { position: sticky; top: 0; z-index: 1; }

.mkt-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-card);
}

.mkt-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-card);
  vertical-align: middle;
  transition: background-color var(--transition);
}

.mkt-table tr:last-child td { border-bottom: none; }
.mkt-table tbody tr { transition: background-color var(--transition); }
.mkt-table tbody tr:hover td { background: var(--bg-app); }

.mkt-table-empty {
  text-align: center;
  padding: 56px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* Action button in table */
.mkt-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 5px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), color var(--transition);
}
.mkt-action-btn:hover { background: var(--danger-bg); color: var(--danger); }
[data-theme="dark"] .mkt-action-btn:hover { background: #2d0a0a; }
.mkt-action-btn svg { width: 15px; height: 15px; }


/* ══════════════════════════════════════════════════════════════════
   BADGES / CHIPS
══════════════════════════════════════════════════════════════════ */
.mkt-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .2px;
}
.badge-green  { background: var(--ok-bg);   color: var(--ok);   }
.badge-blue   { background: var(--brand-light); color: var(--brand); }
.badge-gray   { background: var(--bg-app);  color: var(--text-secondary); border: 1px solid var(--border); }
.badge-amber  { background: var(--warn-bg); color: var(--warn); }

[data-theme="dark"] .badge-green  { background: #0f2d22; color: #34d399; }
[data-theme="dark"] .badge-blue   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-gray   { background: #1e2530; color: var(--text-secondary); border-color: var(--border); }
[data-theme="dark"] .badge-amber  { background: #2d1f00; color: #fbbf24; }


/* ══════════════════════════════════════════════════════════════════
   INPUTS & SELECTS (shared)
══════════════════════════════════════════════════════════════════ */
.mkt-select,
.log-filter-select,
.mkt-date-input {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-xs);
}
.mkt-select:focus,
.log-filter-select:focus,
.mkt-date-input:focus {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.mkt-select { min-width: 160px; }
.log-filter-select { min-width: 120px; }

/* Search wrap */
.mkt-search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
}
.mkt-search-wrap svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.mkt-search-input {
  width: 100%;
  padding: 8px 11px 8px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-xs);
}
.mkt-search-input:focus {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.mkt-search-input::placeholder { color: var(--text-muted); }

/* Inline selects inside table */
.mkt-status-select,
.log-inline-select,
.log-motoboy-select {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), background-color var(--transition);
}
.mkt-status-select:hover, .mkt-status-select:focus,
.log-inline-select:hover,  .log-inline-select:focus,
.log-motoboy-select:hover, .log-motoboy-select:focus {
  border-color: var(--border);
  background: var(--bg-card);
}
.log-inline-select  { max-width: 130px; }
.log-motoboy-select { max-width: 160px; min-width: 110px; }


/* ══════════════════════════════════════════════════════════════════
   KANBAN
══════════════════════════════════════════════════════════════════ */
.mkt-kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.mkt-column {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.mkt-column:hover { box-shadow: var(--shadow-card-hover); }

.mkt-column-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}
.mkt-column-header.col-nova     { background: var(--ok-bg);   color: #065f46; border-bottom: 2px solid var(--ok); }
.mkt-column-header.col-operacao { background: var(--warn-bg); color: #92400e; border-bottom: 2px solid var(--warn); }
.mkt-column-header.col-final    { background: var(--bg-app);  color: var(--text-secondary); border-bottom: 2px solid var(--border-strong); }

[data-theme="dark"] .mkt-column-header.col-nova     { background: #0f2d22; color: #34d399; border-bottom-color: #059669; }
[data-theme="dark"] .mkt-column-header.col-operacao { background: #2d1f00; color: #fbbf24; border-bottom-color: #d97706; }
[data-theme="dark"] .mkt-column-header.col-final    { background: #1e2530; color: var(--text-secondary); border-bottom-color: var(--border-strong); }

.mkt-col-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0,0,0,.10);
  color: inherit;
}

.mkt-column-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.mkt-column-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Kanban card */
.mkt-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.mkt-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateX(2px);
  border-color: var(--border-strong);
}
.mkt-card-drag    { color: var(--text-muted); font-size: 14px; padding-top: 1px; flex-shrink: 0; cursor: default; user-select: none; }
.mkt-card-content { flex: 1; min-width: 0; }
.mkt-card-title   { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; word-break: break-word; }
.mkt-card-meta    { display: flex; flex-direction: column; gap: 4px; }
.mkt-card-tag     { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); }
.mkt-card-tag svg { width: 12px; height: 12px; flex-shrink: 0; color: var(--text-muted); }

.mkt-card-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition);
}
.mkt-card-del:hover { background: var(--danger-bg); color: var(--danger); }
[data-theme="dark"] .mkt-card-del:hover { background: #2d0a0a; }
.mkt-card-del svg { width: 13px; height: 13px; }


/* ══════════════════════════════════════════════════════════════════
   FILTERS
══════════════════════════════════════════════════════════════════ */
.mkt-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Report filters */
.mkt-report-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.mkt-report-filter-group       { display: flex; flex-direction: column; gap: 5px; }
.mkt-report-filter-group label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Report metrics */
.mkt-report-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mkt-report-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
}
.mkt-report-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }

.mkt-report-card .metric-label  { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.mkt-report-card .metric-value  { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -.4px; }
.mkt-report-card .metric-sub    { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.mkt-report-card .metric-icon   { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--bg-icon), var(--brand-light)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 2px 8px rgba(29,78,216,.12); }
.mkt-report-card .metric-icon svg { width: 22px; height: 22px; color: var(--brand-mid); }


/* ══════════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,17,30,.60);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .18s ease;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: slideUp .22s cubic-bezier(.16,1,.3,1);
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-app) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
  letter-spacing: -.2px;
}
.modal-subtitle { font-size: 12px; color: var(--text-muted); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-shrink: 0;
  transition: background-color var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-app); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body   { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-field  { display: flex; flex-direction: column; gap: 6px; }

.modal-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; }
.modal-label span { color: var(--danger); margin-left: 2px; font-weight: 400; text-transform: none; }

.modal-input,
.modal-textarea,
.modal-select-input {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.modal-input:focus,
.modal-textarea:focus,
.modal-select-input:focus {
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: var(--bg-card);
}
.modal-input::placeholder,
.modal-textarea::placeholder { color: var(--text-muted); }
.modal-textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

/* File input */
.modal-file-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.modal-file-wrap:hover { border-color: var(--brand-mid); background: var(--brand-light); }
[data-theme="dark"] .modal-file-wrap:hover { background: #1e3a5f; }
.modal-file-wrap input[type="file"] { display: none; }
.modal-file-label { font-size: 12px; color: var(--text-muted); flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.modal-file-btn {
  padding: 5px 12px;
  background: var(--border);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--transition);
}
.modal-file-btn:hover { background: var(--border-strong); }
.modal-hint { font-size: 11px; color: var(--text-muted); margin-top: -4px; }


/* ══════════════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════════════ */
.wa-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #1e293b;
  color: #f1f5f9;
  padding: 12px 20px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 8px 28px rgba(0,0,0,.30), 0 2px 8px rgba(0,0,0,.15);
  z-index: 600;
  transition: opacity .28s ease, transform .28s ease;
  border-left: 3px solid var(--wa-green);
  max-width: 340px;
}
.wa-toast.hide { opacity: 0; transform: translateY(8px); pointer-events: none; }
.wa-toast svg  { width: 16px; height: 16px; color: var(--wa-green); flex-shrink: 0; }
[data-theme="dark"] .wa-toast { background: #0d1117; border: 1px solid #21262d; border-left: 3px solid var(--wa-green); }


/* ══════════════════════════════════════════════════════════════════
   LOGÍSTICA — TOOLBAR
══════════════════════════════════════════════════════════════════ */
.log-toolbar       { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.log-toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.log-search-wrap { position: relative; display: flex; align-items: center; min-width: 200px; max-width: 280px; }
.log-search-wrap svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
.log-search-wrap .mkt-search-input { padding-left: 32px; }

.log-arquivo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.log-arquivo-btn:hover { background: var(--bg-app); color: var(--text-primary); border-color: var(--border-strong); }
.log-arquivo-btn.active { background: var(--warn-bg); color: var(--warn); border-color: #fcd34d; }
[data-theme="dark"] .log-arquivo-btn.active { background: #2d1f00; color: #fbbf24; border-color: #78350f; }
.log-arquivo-btn svg { width: 14px; height: 14px; }

/* Status pill */
.log-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(30,58,138,.25);
}

/* Client name link */
.log-client-name-link { color: var(--brand-mid); cursor: pointer; font-weight: 600; }
.log-client-name-link:hover { text-decoration: underline; }

/* Autocomplete */
.log-autocomplete-wrap { position: relative; }
.log-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-dropdown);
  z-index: 300;
  max-height: 220px;
  overflow-y: auto;
}
.log-autocomplete-item { padding: 9px 14px; font-size: 13px; cursor: pointer; transition: background-color var(--transition); }
.log-autocomplete-item:hover { background: var(--bg-app); }
.log-autocomplete-item-name  { font-weight: 600; display: block; color: var(--text-primary); }
.log-autocomplete-item-phone { font-size: 11px; color: var(--text-muted); }

/* Currency input */
.log-valor-wrap { position: relative; display: flex; align-items: center; }
.log-valor-prefix { position: absolute; left: 0; padding: 0 12px; color: var(--text-muted); font-size: 13px; pointer-events: none; z-index: 1; font-weight: 500; }
.log-valor-input  { padding-left: 34px !important; }


/* ══════════════════════════════════════════════════════════════════
   FECHAMENTO MOTOBOYS
══════════════════════════════════════════════════════════════════ */
.fec-filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 22px 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.fec-filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.fec-filter-title svg { width: 15px; height: 15px; color: var(--icon-color); }

.fec-filter-grid   { display: grid; grid-template-columns: 1fr 1fr 180px 180px; gap: 14px; align-items: end; }
.fec-filter-group  { display: flex; flex-direction: column; gap: 5px; }
.fec-filter-label  { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.fec-filter-select { min-width: unset; width: 100%; }

.fec-section-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.fec-pay-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--brand-mid) 0%, var(--brand) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 3px rgba(30,58,138,.25);
}
.fec-pay-btn:not(:disabled):hover { opacity: .9; box-shadow: 0 4px 12px rgba(30,58,138,.30); }
.fec-pay-btn:disabled { opacity: .4; cursor: not-allowed; background: var(--text-muted); box-shadow: none; }
.fec-pay-btn svg { width: 14px; height: 14px; }

.fec-arquivo-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: none; color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}
.fec-arquivo-btn:hover { background: var(--bg-app); }
.fec-arquivo-btn.active { background: var(--brand-light); border-color: var(--brand-mid); color: var(--brand); }
.fec-arquivo-btn svg { width: 14px; height: 14px; }

.fec-badge-pendente {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  background: var(--warn-bg); color: var(--warn);
}
.fec-badge-pago {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
  background: var(--ok-bg); color: var(--ok);
}
[data-theme="dark"] .fec-badge-pendente { background: #2d1f00; color: #fbbf24; }
[data-theme="dark"] .fec-badge-pago     { background: #0f2d22; color: #34d399; }

.fec-action-btn {
  width: 30px; height: 30px; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--ok);
  transition: background-color var(--transition);
}
.fec-action-btn:hover { background: var(--ok-bg); }
.fec-action-btn svg { width: 14px; height: 14px; }
.fec-btn-pay { color: var(--ok); }

.mkt-table input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand-mid); }


/* ══════════════════════════════════════════════════════════════════
   CONHECIMENTO
══════════════════════════════════════════════════════════════════ */
.con-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.con-toolbar-left { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }

.con-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 72px 24px; color: var(--text-muted); gap: 10px; text-align: center;
}
.con-empty-state svg { width: 48px; height: 48px; opacity: .3; }
.con-empty-state p { font-size: 14px; color: var(--text-secondary); }

/* Article cards */
.con-articles-list { display: flex; flex-direction: column; gap: 12px; }

.con-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
}
.con-article-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateX(3px);
  border-left-color: var(--brand-mid);
}

.con-article-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.con-article-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.con-article-actions { display: flex; gap: 2px; flex-shrink: 0; }

.con-article-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 7px; line-height: 1.3; letter-spacing: -.1px; }
.con-article-preview {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.con-article-footer { display: flex; align-items: center; justify-content: space-between; }
.con-article-date   { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.con-article-date svg { width: 12px; height: 12px; }
.con-read-more { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--brand-mid); }
.con-read-more svg { width: 12px; height: 12px; }

/* Badges */
.con-cat-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .2px;
}
.con-visi-badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 500;
  background: var(--bg-app); color: var(--text-secondary); border: 1px solid var(--border);
}
.con-article-body { font-size: 14px; line-height: 1.8; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }

/* Video grid */
.con-videos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.con-video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
}
.con-video-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-3px); }

.con-video-thumb { position: relative; width: 100%; padding-top: 56.25%; overflow: hidden; cursor: pointer; background: #0d1117; }
.con-video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.con-video-card:hover .con-video-thumb img { transform: scale(1.05); }

.con-thumb-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #161b22; color: #30363d; }
.con-thumb-placeholder svg { width: 40px; height: 40px; }

.con-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0); transition: background var(--transition-md); }
.con-video-thumb:hover .con-play-overlay { background: rgba(0,0,0,.35); }

.con-play-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  transform: scale(.8); transition: transform var(--transition-md);
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.con-video-thumb:hover .con-play-btn { transform: scale(1); }
.con-play-btn svg { width: 22px; height: 22px; color: var(--brand); margin-left: 3px; }

.con-video-info  { padding: 14px 16px; }
.con-video-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; cursor: pointer; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.con-video-title:hover { color: var(--brand-mid); }
.con-video-desc  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.con-video-footer   { display: flex; align-items: center; justify-content: space-between; }
.con-video-actions  { display: flex; gap: 2px; }

/* Player modal */
.con-player-box { max-width: 880px !important; }
.con-player-wrap { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 0 0 var(--radius-card) var(--radius-card); overflow: hidden; }
.con-player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }


/* ══════════════════════════════════════════════════════════════════
   WHATSAPP PAGE
══════════════════════════════════════════════════════════════════ */
.wa-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  height: calc(100vh - 58px);
  overflow: hidden;
}

/* Sidebar */
.wa-sidebar { background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

.wa-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.wa-sidebar-title { display: flex; align-items: center; gap: 9px; }
.wa-logo-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--wa-green-light); display: flex; align-items: center; justify-content: center; color: var(--wa-green-dark); }
.wa-logo-icon svg { width: 16px; height: 16px; }
.wa-sidebar-title span { font-size: 15px; font-weight: 700; color: var(--text-primary); }

.wa-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  background: var(--bg-app);
}
.wa-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.wa-search input { flex: 1; border: none; background: none; outline: none; font-size: 13px; color: var(--text-primary); }
.wa-search input::placeholder { color: var(--text-muted); }

.wa-contact-list { flex: 1; overflow-y: auto; }

/* Contact item */
.wa-contact-item {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 11px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-card);
  transition: background-color var(--transition);
  border-left: 3px solid transparent;
}
.wa-contact-item:hover { background: var(--bg-app); }
.wa-contact-item.active { background: var(--bg-app); border-left-color: var(--wa-green); }

.wa-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--wa-green-light);
  color: var(--wa-green-dark);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="dark"] .wa-avatar { background: #052e16; color: #34d399; }

.wa-contact-info    { flex: 1; min-width: 0; }
.wa-contact-name    { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact-meta    { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.wa-contact-time    { font-size: 11px; color: var(--text-muted); }

.wa-unread {
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--wa-green); color: #fff;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.wa-badge-ia { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--ia-bg); color: var(--ia); }

/* Chat panel */
.wa-chat-panel { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-app); }

.wa-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); }
.wa-empty-state svg { width: 56px; height: 56px; opacity: .25; }
.wa-empty-state h3  { font-size: 17px; font-weight: 700; color: var(--text-secondary); }
.wa-empty-state p   { font-size: 13px; }

.wa-chat-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.wa-chat-header {
  padding: 13px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.wa-chat-header .wa-avatar { width: 38px; height: 38px; font-size: 13px; }
.wa-chat-header-info  { flex: 1; min-width: 0; }
.wa-chat-header-name  { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.wa-chat-header-phone { font-size: 12px; color: var(--text-muted); }
.wa-chat-header-badges { display: flex; gap: 6px; align-items: center; }

.wa-chip { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.wa-chip-ia    { background: var(--ia-bg);   color: var(--ia); }
.wa-chip-green { background: var(--ok-bg);   color: var(--ok); }
[data-theme="dark"] .wa-chip-green { background: #052e16; color: #34d399; }

/* Messages */
.wa-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 3px; }

.wa-date-sep { display: flex; justify-content: center; margin: 16px 0 10px; }
.wa-date-sep span {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 14px;
  border-radius: 20px;
  letter-spacing: .3px;
}

.wa-msg-wrap          { display: flex; margin-bottom: 2px; }
.wa-msg-wrap.received { justify-content: flex-start; }
.wa-msg-wrap.sent     { justify-content: flex-end; }

.wa-bubble {
  max-width: 62%;
  padding: 9px 13px 7px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.wa-msg-wrap.received .wa-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}
.wa-msg-wrap.sent.by-ia .wa-bubble {
  background: #dbeafe;
  border-bottom-right-radius: 4px;
  color: #1e3a8a;
}
[data-theme="dark"] .wa-msg-wrap.sent.by-ia .wa-bubble { background: #1e3a5f; color: #bfdbfe; }
.wa-msg-wrap.sent.by-equipe .wa-bubble {
  background: var(--wa-green-light);
  border-bottom-right-radius: 4px;
  color: #065f46;
}
[data-theme="dark"] .wa-msg-wrap.sent.by-equipe .wa-bubble { background: #052e16; color: #bbf7d0; }

.wa-msg-footer { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 4px; }
.wa-msg-time   { font-size: 10.5px; color: var(--text-muted); opacity: .75; }

.wa-origin-tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 8px; letter-spacing: .3px; }
.tag-ia     { background: var(--brand-light); color: var(--brand); }
.tag-equipe { background: var(--wa-green-light); color: var(--wa-green-dark); }
[data-theme="dark"] .tag-ia     { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .tag-equipe { background: #052e16; color: #34d399; }

.wa-responsible { font-size: 10.5px; font-weight: 700; color: var(--wa-green-dark); margin-bottom: 3px; text-align: right; padding-right: 2px; }
[data-theme="dark"] .wa-responsible { color: #34d399; }

/* Special messages */
.wa-msg-special { display: flex; justify-content: center; margin: 10px 0 6px; }
.wa-special-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 18px; border-radius: 20px;
  font-size: 12px; font-weight: 700; border: 1px solid;
}
.wa-special-pill svg { width: 13px; height: 13px; flex-shrink: 0; }
.pill-logistica { background: var(--warn-bg); color: #92400e; border-color: #fcd34d; }
.pill-vendedor  { background: var(--ia-bg); color: #5b21b6; border-color: var(--ia-border); }
[data-theme="dark"] .pill-logistica { background: #2d1f00; color: #fbbf24; border-color: #78350f; }
[data-theme="dark"] .pill-vendedor  { background: #1e1040; color: #c4b5fd; border-color: #4a2f7c; }

/* Media */
.wa-media-img { max-width: 260px; border-radius: var(--radius-btn); display: block; cursor: zoom-in; }
.wa-media-placeholder {
  width: 220px; height: 130px;
  background: var(--bg-app); border-radius: var(--radius-btn);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-muted); font-size: 12px;
  border: 1.5px dashed var(--border);
}
.wa-media-placeholder svg { width: 28px; height: 28px; opacity: .45; }
.wa-audio-player  { width: 220px; height: 36px; }
.wa-video-player  { max-width: 260px; border-radius: var(--radius-btn); }

/* Lightbox */
.wa-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
.wa-lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-btn); box-shadow: 0 16px 60px rgba(0,0,0,.5); }
.wa-lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.wa-lightbox-close:hover { background: rgba(255,255,255,.22); }
.wa-lightbox-close svg { width: 18px; height: 18px; }


/* ══════════════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #1d4ed8 100%);
  padding: 24px;
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(96,165,250,.15) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 44px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.15);
  position: relative;
  animation: slideUp .3s cubic-bezier(.16,1,.3,1);
}

.login-logo           { display: flex; justify-content: center; margin-bottom: 32px; }
.login-logo img       { height: 52px; width: auto; }
.login-title          { text-align: center; font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; letter-spacing: -.3px; }
.login-sub            { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.login-field          { margin-bottom: 16px; }
.login-label          { display: block; font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }

.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
.login-input:focus {
  border-color: var(--brand-mid);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.login-input::placeholder { color: var(--text-muted); }

.login-password-wrap { position: relative; }
.login-password-wrap .login-input { padding-right: 44px; }
.login-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 3px; display: flex; transition: color var(--transition); }
.login-eye:hover { color: var(--text-secondary); }
.login-eye svg { width: 17px; height: 17px; }

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--brand-mid) 0%, var(--brand) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(30,58,138,.30);
  letter-spacing: .1px;
}
.login-btn:hover { opacity: .92; box-shadow: 0 6px 20px rgba(30,58,138,.38); transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.login-error {
  margin-top: 16px;
  padding: 11px 14px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-btn);
  font-size: 13px;
  color: var(--danger);
  display: none;
  animation: fadeUp .2s ease;
}
[data-theme="dark"] .login-error { background: #2d0a0a; border-color: #7f1d1d; color: #fca5a5; }

.login-theme-btn {
  position: fixed; top: 16px; right: 16px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-btn);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
  backdrop-filter: blur(8px);
  transition: background-color var(--transition);
}
.login-theme-btn:hover { background: rgba(255,255,255,.2); }
.login-theme-btn svg { width: 17px; height: 17px; }
[data-theme="dark"] .login-theme-btn { background: rgba(255,255,255,.08); }

/* Spinner */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════════
   STATUSES — Log Toolbar
══════════════════════════════════════════════════════════════════ */
.log-client-name-link { color: var(--brand-mid); cursor: pointer; font-weight: 600; }
.log-client-name-link:hover { text-decoration: underline; }


/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .metrics-grid  { grid-template-columns: repeat(2, 1fr); }
  .insights-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .con-videos-grid { grid-template-columns: repeat(2, 1fr); }
  .mkt-kanban      { grid-template-columns: 1fr; }
  .mkt-report-metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .fec-filter-grid  { grid-template-columns: 1fr 1fr; }
  .log-toolbar      { flex-direction: column; align-items: stretch; }
  .log-toolbar-right { flex-wrap: wrap; }
  .log-search-wrap  { max-width: 100%; }
}

@media (max-width: 768px) {
  .page          { padding: 20px 16px 40px; }
  .navbar        { padding: 0 16px; gap: 12px; height: 54px; }
  .navbar-nav    { display: none; }
  .charts-row    { grid-template-columns: 1fr; }
  .metrics-grid  { grid-template-columns: 1fr 1fr; gap: 12px; }
  .insights-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .wa-layout     { grid-template-columns: 1fr; }
  .wa-chat-panel { display: none; }
  .wa-chat-panel.open { display: flex; position: fixed; inset: 54px 0 0 0; z-index: 50; }
  .mkt-tabs { overflow-x: auto; }
  .mkt-report-metrics { grid-template-columns: 1fr; }
  .modal-box { border-radius: var(--radius-card); }
}

@media (max-width: 600px) {
  .mkt-filters          { flex-direction: column; align-items: stretch; }
  .mkt-search-wrap      { max-width: 100%; }
  .mkt-report-filters   { flex-direction: column; align-items: stretch; }
  .log-toolbar-right    { flex-direction: column; align-items: stretch; }
  .log-filter-select    { min-width: unset; width: 100%; }
  .log-arquivo-btn      { width: 100%; justify-content: center; }
  .fec-filter-grid      { grid-template-columns: 1fr; }
  .fec-section-header   { flex-direction: column; align-items: flex-start; }
  .con-videos-grid      { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .metrics-grid  { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
}
