/* ============================================================================
   REDACTA — Visual Identity & Dashboard Layout
   Light & Dark Navy Edition based on Reference Design
   ============================================================================ */

:root {
  /* Light Mode (Default / [data-theme="light"]) */
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-subtle: #F1F5FA;
  --sidebar-bg: #FFFFFF;
  --ink: #071936;
  --ink-muted: #566680;
  --border: #E3EAF3;
  --border-strong: #CBD6E6;

  --navy-accent: #071E46;
  --navy-accent-hover: #0B2B61;
  --navy-pill-text: #FFFFFF;

  --hero-bg: #051D44;
  --hero-border: #051D44;
  --hero-text: #FFFFFF;
  --hero-subtext: #B8C7E0;
  --hero-btn-bg: #FFFFFF;
  --hero-btn-text: #051D44;
  --hero-btn-border: #FFFFFF;
  --hero-icon-border: rgba(255, 255, 255, 0.24);

  --tag-bg: #EEF2F8;
  --tag-text: #071E46;

  --icon-box-bg: #071E46;
  --icon-box-fg: #FFFFFF;

  --brand-mark-color: #071E46;
  --brand-mark-lines: #FFFFFF;

  --mark-bg: rgba(7, 30, 70, 0.12);
  --mark-fg: #071E46;

  --display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #030D1F;
    --surface: #071630;
    --surface-subtle: #0A1D3D;
    --sidebar-bg: #041026;
    --ink: #F2F6FC;
    --ink-muted: #94A6C2;
    --border: #12284C;
    --border-strong: #1C3A6B;

    --navy-accent: #0A2552;
    --navy-accent-hover: #10336E;
    --navy-pill-text: #FFFFFF;

    --hero-bg: #071C3F;
    --hero-border: #133163;
    --hero-text: #FFFFFF;
    --hero-subtext: #A9BBD6;
    --hero-btn-bg: transparent;
    --hero-btn-text: #FFFFFF;
    --hero-btn-border: #264880;
    --hero-icon-border: #1E3E73;

    --tag-bg: #0D2449;
    --tag-text: #C8D7F0;

    --icon-box-bg: #FFFFFF;
    --icon-box-fg: #051836;

    --brand-mark-color: #FFFFFF;
    --brand-mark-lines: #041026;

    --mark-bg: rgba(143, 180, 255, 0.2);
    --mark-fg: #D4E4FF;
  }
}

:root[data-theme="dark"] {
  --bg: #030D1F;
  --surface: #071630;
  --surface-subtle: #0A1D3D;
  --sidebar-bg: #041026;
  --ink: #F2F6FC;
  --ink-muted: #94A6C2;
  --border: #12284C;
  --border-strong: #1C3A6B;

  --navy-accent: #0A2552;
  --navy-accent-hover: #10336E;
  --navy-pill-text: #FFFFFF;

  --hero-bg: #071C3F;
  --hero-border: #133163;
  --hero-text: #FFFFFF;
  --hero-subtext: #A9BBD6;
  --hero-btn-bg: transparent;
  --hero-btn-text: #FFFFFF;
  --hero-btn-border: #264880;
  --hero-icon-border: #1E3E73;

  --tag-bg: #0D2449;
  --tag-text: #C8D7F0;

  --icon-box-bg: #FFFFFF;
  --icon-box-fg: #051836;

  --brand-mark-color: #FFFFFF;
  --brand-mark-lines: #041026;

  --mark-bg: rgba(143, 180, 255, 0.2);
  --mark-fg: #D4E4FF;
}

*, *::before, *::after {
  box-sizing: inherit;
}

html {
  scroll-padding-top: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.96rem;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

mark {
  background: var(--mark-bg);
  color: var(--mark-fg);
  font-weight: 500;
  padding: 0.05em 0;
  border-radius: 2px;
}

:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
}

/* ============================================================================
   APP SHELL: Left Sidebar + Right Main Area
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Left Sidebar (Sticky & Independently Scrollable) ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  overflow: hidden;
}

.sidebar-top {
  flex: none;
  padding: 0.25rem 0.5rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-mark-color);
}

.brand-text {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 999px;
}

.sidebar-label {
  margin: 0 0 0.6rem;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink-muted);
  transition: background-color 150ms ease, color 150ms ease;
}

.nav-list a svg {
  flex: none;
  width: 19px;
  height: 19px;
  color: currentColor;
  opacity: 0.85;
}

.nav-list a:hover {
  background-color: var(--surface-subtle);
  color: var(--ink);
}

.nav-list a.active {
  background-color: var(--navy-accent);
  color: var(--navy-pill-text);
  font-weight: 500;
}

.nav-list a.active svg {
  opacity: 1;
}

.sidebar-footer {
  flex: none;
  padding-top: 1.25rem;
}

.promo-card {
  border: 1px solid var(--border);
  background-color: var(--surface-subtle);
  border-radius: 14px;
  padding: 1.15rem 1.1rem;
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.45;
}

.promo-icon {
  color: var(--ink);
  margin-bottom: 0.55rem;
  display: block;
}

.promo-card p {
  margin: 0;
}

.promo-card strong {
  color: var(--ink);
  font-weight: 600;
}

/* ============================================================================
   MAIN AREA: Topbar + Dashboard Content
   ============================================================================ */
.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.1rem 2.25rem;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.search {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.45rem 0.35rem 0.9rem;
  transition: border-color 150ms ease;
}

.field:focus-within {
  border-color: var(--border-strong);
}

.field-icon {
  flex: none;
  color: var(--ink-muted);
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  padding: 0.35rem 0.25rem;
}

.field input:focus-visible {
  outline: none;
}

.field input::placeholder {
  color: var(--ink-muted);
}

.field button {
  flex: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  background-color: var(--navy-accent);
  color: var(--navy-pill-text);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.field button:hover {
  background-color: var(--navy-accent-hover);
}

.field button:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Autocomplete Dropdown */
.suggest {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 30;
  list-style: none;
  margin: 0;
  padding: 0.45rem;
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
}

.suggest li {
  border-bottom: 1px solid var(--border);
}

.suggest li:last-child {
  border-bottom: 0;
}

.suggest a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
  transition: background-color 140ms ease;
}

.suggest a:hover {
  background-color: var(--surface-subtle);
}

.suggest .suggest-custom {
  background-color: var(--surface-subtle);
}

.suggest .meta {
  flex: none;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-outline {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0.52rem 1rem;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-outline:hover {
  background-color: var(--surface-subtle);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-subtle);
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ---------- Dashboard Content Container ---------- */
.dashboard-content {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* ---------- Hero Banner ---------- */
.hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background-color: var(--hero-bg);
  border: 1px solid var(--hero-border);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  color: var(--hero-text);
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.hero-circle-icon {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid var(--hero-icon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hero-text);
}

.hero-copy h1 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--hero-text);
}

.hero-copy p {
  margin: 0;
  color: var(--hero-subtext);
  font-size: 0.92rem;
  font-weight: 400;
  max-width: 48ch;
}

.hero-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background-color: var(--hero-btn-bg);
  color: var(--hero-btn-text);
  border: 1px solid var(--hero-btn-border);
  border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: opacity 150ms ease, transform 150ms ease;
}

.hero-btn:hover {
  opacity: 0.92;
}

/* ---------- Compact page intro (replaces the hero banner) ---------- */
.page-intro h1 {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 600;
  margin: 0 0 0.3rem;
  color: var(--ink);
}

.page-intro p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

/* ---------- "Ver mais" inside theme cards ---------- */
.entry-list:not(.expanded) .is-extra {
  display: none;
}

.ver-mais {
  margin-top: 0.75rem;
  padding: 0.35rem 0.1rem;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
}

.ver-mais:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Categories Grid (Illustrated Cards) ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.link-action:hover {
  color: var(--ink);
  text-decoration: underline;
}

.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.15rem 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.cat-card svg {
  width: 30px;
  height: 30px;
  color: var(--ink);
  transition: color 150ms ease;
}

.cat-card:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-subtle);
}

.cat-card.active {
  background-color: var(--navy-accent);
  border-color: var(--navy-accent);
  color: var(--navy-pill-text);
}

.cat-card.active svg {
  color: var(--navy-pill-text);
}

/* ---------- Results Header & Feed Cards ---------- */
.feed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.feed-header-left h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--ink);
}

.feed-header-left p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-muted);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.counts strong {
  color: var(--ink);
  font-weight: 600;
}

/* Theme Section Card (matches the "Em alta" card style from reference) */
.tema-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.35rem;
  transition: border-color 150ms ease;
}

.tema-card:hover {
  border-color: var(--border-strong);
}

.tema-card-top {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
  margin-bottom: 1.35rem;
}

.tema-icon-box {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background-color: var(--icon-box-bg);
  color: var(--icon-box-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tema-icon-box svg {
  width: 26px;
  height: 26px;
}

.tema-head-info {
  flex: 1;
  min-width: 0;
}

.tema-head-info h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.45rem;
  color: var(--ink);
}

.tema-head-info h3 a:hover {
  text-decoration: underline;
}

.tema-submeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.mobile-eixos-btn,
.mobile-card-chevron,
.mobile-card-hint {
  display: none;
}

.badge-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background-color: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.22rem 0.58rem;
  border-radius: 6px;
}

/* Two Columns inside Tema Card: Teses (left) + Repertórios (right) */
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.col-title {
  margin: 0 0 0.85rem;
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.arg,
.rep {
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.entry-key,
.rep-tipo {
  margin: 0;
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
}

.tese {
  font-family: var(--sans);
  font-size: 0.94rem;
  font-weight: 400;
  line-height: 1.52;
  margin: 0;
  color: var(--ink);
}

.rep-desc {
  font-family: var(--sans);
  font-size: 0.93rem;
  font-weight: 400;
  line-height: 1.52;
  margin: 0;
  color: var(--ink);
}

.rep-uso {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Discreet SVG Copy Icon Button */
.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-muted);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.copy:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.copy.copied {
  background-color: var(--navy-accent);
  border-color: var(--navy-accent);
  color: var(--navy-pill-text);
}

/* Correlated Themes List */
.correlatos-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.correlatos-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border);
  font-weight: 500;
  transition: border-color 150ms ease;
}

.correlatos-list a:hover {
  border-color: var(--border-strong);
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--ink-muted);
}

.qtd {
  display: block;
  color: var(--ink-muted);
  font-size: 0.88rem;
  padding: 0.4rem 0;
}

/* ---------- Responsive Adaptation (Tablet & Mobile < 960px) ---------- */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 1. Topbar compacta para os Eixos retráteis */
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0;
  }

  .brand {
    gap: 0.55rem;
  }

  .brand-mark svg {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    font-size: 1.25rem;
  }

  .mobile-eixos-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--surface-subtle);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 190px;
    cursor: pointer;
  }

  .mobile-eixos-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Gaveta de Eixos oculta por padrão no celular (abre ao tocar em "Eixos") */
  .sidebar-scroll {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 0;
  }

  .sidebar-scroll.is-open {
    display: block;
  }

  .sidebar-label {
    display: none;
  }

  .nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .nav-list a {
    padding: 0.6rem 0.75rem;
    font-size: 0.86rem;
    border-radius: 8px;
  }

  .sidebar-footer {
    display: none;
  }

  /* 2. Barra de Busca limpa */
  .topbar {
    padding: 0.65rem 1rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .search {
    max-width: none;
    flex: 1;
    min-width: 0;
  }

  .field {
    padding: 0.2rem 0.3rem 0.2rem 0.65rem;
    gap: 0.4rem;
    border-radius: 9px;
  }

  /* 16px evita o zoom automático do iOS ao focar o campo */
  .field input {
    font-size: 16px;
    padding: 0.28rem 0.1rem;
  }

  .field button {
    padding: 0.38rem 0.68rem;
    font-size: 0.76rem;
    border-radius: 6px;
  }

  .topbar-actions {
    flex: none;
    gap: 0.4rem;
  }

  .btn-outline {
    padding: 0.4rem 0.6rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .suggest {
    left: 0;
    right: -2.75rem;
    max-height: 60vh;
    overflow-y: auto;
  }

  .suggest a {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.84rem;
    line-height: 1.38;
  }

  /* 3. Conteúdo principal enxuto */
  .dashboard-content {
    padding: 0.9rem 1rem 2.5rem;
    gap: 0.95rem;
  }

  /* Oculta textos redundantes no mobile para dar espaço aos temas */
  .page-intro {
    display: none;
  }

  /* Categorias como única faixa de filtros rápida */
  .category-cards {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.45rem;
    margin: 0 -1rem;
    padding: 0.1rem 1rem 0.2rem;
    scrollbar-width: none;
  }

  .category-cards::-webkit-scrollbar {
    display: none;
  }

  .categories-section {
    margin-bottom: 0.85rem;
  }

  .cat-card {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
  }

  .cat-card svg {
    width: 15px;
    height: 15px;
  }

  /* Cabeçalho de resultados super enxuto */
  .feed-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
  }

  .feed-header-left h2 {
    font-size: 1rem;
    margin: 0;
  }

  .feed-header-left p {
    display: none;
  }

  .counts {
    font-size: 0.74rem;
    gap: 0.5rem;
  }

  .counts li:not(:first-child) {
    display: none;
  }

  /* 4. Cards de Temas em Acordeão no Mobile (limpos e fáceis de escanear) */
  .tema-card {
    padding: 0.95rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.7rem;
  }

  .tema-card-top {
    gap: 0.65rem;
    margin-bottom: 0;
    align-items: flex-start;
    cursor: pointer;
  }

  /* Oculta o quadrado decorativo no celular para dar 100% da largura ao título */
  .tema-icon-box {
    display: none;
  }

  .tema-head-info h3 {
    font-size: 0.96rem;
    line-height: 1.38;
    margin-bottom: 0.4rem;
  }

  .badge-pill {
    font-size: 0.62rem;
    padding: 0.16rem 0.45rem;
  }

  .mobile-card-hint {
    display: inline-block;
    font-size: 0.72rem;
    color: var(--ink-muted);
  }

  .mobile-card-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-top: 0.1rem;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    transition: transform 180ms ease;
  }

  .tema-card.is-open-mobile .mobile-card-chevron {
    transform: rotate(180deg);
    color: var(--ink);
  }

  /* No mobile, o corpo do card fica recolhido até o aluno tocar */
  .tema-card .cols {
    display: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
  }

  .tema-card.is-open-mobile .cols {
    display: grid;
  }

  .col-title {
    margin-bottom: 0.5rem;
    font-size: 0.68rem;
  }

  .entry-list {
    gap: 0.55rem;
  }

  .arg,
  .rep {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
  }

  .tese,
  .rep-desc {
    font-size: 0.87rem;
    line-height: 1.46;
  }

  .correlatos-list a {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.65rem 0.8rem;
    font-size: 0.86rem;
  }
}



/* ============================================================================
   MÓDULO DE FAVORITOS & WIDGETS DO DASHBOARD (Fidelidade ao Protótipo Redacta)
   ============================================================================ */

.categories-section {
  margin-bottom: 1.25rem;
}

/* Grid do Dashboard (minmax(0, 1fr) impede que filhos largos, como a faixa de categorias, estourem a tela) */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  width: 100%;
}

@media (min-width: 1200px) {
  .dashboard-content {
    max-width: 1440px;
  }
}

/* Estado vazio dos favoritos */
.favoritos-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1rem;
  background-color: var(--surface-subtle);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

.favoritos-empty-state .empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  margin-bottom: 0.65rem;
}

.favoritos-empty-state .empty-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.25rem;
}

.favoritos-empty-state .empty-desc {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.35;
}

/* Botão de Favoritar no Card de Tema */
.tema-bookmark-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 150ms ease;
  flex-shrink: 0;
}

.tema-bookmark-btn:hover {
  background-color: var(--surface-subtle);
  color: var(--ink);
  transform: scale(1.08);
}

.tema-bookmark-btn.is-active {
  color: var(--navy-accent);
}

.tema-bookmark-btn.is-active svg {
  fill: currentColor;
}

:root[data-theme="dark"] .tema-bookmark-btn.is-active {
  color: #60A5FA;
}

/* Botão de Favoritar Repertório (ao lado do copiar) */
.entry-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.rep-bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-muted);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.rep-bookmark-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

.rep-bookmark-btn.is-active {
  color: var(--navy-accent);
  border-color: var(--navy-accent);
}

:root[data-theme="dark"] .rep-bookmark-btn.is-active {
  color: #60A5FA;
  border-color: #60A5FA;
}

/* Badge de favoritos no Topbar */
.topbar-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.topbar-fav-btn:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-subtle);
}

.fav-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--navy-accent);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  border: 1.5px solid var(--surface);
}

/* ============================================================================
   MODAL COMPLETO DE FAVORITOS
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(7, 25, 54, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(7, 25, 54, 0.35);
  transform: translateY(14px) scale(0.98);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.35rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.modal-icon-badge {
  width: 40px;
  height: 40px;
  background-color: var(--navy-accent);
  color: #FFFFFF;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 2px 0 0;
}

.modal-close-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 150ms ease;
}

.modal-close-btn:hover {
  background-color: var(--surface-subtle);
  color: var(--ink);
}

.modal-controls {
  padding: 1rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background-color: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.modal-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  color: var(--ink-muted);
}

.modal-search input {
  border: none;
  outline: none;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.88rem;
  background: transparent;
  color: var(--ink);
}

.modal-filter-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-pill {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--navy-accent);
  color: var(--ink);
}

.filter-pill.active {
  background-color: var(--navy-accent);
  border-color: var(--navy-accent);
  color: #FFFFFF;
}

.modal-body {
  padding: 1.35rem 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.modal-favorito-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background-color: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.modal-favorito-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.modal-favorito-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.modal-favorito-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0.2rem 0 0;
}

.modal-favorito-desc {
  font-size: 0.84rem;
  color: var(--ink);
  line-height: 1.45;
  margin: 0;
}

.modal-favorito-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.3rem;
}

.copy-quote-btn {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.copy-quote-btn:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border-strong);
}

.remove-modal-favorito-btn {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: #EF4444;
  background: none;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.remove-modal-favorito-btn:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

/* Toast de Notificação Flutuante */
.toast-notification {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--ink);
  color: var(--surface);
  border-radius: 10px;
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.86rem;
  font-weight: 600;
}

.toast-notification.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Favoritos e ações no mobile ---------- */
@media (max-width: 960px) {
  /* Alvos de toque maiores nos botões dos cards */
  .copy,
  .rep-bookmark-btn {
    width: 36px;
    height: 36px;
  }

  .entry-actions {
    gap: 0.5rem;
  }

  /* Modal vira uma gaveta que sobe da base da tela */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    max-width: none;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-backdrop.active .modal-container {
    transform: translateY(0);
  }

  .modal-header {
    padding: 1rem 1rem 0.85rem;
    gap: 0.75rem;
  }

  .modal-title-wrap {
    gap: 0.65rem;
    min-width: 0;
  }

  .modal-icon-badge {
    width: 34px;
    height: 34px;
    flex: none;
  }

  .modal-title {
    font-size: 1rem;
  }

  .modal-subtitle {
    font-size: 0.76rem;
  }

  .modal-close-btn {
    flex: none;
    width: 40px;
    height: 40px;
  }

  .modal-controls {
    padding: 0.75rem 1rem;
    gap: 0.65rem;
  }

  .modal-search input {
    font-size: 16px;
  }

  .modal-filter-pills {
    margin: 0 -1rem;
    padding: 0 1rem 2px;
    scrollbar-width: none;
  }

  .modal-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    padding: 0.45rem 0.9rem;
  }

  .modal-body {
    padding: 0.9rem 1rem 1.25rem;
    gap: 0.75rem;
  }

  .modal-favorito-card {
    padding: 0.9rem 0.95rem;
  }

  .modal-favorito-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .copy-quote-btn {
    padding: 0.55rem 0.8rem;
  }

  .remove-modal-favorito-btn {
    padding: 0.55rem 0.7rem;
  }

  /* Toast centralizado e acima da área de gestos */
  .toast-notification {
    left: 1rem;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    justify-content: flex-start;
  }
}
