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

:root {
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --bg: #f0f2f7;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-dark: #3730a3;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --pink: #ec4899;
  --pink-light: #fce7f3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15);
  --transition: .2s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(165deg, #1e1b4b 0%, #312e81 100%);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #a5b4fc;
}
.logo-title { font-size: 15px; font-weight: 700; color: #fff; display: block; }
.logo-sub { font-size: 11px; color: #a5b4fc; display: block; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #a5b4fc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-item.active i { color: #a5b4fc; }

.sidebar-footer { padding: 16px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.btn-nova-acao {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(165,180,252,.15);
  border: 1px dashed rgba(165,180,252,.4);
  border-radius: var(--radius-sm);
  color: #a5b4fc;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-nova-acao:hover { background: rgba(165,180,252,.25); color: #fff; }

/* ===== TOPBAR ===== */
.topbar {
  position: fixed;
  left: var(--sidebar-w);
  top: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.menu-toggle { display: none; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text); }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ===== SEARCH BAR ===== */
.search-bar-wrapper {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  box-shadow: var(--shadow-md);
}
.search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: var(--text-muted);
}
.search-inner input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
.search-inner button { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; }
.search-results { max-height: 360px; overflow-y: auto; border-top: 1px solid var(--border); }
.search-result-item {
  padding: 12px 24px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--surface2); }
.search-result-item .sri-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.search-result-item .sri-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.search-result-item .sri-sub { font-size: 11px; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px 28px;
  min-height: calc(100vh - var(--topbar-h));
  width: calc(100% - var(--sidebar-w));
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.badge-date {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 20px;
}

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; display: block; }
.kpi-value { font-size: 28px; font-weight: 800; display: block; line-height: 1.1; }
.kpi-total .kpi-icon { background: var(--primary-light); color: var(--primary); }
.kpi-total .kpi-value { color: var(--primary); }
.kpi-andamento .kpi-icon { background: var(--info-light); color: var(--info); }
.kpi-andamento .kpi-value { color: var(--info); }
.kpi-concluido .kpi-icon { background: var(--success-light); color: var(--success); }
.kpi-concluido .kpi-value { color: var(--success); }
.kpi-atrasado .kpi-icon { background: var(--danger-light); color: var(--danger); }
.kpi-atrasado .kpi-value { color: var(--danger); }

/* ===== DASH CARDS ===== */
.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-card-lg { grid-column: span 1; }
.dash-card-sm { grid-column: span 1; }
.dash-card-md { grid-column: span 1; }
.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.dash-card:last-child { margin-bottom: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 i { color: var(--primary); }

/* Theme Progress */
.theme-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.theme-progress-item:last-child { border-bottom: none; }
.tpi-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.tpi-info { flex: 1; min-width: 0; }
.tpi-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpi-bar-wrap { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.tpi-bar { height: 100%; border-radius: 99px; transition: width .8s ease; }
.tpi-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Chart legend */
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Proximos vencimentos */
.venc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.venc-item:last-child { border-bottom: none; }
.venc-date {
  min-width: 52px;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px;
}
.venc-day { font-size: 18px; font-weight: 800; line-height: 1; }
.venc-mon { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.venc-info { flex: 1; min-width: 0; }
.venc-titulo { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.venc-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* Atualizações recentes */
.atu-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.atu-item:last-child { border-bottom: none; }
.atu-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.atu-content { flex: 1; }
.atu-texto { font-size: 13px; line-height: 1.5; }
.atu-texto strong { color: var(--text); }
.atu-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.atu-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.filter-group select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  min-width: 140px;
  font-family: 'Inter', sans-serif;
}
.filter-group select:focus { border-color: var(--primary); }
.btn-clear-filters {
  padding: 7px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
  align-self: flex-end;
}
.btn-clear-filters:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

/* ===== AÇÕES CONTAINER ===== */
.fase-block {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.fase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(90deg, var(--primary-light), #fff);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.fase-header-left { display: flex; align-items: center; gap: 10px; }
.fase-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.fase-nome { font-size: 14px; font-weight: 600; }
.fase-obj { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.fase-header-right { display: flex; align-items: center; gap: 10px; }
.fase-stats { display: flex; gap: 6px; }
.fase-collapse-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px; transition: transform var(--transition); }
.fase-collapse-btn.collapsed { transform: rotate(-90deg); }

.fase-body { padding: 0; }
.fase-body.collapsed { display: none; }

/* Ação Row */
.acao-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.acao-row:last-child { border-bottom: none; }
.acao-row:hover { background: var(--surface2); }
.acao-row.subacao { padding-left: 46px; background: #fafbff; }
.acao-row.subacao:hover { background: var(--primary-light); }

.acao-num-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  min-width: 36px;
  text-align: center;
  margin-top: 2px;
}
.subacao .acao-num-badge { background: var(--primary-light); color: var(--primary); border-color: #c7d2fe; }

.acao-content { flex: 1; min-width: 0; }
.acao-title { font-size: 13px; font-weight: 500; line-height: 1.4; margin-bottom: 4px; }
.acao-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.acao-meta-tag {
  font-size: 11px;
  display: flex; align-items: center; gap: 4px;
  color: var(--text-muted);
}
.acao-meta-tag i { font-size: 10px; }

.acao-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.progress-pill {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-nao-iniciado { background: #f1f5f9; color: #64748b; }
.badge-em-andamento { background: var(--info-light); color: #0369a1; }
.badge-concluido { background: var(--success-light); color: #065f46; }
.badge-atrasado { background: var(--danger-light); color: #991b1b; }
.badge-bloqueado { background: var(--warning-light); color: #92400e; }

.badge-alta { background: #fee2e2; color: #991b1b; }
.badge-media { background: var(--warning-light); color: #92400e; }
.badge-baixa { background: var(--success-light); color: #065f46; }

.btn-edit-acao {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0;
}
.acao-row:hover .btn-edit-acao { opacity: 1; }
.btn-edit-acao:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== TEMAS GRID ===== */
.temas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.tema-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.tema-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tema-card-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.tema-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.tema-card-body { padding: 0 20px 16px; }
.tema-nome { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.tema-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.4; }
.tema-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.tema-stat { text-align: center; }
.tema-stat-val { font-size: 18px; font-weight: 800; display: block; }
.tema-stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.tema-progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.tema-progress-bar { height: 100%; border-radius: 99px; transition: width .8s ease; }
.tema-card-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btn-tema-ver {
  font-size: 12px; font-weight: 600;
  color: var(--primary);
  background: none; border: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.btn-tema-ver:hover { text-decoration: underline; }
.btn-tema-edit {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-tema-edit:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ===== CALENDÁRIO ===== */
.calendario-wrapper { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 24px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cal-header h2 { font-size: 18px; font-weight: 700; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav button {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: all var(--transition);
}
.cal-nav button:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 0;
}
.cal-day {
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  cursor: default;
  transition: background var(--transition);
}
.cal-day.other-month { opacity: .35; }
.cal-day.today { background: var(--primary-light); border-color: var(--primary); }
.cal-day-num { font-weight: 600; margin-bottom: 4px; }
.cal-event {
  font-size: 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-event:hover { opacity: .85; }
.cal-event.ev-atrasado { background: var(--danger); }
.cal-event.ev-concluido { background: var(--success); }
.cal-event.ev-andamento { background: var(--info); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
.modal-sm { max-width: 440px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.modal-footer .btn-danger { margin-right: auto; }

/* ===== FORM ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
  font-family: 'Inter', sans-serif;
}
.form-group input[type="range"] { padding: 0; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-group input[type="color"] { width: 50px; height: 36px; padding: 2px; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-ghost:hover { background: var(--surface2); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--surface2); color: var(--primary); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideRight .3s ease;
  max-width: 320px;
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--text); }
.toast i { font-size: 15px; }

/* ===== LOADING ===== */
.loading-spinner {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .3; display: block; }
.empty-state p { font-size: 14px; }

/* ===== TEMA SECTION (agrupamento por tema no plano de ação) ===== */
.tema-section {
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.tema-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.tsh-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.tsh-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.tsh-nome { font-size: 15px; font-weight: 700; }
.tsh-sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tsh-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tsh-progress-wrap {
  width: 100px; height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.tsh-progress-bar { height: 100%; border-radius: 99px; transition: width .8s ease; }
.tsh-collapse-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--transition);
}
.tsh-collapse-btn:hover { background: var(--primary-light); color: var(--primary); }
.tema-section-body.collapsed { display: none; }
.tema-section-body .fase-block { border-radius: 0; border-left: none; border-right: none; border-top: none; box-shadow: none; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.tema-section-body .fase-block:last-child { border-bottom: none; }

/* Entregáveis preview na linha de ação */
.acao-entregaveis {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.acao-entregaveis i { color: var(--primary); margin-top: 1px; flex-shrink: 0; }
.acao-entregaveis span { line-height: 1.4; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .main-content { margin-left: 0; width: 100%; padding: 16px; }
  .topbar { left: 0; }
  .search-bar-wrapper { left: 0; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { gap: 8px; }
  .filter-group select { min-width: 110px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 22px; }
}

/* ===== OVERLAY MOBILE ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* ===== NUMERAÇÃO DE AÇÃO — badges diferenciados ===== */
/* Ação principal: fundo sólido com cor do texto escuro */
.acao-num-badge.acao-num {
  background: #1e293b;
  color: #fff;
  border-color: #1e293b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  min-width: 38px;
}
/* Sub-ação: fundo indigo leve, texto indigo */
.acao-num-badge.subacao-num {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #c7d2fe;
  font-size: 11px;
  font-weight: 600;
}

/* ===== CAMPO NÚMERO COM SUGESTÃO ===== */
.numero-field-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.numero-field-wrap input {
  flex: 1;
}
.numero-sugestao {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px dashed #a5b4fc;
  border-radius: 6px;
  padding: 4px 9px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 80px;
  justify-content: center;
}
.numero-sugestao:not(:empty)::before {
  content: "✦ ";
  font-size: 9px;
}
.numero-sugestao:empty { display: none; }
.numero-sugestao:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== MOVER SUB-AÇÃO BOX ===== */
.mover-subacao-box {
  border: 1.5px dashed #a5b4fc;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  margin-bottom: 14px;
  overflow: hidden;
}
.mover-subacao-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: rgba(79,70,229,.08);
  border-bottom: 1px solid #c7d2fe;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.mover-subacao-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.mover-subacao-body select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: 'Inter', sans-serif;
}
.mover-subacao-body select:focus { border-color: var(--primary); }
.btn-mover {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-mover:hover { background: var(--primary-dark); }
.btn-mover:disabled { opacity: .6; cursor: not-allowed; }
.mover-hint {
  font-size: 11px;
  color: #6366f1;
  padding: 0 14px 10px;
  line-height: 1.5;
}

/* ===== SEARCH: badge de número no resultado ===== */
.sri-num {
  display: inline-block;
  background: #1e293b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 2px;
  vertical-align: middle;
}

/* ===== FILTER BAR — responsividade extras ===== */
@media (max-width: 1280px) {
  .filter-group select { min-width: 120px; }
}
@media (max-width: 960px) {
  .filter-bar { flex-wrap: wrap; }
  .filter-group { flex: 1 1 140px; }
  .filter-group select { min-width: unset; width: 100%; }
}

/* ===================================================
   FASE C — SIDEBAR: group labels + divider
   =================================================== */
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(165,180,252,.5);
  padding: 10px 14px 4px;
  margin-top: 4px;
}
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 10px;
}

/* ===================================================
   FASE C — RESPONSÁVEIS: stats row
   =================================================== */
.resp-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.resp-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.resp-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.resp-stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.resp-stat-icon.total   { background: var(--primary-light); color: var(--primary); }
.resp-stat-icon.ativos  { background: var(--success-light); color: var(--success); }
.resp-stat-icon.acoes   { background: var(--info-light); color: var(--info); }
.resp-stat-icon.areas   { background: var(--purple-light); color: var(--purple); }
.resp-stat-lbl  { font-size: 11px; color: var(--text-muted); font-weight: 500; display: block; text-transform: uppercase; letter-spacing: .3px; }
.resp-stat-val  { font-size: 26px; font-weight: 800; display: block; line-height: 1.1; color: var(--text); }

/* ===================================================
   FASE C — RESPONSÁVEIS: search + table card
   =================================================== */
.resp-table-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.resp-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.resp-table-header h2 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.resp-table-header h2 i { color: var(--primary); }
.resp-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  flex: 1;
  max-width: 320px;
  transition: border-color var(--transition);
}
.resp-search-wrap:focus-within { border-color: var(--primary); background: var(--surface); }
.resp-search-wrap i { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.resp-search-wrap input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  flex: 1;
  min-width: 0;
}

/* Tabela de responsáveis */
.resp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.resp-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.resp-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.resp-table tbody tr:last-child td { border-bottom: none; }
.resp-table tbody tr:hover td { background: var(--surface2); }

.resp-avatar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.resp-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.resp-nome { font-weight: 600; }
.resp-email-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
}
.resp-email-link:hover { text-decoration: underline; }

/* ===================================================
   FASE C — RELATÓRIO: layout dois painéis
   =================================================== */
.rel-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

/* Painel de configuração */
.rel-config-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
}
.rel-config-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--primary-light), #fff);
}
.rel-config-panel-header h2 {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.rel-config-panel-header h2 i { color: var(--primary); }

.rel-config-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.rel-config-section:last-of-type { border-bottom: none; }
.rel-config-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rel-config-title i { font-size: 10px; color: var(--primary); }
.rel-config-section .form-group { margin-bottom: 10px; }
.rel-config-section .form-group:last-child { margin-bottom: 0; }
.rel-config-section label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  display: block;
  margin-bottom: 4px;
}
.rel-config-section select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: 'Inter', sans-serif;
}
.rel-config-section select:focus { border-color: var(--primary); }

/* Checkbox list de colunas */
.rel-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rel-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.rel-check-item:hover { background: var(--surface2); }
.rel-check-item input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.rel-check-item span {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

/* Switch para incluir sub-ações */
.rel-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.rel-toggle-wrap label { font-size: 13px; color: var(--text); font-weight: 500; cursor: pointer; margin-bottom: 0; text-transform: none; letter-spacing: 0; }
.rel-toggle-wrap input[type="checkbox"] {
  width: 38px; height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.rel-toggle-wrap input[type="checkbox"]:checked { background: var(--primary); }
.rel-toggle-wrap input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.rel-toggle-wrap input[type="checkbox"]:checked::after { left: 21px; }

/* Botão exportar Excel */
.btn-export-excel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 8px rgba(22,163,74,.3);
}
.btn-export-excel:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  box-shadow: 0 4px 16px rgba(22,163,74,.4);
  transform: translateY(-1px);
}
.btn-export-excel:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.btn-export-excel i { font-size: 16px; }

/* ===================================================
   FASE C — RELATÓRIO: preview panel
   =================================================== */
.rel-preview-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 400px;
}
.rel-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.rel-preview-header h2 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rel-preview-header h2 i { color: var(--primary); }
.rel-preview-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-weight: 500;
}
.rel-preview-wrap {
  overflow: hidden;
}
.rel-table-scroll {
  overflow-x: auto;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

/* Tabela de preview */
.rel-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rel-preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #fff;
  background: var(--primary);
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.15);
}
.rel-preview-table thead th:last-child { border-right: none; }
.rel-preview-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  max-width: 320px;
  white-space: normal;
  word-break: break-word;
}
.rel-preview-table tbody tr:last-child td { border-bottom: none; }
.rel-preview-table tbody tr:hover td { background: rgba(79,70,229,.04); }

/* Sub-ação: fundo e indent visual */
.rel-row-sub td { background: #fafbff; color: var(--text-muted); }
.rel-row-sub td:first-child { padding-left: 28px; }

/* Cores por status */
.rel-row-concluido td  { border-left: 3px solid var(--success); }
.rel-row-em-andamento td { border-left: 3px solid var(--info); }
.rel-row-atrasado td  { border-left: 3px solid var(--danger); }
.rel-row-bloqueado td { border-left: 3px solid var(--warning); }
.rel-row-nao-iniciado td { border-left: 3px solid var(--border); }

/* ===================================================
   FASE C — RESPONSIVO
   =================================================== */
@media (max-width: 1200px) {
  .rel-layout { grid-template-columns: 260px 1fr; }
  .resp-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .rel-layout { grid-template-columns: 1fr; }
  .rel-config-panel { position: static; }
}
@media (max-width: 768px) {
  .resp-stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .resp-table-header { flex-direction: column; align-items: flex-start; }
  .resp-search-wrap { max-width: 100%; width: 100%; }
  .rel-layout { grid-template-columns: 1fr; gap: 14px; }
}
