/* =========================================================================
   App Faculdade — folha de estilo
   Construida sobre o design system "v0 by Vercel" (DESIGN.md / variables.css).
   Este arquivo NAO redefine os tokens: ele mapeia os tokens do sistema para
   os papeis da interface e monta os componentes.
   ========================================================================= */

/* ---------------------------------------------------------- camada semantica */
:root {
  /* Papeis de cor (tema claro = o tema documentado no design system) */
  --bg: var(--color-canvas);
  --surface: var(--color-paper-white);
  --surface-2: var(--color-canvas);
  --border: var(--color-line);
  --hairline: rgba(0, 0, 0, .08);
  --text: var(--color-ink);
  --muted: var(--color-subtext);
  --icon: var(--color-icon);

  /* Acao primaria: Ink solido, nunca cor saturada */
  --cta-bg: var(--color-ink);
  --cta-text: var(--color-paper-white);
  --selected: rgba(0, 0, 0, .05);
  --focus-ring: rgba(0, 0, 0, .12);

  /* Unica cor semantica preservada: prazo vencido/urgente (ver DESIGN-NOTES) */
  --alert: #b91c1c;
  --alert-soft: rgba(185, 28, 28, .08);

  /* Fontes: o nome publicado no Google Fonts vem antes do stack dos tokens */
  --ui-font: 'Geist', var(--font-geistsans);
  --mono-font: 'Geist Mono', var(--font-geistmono);

  /* -------- Escala de tamanhos fixos (simetria da ferramenta) -------- */
  --card-h: 196px;   /* cartao de materia            */
  --tile-h: 96px;    /* tile de estatistica          */
  --row-h: 104px;    /* linha de tarefa              */
  --day-h: 288px;    /* coluna de dia na agenda      */
  --class-h: 68px;   /* bloco de aula                */
  --note-h: 196px;   /* cartao de resumo (fechado)   */
  --tr-h: 60px;      /* linha de tabela              */
  --empty-h: 220px;  /* estado vazio                 */
  --modal-w: 720px;
  --modal-h: 640px;
  --control-h: 40px;
  --control-sm-h: 32px;
  --filter-w: 196px;
  --topbar-h: 64px;
  --sidebar-w: 232px;

  /* Elevacao e brilho do hover */
  --shadow-lift: 0 18px 32px -16px rgba(0, 0, 0, .40);
  --glow-strength: 30%;
}

/* Tema escuro: mesma logica acromatica, papeis invertidos.
   O design system documenta apenas o tema claro; estes valores sao a
   contraparte escura dos mesmos tokens, sem introduzir cor saturada. */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #171717;
  --border: #262626;
  --hairline: rgba(255, 255, 255, .10);
  --text: #fafafa;
  --muted: #a1a1a1;
  --icon: #7d7d7d;

  --cta-bg: var(--color-paper-white);
  --cta-text: var(--color-ink);
  --selected: rgba(255, 255, 255, .07);
  --focus-ring: rgba(255, 255, 255, .18);

  --alert: #f87171;
  --alert-soft: rgba(248, 113, 113, .12);

  --shadow-subtle: rgba(255, 255, 255, .08) 0 0 0 1px, rgba(0, 0, 0, .40) 0 2px 1px 0;
  --shadow-subtle-2: rgba(255, 255, 255, .08) 0 0 0 1px;
  --shadow-xl: rgba(0, 0, 0, .60) 0 25px 50px -12px;

  /* No escuro o neon precisa render mais e a sombra, menos. */
  --shadow-lift: 0 18px 34px -14px rgba(0, 0, 0, .75);
  --glow-strength: 55%;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body-sm);
  font-weight: var(--font-weight-regular);
  font-feature-settings: "zero", "ss09", "ss05";
  -webkit-font-smoothing: antialiased;
}

/* Tracking negativo progressivo a partir de 24px: assinatura do sistema. */
h1, h2, h3, h4 { margin: 0; font-weight: var(--font-weight-semibold); }
h1 { font-size: var(--text-heading-lg); line-height: var(--leading-heading-lg); letter-spacing: var(--tracking-heading-lg); }
h2 { font-size: var(--text-heading); line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); }
h3 { font-size: var(--text-subheading); line-height: var(--leading-subheading); }
h4 { font-size: var(--text-body); line-height: var(--leading-body); }

a { color: var(--text); text-underline-offset: 2px; }
[hidden] { display: none !important; }
/* O sistema proibe peso 700+: enfase vem de 600 e do tamanho. */
strong, b { font-weight: var(--font-weight-semibold); }

.mono { font-family: var(--mono-font); font-feature-settings: "zero"; }
.muted-text { color: var(--muted); }
.hint { font-size: var(--text-caption); line-height: var(--leading-caption); color: var(--muted); }
.self-start { align-self: flex-start; }

/* blocos auxiliares dos modais */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-16); }
.section-title { margin-bottom: var(--spacing-12); }
.section-gap { margin-bottom: var(--spacing-32); }
.action-row { display: flex; flex-wrap: wrap; gap: var(--spacing-8); margin-top: var(--spacing-32); }
.action-row .spacer { flex: 1; }
.info-block { margin-top: var(--spacing-24); }
.info-text { margin-top: var(--spacing-6); font-size: var(--text-body-sm); white-space: pre-wrap; }
.swatches { display: flex; align-items: center; gap: var(--spacing-8); flex-wrap: wrap; }

/* ============================ controles ============================ */
button, input, select, textarea { font: inherit; color: inherit; font-family: var(--ui-font); }

/* Hierarquia por preenchimento: solido, com borda, so texto. Sem sombra. */
.btn {
  height: var(--control-h);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-6);
  padding: 0 var(--spacing-12);
  border: 1px solid var(--border); border-radius: var(--radius-buttons);
  background: var(--surface); color: var(--text);
  font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--hairline); }
.btn:active { opacity: .85; }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.btn-primary { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-text); }
.btn-primary:hover { background: var(--cta-bg); border-color: var(--cta-bg); opacity: .88; }

.btn-danger { color: var(--alert); border-color: var(--border); background: var(--surface); }
.btn-danger:hover { background: var(--alert-soft); border-color: var(--alert-soft); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: var(--font-weight-regular); }
.btn-ghost:hover { background: var(--selected); color: var(--text); border-color: transparent; }

.btn-sm { height: var(--control-sm-h); padding: 0 var(--spacing-10); font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="search"], select {
  height: var(--control-h);
}
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="search"], select, textarea {
  width: 100%; padding: 0 var(--spacing-12);
  border: 1px solid var(--border); border-radius: var(--radius-inputs);
  background: var(--surface); color: var(--text);
  font-size: var(--text-body-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea {
  padding: var(--spacing-10) var(--spacing-12);
  resize: vertical; min-height: 96px; line-height: var(--leading-body);
}
::placeholder { color: var(--muted); }
/* Foco: brilho externo discreto, sem cor. */
input:focus, select:focus, textarea:focus {
  border-color: var(--text); box-shadow: 0 0 0 3px var(--focus-ring);
}
input[type="color"] {
  width: 44px; height: var(--control-h); padding: 2px;
  border: 1px solid var(--border); border-radius: var(--radius-buttons); background: var(--surface);
}

.field { display: flex; flex-direction: column; gap: var(--spacing-6); margin-bottom: var(--spacing-16); }
.field label {
  font-size: 13px; font-weight: var(--font-weight-medium); color: var(--muted);
}
.field-row { display: flex; gap: var(--spacing-12); }
.field-row > * { flex: 1; min-width: 0; }

/* ============================ login ============================ */
/* Duas colunas: apresentacao (Ink, texto claro) + formulario. O painel escuro
   usa os papeis --cta invertidos, entao continua acromatico nos dois temas. */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); background: var(--bg); }
.auth-side {
  display: flex; flex-direction: column; gap: var(--spacing-48);
  padding: var(--spacing-48) var(--spacing-48) var(--spacing-40);
  background: var(--cta-bg); color: var(--cta-text);
}
.auth-side .logo { color: var(--cta-text); }
.auth-brand { display: flex; align-items: center; gap: var(--spacing-8); }
.auth-brand .logo { width: 32px; height: 32px; }
.auth-brand .wordmark { font-size: var(--text-heading-sm); }
.auth-pitch { margin: auto 0; max-width: 460px; }
.auth-pitch h1 {
  font-size: var(--text-display); line-height: 1.05; letter-spacing: var(--tracking-display);
}
.auth-pitch > p { margin: var(--spacing-16) 0 var(--spacing-40); font-size: var(--text-subheading); line-height: var(--leading-subheading); opacity: .72; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--spacing-20); }
.auth-points li {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: var(--spacing-16); border-left: 2px solid color-mix(in srgb, var(--cta-text) 30%, transparent);
}
.auth-points span { font-size: var(--text-body-sm); opacity: .68; }

.auth-main { display: grid; place-items: center; padding: var(--spacing-48) var(--spacing-24); }
.auth-card {
  width: 100%; max-width: 400px;
  padding: var(--spacing-32); background: var(--surface);
  border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.auth-card h2 { margin-bottom: var(--spacing-4); }
.auth-sub { color: var(--muted); margin: 0 0 var(--spacing-24); font-size: var(--text-body-sm); }
.auth-card .btn-primary { width: 100%; }

/* Senha com botao Mostrar/Ocultar dentro do campo. */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 84px; }
.reveal {
  position: absolute; top: 50%; right: var(--spacing-6); transform: translateY(-50%);
  height: 28px; padding: 0 var(--spacing-8); border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.reveal:hover, .reveal:focus-visible { background: var(--selected); color: var(--text); outline: none; }

.auth-options {
  display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-12);
  margin: calc(var(--spacing-4) * -1) 0 var(--spacing-20); font-size: 13px;
}
.auth-check { display: inline-flex; align-items: center; gap: var(--spacing-6); color: var(--muted); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.link-btn {
  padding: 0; border: 0; background: none; color: var(--text); cursor: pointer;
  font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
}
.auth-note {
  margin: 0 0 var(--spacing-20); padding: var(--spacing-10) var(--spacing-12);
  border-radius: var(--radius-buttons); background: var(--surface-2); box-shadow: var(--shadow-subtle-2);
  font-size: 13px; color: var(--muted);
}
.auth-note strong { color: var(--text); }
.auth-foot { margin: var(--spacing-20) 0 0; text-align: center; font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { gap: var(--spacing-16); padding: var(--spacing-24); }
  .auth-pitch h1 { font-size: var(--text-heading); line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); }
  .auth-pitch > p { margin: var(--spacing-8) 0 0; font-size: var(--text-body-sm); }
  .auth-points { display: none; }
  .auth-main { padding: var(--spacing-24) var(--spacing-16) var(--spacing-40); align-items: start; }
  .auth-card { padding: var(--spacing-24); }
}

/* ============================ layout ============================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--spacing-12);
  padding: 0 var(--spacing-20);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--spacing-8); }
/* O "L" e vazado: a cor do quadro basta, e ele inverte junto com o tema. */
.logo { width: 26px; height: 26px; flex: none; color: var(--cta-bg); display: block; }
.wordmark {
  font-size: var(--text-subheading); font-weight: var(--font-weight-semibold);
  letter-spacing: -.4px;
}
.topbar-spacer { flex: 1; }
.topbar .btn { height: var(--control-h); }
/* Seletor de semestre: mora no cabecalho da Visao geral. */
.semester-picker { display: flex; align-items: center; gap: var(--spacing-8); }
.semester-picker label {
  font-family: var(--mono-font); font-size: var(--text-caption);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.semester-picker select { width: 184px; }

.user-chip {
  height: var(--control-h); display: flex; align-items: center; gap: var(--spacing-8);
  padding: 0 var(--spacing-12) 0 var(--spacing-4);
  border: 1px solid var(--border); border-radius: var(--radius-pills);
  background: var(--surface); cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip .name { font-weight: var(--font-weight-medium); font-size: 13px; }
.user-chip .role { display: block; font-size: var(--text-caption); color: var(--muted); font-family: var(--mono-font); text-transform: uppercase; }

.user-chip .chevron { font-size: 10px; color: var(--icon); margin-left: var(--spacing-4); }
.user-chip[aria-expanded="true"] { background: var(--surface-2); border-color: var(--text); }

/* Menu da conta: abre abaixo do chip, alinhado a direita. */
.user-menu { position: relative; }
.menu {
  position: absolute; top: calc(100% + var(--spacing-8)); right: 0; z-index: 40;
  width: 248px; padding: var(--spacing-6);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-xl), var(--shadow-subtle-2);
  animation: rise .12s ease;
}
.menu-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--spacing-8) var(--spacing-10) var(--spacing-10);
  border-bottom: 1px solid var(--border); margin-bottom: var(--spacing-6);
}
.menu-head span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  display: flex; align-items: center; width: 100%; height: 36px; padding: 0 var(--spacing-10);
  border: 0; border-radius: var(--radius-buttons); background: transparent; color: var(--text);
  font-size: var(--text-body-sm); text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--selected); outline: none; }
.menu-item[data-menu="logout"] { color: var(--alert); }
.menu-sep { height: 1px; background: var(--border); margin: var(--spacing-6) 0; }

/* Link do convite: campo somente leitura + Copiar. */
.copy-row { display: flex; gap: var(--spacing-8); }
.copy-row input { flex: 1; min-width: 0; font-family: var(--mono-font); font-size: 13px; }
.notice {
  margin-top: var(--spacing-12); padding: var(--spacing-10) var(--spacing-12);
  border-radius: var(--radius-buttons); background: var(--surface-2); box-shadow: var(--shadow-subtle-2);
  font-size: 13px; line-height: var(--leading-body-sm);
}

.avatar {
  width: 28px; height: 28px; border-radius: var(--radius-pills); flex: none;
  display: grid; place-items: center; color: #fff;
  font-size: 11px; font-weight: var(--font-weight-medium);
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.has-photo { overflow: hidden; background: var(--surface-2); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shell { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--topbar-h); flex: none; width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h)); padding: var(--spacing-16) var(--spacing-12);
  background: var(--surface); border-right: 1px solid var(--border);
}
.nav-item {
  height: var(--control-h); display: flex; align-items: center; gap: var(--spacing-10);
  width: 100%; padding: 0 var(--spacing-12); margin-bottom: 2px;
  border: 0; border-radius: var(--radius-buttons); background: transparent;
  color: var(--muted); font-size: var(--text-body-sm); font-weight: var(--font-weight-regular);
  text-align: left; cursor: pointer;
}
/* Hover inverte o item: fundo claro e texto escuro no tema escuro, e o oposto
   no tema claro — os tokens --cta ja carregam essa inversao. */
.nav-item { transition: background .14s ease, color .14s ease; }
.nav-item:hover { background: var(--cta-bg); color: var(--cta-text); }
.nav-item:hover .count { color: var(--cta-text); }
.nav-item.active { background: var(--selected); color: var(--text); font-weight: var(--font-weight-medium); }
.nav-item .count { margin-left: auto; font-family: var(--mono-font); font-size: var(--text-caption); color: var(--muted); transition: color .14s ease; }
.nav-sep { height: 1px; background: var(--border); margin: var(--spacing-12) var(--spacing-4); }

.content { flex: 1; min-width: 0; padding: var(--spacing-32) var(--spacing-32) var(--spacing-64); }
.content-inner { max-width: var(--page-max-width); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: var(--spacing-16); margin-bottom: var(--spacing-24); flex-wrap: wrap; }
.page-head h2 { font-size: var(--text-heading); line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); }
.page-head p { margin: var(--spacing-4) 0 0; color: var(--muted); font-size: var(--text-body-sm); }
.page-head .spacer { flex: 1; }

/* ============================ cartoes ============================ */
/* Sombra no lugar de borda: a shadow-subtle ja carrega o anel de 1px. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--spacing-12); margin-bottom: var(--spacing-24); }
.stat {
  height: var(--tile-h); display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--card-padding);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.stat .value {
  font-size: var(--text-heading); line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading); font-weight: var(--font-weight-semibold);
}
.stat .label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat.alert .value { color: var(--alert); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: var(--card-h); gap: var(--spacing-16);
}

.subject-card {
  position: relative; overflow: hidden; text-align: left;
  /* width explicito: dentro da .subject-cell o botao nao estica sozinho e
     encolheria ate o tamanho do texto. */
  display: flex; flex-direction: column; width: 100%; height: 100%;
  padding: var(--spacing-20) var(--card-padding) var(--card-padding);
  background: var(--surface); border: 0; border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle); cursor: pointer;
  transition: box-shadow .2s ease, transform .2s cubic-bezier(.2, .7, .3, 1);
}
/* A celula segura o cartao e o botao Editar (irmaos: botao dentro de botao
   nao e HTML valido). O hover e da celula, para o cartao nao "cair" quando o
   ponteiro passa para o Editar. */
.subject-cell { position: relative; height: 100%; }
.card-edit {
  position: absolute; top: var(--spacing-12); right: var(--spacing-12); z-index: 3;
  opacity: 0; transition: opacity .16s ease, transform .2s cubic-bezier(.2, .7, .3, 1);
}
.subject-cell:hover .card-edit, .card-edit:focus-visible { opacity: 1; }
.subject-cell:hover .card-edit { transform: translateY(-6px); }
/* Sem hover (toque), o Editar fica sempre a vista. */
@media (hover: none) { .card-edit { opacity: 1; } }

/* Hover: o cartao sobe acima dos vizinhos e acende na cor da propria materia.
   O neon sai do conteudo (a cor que a turma escolheu), nao do cromo — por isso
   nao quebra a regra acromatica do design system. */
.subject-cell:hover .subject-card, .subject-card:focus-visible {
  transform: translateY(-6px);
  z-index: 2;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--card-color, var(--text)) 70%, transparent),
    0 0 0 6px color-mix(in srgb, var(--card-color, var(--text)) 10%, transparent),
    0 0 28px -2px color-mix(in srgb, var(--card-color, var(--text)) var(--glow-strength), transparent),
    var(--shadow-lift);
}
/* A cor da materia e conteudo do usuario — a unica cor da interface. */
.subject-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--card-color, var(--text));
  transition: height .18s ease, box-shadow .18s ease;
}
.subject-cell:hover .subject-card::before {
  height: 5px;
  box-shadow: 0 0 12px 1px color-mix(in srgb, var(--card-color, var(--text)) 65%, transparent);
}

/* Cartao com imagem: veu escuro por cima da foto para o texto branco ler bem
   em qualquer imagem. As etiquetas mantem a propria superficie. */
.subject-card.has-cover {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, .74) 100%),
    var(--cover) center / cover no-repeat,
    var(--surface);
  color: #fff;
}
.subject-card.has-cover .code,
.subject-card.has-cover .prof { color: rgba(255, 255, 255, .82); }
.subject-card .code {
  height: 15px; line-height: 15px; font-family: var(--mono-font);
  font-size: var(--text-caption); letter-spacing: .04em; text-transform: uppercase; color: var(--icon);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.subject-card h3 {
  height: 56px; margin: var(--spacing-6) 0 0;
  font-size: var(--text-subheading); line-height: var(--leading-subheading);
  font-weight: var(--font-weight-semibold);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
}
.subject-card .prof {
  height: 21px; line-height: 21px; margin: var(--spacing-4) 0 var(--spacing-12);
  color: var(--muted); font-size: var(--text-body-sm);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.subject-card .meta {
  height: 26px; margin-top: auto; display: flex; align-items: center;
  flex-wrap: nowrap; gap: var(--element-gap); overflow: hidden;
}
.subject-card .meta .pill { flex: none; }

.add-card {
  display: grid; place-content: center; gap: var(--spacing-6); justify-items: center;
  height: 100%; border: 1px dashed var(--border); border-radius: var(--radius-cards);
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
}
.add-card {
  transition: border-color .18s ease, color .18s ease, background .18s ease,
              transform .2s cubic-bezier(.2, .7, .3, 1), box-shadow .2s ease;
}
.add-card:hover {
  border-color: var(--text); color: var(--text); background: var(--surface);
  border-style: solid; transform: translateY(-6px); z-index: 2;
  box-shadow: 0 0 0 1px var(--text), 0 0 24px -6px color-mix(in srgb, var(--text) var(--glow-strength), transparent), var(--shadow-lift);
}

/* ============================ turmas ============================ */
/* Seletor da turma aberta, ao lado da marca: leva a Minhas turmas. */
.team-switch {
  height: var(--control-h); min-width: 0; max-width: 320px;
  display: flex; align-items: center; gap: var(--spacing-8);
  padding: 0 var(--spacing-12); margin-left: var(--spacing-8);
  border: 1px solid var(--border); border-radius: var(--radius-buttons);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.team-switch:hover { background: var(--surface-2); }
.team-switch-label {
  font-family: var(--mono-font); font-size: var(--text-caption);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.team-switch-name {
  font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.team-switch .chevron { font-size: 10px; color: var(--icon); }

/* ---------------------------------------------------- topo: busca, criar, avisos */
.brand-btn { border: 0; background: transparent; color: var(--text); padding: 0; cursor: pointer; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Busca: centro do topo, larga como a do Trello; os resultados abrem embaixo. */
.topbar-search { position: relative; flex: 0 1 560px; min-width: 0; display: flex; align-items: center; }
.topbar-search > .icon { position: absolute; left: var(--spacing-12); color: var(--icon); pointer-events: none; }
.topbar-search input { width: 100%; height: var(--control-sm-h); padding-left: 38px; }
.search-panel {
  position: absolute; top: calc(100% + var(--spacing-8)); left: 0; right: 0; z-index: 40;
  max-height: min(70vh, 520px); overflow-y: auto; padding: var(--spacing-6);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-xl), var(--shadow-subtle-2);
  animation: rise .12s ease;
}
.search-group {
  padding: var(--spacing-8) var(--spacing-10) var(--spacing-4);
  font-family: var(--mono-font); font-size: var(--text-caption); letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.search-item {
  display: flex; align-items: center; gap: var(--spacing-10); width: 100%; padding: var(--spacing-8) var(--spacing-10);
  border: 0; border-radius: var(--radius-buttons); background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.search-item:hover, .search-item:focus-visible { background: var(--selected); outline: none; }
.search-text { min-width: 0; display: flex; flex-direction: column; }
.search-text strong, .search-text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-text strong { font-size: var(--text-body-sm); font-weight: var(--font-weight-medium); }
.search-text span { font-size: 13px; color: var(--muted); }
.search-empty { margin: 0; padding: var(--spacing-12); color: var(--muted); font-size: var(--text-body-sm); }
.subject-dot.neutral { background: var(--icon); }

/* Itens de menu com duas linhas (Criar, Avisos). */
.menu-item.menu-item-2 { height: auto; flex-direction: column; align-items: flex-start; gap: 2px; padding: var(--spacing-8) var(--spacing-10); }
.menu-item-2 strong { font-weight: var(--font-weight-medium); }
.menu-item-2 > span { display: flex; align-items: center; gap: var(--spacing-6); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.menu-item-2 .pill { height: 20px; font-size: 12px; }
.create-menu { width: 280px; }
.bell-panel { width: 340px; max-height: min(70vh, 520px); overflow-y: auto; }
.bell { position: relative; width: var(--control-h); padding: 0; justify-content: center; }
.bell .badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: var(--radius-pills);
  background: var(--cta-bg); color: var(--cta-text); font-size: 11px; font-family: var(--mono-font);
}
.bell .badge.alert { background: var(--alert); color: #fff; }

/* ---------------------------------------------------- inicio */
.home-inner { max-width: 960px; }
.home-block { margin-top: var(--spacing-32); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-12); }
.block-title {
  margin: 0 0 var(--spacing-12); font-size: var(--text-caption); font-family: var(--mono-font);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon); font-weight: var(--font-weight-regular);
}

/* Ladrilho da turma: capa (imagem de uma materia) ou iniciais em giz. */
.team-tile {
  width: 44px; height: 44px; flex: none; border-radius: var(--radius-buttons);
  background: var(--cover) center / cover no-repeat, var(--surface-2);
}
.team-tile.initials {
  display: grid; place-items: center; background: var(--cta-bg); color: var(--cta-text);
  font-weight: var(--font-weight-semibold); font-size: 15px;
}
.team-tile.sm { width: 24px; height: 24px; font-size: 10px; border-radius: 6px; }

/* Acessadas recentemente: ate quatro capas lado a lado. */
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--spacing-12); }
.recent-card {
  display: flex; flex-direction: column; overflow: hidden; padding: 0; text-align: left;
  background: var(--surface); color: var(--text); border: 0; border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle); cursor: pointer;
  transition: box-shadow .2s ease, transform .2s cubic-bezier(.2, .7, .3, 1);
}
.recent-card:hover, .recent-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--text), 0 0 24px -6px color-mix(in srgb, var(--text) var(--glow-strength), transparent), var(--shadow-lift);
}
.recent-cover { height: 92px; background: var(--cover) center / cover no-repeat, var(--surface-2); }
.recent-cover.initials {
  display: grid; place-items: center; background: var(--cta-bg); color: var(--cta-text);
  font-size: var(--text-heading); font-weight: var(--font-weight-semibold); letter-spacing: -.5px;
}
.recent-body { display: flex; flex-direction: column; gap: 2px; padding: var(--spacing-10) var(--spacing-12) var(--spacing-12); min-width: 0; }
.recent-body strong { font-weight: var(--font-weight-medium); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.recent-body span { font-size: 13px; color: var(--muted); }

/* Suas turmas: uma linha por turma, como as areas de trabalho do Trello. */
.team-list { background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle); overflow: hidden; }
.team-row {
  display: flex; align-items: center; gap: var(--spacing-16); flex-wrap: wrap;
  padding: var(--spacing-12) var(--card-padding);
}
.team-row + .team-row { border-top: 1px solid var(--border); }
.team-row-open {
  flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: var(--spacing-12);
  padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.team-row-open:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.team-row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.team-row-main strong { font-weight: var(--font-weight-semibold); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.team-row-kicker {
  font-family: var(--mono-font); font-size: var(--text-caption); letter-spacing: .04em; text-transform: uppercase; color: var(--icon);
}
.team-row-meta { font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.team-row-stats, .team-row-actions { display: flex; gap: var(--spacing-6); flex-wrap: wrap; }
.team-row-new { width: 100%; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.team-row-new:hover { background: var(--surface-2); color: var(--text); }
.team-row-new .team-tile.initials { background: transparent; color: inherit; border: 1px dashed var(--border); font-size: 20px; }

/* Barra lateral do Inicio: turmas expansiveis com atalhos (como no Trello). */
.home-sidebar { overflow-y: auto; }
.side-label {
  padding: var(--spacing-4) var(--spacing-12) var(--spacing-8);
  font-family: var(--mono-font); font-size: var(--text-caption); letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.side-team summary {
  display: flex; align-items: center; gap: var(--spacing-10); height: var(--control-h); padding: 0 var(--spacing-12);
  border-radius: var(--radius-buttons); color: var(--text); font-size: var(--text-body-sm); cursor: pointer; list-style: none;
}
.side-team summary::-webkit-details-marker { display: none; }
.side-team summary::after { content: "\25BE"; margin-left: auto; font-size: 10px; color: var(--icon); transition: transform .15s ease; }
.side-team[open] summary::after { transform: rotate(180deg); }
.side-team summary > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-team summary:hover { background: var(--selected); }
.side-sub {
  display: block; width: 100%; height: 32px; padding: 0 var(--spacing-12) 0 46px;
  border: 0; border-radius: var(--radius-buttons); background: transparent; color: var(--muted);
  font-size: 13px; text-align: left; cursor: pointer;
}
.side-sub:hover { background: var(--selected); color: var(--text); }
.nav-item .count.alert { color: var(--alert); }

/* Prazos de todas as turmas (Inicio e Meus prazos). */
.deadline-list { background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle); overflow: hidden; }
.deadline-row {
  display: flex; align-items: center; gap: var(--spacing-12); width: 100%; min-height: 60px;
  padding: var(--spacing-10) var(--card-padding); border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.deadline-row + .deadline-row { border-top: 1px solid var(--border); }
.deadline-row:hover { background: var(--surface-2); }
.deadline-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.deadline-main strong { font-weight: var(--font-weight-medium); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.deadline-main span { font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.deadline-row .pill { flex: none; }

@media (max-width: 860px) {
  /* A busca desce para uma linha so dela; os paineis ocupam a largura da tela. */
  .topbar-search { order: 10; flex: 1 1 100%; }
  .topbar-spacer { display: none; }
  .topbar .user-menu:last-child { margin-left: auto; }
  .bell-panel, .create-menu { position: fixed; left: var(--spacing-12); right: var(--spacing-12); top: auto; width: auto; }
  .side-label, .side-team { display: none; }
  .team-row-actions { width: 100%; }
}

.subscribe-notice { margin: 0 0 var(--spacing-24); }
.subscribe-notice strong { display: block; margin-bottom: var(--spacing-4); }

/* Equipe > Turma: uma linha por acao (texto a esquerda, botao a direita). */
.team-actions {
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.team-action {
  display: flex; align-items: center; gap: var(--spacing-16);
  padding: var(--spacing-16) var(--card-padding);
}
.team-action + .team-action { border-top: 1px solid var(--border); }
.team-action > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.team-action span { color: var(--muted); font-size: var(--text-body-sm); }
.team-action .btn { flex: none; }

@media (max-width: 640px) {
  .team-switch { max-width: 160px; margin-left: 0; }
  .team-switch-label { display: none; }
  .team-action { flex-direction: column; align-items: stretch; }
}

/* Chip com borda hairline, fundo da superficie, texto Ink. */
.pill {
  display: inline-flex; align-items: center; gap: var(--spacing-6);
  height: 26px; padding: 0 var(--spacing-10);
  border: 1px solid var(--hairline); border-radius: var(--radius-pills);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: var(--font-weight-regular); white-space: nowrap;
}
.pill.muted { color: var(--muted); }
.pill.strong { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-text); font-weight: var(--font-weight-medium); }
.pill.alert { background: var(--alert-soft); border-color: transparent; color: var(--alert); font-weight: var(--font-weight-medium); }

/* ============================ listas ============================ */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--spacing-8); margin-bottom: var(--spacing-20); align-items: center; }
.toolbar select, .toolbar input { width: var(--filter-w); flex: none; }
.toolbar .check-chip { height: var(--control-h); flex: none; }
.toolbar .spacer { flex: 1; }

.list { display: flex; flex-direction: column; gap: var(--spacing-8); }
.task {
  position: relative;
  height: var(--row-h); display: flex; align-items: center; gap: var(--spacing-12);
  padding: 0 var(--card-padding);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle-2);
  transition: box-shadow .18s ease, transform .18s cubic-bezier(.2, .7, .3, 1);
}
/* Mesma linguagem do cartao, em dose menor: a linha sobe e acende na cor da materia. */
.task:hover {
  transform: translateY(-3px); z-index: 2;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--row-color, var(--text)) 55%, transparent),
    0 0 20px -4px color-mix(in srgb, var(--row-color, var(--text)) var(--glow-strength), transparent),
    var(--shadow-lift);
}
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check {
  flex: none; width: 20px; height: 20px; align-self: center;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: transparent; font-size: 12px;
  display: grid; place-items: center; cursor: pointer;
}
.task-check:hover { border-color: var(--text); }
.task-check.on { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-text); }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.task-title {
  height: 24px; line-height: 24px; font-size: var(--text-body); font-weight: var(--font-weight-medium);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.task-desc {
  height: 20px; line-height: 20px; margin-top: 2px;
  color: var(--muted); font-size: var(--text-body-sm);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.task-meta {
  height: 26px; margin-top: var(--spacing-8); display: flex; align-items: center;
  flex-wrap: nowrap; gap: var(--element-gap); overflow: hidden;
}
.task-meta > * { flex: none; }
.task-actions { display: flex; gap: var(--spacing-4); flex: none; align-self: center; }
/* Pessoa na linha da tarefa: "(foto) Ana". */
.assign-chip { padding-left: 2px; gap: var(--spacing-6); }
.assign-chip .avatar { box-shadow: none; }

.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

.subject-dot { width: 8px; height: 8px; border-radius: var(--radius-pills); flex: none; }

.empty {
  min-height: var(--empty-h); display: grid; place-content: center; align-content: center;
  text-align: center; padding: var(--spacing-24); color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius-cards);
}
.empty strong { display: block; color: var(--text); font-weight: var(--font-weight-medium); margin-bottom: var(--spacing-4); }

/* ============================ agenda ============================ */
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--spacing-12); }
.week-day {
  height: var(--day-h); overflow-y: auto; padding: var(--card-padding);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.week-day.today { box-shadow: var(--shadow-subtle), 0 0 0 2px var(--text); }
.week-day h4 {
  height: 16px; margin-bottom: var(--spacing-12); font-family: var(--mono-font);
  font-size: var(--text-caption); line-height: 16px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--icon); font-weight: var(--font-weight-regular);
}
.class-block {
  height: var(--class-h); overflow: hidden; cursor: pointer;
  padding: var(--spacing-8) var(--spacing-10); margin-bottom: var(--spacing-8);
  border-left: 3px solid var(--card-color, var(--text));
  border-radius: var(--radius-md); background: var(--surface-2);
}
.class-block { transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.class-block:hover {
  transform: translateX(2px); background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--card-color, var(--text)) 45%, transparent),
              0 0 16px -6px color-mix(in srgb, var(--card-color, var(--text)) var(--glow-strength), transparent);
}
.class-block .time {
  height: 18px; line-height: 18px; font-family: var(--mono-font);
  font-size: var(--text-caption); color: var(--muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.class-block .name {
  height: 20px; line-height: 20px; margin-top: 2px;
  font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

/* ============================ tabela ============================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle); background: var(--surface); }
.table { width: 100%; min-width: 560px; border-collapse: collapse; }
.table th, .table td { height: var(--tr-h); padding: 0 var(--card-padding); text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  font-family: var(--mono-font); font-size: var(--text-caption); font-weight: var(--font-weight-regular);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon); background: var(--surface-2);
}
.table tr:last-child td { border-bottom: 0; }
.table th.c, .table td.c { text-align: center; }
/* Tabela de integrantes da Visao geral: muitas colunas, rola de lado no celular. */
.table.wide { min-width: 920px; }
.row-link { cursor: pointer; transition: background .12s ease; }
.row-link:hover, .row-link:focus-visible { background: var(--surface-2); outline: none; }
.member-cell { display: flex; align-items: center; gap: var(--spacing-8); white-space: nowrap; }
.num { font-family: var(--mono-font); font-size: var(--text-body-sm); font-weight: var(--font-weight-medium); }
.num.zero { color: var(--icon); font-weight: var(--font-weight-regular); }
.num.alert { color: var(--alert); }
.subject-name { display: flex; flex-direction: column; min-width: 0; }
.subject-name strong { overflow: hidden; text-overflow: ellipsis; }
.subject-name .mono { font-size: var(--text-caption); line-height: var(--leading-caption); }
.next-due { display: flex; align-items: center; gap: var(--spacing-8); min-width: 0; }
.next-title { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.table-note { margin: var(--spacing-8) 0 0; }

/* Blocos da Visao geral */
.home-section { margin-top: var(--spacing-40); }
.home-section .section-head { align-items: flex-end; gap: var(--spacing-16); }
.section-sub { margin: var(--spacing-4) 0 0; color: var(--muted); font-size: var(--text-body-sm); }

/* ============================ visao geral: area pessoal ============================ */
/* Topo: entrega mais urgente ao lado dos numeros da pessoa (2x2). */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--spacing-12); }
.home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.stat-bar { height: 4px; margin-top: var(--spacing-6); border-radius: 2px; background: var(--surface-2); box-shadow: var(--shadow-subtle-2); overflow: hidden; }
.stat-bar span { display: block; height: 100%; background: var(--text); }

.focus-card {
  display: flex; align-items: center; gap: var(--spacing-20);
  min-height: calc(var(--tile-h) * 2 + var(--spacing-12)); padding: var(--spacing-24);
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 0; border-left: 4px solid var(--card-color, var(--text));
  border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
  transition: transform .16s ease, box-shadow .16s ease;
}
button.focus-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-subtle), 0 18px 32px -20px color-mix(in srgb, var(--card-color, var(--text)) var(--glow-strength), transparent);
}
.focus-card.calm { cursor: default; border-left-color: var(--border); }
.focus-count { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 88px; }
.focus-big {
  font-size: var(--text-display); line-height: 1; letter-spacing: var(--tracking-display);
  font-weight: var(--font-weight-semibold);
}
.focus-card.alert .focus-big { color: var(--alert); }
.focus-unit { margin-top: var(--spacing-6); font-size: 13px; color: var(--muted); }
.focus-main { min-width: 0; display: flex; flex-direction: column; gap: var(--spacing-4); }
.focus-kicker {
  font-family: var(--mono-font); font-size: var(--text-caption); letter-spacing: .06em;
  text-transform: uppercase; color: var(--icon);
}
.focus-card.alert .focus-kicker { color: var(--alert); }
.focus-title { font-size: var(--text-heading-sm); line-height: var(--leading-heading-sm); font-weight: var(--font-weight-semibold); }
.focus-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--spacing-6); color: var(--muted); font-size: 13px; }

/* Sua semana: 7 colunas a partir de hoje. */
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--spacing-8); }
.day-col {
  display: flex; flex-direction: column; gap: var(--spacing-6); min-height: 200px;
  padding: var(--spacing-12); background: var(--surface);
  border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.day-col.today { box-shadow: var(--shadow-subtle), 0 0 0 2px var(--text); }
.day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-4);
  margin: calc(var(--spacing-4) * -1); padding: var(--spacing-4);
  border: 0; border-radius: var(--radius-buttons); background: transparent;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.day-head:hover { background: var(--selected); }
.day-name { font-weight: var(--font-weight-semibold); }
.day-date { font-family: var(--mono-font); font-size: var(--text-caption); color: var(--icon); }
.day-load { height: 4px; border-radius: 2px; background: var(--surface-2); box-shadow: var(--shadow-subtle-2); overflow: hidden; }
.day-load span { display: block; height: 100%; background: var(--text); }
.day-count { font-size: var(--text-caption); font-family: var(--mono-font); color: var(--icon); }
.day-col.busy .day-count { color: var(--text); }
/* Ate duas linhas: nome de materia comprido ("Técnicas de avaliação") cabe. */
.day-task, .day-class {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  width: 100%; padding: var(--spacing-6) var(--spacing-8);
  overflow: hidden; line-height: 1.35; overflow-wrap: anywhere;
  text-align: left; font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
  border: 0; border-left: 3px solid var(--card-color, var(--text)); border-radius: var(--radius-buttons);
}
.day-task { background: var(--selected); font-weight: var(--font-weight-medium); }
.day-class { background: transparent; color: var(--muted); }
.day-task:hover, .day-class:hover { background: color-mix(in srgb, var(--card-color, var(--text)) 14%, transparent); color: var(--text); }
.day-class .mono { font-size: var(--text-caption); }

/* Prazos (largo) + coluna lateral com os resumos curtos. */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--spacing-24); align-items: start; }
.home-side { margin-top: var(--spacing-40); display: flex; flex-direction: column; gap: var(--spacing-12); }
.side-card {
  padding: var(--card-padding); background: var(--surface);
  border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle);
}
.side-card h4 { margin-bottom: var(--spacing-12); }
.side-empty { margin: 0; font-size: 13px; }
.load-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 24px; align-items: center; gap: var(--spacing-8);
  width: 100%; padding: var(--spacing-6) var(--spacing-4); border: 0; border-radius: var(--radius-buttons);
  background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.load-row:hover { background: var(--selected); }
.load-row .num { text-align: right; }
.load-name { display: flex; align-items: center; gap: var(--spacing-6); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.load-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.load-bar span { display: block; height: 100%; border-radius: 3px; }
.role-chips { display: flex; flex-wrap: wrap; gap: var(--spacing-6); }
.class-pulse { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacing-8); }
.class-pulse > div { display: flex; flex-direction: column; gap: 2px; }
.class-pulse .num { font-size: var(--text-heading-sm); }
.class-pulse span:not(.num) { font-size: var(--text-caption); color: var(--muted); }
.side-link { margin-top: var(--spacing-12); padding-left: 0; }

/* Calendario (modal): mes a esquerda, detalhes do dia a direita. */
.modal.cal-modal { width: 920px; height: 680px; }
.cal-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--spacing-24); }
.cal-nav { display: flex; align-items: center; gap: var(--spacing-8); margin-bottom: var(--spacing-12); }
.cal-nav .spacer { flex: 1; }
.cal-month { min-width: 140px; text-align: center; font-size: var(--text-body); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--spacing-4); }
.cal-weekday {
  padding-bottom: var(--spacing-4); text-align: center;
  font-family: var(--mono-font); font-size: var(--text-caption); text-transform: uppercase; color: var(--icon);
}
.cal-day {
  position: relative; height: 68px; padding: var(--spacing-6);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--spacing-4);
  border: 1px solid var(--border); border-radius: var(--radius-buttons); background: var(--surface);
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.cal-day:hover { background: var(--surface-2); border-color: var(--hairline); }
.cal-day.outside { color: var(--icon); background: transparent; }
.cal-day.today .cal-num { background: var(--cta-bg); color: var(--cta-text); }
.cal-day.selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.cal-num {
  min-width: 22px; height: 22px; padding: 0 4px; border-radius: var(--radius-pills);
  display: grid; place-items: center; font-size: 13px; font-weight: var(--font-weight-medium);
}
.cal-marks { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-class { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--icon); }
.cal-due {
  position: absolute; right: var(--spacing-6); bottom: var(--spacing-6);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pills);
  display: inline-grid; place-items: center;
  font-family: var(--mono-font); font-size: var(--text-caption); font-weight: var(--font-weight-medium);
  background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-subtle-2);
}
.cal-due.mine { background: var(--cta-bg); color: var(--cta-text); box-shadow: none; }
.cal-due.alert { background: var(--alert); color: #fff; box-shadow: none; }
.cal-legend {
  display: flex; flex-wrap: wrap; gap: var(--spacing-16); margin-top: var(--spacing-12);
  font-size: var(--text-caption); color: var(--muted);
}
.cal-legend > span { display: inline-flex; align-items: center; gap: var(--spacing-6); }
.cal-legend .cal-due { position: static; }

.cal-detail { border-left: 1px solid var(--border); padding-left: var(--spacing-24); min-width: 0; }
.cal-detail-head { margin-bottom: var(--spacing-16); display: flex; flex-direction: column; gap: 2px; }
.cal-detail-section { margin-bottom: var(--spacing-20); }
.cal-detail-section h5 {
  margin: 0 0 var(--spacing-8); font-family: var(--mono-font); font-size: var(--text-caption);
  font-weight: var(--font-weight-regular); text-transform: uppercase; letter-spacing: .06em; color: var(--icon);
}
.cal-detail-section .muted-text { margin: 0; font-size: 13px; }
.cal-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; margin-bottom: var(--spacing-6);
  padding: var(--spacing-8) var(--spacing-10);
  border: 0; border-left: 3px solid var(--card-color, var(--text)); border-radius: var(--radius-buttons);
  background: var(--surface-2); font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.cal-item:hover { background: color-mix(in srgb, var(--card-color, var(--text)) 12%, var(--surface)); }
.cal-item > span { font-size: 13px; color: var(--muted); }
.cal-item.done strong { text-decoration: line-through; color: var(--muted); }
.cal-item-tags { display: flex; flex-wrap: wrap; gap: var(--spacing-4); margin-top: var(--spacing-4); }
.cal-item-tags .pill { height: 22px; font-size: 12px; }

@media (max-width: 1100px) {
  .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .modal.cal-modal { height: 88vh; }
  .cal-body { grid-template-columns: minmax(0, 1fr); }
  .cal-detail { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: var(--spacing-16); }
  .cal-day { height: 52px; padding: var(--spacing-4); }
  .cal-due { right: 3px; bottom: 3px; }
}
@media (max-width: 860px) {
  .home-top, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-side { margin-top: 0; }
  .week-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-col { min-height: 0; }
  .focus-card { min-height: 0; padding: var(--spacing-20); }
  .focus-big { font-size: var(--text-heading-lg); }
}

/* ============================ modal ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .40);
  display: flex; align-items: center; justify-content: center; padding: var(--spacing-20);
  animation: fade .14s ease;
}
/* Materia com fundo proprio: a imagem ocupa a area atras do modal, com um veu
   por cima para a janela continuar sendo o foco. */
.overlay.has-backdrop {
  background:
    linear-gradient(rgba(0, 0, 0, .38), rgba(0, 0, 0, .38)),
    var(--backdrop) center / cover no-repeat,
    #000;
}
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } }

/* Janela unica: mesma largura e altura em todos os modais. */
.modal {
  width: var(--modal-w); max-width: 100%;
  height: var(--modal-h); max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: var(--radius-cards);
  box-shadow: var(--shadow-xl); animation: rise .16s ease;
}
.modal.compact { height: auto; }
.modal-head {
  flex: none; height: 72px; display: flex; align-items: center; gap: var(--spacing-12);
  padding: 0 var(--spacing-24); border-bottom: 1px solid var(--border);
}
.modal.compact .modal-head { height: auto; padding: var(--spacing-24) var(--spacing-24) var(--spacing-16); align-items: flex-start; }
.modal-head h3 {
  font-size: var(--text-heading-sm); line-height: var(--leading-heading-sm);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.modal-head p {
  margin: 2px 0 0; color: var(--muted); font-size: 13px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.modal.compact .modal-head p { white-space: normal; }
.modal-head > div:not(.spacer) { min-width: 0; }
.modal-head .spacer { flex: 1; }
.modal-body { flex: 1; min-height: 0; padding: var(--spacing-24); overflow-y: auto; }
.modal-foot {
  flex: none; height: 72px; display: flex; align-items: center; justify-content: flex-end;
  gap: var(--spacing-8); padding: 0 var(--spacing-24);
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal-foot .spacer { flex: 1; }

.tabs { flex: none; display: flex; gap: var(--spacing-4); padding: 0 var(--spacing-24); border-bottom: 1px solid var(--border); }
.tab {
  height: 48px; padding: 0 var(--spacing-12); border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: var(--text-body-sm); font-weight: var(--font-weight-regular);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: var(--font-weight-medium); border-bottom-color: var(--text); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--spacing-20); }
.info-item .k {
  font-family: var(--mono-font); font-size: var(--text-caption);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.info-item .v { margin-top: var(--spacing-4); font-size: var(--text-body-sm); word-break: break-word; }

.class-row { display: flex; gap: var(--spacing-8); align-items: center; margin-bottom: var(--spacing-8); }
.class-row select { width: 130px; }
.class-row input[type="time"] { width: 112px; }

/* Resumo fechado tem altura fixa; "Ver mais" libera o texto inteiro. */
.note-card {
  height: var(--note-h); display: flex; flex-direction: column; overflow: hidden;
  padding: var(--card-padding); margin-bottom: var(--spacing-10);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle-2);
}
.note-card { transition: box-shadow .16s ease, transform .16s ease; }
.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--row-color, var(--text)) 45%, transparent),
              0 0 18px -6px color-mix(in srgb, var(--row-color, var(--text)) var(--glow-strength), transparent);
}
.note-card.open { height: auto; }
.note-card h4 {
  height: 24px; line-height: 24px; font-size: var(--text-body); font-weight: var(--font-weight-semibold);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.note-card .note-meta {
  height: 18px; line-height: 18px; margin: 2px 0 var(--spacing-10);
  font-family: var(--mono-font); font-size: var(--text-caption); color: var(--icon);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.note-card .note-body {
  white-space: pre-wrap; font-size: var(--text-body-sm); line-height: var(--leading-body);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3; overflow: hidden;
}
.note-card.open .note-body { display: block; -webkit-line-clamp: none; line-clamp: none; }
.note-card .note-actions { height: 32px; display: flex; align-items: center; gap: var(--spacing-6); margin-top: auto; }

.checks { display: flex; flex-wrap: wrap; gap: var(--spacing-8); }
.check-chip {
  display: inline-flex; align-items: center; gap: var(--spacing-8);
  height: var(--control-sm-h); padding: 0 var(--spacing-12) 0 var(--spacing-6);
  border: 1px solid var(--border); border-radius: var(--radius-pills);
  background: var(--surface); font-size: 13px; cursor: pointer; user-select: none;
}
.check-chip:hover { background: var(--surface-2); }
.check-chip.on { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-text); font-weight: var(--font-weight-medium); }
.check-chip input { display: none; }

.form-error {
  background: var(--alert-soft); color: var(--alert); border-radius: var(--radius-buttons);
  padding: var(--spacing-10) var(--spacing-12); font-size: 13px; margin-bottom: var(--spacing-16);
}

.swatch { width: 22px; height: 22px; border-radius: var(--radius-pills); border: 1px solid var(--hairline); cursor: pointer; padding: 0; }

/* Campo de imagem da materia: miniatura + escolher/remover. */
.image-pick { display: flex; align-items: center; gap: var(--spacing-12); }
.image-preview {
  flex: none; width: 128px; height: 76px; display: grid; place-items: center;
  border-radius: var(--radius-buttons); box-shadow: var(--shadow-subtle-2);
  background: var(--surface-2) center / cover no-repeat;
  font-family: var(--mono-font); font-size: var(--text-caption); color: var(--icon);
}
.image-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--spacing-4); }

/* "+ Criar novo cargo": o campo de nome aparece logo abaixo do select. */
.field select + input { margin-top: var(--spacing-6); }

/* ============================ toasts ============================ */
.toasts { position: fixed; z-index: 90; bottom: var(--spacing-24); right: var(--spacing-24); display: flex; flex-direction: column; gap: var(--spacing-8); }
.toast {
  max-width: 340px; padding: var(--spacing-12) var(--spacing-16);
  background: var(--cta-bg); color: var(--cta-text);
  border-radius: var(--radius-buttons); box-shadow: var(--shadow-xl);
  font-size: 13px; animation: rise .16s ease;
}
.toast.error { background: var(--alert); color: #fff; }

/* ============================ movimento ============================ */
/* Quem pediu menos animacao no sistema recebe a interface parada. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .subject-cell:hover .subject-card, .subject-cell:hover .card-edit,
  .task:hover, .note-card:hover, .add-card:hover { transform: none; }
  .class-block:hover { transform: none; }
}

/* ============================ responsivo ============================ */
@media (max-width: 860px) {
  .sidebar {
    position: static; width: 100%; height: auto; top: auto;
    display: flex; gap: var(--spacing-6); overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border); padding: var(--spacing-10);
  }
  /* align-items: stretch e essencial: com flex-start o .content assumiria a
     largura do proprio conteudo e a pagina rolaria de lado. */
  .shell { flex-direction: column; align-items: stretch; }
  .content { width: 100%; padding: var(--spacing-20) var(--spacing-16) var(--spacing-48); }
  .nav-item { width: auto; flex: none; white-space: nowrap; }
  .nav-sep { display: none; }
  .week { grid-template-columns: 1fr; }
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; row-gap: var(--spacing-8); padding: var(--spacing-8) var(--spacing-12); }
  .brand span { display: none; }
  .semester-picker { width: 100%; }
  .semester-picker select { flex: 1; width: auto; min-width: 0; }
  .image-pick { flex-direction: column; align-items: flex-start; }
  .user-chip > span { display: none; }
  .toolbar select, .toolbar input { flex: 1; width: auto; min-width: 140px; }
}

/* ------------------------------------------------------------------ painel de IA */

.ai-panel {
  padding: var(--card-padding);
  margin-bottom: var(--spacing-16);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-cards);
}
.ai-panel-head {
  display: flex; align-items: baseline; gap: var(--spacing-8);
  margin-bottom: var(--spacing-12);
}
.ai-panel-head .muted-text {
  font-family: var(--mono-font); font-size: var(--text-caption);
}
.ai-actions { display: flex; flex-wrap: wrap; gap: var(--spacing-8); }

/* Foco opcional, logo acima dos botoes de geracao. */
.ai-focus { display: flex; flex-direction: column; gap: var(--spacing-6); margin-bottom: var(--spacing-12); }
.ai-focus label { font-size: 13px; font-weight: var(--font-weight-medium); color: var(--muted); }

/* Resumo do material que entrou no prompt (janela "copiar prompt"). */
.ai-summary {
  display: flex; flex-direction: column; gap: var(--spacing-4);
  padding: var(--spacing-10) var(--spacing-12); margin-bottom: var(--spacing-12);
  border-radius: var(--radius-buttons); background: var(--surface-2); box-shadow: var(--shadow-subtle-2);
  font-size: 13px;
}
.ai-summary .warn { color: var(--alert); }
.ai-actions:empty::before { content: '...'; color: var(--icon); }

/* Tipo de resumo: lista suspensa com busca por qualquer palavra. */
.ai-combo { position: relative; }
.ai-combo input { padding-right: var(--spacing-32); text-overflow: ellipsis; }
.ai-combo-caret {
  position: absolute; top: 50%; right: var(--spacing-12); transform: translateY(-50%);
  font-size: 11px; color: var(--icon); pointer-events: none;
}
.ai-combo-list {
  position: absolute; top: calc(100% + var(--spacing-4)); left: 0; right: 0; z-index: 40;
  max-height: 320px; overflow-y: auto; padding: var(--spacing-4);
  background: var(--surface); border-radius: var(--radius-cards);
  box-shadow: var(--shadow-xl), var(--shadow-subtle-2);
  animation: rise .12s ease;
}
.ai-combo-group {
  padding: var(--spacing-8) var(--spacing-10) var(--spacing-4);
  font-family: var(--mono-font); font-size: var(--text-caption); text-transform: uppercase; color: var(--icon);
}
.ai-combo-option {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--spacing-8) var(--spacing-10); border-radius: var(--radius-buttons); cursor: pointer;
}
.ai-combo-option:hover, .ai-combo-option.active { background: var(--selected); }
.ai-combo-option[aria-selected="true"] .ai-combo-label::after { content: ' ✓'; color: var(--muted); }
.ai-combo-label { font-weight: var(--font-weight-medium); }
.ai-combo-desc { font-size: 13px; line-height: 1.4; color: var(--muted); }
.ai-combo-option mark { background: var(--focus-ring); color: inherit; border-radius: 2px; }
.ai-combo-empty { padding: var(--spacing-12) var(--spacing-10); color: var(--muted); }
.ai-type-hint { font-size: 13px; }

/* Quanto do material marcado cabe no prompt. */
.ai-meter { margin-bottom: var(--spacing-12); font-size: 13px; color: var(--muted); }
.ai-meter-bar { height: 4px; margin-bottom: var(--spacing-6); border-radius: 2px; background: var(--surface-2); box-shadow: var(--shadow-subtle-2); overflow: hidden; }
.ai-meter-bar span { display: block; height: 100%; background: var(--text); }
.ai-meter.over .ai-meter-bar span { background: var(--alert); }
.ai-meter.over strong { color: var(--alert); font-weight: var(--font-weight-medium); }

.ai-prompt-help { margin: 0 0 var(--spacing-8); font-size: 13px; }
@media (max-width: 640px) {
  .ai-prompt-foot { height: auto; flex-wrap: wrap; padding-block: var(--spacing-12); }
}

/* O prompt e longo: monoespacado e rolavel, sem empurrar o rodape do modal. */
.ai-prompt {
  width: 100%; min-height: 320px; resize: vertical;
  font-family: var(--mono-font); font-size: var(--text-body-sm); line-height: 1.5;
  white-space: pre-wrap;
}

/* ------------------------------------------------------------ anexos da IA */

.ai-drop {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--spacing-16); margin-bottom: var(--spacing-12);
  text-align: center; cursor: pointer;
  border: 1px dashed var(--border); border-radius: var(--radius-cards);
  transition: border-color .16s ease, background .16s ease;
}
.ai-drop:hover, .ai-drop:focus-visible { border-color: var(--text); background: var(--surface-2); }
.ai-drop.over { border-color: var(--text); border-style: solid; background: var(--surface-2); }
.ai-drop.busy { opacity: .6; pointer-events: none; }
.ai-drop .muted-text { font-size: var(--text-body-sm); }

.ai-files { margin-bottom: var(--spacing-12); }
.ai-files-head { font-family: var(--mono-font); font-size: var(--text-caption); margin-bottom: var(--spacing-6); }

.ai-file {
  display: flex; align-items: center; gap: var(--spacing-8);
  padding: var(--spacing-6) 0; border-bottom: 1px solid var(--border);
}
.ai-file:last-child { border-bottom: 0; }
.ai-file-pick { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--text); cursor: pointer; }
.ai-file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-file-read { font-size: var(--text-caption); line-height: 1.4; color: var(--muted); }
.ai-file-read.ok { color: var(--text); }
.ai-file-read.warn { color: var(--alert); }
.ai-file-kind {
  flex: none; padding: 1px 6px; border-radius: var(--radius-buttons);
  font-family: var(--mono-font); font-size: var(--text-caption);
  background: var(--surface-2); color: var(--icon);
}
/* O nome precisa encolher: sem min-width:0 o flex nao deixa o ellipsis agir. */
.ai-file-name {
  flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: var(--text-body-sm); color: inherit; text-decoration: none;
}
.ai-file-name:hover { text-decoration: underline; }
.ai-file-size { flex: none; font-family: var(--mono-font); font-size: var(--text-caption); }

/* ------------------------------------------------------------ perfis e acesso */

/* Regras da hierarquia, em quatro blocos curtos. */
.rules {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--spacing-12);
  margin-bottom: var(--spacing-8);
}
.rules > div {
  padding: var(--spacing-12) var(--spacing-16); border-radius: var(--radius-cards);
  background: var(--surface); box-shadow: var(--shadow-subtle-2);
  font-size: 13px; line-height: var(--leading-body-sm); color: var(--muted);
}
.rules strong { display: block; color: var(--text); margin-bottom: 2px; }

/* Escada: um degrau por perfil, do nivel mais alto para o mais baixo. */
.ladder { display: flex; flex-direction: column; gap: var(--spacing-8); }
.ladder-step {
  display: flex; align-items: center; gap: var(--spacing-16);
  padding: var(--spacing-12) var(--card-padding);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-subtle-2);
}
.ladder-step.mine { box-shadow: 0 0 0 1px var(--text); }
.ladder-level {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--radius-buttons); background: var(--surface-2); box-shadow: var(--shadow-subtle-2);
  font-family: var(--mono-font); font-size: var(--text-body); font-weight: var(--font-weight-medium);
}
.ladder-step:first-child .ladder-level { background: var(--cta-bg); color: var(--cta-text); box-shadow: none; }
.ladder-body { flex: 1; min-width: 0; }
.ladder-title { display: flex; align-items: center; gap: var(--spacing-8); flex-wrap: wrap; }
.ladder-meta { margin-top: 2px; font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ladder-actions { flex: none; display: flex; gap: var(--spacing-6); }

/* Matriz de direitos: linhas = direitos, colunas = perfis. */
.table.matrix { min-width: 640px; }
.table.matrix td, .table.matrix th { height: 44px; }
.matrix-group td {
  height: 36px; background: var(--surface-2);
  font-family: var(--mono-font); font-size: var(--text-caption); letter-spacing: .06em;
  text-transform: uppercase; color: var(--icon);
}
.matrix .yes { font-weight: var(--font-weight-semibold); }
.matrix .no { color: var(--icon); }

/* Editor de perfil: caixas de direitos agrupadas. */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--spacing-12); }
.perm-group {
  margin: 0; padding: var(--spacing-10) var(--spacing-12) var(--spacing-8);
  border: 1px solid var(--border); border-radius: var(--radius-cards);
}
.perm-group legend {
  padding: 0 var(--spacing-4); font-family: var(--mono-font); font-size: var(--text-caption);
  letter-spacing: .06em; text-transform: uppercase; color: var(--icon);
}
.perm { display: flex; align-items: flex-start; gap: var(--spacing-8); padding: var(--spacing-4) 0; font-size: var(--text-body-sm); cursor: pointer; }
.perm input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--text); }
.perm.off { color: var(--muted); cursor: not-allowed; }

.task-check:disabled { cursor: not-allowed; opacity: .5; }

/* ============================ tarefa aberta ============================ */
/* Clicar no corpo da linha abre a tarefa (etapas, anexos, comentarios). */
.task-body[data-act="open"] { cursor: pointer; outline: none; }
.task-body[data-act="open"]:focus-visible .task-title { text-decoration: underline; }

.chip-wrap { display: flex; flex-wrap: wrap; gap: var(--spacing-6); margin-top: var(--spacing-8); }
.inline-dot { display: inline-flex; align-items: center; gap: var(--spacing-6); }

/* Uma secao embaixo da outra: Detalhes, Etapas, Anexos, Comentarios. */
.td-section + .td-section { margin-top: var(--spacing-24); padding-top: var(--spacing-20); border-top: 1px solid var(--border); }
.td-title { display: flex; align-items: center; gap: var(--spacing-8); margin-bottom: var(--spacing-12); font-size: var(--text-body); font-weight: var(--font-weight-medium); }
.td-count { font-family: var(--mono-font); font-size: var(--text-caption); color: var(--muted); font-weight: var(--font-weight-regular); }
.td-actions { display: flex; gap: var(--spacing-8); margin-top: var(--spacing-16); }
.td-empty { color: var(--muted); font-size: var(--text-body-sm); margin-bottom: var(--spacing-10); }

/* Etapas: checklist */
.progress { height: 4px; margin-bottom: var(--spacing-10); border-radius: var(--radius-pills); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--cta-bg); transition: width .2s ease; }
.checklist { display: flex; flex-direction: column; margin-bottom: var(--spacing-8); }
/* Colunas fixas: etapa | responsavel | prazo | acoes. Assim o nome e o prazo
   ficam um embaixo do outro, qualquer que seja o tamanho do texto. */
.check-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 130px 120px 150px;
  align-items: center; column-gap: var(--spacing-12); min-height: 40px;
  padding: var(--spacing-4) var(--spacing-6); margin: 0 calc(-1 * var(--spacing-6));
  border-radius: var(--radius-buttons);
}
.check-row:hover { background: var(--surface-2); }
.check-main { min-width: 0; display: flex; align-items: center; gap: var(--spacing-10); cursor: pointer; font-size: var(--text-body-sm); }
.check-main input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--cta-bg); cursor: pointer; }
.check-main input:disabled { cursor: not-allowed; }
.check-title { line-height: 1.4; word-break: break-word; }
.check-row.done .check-title { text-decoration: line-through; color: var(--muted); }
.check-who { min-width: 0; display: flex; align-items: center; gap: var(--spacing-6); font-size: var(--text-caption); color: var(--muted); }
.check-who > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-due { min-width: 0; }
.check-row .pill { height: 22px; font-size: 12px; }
.check-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .12s; }
.check-row:hover .check-actions, .check-row:focus-within .check-actions { opacity: 1; }
@media (hover: none) { .check-actions { opacity: 1; } }
.check-row.editing { display: block; padding: var(--spacing-8) var(--spacing-6); background: var(--surface-2); }
.step-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 150px; gap: var(--spacing-8); }
.step-form-actions { display: flex; justify-content: flex-end; gap: var(--spacing-8); margin-top: var(--spacing-8); }
/* Nova etapa: lista de etapas comuns + responsavel + prazo; embaixo, o texto livre. */
.step-add { display: flex; flex-direction: column; gap: var(--spacing-8); margin-top: var(--spacing-8); }
.step-add-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 150px auto; gap: var(--spacing-8); }

/* Anexos */
.drop-zone {
  display: flex; justify-content: center; align-items: baseline; gap: var(--spacing-6);
  padding: var(--spacing-12); margin-bottom: var(--spacing-10);
  text-align: center; cursor: pointer; font-size: var(--text-body-sm);
  border: 1px dashed var(--border); border-radius: var(--radius-cards);
  transition: border-color .16s ease, background .16s ease;
}
.drop-zone span { color: var(--muted); }
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--text); background: var(--surface-2); outline: none; }
.drop-zone.over { border-color: var(--text); border-style: solid; background: var(--surface-2); }
.file-list { display: flex; flex-direction: column; }
.file-row {
  display: flex; align-items: center; gap: var(--spacing-12);
  padding: var(--spacing-10) 0; border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: 0; }
.file-kind {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--radius-buttons); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--mono-font); font-size: var(--text-caption);
}
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { color: var(--text); font-size: var(--text-body-sm); font-weight: var(--font-weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { text-decoration: underline; }
.file-meta { color: var(--muted); font-size: var(--text-caption); }

/* Comentarios */
.comment-list { display: flex; flex-direction: column; gap: var(--spacing-16); margin-bottom: var(--spacing-24); }
.comment { display: flex; gap: var(--spacing-10); }
.comment .avatar { flex: none; margin-top: 2px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: var(--spacing-8); font-size: var(--text-body-sm); }
.comment-head span { color: var(--muted); font-size: var(--text-caption); }
.comment-head .spacer { flex: 1; }
.comment-body {
  margin-top: var(--spacing-4); padding: var(--spacing-10) var(--spacing-12);
  background: var(--surface-2); border-radius: var(--radius-cards);
  font-size: var(--text-body-sm); line-height: var(--leading-body-sm); white-space: pre-wrap; word-break: break-word;
}
.mention {
  padding: 0 3px; border-radius: 4px; font-weight: var(--font-weight-medium);
  background: color-mix(in srgb, var(--row-color, var(--text)) 16%, transparent);
}
.composer textarea { min-height: 64px; }
.composer-foot { display: flex; align-items: center; gap: var(--spacing-12); margin-top: var(--spacing-8); }
.composer-foot .spacer { flex: 1; }
.mention-wrap { position: relative; }
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + var(--spacing-4)); z-index: 5;
  width: 280px; max-width: 100%; padding: var(--spacing-6);
  background: var(--surface); border-radius: var(--radius-cards); box-shadow: var(--shadow-xl), var(--shadow-subtle-2);
}
.mention-option { gap: var(--spacing-8); }
.mention-option.active { background: var(--selected); }

@media (max-width: 640px) {
  .step-fields { grid-template-columns: 1fr; }
  .check-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--spacing-4); }
  .check-who, .check-due { grid-column: 1; padding-left: 28px; }
  .check-actions { grid-column: 2; grid-row: 1; }
  .step-add-row { grid-template-columns: 1fr 1fr; }
  .composer-foot .hint { display: none; }
}

/* Sino: avisos (o nao lido tem um ponto) e, embaixo, os prazos. */
.bell-head { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--spacing-8); }
.bell-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-head .btn { flex: none; }
.bell-sub { padding: var(--spacing-4) var(--spacing-10); font-family: var(--mono-font); font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .06em; color: var(--icon); }
.bell-empty { padding: var(--spacing-8) var(--spacing-10) var(--spacing-12); font-size: 13px; color: var(--muted); line-height: var(--leading-body-sm); }
.menu-item.notif { position: relative; padding-left: var(--spacing-20); }
.notif strong { font-weight: var(--font-weight-regular); }
.notif.unread strong { font-weight: var(--font-weight-semibold); }
.notif.unread::before {
  content: ''; position: absolute; left: 7px; top: 15px;
  width: 7px; height: 7px; border-radius: var(--radius-pills); background: var(--cta-bg);
}
.menu-item-2.notif > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item-2.notif > .notif-detail { color: var(--text); }

/* Quem tem data-person abre o cartao da pessoa ao clicar. */
[data-person] { cursor: pointer; }
.inline-person { display: inline-flex; align-items: center; gap: var(--spacing-6); }
.comment > [data-person] { flex: none; margin-top: 2px; }

/* Editar perfil */
.photo-pick { display: flex; align-items: center; gap: var(--spacing-16); margin-bottom: var(--spacing-20); }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--spacing-8); }
.photo-actions .hint { flex-basis: 100%; }
.form-section {
  display: flex; flex-direction: column; gap: 2px;
  margin: var(--spacing-8) 0 var(--spacing-16); padding-top: var(--spacing-16); border-top: 1px solid var(--border);
  font-size: var(--text-body); font-weight: var(--font-weight-medium);
}
.form-section span { font-size: 13px; font-weight: var(--font-weight-regular); color: var(--muted); }
.birthday-pick { display: flex; gap: var(--spacing-8); }
.birthday-pick select:first-child { width: 90px; flex: none; }

/* Cartao da pessoa */
.person-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--spacing-6); padding: var(--spacing-32) var(--spacing-24) var(--spacing-24); text-align: center; }
.person-close { position: absolute; top: var(--spacing-12); right: var(--spacing-12); }
.person-card h3 { margin-top: var(--spacing-8); font-size: var(--text-heading-sm); }
.person-sub, .person-birthday { color: var(--muted); font-size: 13px; }
.person-course { font-size: var(--text-body-sm); font-weight: var(--font-weight-medium); }
.person-bio { max-width: 360px; font-size: var(--text-body-sm); line-height: var(--leading-body-sm); white-space: pre-wrap; }
.contacts { width: 100%; display: flex; flex-direction: column; gap: var(--spacing-6); margin-top: var(--spacing-12); }
.contact {
  display: flex; justify-content: space-between; gap: var(--spacing-12); padding: var(--spacing-8) var(--spacing-12);
  border-radius: var(--radius-buttons); background: var(--surface-2); color: var(--text); font-size: var(--text-body-sm); text-decoration: none;
}
.contact:hover { background: var(--selected); }
.contact span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-actions { display: flex; gap: var(--spacing-8); margin-top: var(--spacing-12); }
.person-actions:empty { display: none; }

/* Pessoas da tarefa: montado das etapas (quem e o que faz). */
.people-list { display: flex; flex-direction: column; gap: var(--spacing-8); margin-top: var(--spacing-8); }
.people-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: var(--spacing-12); font-size: var(--text-body-sm); }
.people-row .inline-person { min-width: 0; }
.people-row .inline-person strong { font-weight: var(--font-weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-jobs { display: flex; flex-wrap: wrap; gap: var(--spacing-6); }
.job {
  padding: 1px var(--spacing-8); border-radius: var(--radius-pills);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); font-size: 12px;
}
.job.done { color: var(--muted); text-decoration: line-through; }
.people-empty { margin-top: var(--spacing-6); font-size: var(--text-body-sm); }
@media (max-width: 640px) { .people-row { grid-template-columns: 1fr; gap: var(--spacing-4); } }
