:root {
  --brand: #4ca59b;
  --brand-dark: #385c57;
  --brand-light: #f0faf8;
  --text: #1a2e2c;
  --muted: #5a706c;
  --border: #d7e6e3;
  --warn-bg: #fff8e8;
  --warn-border: #f0d9a0;
  --tip-bg: #eef8f6;
  --danger-bg: #fdecea;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: #f4f8f7;
}

.manual-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.manual-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem 2rem;
}

.manual-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--brand);
}

.manual-brand img {
  width: 40px;
  height: 40px;
}

.manual-brand h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--brand-dark);
}

.manual-brand p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.manual-nav h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
}

.manual-nav a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
}

.manual-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.manual-nav .nav-item > a:first-child {
  flex: 1;
  min-width: 0;
}

.manual-nav a.nav-videos {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-dark);
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
}

.manual-nav a.nav-videos:hover,
.manual-nav a.nav-videos:focus-visible {
  background: var(--brand);
  color: #fff;
}

.manual-nav a:hover,
.manual-nav a.is-active {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.manual-content {
  max-width: 820px;
  padding: 2rem 2.5rem 4rem;
}

.manual-cover {
  background: linear-gradient(145deg, #fff 0%, var(--brand-light) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
}

.manual-cover .badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.manual-cover h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  color: var(--brand-dark);
}

.manual-cover .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.manual-content h2 {
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--brand);
  color: var(--brand-dark);
  font-size: 1.45rem;
}

.manual-content h3 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.1rem;
  color: var(--brand-dark);
}

.manual-content h4 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.manual-content p,
.manual-content li {
  font-size: 0.95rem;
}

.manual-content ol.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.manual-content ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3rem;
  margin-bottom: 0.65rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.manual-content ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.callout {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
}

.callout-tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--brand);
}

.callout-warn {
  background: var(--warn-bg);
  border-left: 4px solid #d4a017;
}

.callout-info {
  background: #eef6fb;
  border-left: 4px solid #3b7ea6;
}

table.manual-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

table.manual-table th,
table.manual-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.manual-table th {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 650;
}

.kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f8f8f8;
  font-size: 0.85em;
  font-family: ui-monospace, monospace;
}

@media (max-width: 900px) {
  .manual-layout {
    grid-template-columns: 1fr;
  }

  .manual-sidebar {
    position: relative;
    height: auto;
    max-height: 40vh;
  }

  .manual-content {
    padding: 1.25rem 1rem 3rem;
  }
}

.manual-nav a.nav-back {
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--brand-dark);
}

.biblio-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #f0faf8 0%, #eef6fb 55%, #f4f8f7 100%);
}

.biblio-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.biblio-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.biblio-brand h1 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--brand-dark);
}

.biblio-brand p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.biblio-gate,
.biblio-catalog .manual-cover {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem;
}

.biblio-gate {
  max-width: 420px;
  margin: 3rem auto 0;
}

.biblio-gate h2 {
  margin: 0 0 0.4rem;
  color: var(--brand-dark);
}

.biblio-gate p {
  color: var(--muted);
  font-size: 0.92rem;
}

.biblio-gate label {
  display: block;
  font-size: 0.85rem;
  font-weight: 650;
  margin: 1.1rem 0 0.35rem;
}

.biblio-gate input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.biblio-gate button,
.biblio-card a,
.biblio-card .biblio-soon {
  font: inherit;
}

.biblio-gate button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.biblio-gate button:hover {
  background: var(--brand-dark);
}

.biblio-error {
  color: #b91c1c;
  font-size: 0.88rem;
  margin: 0.75rem 0 0;
}

.biblio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.biblio-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.biblio-card h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 1.05rem;
}

.biblio-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  flex: 1;
}

.biblio-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.biblio-card-actions a {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 650;
  font-size: 0.9rem;
}

.biblio-card-actions a:hover {
  background: var(--brand-dark);
}

.biblio-card-actions a.biblio-btn-secondary {
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid var(--brand);
}

.biblio-card-actions a.biblio-btn-secondary:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.biblio-card--soon .biblio-card-actions a {
  background: #9aaeaa;
}

.biblio-card--soon .biblio-card-actions a:hover {
  background: #7e9490;
}

.biblio-card--soon .biblio-card-actions a.biblio-btn-secondary {
  background: #fff;
  color: #5a706c;
  border-color: #9aaeaa;
}

.biblio-card--soon .biblio-card-actions a.biblio-btn-secondary:hover {
  background: #eef2f1;
}

.biblio-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.biblio-badge--soon {
  background: #eef2f1;
  color: #6a7f7b;
}

.biblio-logout {
  margin-top: 2rem;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 800px) {
  .biblio-grid {
    grid-template-columns: 1fr;
  }
}

.manual-video-empty {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.manual-video-empty a {
  color: var(--brand-dark);
  font-weight: 650;
}

.manual-video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0 0.25rem;
}

.manual-video-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(26, 46, 44, 0.06);
}

.manual-video-card:hover,
.manual-video-card:focus-visible {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.manual-video-card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: #1a2e2c;
  overflow: hidden;
}

.manual-video-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.manual-video-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: rgba(26, 46, 44, 0.72);
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
}

.manual-video-card__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-dark);
  padding: 0 0.55rem;
  line-height: 1.3;
}

.manual-video-card__desc {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0 0.55rem 0.65rem;
  line-height: 1.35;
}

.manual-video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.manual-video-lightbox[hidden] {
  display: none;
}

.manual-video-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 20, 0.72);
}

.manual-video-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.manual-video-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem 0.65rem 1.1rem;
}

.manual-video-lightbox__bar h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--brand-dark);
}

.manual-video-lightbox__close {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.manual-video-lightbox__player {
  background: #000;
}

.manual-video-lightbox__player video {
  display: block;
  width: 100%;
  max-height: min(70vh, 560px);
  background: #000;
}

.manual-video-lightbox__desc {
  margin: 0;
  padding: 0.75rem 1.1rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

body.manual-video-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .manual-video-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .manual-video-gallery {
    grid-template-columns: 1fr;
  }
}

@media print {
  .manual-sidebar {
    display: none;
  }

  .manual-video-gallery,
  .manual-video-lightbox,
  .alejandra-fab,
  .alejandra-panel {
    display: none !important;
  }

  .manual-layout {
    grid-template-columns: 1fr;
  }

  .manual-content {
    max-width: none;
    padding: 0;
  }

  .manual-cover {
    page-break-after: always;
  }

  h2 {
    page-break-after: avoid;
  }
}
