/* ─── Variáveis ──────────────────────────────────────────────── */
:root {
  --navy:  #0B1929;
  --blue:  #1A5EAB;
  --teal:  #0B9E80;
  --amber: #D97706;
  --red:   #C0392B;
  --bg:    #F4F6FA;
  --card:  #FFFFFF;
  --text:  #1A202C;
  --muted: #718096;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

/* ─── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.navbar-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.75) !important;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff !important;
}

.navbar-usuario {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  white-space: nowrap;
}

/* ─── Navbar: dropdown "Análises Web" (hover/foco, sem JS) ──────── */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 170px;
  background: var(--navy);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.32);
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-menu .nav-link {
  padding: 8px 12px;
  white-space: nowrap;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.page-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ─── Badges ─────────────────────────────────────────────────── */
.badge   { display:inline-block; padding:2px 8px; border-radius:4px; font-size:10.5px; font-weight:600; letter-spacing:.03em; }
.b-red   { background:#FEE2E2; color:#991B1B; }
.b-amber { background:#FEF3C7; color:#92400E; }
.b-teal  { background:#CCFBF1; color:#065F46; }
.b-blue  { background:#DBEAFE; color:#1E40AF; }
.b-gray  { background:#F1F5F9; color:#475569; }

/* ─── Login ──────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

.login-card {
  background: var(--card);
  border-radius: 14px;
  padding: 48px 40px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.24);
}

.login-titulo {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}

.login-subtitulo {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: -8px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #CBD5E0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border 0.15s;
}

.login-input:focus { border-color: var(--blue); }

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover { background: #144988; }

.login-erro {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

/* ─── Alert boxes ────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  border-left: 3px solid;
  margin-bottom: 8px;
}
.alert strong { font-weight: 600; display: block; margin-bottom: 2px; }
.alert-red   { background: #FEF2F2; border-color: #C0392B; color: #7F1D1D; }
.alert-amber { background: #FFFBEB; border-color: #D97706; color: #78350F; }
.alert-teal  { background: #F0FDF4; border-color: #0B9E80; color: #14532D; }
.alert-blue  { background: #EFF6FF; border-color: #1A5EAB; color: #1E3A5F; }

/* ─── Botão Imprimir PDF (Churn Web) ─────────────────────────── */
.cw-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #0B1929;
  color: white;
  border: none;
  border-radius: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 6px;
  transition: background 0.15s;
}
.cw-print-btn:hover { background: #1A5EAB; }

/* ─── Print / PDF ────────────────────────────────────────────── */
@media print {
  .navbar,
  .cw-print-btn,
  #cw-interval,
  [id="cw-limpar"],
  .VirtualizedSelectFocusedOption,
  .Select { display: none !important; }

  body, .page-content { background: white !important; }
  .page-content { padding: 0 !important; margin: 0 !important; }
  .js-plotly-plot, .plotly { width: 100% !important; }
  .previous-page, .next-page, .last-page, .first-page { display: inline-block !important; }
}

/* ─── Operação CS ─────────────────────────────────────────────── */
.cs-drawer-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1050;
  display: flex;
  justify-content: flex-end;
}
.cs-drawer-panel {
  background: #fff;
  width: min(880px, 75vw);
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}
@media (max-width: 768px) {
  .cs-drawer-panel { width: 100vw; }
}

.cs-statbar {
  display: flex;
  flex-wrap: wrap;
  background: #FFFFFF;
  border: 1px solid #E1E5EE;
  border-radius: 10px;
  overflow: hidden;
}
.cs-stat {
  flex: 1 1 150px;
  min-width: 150px;
  padding: 14px 20px;
  cursor: pointer;
  border-right: 1px solid #E1E5EE;
  transition: background 0.12s ease;
}
.cs-stat:last-child { border-right: none; }
.cs-stat:hover { background: #F7F8FB; }
.cs-stat-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: #646E85;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.cs-stat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.cs-stat-value { font-size: 22px; font-weight: 700; color: #0E1322; line-height: 1.15; }

.cs-toolbar {
  border-bottom: 1px solid #E1E5EE;
  padding-bottom: 16px;
}
.cs-search-wrap { position: relative; }
.cs-search-wrap .cs-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: #96A0B5; font-size: 13px; pointer-events: none;
}
.cs-switches { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.cs-btn-ghost {
  background: transparent; border: none; color: #646E85;
  font-weight: 600; cursor: pointer; font-family: inherit; padding: 0;
}
.cs-btn-ghost:hover { color: #AE2727; }

.cs-tabs .tab-container { border-bottom: 1px solid #E1E5EE; display: flex; }
.cs-tabs .tab {
  border: none !important; background: transparent !important;
  border-radius: 0 !important; padding: 10px 2px !important;
  margin-right: 24px; color: #646E85 !important; font-weight: 600;
  font-size: 13.5px; cursor: pointer;
}
.cs-tabs .tab--selected {
  color: #1D42D7 !important;
  border-bottom: 2px solid #1D42D7 !important;
}
.cs-tabs .tab:hover:not(.tab--selected) { color: #0E1322 !important; }

.cs-table-wrap .dash-spreadsheet-inner table { border-collapse: collapse; }
.cs-table-wrap .dash-spreadsheet-inner tr:hover td { background-color: #F7F8FB !important; }
.cs-table-wrap .dash-spreadsheet-inner th { border-bottom: 1px solid #C7CEDC !important; }
.cs-table-wrap .dash-spreadsheet-inner td { border-bottom: 1px solid #E1E5EE !important; }

.cs-page .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
}
.cs-page .badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cs-page .b-red   { background: #FBE6E6; color: #AE2727; }
.cs-page .b-amber { background: #FCF0D9; color: #B0740B; }
.cs-page .b-teal  { background: #E2F5EA; color: #12864B; }
.cs-page .b-blue  { background: #EDF0FC; color: #1D42D7; }
.cs-page .b-gray  { background: #EFF1F6; color: #646E85; }

.cs-quickaction {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; border: none;
  background: #EFF1F6; color: #333B50; font-size: 12.5px; font-weight: 600;
  text-decoration: none; transition: background 0.12s ease;
}
.cs-quickaction:hover { background: #E1E5EE; color: #0E1322; }

.cs-kanban {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}
.cs-kanban-col {
  flex: 1 1 260px;
  min-width: 260px;
  max-width: 320px;
  background: #F7F8FB;
  border: 1px solid #E1E5EE;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 340px);
  min-height: 200px;
}
.cs-kanban-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid #E1E5EE; flex-shrink: 0;
}
.cs-kanban-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cs-kanban-title {
  font-size: 12.5px; font-weight: 700; color: #333B50;
  text-transform: uppercase; letter-spacing: 0.03em; flex: 1;
}
.cs-kanban-count {
  font-size: 11px; font-weight: 700; color: #646E85;
  background: #EFF1F6; border-radius: 999px; padding: 1px 8px;
}
.cs-kanban-body {
  padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.cs-kanban-card {
  background: #FFFFFF; border: 1px solid #E1E5EE; border-radius: 8px;
  padding: 10px 12px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(6, 19, 61, 0.04);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.cs-kanban-card:hover { border-color: #C7CEDC; box-shadow: 0 2px 8px rgba(6, 19, 61, 0.08); }
.cs-kanban-card-title { font-size: 0.8125rem; font-weight: 600; color: #0E1322; }
.cs-kanban-card-sub { font-size: 0.75rem; color: #646E85; margin-top: 2px; }
.cs-kanban-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.cs-kanban-card-data { font-size: 0.75rem; font-weight: 600; color: #333B50; }
.cs-kanban-card-mrr { font-size: 0.6875rem; color: #646E85; }
.cs-kanban-card-badges {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
}
.cs-kanban-empty {
  color: #646E85; font-size: 0.8125rem; padding: 16px; text-align: center;
}

.cs-field-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; padding: 7px 0; border-bottom: 1px solid #E1E5EE;
}
.cs-field-row:last-child { border-bottom: none; }
.cs-field-label { font-size: 0.75rem; color: #646E85; flex-shrink: 0; }
.cs-field-value { font-size: 0.8125rem; font-weight: 600; color: #0E1322; text-align: right; }

/* ─── Toggle switch (substitui dbc.Switch) ───────────────────────── */
.cs-toggle-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13.5px; color: #333B50;
  font-weight: 500; user-select: none;
}
.cs-toggle {
  -webkit-appearance: none; appearance: none;
  width: 32px; height: 18px;
  background: #CBD5E0; border-radius: 999px;
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.cs-toggle:checked { background: #1D42D7; }
.cs-toggle::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  transition: transform 0.15s;
}
.cs-toggle:checked::after { transform: translateX(14px); }

/* ─── Modal overlay (substitui dbc.Modal) ───────────────────────── */
.cs-modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1055;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cs-modal-dialog {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.cs-modal-xl { max-width: 1140px; }
.cs-modal-lg { max-width: 800px; }
.cs-modal-md { max-width: 520px; }
.cs-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E1E5EE;
  flex-shrink: 0;
}
.cs-modal-title { font-size: 1rem; font-weight: 700; color: #0E1322; margin: 0; }
.cs-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.cs-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #E1E5EE;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Modal de formulário: overflow visível para dropdowns e calendário escaparem */
.cs-modal-dialog--form {
  overflow: visible;
}
.cs-modal-dialog--form .cs-modal-header {
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.cs-modal-dialog--form .cs-modal-body {
  overflow: visible;
}
.cs-modal-dialog--form .cs-modal-footer {
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

/* DatePickerSingle na barra de filtros da pesquisa — alinha com field_cls() */
.ps-date-filter,
.ps-date-filter .SingleDatePicker,
.ps-date-filter .SingleDatePickerInput {
  width: 100%;
  display: block;
}
.ps-date-filter .SingleDatePickerInput__withBorder {
  border: none !important;
  border-radius: 0 !important;
  width: 100%;
}
.ps-date-filter .DateInput {
  width: 100%;
}
.ps-date-filter .DateInput_input {
  width: 100% !important;
  height: 36px !important;
  padding: 0 12px !important;
  font-size: 0.875rem !important;
  font-family: inherit !important;
  color: #0E1322 !important;
  background: #fff !important;
  border: 1px solid #E1E5EE !important;
  border-radius: 6px !important;
  box-sizing: border-box;
  line-height: 36px !important;
}
.ps-date-filter .DateInput_input__focused {
  border-color: #1D42D7 !important;
  box-shadow: 0 0 0 3px rgba(29,66,215,0.15) !important;
  outline: none !important;
}

/* DatePickerSingle dentro de modais de formulário — alinha com field_cls() */
.cs-modal-dialog--form .SingleDatePicker,
.cs-modal-dialog--form .SingleDatePickerInput {
  width: 100%;
  display: block;
}
.cs-modal-dialog--form .SingleDatePickerInput__withBorder {
  border: none !important;
  border-radius: 0 !important;
  width: 100%;
}
.cs-modal-dialog--form .DateInput {
  width: 100%;
}
.cs-modal-dialog--form .DateInput_input {
  width: 100% !important;
  height: 36px !important;
  padding: 0 12px !important;
  font-size: 0.875rem !important;
  font-family: inherit !important;
  color: #0E1322 !important;
  background: #fff !important;
  border: 1px solid #E1E5EE !important;
  border-radius: 6px !important;
  box-sizing: border-box;
  line-height: 36px !important;
}
.cs-modal-dialog--form .DateInput_input__focused {
  border-color: #4F6BED !important;
  box-shadow: 0 0 0 3px rgba(79,107,237,0.15) !important;
  outline: none !important;
}
/* Calendário acima da overlay do modal */
.SingleDatePicker_picker {
  z-index: 2000 !important;
}

/* Tooltip CSS puro (substitui dcc.Tooltip que não suporta elementos HTML) */
.ps-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}
.ps-tooltip-box {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #E1E5EE;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(6, 19, 61, 0.12);
  z-index: 1200;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #333B50;
  text-align: left;
}
.ps-tooltip-wrap:hover .ps-tooltip-box { display: block; }
