/* ============================================================
   DIRETI — Main Stylesheet
   Design: Light Professional / Legal Blue  (estilo Salesforce)
   Fontes: Inter (corpo) + Plus Jakarta Sans (títulos)
   ============================================================ */

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

:root {
  /* ── Marca ─────────────────────────────────────────────── */
  --brand-blue:     #0176d3;
  --brand-blue-dk:  #014486;
  --brand-blue-lt:  #d6e9fb;
  --brand-cyan:     #06b6d4;
  --brand-green:    #2e844a;
  --brand-green-lt: #cdefc4;
  --brand-amber:    #dd7a01;
  --brand-amber-lt: #fde8c8;
  --brand-red:      #ba0517;
  --brand-red-lt:   #fbd0d5;
  --brand-purple:   #5a2cba;

  /* ── Backgrounds ────────────────────────────────────────── */
  --bg-base:           #f3f6fb;
  --bg-surface:        #ffffff;
  --bg-card:           #ffffff;
  --bg-elevated:       #f3f6fb;
  --bg-hover:          #eaf3fc;
  --bg-sidebar:        #16325c;
  --bg-sidebar-hover:  #1e3a6e;
  --bg-sidebar-active: #0176d3;

  /* ── Bordas ─────────────────────────────────────────────── */
  --border:       #dde3ed;
  --border-light: #c9d3e0;
  --border-focus: #0176d3;

  /* ── Texto ──────────────────────────────────────────────── */
  --text-primary: #181c2e;
  --text-muted:   #5a6478;
  --text-xmuted:  #9aa5b8;
  --text-sidebar: #c5d4e8;

  /* ── Layout ─────────────────────────────────────────────── */
  --sidebar-w:  228px;
  --topbar-h:   56px;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 8px rgba(22,50,92,0.10);
  --shadow-md:  0 4px 20px rgba(22,50,92,0.13);
  --transition: 0.15s ease;

  /* ── Fontes ─────────────────────────────────────────────── */
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

/* ─── RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--bg-base);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { color: var(--brand-blue-dk); text-decoration: underline; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ─── SIDEBAR ───────────────────────────────────────────── */
.direti-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 900;
  transition: transform var(--transition);
  box-shadow: 2px 0 12px rgba(22,50,92,0.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-icon { font-size: 1.3rem; color: #4db8ff; }
.brand-name { color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 0.845rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar-nav .nav-link i { font-size: 0.95rem; width: 17px; flex-shrink: 0; opacity: 0.8; }
.sidebar-nav .nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link:hover i { opacity: 1; }
.sidebar-nav .nav-link.active { background: var(--bg-sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav .nav-link.active i { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0176d3, #4db8ff);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
}

.user-info { display: flex; flex-direction: column; min-width: 0; }

.user-name {
  font-size: 0.78rem; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-role { font-size: 0.68rem; color: var(--text-sidebar); opacity: 0.7; }

.btn-logout-full {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 8px 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #c5d4e8;
  font-size: 0.845rem;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
}
.btn-logout-full i { font-size: 0.95rem; flex-shrink: 0; }
.btn-logout-full:hover {
  background: rgba(186,5,23,0.25);
  border-color: rgba(186,5,23,0.4);
  color: #fca5a5;
  text-decoration: none;
}

.btn-logout {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  transition: all var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}
.btn-logout:hover { background: rgba(186,5,23,0.2); color: #fca5a5; }

/* ─── TOPBAR ────────────────────────────────────────────── */
.direti-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  z-index: 800;
  box-shadow: 0 1px 4px rgba(22,50,92,0.06);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

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

/* ─── MAIN ──────────────────────────────────────────────── */
.direti-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
  flex: 1;
  overflow-x: hidden;
}

/* ─── CARDS ─────────────────────────────────────────────── */
.d-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.d-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.d-card-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

/* ─── METRIC CARDS ──────────────────────────────────────── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.metric-card.blue::before   { background: var(--brand-blue); }
.metric-card.amber::before  { background: var(--brand-amber); }
.metric-card.purple::before { background: var(--brand-purple); }
.metric-card.green::before  { background: var(--brand-green); }
.metric-card.red::before    { background: var(--brand-red); }

.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.metric-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  margin-bottom: 12px;
}

.metric-icon.blue   { background: var(--brand-blue-lt);  color: var(--brand-blue); }
.metric-icon.amber  { background: var(--brand-amber-lt); color: var(--brand-amber); }
.metric-icon.purple { background: #ede9fb;               color: var(--brand-purple); }
.metric-icon.green  { background: var(--brand-green-lt); color: var(--brand-green); }
.metric-icon.red    { background: var(--brand-red-lt);   color: var(--brand-red); }

.metric-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.865rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-primary   { background: var(--brand-blue);  border-color: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-dk); border-color: var(--brand-blue-dk); color: #fff; }
.btn-success   { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.btn-warning   { background: var(--brand-amber); border-color: var(--brand-amber); color: #fff; }
.btn-danger    { background: var(--brand-red);   border-color: var(--brand-red);   color: #fff; }
.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-light);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-focus);
  color: var(--brand-blue);
}
.btn-sm { font-size: 0.78rem; padding: 4px 10px; }

/* ─── TABLES ────────────────────────────────────────────── */
.d-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.d-table thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}

.d-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

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

/* ─── BADGES ────────────────────────────────────────────── */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── FORMS ─────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
  background: var(--bg-surface);
  border-color: var(--border-focus);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(1,118,211,0.15);
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}

/* ─── MODAL ─────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.modal-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── KANBAN ────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 160px);
  align-items: flex-start;
}

.kanban-column {
  min-width: 272px;
  max-width: 272px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
}

.kanban-col-header {
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.kanban-col-count {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 80px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(22,50,92,0.06);
}

.kanban-card:hover {
  border-color: var(--brand-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(1,118,211,0.12);
}

.kanban-card.sortable-ghost { opacity: 0.4; background: var(--bg-elevated); }
.kanban-card.sortable-drag  { box-shadow: 0 8px 32px rgba(1,118,211,0.2); transform: rotate(1deg); }

.card-lead-name {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--text-primary);
}

.card-lead-phone { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 6px; }

.card-lead-need {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  line-height: 1.45;
}

.card-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.69rem;
  color: var(--text-xmuted);
}

/* ─── CHAT ──────────────────────────────────────────────── */
.chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.chat-msg.in  { align-self: flex-start; }
.chat-msg.out { align-self: flex-end; align-items: flex-end; }

.chat-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.845rem;
  line-height: 1.5;
  word-break: break-word;
  font-family: var(--font-body);
}

.chat-msg.in  .chat-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  color: var(--text-primary);
}

.chat-msg.out .chat-bubble {
  background: var(--brand-blue-lt);
  border: 1px solid #9dcbf5;
  border-bottom-right-radius: 3px;
  color: var(--brand-blue-dk);
}

.chat-time { font-size: 0.67rem; color: var(--text-xmuted); margin-top: 3px; padding: 0 4px; }

/* ─── LOGIN ─────────────────────────────────────────────── */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #e8f0fb 0%, #f3f6fb 50%, #ddeeff 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(22,50,92,0.14);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.login-logo .logo-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--bg-sidebar);
  display: block;
  letter-spacing: -0.03em;
}
.login-logo .logo-sub { font-size: 0.77rem; color: var(--text-muted); display: block; margin-top: 3px; }

/* ─── CONTRATO ──────────────────────────────────────────── */
.sign-page { min-height: 100vh; background: #f3f6fb; color: var(--text-primary); font-family: var(--font-body); }
.sign-header { background: var(--bg-sidebar); color: #fff; padding: 18px 32px; display: flex; align-items: center; gap: 12px; }
.contract-body {
  max-width: 800px;
  margin: 32px auto;
  padding: 40px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  line-height: 1.8;
  border: 1px solid var(--border);
}

/* ─── ALERTS ────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); border: 1px solid; font-size: 0.86rem; font-family: var(--font-body); }

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

/* ─── FILTER BAR ────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }

/* ─── NAV PILLS ─────────────────────────────────────────── */
.nav-pills .nav-link { color: var(--text-muted); font-size: 0.845rem; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid transparent; }
.nav-pills .nav-link:hover { background: var(--bg-hover); color: var(--brand-blue); }
.nav-pills .nav-link.active { background: var(--brand-blue-lt); color: var(--brand-blue); font-weight: 600; border-color: #9dcbf5; }

/* ─── MISC ──────────────────────────────────────────────── */
.text-muted-custom { color: var(--text-muted) !important; }
.separator { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.875rem; }
.empty-state i { font-size: 2rem; margin-bottom: 10px; display: block; color: var(--text-xmuted); }

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 768px) {
  .direti-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .direti-sidebar.open { transform: translateX(0); }
  .direti-topbar { left: 0; }
  .sidebar-toggle { display: flex; }
  .direti-main { margin-left: 0; padding: 16px; }
  .kanban-board { flex-direction: column; }
  .kanban-column { min-width: 100%; max-width: 100%; max-height: none; }
  .metric-value { font-size: 1.55rem; }
  .login-card { margin: 20px; padding: 32px 24px; }
}