/* ============================================================
   AGÊNCIA TOSTE — SISTEMA DE GESTÃO
   Design System — Linear / Vercel inspired
   ============================================================ */

/* --- TOKENS ------------------------------------------------ */
:root {
  --sidebar-bg: #FFFFFF;
  --sidebar-width: 220px;

  --accent: #20C1F5;
  --accent-hover: #0AAEE0;
  --accent-light: rgba(32, 193, 245, 0.1);

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --border-hover: #CBD5E1;

  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;

  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.13);
  --sidebar-bg: #0d0d0d;
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-tertiary: #555555;
  --success-bg: rgba(16,185,129,0.12);
  --warning-bg: rgba(245,158,11,0.12);
  --danger-bg: rgba(239,68,68,0.12);
  --info-bg: rgba(59,130,246,0.12);
  --accent-light: rgba(32,193,245,0.10);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow: 0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.6);
}

/* --- RESET ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* --- SIDEBAR ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .user-info-text,
.sidebar.collapsed .sidebar-logo-img,
.sidebar.collapsed .logo-dark-show,
.sidebar.collapsed .logo-dark-hide { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 20px 0 16px; }
.sidebar.collapsed .sidebar-logo::after {
  content: 'AT';
  font-size: 13px; font-weight: 800; color: var(--accent);
  letter-spacing: -0.5px;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-collapse-btn { justify-content: center; }
.sidebar.collapsed .nav-icon { width: 20px; height: 20px; }
.sidebar.collapsed .nav-icon svg { width: 18px; height: 18px; }
.main-content { transition: margin-left 0.25s cubic-bezier(.4,0,.2,1); }
.sidebar.collapsed ~ .main-content { margin-left: 64px; }

.sidebar-logo {
  padding: 20px 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.sidebar-logo-img { height: 32px; width: auto; }

/* Troca de logo claro/escuro */
.logo-dark-show { display: none; }
.logo-dark-hide { display: block; }
[data-theme="dark"] .logo-dark-show { display: block; }
[data-theme="dark"] .logo-dark-hide { display: none; }

.sidebar-nav { flex: 1; padding: 4px 10px; overflow-y: auto; }

.nav-group-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 14px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap; margin-bottom: 2px;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--surface-2);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Dark mode nav overrides */
[data-theme="dark"] .nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #e0e0e0;
}
[data-theme="dark"] .nav-item.active {
  background: rgba(255,255,255,0.11);
  color: #ffffff;
  font-weight: 600;
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 16px; height: 16px; stroke-width: 1.75; color: currentColor; }
.nav-label { flex: 1; }

.nav-badge {
  font-size: 10px; font-weight: 600;
  background: var(--danger); color: white;
  border-radius: 99px; padding: 1px 6px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 10px;
  cursor: pointer; transition: background var(--transition);
  flex: 1;
}
.sidebar-user:hover { background: var(--surface-2); }
[data-theme="dark"] .sidebar-user:hover { background: rgba(255,255,255,0.06); }

.user-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: white; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.user-info-text { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-tertiary); }

.theme-btn {
  width: 28px; height: 28px; border-radius: 8px;
  color: var(--text-tertiary); display: flex; align-items: center;
  justify-content: center; transition: all var(--transition); flex-shrink: 0;
}
.theme-btn:hover { background: var(--surface-2); color: var(--text-primary); }
[data-theme="dark"] .theme-btn:hover { background: rgba(255,255,255,0.08); }
.theme-btn svg { width: 15px; height: 15px; }

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

.page-header {
  padding: 28px 32px 0;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
}

.page-title { font-size: 20px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.page-body { padding: 20px 32px 32px; flex: 1; overflow-y: auto; }

/* --- CARDS ------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.card-title { font-size: 13.5px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-secondary); }
.card-body { padding: 20px; }

/* --- STATS ------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.stat-label {
  font-size: 11.5px; font-weight: 500; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 6px;
}
.stat-label svg { width: 13px; height: 13px; }
.stat-value {
  font-size: 26px; font-weight: 700; margin-top: 8px;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 6px; }
.stat-change {
  font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: var(--radius-sm); display: inline-flex;
}
.stat-change.up { color: var(--success); background: var(--success-bg); }
.stat-change.down { color: var(--danger); background: var(--danger-bg); }

/* --- BUTTONS ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--radius); transition: all var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-hover); }
.btn-ghost { color: var(--text-secondary); padding: 7px 10px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* --- BADGES ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray { background: var(--surface-2); color: var(--text-secondary); }
.badge-orange { background: var(--accent-light); color: var(--accent); }

/* --- TABLE ------------------------------------------------- */
.table-wrapper {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-2); }

/* --- FORMS ------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.form-control {
  padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-size: 13px;
  transition: all var(--transition); outline: none; width: 100%;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-tertiary); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* --- TOOLBAR ----------------------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.search-input { position: relative; flex: 1; max-width: 300px; }
.search-input svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-tertiary); pointer-events: none;
}
.search-input input {
  padding: 7px 12px 7px 32px; background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-primary); font-size: 13px; width: 100%;
  outline: none; transition: all var(--transition);
}
.search-input input:focus {
  background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- AVATAR ------------------------------------------------ */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #FF8F65);
  color: white; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* --- CLIENT CARDS ----------------------------------------- */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.client-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: all var(--transition); cursor: pointer;
}
.client-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.client-card-info { flex: 1; min-width: 0; }
.client-card-name { font-size: 14px; font-weight: 600; }
.client-card-spec { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.client-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }


/* ═══════════════════════════════════════════════════════════
   KANBAN — TAREFAS
═══════════════════════════════════════════════════════════ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  align-items: start;
  padding-bottom: 16px;
}
.kanban-col {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.kanban-col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface-2); z-index: 2;
}
.kanban-col-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { font-size: 12.5px; font-weight: 700; flex: 1; text-transform: uppercase; letter-spacing: 0.03em; }
.kanban-col-count {
  min-width: 22px; height: 22px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
}
.kanban-items {
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 100px; transition: background 0.15s;
}
.kanban-items.drag-over {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.kanban-drop-zone {
  border: 2px dashed transparent; border-radius: 8px;
  padding: 10px; text-align: center; font-size: 11.5px;
  font-weight: 500; color: transparent; transition: all 0.15s;
}
.kanban-drop-zone.drag-over-zone {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s, opacity 0.15s;
  user-select: none;
}
.kanban-card[data-prio="urgente"]  { border-left-color: #EF4444; }
.kanban-card[data-prio="alta"]     { border-left-color: #F97316; }
.kanban-card[data-prio="normal"]   { border-left-color: #3B82F6; }
.kanban-card[data-prio="baixa"]    { border-left-color: #94A3B8; }
.kanban-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); border-color: var(--border-hover); }
.kanban-card.dragging { opacity: 0.25; transform: none; cursor: grabbing; }
.kanban-card-drag-handle {
  position: absolute; top: 10px; right: 10px;
  color: var(--text-tertiary); opacity: 0; transition: opacity 0.15s;
  cursor: grab; line-height: 0;
}
.kanban-card:hover .kanban-card-drag-handle { opacity: 1; }
.kanban-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; padding-right: 20px; color: var(--text-primary); }
.kanban-card-client {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-secondary); margin-top: 5px;
}
.kanban-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   PIPELINE — CRM
═══════════════════════════════════════════════════════════ */
.pipeline-board {
  display: grid; grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 10px; align-items: start; padding-bottom: 16px;
}
.pipeline-col {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.pipeline-col-header {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.pipeline-col-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.pipeline-col-value { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.pipeline-items {
  padding: 8px; display: flex; flex-direction: column; gap: 7px;
  min-height: 80px; transition: background 0.15s;
}
.pipeline-items.drag-over { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pipeline-drop-zone {
  border: 2px dashed transparent; border-radius: 7px;
  padding: 8px; text-align: center; font-size: 11px;
  color: transparent; transition: all 0.15s; margin-top: 2px;
}
.pipeline-drop-zone.drag-over-zone {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.pipeline-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
  cursor: grab; position: relative;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}
.pipeline-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-1px); border-color: var(--border-hover); }
.pipeline-card.dragging { opacity: 0.25; transform: none; cursor: grabbing; }
.pipeline-card-name { font-size: 12px; font-weight: 600; }
.pipeline-card-esp  { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.pipeline-card-valor { font-size: 12px; font-weight: 700; color: var(--accent); margin-top: 6px; }
.pipeline-drag-handle {
  position: absolute; top: 8px; right: 8px;
  color: var(--text-tertiary); opacity: 0; transition: opacity 0.15s; cursor: grab; line-height: 0;
}
.pipeline-card:hover .pipeline-drag-handle { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   AUTOMAÇÕES
═══════════════════════════════════════════════════════════ */
.automacao-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: all 0.15s; position: relative; overflow: hidden;
}
.automacao-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent);
}
.automacao-card:hover { border-color: var(--border-hover); box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); }
.automacao-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.automacao-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.automacao-tasks {
  margin: 12px 0 0; display: flex; flex-direction: column; gap: 5px;
  max-height: 200px; overflow-y: auto;
}
.automacao-task {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background 0.15s;
}
.automacao-task:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }
.automacao-task-num {
  min-width: 20px; height: 20px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.automacao-task-day {
  font-size: 10.5px; color: var(--text-tertiary);
  background: var(--surface); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   PAGES — CONTROLE DE VISIBILIDADE (CRÍTICO)
═══════════════════════════════════════════════════════════ */
.page { display: none; flex-direction: column; flex: 1; min-height: 0; }
.page.active { display: flex; }

/* ─── DETAIL ROWS ─────────────────────────────────────────── */
.detail-row {
  display: flex; gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 12px; font-weight: 500; color: var(--text-secondary); min-width: 120px; }
.detail-value { font-size: 13px; flex: 1; }

/* ─── SECTION LABEL ────────────────────────────────────────── */
.section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary); margin-bottom: 10px;
}

/* ─── UTILS ─────────────────────────────────────────────────── */
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none !important; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: modalIn .15s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 18px; line-height: 1;
  padding: 4px; border-radius: 6px; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: var(--surface);
  padding: 10px 20px; border-radius: 99px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  z-index: 9999; white-space: nowrap;
  transition: opacity .25s, transform .25s;
}
.toast.hidden { display: none; }
.toast.success { background: #16A34A; }
.toast.error   { background: #DC2626; }
.toast.info    { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   CALENDÁRIO
═══════════════════════════════════════════════════════════ */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
}
.calendar-day-header {
  padding: 10px 0; text-align: center;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.calendar-day {
  min-height: 90px; padding: 6px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top; position: relative;
  transition: background var(--transition);
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day:hover { background: var(--surface-2); }
.calendar-day.other-month { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.calendar-day.other-month .calendar-day-num { color: var(--text-tertiary); }
.calendar-day.today .calendar-day-num {
  background: var(--accent); color: #fff;
  border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.calendar-day-num { font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.calendar-event {
  font-size: 10.5px; font-weight: 500; padding: 2px 5px;
  border-radius: 4px; margin-bottom: 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity var(--transition);
}
.calendar-event:hover { opacity: .8; }
.calendar-event.reuniao    { background: color-mix(in srgb,#3B82F6 15%,transparent); color: #1D4ED8; }
.calendar-event.entrega    { background: color-mix(in srgb,#10B981 15%,transparent); color: #065F46; }
.calendar-event.vencimento { background: color-mix(in srgb,#F59E0B 15%,transparent); color: #92400E; }
.calendar-event.renovacao  { background: color-mix(in srgb,#8B5CF6 15%,transparent); color: #4C1D95; }
.calendar-event.outro      { background: color-mix(in srgb,#6B7280 15%,transparent); color: #374151; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 32px; text-align: center; color: var(--text-secondary);
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-subtitle { font-size: 13px; line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════
   FILTER BUTTONS
═══════════════════════════════════════════════════════════ */
.filter-btn {
  padding: 5px 12px; border-radius: 99px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ─── SIDEBAR COLLAPSE BUTTON ───────────────────────────────── */
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 8px 10px 0; cursor: pointer;
}
.sidebar-collapse-btn button {
  width: 24px; height: 24px; border-radius: 6px;
  color: #94A3B8; display: flex; align-items: center;
  justify-content: center; transition: all var(--transition); flex-shrink: 0;
  border: 1px solid #E2E8F0;
}
.sidebar-collapse-btn button:hover { background: #F1F5F9; color: #0F172A; }
.sidebar-collapse-btn button svg { width: 13px; height: 13px; transition: transform 0.25s; }
.sidebar.collapsed .sidebar-collapse-btn button svg { transform: rotate(180deg); }

/* ─── NAV TOOLTIP (collapsed mode) ─────────────────────────── */
.sidebar.collapsed .nav-item { position: relative; }
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute; left: 72px; top: 50%;
  transform: translateY(-50%);
  background: #0F172A; color: rgba(255,255,255,0.9);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

/* ─── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  height: 52px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--surface); flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition);
}
.topbar-icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.topbar-icon-btn svg { width: 16px; height: 16px; }

/* ── Dark mode overrides ─────────────────────────────────── */
[data-theme="dark"] .sidebar {
  background: #0d0d0d;
  border-right-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .sidebar-logo { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sidebar-footer { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .nav-item { color: #666; }
[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,0.07); color: #e0e0e0; }
[data-theme="dark"] .nav-item.active {
  background: rgba(255,255,255,0.11);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
[data-theme="dark"] .nav-group-label { color: #3a3a3a; }
[data-theme="dark"] .user-name { color: #e0e0e0; }
[data-theme="dark"] .user-role { color: #555; }
[data-theme="dark"] .theme-btn { color: #555; }
[data-theme="dark"] .theme-btn:hover { background: rgba(255,255,255,0.07); color: #ccc; }
[data-theme="dark"] .sidebar-collapse-btn button { border-color: rgba(255,255,255,0.08); color: #555; }
[data-theme="dark"] .sidebar-collapse-btn button:hover { background: rgba(255,255,255,0.07); color: #ccc; }
[data-theme="dark"] .topbar {
  background: #0d0d0d;
  border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .card {
  background: #161616;
  border-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .card-header {
  border-bottom-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.75); }
[data-theme="dark"] .modal {
  background: #161616;
  border: 1px solid rgba(255,255,255,0.08);
}
[data-theme="dark"] .form-control {
  background: #1e1e1e;
  border-color: rgba(255,255,255,0.1);
  color: #f0f0f0;
}
[data-theme="dark"] .form-control:focus {
  border-color: var(--accent);
  background: #222;
}
[data-theme="dark"] .btn-secondary {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
  color: #ccc;
}
[data-theme="dark"] .btn-secondary:hover {
  background: rgba(255,255,255,0.13);
  color: #fff;
}
[data-theme="dark"] .btn-ghost { color: #777; }
[data-theme="dark"] .btn-ghost:hover { background: rgba(255,255,255,0.07); color: #ccc; }
[data-theme="dark"] select.form-control option { background: #1e1e1e; }
[data-theme="dark"] .topbar-search-bar {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  color: #666;
}
[data-theme="dark"] .topbar-search-bar:hover {
  border-color: var(--accent);
  color: #aaa;
}
[data-theme="dark"] .topbar-search-bar kbd {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #555;
}
[data-theme="dark"] .page-header,
[data-theme="dark"] .page-body { background: transparent; }
[data-theme="dark"] table th {
  background: #1a1a1a;
  border-color: rgba(255,255,255,0.07);
  color: #888;
}
[data-theme="dark"] table td {
  border-color: rgba(255,255,255,0.05);
  color: #ccc;
}
[data-theme="dark"] table tr:hover td { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .empty-state { color: #555; }
[data-theme="dark"] .empty-title { color: #444; }
[data-theme="dark"] .detail-row { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .detail-label { color: #555; }
[data-theme="dark"] .detail-value { color: #ccc; }

/* ─── CALENDÁRIO DRAG ─────────────────────────────────────── */
.calendar-event[draggable] { cursor: grab; user-select: none; }
.calendar-event[draggable]:active { cursor: grabbing; }
.calendar-day.cal-drop-target {
  background: color-mix(in srgb, var(--accent) 10%, transparent) !important;
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* ─── STAT CARD HOVER ────────────────────────────────────── */
.stat-card[onclick]:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent) !important;
  transform: translateY(-1px);
}

/* ─── AGENTE DE VOZ ─────────────────────────────────────────── */
#voz-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.55); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
#voz-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 28px 28px;
  min-width: 360px; max-width: 420px; text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
#voz-mic-icon { font-size: 48px; margin-bottom: 8px; }
#topbar-voz-btn.voz-active { color: var(--accent) !important; }
#topbar-voz-btn.voz-active svg { animation: voz-pulse 1.2s ease-in-out infinite; }
.voz-pulsing { animation: voz-pulse 1.2s ease-in-out infinite; }
@keyframes voz-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* ── Busca Global ─────────────────────────────────────────────── */
.topbar-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s;
  min-width: 200px;
}
.topbar-search-bar:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(32,193,245,.12);
  color: var(--text-primary);
}
.topbar-search-bar kbd {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-left: auto;
}
#busca-global-overlay {
  animation: fadeIn .15s ease;
}
#busca-global-modal {
  animation: slideDown .18s ease;
}
@keyframes slideDown {
  from { opacity:0; transform: translateY(-16px); }
  to   { opacity:1; transform: translateY(0); }
}
.busca-categoria {
  padding: 6px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-secondary);
}
.busca-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background .12s;
  border-radius: 0;
}
.busca-item:hover, .busca-item.busca-selected {
  background: var(--bg-secondary);
}
.busca-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}
.busca-item-info { flex: 1; min-width: 0; }
.busca-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.busca-item-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.busca-item-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.busca-highlight {
  color: var(--accent);
  font-weight: 700;
}

/* ── Busca Global ─────────────────────────────────────────────── */
.topbar-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s;
  min-width: 200px;
}
.topbar-search-bar:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(32,193,245,.12);
  color: var(--text-primary);
}
.topbar-search-bar kbd {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-left: auto;
}
#busca-global-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.65) !important;
  z-index: 9000 !important;
  align-items: flex-start !important;
  justify-content: center !important;
  padding-top: 80px !important;
}
#busca-global-modal {
  background: #ffffff !important;
  border-radius: 16px !important;
  width: 100% !important;
  max-width: 620px !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.4) !important;
  overflow: hidden !important;
  animation: buscaSlideDown .18s ease;
}
body.dark #busca-global-modal {
  background: #1e2330 !important;
}
@keyframes buscaSlideDown {
  from { opacity:0; transform: translateY(-20px); }
  to   { opacity:1; transform: translateY(0); }
}
#busca-global-modal .busca-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}
body.dark #busca-global-modal .busca-header {
  border-bottom-color: #2d3448;
}
#busca-global-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 16px !important;
  color: #111827 !important;
  font-family: inherit;
}
body.dark #busca-global-input {
  color: #f1f5f9 !important;
}
#busca-global-input::placeholder {
  color: #9ca3af;
}
.busca-global-esc {
  font-size: 11px;
  padding: 2px 7px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  color: #6b7280;
  flex-shrink: 0;
}
body.dark .busca-global-esc {
  background: #2d3448;
  border-color: #3d4560;
  color: #9ca3af;
}
#busca-global-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 0;
}
.busca-categoria {
  padding: 10px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #6b7280;
}
body.dark .busca-categoria { color: #64748b; }
.busca-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background .1s;
}
.busca-item:hover, .busca-item.busca-selected {
  background: #f3f4f6;
}
body.dark .busca-item:hover,
body.dark .busca-item.busca-selected {
  background: #252b3d;
}
.busca-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.busca-item-info { flex: 1; min-width: 0; }
.busca-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dark .busca-item-title { color: #f1f5f9; }
.busca-item-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dark .busca-item-sub { color: #94a3b8; }
.busca-item-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.busca-highlight {
  color: var(--accent);
  font-weight: 700;
}
.busca-vazio {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}
body.dark .busca-vazio { color: #64748b; }

/* ── Alertas Proativos ─────────────────────────────────────── */
#alertas-painel {
  border: 1px solid #e5e7eb;
}
body.dark #alertas-painel {
  background: #1e2330 !important;
  border-color: #2d3448 !important;
}
body.dark #alertas-painel > div {
  border-color: #2d3448 !important;
}
.alerta-item {
  display: flex;
  gap: 12px;
  padding: 11px 18px;
  border-left: 3px solid transparent;
  transition: background .1s;
  cursor: default;
}
.alerta-item:hover { background: #f9fafb; }
body.dark .alerta-item:hover { background: #252b3d; }
.alerta-item.nivel-danger  { border-left-color: #ef4444; }
.alerta-item.nivel-warning { border-left-color: #f59e0b; }
.alerta-item.nivel-info    { border-left-color: #3b82f6; }
.alerta-item.nivel-success { border-left-color: #22c55e; }
.alerta-icone {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.alerta-conteudo { flex: 1; min-width: 0; }
.alerta-titulo {
  font-size: 13px; font-weight: 600; color: #111827;
  line-height: 1.3;
}
body.dark .alerta-titulo { color: #f1f5f9; }
.alerta-sub {
  font-size: 11.5px; color: #6b7280; margin-top: 2px;
}
body.dark .alerta-sub { color: #94a3b8; }
.alerta-acao {
  margin-top: 5px;
  font-size: 11px; font-weight: 600;
  color: var(--accent); cursor: pointer; text-decoration: none;
  display: inline-block;
}
.alerta-acao:hover { text-decoration: underline; }
.alerta-separador {
  padding: 6px 18px 2px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: #9ca3af;
}
#notif-badge {
  display: none;
}
#notif-badge.visivel {
  display: flex !important;
}
