/* ============================================================
   INTELIGÊNCIA POLÍTICA - Estilos Principais
   ============================================================ */

:root {
  --accent: #3b5de7;
  --sidebar-w: 260px;
  --sidebar-bg: #1a2236;
  --sidebar-text: #9db0c9;
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active-bg: var(--accent);
  --topbar-h: 60px;
  --body-bg: #f1f5fb;
  --card-bg: #fff;
  --border: #e4eaf3;
  --text: #1e2a3a;
  --text-muted: #6b7a93;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
}

/* ---- LAYOUT ---- */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: width .25s ease;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: 70px;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .9rem;
  flex-shrink: 0;
}

.brand-text { overflow: hidden; }
.brand-name {
  display: block;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub {
  display: block;
  color: var(--sidebar-text);
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-wrap { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-nav-wrap::-webkit-scrollbar { width: 3px; }
.sidebar-nav-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.sidebar-nav {
  list-style: none;
  margin: 0; padding: 0;
}

.nav-section {
  padding: 14px 20px 4px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
  user-select: none;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  margin: 2px 8px;
  transition: background .15s, color .15s;
  font-size: .875rem;
  white-space: nowrap;
}
.nav-item a i {
  width: 18px;
  text-align: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.nav-item a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.nav-item.active a {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  gap: 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}
.sidebar-user-info { overflow: hidden; }
.user-name {
  display: block;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  display: block;
  color: var(--sidebar-text);
  font-size: .7rem;
}
.logout-link {
  color: var(--sidebar-text);
  font-size: 1rem;
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.logout-link:hover { color: var(--danger); background: rgba(231,76,60,.1); }

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--body-bg); }
.page-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}
.page-sub {
  font-size: .75rem;
  color: var(--text-muted);
  margin: 0;
}
.topbar-date {
  font-size: .8rem;
  color: var(--text-muted);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.topbar-user:hover { background: var(--body-bg); color: var(--text); }

/* ---- AVATARS ---- */
.avatar-circle, .avatar-sm {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-circle { width: 36px; height: 36px; font-size: .85rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }

/* ---- FLASH / ALERTS ---- */
.flash-area { padding: 16px 24px 0; }

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }
.card-footer {
  background: #fafbfd;
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 2px; }
.stat-label { font-size: .8rem; color: var(--text-muted); }
.stat-change { font-size: .75rem; margin-top: 4px; }

.bg-accent-light { background: rgba(59,93,231,.12); color: var(--accent); }
.bg-success-light { background: rgba(46,204,113,.12); color: #27ae60; }
.bg-warning-light { background: rgba(243,156,18,.12); color: #e67e22; }
.bg-danger-light  { background: rgba(231,76,60,.12);  color: #c0392b; }
.bg-info-light    { background: rgba(52,152,219,.12); color: #2980b9; }
.bg-purple-light  { background: rgba(142,68,173,.12); color: #8e44ad; }

/* ---- TABLES ---- */
.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  white-space: nowrap;
}
.table tbody td { vertical-align: middle; border-color: #f0f4f8; }
.table tbody tr:hover { background: #f8fafc; }

.actions-col { white-space: nowrap; text-align: right; }
.btn-action {
  padding: 4px 8px;
  font-size: .8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-action:hover { background: var(--body-bg); color: var(--text); border-color: #d0d8e4; }
.btn-action-danger:hover { background: #fff0ef; color: var(--danger); border-color: #f5c6c2; }
.btn-action-primary:hover { background: rgba(59,93,231,.08); color: var(--accent); border-color: #c5cfef; }

/* ---- FORMS ---- */
.form-label { font-weight: 600; font-size: .83rem; color: var(--text); margin-bottom: 4px; }
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  padding: 8px 12px;
  color: var(--text);
  transition: border-color .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,93,231,.12);
  outline: none;
}
.form-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  margin-top: 24px;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #2d4bc7;
  border-color: #2d4bc7;
}

/* ---- BADGES ---- */
.badge { font-size: .72rem; padding: 4px 8px; border-radius: 20px; font-weight: 600; }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.filter-bar .form-control,
.filter-bar .form-select { min-width: 160px; max-width: 220px; }

/* ---- PAGE HEADER (title + actions) ---- */
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-top h2 { margin: 0; font-size: 1.3rem; font-weight: 700; }

/* ---- MINI INFO ROWS ---- */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  font-size: .875rem;
}
.info-row i { color: var(--accent); width: 18px; margin-top: 2px; flex-shrink: 0; }
.info-label { font-weight: 600; color: var(--text-muted); min-width: 120px; font-size: .8rem; }

/* ---- KANBAN (tarefas) ---- */
.kanban-col {
  background: #f4f7fb;
  border-radius: 12px;
  padding: 12px;
  min-height: 300px;
}
.kanban-col-header {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.kanban-card:hover { border-color: var(--accent); }

/* ---- PROGRESS BARS ---- */
.progress { height: 6px; border-radius: 4px; }

/* ---- TIMELINE (logs) ---- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  flex-shrink: 0;
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-title { font-weight: 600; font-size: .85rem; }
.timeline-time { font-size: .75rem; color: var(--text-muted); }

/* ---- COLLAPSED SIDEBAR ---- */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .nav-item a span { display: none; }
body.sidebar-collapsed .nav-item a { justify-content: center; padding: 10px; margin: 2px 4px; }
body.sidebar-collapsed .nav-item a i { width: auto; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; }
body.sidebar-collapsed .main-content { margin-left: 64px; }

/* ---- LOGIN PAGE ---- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1a2236 0%, #2d3c5e 100%); display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 20px; padding: 44px 40px; width: 100%; max-width: 440px; }
.login-logo { width: 56px; height: 56px; background: var(--accent); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem; margin: 0 auto 20px; }
.login-card h2 { text-align: center; font-weight: 800; margin-bottom: 4px; }
.login-card .tagline { text-align: center; color: var(--text-muted); font-size: .875rem; margin-bottom: 32px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { width: 0; }
  .sidebar.open { width: var(--sidebar-w); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  body.sidebar-collapsed .sidebar { width: 0; }
  body.sidebar-collapsed .main-content { margin-left: 0; }
}

/* ---- UTILITIES ---- */
.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent) !important; }
.fw-700 { font-weight: 700; }
.font-sm { font-size: .8rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
