@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:          #0D1117;
  --bg2:         #161B22;
  --bg3:         #1C2333;
  --bg4:         #21262D;
  --border:      #30363D;
  --border2:     #3D444D;
  --text:        #E6EDF3;
  --text2:       #8B949E;
  --text3:       #6E7681;
  --green:       #00C896;
  --green2:      #00A87E;
  --green-bg:    rgba(0,200,150,.12);
  --blue:        #58A6FF;
  --blue-bg:     rgba(88,166,255,.10);
  --orange:      #F78166;
  --orange-bg:   rgba(247,129,102,.12);
  --yellow:      #E3B341;
  --yellow-bg:   rgba(227,179,65,.12);
  --purple:      #BC8CFF;
  --purple-bg:   rgba(188,140,255,.12);
  --sidebar-w:   260px;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --font:        'Plus Jakarta Sans', sans-serif;
  --mono:        'JetBrains Mono', monospace;
  --transition:  .18s ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.logo-text span { color: var(--green); }

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
  padding: 0 8px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--green-bg); color: var(--green); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--green);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.nav-badge.orange { background: var(--orange); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.user-chip:hover { background: var(--bg3); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #000;
  flex-shrink: 0;
}

.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; truncate; }
.user-role { font-size: 11px; color: var(--text3); }

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── PAGE CONTENT ── */
.page {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

/* ── CARDS ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

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

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: auto;
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--orange); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: #000;
}
.btn-primary:hover { background: var(--green2); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg4); border-color: var(--border2); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid rgba(247,129,102,.3);
}
.btn-danger:hover { background: rgba(247,129,102,.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 15px;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg4); color: var(--text); }

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray   { background: var(--bg4);       color: var(--text2); }

/* ── FORMS ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.form-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,200,150,.12); }
.form-input::placeholder { color: var(--text3); }

textarea.form-input { resize: vertical; min-height: 90px; line-height: 1.6; }

.form-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B949E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select:focus { border-color: var(--green); }

/* ── TOGGLE ── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  width: 40px; height: 22px;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  width: 16px; height: 16px;
  background: var(--text3);
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: var(--transition);
}

.toggle.on { background: var(--green); border-color: var(--green); }
.toggle.on::after { background: #000; left: 20px; }

.toggle-label { font-size: 13px; font-weight: 500; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

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

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: var(--transition);
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── SEARCH ── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
  width: 220px;
}

.search-box input::placeholder { color: var(--text3); }
.search-icon { color: var(--text3); font-size: 14px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

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

.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text2);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 13px; max-width: 320px; margin: 0 auto 20px; }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 6px;
  background: var(--bg4);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .4s ease;
}

/* ── TOOLTIP ── */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 99;
}

.tooltip-wrap:hover .tooltip { opacity: 1; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── FLEX UTILS ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text2); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.fw-700 { font-weight: 700; }

/* ── CHAT UI ── */
.chat-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.chat-bubble.out {
  background: var(--green);
  color: #000;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.chat-bubble.in {
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-bubble.bot {
  background: var(--blue-bg);
  border: 1px solid rgba(88,166,255,.2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-time {
  font-size: 10px;
  color: var(--text3);
  text-align: right;
  margin-bottom: 12px;
}

/* ── STEP INDICATOR ── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
}

.step:last-child::before { display: none; }

.step.done::before { background: var(--green); }

.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text3);
  z-index: 1;
  position: relative;
}

.step.done .step-dot { background: var(--green); border-color: var(--green); color: #000; }
.step.active .step-dot { background: var(--bg); border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px rgba(0,200,150,.15); }

.step-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  margin-top: 6px;
  text-align: center;
}

.step.active .step-label { color: var(--green); }
.step.done .step-label { color: var(--text2); }

/* ── KANBAN ── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col {
  min-width: 240px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  flex-shrink: 0;
}

.kanban-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.kanban-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow); }

/* ── NOTIFICATION DOT ── */
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ── CHART PLACEHOLDER ── */
.chart-area {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
}

.chart-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--green-bg);
  border: 1px solid rgba(0,200,150,.3);
  transition: var(--transition);
  position: relative;
}

.chart-bar:hover { background: rgba(0,200,150,.25); }
.chart-bar.highlight { background: var(--green); border-color: var(--green); }

/* ── DONUT ── */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: conic-gradient(
    var(--green) 0% 62%,
    var(--blue) 62% 80%,
    var(--orange) 80% 92%,
    var(--bg4) 92% 100%
  );
  position: relative;
  flex-shrink: 0;
}

.donut::after {
  content: '';
  width: 64px; height: 64px;
  background: var(--bg2);
  border-radius: 50%;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── WHATSAPP PREVIEW ── */
.wa-preview {
  background: #0B141A;
  border-radius: 12px;
  padding: 14px;
  max-width: 280px;
}

.wa-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.wa-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

.wa-name { font-size: 13px; font-weight: 600; }
.wa-status { font-size: 10px; color: #8696A0; }

.wa-msg {
  background: #1F2C34;
  border-radius: 8px 8px 8px 0;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #E9EDEF;
  margin-bottom: 6px;
  max-width: 220px;
}

.wa-msg.out {
  background: #005C4B;
  border-radius: 8px 8px 0 8px;
  margin-left: auto;
}

/* ── SIDEBAR EMPRESA INDICATOR ── */
.empresa-selector {
  margin: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.empresa-selector:hover { border-color: var(--border2); }

.empresa-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.empresa-name { font-size: 12.5px; font-weight: 600; flex: 1; }
.empresa-plan { font-size: 10px; color: var(--text3); }

/* ── ANIMATION ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease forwards; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.pulse { animation: pulse 2s infinite; }
