
/* ══════════════════════════════════════════════════════════
   ELEICOES WIDGET PLATFORM — Design System v2
   Paleta: Dark Red / Off-White / Ink
   ══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Serif:wght@400;600;700&display=swap');

:root {
  --red:        #8B1A00;
  --red-dark:   #6B1400;
  --red-light:  #b52200;
  --red-muted:  #f5ede8;
  --ink:        #1A1A1A;
  --ink-light:  #4A4A4A;
  --ink-faint:  #8A8A8A;
  --border:     #E5E5E5;
  --bg:         #F3F3F1;
  --surface:    #FFFFFF;
  --sidebar-w:  240px;
  --r:          7px;
  --shadow:     0 1px 3px rgba(0,0,0,.06), 0 4px 18px rgba(0,0,0,.04);
  --shadow-md:  0 2px 8px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.06);
  --transition: .17s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* ══ LAYOUT ══ */
.layout { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 30px 36px; max-width: 1400px; }

/* ══ SIDEBAR ══ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column; z-index: 200;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo h2 {
  font-size: 12px; font-weight: 700; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--red-light);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo small {
  display: block; font-size: 10px; color: rgba(255,255,255,.28);
  margin-top: 3px; letter-spacing: .6px;
}

.sidebar-menu { padding: 10px 0; flex: 1; }
.sidebar-section {
  padding: 16px 20px 5px;
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 1.8px;
  color: rgba(255,255,255,.18); font-weight: 600;
}
.sidebar-menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 20px; color: rgba(255,255,255,.5);
  text-decoration: none; font-size: 13px; font-weight: 400;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}
.sidebar-menu a svg { flex-shrink: 0; opacity: .55; transition: opacity var(--transition); }
.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.9); border-left-color: var(--red-light);
}
.sidebar-menu a:hover svg, .sidebar-menu a.active svg { opacity: 1; }
.sidebar-menu a.active { background: rgba(139,26,0,.15); }

.sidebar-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: rgba(255,255,255,.3);
}
.sidebar-user strong { display: block; color: rgba(255,255,255,.75); font-size: 12.5px; margin-bottom: 1px; }
.sidebar-user a { color: var(--red-light); text-decoration: none; font-size: 11px; display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; }
.sidebar-user a:hover { text-decoration: underline; }

/* ══ TOPBAR ══ */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 26px;
}
.topbar h1 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -.3px;
}
.topbar small { display: block; color: var(--ink-faint); font-size: 12px; margin-top: 2px; }

/* ══ CARDS ══ */
.card {
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px;
  border: 1px solid rgba(0,0,0,.04);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: -.1px;
  display: flex; align-items: center; gap: 7px;
}

/* ══ STATS ══ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border-radius: var(--r); padding: 18px 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
  border: 1px solid rgba(0,0,0,.04); transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.red   { background: var(--red-muted); color: var(--red); }
.stat-icon.dark  { background: #f0f0ee; color: var(--ink); }
.stat-icon.green { background: #e8f5ee; color: #1a7a42; }
.stat-icon.blue  { background: #e8f0fa; color: #1a44a8; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.stat-label { font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; text-transform: uppercase; letter-spacing: .6px; }

/* ══ FORMS ══ */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 5px; color: var(--ink-light); text-transform: uppercase; letter-spacing: .5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 13.5px; color: var(--ink); background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit; outline: none;
}
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(139,26,0,.08); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent; text-decoration: none;
  transition: all var(--transition); white-space: nowrap; font-family: inherit;
  letter-spacing: .1px; outline: none; position: relative;
}
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(139,26,0,.25); }
.btn-danger { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover { background: #a93226; border-color: #a93226; }
.btn-secondary { background: var(--bg); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #ebebeb; }
.btn-outline { background: transparent; border-color: var(--red); color: var(--red); }
.btn-outline:hover { background: var(--red-muted); }
.btn-sm { padding: 5px 11px; font-size: 12px; gap: 4px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-faint); padding: 6px 8px; }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

/* ══ TABLE ══ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 8px 14px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .9px; color: var(--ink-faint);
  border-bottom: 1.5px solid var(--border); font-weight: 600;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }

/* ══ BADGES ══ */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.badge-green  { background: #e4f3eb; color: #1a7a42; }
.badge-red    { background: #fce8e6; color: #c0392b; }
.badge-blue   { background: #e6eeff; color: #1a44a8; }
.badge-gray   { background: #ebebeb; color: var(--ink-faint); }
.badge-eleito { background: var(--red); color: #fff; }
.badge-dark   { background: var(--ink); color: #fff; }

/* ══ ALERTS ══ */
.alert { padding: 11px 15px; border-radius: var(--r); font-size: 13px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: #e8f5ee; color: #1a5c33; border-left: 3px solid #1a7a42; }
.alert-error   { background: #fce8e6; color: #8b2222; border-left: 3px solid #c0392b; }
.alert-info    { background: #e8eeff; color: #1a3b7a; border-left: 3px solid #1a44a8; }

/* ══ CANDIDATO BAR ══ */
.candidato-item   { margin-bottom: 16px; }
.candidato-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.candidato-info   { display: flex; align-items: center; gap: 10px; }
.candidato-foto   { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--border); }
.candidato-nome   { font-weight: 600; font-size: 13.5px; }
.candidato-partido{ font-size: 11px; color: var(--ink-faint); }
.candidato-pct    { font-weight: 700; font-size: 15px; color: var(--ink); }
.progress-bar     { height: 5px; background: #eeeeeb; border-radius: 3px; overflow: hidden; }
.progress-fill    { height: 100%; border-radius: 3px; transition: width .6s ease; }

/* ══ TABS ══ */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 18px; gap: 0; }
.tab-btn {
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; background: none; color: var(--ink-faint);
  border-bottom: 2px solid transparent; margin-bottom: -1.5px;
  transition: all var(--transition); font-family: inherit;
}
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══ LOGIN ══ */
.login-wrap { min-height: 100vh; display: flex; background: var(--ink); }
.login-left {
  flex: 1; background: var(--red-dark);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px; position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 40px,
    rgba(255,255,255,.018) 40px, rgba(255,255,255,.018) 80px
  );
}
.login-left::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 200px;
  background: linear-gradient(to top, rgba(0,0,0,.25), transparent);
}
.login-left h1 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 38px; color: #fff; font-weight: 700; line-height: 1.2;
  position: relative; z-index: 1;
}
.login-left h1 span { color: rgba(255,255,255,.4); display: block; font-size: 13px; font-weight: 500; letter-spacing: 2.5px; text-transform: uppercase; margin-bottom: 10px; }
.login-left p { color: rgba(255,255,255,.45); font-size: 14px; margin-top: 18px; position: relative; z-index: 1; max-width: 320px; line-height: 1.75; }

.login-right { width: 420px; display: flex; flex-direction: column; justify-content: center; padding: 60px 48px; background: var(--surface); }
.login-right h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-right small { color: var(--ink-faint); display: block; margin-bottom: 32px; }

/* ══ WIDGET ITEMS ══ */
.widget-list { display: grid; gap: 10px; }
.widget-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--r); background: var(--surface);
  transition: all var(--transition);
}
.widget-item.active { border-color: var(--red); background: var(--red-muted); }
.widget-item:hover { border-color: #ccc; }
.widget-icon { width: 38px; height: 38px; border-radius: var(--r); background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--red); }
.widget-item.active .widget-icon { background: rgba(139,26,0,.1); }
.widget-name { font-weight: 600; font-size: 13.5px; }
.widget-type { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.widget-actions { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; }

/* ══ CODE BOX ══ */
.code-box {
  background: #141414; color: #e2e2e2; padding: 14px 18px; border-radius: var(--r);
  font-family: 'IBM Plex Mono', 'SFMono-Regular', 'Consolas', monospace; font-size: 12.5px;
  word-break: break-all; line-height: 1.7; border: 1px solid rgba(255,255,255,.06);
}
.code-box span { color: #7ec8e3; }

/* ══ INJECT CARD ══ */
.inject-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #242424 100%);
  color: #fff; border-radius: var(--r);
  padding: 22px 24px; margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.inject-card h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.inject-card small { font-size: 11px; color: rgba(255,255,255,.35); display: block; margin-bottom: 14px; }

/* ══ NAV BADGE ══ */
.nav-badge { background: var(--red); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 10px; margin-left: 4px; }

/* ══ PORTAL ══ */
.portal-header {
  background: var(--red-dark); padding: 0 32px; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
}
.portal-brand { display: flex; align-items: center; gap: 10px; }
.portal-brand h1 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -.3px;
}
.portal-brand span { color: rgba(255,255,255,.4); font-size: 12px; font-weight: 400; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.18); margin-left: 10px; }
.portal-nav {
  background: var(--red); padding: 0 32px;
  display: flex; align-items: center; gap: 0; height: 40px;
}
.portal-nav a {
  color: rgba(255,255,255,.7); text-decoration: none; padding: 0 14px; height: 40px;
  display: flex; align-items: center; font-size: 12.5px; font-weight: 500;
  transition: all var(--transition); letter-spacing: .2px;
}
.portal-nav a:hover, .portal-nav a.active { color: #fff; background: rgba(255,255,255,.12); }
.portal-body {
  max-width: 1200px; margin: 0 auto; padding: 28px 24px;
  display: grid; grid-template-columns: 1fr 320px; gap: 24px;
}

/* Portal news */
.news-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-img { width: 110px; height: 74px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--border); }
.news-title a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; line-height: 1.3; display: block; margin-bottom: 5px; }
.news-title a:hover { color: var(--red); }
.news-meta { font-size: 11px; color: var(--ink-faint); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Noticia reader */
.noticia-reader { max-width: 720px; }
.noticia-img { width: 100%; height: 380px; object-fit: cover; border-radius: var(--r); margin-bottom: 22px; }
.noticia-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 12px; color: var(--ink-faint); flex-wrap: wrap; }
.noticia-categoria { background: var(--red); color: #fff; padding: 2px 10px; border-radius: 2px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.noticia-title { font-family: 'IBM Plex Serif', serif; font-size: 28px; font-weight: 700; line-height: 1.25; margin-bottom: 14px; letter-spacing: -.3px; }
.noticia-resumo { font-size: 16px; color: var(--ink-light); margin-bottom: 22px; line-height: 1.7; border-left: 3px solid var(--red); padding-left: 16px; }
.noticia-body { font-size: 16px; line-height: 1.85; }
.noticia-body p { margin-bottom: 16px; }
.noticia-nav { display: flex; justify-content: space-between; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: 4px 0 40px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .portal-body { grid-template-columns: 1fr; }
  .widget-actions { flex-direction: column; gap: 4px; }
}
