/* ════════════════════════════════════
   TOKENS
════════════════════════════════════ */
:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-soft: #f9f8f6;
  --border: #e4e2dd;
  --text: #1a1714;
  --muted: #6b6460;
  --accent: #e4b062;
  --accent-deep: #a96c15;
  --accent-green: #4e7a65;
  --danger: #b94040;
  --success: #3d6e52;
  --light: #fff8ef;
  --sidebar-bg: #16130f;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --r: 16px;
  --r-sm: 10px;
  --nav-h: 60px;
}

/* ════════════════════════════════════
   BASE — MOBILE FIRST
════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.auth-booting .members-content,
body.auth-booting .state-panel { display: none; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.hidden { display: none !important; }

.brand-kicker,
.eyebrow,
.module-kicker {
  margin: 0;
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-green);
}

.lesson-type {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(228,176,98,0.15);
  color: var(--accent-deep);
}
.lesson-type.text      { background: rgba(78,122,101,0.12); color: var(--accent-green); }
.lesson-type.pdf,
.lesson-type.template,
.lesson-type.checklist { background: rgba(26,23,20,0.07); color: var(--text); }
.lesson-type.prompt,
.lesson-type.script    { background: rgba(247,208,137,0.25); color: #895b12; }

/* ════════════════════════════════════
   LAYOUT — MOBILE
════════════════════════════════════ */
.app-shell { display: block; min-height: 100vh; }

.sidebar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.sidebar-brand,
.sidebar-user,
.sidebar-note { display: none; }

.sidebar-nav {
  display: flex;
  justify-content: space-around;
  gap: 2px;
}

.nav-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 4px;
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,248,239,0.45);
  text-align: center;
  transition: background 140ms, color 140ms;
}
.nav-item:hover,
.nav-item.active { color: var(--light); background: rgba(255,255,255,0.1); }

.main-panel {
  padding: 14px;
  padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
}

/* ════════════════════════════════════
   TOPBAR
════════════════════════════════════ */
.topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.topbar h2 {
  margin: 4px 0 0;
  font-family: "Poppins", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.member-chip {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.member-chip span  { display: block; font-size: 11px; color: var(--muted); }
.member-chip strong{ display: block; font-size: 13px; font-weight: 600; }
.member-chip small { font-size: 11px; color: var(--muted); }

.ghost-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

/* ════════════════════════════════════
   BANNERS
════════════════════════════════════ */
.system-banner,
.state-panel {
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.system-banner {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--muted);
}
.system-banner code {
  background: rgba(26,23,20,0.07);
  padding: 1px 6px; border-radius: 5px; font-size: 12px;
}
.state-panel { display: flex; flex-direction: column; gap: 12px; }
.state-panel h3 {
  margin: 4px 0;
  font-family: "Poppins", sans-serif;
  font-size: 1rem; font-weight: 700;
}
.state-panel p { margin: 0; font-size: 13px; color: var(--muted); }

/* ════════════════════════════════════
   BOTÕES
════════════════════════════════════ */
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-weight: 600; font-size: 14px;
  border: 0; cursor: pointer; width: 100%;
  transition: opacity 150ms, transform 150ms;
}
.btn:active { opacity: 0.88; transform: scale(0.98); }
.btn-primary  { background: linear-gradient(135deg, var(--accent), #f0c47a); color: #18120d; }
.btn-secondary{ background: var(--surface); border: 1px solid var(--border); color: var(--text); }

/* ════════════════════════════════════
   DASHBOARD
════════════════════════════════════ */
.dashboard-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
}
.hero-card h3 {
  margin: 6px 0 8px;
  font-family: "Poppins", sans-serif;
  font-size: 1.15rem; font-weight: 700; line-height: 1.2;
}
.hero-copy p { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.6; }
.hero-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.hero-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-top: 16px;
}
.stat-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 10px; text-align: center;
}
.stat-box strong {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 2px; color: var(--accent-deep);
}
.stat-box span { font-size: 11px; color: var(--muted); font-weight: 500; }

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow);
}
.card-title {
  margin: 0 0 10px;
  font-family: "Poppins", sans-serif;
  font-size: 13px; font-weight: 700;
}
.clean-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.clean-list li {
  position: relative; padding-left: 14px;
  font-size: 13px; color: var(--muted);
}
.clean-list li::before {
  content: ""; position: absolute;
  left: 0; top: 7px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent);
}

/* ════════════════════════════════════
   CABEÇALHOS DE SEÇÃO
════════════════════════════════════ */
.section-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.section-head h2 {
  margin: 5px 0 0;
  font-family: "Poppins", sans-serif;
  font-size: 1.25rem; font-weight: 700; line-height: 1.2;
}

.shelf-section  { margin-bottom: 24px; }
.modules-section{ margin-bottom: 8px; }

/* ════════════════════════════════════
   CATÁLOGO — miniaturas visuais
════════════════════════════════════ */
.poster-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.poster-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 160ms, box-shadow 160ms;
  color: var(--text);
}
.poster-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.poster-thumb {
  position: relative;
  height: 140px;
  overflow: hidden;
}
.poster-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.poster-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
}

.poster-body {
  padding: 12px; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.poster-body strong {
  font-family: "Poppins", sans-serif;
  font-size: 13px; font-weight: 700; line-height: 1.3;
}
.poster-body p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.4; }

/* ════════════════════════════════════
   MÓDULOS
════════════════════════════════════ */
.module-card,
.resource-section,
.faq-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}

#modulo-1 { border-top: 3px solid #764ba2; }
#modulo-2 { border-top: 3px solid #4f46e5; }
#modulo-3 { border-top: 3px solid #11998e; }
#modulo-4 { border-top: 3px solid #f7971e; }
#modulo-5 { border-top: 3px solid #ee0979; }
#modulo-6 { border-top: 3px solid var(--accent); }

.module-head { margin-bottom: 10px; }
.module-head h3,
.resource-card h3,
.module-card h3 {
  margin: 5px 0 0;
  font-family: "Poppins", sans-serif;
  font-size: 1rem; font-weight: 700; line-height: 1.3;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill-row span {
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); font-weight: 500;
}

.module-intro { color: var(--muted); font-size: 13px; margin: 0 0 14px; line-height: 1.6; }

.lesson {
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 8px;
}
.lesson:last-child { margin-bottom: 0; }

.lesson summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: flex-start;
  gap: 10px; padding: 12px 14px;
}
.lesson summary::-webkit-details-marker { display: none; }
.lesson summary strong { font-size: 14px; font-weight: 600; line-height: 1.3; }
.lesson summary p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.lesson-body,
.lesson-body.single {
  display: flex; flex-direction: column;
  gap: 10px; padding: 0 14px 14px;
}
.lesson-copy p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.6; }

.video-slot {
  border-radius: var(--r-sm); min-height: 175px; padding: 14px;
  background: linear-gradient(180deg, #1a1714, #24211d);
  color: var(--light);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
}
.video-slot span { font-family: "Poppins", sans-serif; font-size: 14px; font-weight: 600; }
.video-slot p    { margin: 0; font-size: 12px; color: rgba(255,248,239,0.55); }

.download-box {
  border-radius: var(--r-sm); padding: 14px;
  background: #fffbf2; border: 1px solid rgba(228,176,98,0.25);
}
.download-box h4 {
  margin: 0 0 6px;
  font-family: "Poppins", sans-serif; font-size: 13px; font-weight: 700;
}
.download-box p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ════════════════════════════════════
   RECURSOS / FAQ / CONTA
════════════════════════════════════ */
.resource-grid,
.faq-grid,
.account-grid { display: flex; flex-direction: column; gap: 10px; }

.resource-card,
.faq-item {
  border-radius: var(--r-sm); padding: 14px;
  background: var(--surface-soft); border: 1px solid var(--border);
}
.resource-card h3 {
  margin: 0 0 6px;
  font-family: "Poppins", sans-serif; font-weight: 700; font-size: 14px;
}
.resource-card p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

.password-form {
  border-radius: var(--r-sm); padding: 16px;
  background: var(--surface-soft); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}
.password-form h3 {
  margin: 0;
  font-family: "Poppins", sans-serif; font-size: 15px; font-weight: 700;
}
.password-form p  { font-size: 13px; color: var(--muted); margin: 0; }
.password-form label { display: grid; gap: 5px; font-weight: 500; font-size: 13px; }
.password-form input {
  min-height: 44px; padding: 10px 12px;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: #fff; font-size: 15px;
  transition: border-color 140ms;
}
.password-form input:focus { outline: none; border-color: var(--accent); }

.form-note { font-size: 13px; color: var(--muted); min-height: 18px; }
.form-note.error   { color: var(--danger); }
.form-note.success { color: var(--success); }

.faq-item summary {
  cursor: pointer; list-style: none;
  font-family: "Poppins", sans-serif;
  font-size: 14px; font-weight: 600; padding: 2px 0;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ════════════════════════════════════
   TABLET (600px+)
════════════════════════════════════ */
@media (min-width: 600px) {
  .main-panel {
    padding: 18px 20px;
    padding-bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom));
  }
  .poster-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .poster-thumb { height: 160px; }
  .resource-grid,
  .faq-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .btn { width: auto; }
  .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-card { grid-column: 1 / -1; }
}

/* ════════════════════════════════════
   DESKTOP (900px+)
════════════════════════════════════ */
@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }

  .sidebar {
    position: sticky; top: 0;
    left: auto; right: auto; bottom: auto;
    height: 100vh; border-top: none;
    padding: 1rem;
    display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto;
  }
  .sidebar-brand,
  .sidebar-user,
  .sidebar-note {
    display: block;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar-brand { padding: 1rem; }
  .sidebar-brand h1 {
    margin: 6px 0 8px;
    font-family: "Poppins", sans-serif;
    font-size: 1.15rem; font-weight: 700; line-height: 1.1; color: var(--light);
  }
  .brand-kicker { color: #b8a888; }
  .brand-copy   { font-size: 13px; color: rgba(255,248,239,0.55); margin: 0; }

  .sidebar-nav { flex-direction: column; justify-content: flex-start; gap: 2px; }
  .nav-item { justify-content: flex-start; flex: none; padding: 10px 12px; font-size: 14px; border-radius: 10px; }

  .sidebar-user { padding: 12px; display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
  .sidebar-user img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
  .sidebar-user strong { display: block; font-size: 13px; font-weight: 600; color: var(--light); }
  .sidebar-user p { font-size: 12px; color: rgba(255,248,239,0.55); margin: 2px 0 0; }

  .sidebar-note { padding: 12px; margin-top: auto; }
  .note-title { margin: 0 0 5px; font-family: "Poppins", sans-serif; font-size: 13px; font-weight: 700; color: var(--light); }
  .sidebar-note p { font-size: 12px; color: rgba(255,248,239,0.5); margin: 0; }

  .main-panel { padding: 1.1rem; padding-bottom: 1.1rem; }

  .topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .topbar h2 { font-size: 1.15rem; }
  .topbar-actions { margin-top: 0; }

  .dashboard-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr; gap: 12px; margin-bottom: 24px; }
  .hero-card { grid-column: auto; display: grid; grid-template-columns: 1fr 210px; gap: 1rem; }
  .hero-progress { grid-template-columns: 1fr; margin-top: 0; }
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
  .btn { width: auto; }

  .poster-row { grid-template-columns: repeat(6, 1fr); gap: 12px; }
  .poster-thumb { height: 170px; }

  .lesson-body { flex-direction: row; }
  .lesson-body.single { flex-direction: column; }

  .resource-grid, .faq-grid, .account-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
  .state-panel { flex-direction: row; align-items: center; }
}

@media (min-width: 1200px) {
  .app-shell { grid-template-columns: 290px 1fr; }
}
