/* ============================================================
   ICIA Process — Main Stylesheet
   Projeto Clareza | Grupo VanguardIA
   ============================================================ */

/* === CSS Variables — Dark Blue Apple Theme === */
:root {
  --primary: #1B365D;
  --primary-light: #2a4a7a;
  --primary-dark: #0a1628;
  --accent: #D4A84B;
  --accent-light: #e8c87a;
  --accent-dark: #b8903a;
  --success: #34C759;
  --success-light: #30D158;
  --warning: #FF9F0A;
  --warning-light: #FFD60A;
  --danger: #FF453A;
  --danger-light: #FF6961;
  --bg: #0d1b2a;
  --bg-secondary: #1b2838;
  --bg-dark: #091520;
  --card-bg: rgba(25, 42, 65, 0.7);
  --card-bg-solid: #192a41;
  --card-hover: rgba(30, 50, 75, 0.85);
  --text-primary: #e8edf3;
  --text-secondary: #8899aa;
  --text-light: #556677;
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(255,255,255,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --glow-accent: 0 0 20px rgba(212,168,75,0.15);
  --glow-success: 0 0 20px rgba(52,199,89,0.15);
  --glow-danger: 0 0 20px rgba(255,69,58,0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --backdrop-blur: blur(20px);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  background-image: radial-gradient(ellipse at 20% 50%, rgba(27,54,93,0.4) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(212,168,75,0.06) 0%, transparent 50%);
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* === App Layout === */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  grid-area: sidebar;
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  color: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 1px solid var(--border);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.sidebar-brand small {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section-title {
  padding: 12px 20px 6px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
}

/* === Top Bar === */
.topbar {
  grid-area: topbar;
  background: rgba(13, 27, 42, 0.8);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.topbar-breadcrumb span {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

/* === Main Content === */
.main-content {
  grid-area: main;
  overflow-y: auto;
  padding: 24px;
  width: 100%;
}

/* Inner wrapper — limita largura max em telas muito grandes */
.view-inner {
  max-width: 1600px;
  width: 100%;
}

/* === Cards === */
.card {
  background: var(--card-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
}

.card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-md);
}

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

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  padding: 20px;
}

/* === Stat Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,255,255,0.15);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon.primary { background: rgba(27,54,93,0.3); color: #5b8dc9; }
.stat-icon.accent { background: rgba(212,168,75,0.2); color: var(--accent); }
.stat-icon.success { background: rgba(52,199,89,0.15); color: var(--success); }
.stat-icon.danger { background: rgba(255,69,58,0.15); color: var(--danger); }

.stat-info h4 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.stat-info p {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}

/* === Progress Bar === */
.progress-bar {
  height: 8px;
  background: var(--bg-dark);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.progress-bar.small { height: 6px; }

/* === Tables === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(27,54,93,0.02);
}

/* === Badges / Status === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.validated, .badge.published, .badge.complete { background: rgba(46,125,50,0.1); color: var(--success); }
.badge.draft, .badge.in_progress { background: rgba(249,168,37,0.15); color: #E65100; }
.badge.gap, .badge.not-started { background: rgba(198,40,40,0.1); color: var(--danger); }
.badge.mapped { background: rgba(27,54,93,0.1); color: var(--primary); }
.badge.hidden { background: rgba(198,40,40,0.1); color: var(--danger); }
.badge.orphan { background: rgba(249,168,37,0.15); color: #E65100; }

/* === System Tags (Nibo, Conexa, etc.) === */
.sys-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  margin: 2px 4px 2px 0;
  border: 1px solid transparent;
}
.sys-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
/*
 * Paleta SISTEMAS — toda cor diferente das empresas (ver EMPRESA_COLORS em data.js).
 *   Empresas: #1B365D DO IT, #2E7D32 Emporio, #D4A84B VanguardIA, #6A1B9A JFG,
 *             #00838F Auad, #AD1457 GM2N, #546E7A Grupo.
 *   Sistemas devem NAO colidir com nenhuma acima e NAO repetir entre si.
 */
.sys-tag.nibo     { background: rgba(239,108,0,0.12);  color: #EF6C00; border-color: rgba(239,108,0,0.30); }  /* laranja */
.sys-tag.conexa   { background: rgba(2,136,209,0.12);  color: #0288D1; border-color: rgba(2,136,209,0.30); }  /* sky blue */
.sys-tag.consumer { background: rgba(211,47,47,0.12);  color: #D32F2F; border-color: rgba(211,47,47,0.30); }  /* red */
.sys-tag.banco    { background: rgba(93,64,55,0.12);   color: #5D4037; border-color: rgba(93,64,55,0.30); }   /* brown */
.sys-tag.excel,
.sys-tag.planilha { background: rgba(130,119,23,0.15); color: #827717; border-color: rgba(130,119,23,0.30); } /* olive */
.sys-tag.email    { background: rgba(142,36,170,0.12); color: #8E24AA; border-color: rgba(142,36,170,0.30); } /* magenta */
.sys-tag.supabase { background: rgba(67,160,71,0.15);  color: #43A047; border-color: rgba(67,160,71,0.30); }  /* medium green */
.sys-tag.powerbi  { background: rgba(251,192,45,0.18); color: #B28704; border-color: rgba(251,192,45,0.35); } /* amber */
.sys-tag.portal   { background: rgba(40,53,147,0.12);  color: #283593; border-color: rgba(40,53,147,0.30); }  /* deep indigo */
.sys-tag.script   { background: rgba(38,50,56,0.12);   color: #263238; border-color: rgba(38,50,56,0.30); }  /* charcoal */
.sys-tag.default  { background: rgba(158,158,158,0.15);color: #616161; border-color: rgba(158,158,158,0.35); }/* silver */

/* === Priority Matrix === */
.priority-dist-bar { display:flex; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.priority-dist-item {
  flex:1; min-width:120px; padding:12px 14px; border-radius:10px;
  border:1px solid; display:flex; flex-direction:column; gap:4px;
}
.priority-table-wrapper { overflow-x:auto; background:var(--surface); border:1px solid var(--border-light); border-radius:10px; }
.priority-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.priority-table thead { background:var(--bg); }
.priority-table th { padding:10px 8px; text-align:left; font-weight:600; font-size:0.78rem; color:var(--text-secondary); border-bottom:1px solid var(--border-light); }
.priority-table td { padding:10px 8px; border-bottom:1px solid var(--border-light); vertical-align:middle; color:var(--text-primary); }
.priority-row { cursor:pointer; transition:background 0.15s; }
.priority-row:hover { background:rgba(212,168,75,0.06); }
.priority-expanded-row td { background:var(--bg); padding:16px 24px; }
.priority-expanded h4 { color:var(--text-primary); font-size:1rem; }
.priority-dim-line {
  display:flex; align-items:center; gap:12px;
  padding:8px 10px; background:var(--surface); border:1px solid var(--border-light);
  border-radius:6px; font-size:0.85rem; color:var(--text-primary);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-accent {
  background: var(--accent);
  color: var(--primary);
}

.btn-accent:hover {
  background: var(--accent-light);
}

.btn-outline {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

/* === Process Grid === */
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.process-card {
  background: var(--card-bg);
  backdrop-filter: var(--backdrop-blur);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.process-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--glow-accent);
  border-color: rgba(212,168,75,0.3);
}

.process-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.process-card-icon {
  font-size: 1.5rem;
}

.process-card-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.process-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* === Activity Feed === */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.activity-text {
  font-size: 0.85rem;
  line-height: 1.5;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* === Section Headers === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.3rem;
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: var(--font-family);
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* === Filters === */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-family);
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* === POP Cards === */
.pop-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 12px;
  transition: all var(--transition);
}

.pop-card:hover {
  box-shadow: var(--shadow-md);
}

.pop-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.pop-card-header h4 {
  font-size: 0.95rem;
}

.pop-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pop-card-body {
  padding: 0 20px 20px;
  display: none;
}

.pop-card-body.expanded {
  display: block;
}

.pop-step {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.pop-step:last-child { border-bottom: none; }

.pop-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pop-step-content h5 {
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.pop-step-content p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pop-step-details {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* === Two-Column Layout === */
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

/* === Modal / Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal h2 {
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: border-color var(--transition);
  background: var(--card-bg);
  color: var(--text-primary);
}

.form-group select option {
  background: var(--card-bg);
  color: var(--text-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,54,93,0.1);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* === Session Card === */
.session-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 12px;
}

.session-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

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

.session-card-stats {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.session-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === Transcript === */
.transcript {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.transcript-msg {
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
}

.transcript-msg.agent {
  flex-direction: row;
}

.transcript-msg.user {
  flex-direction: row-reverse;
}

.transcript-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
}

.transcript-msg.agent .transcript-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
}

.transcript-msg.user .transcript-bubble {
  background: var(--primary);
  color: white;
}

/* === Responsive === */

/* Monitor grande (1440px+) */
@media (min-width: 1440px) {
  :root {
    --sidebar-width: 240px;
    --topbar-height: 60px;
  }
  .main-content {
    padding: 32px;
  }
}

/* Monitor muito grande (1920px+) */
@media (min-width: 1920px) {
  :root {
    --sidebar-width: 260px;
  }
  html { font-size: 17px; }
  .main-content {
    padding: 40px;
  }
}

@media (max-width: 1024px) {
  .two-columns {
    grid-template-columns: 1fr;
  }
}

/* Tablet (769–1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  :root { --sidebar-width: 200px; }
}

/* Mobile/tablet */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .menu-toggle {
    display: block;
  }

  .main-content {
    padding: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .process-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* === Sidebar Overlay (mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}

.sidebar-overlay.active {
  display: block;
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 1.5s infinite; }

/* === Tooltip === */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 50;
}

/* === Dashboard Filter Row === */
.dash-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.dash-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-family);
}

.dash-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dash-filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.dash-filter-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Stats grid — 5 columns */
.stats-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.stat-icon.info {
  background: rgba(27, 54, 93, 0.08);
  color: var(--primary-light);
}

/* === Dashboard 2-column grid === */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* === Horizontal Bar Chart (Status) === */
.dash-hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dash-hbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-hbar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  flex-shrink: 0;
}

.dash-hbar-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-hbar-track {
  flex: 1;
  height: 22px;
  background: var(--bg-dark);
  border-radius: 6px;
  overflow: hidden;
}

.dash-hbar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.dash-hbar-value {
  min-width: 28px;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === Progress Chart (per process) === */
.dash-progress-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-progress-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.dash-progress-row:hover {
  background: rgba(27, 54, 93, 0.03);
}

.dash-progress-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dash-progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-progress-track {
  flex: 1;
  height: 8px;
  background: var(--bg-dark);
  border-radius: 4px;
  overflow: hidden;
}

.dash-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.dash-progress-pct {
  min-width: 38px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

/* === Donut Legend === */
.dash-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dash-donut-legend-item strong {
  margin-left: auto;
  font-weight: 700;
}

.dash-donut-center {
  pointer-events: none;
}

/* === Empresa Tag === */
.dash-empresa-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

/* === Dashboard responsive overrides === */
@media (max-width: 1200px) {
  .stats-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .dash-grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stats-grid-5 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid-5 {
    grid-template-columns: 1fr;
  }
}

/* === View container (hide all, show active) === */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

/* === Chat view takes full area === */
.view.chat-view.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  padding: 0;
  margin: -24px;
}

/* Process detail layout — altura total + toggle memo */
.process-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  min-height: 0;
  height: calc(100vh - var(--topbar-height) - 170px);
  align-items: stretch;
}

.process-detail-layout.memo-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}
.process-detail-layout.memo-collapsed .process-memo {
  display: none;
}

.process-flowchart-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.process-flowchart-area .flowchart-container {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 1200px) {
  .process-detail-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .process-detail-layout.memo-collapsed {
    grid-template-columns: 1fr;
  }
}

/* Botão toggle do painel Memo */
.btn-memo-toggle {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 120ms, color 120ms;
  line-height: 1.2;
}
.btn-memo-toggle:hover {
  background: rgba(212, 168, 75, 0.15);
  color: var(--accent, #D4A84B);
}

.flowchart-container {
  overflow: auto;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  min-height: 400px;
  position: relative;
}

.process-memo {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow-y: auto;
  height: 100%;
}

.process-memo-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 5;
}

.process-memo-body {
  padding: 20px;
}

.activity-detail-card {
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.activity-detail-card h5 {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.activity-detail-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.detail-row {
  display: flex;
  gap: 8px;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.detail-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 90px;
}

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

/* Variable highlight link */
.var-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.var-link:hover {
  color: var(--accent);
}

/* === Approval Module === */
.approval-card {
  border-left: 4px solid var(--accent);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: all var(--transition);
}

.approval-card.approved {
  border-left-color: #2E7D32;
  background: rgba(46, 125, 50, 0.06);
}

.approval-card.rejected {
  border-left-color: var(--danger);
  opacity: 0.7;
}

.approval-type-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  color: white;
}

.approval-type-badge.processo { background: #1B365D; }
.approval-type-badge.variavel { background: #7B1FA2; }
.approval-type-badge.pop { background: #E65100; }
.approval-type-badge.gap { background: #C62828; }

.approval-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
}

@media (max-width: 1200px) {
  .approval-detail-layout { grid-template-columns: 1fr; }
}

.approval-transcript {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  padding: 16px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.approval-items {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  position: relative;
}

.approval-actions-bar {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border-light);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.insight-card {
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(212, 168, 75, 0.08);
}

/* Approval badge (pending_review) */
.badge.pending_review {
  background: rgba(212, 168, 75, 0.15);
  color: var(--accent);
}

.badge.approved {
  background: rgba(46, 125, 50, 0.1);
  color: #2E7D32;
}

.badge.rejected {
  background: rgba(198, 40, 40, 0.1);
  color: var(--danger);
}

/* === Inline Editing === */
.process-edit-form { background: var(--card-bg); border: 1px solid var(--accent); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.process-edit-form .form-group { margin-bottom: 12px; }
.process-edit-form label { display: block; font-size: 0.8rem; color: var(--text-light); margin-bottom: 4px; }
.process-edit-form input, .process-edit-form textarea, .process-edit-form select { width: 100%; padding: 8px 12px; background: var(--bg-secondary, #1a1f2e); border: 1px solid var(--border-light, #2a3040); border-radius: 8px; color: var(--text-primary, #e0e0e0); font-size: 0.9rem; font-family: var(--font-family); }
.process-edit-form textarea { min-height: 60px; resize: vertical; }
.process-edit-form .btn-group { display: flex; gap: 8px; margin-top: 12px; }
.activity-edit-form { background: rgba(52, 199, 89, 0.05); border: 1px solid rgba(52, 199, 89, 0.3); border-radius: 10px; padding: 16px; margin-bottom: 8px; }
.activity-edit-form .form-group { margin-bottom: 10px; }
.activity-edit-form label { display: block; font-size: 0.75rem; color: var(--text-light); margin-bottom: 3px; }
.activity-edit-form input, .activity-edit-form textarea { width: 100%; padding: 6px 10px; background: var(--bg-secondary, #1a1f2e); border: 1px solid var(--border-light, #2a3040); border-radius: 6px; color: var(--text-primary, #e0e0e0); font-size: 0.85rem; font-family: var(--font-family); }
.btn-edit-inline { padding: 4px 10px; font-size: 0.75rem; border: 1px solid var(--border-light); border-radius: 6px; background: transparent; color: var(--text-light); cursor: pointer; transition: all 0.2s; font-family: var(--font-family); }
.btn-edit-inline:hover { border-color: var(--accent); color: var(--accent); }
.btn-logout:hover { border-color: var(--danger, #E65100) !important; color: var(--danger, #E65100) !important; }

/* === Entrevistas Module === */
.stat-card-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  min-width: 80px;
  transition: border-color var(--transition);
}
.stat-card-mini:hover { border-color: var(--primary-light); }
.stat-card-mini--active { border-color: var(--accent); box-shadow: var(--glow-accent); }

.entrevistas-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entrevista-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 18px;
  transition: border-color var(--transition);
}
.entrevista-card:hover { border-color: var(--accent); }

.entrevista-status-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  white-space: nowrap;
}

.entrevista-prioridade {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}
.entrevista-prioridade--urgente { background: rgba(255, 69, 58, 0.2); color: var(--danger); }
.entrevista-prioridade--alta { background: rgba(255, 159, 10, 0.2); color: var(--warning); }
.entrevista-prioridade--normal { background: rgba(212, 168, 75, 0.15); color: var(--accent); }
.entrevista-prioridade--baixa { background: rgba(52, 199, 89, 0.15); color: var(--success); }
