/* ════════════════════════════════════════════════════════════════════════════
   SHELL DA PLATAFORMA — trilho noturno do cockpit de preparação.

   O contraste forte fica restrito à navegação. As salas continuam claras e a
   rota ativa recebe uma única linha luminosa, como uma marca de corte.
   Tudo permanece sob .app-shell e não alcança a experiência pré-login.
════════════════════════════════════════════════════════════════════════════ */

.app-shell {
  min-height: 100vh;
  color: #182138;
  background: #f3f5fa;
  --info: #5870f2;
  --info-soft: #eef1ff;
}

/* ── Geometria permanente ─────────────────────────────────────────────── */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-header);
  width: 252px;
}

.app-shell > .app-sidebar {
  display: flex;
  flex-direction: column;
  width: 252px;
  padding: max(20px, env(safe-area-inset-top)) 17px max(18px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  color: #f7f9ff;
  border-right: 1px solid rgba(100, 121, 210, .16);
  background:
    radial-gradient(circle at 18% 0%, rgba(96, 119, 255, .23), transparent 19rem),
    linear-gradient(180deg, #151f3d 0%, #10182e 58%, #0d1529 100%);
  box-shadow: 18px 0 48px rgba(12, 20, 42, .12);
  scrollbar-color: #46516d transparent;
  scrollbar-width: thin;
}
.app-shell > .app-sidebar::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 0;
  bottom: 20px;
  width: 1px;
  z-index: 0;
  background: linear-gradient(180deg, transparent, rgba(111, 132, 255, .48) 36%, rgba(181, 235, 90, .28) 66%, transparent);
  pointer-events: none;
}
.app-shell > .app-sidebar > * { position: relative; z-index: 1; }
.app-shell > .app-sidebar::-webkit-scrollbar { width: 5px; }
.app-shell > .app-sidebar::-webkit-scrollbar-thumb { border-radius: 999px; background: #46516d; }

.app-main { margin-left: 252px; }
.app-shell > .app-main {
  min-height: 100vh;
  margin-left: 252px;
  background-color: #f3f5fa;
}
.app-bottombar { display: none; }
.app-streak-dock { display: none; }

/* ── Marca: cabeçalho da coluna, sem bloco flutuante ─────────────────── */
.app-shell .app-sidebar-logo {
  display: flex;
  min-height: var(--tap-min);
  margin: 0 1px 25px;
  padding: 5px 8px 22px;
  align-items: center;
  color: #fff;
  border-bottom: 1px solid rgba(213, 222, 255, .12);
  border-radius: 0;
  font-family: var(--font-display), Manrope, Inter, sans-serif;
  text-decoration: none;
}
.app-shell .app-logo-mark {
  width: 27px;
  height: 27px;
  margin-right: 10px;
  flex: 0 0 auto;
  color: #879aff;
  filter: drop-shadow(0 5px 12px rgba(96, 119, 255, .32));
}
.app-shell .app-sidebar-logo strong {
  color: #fff;
  font-size: var(--esp-type-subhead);
  font-weight: var(--esp-weight-bold);
  letter-spacing: -.055em;
  line-height: 1;
}
.app-shell .app-sidebar-logo em { color: #a8b5ff; font-style: normal; }
.app-shell .app-sidebar-logo small {
  margin: 3px 0 0 6px;
  color: #7f8aa8;
  font-family: var(--font-body), Inter, sans-serif;
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  letter-spacing: .09em;
}

/* ── Navegação: pauta e índices de seção ─────────────────────────────── */
.app-shell .app-nav-label {
  display: block;
  margin: 0 10px 9px;
  color: #7f8aa8;
  font-family: var(--esp-micro, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  letter-spacing: .145em;
  line-height: 1.3;
  text-transform: uppercase;
}
.app-shell .app-nav-label--evaluation { margin-top: 27px; }

.app-shell .app-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.app-shell .app-nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 6px 11px 6px 8px;
  align-items: center;
  gap: 11px;
  overflow: visible;
  color: #a7b1c8;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-family: var(--font-body), Inter, sans-serif;
  font-size: var(--esp-type-support);
  font-weight: var(--esp-weight-bold);
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--t-fast), background-color var(--t-fast);
}
.app-shell .app-nav-item::before {
  content: "";
  position: absolute;
  top: 50%;
  right: auto;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #7186ff, #b5eb5a);
  opacity: 0;
  transform: translateY(-50%) scaleY(.35);
  transform-origin: center;
  transition: opacity var(--t-fast), transform var(--t-med);
}
.app-shell .app-nav-item::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 13px;
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: #b5eb5a;
  box-shadow: 0 0 0 4px rgba(181, 235, 90, .1), 0 0 14px rgba(181, 235, 90, .5);
  opacity: 0;
  transform: translateY(-50%) scale(.55);
  transition: opacity var(--t-fast), transform var(--t-med);
}
.app-shell .app-nav-item svg {
  position: relative;
  z-index: 1;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  padding: 7px;
  color: #a7b1c8;
  border: 1px solid rgba(213, 222, 255, .1);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  stroke-width: 1.8;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}
.app-shell .app-nav-item > span { min-width: 0; }
.app-shell .app-nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(91, 114, 246, .24), rgba(91, 114, 246, .08));
}
.app-shell .app-nav-item.active::before { opacity: 1; transform: translateY(-50%) scaleY(1); }
.app-shell .app-nav-item.active::after { opacity: 1; transform: translateY(-50%) scale(1); }
.app-shell .app-nav-item.active svg {
  color: #fff;
  border-color: rgba(139, 156, 255, .58);
  background: linear-gradient(145deg, #6278f5, #445bd4);
  box-shadow: 0 8px 18px rgba(52, 71, 169, .34);
}

/* ── Registro de preparação: duas linhas, nenhuma pilha de cards ─────── */
.app-progresso {
  display: grid;
  margin-top: auto;
  margin-bottom: 6px;
  padding: 8px 0 0;
  border-top: 1px solid rgba(213, 222, 255, .12);
  border-bottom: 1px solid rgba(213, 222, 255, .12);
}
.app-progresso[hidden] { display: none; }
.app-shell .app-sidebar-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(213, 222, 255, .1);
}
.app-shell .app-sidebar-metrics > span {
  display: grid;
  min-width: 0;
  min-height: 52px;
  padding: 9px 7px;
  align-content: center;
  gap: 4px;
}
.app-shell .app-sidebar-metrics > span:nth-child(even) { border-left: 1px solid rgba(213, 222, 255, .08); }
.app-shell .app-sidebar-metrics > span:nth-child(-n + 2) { border-bottom: 1px solid rgba(213, 222, 255, .08); }
.app-shell .app-sidebar-metrics b {
  overflow: hidden;
  color: #fff;
  font-family: var(--font-display), Manrope, Inter, sans-serif;
  font-size: var(--esp-type-support);
  font-weight: var(--esp-weight-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-shell .app-sidebar-metrics small {
  overflow: hidden;
  color: #929db6;
  font-family: var(--font-body), Inter, sans-serif;
  font-size: var(--esp-type-caption);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-shell .app-progresso-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  min-height: 40px;
  padding: 8px 7px;
  align-items: baseline;
  gap: 8px;
  color: #929db6;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.app-shell .app-progresso-item + .app-progresso-item { border-top: 1px solid rgba(213, 222, 255, .08); }
.app-shell .app-progresso-item b {
  color: #fff;
  font-family: var(--font-display), Manrope, Inter, sans-serif;
  font-size: var(--esp-type-body);
  font-weight: var(--esp-weight-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  line-height: 1;
  text-align: right;
}
.app-shell .app-progresso-item span {
  color: #929db6;
  font-size: var(--esp-type-caption);
  line-height: 1.3;
}
.app-shell .app-progresso-item--streak b { color: #b5eb5a; }
.app-shell .app-progresso-item--deadline {
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
}
.app-shell .app-progresso-item--deadline span { white-space: nowrap; }

/* ── Conta: rodapé funcional da coluna ───────────────────────────────── */
.app-shell .app-user {
  display: flex;
  min-height: 66px;
  margin-top: auto;
  padding: 13px 2px 0;
  align-items: center;
  gap: 8px;
  color: #f7f9ff;
  border: 0;
  border-top: 1px solid rgba(213, 222, 255, .14);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.app-shell .app-progresso:not([hidden]) + .app-user { margin-top: 0; }
.app-shell .app-user-profile {
  display: flex;
  min-width: 0;
  min-height: var(--tap-min);
  flex: 1 1 auto;
  padding: 3px 4px;
  align-items: center;
  gap: 9px;
  color: inherit;
  border-radius: 10px;
  text-decoration: none;
  transition: background-color var(--t-fast);
}
.app-shell .app-user-avatar {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(146, 162, 255, .42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(111, 133, 255, .38), rgba(76, 94, 188, .18));
  box-shadow: 0 10px 24px rgba(5, 11, 28, .22);
  font-size: var(--esp-type-support);
  font-weight: var(--esp-weight-bold);
}
.app-shell .app-user-avatar::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid #10182e;
  border-radius: 50%;
  background: #b5eb5a;
}
.app-shell .app-user-meta {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
}
.app-shell .app-user-caption {
  display: block;
  color: #8995b0;
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  letter-spacing: .04em;
  line-height: 1.2;
  white-space: nowrap;
}
.app-shell .app-user-name {
  max-width: none;
  overflow: visible;
  color: #fff;
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}
.app-shell .app-user-sair {
  display: inline-flex;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  flex: 0 0 auto;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  color: #8995b0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-body), Inter, sans-serif;
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  line-height: 1;
  cursor: pointer;
  transition: color var(--t-fast), background-color var(--t-fast);
}

/* Visitante na sala: mesma coluna, convite claro e sem card promocional. */
.app-shell .app-user--anon {
  display: block;
  min-height: 0;
  padding: 15px 5px 0;
  text-align: left;
}
.app-shell .app-user--anon strong {
  display: block;
  margin-top: 5px;
  color: #fff;
  font-size: var(--esp-type-support);
  font-weight: var(--esp-weight-bold);
  line-height: 1.4;
}
.app-shell .app-user--anon > span:not(.app-user-caption) {
  display: block;
  margin-top: 3px;
  color: #929db6;
  font-size: var(--esp-type-caption);
  line-height: 1.48;
}
.app-user-entrar {
  display: flex;
  min-height: var(--tap-min);
  margin-top: 11px;
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 1px solid rgba(139, 156, 255, .46);
  border-radius: 10px;
  background: rgba(96, 119, 255, .13);
  font-size: var(--esp-type-caption);
  font-weight: var(--esp-weight-bold);
  text-align: center;
  text-decoration: none;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}
.app-shell .app-user-entrar { color: #fff; border-color: rgba(139, 156, 255, .46); background: rgba(96, 119, 255, .13); }

/* ── Foco, hover e estados de interação ──────────────────────────────── */
.app-shell .app-sidebar-logo:focus-visible,
.app-shell .app-nav-item:focus-visible,
.app-shell .app-user-profile:focus-visible,
.app-shell .app-user-sair:focus-visible,
.app-shell .app-user-entrar:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

@media (hover: hover) {
  .app-shell .app-sidebar-logo:hover { color: #fff; }
  .app-shell .app-nav-item:hover { color: #eef2ff; background: rgba(255, 255, 255, .055); }
  .app-shell .app-nav-item:hover svg { color: #d8deff; border-color: rgba(139, 156, 255, .28); }
  .app-shell .app-nav-item.active:hover { color: #fff; background: linear-gradient(90deg, rgba(91, 114, 246, .29), rgba(91, 114, 246, .11)); }
  .app-shell .app-nav-item.active:hover svg { color: #fff; border-color: rgba(160, 174, 255, .68); background: linear-gradient(145deg, #6a80fa, #4a61dc); }
  .app-shell .app-user-profile:hover { background: rgba(255, 255, 255, .055); }
  .app-shell .app-user-sair:hover { color: #ff94a0; background: rgba(217, 91, 105, .1); text-decoration: none; }
  .app-shell .app-user-entrar:hover { color: #10182e; border-color: #b5eb5a; background: #b5eb5a; }
}

/* ── Barra inferior: a margem de rubrica vira traço sobre a rota ─────── */
@media (max-width: 820px) {
  .app-shell > .app-sidebar { display: none; }
  .app-shell > .app-main {
    min-height: 100vh;
    margin-left: 0;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }
  .app-shell > .app-bottombar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-header);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-flow: initial;
    grid-auto-columns: initial;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
    min-height: calc(70px + env(safe-area-inset-bottom));
    padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    align-items: center;
    gap: 2px;
    color: #9da8c0;
    border-top: 1px solid rgba(129, 147, 235, .2);
    background: rgba(15, 23, 45, .96);
    box-shadow: 0 -14px 34px rgba(11, 18, 38, .2);
    backdrop-filter: blur(18px) saturate(130%);
  }
  .app-shell .app-bottombar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(113, 134, 255, .55), transparent);
    pointer-events: none;
  }
  .app-shell .app-bottombar .app-nav-item {
    width: 100%;
    min-width: 0;
    min-height: 57px;
    padding: 7px 2px 5px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    overflow: visible;
    color: #9da8c0;
    border-radius: 3px;
    background: transparent;
    font-size: var(--esp-type-caption);
    font-weight: var(--esp-weight-medium);
    letter-spacing: -.05em;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
  }
  .app-shell .app-bottombar .app-nav-item::before {
    top: -6px;
    right: auto;
    bottom: auto;
    left: 50%;
    width: 32px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, #6f85ff, #b5eb5a);
    opacity: 0;
    transform: translateX(-50%) scaleX(.45);
    transform-origin: center;
  }
  .app-shell .app-bottombar .app-nav-item::after { display: none; }
  .app-shell .app-bottombar .app-nav-item.active::before {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
  }
  .app-shell .app-bottombar .app-nav-item svg {
    width: 27px;
    height: 27px;
    padding: 4px;
    color: #9da8c0;
    border: 0;
    border-radius: 5px;
    background: transparent;
  }
  .app-shell .app-bottombar .app-nav-item > span {
    width: 100%;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .app-shell .app-bottombar .app-nav-item.active {
    color: #fff;
    background: transparent;
  }
  .app-shell .app-bottombar .app-nav-item.active svg {
    color: #fff;
    background: rgba(91, 114, 246, .22);
    box-shadow: 0 6px 16px rgba(4, 10, 27, .2);
  }
  .app-shell .app-user--anon { display: none; }
}

@media (max-width: 360px) {
  .app-shell > .app-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .app-shell > .app-bottombar {
    gap: 0;
    padding-right: max(2px, env(safe-area-inset-right));
    padding-left: max(2px, env(safe-area-inset-left));
  }
  .app-shell .app-bottombar .app-nav-item { padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .app-nav-item,
  .app-shell .app-nav-item::before,
  .app-shell .app-nav-item::after,
  .app-shell .app-nav-item svg,
  .app-shell .app-user-profile,
  .app-shell .app-user-sair,
  .app-shell .app-user-entrar { transition: none; }
}

/* ── Navegação de estudo: uma margem de caderno, não um cockpit premium ────
   A sala é clara e o aluno volta várias vezes por semana. A navegação acompanha
   esse gesto: papel frio, grafite e uma única marca roxa para dizer onde ele está.
   O lima fica restrito à confirmação de sequência, sem halo ou gradiente. */
.app-shell > .app-sidebar {
  color: #2b354d;
  border-right-color: #dfe4ee;
  background: #f7f8fc;
  box-shadow: 8px 0 28px rgba(39, 50, 83, .06);
  scrollbar-color: #c7cfdf transparent;
}
.app-shell > .app-sidebar::after { background: #e4e8f1; }
.app-shell .app-sidebar-logo {
  color: #27324a;
  border-bottom-color: #dfe4ee;
}
.app-shell .app-sidebar-logo:hover { color: #27324a; }
.app-shell .app-logo-mark {
  color: #6075d6;
  filter: none;
}
.app-shell .app-sidebar-logo strong { color: #27324a; }
.app-shell .app-sidebar-logo em { color: #6679d4; }
.app-shell .app-sidebar-logo small { color: #7e899d; }
.app-shell .app-nav-label { color: #7d879b; }
.app-shell .app-nav-item {
  color: #68748b;
  border-radius: 10px;
}
.app-shell .app-nav-item::before {
  width: 3px;
  background: #687bd1;
}
.app-shell .app-nav-item::after {
  background: #79a63a;
  box-shadow: 0 0 0 3px rgba(121, 166, 58, .14);
}
.app-shell .app-nav-item svg {
  color: #78849a;
  border-color: #dce2ed;
  background: #fff;
}
.app-shell .app-nav-item.active {
  color: #3f51ad;
  background: #edf0ff;
  box-shadow: inset 0 0 0 1px rgba(103, 122, 211, .16);
}
.app-shell .app-nav-item.active svg {
  color: #fff;
  border-color: #8493e0;
  background: #6579d7;
  box-shadow: 0 4px 10px rgba(78, 97, 180, .16);
}
.app-shell .app-progresso {
  border-top-color: #dfe4ee;
  border-bottom: 0;
}
.app-shell .app-sidebar-metrics { border-bottom-color: #dfe4ee; }
.app-shell .app-sidebar-metrics > span:nth-child(even),
.app-shell .app-sidebar-metrics > span:nth-child(-n + 2) { border-color: #e3e7ef; }
.app-shell .app-sidebar-metrics b,
.app-shell .app-progresso-item b { color: #2b354d; }
.app-shell .app-sidebar-metrics small,
.app-shell .app-progresso-item,
.app-shell .app-progresso-item span { color: #7a869b; }
.app-shell .app-progresso-item + .app-progresso-item { border-top-color: #e3e7ef; }
.app-shell .app-progresso-item--streak b { color: #6c9834; }
.app-shell .app-progresso-item--streak {
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
}
.app-shell .app-progresso-item--streak b { text-align: left; }
.app-shell .app-user {
  color: #2b354d;
  border-top-color: #dfe4ee;
  padding-top: 15px;
}
.app-shell .app-user-profile:hover { background: #eef1ff; }
.app-shell .app-user-avatar {
  color: #4256b4;
  border-color: #c4cdeb;
  background: #e8ecff;
  box-shadow: none;
}
.app-shell .app-user-avatar::after {
  border-color: #f7f8fc;
  background: #79a63a;
  box-shadow: none;
}
.app-shell .app-user-caption,
.app-shell .app-user-sair { color: #7b879b; }
.app-shell .app-user-name { color: #2b354d; }
.app-shell .app-user-sair:hover { color: #bb4c58; background: #fff1f2; }
.app-shell .app-user--anon strong { color: #2b354d; }
.app-shell .app-user--anon > span:not(.app-user-caption) { color: #7a869b; }
.app-shell .app-user-entrar,
.app-shell .app-user-entrar:hover {
  color: #4e61bd;
  border-color: #cfd7ef;
  background: #eef1ff;
}

@media (hover: hover) {
  .app-shell .app-nav-item:hover { color: #3f4f91; background: #eef1fb; }
  .app-shell .app-nav-item:hover svg { color: #5267bd; border-color: #cfd7ec; }
  .app-shell .app-nav-item.active:hover { color: #3f51ad; background: #e8ecff; }
  .app-shell .app-nav-item.active:hover svg { color: #fff; border-color: #8493e0; background: #6579d7; }
}

@media (max-width: 820px) {
  .app-shell > .app-bottombar {
    color: #707c91;
    border-top-color: #dfe4ee;
    /* Fundo sólido: evita que o conteúdo da página atravesse a barra fixa no
       mobile quando um bloco termina exatamente atrás dela. */
    background: #fafaf8;
    box-shadow: 0 -8px 20px rgba(45, 58, 91, .08);
    backdrop-filter: none;
  }
  .app-shell .app-bottombar::before { background: #d9dfed; }
  .app-shell .app-bottombar .app-nav-item { color: #78849a; }
  .app-shell .app-bottombar .app-nav-item::before { background: #687bd1; }
  .app-shell .app-bottombar .app-nav-item svg { color: #7b879a; }
  .app-shell .app-bottombar .app-nav-item.active {
    color: #465ab9;
    background: #f0f2ff;
  }
  .app-shell .app-bottombar .app-nav-item.active svg {
    color: #5266c2;
    background: #e7ebff;
    box-shadow: none;
  }
}

/* Sequência é um estado consultável, não uma sexta rota. O controle flutua
   discretamente acima da navegação e revela somente ritmo + prazo; médias e
   notas ficam nas telas em que ganham contexto. */
@media (max-width: 820px) {
  .app-shell > .app-main {
    padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }
  .app-shell > .app-streak-dock {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: calc(var(--z-header) + 1);
    display: block;
  }
  .app-shell .app-streak-trigger {
    display: inline-flex;
    min-width: var(--app-tap, 44px);
    height: var(--app-tap, 44px);
    padding: 0 12px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #547b25;
    border: 1px solid #d7e5bd;
    border-radius: 999px;
    background: rgba(250, 250, 248, .94);
    box-shadow: 0 9px 24px rgba(42, 55, 88, .12);
    backdrop-filter: blur(12px);
    cursor: pointer;
  }
  .app-shell .app-streak-trigger svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    opacity: 1;
    visibility: visible;
    transform-origin: 50% 82%;
  }
  .app-shell .app-streak-trigger svg .app-icon-fill {
    fill: currentColor;
    stroke: none;
    opacity: .12;
  }
  .app-shell .app-streak-trigger > span {
    min-width: 1ch;
    font-family: var(--font-display), Manrope, Inter, sans-serif;
    font-size: var(--esp-type-support);
    font-weight: var(--esp-weight-bold);
    font-variant-numeric: tabular-nums;
  }
  .app-shell .app-streak-trigger[aria-expanded="true"] {
    color: #3f601d;
    border-color: #bdd68f;
    background: #f6fbe9;
  }
  .app-shell .app-streak-trigger.is-flaring svg {
    animation: app-streak-flare .36s cubic-bezier(.2, .78, .25, 1);
  }
  .app-shell .app-streak-dock .app-streak-card {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    left: auto;
    width: min(320px, calc(100vw - 24px));
    max-height: min(330px, calc(100vh - 160px));
    padding: 18px;
    overflow-y: auto;
    color: var(--app-ink, #172039);
    border: 1px solid var(--app-line, #dde2ec);
    border-radius: var(--app-radius-panel, 16px);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--app-elevation-overlay, 0 24px 64px rgba(29, 39, 70, .18));
    backdrop-filter: blur(18px);
  }
  .app-shell .app-streak-card-head {
    display: grid;
    margin-bottom: 10px;
    padding-bottom: 12px;
    gap: 3px;
    border-bottom: 1px solid var(--app-line, #dde2ec);
  }
  .app-shell .app-streak-card-head span {
    color: var(--app-success, #5f8d2d);
    font-family: var(--esp-micro, ui-monospace, monospace);
    font-size: var(--esp-type-caption);
    font-weight: var(--esp-weight-bold);
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .app-shell .app-streak-card-head strong {
    color: var(--app-ink, #172039);
    font-size: var(--esp-type-support);
  }
  .app-shell .app-streak-card-content {
    display: grid;
  }
  .app-shell .app-streak-card .app-progresso-item {
    min-height: 46px;
    padding: 10px 2px;
  }
  .app-shell .app-streak-trigger:focus-visible {
    outline: 3px solid var(--accent-ring);
    outline-offset: 3px;
  }
}

@keyframes app-streak-flare {
  0% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 rgba(123, 177, 49, 0)); }
  32% { transform: scale(1.22, 1.3) rotate(-5deg); filter: drop-shadow(0 0 5px rgba(123, 177, 49, .65)); }
  62% { transform: scale(.96, 1.1) rotate(4deg); filter: drop-shadow(0 0 3px rgba(123, 177, 49, .42)); }
  100% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 rgba(123, 177, 49, 0)); }
}

@media (max-width: 360px) {
  .app-shell > .app-main {
    padding-bottom: calc(122px + env(safe-area-inset-bottom));
  }
  .app-shell > .app-streak-dock {
    right: max(8px, env(safe-area-inset-right));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .app-streak-trigger { transition: none; }
  .app-shell .app-streak-trigger.is-flaring svg { animation: none; }
}

/* Ícones da sidebar são sinais de percurso, não botões dentro de botões. */
@media (min-width: 821px) {
  .app-shell .app-nav { gap: 3px; }
  .app-shell .app-nav-item { gap: 10px; border-radius: 8px; }
  .app-shell .app-nav-item svg {
    width: 24px;
    height: 24px;
    padding: 2px;
    color: #748098;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .app-shell .app-nav-item.active svg {
    color: #5266c2;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .app-shell .app-nav-item:hover svg,
  .app-shell .app-nav-item.active:hover svg {
    color: #5266c2;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
}

/* Ícones de estudo: um só traço, sem caixa. O preenchimento parcial funciona
   como marcação da atividade atual; os demais permanecem apenas desenhados. */
.app-shell .app-nav-item::after { content: none; }
.app-shell .app-nav-item svg {
  stroke-width: 1.75;
  overflow: visible;
}
.app-shell .app-nav-item svg .app-icon-fill {
  fill: currentColor;
  stroke: none;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.app-shell .app-nav-item.active {
  background: transparent;
  box-shadow: none;
}
.app-shell .app-nav-item.active svg .app-icon-fill { opacity: .13; }

@media (max-width: 820px) {
  .app-shell .app-bottombar .app-nav-item.active { background: transparent; }
  .app-shell .app-bottombar .app-nav-item.active svg {
    color: #5266c2;
    background: transparent;
    box-shadow: none;
  }
  .app-shell .app-streak-card[hidden] { display: none; }
  .app-shell .app-streak-empty { margin: 6px 0; color: #707c91; font-size: var(--esp-type-caption); line-height: 1.5; }
}
