/* ============ APP ============ */
.app {
  min-height: 100vh;
}
.sidebar {
  display: none;
}
@media (min-width: 768px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 248px;
    padding: 18px;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    z-index: 40;
    transition:
      width 0.26s var(--ease-out),
      box-shadow 0.26s var(--ease-out);
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Recolhido é o mesmo menu, só mais estreito: nada muda de lugar. Os ícones ficam na mesma posição
     (centro a 39px da borda nos dois estados) e os nomes ficam cortados e transparentes; ao abrir
     (mouse ou botão) só a barra cresce e os nomes aparecem com um fade. */
  .sidebar.mini {
    width: 78px;
  }
  .sidebar .txt,
  .sidebar .side-group-t,
  .sidebar .side-foot .note,
  .sidebar .side-plan,
  .sidebar .nav-count,
  .sidebar .nav-lock,
  .sidebar .side-toggle {
    transition: opacity 0.2s var(--ease-out) 0.08s;
  }
  .sidebar.mini .txt,
  .sidebar.mini .side-group-t,
  .sidebar.mini .side-foot .note,
  .sidebar.mini .side-plan,
  .sidebar.mini .nav-count,
  .sidebar.mini .nav-lock,
  .sidebar.mini .side-toggle {
    opacity: 0;
    transition-duration: 0.1s;
    transition-delay: 0s;
  }
  .sidebar.mini .side-plan,
  .sidebar.mini .side-toggle {
    pointer-events: none;
  }
  /* Os textos do rodapé têm a largura da barra aberta: recolhida, eles só ficam cortados, sem
     quebrar em mais linhas (senão o rodapé crescia e o avatar descia) */
  .sidebar .side-foot .note,
  .sidebar .side-plan {
    width: 212px;
  }
  /* No lugar do título do grupo, um traço curto alinhado com os ícones */
  .side-group {
    position: relative;
  }
  .sidebar .side-group::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 6px;
    width: 14px;
    height: 1px;
    background: var(--color-border);
    opacity: 0;
    transition: opacity 0.15s;
  }
  .sidebar.mini .side-group::before {
    opacity: 1;
  }
  /* Menu recolhido aberto pelo mouse: passa por cima do conteúdo, com sombra (js/app/events.js) */
  .sidebar.peek {
    box-shadow: var(--shadow-lg);
  }
  /* Com o menu recolhido, o menu do perfil abre ao lado da barra (a barra corta o que passa da largura) */
  .sidebar.mini .me-menu {
    position: fixed;
    left: 86px;
    right: auto;
    bottom: 16px;
    width: 240px;
  }
  .main {
    margin-left: 248px;
    transition: margin 0.26s var(--ease-out);
  }
  .app.collapsed .main {
    margin-left: 78px;
  }
}
[data-collapse] svg {
  transition: transform 0.2s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar *,
  .sidebar .side-group::before,
  .main {
    transition-duration: 0s !important;
  }
  .sidebar:not(.mini) .nav-item:hover .txt,
  .sheet-list .nav-item:hover .txt {
    transform: none;
  }
}
.app.collapsed [data-collapse] svg {
  transform: scaleX(-1);
}
.side-logo {
  padding: 2px 0 22px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.side-toggle {
  width: 34px;
  height: 34px;
  color: var(--color-text-muted);
}
/* Menu em grupos (NAV_GROUPS em js/ui/shell.js) com o título do grupo em versalete */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.side-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* os nomes (sem quebra) não alargam os itens */
  gap: 2px;
}
.side-group-t {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.nav-item {
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--color-text-muted);
  background: none;
  border: 0;
  font: 500 14.5px var(--font-sans);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition:
    background 0.15s,
    color 0.15s;
  position: relative;
}
.nav-item:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}
/* Ao passar o mouse, o nome do item anda um pouco para a direita */
.sidebar:not(.mini) .nav-item .txt,
.sheet-list .nav-item .txt {
  transition: transform 0.15s var(--ease-out);
}
.sidebar:not(.mini) .nav-item:hover .txt,
.sheet-list .nav-item:hover .txt {
  transform: translateX(4px);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.nav-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nav-item[aria-current='page'] {
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-weight: 600;
}
.nav-item .live {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-live);
  box-shadow: 0 0 0 3px var(--tone-blue-bg);
}
.side-foot {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.side-foot .note {
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 0 12px;
  line-height: 1.45;
}
/* Situação do plano: teste do Pro com a barra dos dias que faltam */
.side-plan {
  display: grid;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--color-text-muted);
  cursor: pointer;
}
.side-plan b {
  font-weight: 600;
  color: var(--color-text);
}
.side-plan svg {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  vertical-align: -2px;
  color: var(--color-accent);
}
.side-plan .bar {
  height: 4px;
}
.side-plan:hover b {
  color: var(--color-accent);
}
/* O aluno: inicial, nome, objetivo e os atalhos de Planos, Configurações e Sair */
.side-me {
  position: relative;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.me-trigger {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px; /* mesma altura com e sem o nome, para o avatar não mexer ao recolher */
  padding: 8px 8px 8px 5px; /* avatar centrado no mesmo eixo dos ícones (39px) */
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.me-trigger:hover,
.me-trigger[aria-expanded='true'] {
  background: var(--color-surface-sunken);
}
.me-trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.me-av {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-weight: 600;
  font-size: 13px;
}
.me-txt {
  flex: 1;
  min-width: 0;
  display: grid;
  font-size: 14px;
  line-height: 1.3;
}
.me-txt b,
.me-txt small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-txt small {
  font-size: 12px;
  color: var(--color-text-muted);
}
.me-chev {
  display: grid;
  color: var(--color-text-muted);
}
.me-chev svg {
  width: 16px;
  height: 16px;
}
/* O menu do perfil abre para cima, sobre o rodapé */
.me-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 50;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.me-menu[hidden] {
  display: none;
}
.me-menu hr {
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid var(--color-border);
}
.me-item {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}
.me-item > svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--color-text-muted);
}
.me-item:hover,
.me-item:focus-visible {
  background: var(--color-surface-sunken);
}
.me-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}
.me-menu .txt {
  display: inline !important;
}
.theme-item .txt {
  flex: 1;
}
.me-item .txt {
  white-space: nowrap;
}
/* Interruptor de tema: trilho com sol e lua e uma bolinha que desliza até o tema ativo */
.theme-sw {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 52px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
}
.theme-item .theme-sw svg {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  margin: 0 1px;
  color: var(--color-text-muted);
  transition: color 0.3s var(--ease-out);
}
.theme-sw .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
  transition: transform 0.3s var(--ease-out);
}
.theme-item[aria-checked='false'] .theme-sw svg:first-of-type,
.theme-item[aria-checked='true'] .theme-sw svg:last-of-type {
  color: var(--color-on-ink);
}
.theme-item[aria-checked='true'] .theme-sw .knob {
  transform: translateX(24px);
}
@media (prefers-reduced-motion: reduce) {
  .theme-item .theme-sw svg,
  .theme-sw .knob {
    transition: none;
  }
}
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid transparent;
}
@media (min-width: 768px) {
  .topbar {
    padding: 16px 32px;
  }
}
.topbar .grow {
  flex: 1;
  min-width: 0;
}
.search {
  position: relative;
  max-width: 380px;
  display: none;
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  width: 18px;
  height: 18px;
}
.search .input {
  padding-left: 42px;
  min-height: 42px;
  font-size: 14.5px;
  border-radius: 999px;
  background: var(--color-surface);
}
/* Dados de exemplo, no topo (no celular, .example-banner no começo da tela) */
.example-chip {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px dashed var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.example-chip button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}
@media (min-width: 900px) {
  .example-chip {
    display: inline-flex;
  }
}
@media (min-width: 1200px) {
  .search {
    display: block;
  }
}
.mobile-logo {
  display: flex;
}
@media (min-width: 768px) {
  .mobile-logo {
    display: none;
  }
}
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--tone-blue-bg);
  color: var(--tone-blue-fg);
  border: 0;
  font: 600 14px var(--font-sans);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.timer-pill .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
.content {
  padding: 8px 16px calc(100px + env(safe-area-inset-bottom, 0px));
  max-width: 1440px;
  container-type: inline-size;
  container-name: content;
}
@media (min-width: 768px) {
  .content {
    padding: 8px 32px 48px;
  }
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
/* Títulos das telas em serifa, como na landing */
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .page-head h1 {
    font-size: 42px;
  }
}
.page-head p {
  color: var(--color-text-muted);
  margin-top: 8px;
  font-size: 16px;
}
/* Celular: barra de abas flutuante em pílula, com a aba atual em tinta */
.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 5px;
}
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 50px;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--color-text-muted);
  font: 600 11px var(--font-sans);
  cursor: pointer;
  border-radius: 999px;
}
.bottom-nav button svg {
  width: 19px;
  height: 19px;
}
.bottom-nav button[aria-current='page'] {
  color: var(--color-on-ink);
  background: var(--color-ink);
}
.sheet-list {
  display: grid;
  gap: 2px;
}
.sheet-list .side-group-t {
  margin-top: 14px;
}
.sheet-list .side-group-t:first-child {
  margin-top: 0;
}
/* Enquanto a barra cresce, os nomes não quebram linha */
.side-logo .txt,
.sidebar .nav-item .txt,
.sidebar .side-group-t,
.me-txt {
  white-space: nowrap;
}
/* Foto de perfil (js/features/profile-photo.js): a foto ocupa o círculo do avatar */
.me-av.has-photo {
  overflow: hidden;
  background: var(--color-surface-sunken);
}
.me-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.me-av.lg {
  width: 72px;
  height: 72px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
}
.photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
/* Ajuste da foto: prévia em círculo, arrastável, com o zoom embaixo */
.photo-crop {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.photo-stage {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: var(--color-surface-sunken);
  box-shadow: 0 0 0 1px var(--color-border);
  cursor: grab;
  touch-action: none;
}
.photo-stage:active {
  cursor: grabbing;
}
.photo-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 260px);
  color: var(--color-text-muted);
}
.photo-zoom svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.photo-zoom input {
  flex: 1;
  accent-color: var(--color-ink);
}
/* Celular: quem está usando, no topo do menu "Mais" */
.sheet-me {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
}
.sheet-me .me-av {
  width: 40px;
  height: 40px;
  font-size: 15px;
}
.sheet-me .me-txt b {
  font-size: 15px;
}
.sheet-me:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============ MOVIMENTO ============
   Troca de tela (animateView em js/ui/shell.js): os blocos sobem 12px e aparecem, um depois do outro.
   Barras de progresso crescem e o anel da semana se desenha. Tudo desligado com movimento reduzido. */
.view-enter {
  animation: view-in 0.46s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.entering .bar > span {
  transform-origin: left;
  animation: bar-grow 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both;
}
@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
}
.entering .wk-ring .v {
  animation: ring-draw 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both;
}
@keyframes ring-draw {
  from {
    stroke-dashoffset: var(--c);
  }
}
/* Menu do perfil: abre a partir do botão (escala e sobe), os itens entram em sequência */
.me-menu:not([hidden]) {
  transform-origin: 50% 100%;
  animation: menu-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sidebar.mini .me-menu:not([hidden]) {
  transform-origin: 0 100%;
}
.me-menu:not([hidden]) > * {
  animation: menu-item-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.me-menu > :nth-child(2) {
  animation-delay: 30ms;
}
.me-menu > :nth-child(3) {
  animation-delay: 50ms;
}
.me-menu > :nth-child(4) {
  animation-delay: 70ms;
}
.me-menu.closing {
  animation: menu-out 0.13s ease-in forwards;
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}
@keyframes menu-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
}
@keyframes menu-item-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .view-enter,
  .entering .bar > span,
  .entering .wk-ring .v,
  .me-menu:not([hidden]),
  .me-menu:not([hidden]) > *,
  .me-menu.closing {
    animation: none;
  }
}
/* Menu lateral: logo completa com o símbolo no mesmo eixo dos ícones (39px da borda). Com 22px de
   altura o símbolo tem ~28px e seu centro fica a 13,8px do início da logo; o nome (.txt) some no recolhido. */
.side-logo .logo-full {
  height: 22px;
}
