:root {
  --bg: #E8EFED;
  --bg-deep: #0B4A48;
  --paper: #F7FAF9;
  --surface: #FFFFFF;
  --ink: #14201E;
  --muted: #5A6B67;
  --teal: #1F6E67;
  --teal-deep: #0B4A48;
  --teal-soft: #D8E8E5;
  --accent: #8A7348;
  --line: rgba(11, 74, 72, 0.12);
  --shadow: 0 18px 48px rgba(11, 74, 72, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--teal);
}

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  margin: 0;
}

.muted { color: var(--muted); margin: 8px 0 0; }

input, button, textarea, select { font: inherit; }

/* ——— Login ——— */
.login-screen {
  display: none !important;
  min-height: 100vh;
  place-items: center;
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
  z-index: 30;
}

.login-screen.is-visible { display: grid !important; }
.login-screen[hidden] { display: none !important; }

.portal[hidden] { display: none !important; }

.login-ambient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 12% 18%, rgba(31, 110, 103, 0.28), transparent 55%),
    radial-gradient(ellipse 55% 45% at 88% 78%, rgba(138, 115, 72, 0.14), transparent 50%),
    linear-gradient(165deg, #DDE8E5 0%, #F0F5F3 42%, #E4ECEA 100%);
  animation: ambient-drift 18s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.04) translate(-1%, 1%); }
}

.login-panel {
  position: relative;
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(11, 74, 72, 0.1);
  border-radius: 20px;
  padding: 36px 30px 28px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
  animation: panel-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-logo {
  display: block;
  width: min(220px, 70%);
  height: auto;
  margin: 0 auto 4px;
  object-fit: contain;
}

.brand-logo-sm {
  width: min(160px, 40vw);
  margin: 0;
  border-radius: 8px;
  background: #fff;
  padding: 4px 8px;
}

.login-panel h1 {
  font-size: clamp(2rem, 5vw, 2.45rem);
  color: var(--teal-deep);
  line-height: 1.08;
}

.lede {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.login-help {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.pass-wrap {
  position: relative;
  display: block;
}

.pass-wrap input {
  width: 100%;
  padding-right: 44px;
}

.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.pass-toggle:hover { color: var(--teal-deep); }
.pass-toggle svg { width: 18px; height: 18px; }

.login-panel label,
.info-card label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

input {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: rgba(31, 110, 103, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 110, 103, 0.12);
}

.login-panel button[type="submit"],
.cert-btn {
  margin-top: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s, filter 0.2s;
}

.login-panel button[type="submit"]:hover,
.cert-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.back-link {
  text-align: center;
  color: var(--teal);
  font-size: 0.88rem;
  text-decoration: none;
  margin-top: 4px;
}

.back-link:hover { text-decoration: underline; }

.error {
  background: #FCE8E6;
  color: #8B2E26;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

/* ——— Portal ——— */
.portal {
  display: none !important;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.portal.is-visible { display: block !important; }
.portal[hidden] { display: none !important; }

.portal-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 0% 0%, rgba(31, 110, 103, 0.16), transparent 55%),
    radial-gradient(ellipse 45% 35% at 100% 8%, rgba(138, 115, 72, 0.1), transparent 50%),
    linear-gradient(180deg, #D5E4E1 0%, var(--bg) 28%, var(--paper) 100%);
  z-index: 0;
}

.portal-top,
.portal-nav,
.portal-main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

.portal-top {
  padding: 28px 24px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  animation: panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.portal-top .eyebrow { color: var(--teal-deep); opacity: 0.85; }

.portal-top h1 {
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  color: var(--teal-deep);
  line-height: 1.1;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--teal-deep);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}

.ghost-btn:hover {
  background: #fff;
  border-color: rgba(11, 74, 72, 0.28);
}

.portal-nav {
  padding: 8px 24px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 2px;
  border-bottom: 1px solid var(--line);
  animation: panel-in 0.55s 0.06s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: transparent;
  border-radius: 2px;
  transition: background 0.2s;
}

.tab:hover { color: var(--teal-deep); }

.tab.is-active {
  color: var(--teal-deep);
}

.tab.is-active::after {
  background: var(--teal);
}

.portal-main {
  padding: 22px 24px 56px;
  animation: panel-in 0.6s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ——— Hero ——— */
.hero-card {
  background:
    linear-gradient(125deg, rgba(11, 74, 72, 0.92), rgba(31, 110, 103, 0.88) 55%, rgba(11, 74, 72, 0.95)),
    var(--teal-deep);
  color: #F7FAF9;
  border-radius: 20px;
  padding: 28px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  box-shadow: 0 22px 50px rgba(11, 74, 72, 0.22);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(138, 115, 72, 0.18), transparent 45%);
  pointer-events: none;
}

.hero-card-copy,
.hero-card-aside {
  position: relative;
  z-index: 1;
}

.hero-card .eyebrow {
  color: rgba(247, 250, 249, 0.75);
}

.hero-card h2 {
  font-size: clamp(1.65rem, 3.2vw, 2.35rem);
  color: #fff;
  max-width: 22ch;
  line-height: 1.12;
}

.hero-card .muted {
  color: rgba(247, 250, 249, 0.78);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.hero-card-aside {
  text-align: right;
  flex-shrink: 0;
}

.hero-aside-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: rgba(247, 250, 249, 0.65);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  white-space: nowrap;
}

.status-pill.is-pago {
  background: rgba(226, 240, 229, 0.95);
  color: #1F5A2E;
}

.status-pill.is-pendente {
  background: rgba(227, 236, 245, 0.95);
  color: #2E4A66;
}

/* ——— Sections ——— */
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.section-head {
  margin: 0 0 18px;
}

.section-head h3 {
  font-size: clamp(1.45rem, 2.5vw, 1.75rem);
  color: var(--teal-deep);
}

.section-head .muted {
  margin-top: 4px;
  max-width: 48ch;
  line-height: 1.5;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 8px 28px rgba(11, 74, 72, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(11, 74, 72, 0.08);
}

.info-card h3 {
  font-size: 1.35rem;
  color: var(--teal-deep);
  margin-bottom: 14px;
}

.info-card dl {
  margin: 0;
  display: grid;
  gap: 12px;
}

.info-card dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.info-card dd {
  margin: 3px 0 0;
  font-size: 0.98rem;
}

.address {
  margin: 0;
  line-height: 1.6;
  color: var(--ink);
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.shortcut-list button {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--teal-deep);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.shortcut-list button:hover {
  background: var(--teal-soft);
  border-color: rgba(31, 110, 103, 0.25);
  transform: translateX(3px);
}

.cert-card {
  background:
    linear-gradient(160deg, rgba(11, 74, 72, 0.05), transparent 50%),
    var(--surface);
  border-color: rgba(31, 110, 103, 0.18);
  max-width: 520px;
}

.cert-code {
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  color: var(--teal-deep);
  font-weight: 600;
  margin: 10px 0;
}

.cert-btn {
  margin-top: 14px;
  width: fit-content;
}

.cert-card.is-locked .cert-btn { display: none; }

.aula-list,
.material-list {
  display: grid;
  gap: 12px;
}

.aula-item,
.material-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 6px 22px rgba(11, 74, 72, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.aula-item:hover,
.material-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(11, 74, 72, 0.08);
}

.aula-item h4,
.material-item h4 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  color: var(--teal-deep);
}

.aula-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.aula-actions,
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.aula-actions a,
.ghost-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal-deep);
  cursor: pointer;
  font: inherit;
  transition: background 0.2s, border-color 0.2s;
}

.aula-actions a:hover,
.ghost-dark:hover {
  background: var(--paper);
  border-color: rgba(11, 74, 72, 0.28);
}

.aula-actions a.primary {
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
  color: #fff;
  border: none;
}

.aula-actions a.primary:hover {
  filter: brightness(1.05);
}

.badge-aula {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  margin-bottom: 8px;
}

.badge-aula.is-ao-vivo { background: #E2F0E5; color: #2F6B3A; }
.badge-aula.is-encerrada { background: #EDF1F1; color: #5C6B66; }

.empty-note {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  color: var(--muted);
  text-align: center;
}

/* ——— Perfil foto ——— */
.perfil-foto-card .perfil-foto-layout {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
}

.perfil-foto-preview-wrap {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--teal-soft);
  box-shadow: 0 0 0 3px rgba(31, 110, 103, 0.15);
  background: linear-gradient(160deg, #E4EEEC, #F0F5F3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.perfil-foto {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.perfil-foto-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  font-size: 0.72rem;
  text-align: center;
  padding: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.perfil-foto-empty svg {
  width: 36px;
  height: 36px;
  color: var(--teal);
  opacity: 0.7;
}

.perfil-foto-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.perfil-file-btn {
  cursor: pointer;
  color: #fff !important;
}

.perfil-senha-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.perfil-senha-form .cert-btn {
  justify-self: start;
  margin-top: 4px;
}

.acesso-result {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(31, 110, 103, 0.1);
  color: var(--teal-deep);
  font-size: 0.9rem;
}

/* ——— Termo ——— */
.termo-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 28, 26, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.termo-overlay[hidden] {
  display: none !important;
}

.termo-modal {
  width: min(760px, 100%);
  max-height: min(92vh, 860px);
  background: var(--paper);
  border-radius: 16px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(11, 74, 72, 0.28);
  animation: panel-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.termo-header {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.termo-header h2 {
  color: var(--teal-deep);
  font-size: 1.7rem;
}

.termo-scroll {
  flex: 1;
  overflow: auto;
  padding: 18px 24px;
  background: #fff;
}

.termo-block { margin-bottom: 18px; }

.termo-block h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--teal-deep);
}

.termo-block p,
.termo-intro {
  margin: 0;
  white-space: pre-wrap;
  color: #2A3532;
  font-size: 0.92rem;
  line-height: 1.55;
}

.termo-ces-box {
  background: var(--teal-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--teal-deep);
}

.termo-end-marker {
  text-align: center;
  padding: 18px 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.termo-footer {
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: grid;
  gap: 10px;
}

.termo-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.termo-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
}

.termo-check input { margin-top: 3px; }

#termo-accept:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 780px) {
  .grid-cards { grid-template-columns: 1fr; }
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-card-aside { text-align: left; }
  .portal-top { padding-top: 20px; }
  .portal-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .portal-nav::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 12px 12px; font-size: 0.85rem; }
  .portal-brand { gap: 10px; }
  .termo-modal { max-height: 96vh; }
}
