:root {
  /* Modern Clean Theme */
  --bg: #FFFFFF;
  /* White Background as requested */
  --text: #2B3674;
  --text-secondary: #A3AED0;
  --card: #ffffff;
  --border: #E0E5F2;

  /* Primary Purple */
  /* Identidade SegZio: navy + azul-claro (mesma paleta da landing) */
  --primary: #001848;
  --primary2: #4DA8FF;
  --primary-soft: #EAF3FF;

  --danger: #EE5D50;
  --success: #05CD99;
  --warning: #FFCE20;

  --shadow: 0px 18px 40px rgba(112, 144, 176, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Global: Remove Underlines */
a {
  text-decoration: none !important;
}

/* Glass / Clean Classes */
.glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid white;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  /* Reduced padding (was 30px) */
  background: var(--primary);
  /* Purple Header */
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  height: 60px;
  /* Fixed height to prevent expansion */
}

.brand {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Logo Image Style */
.brand img {
  /* ADJUST HEIGHT HERE */
  height: 110px;
  /* Reduced by 20px (was 180px) */
  width: auto;
  position: absolute;
  /* Force to corner */
  top: -25px;
  /* Moves up further */
  left: -25px;
  /* Moves left to corner */
  z-index: 100;
  margin: 0;
}

.logo-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4DA8FF 0%, #001848 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
  box-shadow: none;
}

.brand-text .title {
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
}

.brand-text .subtitle {
  display: none;
}

.nav a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  /* Light text on purple */
  font-weight: 500;
  margin-left: 30px;
  font-size: 16px;
  transition: all 0.2s;
}

.nav a:hover {
  color: white;
  font-weight: 700;
}

.nav a.active {
  color: var(--text);
  font-weight: 700;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: none;
  margin-bottom: 24px;
}

.card.glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 980px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .col-span-12 {
    grid-column: span 12;
  }

  .col-span-8 {
    grid-column: span 8;
  }

  .col-span-6 {
    grid-column: span 6;
  }

  .col-span-4 {
    grid-column: span 4;
  }

  .col-span-3 {
    grid-column: span 3;
  }
}

h1 {
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.muted {
  color: var(--text-secondary);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: none;
  margin: 8px 0 20px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Fix for Search Form alignment */
form[method="GET"] {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
}

form[method="GET"] .input {
  margin-bottom: 0 !important;
}

.textarea {
  min-height: 120px;
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 10px 20px -10px var(--primary);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px var(--primary);
  filter: brightness(110%);
}

.btn.secondary {
  background: #111C44;
  box-shadow: 0 10px 20px -10px #111C44;
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
  border: 1px solid transparent;
}

.btn.ghost:hover {
  background: var(--primary-soft);
}

.btn-icon {
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: 0.2s;
  width: auto;
  height: auto;
  display: inline-block;
}

.btn-icon:hover {
  color: var(--primary);
  transform: scale(1.1);
  background: transparent;
}

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

.table th {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  background: transparent;
  letter-spacing: normal;
}

.table td {
  padding: 16px 20px;
  color: var(--text);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--primary-soft);
  cursor: default;
}

.badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
}

.hr {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
  opacity: 0.5;
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.row .col {
  flex: 1;
  min-width: 220px;
}

.flash-wrap {
  margin-bottom: 20px;
}

.flash {
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.flash.danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.flash.warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.flash.success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

/* Clean Kanban */
.kanban {
  display: flex;
  gap: 16px;
  width: 100%;
  height: calc(100vh - 180px);
  /* Fixed height */
  overflow: hidden;
  /* No outer scroll */
  align-items: stretch;
  /* Cards stretch height */
  padding-bottom: 0;
}

.kcol {
  flex: 1;
  min-width: 0;
  background: #F4F7FE;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid transparent;
  overflow-y: auto;
  /* Internal scroll */
}

/* Scrollbar Styling for Kanban Columns */
.kcol::-webkit-scrollbar {
  width: 6px;
}

.kcol::-webkit-scrollbar-track {
  background: transparent;
}

.kcol::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.kcol::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.khead {
  flex-shrink: 0;
  /* Don't shrink header */
  padding: 0 4px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.khead .title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.khead .count {
  font-size: 12px;
  color: var(--primary);
  background: white;
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 700;
}

.klist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
  flex-grow: 1;
  /* Fill remaining space */
}

.kcard {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  cursor: grab;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
  /* Don't squash cards */
}

.kcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
  border-color: var(--primary-soft);
}

.kcard .t {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  /* Prevent wrapping */
  overflow: hidden;
  /* Hide overflow */
  text-overflow: ellipsis;
  /* Ellipsis */
}

.kcard .s {
  font-size: 0.85rem;
  color: var(--muted);
}

.kdrop {
  outline: 2px dashed var(--primary);
  background: var(--primary-soft);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.2;
}

.topbar {
  position: sticky;
  overflow: visible;
  min-height: 44px;
  height: auto;
  padding: 2px 10px;
  margin-bottom: 14px;
}

.brand img {
  height: 66px;
  max-width: none;
  object-fit: contain;
  object-position: left center;
  margin-left: -8px;
  position: static;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  flex-wrap: wrap;
}

.nav a {
  margin-left: 0;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.nav .danger {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.auth-shell {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
  padding: 24px 0 32px;
}

.crm-auth-shell {
  background: transparent;
}

.auth-card {
  width: min(560px, 100%);
  padding: 32px;
  position: relative;
}

.auth-card h1 {
  font-size: 40px;
}

.auth-submit {
  min-width: 150px;
}

.login-corner-tag {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #7e3f92;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form label {
  display: block;
  margin-left: 4px;
}

.login-form .input {
  width: calc(100% - 8px);
  margin-left: 4px;
  margin-right: 4px;
}

@media (max-width: 920px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    height: auto;
    min-height: 50px;
    padding: 4px 8px;
    margin-bottom: 14px;
  }

  .brand img {
    height: 56px;
    max-width: none;
    margin-left: -4px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 10px;
    right: 10px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 35px rgba(17, 24, 39, 0.18);
    padding: 10px;
    z-index: 60;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    color: #1f2a60;
    font-size: 15px;
    padding: 10px 12px;
  }

  .nav .danger {
    background: #fef2f2;
    color: #b91c1c;
  }

  .container {
    padding: 0 14px 24px;
    max-width: 100%;
  }

  .auth-shell {
    min-height: auto;
    padding-top: 0;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .login-corner-tag {
    top: 10px;
    right: 12px;
    font-size: 11px;
  }

  .auth-card h1 {
    font-size: 32px;
  }

  canvas {
    max-width: 100% !important;
  }
}

/* ===== Campanhas: variantes de cor, toggle, charts ===== */
.badge.success { background: #e6f6ec; color: #1a7f37; }
.badge.warning { background: #fff5e6; color: #b76e00; }
.badge.danger  { background: #fdeaea; color: #c0392b; }
.badge.ghost   { background: #eef0f5; color: #5b6478; }

.btn.success { background: #1a7f37; box-shadow: 0 10px 20px -10px #1a7f37; }
.btn.warning { background: #b76e00; box-shadow: 0 10px 20px -10px #b76e00; }
.btn.danger  { background: #c0392b; box-shadow: 0 10px 20px -10px #c0392b; }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 16px; }
.kpi { background: var(--primary-soft); border-radius: 16px; padding: 18px; text-align: center; }
.kpi .v { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.kpi .l { font-size: .8rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; margin-top: 4px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; margin: 10px 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { width: 48px; height: 26px; background: #cdd3e0; border-radius: 999px; position: relative; transition: .2s; flex: 0 0 48px; }
.switch .slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch .txt { font-weight: 600; color: var(--text); }

.search-drop { border: 1px solid var(--border); border-radius: 14px; margin: -12px 0 16px; max-height: 240px; overflow: auto; background: #fff; }
.search-drop .opt { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.search-drop .opt:last-child { border-bottom: none; }
.search-drop .opt:hover { background: var(--primary-soft); }

.chart-box { position: relative; height: 320px; }

/* Cabecalho de pagina + grupo de acoes (sem estourar o container) */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { margin-bottom: 4px; }
.field > label { display: block; font-weight: 600; margin: 6px 0 0; }

/* Barra de progresso */
.progress { background: #eef0f5; border-radius: 999px; height: 14px; overflow: hidden; width: 100%; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
