@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader-Italic-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-VariableFont_wdth,wght.ttf") format("truetype");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  overflow: hidden;
}

/* ===== Theme A: azul (Guilherme) ===== */
body.theme-azul {
  --page-bg: linear-gradient(145deg, #1a4fd8 0%, #3d7dff 45%, #6aa8ff 100%);
  --sidebar: #0d2f8f;
  --sidebar-text: #dbe7ff;
  --sidebar-muted: #9bb6ef;
  --sidebar-active: rgba(255,255,255,.16);
  --shell: #f4f7fb;
  --card: #ffffff;
  --ink: #12203a;
  --muted: #66748f;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --accent-deep: #1a4fd8;
  --line: #e3e9f3;
  --ok: #1f9d63;
  --danger: #d64545;
  --holiday: #f3c1d0;
  --badge: #2f6bff;
  --hero-card: #2f6bff;
  --hero-text: #ffffff;
  --chip: #eef3ff;
  --shadow: 0 10px 30px rgba(18,40,90,.08);
  --serif: Newsreader, Georgia, serif;
  --sans: Inter, "IBM Plex Sans", system-ui, sans-serif;
}

/* ===== Theme B: biblioteca (Fernando) ===== */
body.theme-biblioteca {
  --page-bg: linear-gradient(145deg, #1E3A2F 0%, #2a4d3f 40%, #cfc4a6 100%);
  --sidebar: #1E3A2F;
  --sidebar-text: #F1EBDD;
  --sidebar-muted: #C9B895;
  --sidebar-active: rgba(241,235,221,.12);
  --shell: #F3EFE6;
  --card: #FBF8F0;
  --ink: #23231F;
  --muted: #6b6558;
  --accent: #7A5A1E;
  --accent-soft: #efe4cb;
  --accent-deep: #1E3A2F;
  --line: #e2d8c2;
  --ok: #2f6b4f;
  --danger: #9A3F24;
  --holiday: #f0d5c8;
  --badge: #7A5A1E;
  --hero-card: #1E3A2F;
  --hero-text: #F1EBDD;
  --chip: #EFE8D8;
  --shadow: 0 10px 28px rgba(30,58,47,.10);
  --serif: Newsreader, Georgia, serif;
  --sans: Inter, "IBM Plex Sans", system-ui, sans-serif;
}

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  padding: 18px;
  gap: 14px;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-radius: 22px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 14px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 600; color: #fff; font-size: 16px;
}
body.theme-biblioteca .brand-mark { background: #C9B895; color: #1E3A2F; }
.profiles { display: flex; gap: 6px; margin-left: auto; }
.profiles span {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.35);
  font-size: 10px; display:grid; place-items:center; font-weight: 600;
}
.handle {
  font-size: 12px; color: var(--sidebar-muted);
  padding: 0 8px 12px; letter-spacing: .01em;
}
.nav-label {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--sidebar-muted); padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--sidebar-active); }
.nav-item.active { background: var(--sidebar-active); font-weight: 600; }
.nav-item .ico { width: 18px; opacity: .9; }
.nav-item .count {
  margin-left: auto; background: rgba(255,255,255,.18);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600;
}
.main {
  background: var(--shell);
  border-radius: 22px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 24px 4px;
}
.crumb {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
h1 {
  font-family: var(--serif);
  font-weight: 520; font-size: 36px; letter-spacing: -.02em;
  color: var(--ink); line-height: 1.05;
}
.sub { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 520px; }
.content { padding: 4px 24px 16px; overflow: auto; flex: 1; }
.period {
  display: flex; gap: 6px; align-items: center;
}
.period button, .btn {
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 999px; padding: 8px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.period button.active, .btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
body.theme-biblioteca .btn.primary { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--hero-text); }
.btn.ghost { background: var(--card); }

.grid-metrics {
  display: grid; grid-template-columns: 1.1fr 1fr 1.15fr; gap: 14px; margin-top: 18px;
}
.card {
  background: var(--card); border-radius: 18px; padding: 18px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.card.hero {
  background: var(--hero-card); color: var(--hero-text); border: none;
}
.card .label {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; opacity: .75; margin-bottom: 8px;
}
.card .value {
  font-family: var(--serif); font-size: 40px; font-weight: 520;
  letter-spacing: -.02em; line-height: 1;
}
.card .delta { font-size: 12px; margin-top: 8px; opacity: .85; }
.card .delta.up { color: var(--ok); }
.card.hero .delta.up { color: #b7f0cf; }
.mini-bars {
  display: flex; align-items: flex-end; gap: 4px; height: 54px; margin-top: 16px;
}
.mini-bars span {
  flex: 1; border-radius: 4px 4px 2px 2px; background: rgba(255,255,255,.35);
  min-height: 6px;
}
body.theme-biblioteca .card.hero .mini-bars span { background: rgba(201,184,149,.45); }
.card:not(.hero) .mini-bars span { background: var(--accent-soft); }
.card:not(.hero) .mini-bars span.on { background: var(--accent); }

.eng-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px;
}
.eng-grid div {
  background: var(--chip); border-radius: 12px; padding: 10px 12px;
}
.eng-grid strong { display:block; font-size: 18px; font-family: var(--serif); }
.eng-grid span { font-size: 11px; color: var(--muted); }
.card.hero .eng-grid div { background: rgba(255,255,255,.12); }
.card.hero .eng-grid span { color: rgba(255,255,255,.75); }

.section-title {
  margin: 26px 0 12px; display: flex; justify-content: space-between; align-items: baseline;
}
.section-title h2 {
  font-family: var(--serif); font-size: 22px; font-weight: 520;
}
.posts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.post {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: var(--shadow);
}
.post .thumb {
  aspect-ratio: 4 / 5;
  height: auto;
  background-color: var(--accent-soft);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.post .thumb.thumb-reel {
  aspect-ratio: 9 / 16;
}
.post .body { padding: 12px; }
.post .meta { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.post .title { font-size: 13px; font-weight: 600; margin: 6px 0 10px; line-height: 1.3; min-height: 34px; }
.post .stats { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); }
.post .stats b { color: var(--ink); }

.fila {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 8px;
}
.fila-col {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  min-height: 180px;
}
.fila-col h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 8px; font-weight: 700;
}
.chip-card {
  background: var(--shell); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; margin-bottom: 8px; font-size: 12px; line-height: 1.35;
}
.chip-card .fmt { color: var(--muted); font-size: 10px; margin-top: 4px; }
.chip-card .tag {
  display: inline-block; margin-top: 6px; font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 999px;
}

/* Cronograma */
.cal-head {
  display: flex; justify-content: space-between; align-items: center; margin: 8px 0 14px;
}
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--muted); }
.legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px;
}
.cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.cal .dow {
  font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px;
  text-transform: uppercase; letter-spacing: .06em;
}
.day {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  min-height: 92px; padding: 8px; position: relative;
}
.day.out { opacity: .45; }
.day .n { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.day.today { outline: 2px solid var(--accent); }
.event {
  background: var(--accent-soft); border-radius: 8px; padding: 5px 6px; margin-bottom: 5px;
  font-size: 10px; line-height: 1.25; border-left: 3px solid var(--accent);
  display: flex; gap: 6px; align-items: flex-start;
}
.event img { width: 28px; height: 35px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.event .ph {
  width: 28px; height: 35px; border-radius: 4px; background: var(--accent); flex-shrink: 0; opacity: .35;
}
.event.pub { border-left-color: var(--accent-deep); background: #fff; border: 1px solid var(--line); border-left-width: 3px; }
.event.plan { border-left-color: #8aa4d8; }
body.theme-biblioteca .event.plan { border-left-color: #9C7434; }
.event.li { border-left-color: #0a66c2; }
body.theme-biblioteca .event.li { border-left-color: #1E3A2F; }
.event.hol {
  background: var(--holiday); border-left-color: var(--danger); font-weight: 700; text-align: center;
  display: block;
}
.event .t { font-weight: 700; color: var(--ink); }
.event .m { color: var(--muted); margin-top: 2px; }

/* Insights */
.insights-hero {
  background: var(--hero-card); color: var(--hero-text);
  border-radius: 20px; padding: 24px; margin-top: 10px;
  box-shadow: var(--shadow);
}
.insights-hero .badge {
  display: inline-flex; gap: 8px; align-items: center;
  background: rgba(255,255,255,.14); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; margin-bottom: 14px;
}
.insights-hero h2 {
  font-family: var(--serif); font-size: 28px; font-weight: 520;
  letter-spacing: -.015em; max-width: 780px; line-height: 1.2;
}
.insights-hero p { margin-top: 10px; opacity: .9; max-width: 760px; font-size: 14px; line-height: 1.5; }
.insights-cols {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid rgba(255,255,255,.18);
}
.insights-cols h3 {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  opacity: .7; margin-bottom: 10px; font-weight: 700;
}
.insights-cols ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.insights-cols li {
  background: rgba(255,255,255,.1); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; line-height: 1.4;
}

/* Analytics */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px;
}
.kpi .value { font-size: 32px; }
.chart-card { margin-top: 14px; }
.chart-card h3 { font-family: var(--serif); font-size: 18px; margin-bottom: 6px; }
.chart-note { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.chart {
  height: 220px; display: flex; align-items: flex-end; gap: 10px; padding: 10px 4px 0;
  border-top: 1px solid var(--line);
}
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%; border-radius: 8px 8px 4px 4px; background: var(--accent);
  min-height: 4px; position: relative;
}
.chart .bar.views { background: var(--accent-soft); position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px 8px 4px 4px; }
.chart .dual { width: 100%; position: relative; display: flex; align-items: flex-end; height: 160px; }
.chart .lab { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; }
.chart .val { font-size: 10px; font-weight: 700; color: var(--ink); }

.view { display: none; }
.view.active { display: block; }

.gold-line {
  height: 2px; width: 48px; background: #C9B895; margin: 8px 0 0; border-radius: 2px;
  display: none;
}
body.theme-biblioteca .gold-line { display: block; }

.placeholder-page {
  padding: 40px 0; color: var(--muted); font-size: 14px;
}
.footnote {
  margin-top: 18px; font-size: 11px; color: var(--muted);
}


.menu-btn,
.sidebar-backdrop { display: none; }
.menu-btn {
  width: 42px; height: 42px; border: none; border-radius: 12px;
  background: var(--accent-deep); color: var(--hero-text);
  place-items: center; gap: 5px; padding: 0;
  box-shadow: var(--shadow); cursor: pointer;
}
.menu-btn span {
  display: block; width: 16px; height: 1.5px; border-radius: 2px;
  background: var(--hero-text);
}
body.theme-biblioteca .menu-btn { background: #1E3A2F; }

@media (max-width: 900px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow: auto; }
  .app {
    grid-template-columns: 1fr;
    padding: 10px;
    min-height: 100dvh;
    height: auto;
  }
  .menu-btn {
    display: grid;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 60;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 10, 0.45);
    z-index: 40;
    border: 0;
  }
  body.nav-open .sidebar-backdrop { display: block; }
  .sidebar {
    position: fixed;
    top: 10px; left: 10px; bottom: 10px;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.2s ease;
    overflow: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .main {
    min-height: calc(100dvh - 20px);
    border-radius: 18px;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px 16px 8px 62px;
  }
  h1 { font-size: 28px; }
  .content { padding: 4px 16px 28px; overflow: visible; }
  .period { flex-wrap: wrap; }
  .grid-metrics,
  .insights-cols,
  .kpi-row { grid-template-columns: 1fr; }
  .posts { grid-template-columns: 1fr 1fr; }
  .fila { grid-template-columns: 1fr 1fr; }
  .card .value { font-size: 34px; }
  .cal { gap: 4px; }
  .day { min-height: 70px; padding: 6px; }
  .event img,
  .event .ph { display: none; }
  .insights-hero h2 { font-size: 22px; }
  .insights-hero { padding: 18px; }
}

@media (max-width: 560px) {
  .fila { grid-template-columns: 1fr; }
  .posts { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 26px; }
}
