/* Área do aluno no estilo Apple: barra lateral em grupos, barra de abas no celular, folha "Mais",
   links sem sublinhado e o "Meu dia" com o que fazer hoje primeiro. Carregado depois de apple.css. */

/* ---- Barra lateral (computador): grupos como no Finder e ícones de linha ---- */
.navhead {
  margin: 18px 0 4px;
  padding: 0 12px;
  font: 600 11.5px/1.2 var(--body);
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
}
.navhead:first-child {
  margin-top: 4px;
}
nav a .navicon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  flex: none;
}
nav a .navicon svg {
  width: 20px;
  height: 20px;
}
nav a {
  display: flex;
  align-items: center;
}
nav a.active .navicon {
  color: var(--btn);
}

/* ---- Links: cor de destaque, sem sublinhado, como nos apps da Apple ---- */
a.textbtn,
button.textbtn {
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--green);
}
a.textbtn:hover,
button.textbtn:hover {
  text-decoration: none;
  opacity: 0.75;
}
/* Cronograma: as matérias de cada etapa viram cápsulas. */
.week > div:last-child > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0;
  margin-top: 10px;
}
.week > div:last-child > div a.textbtn {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--green);
}
.week .label {
  font-size: 11px;
}
.week.current {
  border: 0;
  box-shadow: inset 0 0 0 2px var(--btn), var(--shadow);
}

/* ---- Meu dia ---- */
.revbox {
  border: 0;
  background: var(--accent-soft);
  border-radius: 14px;
}
.task {
  border-radius: 12px;
}

/* ---- Celular ---- */
#tabbarslot .abasbar,
#tabbarslot .maisfundo,
#tabbarslot .maisfolha {
  display: none;
}
@media (max-width: 650px) {
  /* Topo enxuto: marca e botões; as seções vão para a barra de abas embaixo. */
  body.comabas aside nav#nav {
    display: none;
  }
  body.comabas aside {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  body.comabas main {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  body.comabas #badge {
    display: none;
  }
  #tabbarslot .abasbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 14;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--paper) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    #tabbarslot .abasbar {
      background: var(--paper);
    }
  }
  .abasbar a,
  .abasbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font: 600 10.5px/1.1 var(--body);
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
  }
  .abasbar .tbi svg {
    width: 25px;
    height: 25px;
    display: block;
  }
  .abasbar .on {
    color: var(--btn);
  }
  .abasbar .on .tbi svg {
    stroke-width: 2.2;
  }
  .abasbar a:active,
  .abasbar button:active {
    transform: scale(0.92);
  }
  /* A IA e as barras fixas das questões ficam acima das abas. */
  body.comabas #tutorfab {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }
  body.comabas .qnav,
  body.comabas .startbar {
    bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  }
  body.maisaberto #tutorfab {
    display: none;
  }

  /* Folha "Mais", como as folhas do iOS. */
  #tabbarslot .maisfundo {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.4);
    animation: ap-tela 0.25s ease both;
  }
  #tabbarslot .maisfolha {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 21;
    max-height: 85vh;
    overflow-y: auto;
    padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--paper);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    animation: k-folha 0.45s var(--ap-expo, ease) both;
  }
  .maisfolha .grabber {
    display: block;
    width: 36px;
    height: 5px;
    margin: 0 auto 8px;
    border-radius: 3px;
    background: var(--line-strong);
  }
  .maistopo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 4px 12px;
  }
  .maistopo h2 {
    margin: 0;
    font-size: 22px;
  }
  .maisok {
    background: none;
    color: var(--green);
    font-weight: 600;
    font-size: 16px;
    padding: 8px;
    min-height: 44px;
  }
  .maisgrupo {
    margin: 22px 16px 6px;
    font-size: 13px;
    color: var(--muted);
  }
  .maislista {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
  }
  .maislista li + li {
    border-top: 1px solid var(--line);
    margin-left: 56px;
  }
  .maislista li + li > * {
    margin-left: -56px;
  }
  .maislista a,
  .maislista button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: calc(100% + 0px);
    min-height: 52px;
    padding: 0 16px;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--ink);
    font: 500 16px var(--body);
    text-align: left;
    text-decoration: none;
  }
  .maislista li + li > a,
  .maislista li + li > button {
    width: calc(100% + 56px);
  }
  .maislista .mfi {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--btn);
    color: #fff;
    flex: none;
  }
  .maislista .mfi svg {
    width: 19px;
    height: 19px;
  }
  .maislista .mft {
    flex: 1;
  }
  .maislista .mfc {
    color: var(--faint);
    font-size: 22px;
  }
  .maislista .on {
    color: var(--green);
    font-weight: 600;
  }
  .maislista .perigo {
    color: var(--bad);
  }
  .maislista .perigo .mfi {
    background: var(--bad-fill);
  }

  /* Meu dia no celular: primeiro o que fazer hoje, depois os números, o desempenho e o ritmo. */
  body[data-tela='inicio'] #app {
    display: flex;
    flex-direction: column;
  }
  body[data-tela='inicio'] #app {
    gap: 14px;
  }
  body[data-tela='inicio'] #app > *,
  body[data-tela='inicio'] .dashgrid > * {
    margin-top: 0;
    margin-bottom: 0;
  }
  body[data-tela='inicio'] .dashgrid {
    display: contents;
  }
  body[data-tela='inicio'] .today { order: 0; }
  body[data-tela='inicio'] .dashgrid > :nth-child(2) { order: 1; }
  body[data-tela='inicio'] .kpis { order: 2; }
  body[data-tela='inicio'] .dashgrid > :nth-child(1) { order: 3; }
  body[data-tela='inicio'] #app > :nth-child(n + 4) { order: 4; }
  /* A contagem regressiva vira uma linha compacta em vez dos anéis que cobriam o texto. */
  .today {
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    gap: 14px;
  }
  .today .countdown {
    position: static;
    width: auto;
    height: auto;
    display: inline-flex;
    align-self: flex-start;
    margin: 0;
    padding: 0;
  }
  .today .countdown svg {
    display: none;
  }
  .today .countdown .cdnum {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--pill);
    background: var(--accent-soft);
    transform: none;
    inset: auto;
  }
  .today .countdown .cdnum strong {
    font-size: 22px;
    color: var(--green);
    line-height: 1;
  }
  .today .countdown .cdnum span,
  .today .countdown .cdnum small {
    font-size: 13px;
    margin: 0;
    color: var(--ink);
  }
  .today .countdown .cdnum small {
    color: var(--muted);
  }
}

@keyframes k-folha {
  from {
    transform: translateY(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes k-folha {
    from {
      opacity: 0;
    }
  }
}
@media (max-width: 650px) {
  .today .label {
    padding-right: 0;
  }
}
@media (max-width: 650px) {
  /* Título do cartão e etiqueta: o título ocupa a linha, a etiqueta vai embaixo quando não cabe. */
  #app .card .row {
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: baseline;
  }
  #app .card .row h2 {
    font-size: 20px;
    flex: 1 1 auto;
  }
}
@media (max-width: 650px) {
  /* Com a barra "Começar" ou a navegação das questões na tela, o botão da IA sobe para não cobrir os botões. */
  body.comabas:has(.startbar) #tutorfab,
  body.comabas:has(.qnav) #tutorfab {
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }
}
@media (min-width: 651px) {
  nav#nav a {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .navhead {
    margin-top: 14px;
  }
}
