/* TickD Manual — layout y estilos de sitio
   Requiere tickd.css cargado antes de este archivo.
   Tema: data-theme="tickd" en <html> */

:root {
  --sidebar-width: 280px;
  --toc-width: 240px;
  --content-max: 760px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--tk-font);
  color: var(--tk-ink);
  background: var(--tk-page);
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--tk-navy);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease-out;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: var(--tk-navy);
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin-bottom: 16px;
}

.sidebar-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

/* Logo en portada */
.intro-logo-wrap { margin-bottom: 28px; }
.intro-logo { height: 56px; width: auto; object-fit: contain; }

/* ── BÚSQUEDA ── */
.search-box { position: relative; }

.search-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--tk-r-control);
  color: rgba(255,255,255,0.82);
  font-family: var(--tk-font);
  font-size: 13px;
  font-weight: 400;
  padding: 9px 12px 9px 34px;
  outline: none;
  transition: border-color 0.18s ease-out;
}
.search-input::placeholder { color: rgba(255,255,255,0.3); }
.search-input:focus { border-color: var(--tk-accent); }

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.3);
  font-size: 14px;
  pointer-events: none;
}

/* ── NAV ── */
.sidebar-nav { padding: 16px 0 40px; flex: 1; }
.nav-section { margin-bottom: 8px; }

.nav-section-title {
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 8px 20px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  color: rgba(255,255,255,0.52);
  font-family: var(--tk-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  transition: color 0.18s ease-out, background 0.18s ease-out;
}
.nav-link i { font-size: 15px; flex-shrink: 0; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.07); }
.nav-link.active {
  color: #fff;
  background: rgba(240,0,96,0.14);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tk-accent);
  border-radius: 0 2px 2px 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: rgba(240,0,96,0.2);
  color: var(--tk-accent);
  padding: 1px 7px;
  border-radius: var(--tk-r-pill);
}

.nav-sub { padding-left: 12px; }
.nav-sub .nav-link {
  font-size: 12.5px;
  padding: 5px 20px 5px 28px;
  color: rgba(255,255,255,0.35);
}
.nav-sub .nav-link:hover { color: #fff; }
.nav-sub .nav-link.active { color: #fff; }

/* ── TOPBAR ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-h);
  background: var(--tk-surface);
  border-bottom: 1px solid var(--tk-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--tk-slate);
  cursor: pointer;
  padding: 4px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--tk-font);
  font-size: 12.5px;
  color: var(--tk-muted);
}
.breadcrumb-sep { color: var(--tk-line-strong); }
.breadcrumb span:last-child { color: var(--tk-ink); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.version-badge {
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--tk-r-pill);
  background: var(--tk-accent-soft);
  color: var(--tk-accent);
  border: 1px solid rgba(240,0,96,0.2);
}

/* ── MAIN ── */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-h);
  flex: 1;
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.content-wrapper {
  flex: 1;
  padding: 48px 64px 64px 48px;
  max-width: calc(var(--content-max) + 128px);
  min-width: 0;
}

.page { display: none; }
.page.active { display: block; }

/* ── TIPOGRAFÍA ── */
.content-wrapper h1 {
  font-family: var(--tk-font);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--tk-ink);
  line-height: 1.2;
  margin-bottom: 8px;
}

.content-wrapper h2 {
  font-family: var(--tk-font);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.35px;
  color: var(--tk-ink);
  line-height: 1.25;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tk-line);
  scroll-margin-top: 80px;
}

.content-wrapper h3 {
  font-family: var(--tk-font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.25px;
  color: var(--tk-ink);
  line-height: 1.3;
  margin: 28px 0 12px;
  scroll-margin-top: 80px;
}

.content-wrapper h4 {
  font-family: var(--tk-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--tk-muted);
  margin: 20px 0 8px;
}

.page-intro {
  font-family: var(--tk-font);
  font-size: 14px;
  font-weight: 300;
  color: var(--tk-slate);
  line-height: 1.65;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--tk-line);
}

.content-wrapper p {
  font-family: var(--tk-font);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--tk-slate);
  margin-bottom: 16px;
}

.content-wrapper ul,
.content-wrapper ol { margin: 0 0 16px 20px; }

.content-wrapper li {
  font-family: var(--tk-font);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--tk-slate);
  margin-bottom: 6px;
}
.content-wrapper li::marker { color: var(--tk-accent); }

.content-wrapper a {
  color: var(--tk-accent);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.18s ease-out;
}
.content-wrapper a:hover { color: var(--tk-accent-dark); }

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.84em;
  background: var(--tk-surface-alt);
  color: var(--tk-navy);
  padding: 1px 5px;
  border-radius: 6px;
  border: 1px solid var(--tk-line);
  font-weight: 500;
}

pre {
  background: var(--tk-navy);
  border-radius: var(--tk-r-card);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 20px 0;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  line-height: 1.7;
}

/* ── CALLOUTS ── */
.callout {
  border-radius: var(--tk-r-control);
  padding: 13px 15px;
  margin: 24px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--tk-line);
  background: var(--tk-surface-alt);
}

.callout-tip {
  background: rgba(27,145,107,0.07);
  border-color: rgba(27,145,107,0.28);
}
.callout-warning {
  background: var(--tk-warning-surface);
  border-color: rgba(247,153,45,0.35);
}
.callout-note {
  background: var(--tk-surface-alt);
  border-color: var(--tk-line-strong);
}

.callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.callout-tip .callout-icon { color: var(--tk-success); }
.callout-warning .callout-icon { color: var(--tk-warning); }
.callout-note .callout-icon { color: var(--tk-slate); }

.callout-content { flex: 1; min-width: 0; }
.callout-content strong {
  display: block;
  font-family: var(--tk-font);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tk-ink);
  margin-bottom: 4px;
}
.callout-content p {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--tk-slate);
}

/* ── STEPS ── */
.steps { margin: 24px 0; }

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px; top: 34px; bottom: -12px;
  width: 2px;
  background: var(--tk-line);
}

.step-num {
  width: 32px; height: 32px;
  background: var(--tk-accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--tk-font);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  z-index: 1;
}

.step-content { flex: 1; min-width: 0; padding-top: 5px; }

.step-content h4 {
  margin-top: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--tk-ink);
}

/* ── TABLAS ── */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--tk-r-card);
  border: 1px solid var(--tk-line);
  background: var(--tk-surface);
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead tr { background: var(--tk-surface-alt); }

th {
  padding: 12px 14px;
  text-align: left;
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tk-muted);
  border-bottom: 1px solid var(--tk-line);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--tk-line);
  vertical-align: top;
  font-family: var(--tk-font);
  font-size: 13px;
  font-weight: 400;
  color: var(--tk-slate);
}
td strong { font-weight: 700; color: var(--tk-ink); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--tk-surface-deep); }
td code { font-size: 11.5px; }

/* ── MÓDULO CARDS ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.module-card {
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-r-card);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.22s ease-out, box-shadow 0.22s ease-out, transform 0.22s ease-out;
  text-decoration: none;
  display: block;
}
.module-card:hover {
  border-color: var(--tk-accent);
  box-shadow: var(--tk-sh-card);
  transform: translateY(-2px);
}

.module-card-icon {
  width: 40px; height: 40px;
  background: var(--tk-accent-soft);
  border-radius: var(--tk-r-control);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--tk-accent);
}
.module-card-icon i { font-size: 22px; }

.module-card-title {
  font-family: var(--tk-font);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.2px;
  color: var(--tk-ink);
  margin-bottom: 4px;
}

.module-card-desc {
  font-family: var(--tk-font);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--tk-slate);
  line-height: 1.5;
}

/* ── PERMISOS BADGE ── */
.perm-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--tk-surface-alt);
  color: var(--tk-navy);
  border-radius: 8px;
  margin: 2px;
  border: 1px solid var(--tk-line-strong);
}

/* ── ROLES (chips TickD) ── */
.role {
  display: inline-flex;
  align-items: center;
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--tk-r-pill);
  margin: 2px;
  border: 1px solid transparent;
}
.role-admin { background: rgba(247,153,45,0.12); color: #a0620a; border-color: rgba(247,153,45,0.3); }
.role-super { background: rgba(210,47,63,0.08); color: var(--tk-danger); border-color: rgba(210,47,63,0.25); }
.role-cashier { background: rgba(32,16,80,0.07); color: var(--tk-navy); border-color: rgba(32,16,80,0.18); }
.role-verifier { background: rgba(27,145,107,0.08); color: var(--tk-success); border-color: rgba(27,145,107,0.25); }

/* ── TOC ── */
.toc-sidebar {
  width: var(--toc-width);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  padding: 0 24px 40px 0;
  display: none;
}
@media (min-width: 1280px) { .toc-sidebar { display: block; } }

.toc-title {
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--tk-muted);
  margin-bottom: 12px;
}

.toc-list { list-style: none; }
.toc-list li { margin-bottom: 2px; }
.toc-list a {
  font-family: var(--tk-font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tk-muted);
  text-decoration: none;
  display: block;
  padding: 3px 0;
  transition: color 0.18s ease-out;
  border-bottom: none;
}
.toc-list a:hover, .toc-list a.active { color: var(--tk-accent); font-weight: 700; }
.toc-list .toc-h3 { padding-left: 12px; font-size: 12px; }

/* ── PAGE FOOTER ── */
.page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--tk-line);
  gap: 16px;
}

.page-footer a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-r-card);
  text-decoration: none;
  flex: 1;
  max-width: 240px;
  transition: border-color 0.18s ease-out, box-shadow 0.18s ease-out;
  color: var(--tk-ink);
}
.page-footer a:hover {
  border-color: var(--tk-accent);
  box-shadow: var(--tk-sh-card);
}
.page-footer a.next { text-align: right; margin-left: auto; }

.page-footer .nav-label {
  font-family: var(--tk-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--tk-muted);
}
.page-footer .nav-title {
  font-family: var(--tk-font);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tk-accent);
}

/* ── BÚSQUEDA RESULTADOS ── */
.search-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--tk-navy-light);
  border: 1px solid rgba(255,255,255,0.1);
  border-top: none;
  border-radius: 0 0 var(--tk-r-control) var(--tk-r-control);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.search-results.show { display: block; }

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.18s ease-out;
}
.search-result-item:hover { background: rgba(255,255,255,0.07); }
.search-result-item:last-child { border-bottom: none; }
.search-result-title { font-size: 13px; font-weight: 600; color: #fff; }
.search-result-section { font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* ── OVERLAY MÓVIL ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ── FEATURE LIST ── */
.feature-list { list-style: none; margin: 0 0 16px; }
.feature-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--tk-line);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--tk-slate);
  font-size: 14px;
  font-weight: 300;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tk-accent);
  flex-shrink: 0;
  margin-top: 7px;
}

/* ── USER TYPES ── */
.user-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* ── IMPORTANT BOX ── */
.important {
  background: var(--tk-surface);
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-r-card);
  padding: 20px 24px;
  margin: 24px 0;
}
.important-title {
  font-family: var(--tk-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--tk-accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .topbar { left: 0; }
  .menu-toggle { display: flex; }
  .content-wrapper { padding: 32px 24px; }
}

@media (max-width: 640px) {
  .content-wrapper h1 { font-size: 20px; }
  .content-wrapper h2 { font-size: 16px; }
  .page-footer { flex-direction: column; }
  .page-footer a { max-width: 100%; }
  .page-footer a.next { margin-left: 0; }
}

.content-wrapper h2[id],
.content-wrapper h3[id] { scroll-margin-top: 80px; }
