:root {
  --blue-900: #003d99;
  --blue-800: #0047b3;
  --blue-700: #0052cc;
  --blue-600: #1a66d9;
  --blue-500: #3380e6;
  --blue-100: #e8f0fc;
  --blue-50: #f3f7fd;
  --white: #ffffff;
  --gray-900: #1a2332;
  --gray-700: #3d4a5c;
  --gray-500: #6b7a90;
  --gray-300: #c5d0de;
  --gray-100: #eef2f7;
  --success: #1f9d6a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 8px 28px rgba(0, 61, 153, 0.12);
  --shadow-sm: 0 4px 14px rgba(0, 61, 153, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 72px;
  --header-h: 64px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--gray-900);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(51, 128, 230, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(0, 82, 204, 0.12), transparent 50%),
    linear-gradient(180deg, #f7faff 0%, #eef4fb 100%);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  width: min(480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  padding-bottom: calc(var(--nav-h) + 20px);
  overflow-x: hidden;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    linear-gradient(160deg, rgba(0, 61, 153, 0.92), rgba(0, 82, 204, 0.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 28px;
  padding: 36px 28px 28px;
  box-shadow: 0 24px 60px rgba(0, 30, 80, 0.28);
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--blue-700), var(--blue-900));
  display: grid;
  place-items: center;
  color: white;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  box-shadow: 0 12px 28px rgba(0, 61, 153, 0.35);
  animation: pulseSoft 2.8s ease-in-out infinite;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  text-align: center;
  color: var(--blue-900);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  border: 1.5px solid var(--gray-300);
  background: var(--blue-50);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus {
  border-color: var(--blue-600);
  background: white;
  box-shadow: 0 0 0 4px rgba(0, 82, 204, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-900));
  color: white;
  box-shadow: 0 10px 24px rgba(0, 61, 153, 0.3);
  margin-top: 8px;
}

.btn-primary:hover {
  box-shadow: 0 14px 30px rgba(0, 61, 153, 0.38);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.login-error {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
  animation: shake 0.4s ease;
}

.login-error.show {
  display: block;
}

.login-hint {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
  font-size: 0.78rem;
  color: var(--gray-500);
  text-align: center;
  line-height: 1.5;
}

/* ---------- App chrome ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 82, 204, 0.08);
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--blue-900);
  letter-spacing: -0.02em;
  flex: 1;
  text-align: center;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--blue-100);
  color: var(--blue-800);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: background 0.2s, transform 0.2s;
}

.icon-btn:hover {
  background: #d6e6fb;
  transform: translateY(-1px);
}

.icon-btn.ghost {
  background: transparent;
  visibility: hidden;
  pointer-events: none;
}

.page-content {
  padding: 20px 16px 28px;
  animation: fadeSlide 0.45s ease both;
}

/* ---------- Home ---------- */
.hero-home {
  background: linear-gradient(145deg, var(--blue-700), var(--blue-900));
  color: white;
  border-radius: 24px;
  padding: 24px 20px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-home::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  right: -40px;
  top: -50px;
  background: rgba(255, 255, 255, 0.08);
  animation: floatOrb 6s ease-in-out infinite;
}

.hero-home .greeting {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 6px;
}

.hero-home h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.hero-home .course {
  font-size: 0.92rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.menu-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 82, 204, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 132px;
  transition: transform 0.22s, box-shadow 0.22s;
  animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.menu-card:nth-child(1) { animation-delay: 0.05s; }
.menu-card:nth-child(2) { animation-delay: 0.1s; }
.menu-card:nth-child(3) { animation-delay: 0.15s; }
.menu-card:nth-child(4) { animation-delay: 0.2s; }
.menu-card:nth-child(5) { animation-delay: 0.25s; grid-column: 1 / -1; }

.menu-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.menu-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: var(--blue-100);
  color: var(--blue-800);
}

.menu-card h3 {
  font-size: 1rem;
  color: var(--blue-900);
}

.menu-card p {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.35;
}

/* ---------- Shared content blocks ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--blue-900);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.section-sub {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-box {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: riseIn 0.5s ease both;
}

.stat-box strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--blue-800);
  margin-bottom: 2px;
}

.stat-box span {
  font-size: 0.72rem;
  color: var(--gray-500);
}

.info-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 82, 204, 0.05);
  animation: riseIn 0.5s ease both;
}

.info-card:hover {
  box-shadow: var(--shadow);
}

.info-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--blue-100);
  color: var(--blue-800);
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #ffedd5;
  color: #9a3412;
}

.info-card h3 {
  font-size: 1.02rem;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.info-card p,
.info-card li {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.45;
}

.info-card ul {
  padding-left: 18px;
  margin-top: 8px;
}

.progress {
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-800));
  border-radius: inherit;
  transform-origin: left;
  animation: growBar 1s ease both;
}

.period-block {
  margin-bottom: 18px;
}

.period-block > h3 {
  font-size: 0.95rem;
  color: var(--blue-800);
  margin-bottom: 10px;
  font-weight: 750;
}

.table-like {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.table-like th,
.table-like td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--gray-100);
}

.table-like th {
  color: var(--gray-500);
  font-weight: 650;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.support-grid {
  display: grid;
  gap: 12px;
}

.support-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.support-item .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--blue-100);
  color: var(--blue-800);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}

.news-date {
  font-size: 0.75rem;
  color: var(--blue-600);
  font-weight: 700;
  margin-bottom: 6px;
}

/* ---------- Carteirinha / Perfil ---------- */
.profile-hero {
  background: linear-gradient(160deg, var(--blue-700), var(--blue-900));
  color: white;
  text-align: center;
  padding: 28px 20px 34px;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08), transparent 35%);
}

.profile-picture {
  position: relative;
  width: 96px;
  margin: 0 auto 14px;
  z-index: 1;
}

.profile-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  animation: riseIn 0.55s ease both;
}

.camera-icon {
  position: absolute;
  right: -2px;
  bottom: 2px;
  width: 30px;
  height: 30px;
  background: white;
  color: var(--blue-800);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.profile-info {
  position: relative;
  z-index: 1;
}

.profile-info h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.profile-info p {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 4px;
}

.card-container {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin: -18px 16px 20px;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  z-index: 2;
  animation: riseIn 0.6s 0.1s ease both;
}

.card-container .logo {
  width: 140px;
  margin: 0 auto 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}

.card-details {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  text-align: left;
}

.card-details strong {
  display: block;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.card-details p {
  color: var(--blue-900);
  font-weight: 750;
}

.access-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-900));
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0, 61, 153, 0.28);
  transition: transform 0.2s, box-shadow 0.2s;
}

.access-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 61, 153, 0.35);
}

.profile-page .topbar {
  background: transparent;
  border: none;
  color: white;
  position: absolute;
  width: 100%;
  left: 0;
}

.profile-page .topbar h1 {
  color: white;
}

.profile-page .icon-btn {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.placeholder-card {
  margin: 24px 16px;
  background: white;
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: riseIn 0.55s ease both;
}

.placeholder-card .big-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.placeholder-card h2 {
  font-family: var(--font-display);
  color: var(--blue-900);
  margin-bottom: 8px;
}

.placeholder-card p {
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 82, 204, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 40;
  padding: 0 4px env(safe-area-inset-bottom);
  box-shadow: 0 -8px 24px rgba(0, 40, 100, 0.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--gray-500);
  font-size: 0.68rem;
  font-weight: 650;
  padding: 8px 4px;
  border-radius: 12px;
  transition: color 0.2s, transform 0.2s;
}

.nav-item .ico {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue-700);
}

.nav-item.active {
  transform: translateY(-2px);
}

.loading-screen {
  min-height: 60vh;
  display: grid;
  place-items: center;
  color: var(--gray-500);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}

/* ---------- Animations ---------- */
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-12px, 10px); }
}

@keyframes growBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 481px) {
  body {
    background:
      radial-gradient(1000px 700px at 20% 0%, rgba(0, 82, 204, 0.15), transparent 50%),
      #dfeaf8;
  }

  .app-shell {
    box-shadow: 0 0 0 1px rgba(0, 82, 204, 0.06), 0 20px 60px rgba(0, 40, 100, 0.12);
    background: linear-gradient(180deg, #f7faff 0%, #eef4fb 100%);
  }
}
