:root {
  --bg-dark: #0E1015;
  --bg-dark-2: #141720;
  --bg-dark-3: #1C202C;
  --line-dark: #282D3B;
  --ink-light: #F3F4F6;
  --muted-light: #9CA3AF;

  --paper: #F5F3EE;
  --paper-card: #FFFFFF;
  --paper-warm: #EBE7DE;
  --ink-dark: #161A22;
  --muted-dark: #57606F;
  --line-light: #DDD8CE;

  --accent: #8E2457;
  --accent-bright: #C43C7B;
  --accent-soft: #F7E8EF;
  --accent-ink: #FFFFFF;

  --ok: #18794E;
  --ok-soft: #E3F3EA;
  --over: #B42318;
  --over-soft: #FBE9E7;

  --display: 'Barlow Condensed', 'Bebas Neue', Arial, sans-serif;
  --bebas: 'Bebas Neue', 'Barlow Condensed', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --sidebar-w: 260px;
  --radius: 10px;
  --radius-sm: 6px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--ink-light);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, video {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* Boot screen */
.boot-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(142, 36, 87, 0.22), transparent 60%), var(--bg-dark);
}
.boot-logo {
  width: 220px;
  height: auto;
}
.boot-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-dark);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-dark-3);
  color: var(--ink-light);
  border: 1px solid var(--accent-bright);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (min-width: 900px) {
  .toast { bottom: 28px; }
}

/* Login Screen */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(142, 36, 87, 0.25), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(142, 36, 87, 0.14), transparent 50%),
    var(--bg-dark);
}
.login-watermark {
  position: absolute;
  right: -60px;
  bottom: -40px;
  width: min(460px, 75vw);
  opacity: 0.04;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  padding: 36px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.login-logo {
  width: 195px;
  margin: 0 auto 20px;
}
.login-eyebrow {
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--accent-bright);
  margin-bottom: 4px;
}
.login-title {
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
  margin: 0 0 8px;
}
.login-sub {
  text-align: center;
  color: var(--muted-light);
  font-size: 0.92rem;
  margin: 0 0 24px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-light);
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--line-dark);
  background: var(--bg-dark);
  color: var(--ink-light);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}
.form-input:focus {
  border-color: var(--accent-bright);
}
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink-light);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-dark) inset;
  transition: background-color 5000s ease-in-out 0s;
}
.form-error {
  background: rgba(180, 35, 24, 0.18);
  border: 1px solid rgba(255, 138, 128, 0.45);
  color: #FCA5A5;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 11px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary.full { width: 100%; padding: 13px 20px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--ink-light);
  border: 1.5px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover {
  border-color: var(--accent-bright);
  background: rgba(255, 255, 255, 0.04);
}
.btn-secondary.light {
  color: var(--ink-dark);
  border-color: var(--line-light);
  background: var(--paper-card);
}
.btn-secondary.light:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.login-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted-light);
}
.login-foot a {
  color: var(--accent-bright);
  font-weight: 600;
  text-decoration: underline;
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--line-dark);
  margin-bottom: 18px;
}
.login-tab {
  border: 0;
  background: transparent;
  color: var(--muted-light);
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.login-tab.active {
  background: var(--accent);
  color: #FFFFFF;
}
.form-info {
  background: rgba(142, 36, 87, 0.18);
  border: 1px solid var(--accent-bright);
  color: #FBCFE8;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* App Shell */
.shell {
  display: flex;
  min-height: 100dvh;
}

/* Desktop Sidebar */
.sidebar {
  display: none;
}
@media (min-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-dark-2);
    border-right: 1px solid var(--line-dark);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: width 0.2s ease;
  }
  .shell.collapsed .sidebar {
    width: 74px;
  }
  .shell-main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    transition: margin-left 0.2s ease, width 0.2s ease;
  }
  .shell.collapsed .shell-main {
    margin-left: 74px;
    width: calc(100% - 74px);
  }
}

.side-head {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-logo-full {
  height: 44px;
  width: auto;
  object-fit: contain;
}
.side-logo-icon {
  display: none;
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.shell.collapsed .side-logo-full { display: none; }
.shell.collapsed .side-logo-icon { display: block; margin: 0 auto; }

.collapse-btn {
  background: transparent;
  border: 1px solid var(--line-dark);
  color: var(--muted-light);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.collapse-btn:hover { color: var(--ink-light); border-color: var(--muted-light); }
.shell.collapsed .side-head { flex-direction: column; gap: 10px; padding: 16px 10px; }

.side-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-light);
  padding: 14px 12px 6px;
  font-weight: 700;
}
.shell.collapsed .side-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted-light);
  font-weight: 500;
  font-size: 0.94rem;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-light);
}
.nav-item.active {
  background: rgba(142, 36, 87, 0.25);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent-bright);
}
.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
}
.shell.collapsed .nav-item span,
.shell.collapsed .nav-badge { display: none; }
.shell.collapsed .nav-item { justify-content: center; padding: 11px; }

.side-foot {
  padding: 12px;
  border-top: 1px solid var(--line-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.user-meta {
  min-width: 0;
  flex: 1;
}
.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.75rem;
  color: var(--muted-light);
}
.logout-btn {
  background: transparent;
  border: 1px solid var(--line-dark);
  color: var(--ink-light);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.logout-btn:hover { color: #FCA5A5; border-color: #FCA5A5; }
.shell.collapsed .user-meta,
.shell.collapsed .logout-btn { display: none; }
.shell.collapsed .side-foot { justify-content: center; }

/* Mobile Header + Bottom Nav */
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 35;
  background: rgba(14, 16, 21, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-dark);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mobile-header img { height: 32px; width: auto; }
.mobile-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line-dark);
  background: var(--bg-dark-2);
  color: var(--ink-light);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }

.mobile-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 45;
  background: rgba(20, 23, 32, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-dark);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.mob-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--muted-light);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
}
.mob-tab svg { width: 20px; height: 20px; }
.mob-tab.active {
  color: #FFFFFF;
  background: rgba(142, 36, 87, 0.25);
}

.shell-main {
  flex: 1;
  min-width: 0;
  padding-bottom: 76px;
}
@media (min-width: 900px) {
  .mobile-header, .mobile-nav { display: none; }
  .shell-main { padding-bottom: 0; }
}

/* Home Hero (Dark Editorial Section) */
.hero-band {
  position: relative;
  overflow: hidden;
  padding: 36px 20px 44px;
  background:
    radial-gradient(circle at 80% 10%, rgba(142, 36, 87, 0.22), transparent 50%),
    linear-gradient(180deg, #0E1015 0%, #141720 100%);
  border-bottom: 1px solid var(--line-dark);
}
@media (min-width: 900px) {
  .hero-band { padding: 48px 44px 52px; }
}
.hero-inner {
  max-width: 1020px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.hero-watermark {
  position: absolute;
  right: -20px;
  top: -10px;
  width: 260px;
  opacity: 0.05;
  pointer-events: none;
}
@media (min-width: 900px) {
  .hero-watermark { width: 340px; right: 20px; top: -20px; }
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.eyebrow {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  color: var(--accent-bright);
}
.search-trigger {
  display: none;
}
@media (min-width: 900px) {
  .search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line-dark);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted-light);
    font-size: 0.88rem;
    cursor: pointer;
  }
  .search-trigger:hover { border-color: var(--accent-bright); color: var(--ink-light); }
  .search-kbd {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--line-dark);
    background: var(--bg-dark);
  }
}

.hero-h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.35rem);
  line-height: 1.02;
  margin: 0 0 12px;
  max-width: 18ch;
}
.hero-h1 em {
  font-style: normal;
  border-bottom: 3px solid var(--accent-bright);
  padding-bottom: 2px;
}
.hero-sub {
  color: var(--muted-light);
  max-width: 58ch;
  font-size: 1rem;
  margin: 0 0 28px;
}

/* Floating Continue Card (Maison-inspired High Contrast Light Card) */
.continue-card {
  background: var(--paper);
  color: var(--ink-dark);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  border-top: 4px solid var(--accent);
}
@media (min-width: 760px) {
  .continue-card {
    grid-template-columns: auto 1fr auto;
    padding: 24px 28px;
  }
}
.continue-roman {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
  width: 48px;
  text-align: center;
  display: none;
}
@media (min-width: 760px) { .continue-roman { display: block; } }

.continue-kicker {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-dark);
  margin-bottom: 4px;
}
.continue-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.15;
  margin: 0 0 10px;
}
.progress-track {
  height: 6px;
  background: var(--line-light);
  border-radius: 999px;
  overflow: hidden;
  max-width: 340px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.continue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metrics-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 28px;
}
.metric {
  padding-right: 24px;
  border-right: 1px solid var(--line-dark);
}
.metric:last-child { border-right: 0; }
.metric-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
}
.metric-lbl {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-light);
  margin-top: 4px;
}

/* Light Paper Section: Trilha */
.trilha-band {
  background: var(--paper);
  color: var(--ink-dark);
  padding: 44px 20px;
  border-bottom: 1px solid var(--line-light);
}
@media (min-width: 900px) { .trilha-band { padding: 56px 44px; } }
.section-inner {
  max-width: 1020px;
  margin: 0 auto;
}
.section-heading {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  line-height: 1.08;
  margin: 4px 0 8px;
}
.section-sub {
  color: var(--muted-dark);
  max-width: 56ch;
  margin: 0 0 28px;
}
.section-sub.on-dark { color: var(--muted-light); }

.trilha-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.trilha-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--paper-warm);
  border: 1px solid var(--line-light);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.trilha-row:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.trilha-row.current {
  background: var(--paper-card);
  border-color: var(--line-light);
  border-left: 5px solid var(--accent);
  box-shadow: 0 10px 28px rgba(22, 26, 34, 0.08);
}
.trilha-roman {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--accent);
  text-align: center;
}
.trilha-meta {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.trilha-row:not(.current) .trilha-meta { color: var(--muted-dark); }
.trilha-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--ink-dark);
}
.trilha-desc {
  font-size: 0.92rem;
  color: var(--muted-dark);
  margin-top: 3px;
}
.trilha-right {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-dark);
  white-space: nowrap;
}
.trilha-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(22, 26, 34, 0.06);
}
.trilha-pill.done {
  background: var(--ok-soft);
  color: var(--ok);
}

/* Dark Section: Quick Tools & Archive Grid */
.tools-band {
  background: var(--bg-dark-2);
  padding: 44px 20px;
  border-bottom: 1px solid var(--line-dark);
}
@media (min-width: 900px) { .tools-band { padding: 52px 44px; } }

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 760px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}
.tool-card {
  background: var(--bg-dark-3);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tool-card:hover {
  border-color: var(--accent-bright);
  transform: translateY(-2px);
}
.tool-card.featured {
  border-color: var(--accent);
  background: linear-gradient(155deg, rgba(142, 36, 87, 0.22), var(--bg-dark-3) 65%);
}
.tool-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(142, 36, 87, 0.25);
  color: var(--accent-bright);
  display: grid;
  place-items: center;
}
.tool-icon svg { width: 20px; height: 20px; }
.tool-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.15;
}
.tool-desc {
  font-size: 0.9rem;
  color: var(--muted-light);
  flex: 1;
}
.tool-link {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Modules Archive Grid */
.archive-band {
  background: var(--bg-dark);
  padding: 44px 20px 56px;
}
@media (min-width: 900px) { .archive-band { padding: 52px 44px 64px; } }

.modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 680px) {
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1060px) {
  .modules-grid { grid-template-columns: repeat(3, 1fr); }
}
.mod-card {
  background: var(--bg-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.mod-card:hover {
  border-color: var(--accent-bright);
  transform: translateY(-2px);
}
.mod-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mod-roman {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--accent-bright);
}
.mod-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-light);
}
.mod-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.15;
}
.mod-desc {
  font-size: 0.9rem;
  color: var(--muted-light);
  flex: 1;
}
.mod-prog {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted-light);
}
.mod-prog .progress-track { flex: 1; background: var(--line-dark); height: 5px; }

/* Lesson & Module Unified Player/Reader View */
.lesson-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(14, 16, 21, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-dark);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
@media (max-width: 899px) {
  .lesson-topbar { top: 53px; }
}
.lesson-crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.lesson-crumb-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lesson-workspace {
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 960px) {
  .lesson-workspace.drawer-open {
    grid-template-columns: 1fr 310px;
  }
}

.lesson-main {
  padding: 24px 16px 48px;
  min-width: 0;
}
@media (min-width: 760px) {
  .lesson-main { padding: 32px 36px 64px; }
}
.lesson-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Video Box */
.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #050608;
  border: 1px solid var(--line-dark);
}
.video-frame iframe, .video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
}
.video-placeholder {
  background: linear-gradient(135deg, var(--bg-dark-2), var(--bg-dark-3));
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.video-placeholder-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(142, 36, 87, 0.22);
  color: var(--accent-bright);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.lesson-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.lesson-h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.75rem, 3.5vw, 2.3rem);
  line-height: 1.1;
  margin: 4px 0 6px;
}
.lesson-summary {
  color: var(--muted-light);
  font-size: 0.98rem;
}

.complete-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1.5px solid var(--line-dark);
  background: var(--bg-dark-2);
  color: var(--ink-light);
  transition: all 0.15s ease;
}
.complete-btn.is-done {
  background: rgba(24, 121, 78, 0.2);
  border-color: #34D399;
  color: #6EE7B7;
}

/* CTA Box */
.cta-banner {
  background: linear-gradient(135deg, rgba(142, 36, 87, 0.28), var(--bg-dark-2));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

/* Editorial Reading Card ("Texto Corrido") */
.article-card {
  background: var(--paper-card);
  color: var(--ink-dark);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
@media (min-width: 760px) {
  .article-card { padding: 38px 42px; }
}
.article-section + .article-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line-light);
}
.article-section h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.48rem;
  line-height: 1.15;
  color: var(--ink-dark);
  margin: 0 0 12px;
}
.article-section p {
  margin: 0 0 14px;
  font-size: 1.03rem;
  line-height: 1.72;
  color: #252A34;
  max-width: 70ch;
}
.article-section p:last-child { margin-bottom: 0; }
.article-callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 16px 18px;
  border-radius: 0 8px 8px 0;
  color: var(--ink-dark);
  font-weight: 500;
  white-space: pre-line;
  line-height: 1.65;
}

/* Attachments Card */
.attachments-card {
  background: var(--bg-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attachments-title {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  color: var(--muted-light);
  margin-bottom: 2px;
}
.attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-dark);
  background: var(--bg-dark);
  transition: border-color 0.15s ease;
}
.attach-item:hover { border-color: var(--accent-bright); }
.attach-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.attach-badge {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #B42318;
  color: #FFFFFF;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.attach-name { font-weight: 600; font-size: 0.95rem; }
.attach-size { font-size: 0.8rem; color: var(--muted-light); }

/* Prev/Next Lesson Footer */
.lesson-nav-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}
.lesson-nav-foot button {
  max-width: 48%;
  text-align: left;
}

/* Right Lessons Drawer */
.lessons-drawer {
  background: var(--bg-dark-2);
  border-top: 1px solid var(--line-dark);
  padding: 18px 16px;
}
@media (min-width: 960px) {
  .lessons-drawer {
    border-top: 0;
    border-left: 1px solid var(--line-dark);
    position: sticky;
    top: 61px;
    height: calc(100dvh - 61px);
    overflow-y: auto;
  }
  .lesson-workspace:not(.drawer-open) .lessons-drawer {
    display: none;
  }
}
@media (max-width: 959px) {
  .lesson-workspace:not(.drawer-open) .lessons-drawer {
    display: none;
  }
}

.drawer-mod {
  margin-bottom: 16px;
}
.drawer-mod-head {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-light);
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.drawer-lesson {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-light);
  text-align: left;
  cursor: pointer;
  margin-bottom: 4px;
}
.drawer-lesson:hover { background: rgba(255, 255, 255, 0.04); }
.drawer-lesson.active {
  background: rgba(142, 36, 87, 0.24);
  border-color: var(--accent);
}
.check-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--muted-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.72rem;
}
.check-dot.done {
  background: var(--ok);
  border-color: var(--ok);
  color: #FFFFFF;
}
.drawer-lesson-title {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.25;
}

/* =========================================================
   CALCULADORA DA REFEIÇÃO LIVRE (Integrated & Enhanced)
   ========================================================= */
.calc-page {
  background: var(--paper);
  color: var(--ink-dark);
  min-height: calc(100dvh - 54px);
}
.calc-sticky-top {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--paper-card);
  border-bottom: 1px solid var(--line-light);
  padding: 12px 16px;
}
@media (max-width: 899px) {
  .calc-sticky-top { top: 53px; }
}
.calc-sticky-in {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}
.calc-lbl {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-dark);
  font-weight: 700;
}
.calc-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.calc-unit { font-size: 0.85rem; color: var(--muted-dark); margin-left: 4px; }
.calc-sticky-top[data-s="ok"] .calc-num { color: var(--ok); }
.calc-sticky-top[data-s="over"] .calc-num { color: var(--over); }
.calc-bar {
  height: 10px;
  background: var(--line-light);
  border-radius: 999px;
  overflow: hidden;
}
.calc-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.calc-sticky-top[data-s="ok"] .calc-bar i { background: var(--ok); }
.calc-sticky-top[data-s="over"] .calc-bar i { background: var(--over); }

.calc-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.calc-panel {
  background: var(--paper-card);
  border: 1px solid var(--line-light);
  border-radius: 12px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.calc-panel h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0;
}
.calc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.calc-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-dark);
}
.calc-field input {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--line-light);
  background: var(--paper);
  color: var(--ink-dark);
}
.calc-budget {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
}
.calc-budget span { font-size: 0.9rem; font-weight: 600; }
.calc-budget b { font-family: var(--display); font-size: 1.9rem; line-height: 1; color: var(--accent); }

.calc-status {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  background: var(--accent-soft);
}
.calc-status[data-s="ok"] { background: var(--ok-soft); color: var(--ok); }
.calc-status[data-s="over"] { background: var(--over-soft); color: var(--over); }

.calc-plate {
  list-style: none;
  margin: 0;
  padding: 0;
}
.calc-plate li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-light);
}
.calc-plate li.tot {
  border-bottom: 0;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 700;
}
.calc-plate li.empty { color: var(--muted-dark); border-bottom: 0; }

.combo-grid { display: flex; flex-direction: column; gap: 10px; }
.combo-btn {
  text-align: left;
  color: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line-light);
  background: var(--paper-card);
  cursor: pointer;
}
.combo-btn:hover { border-color: var(--accent); }
.combo-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.combo-btn .cn, .combo-btn .ck { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.combo-btn .cd { grid-column: 1 / -1; font-size: 0.88rem; color: var(--muted-dark); }

/* Search & Category Chips inside Calculator */
.calc-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc-search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--line-light);
  background: var(--paper);
  color: var(--ink-dark);
  font-size: 1rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-light);
  background: var(--paper);
  color: var(--muted-dark);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.food-group-title {
  font-family: var(--display);
  font-size: 1.08rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-dark);
  margin: 10px 0 4px;
}
.food-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.food-row.on { background: var(--accent-soft); }
.food-nm { display: block; font-weight: 600; line-height: 1.25; }
.food-pt { display: block; font-size: 0.84rem; color: var(--muted-dark); }
.food-pt b { color: var(--ink-dark); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1.5px solid var(--line-light);
  background: var(--paper-card);
  color: var(--ink-dark);
  font-size: 1.25rem;
  cursor: pointer;
}
.stepper input {
  width: 3rem;
  height: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  border: 0;
  background: transparent;
  color: var(--ink-dark);
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.custom-food-form {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-light);
}
@media (max-width: 540px) {
  .custom-food-form { grid-template-columns: 1fr 1fr; }
  .custom-food-form button { grid-column: 1 / -1; }
}

.calc-details {
  background: var(--paper-card);
  border: 1px solid var(--line-light);
  border-radius: 12px;
  padding: 0 16px;
}
.calc-details summary {
  cursor: pointer;
  padding: 14px 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
}
.calc-details > div { padding-bottom: 16px; font-size: 0.95rem; }

/* Admin View */
.admin-wrap {
  max-width: 1020px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-card {
  background: var(--bg-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 22px;
}
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-dark);
}
.admin-search {
  flex: 1 1 220px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line-dark);
  background: var(--bg-dark);
  color: var(--ink-light);
  font-size: 0.92rem;
}
.admin-search:focus { border-color: var(--accent-bright); outline: none; }
.admin-select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line-dark);
  background: var(--bg-dark);
  color: var(--ink-light);
  font-size: 0.88rem;
  cursor: pointer;
}
.admin-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-chip {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-dark);
  background: var(--bg-dark);
  color: var(--muted-light);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.admin-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}
.user-table th, .user-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-dark);
  font-size: 0.92rem;
}
.user-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-light);
}
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.status-pill.active { background: rgba(24, 121, 78, 0.25); color: #6EE7B7; }
.status-pill.inactive { background: rgba(180, 35, 24, 0.25); color: #FCA5A5; }
.status-pill.pending { background: rgba(217, 119, 6, 0.22); color: #FCD34D; margin-left: 6px; }
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(180, 35, 24, 0.16);
  color: #FCA5A5;
  border: 1.5px solid rgba(252, 165, 165, 0.4);
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-danger:hover {
  background: #B42318;
  border-color: #B42318;
  color: #FFFFFF;
}
.btn-danger.lg {
  padding: 10px 18px;
  font-size: 0.92rem;
}

@media (max-width: 680px) {
  .user-table thead { display: none; }
  .user-table tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line-dark); }
  .user-table td { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border: 0; }
}

/* Global Search Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 8, 12, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: start center;
  padding: 64px 16px 24px;
}
.modal-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-search-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-dark);
}
.modal-search-top input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ink-light);
  font-size: 1rem;
  outline: none;
}
.modal-results {
  max-height: 60dvh;
  overflow-y: auto;
  padding: 10px;
}
.search-res-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-light);
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-res-item:hover {
  background: rgba(142, 36, 87, 0.2);
  border-color: var(--accent);
}
.search-res-meta { font-size: 0.75rem; color: var(--accent-bright); font-weight: 700; text-transform: uppercase; }
.search-res-title { font-weight: 600; font-size: 0.96rem; }

.app-footer {
  padding: 28px 20px;
  border-top: 1px solid var(--line-dark);
  background: var(--bg-dark);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted-light);
}
