/* ===========================================================================
   Prisma — design system
   ---------------------------------------------------------------------------
   A metáfora do produto é o prisma: uma luz entra, o espectro sai organizado.
   Daí o índigo profundo como cor de marca e a faixa espectral usada para
   distinguir disciplinas e estados de progresso.

   Toda cor é declarada como token em :root. O tema escuro apenas redefine os
   tokens — nenhum componente conhece cor literal.
   =========================================================================== */

:root {
  /* Marca */
  --brand-50:  #eef0ff;
  --brand-100: #dfe2ff;
  --brand-200: #c3c8ff;
  --brand-300: #a0a5ff;
  --brand-400: #7d7bfa;
  --brand-500: #6357ef;
  --brand-600: #533dd6;
  --brand-700: #4531ab;
  --brand-800: #392c89;
  --brand-900: #262062;

  /* Espectro — disciplinas, gráficos e estados */
  --spectrum-violet: #7c5cff;
  --spectrum-blue:   #3b82f6;
  --spectrum-cyan:   #06b6d4;
  --spectrum-green:  #10b981;
  --spectrum-amber:  #f59e0b;
  --spectrum-orange: #f97316;
  --spectrum-rose:   #f43f5e;

  /* Superfícies e texto (tema claro) */
  --bg:            #f7f7fb;
  --surface:       #ffffff;
  --surface-muted: #f2f2f7;
  --surface-sunken:#ebebf2;
  --border:        #e2e2ec;
  --border-strong: #cdcdda;

  --text:          #16151f;
  --text-muted:    #5c5a6e;
  --text-subtle:   #86849a;
  --text-on-brand: #ffffff;

  --success: #0f9d63;
  --warning: #b4780a;
  --danger:  #d63b4d;
  --info:    #2b6fd6;

  --success-bg: #e6f7f0;
  --warning-bg: #fdf4e3;
  --danger-bg:  #fdeaec;
  --info-bg:    #e8f1fd;

  /* Forma */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 18, 40, .06);
  --shadow:    0 4px 16px rgba(20, 18, 40, .08);
  --shadow-lg: 0 16px 48px rgba(20, 18, 40, .14);

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --content-width: 1140px;
  --transition: 160ms cubic-bezier(.4, 0, .2, 1);

  color-scheme: light;
}

/* Tema escuro — só os tokens mudam. */
:root[data-theme="dark"],
:root:not([data-theme="light"]):not([data-theme="dark"]) {
  /* placeholder para o seletor de sistema abaixo não sobrescrever o claro */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0d0c14;
    --surface:       #16151f;
    --surface-muted: #1e1d29;
    --surface-sunken:#100f18;
    --border:        #2a2837;
    --border-strong: #3b3950;

    --text:          #f2f1f7;
    --text-muted:    #a5a2b8;
    --text-subtle:   #7a7791;

    --success-bg: #0d2b21;
    --warning-bg: #2c2109;
    --danger-bg:  #33131a;
    --info-bg:    #101f36;

    --success: #34d399;
    --warning: #fbbf24;
    --danger:  #fb7185;
    --info:    #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 4px 16px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:            #0d0c14;
  --surface:       #16151f;
  --surface-muted: #1e1d29;
  --surface-sunken:#100f18;
  --border:        #2a2837;
  --border-strong: #3b3950;

  --text:          #f2f1f7;
  --text-muted:    #a5a2b8;
  --text-subtle:   #7a7791;

  --success-bg: #0d2b21;
  --warning-bg: #2c2109;
  --danger-bg:  #33131a;
  --info-bg:    #101f36;

  --success: #34d399;
  --warning: #fbbf24;
  --danger:  #fb7185;
  --info:    #60a5fa;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 4px 16px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { margin: 0 0 var(--space-3); line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 var(--space-4); }

a { color: var(--brand-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-700); text-decoration: underline; }
:root[data-theme="dark"] a { color: var(--brand-300); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--brand-300); } }

img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container--narrow { max-width: 760px; }

.page { flex: 1 0 auto; padding-block: var(--space-6) var(--space-8); }

.page-head {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--space-6);
}
.page-head__title { margin: 0; }
.page-head__subtitle { margin: var(--space-1) 0 0; color: var(--text-muted); }

.stack > * + * { margin-top: var(--space-4); }
.grid { display: grid; gap: var(--space-4); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Marca ────────────────────────────────────────────────────────────────── */

.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__name { font-size: 1.15rem; }

/* ── Navegação ────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex; align-items: center; gap: var(--space-4);
  min-height: 60px;
}
.topbar__nav { display: none; gap: var(--space-1); margin-left: var(--space-4); }
@media (min-width: 860px) { .topbar__nav { display: flex; } }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }

.navlink {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .925rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.navlink:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.navlink--active { background: var(--brand-50); color: var(--brand-700); }
:root[data-theme="dark"] .navlink--active { background: var(--surface-muted); color: var(--brand-300); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .navlink--active { background: var(--surface-muted); color: var(--brand-300); }
}

/* ── Botões ───────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: .6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit; font-size: .95rem; font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--brand-600); color: var(--text-on-brand); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-700); color: var(--text-on-brand); }

.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-muted); color: var(--text); }

.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-muted); color: var(--text); }

.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--danger:hover { background: var(--danger-bg); color: var(--danger); }

.btn--block { width: 100%; }
.btn--sm { padding: .35rem .7rem; font-size: .85rem; }
.btn--lg { padding: .8rem 1.6rem; font-size: 1.05rem; }

.btn-icon {
  width: 38px; height: 38px; padding: 0;
  border-radius: var(--radius);
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--surface-muted); color: var(--text); }

/* ── Cartões ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card__title { margin: 0; font-size: 1.05rem; font-weight: 650; }
.card__hint { margin: calc(var(--space-2) * -1) 0 var(--space-4); color: var(--text-muted); font-size: .9rem; }
.card--flush { padding: 0; overflow: hidden; }

/* ── Formulários ──────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: var(--space-4); }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-size: .9rem; font-weight: 600; color: var(--text); }
.field__label .req { color: var(--danger); margin-left: 2px; }

.field__input {
  width: 100%;
  padding: .65rem .85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit; font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field__input::placeholder { color: var(--text-subtle); }
.field__input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent);
}
.field__input--textarea { resize: vertical; min-height: 92px; }
.field__input--select { appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2386849a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; }

.field--invalid .field__input { border-color: var(--danger); }
.field--invalid .field__input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }

.field__help { font-size: .825rem; color: var(--text-muted); }
.field__help ul { margin: var(--space-1) 0 0; padding-left: 1.1rem; }
.field__errors { margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--danger); font-weight: 500; }

.field--check { flex-direction: row; align-items: flex-start; gap: var(--space-3); }
.field__checkbox { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--brand-600); cursor: pointer; }
.field--check .field__label { font-weight: 500; color: var(--text-muted); cursor: pointer; }

.field__file { font-size: .9rem; color: var(--text-muted); }

.form__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-top: var(--space-2); }
.form__error-summary {
  padding: var(--space-3) var(--space-4);
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius); font-size: .9rem;
}

/* ── Alertas e mensagens ──────────────────────────────────────────────────── */

.messages { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }

.alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .925rem;
}
.alert__icon { flex: none; margin-top: 2px; }
.alert__body { flex: 1; }
.alert--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.alert--warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.alert--error   { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.alert--info,
.alert--debug   { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 28%, transparent); }

/* ── Etiquetas ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: .18rem .6rem;
  border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 600; line-height: 1.5;
  background: var(--surface-muted); color: var(--text-muted);
}
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--brand   { background: var(--brand-50);   color: var(--brand-700); }
:root[data-theme="dark"] .badge--brand { background: var(--surface-muted); color: var(--brand-300); }

/* ── Avatar ───────────────────────────────────────────────────────────────── */

.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-pill);
  object-fit: cover;
  background: var(--brand-600); color: var(--text-on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  border: 1px solid var(--border);
}
.avatar--lg { width: 72px; height: 72px; font-size: 1.4rem; }

/* ── Menu suspenso (sem JS de biblioteca) ─────────────────────────────────── */

.menu { position: relative; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 232px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: 60;
}
.menu__panel[hidden] { display: none; }
.menu__header { padding: var(--space-2) var(--space-3) var(--space-3); border-bottom: 1px solid var(--border); margin-bottom: var(--space-2); }
.menu__name { font-weight: 600; font-size: .925rem; }
.menu__email { font-size: .8rem; color: var(--text-subtle); word-break: break-all; }
.menu__item {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0; background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: .9rem; text-align: left;
  cursor: pointer;
}
.menu__item:hover { background: var(--surface-muted); text-decoration: none; color: var(--text); }
.menu__sep { height: 1px; background: var(--border); margin: var(--space-2) 0; }

/* ── Abas ─────────────────────────────────────────────────────────────────── */

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); margin-bottom: var(--space-5); overflow-x: auto; }
.tabs__link {
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted); font-size: .925rem; font-weight: 550;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs__link:hover { color: var(--text); text-decoration: none; }
.tabs__link--active { color: var(--brand-600); border-bottom-color: var(--brand-600); }
:root[data-theme="dark"] .tabs__link--active { color: var(--brand-300); border-bottom-color: var(--brand-400); }

/* ── Autenticação ─────────────────────────────────────────────────────────── */

.auth {
  flex: 1 0 auto;
  display: grid; place-items: center;
  padding: var(--space-6) var(--space-4) var(--space-8);
}
.auth__card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6);
}
.auth__head { text-align: center; margin-bottom: var(--space-5); }
.auth__title { margin-bottom: var(--space-2); font-size: 1.5rem; }
.auth__subtitle { color: var(--text-muted); margin: 0; font-size: .95rem; }
.auth__footer { margin-top: var(--space-5); text-align: center; font-size: .9rem; color: var(--text-muted); }
.auth__aside { margin-top: var(--space-4); text-align: center; }

/* ── Rodapé ───────────────────────────────────────────────────────────────── */

.footer {
  flex: none;
  border-top: 1px solid var(--border);
  padding-block: var(--space-5);
  color: var(--text-subtle); font-size: .875rem;
}
.footer__inner { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; justify-content: space-between; }

/* ── Landing ──────────────────────────────────────────────────────────────── */

.hero { padding-block: var(--space-8) var(--space-7); text-align: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: .25rem .8rem; margin-bottom: var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--brand-50); color: var(--brand-700);
  font-size: .82rem; font-weight: 600;
}
:root[data-theme="dark"] .hero__eyebrow { background: var(--surface-muted); color: var(--brand-300); }
.hero__title { max-width: 18ch; margin-inline: auto; }
.hero__lead { max-width: 60ch; margin-inline: auto; color: var(--text-muted); font-size: 1.1rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-5); }

.spectrum-bar {
  height: 5px; width: min(420px, 80%);
  margin: var(--space-6) auto 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    var(--spectrum-violet), var(--spectrum-blue), var(--spectrum-cyan),
    var(--spectrum-green), var(--spectrum-amber), var(--spectrum-orange), var(--spectrum-rose));
}

.feature { padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.feature__icon {
  width: 40px; height: 40px; margin-bottom: var(--space-3);
  border-radius: var(--radius); display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
}
:root[data-theme="dark"] .feature__icon { background: var(--surface-muted); color: var(--brand-300); }
.feature__title { font-size: 1rem; margin-bottom: var(--space-2); }
.feature__text { color: var(--text-muted); font-size: .925rem; margin: 0; }

/* ── Painel ───────────────────────────────────────────────────────────────── */

.stat { display: flex; flex-direction: column; gap: var(--space-1); }
.stat__label { font-size: .82rem; color: var(--text-muted); font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: .85rem; color: var(--text-subtle); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist__item {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.checklist__item:last-child { border-bottom: 0; }
.checklist__mark { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--surface-muted); color: var(--text-subtle); font-size: .7rem; font-weight: 700; }
.checklist__mark--done { background: var(--success-bg); color: var(--success); }
.checklist__title { font-weight: 550; font-size: .95rem; }
.checklist__text { color: var(--text-muted); font-size: .875rem; margin: 0; }

.empty-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--text-muted); }
.empty-state__title { color: var(--text); margin-bottom: var(--space-2); }

/* ── Utilidades ───────────────────────────────────────────────────────────── */

.text-muted  { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-sm     { font-size: .875rem; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-5 { margin-bottom: var(--space-5); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.wrap { flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================================
   Etapa 2 — planejamento
   =========================================================================== */

/* ── Tabelas ──────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; }
.table thead th {
  font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-subtle); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td {
  border-top: 1px solid var(--border-strong); font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ── Marcador de disciplina ───────────────────────────────────────────────── */

.dot {
  display: inline-block; width: 10px; height: 10px; flex: none;
  border-radius: var(--radius-pill); margin-right: var(--space-2);
  vertical-align: baseline;
}
.dot--violet { background: var(--spectrum-violet); }
.dot--blue   { background: var(--spectrum-blue); }
.dot--cyan   { background: var(--spectrum-cyan); }
.dot--green  { background: var(--spectrum-green); }
.dot--amber  { background: var(--spectrum-amber); }
.dot--orange { background: var(--spectrum-orange); }
.dot--rose   { background: var(--spectrum-rose); }

/* ── Barras ───────────────────────────────────────────────────────────────── */

.bar {
  height: 8px; width: 100%;
  background: var(--surface-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.bar__fill { height: 100%; border-radius: var(--radius-pill); transition: width var(--transition); }
.bar__fill--violet { background: var(--spectrum-violet); }
.bar__fill--blue   { background: var(--spectrum-blue); }
.bar__fill--cyan   { background: var(--spectrum-cyan); }
.bar__fill--green  { background: var(--spectrum-green); }
.bar__fill--amber  { background: var(--spectrum-amber); }
.bar__fill--orange { background: var(--spectrum-orange); }
.bar__fill--rose   { background: var(--spectrum-rose); }
.bar__fill--brand  { background: var(--brand-500); }

/* Faixa empilhada: como a semana inteira se reparte. */
.split { display: flex; height: 14px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-sunken); }
.split__part { height: 100%; }
.split__legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-3); font-size: .85rem; color: var(--text-muted); }
.split__key { display: inline-flex; align-items: center; gap: var(--space-2); }

/* ── Cartão de planejamento ───────────────────────────────────────────────── */

.plan-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.plan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.plan-card--primary { border-color: var(--brand-400); }
.plan-card--archived { opacity: .68; }
.plan-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.plan-card__title { font-size: 1.05rem; font-weight: 650; margin: 0; }
.plan-card__title a { color: var(--text); }
.plan-card__title a:hover { color: var(--brand-600); text-decoration: none; }
.plan-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: .85rem; color: var(--text-muted); }
.plan-card__foot { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* ── Contagem regressiva ──────────────────────────────────────────────────── */

.countdown { display: flex; align-items: baseline; gap: var(--space-2); }
.countdown__number { font-size: 2.2rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.countdown__unit { color: var(--text-muted); font-size: .9rem; }
.countdown--soon .countdown__number { color: var(--warning); }
.countdown--overdue .countdown__number { color: var(--danger); }

/* ── Linhas de formset ────────────────────────────────────────────────────── */

.formset { display: flex; flex-direction: column; gap: var(--space-3); }

.formset__row {
  display: grid; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.formset__row--deleted { opacity: .45; }
.formset__grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .formset__grid--subject { grid-template-columns: 2fr 1fr 1fr 1.4fr; align-items: end; }
  .formset__grid--window  { grid-template-columns: 1.4fr 1fr 1fr 1.4fr; align-items: end; }
  .formset__grid--blocked { grid-template-columns: 1fr 1fr 1fr 1.4fr; align-items: end; }
  .formset__grid--limits  { grid-template-columns: repeat(4, 1fr); align-items: end; }
}
.formset__row-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.formset__empty { display: none; }

.field--compact .field__label { font-size: .8rem; color: var(--text-muted); }

/* Controle deslizante de domínio */
input[type="range"].field__input {
  padding: 0; height: 34px; background: transparent; border: 0;
  accent-color: var(--brand-500); cursor: pointer;
}
input[type="range"].field__input:focus { box-shadow: none; }
.range-value { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; min-width: 3.2em; display: inline-block; }

/* ── Passos de configuração ───────────────────────────────────────────────── */

.steps { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.step {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text-muted);
  font-size: .875rem; font-weight: 550;
}
.step:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.step--active { background: var(--brand-600); border-color: var(--brand-600); color: var(--text-on-brand); }
.step--active:hover { color: var(--text-on-brand); }
.step--done { border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success); }
.step__index { font-variant-numeric: tabular-nums; opacity: .75; }

/* ── Grade semanal ────────────────────────────────────────────────────────── */

.week { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.week__day {
  padding: var(--space-3);
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.week__name { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-subtle); margin-bottom: var(--space-2); }
.week__slot { font-size: .85rem; font-variant-numeric: tabular-nums; padding: 2px 0; }
.week__total { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }
.week__day--empty { opacity: .5; }

/* ── Fórmula ──────────────────────────────────────────────────────────────── */

.formula {
  padding: var(--space-4);
  background: var(--surface-sunken);
  border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .9rem;
  text-align: center; color: var(--text-muted);
  overflow-x: auto;
}
.formula strong { color: var(--text); font-weight: 600; }

/* ===========================================================================
   Etapa 3 — execução
   =========================================================================== */

/* ── Cronômetro ───────────────────────────────────────────────────────────── */

.timer { text-align: center; padding: var(--space-6) var(--space-4); }

.timer__clock {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 2rem + 8vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1;
  font-feature-settings: "tnum";
}
.timer__clock--paused { color: var(--text-subtle); }

.timer__label { color: var(--text-muted); margin-top: var(--space-2); font-size: .95rem; }
.timer__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-5); }

.timer__ring { display: grid; place-items: center; margin-inline: auto; position: relative; width: 240px; height: 240px; }
.timer__ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer__ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.timer__ring .ring-track { stroke: var(--surface-sunken); }
.timer__ring .ring-fill  { stroke: var(--brand-500); transition: stroke-dashoffset 400ms linear; }
.timer__ring--paused .ring-fill { stroke: var(--text-subtle); }
.timer__ring-inner { position: relative; z-index: 1; text-align: center; }

.timer__status {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: .25rem .75rem; border-radius: var(--radius-pill);
  font-size: .82rem; font-weight: 600;
  background: var(--success-bg); color: var(--success);
}
.timer__status--paused { background: var(--warning-bg); color: var(--warning); }
.timer__status--offline { background: var(--danger-bg); color: var(--danger); }
.timer__pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Bloco "estudar agora" ────────────────────────────────────────────────── */

.now-card {
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-500);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.now-card__eyebrow { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); }
.now-card__subject { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin: var(--space-2) 0; }
.now-card__meta { display: flex; flex-wrap: wrap; gap: var(--space-4); color: var(--text-muted); font-size: .925rem; margin-bottom: var(--space-5); }
.now-card--violet { border-left-color: var(--spectrum-violet); }
.now-card--blue   { border-left-color: var(--spectrum-blue); }
.now-card--cyan   { border-left-color: var(--spectrum-cyan); }
.now-card--green  { border-left-color: var(--spectrum-green); }
.now-card--amber  { border-left-color: var(--spectrum-amber); }
.now-card--orange { border-left-color: var(--spectrum-orange); }
.now-card--rose   { border-left-color: var(--spectrum-rose); }
.now-card--brand  { border-left-color: var(--brand-500); }

/* ── Lista do ciclo ───────────────────────────────────────────────────────── */

.cycle-list { list-style: none; margin: 0; padding: 0; }
.cycle-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.cycle-item:last-child { border-bottom: 0; }
.cycle-item--current { background: var(--brand-50); }
:root[data-theme="dark"] .cycle-item--current { background: var(--surface-muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cycle-item--current { background: var(--surface-muted); }
}
.cycle-item--done { opacity: .5; }
.cycle-item__index {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken); color: var(--text-subtle);
  font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cycle-item--current .cycle-item__index { background: var(--brand-600); color: var(--text-on-brand); }
.cycle-item--done .cycle-item__index { background: var(--success-bg); color: var(--success); }
.cycle-item__body { flex: 1; min-width: 0; }
.cycle-item__title { font-weight: 550; font-size: .95rem; }
.cycle-item__meta { font-size: .82rem; color: var(--text-muted); }
.cycle-item__time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* ── Agenda do dia ────────────────────────────────────────────────────────── */

.agenda { list-style: none; margin: 0; padding: 0; }
.agenda__row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.agenda__row:last-child { border-bottom: 0; }
.agenda__time { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--text-muted); white-space: nowrap; min-width: 6.5em; }
.agenda__title { font-weight: 550; font-size: .95rem; }
.agenda__type { font-size: .82rem; color: var(--text-muted); }

/* ── Histórico ────────────────────────────────────────────────────────────── */

.filters { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 760px) { .filters { grid-template-columns: repeat(4, 1fr); align-items: end; } }

.session-row__type { font-size: .82rem; color: var(--text-muted); }

/* ===========================================================================
   Etapa 4 — desempenho
   =========================================================================== */

/* ── Gráfico SVG ──────────────────────────────────────────────────────────── */

.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart__grid-line { stroke: var(--border); stroke-width: 1; }
.chart__grid-label { fill: var(--text-subtle); font-size: 11px; font-family: var(--font-sans); }
.chart__axis-label { fill: var(--text-subtle); font-size: 11px; font-family: var(--font-sans); text-anchor: middle; }

.chart__bar { fill: var(--brand-400); transition: fill var(--transition); }
.chart__bar--highlight { fill: var(--brand-600); }
.chart__bar-group:hover .chart__bar { fill: var(--brand-700); }
:root[data-theme="dark"] .chart__bar { fill: var(--brand-500); }
:root[data-theme="dark"] .chart__bar--highlight { fill: var(--brand-300); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chart__bar { fill: var(--brand-500); }
  :root:not([data-theme="light"]) .chart__bar--highlight { fill: var(--brand-300); }
}

.chart__goal { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart__goal-label { fill: var(--warning); font-size: 11px; font-family: var(--font-sans); }

.chart__empty {
  display: grid; place-items: center;
  min-height: 180px; color: var(--text-subtle); font-size: .925rem; text-align: center;
}

/* ── Comparação planejado × realizado ─────────────────────────────────────── */

.compare { display: flex; flex-direction: column; gap: var(--space-4); }
.compare__row { display: grid; gap: var(--space-2); }
.compare__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); font-size: .9rem; }
.compare__name { font-weight: 550; }
.compare__numbers { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare__track {
  position: relative; height: 10px;
  background: var(--surface-sunken); border-radius: var(--radius-pill); overflow: hidden;
}
.compare__done { height: 100%; border-radius: var(--radius-pill); }
.compare__planned {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--text-subtle); border-radius: 1px;
}

/* ── Alertas do painel ────────────────────────────────────────────────────── */

.insight {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--border-strong);
  background: var(--surface-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.insight + .insight { margin-top: var(--space-2); }
.insight--warning { border-left-color: var(--warning); }
.insight--danger  { border-left-color: var(--danger); }
.insight--success { border-left-color: var(--success); }
.insight--info    { border-left-color: var(--info); }
.insight__text { font-size: .925rem; }
.insight__hint { font-size: .85rem; color: var(--text-muted); margin: 2px 0 0; }

/* ── Árvore do edital ─────────────────────────────────────────────────────── */

.tree { list-style: none; margin: 0; padding: 0; }
.tree__row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.tree__row:last-child { border-bottom: 0; }
.tree__row:hover { background: var(--surface-muted); }
.tree__name { flex: 1; min-width: 0; font-size: .925rem; }
.tree__name a { color: var(--text); }
.tree__depth-0 .tree__name { font-weight: 650; }
.tree__depth-1 { padding-left: calc(var(--space-4) + 20px); }
.tree__depth-2 { padding-left: calc(var(--space-4) + 40px); }
.tree__depth-3 { padding-left: calc(var(--space-4) + 60px); }
.tree__depth-4 { padding-left: calc(var(--space-4) + 80px); }
.tree__depth-5 { padding-left: calc(var(--space-4) + 100px); }
.tree__status { flex: none; }
.tree__status select { font-size: .82rem; padding: .25rem .5rem; min-width: 9.5rem; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.status-dot--studying { background: var(--spectrum-blue); }
.status-dot--reviewed { background: var(--spectrum-cyan); }
.status-dot--mastered { background: var(--success); }
.status-dot--ignored, .status-dot--out_of_scope { background: var(--text-subtle); opacity: .5; }

/* ── Prévia da importação ─────────────────────────────────────────────────── */

.preview-tree { font-family: var(--font-mono); font-size: .85rem; line-height: 1.9; }
.preview-tree__item { color: var(--text-muted); }
.preview-tree__item--root { color: var(--text); font-weight: 600; }

/* ===========================================================================
   Etapa 5 — revisões
   =========================================================================== */

.review-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.review-row:last-child { border-bottom: 0; }
.review-row:hover { background: var(--surface-muted); }
.review-row__body { flex: 1; min-width: 0; }
.review-row__topic { font-weight: 600; font-size: .95rem; }
.review-row__meta { font-size: .82rem; color: var(--text-muted); }
.review-row__actions { display: flex; gap: var(--space-2); flex: none; flex-wrap: wrap; }
.review-row--overdue { border-left: 3px solid var(--warning); }
.review-row--locked { border-left: 3px solid var(--info); }

.step-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px; flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken); color: var(--text-subtle);
  font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Escala de dificuldade: quatro botões grandes, resposta em um toque. */
.difficulty { display: grid; gap: var(--space-2); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .difficulty { grid-template-columns: repeat(4, 1fr); } }
.difficulty label {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; text-align: center;
  font-size: .9rem; font-weight: 550;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.difficulty label:hover { background: var(--surface-muted); }
.difficulty input { position: absolute; opacity: 0; pointer-events: none; }
.difficulty input:checked + span,
.difficulty label:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
:root[data-theme="dark"] .difficulty label:has(input:checked) { background: var(--surface-muted); color: var(--brand-300); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .difficulty label:has(input:checked) { background: var(--surface-muted); color: var(--brand-300); }
}
.difficulty__hint { font-size: .78rem; color: var(--text-subtle); font-weight: 400; }
.difficulty ul { list-style: none; margin: 0; padding: 0; display: contents; }
.difficulty li { display: contents; }

/* ===========================================================================
   Etapa 6 — assinaturas
   =========================================================================== */

.pricing { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 820px) { .pricing { grid-template-columns: repeat(2, 1fr); } }

.price-card {
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.price-card--featured { border-color: var(--brand-500); box-shadow: var(--shadow); }
.price-card--current { border-color: var(--success); }
.price-card__ribbon {
  position: absolute; top: -11px; left: var(--space-6);
  padding: .18rem .7rem; border-radius: var(--radius-pill);
  background: var(--brand-600); color: var(--text-on-brand);
  font-size: .74rem; font-weight: 700; letter-spacing: .02em;
}
.price-card--current .price-card__ribbon { background: var(--success); }
.price-card__name { font-size: 1.15rem; font-weight: 650; margin: 0; }
.price-card__tagline { color: var(--text-muted); font-size: .9rem; margin: 0; }
.price-card__amount { display: flex; align-items: baseline; gap: var(--space-2); }
.price-card__value { font-size: 2.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.price-card__unit { color: var(--text-muted); font-size: .95rem; }
.price-card__note { font-size: .85rem; color: var(--text-subtle); margin: 0; }
.price-card__savings {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: .2rem .7rem; border-radius: var(--radius-pill);
  background: var(--success-bg); color: var(--success);
  font-size: .8rem; font-weight: 650;
}
.price-card__features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.price-card__feature { display: flex; gap: var(--space-2); align-items: flex-start; font-size: .925rem; }
.price-card__check { flex: none; color: var(--success); margin-top: 2px; }
.price-card__cross { flex: none; color: var(--text-subtle); margin-top: 2px; }
.price-card__feature--off { color: var(--text-subtle); }
.price-card__foot { margin-top: auto; }

/* Faixa de aviso no topo das páginas autenticadas. */
.notice-bar {
  padding: var(--space-3) var(--space-4);
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--info-bg); color: var(--info);
}
.notice-bar--warning { background: var(--warning-bg); color: var(--warning); }
.notice-bar--danger { background: var(--danger-bg); color: var(--danger); }
.notice-bar__inner { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.notice-bar a { color: inherit; text-decoration: underline; font-weight: 600; }

/* Documentos legais. */
.legal { max-width: 760px; }
.legal h2 { margin-top: var(--space-6); font-size: 1.15rem; }
.legal h3 { margin-top: var(--space-5); font-size: 1rem; }
.legal p, .legal li { color: var(--text-muted); line-height: 1.75; }
.legal ul { padding-left: 1.25rem; }
.legal li { margin-bottom: var(--space-2); }
.legal__meta {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-muted); border-radius: var(--radius);
  font-size: .875rem; color: var(--text-muted); margin-bottom: var(--space-5);
}
.legal strong { color: var(--text); }
