:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-soft: #f9fbfb;
  --ink: #1f2933;
  --muted: #687383;
  --line: #dde4e7;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --teal: #0f766e;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --rose: #e11d48;
  --shadow: 0 20px 50px rgba(31, 41, 51, 0.11);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(15, 118, 110, 0.1), transparent 32%),
    var(--bg);
  background-size: 140% 140%, 130% 130%, auto;
  letter-spacing: 0;
  overflow-x: hidden;
  animation: ambientShift 18s var(--ease-out) infinite alternate;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  transition:
    transform 0.22s var(--ease-spring),
    box-shadow 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    filter 0.22s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.is-hidden {
  display: none !important;
}

body.app-active .auth-screen {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
}

.auth-panel {
  position: relative;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 0.75fr);
  overflow: hidden;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  animation: authPanelIn 0.72s var(--ease-out) both;
}

.auth-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 44px;
  color: white;
  background: #1f2933;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.auth-brand::before {
  background:
    linear-gradient(180deg, rgba(31, 41, 51, 0.15), rgba(31, 41, 51, 0.88)),
    linear-gradient(135deg, rgba(15, 118, 110, 0.82), rgba(37, 99, 235, 0.28) 42%, rgba(31, 41, 51, 0.78));
}

.auth-brand::after {
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(31, 41, 51, 0.68));
}

.auth-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scale(1.04);
  animation: slowZoom 18s var(--ease-out) infinite alternate;
}

.auth-brand-content {
  position: relative;
  z-index: 2;
  animation: fadeUp 0.72s 0.12s var(--ease-out) both;
}

.brand-mark,
.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  font-weight: 800;
  color: #102018;
  background: #facc15;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.auth-brand p {
  margin: 22px 0 12px;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 700;
}

.auth-brand h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1;
}

.auth-card {
  align-self: center;
  padding: 36px;
  animation: formSlideIn 0.62s 0.08s var(--ease-out) both;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 26px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.auth-tab {
  border: 0;
  border-radius: 8px;
  padding: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.auth-tab.active {
  color: white;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.auth-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.auth-feedback {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-size: 14px;
  font-weight: 700;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.app:not(.is-hidden) .sidebar {
  animation: sidebarIn 0.48s var(--ease-out) both;
}

.app:not(.is-hidden) .content {
  animation: contentIn 0.52s 0.04s var(--ease-out) both;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 22px;
  color: white;
  background: #1f2933;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  flex: 0 0 auto;
}

.sidebar h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.1;
}

.sidebar p {
  margin: 0;
  color: #bdc9d1;
}

.profile-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  animation: fadeUp 0.46s 0.08s var(--ease-out) both;
}

.profile-card > div {
  min-width: 0;
}

.avatar {
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: white;
  background: var(--teal);
  cursor: pointer;
  font-weight: 800;
}

.avatar::after {
  content: "Editar";
  position: absolute;
  inset: auto 0 0;
  padding: 2px 0 3px;
  color: white;
  background: rgba(31, 41, 51, 0.78);
  font-size: 9px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}

.avatar:hover::after,
.avatar:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar span {
  color: white;
  font-size: 14px;
}

.profile-card small,
.profile-card span {
  display: block;
  color: #bdc9d1;
  font-size: 12px;
}

.profile-card .avatar span {
  color: white;
  font-size: 14px;
}

.profile-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.profile-photo-btn {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  margin-top: 7px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #facc15;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.profile-photo-btn:hover {
  color: white;
  background: transparent;
  box-shadow: none;
}

.nav-toggle {
  display: none;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0 14px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-weight: 800;
}

.nav-toggle span:last-child {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #102018;
  background: #facc15;
}

.sidebar nav {
  display: grid;
  gap: 10px;
}

.sidebar nav button {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f4f7f8;
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
  text-align: left;
}

.sidebar nav button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #facc15;
  opacity: 0;
  transform: scaleY(0.45);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}

.sidebar nav button.active,
.sidebar nav button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.25);
}

.sidebar nav button.active::before,
.sidebar nav button:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.content {
  padding: 34px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  animation: fadeUp 0.5s 0.08s var(--ease-out) both;
}

.topbar h2 {
  margin: 0 0 8px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.02;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sync-status.is-ok {
  color: var(--green);
}

.sync-status.is-error {
  color: var(--red);
}

.motivation-strip {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  border-radius: 8px;
  padding: 18px 20px;
  color: white;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.96), rgba(37, 99, 235, 0.92) 58%, rgba(31, 41, 51, 0.96)),
    #1f2933;
  box-shadow: 0 16px 36px rgba(31, 41, 51, 0.12);
  animation: fadeUp 0.42s 0.12s var(--ease-out) both;
}

.motivation-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  transform: translateX(-100%);
  animation: shineAcross 7s ease-in-out infinite;
  pointer-events: none;
}

.motivation-strip span {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.motivation-strip p {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 800;
  line-height: 1.25;
}

.motivation-strip p.is-changing {
  animation: messageSwap 0.42s var(--ease-out) both;
}

.add-btn,
.ghost-btn,
.secondary-btn {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.add-btn {
  border: 0;
  color: white;
  background: var(--primary);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.ghost-btn,
.secondary-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
}

.secondary-btn {
  color: white;
  border-color: transparent;
  background: var(--teal);
}

.calendar-panel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.card,
.panel {
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 36px rgba(31, 41, 51, 0.08);
  transition:
    transform 0.24s var(--ease-spring),
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  animation: riseIn 0.45s var(--ease-out) both;
}

.card:nth-child(2) {
  animation-delay: 0.06s;
}

.card:nth-child(3) {
  animation-delay: 0.12s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--primary);
}

.accent-blue::before {
  background: var(--primary);
}

.accent-amber::before {
  background: var(--amber);
}

.accent-red::before {
  background: var(--red);
}

.accent-teal::before {
  background: var(--teal);
}

.accent-green::before {
  background: var(--green);
}

.card:hover,
.panel:hover,
.materia-card:hover,
.falta-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(31, 41, 51, 0.12);
  border-color: rgba(37, 99, 235, 0.14);
}

.card h3 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}

.card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 42px;
  line-height: 1;
  color: var(--ink);
}

.card p {
  margin: 0;
  color: var(--muted);
}

.panel {
  padding: 20px;
}

.panel > h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeUp 0.32s var(--ease-out) both;
}

.calendar-view.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h3 {
  margin: 0;
  font-size: 22px;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-actions strong {
  min-width: 170px;
  text-align: center;
  text-transform: capitalize;
}

.icon-btn,
.today-btn {
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: #e7eefb;
  cursor: pointer;
}

.icon-btn {
  width: 38px;
  height: 38px;
  font-size: 26px;
  line-height: 1;
}

.today-btn {
  min-height: 38px;
  padding: 0 12px;
}

.icon-btn:hover,
.today-btn:hover {
  background: #d5e1f8;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.calendar-weekdays span {
  padding: 8px 0;
}

.calendar-grid {
  gap: 8px;
}

.calendar-day,
.calendar-empty {
  min-height: 112px;
  border-radius: 8px;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 10px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.calendar-day:hover,
.calendar-day.selected {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.13);
  background: #fbfdff;
}

.calendar-day.today .calendar-number {
  color: var(--primary);
  font-weight: 800;
}

.calendar-number {
  font-size: 15px;
  font-weight: 700;
}

.calendar-events {
  display: grid;
  gap: 5px;
}

.calendar-event {
  overflow: hidden;
  border-radius: 8px;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: fadeUp 0.24s var(--ease-out) both;
}

.event-atividade {
  color: #92400e;
  background: #fef3c7;
}

.event-prova {
  color: #991b1b;
  background: #fee2e2;
}

.event-seminario {
  color: #1d4ed8;
  background: #dbeafe;
}

.event-hospital {
  color: #0f766e;
  background: #ccfbf1;
}

.event-feriado,
.event-ponto-facultativo {
  color: #166534;
  background: #dcfce7;
}

.event-concluida {
  opacity: 0.62;
}

.event-more {
  color: var(--muted);
  background: #eef2f4;
}

.calendar-event[style*="--event-color"] {
  color: var(--event-text);
  background: var(--event-bg);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(31, 41, 51, 0.05);
}

.legend-prova {
  background: var(--red);
}

.legend-visita {
  background: var(--teal);
}

.legend-seminario {
  background: var(--primary);
}

.legend-atividade {
  background: var(--amber);
}

.legend-feriado {
  background: var(--green);
}

.calendar-side {
  display: grid;
  gap: 18px;
}

.mini-event,
.holiday-item {
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-soft);
  margin-bottom: 12px;
  animation: fadeUp 0.28s var(--ease-out) both;
  transition: transform 0.2s var(--ease-spring), background 0.2s ease;
}

.mini-event:hover,
.holiday-item:hover {
  transform: translateX(2px);
}

.mini-event strong,
.holiday-item strong {
  display: block;
  margin: 4px 0;
}

.mini-event span,
.holiday-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-event p,
.holiday-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.mini-event.event-prova {
  border-left-color: var(--red);
}

.mini-event.event-seminario {
  border-left-color: var(--primary);
}

.mini-event.event-hospital {
  border-left-color: var(--teal);
}

.mini-event.event-feriado,
.mini-event.event-ponto-facultativo {
  border-left-color: var(--green);
}

.mini-event[style*="--event-color"] {
  border-left-color: var(--event-color);
  background: var(--event-bg);
}

.materia-form,
.topico-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 18px;
}

.materia-form {
  grid-template-columns: minmax(0, 1fr) 150px auto;
}

.materia-form.is-collapsed {
  display: none;
}

.novo-tipo-box.is-collapsed {
  display: none;
}

.tipo-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.tipo-actions {
  display: flex;
  gap: 8px;
}

.tipo-add-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--primary);
  background: #eff6ff;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.tipo-add-btn:hover {
  background: #dbeafe;
}

.tipo-remove-btn {
  border: 1px solid #fecaca;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 12px;
  color: var(--red);
  background: #fff5f5;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.tipo-remove-btn:hover:not(:disabled) {
  background: #fee2e2;
}

.tipo-remove-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.novo-tipo-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.color-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.color-field input {
  min-height: 44px;
  padding: 4px;
  cursor: pointer;
}

.materias-list,
.faltas-list {
  display: grid;
  gap: 16px;
}

.materia-card,
.falta-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  animation: fadeUp 0.3s var(--ease-out) both;
  transition:
    transform 0.22s var(--ease-spring),
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.materia-header,
.falta-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.materia-header h4,
.falta-header h4 {
  margin: 0;
  font-size: 20px;
}

.falta-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.materia-header button,
.topico-remove {
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  cursor: pointer;
  font-weight: 700;
}

.materia-header button {
  padding: 9px 12px;
}

.hours-field {
  display: grid;
  gap: 6px;
  min-width: 118px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hours-field input {
  min-height: 34px;
  padding: 8px 10px;
}

.falta-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.toggle-grid-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--primary);
  background: #eff6ff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toggle-grid-btn:hover {
  background: #dbeafe;
}

.absence-progress {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: #e9eef2;
}

.absence-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width 0.25s ease;
}

.absence-grid {
  display: grid;
  grid-template-columns: repeat(var(--absence-columns, 10), 22px);
  gap: 5px;
  justify-content: start;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.absence-cell {
  width: 22px;
  height: 22px;
  border: 1px solid #d6e1e5;
  border-radius: 3px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.absence-cell:hover {
  border-color: var(--red);
  background: #fff7ed;
}

.absence-cell.is-absent {
  border-color: var(--red);
  color: white;
  background: var(--red);
}

.study-progress {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e9eef2;
}

.study-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.35s ease;
}

.study-count {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.topico-list {
  display: grid;
  gap: 10px;
}

.topico-empty {
  margin: 0;
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
}

.topico-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
  animation: fadeUp 0.25s var(--ease-out) both;
  transition: background 0.2s ease, transform 0.2s var(--ease-spring);
}

.topico-item:hover {
  transform: translateX(2px);
  background: #eef6f5;
}

.topico-check {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--ink);
}

.topico-check input {
  width: auto;
  accent-color: var(--teal);
}

.topico-check span {
  overflow-wrap: anywhere;
}

.topico-item.estudado .topico-check span {
  color: var(--muted);
  text-decoration: line-through;
}

.topico-remove {
  flex: 0 0 auto;
  padding: 8px 10px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 51, 0.55);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(31, 41, 51, 0.24);
  position: relative;
  animation: popIn 0.28s var(--ease-out) both;
}

.modal-content h2 {
  margin: 0 0 20px;
  color: var(--primary);
}

.fechar {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group,
.date-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-size: 15px;
  color: var(--ink);
  background: white;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s var(--ease-spring),
    background 0.2s ease;
}

textarea {
  min-height: 90px;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.input-group:focus-within span,
.date-field:focus-within span {
  color: var(--primary);
}

.date-field input {
  min-height: 48px;
  appearance: auto;
  -webkit-appearance: none;
}

.date-field input::-webkit-date-and-time-value {
  min-height: 1.4em;
  text-align: left;
}

form button {
  border: none;
  background: var(--primary);
  color: white;
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

form button:hover,
.add-btn:hover {
  background: var(--primary-dark);
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cancelar {
  background: #eef2f4;
  color: var(--ink);
}

.atividade {
  background: var(--surface-soft);
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  border-left: 6px solid var(--primary);
  animation: fadeUp 0.28s var(--ease-out) both;
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.atividade:hover {
  transform: translateX(2px);
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

.atividade.concluida {
  background: #f3fcf6;
}

.atividade h4 {
  font-size: 16px;
  margin: 0 0 6px;
}

.atividade p {
  color: var(--muted);
  margin: 0 0 3px;
  font-size: 14px;
}

.atividade .acoes {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.atividade button {
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.concluir {
  background: var(--green);
  color: white;
}

.reabrir {
  background: var(--amber);
  color: white;
}

.alterar-data {
  background: var(--teal);
  color: white;
}

.excluir {
  background: var(--red);
  color: white;
}

.prioridade-alta {
  border-left-color: var(--red);
}

.prioridade-media {
  border-left-color: var(--amber);
}

.prioridade-baixa {
  border-left-color: var(--green);
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
}

@media (max-width: 900px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 320px;
    padding: 34px;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 22px 20px;
  }

  .nav-toggle {
    display: flex;
  }

  .sidebar nav {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .sidebar.nav-open nav {
    display: grid;
  }

  .sidebar nav button {
    text-align: center;
  }

  .content {
    padding: 22px 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .calendar-view.active {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays,
  .calendar-grid {
    min-width: 640px;
  }
}

@media (max-width: 560px) {
  .auth-screen {
    padding: 12px;
  }

  .auth-brand,
  .auth-card {
    padding: 24px 18px;
  }

  .auth-brand {
    min-height: 280px;
  }

  .auth-brand h1 {
    font-size: 34px;
  }

  .sidebar {
    padding: 18px 14px;
  }

  .brand-block {
    align-items: flex-start;
  }

  .sidebar h1 {
    font-size: 24px;
  }

  .sidebar p {
    font-size: 14px;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sidebar nav button {
    min-height: 44px;
    padding: 10px;
    font-size: 14px;
  }

  .content {
    padding: 16px 12px 24px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 20px;
  }

  .topbar p {
    font-size: 14px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cards {
    gap: 12px;
    margin-bottom: 16px;
  }

  .motivation-strip {
    margin-bottom: 16px;
    padding: 16px;
  }

  .motivation-strip p {
    font-size: 18px;
  }

  .card {
    padding: 16px;
  }

  .card h3 {
    margin-bottom: 10px;
  }

  .card strong {
    font-size: 34px;
  }

  .panel {
    padding: 16px;
  }

  .panel > h3,
  .panel-header h3 {
    font-size: 18px;
  }

  .panel-header,
  .calendar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-actions strong {
    min-width: 0;
  }

  .calendar-actions {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    grid-template-areas:
      "prev mes next"
      "hoje hoje hoje";
  }

  #mesAnterior {
    grid-area: prev;
  }

  #calendarioMes {
    grid-area: mes;
  }

  #mesProximo {
    grid-area: next;
  }

  .today-btn {
    grid-area: hoje;
  }

  .icon-btn,
  .today-btn {
    min-height: 44px;
  }

  .calendar-grid {
    gap: 5px;
  }

  .calendar-weekdays,
  .calendar-grid {
    min-width: 590px;
  }

  .calendar-day,
  .calendar-empty {
    min-height: 88px;
  }

  .calendar-day {
    padding: 7px;
  }

  .calendar-event {
    padding: 4px 5px;
    font-size: 11px;
  }

  .calendar-legend {
    gap: 9px 12px;
    font-size: 13px;
  }

  .modal {
    align-items: flex-start;
    overflow-y: auto;
    padding: 12px;
  }

  .modal-content {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 22px 18px;
  }

  input,
  select,
  textarea,
  form button {
    min-height: 44px;
    padding: 12px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }

  .tipo-field {
    grid-template-columns: 1fr;
  }

  .tipo-actions button {
    flex: 1 1 0;
  }

  .materia-form,
  .topico-form {
    grid-template-columns: 1fr;
  }

  .materia-header,
  .falta-header,
  .topico-item {
    align-items: stretch;
    flex-direction: column;
  }

  .falta-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .absence-grid {
    grid-template-columns: repeat(var(--absence-columns, 10), 28px);
    gap: 7px;
  }

  .absence-cell {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .materia-card,
  .falta-card {
    padding: 14px;
  }

  .atividade {
    padding: 12px;
  }

  .atividade .acoes button {
    flex: 1 1 120px;
    min-height: 40px;
  }
}

@media (max-width: 380px) {
  .sidebar nav {
    grid-template-columns: 1fr;
  }

  .content {
    padding-inline: 10px;
  }

  .top-actions {
    grid-template-columns: 1fr;
  }
}

@keyframes ambientShift {
  from {
    background-position: 0% 0%, 100% 0%, center;
  }

  to {
    background-position: 100% 22%, 0% 100%, center;
  }
}

@keyframes authPanelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes formSlideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes sidebarIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slowZoom {
  from {
    transform: scale(1.04);
  }

  to {
    transform: scale(1.1);
  }
}

@keyframes shineAcross {
  0%,
  62% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes messageSwap {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
