/* ─── Scroll horizontal (compartido) ───────────────────────────── */
.ruta-intervenciones-repeater,
.rutas-form-repeater {
    overflow-x: auto;
    max-width: 100%;
}

.ruta-intervenciones-repeater table,
.rutas-form-repeater table {
    min-width: max-content;
}

/* Permitir que los padres del repeater no corten el overflow */
.fi-fo-field-content,
.fi-fo-field-content-ctn,
.fi-fo-field-content-col {
    overflow: visible;
}


/* ─── Validación de Rutas (ruta-intervenciones-repeater) ────────── */

/* Columna Tarea: 380px con textarea */
.ruta-intervenciones-repeater td:first-child {
    width: 380px;
    min-width: 380px;
}

.ruta-intervenciones-repeater td:first-child textarea {
    width: 100%;
    resize: none;
}


/* ─── Crear / Editar Rutas (rutas-form-repeater) ────────────────── */

/* Columna Tarea: 320px en create, 500px en edit (el ancho lo define el TableColumn,
   acá solo aseguramos que el select no fuerce un mínimo mayor) */
.rutas-form-repeater td:first-child {
    min-width: 0;
}


/* ─── Filas de cliente bloqueado ────────────────────────────────── */
tr.row-bloqueado td {
    background-color: rgb(254 226 226) !important; /* red-200 */
}

.dark tr.row-bloqueado td {
    background-color: rgb(127 29 29 / 0.4) !important; /* red-900/40 */
}

/* ─── Filas de contrato perdido ──────────────────────────────────── */
tr.row-perdido td {
    background-color: rgb(254 215 170) !important; /* orange-200 */
}

.dark tr.row-perdido td {
    background-color: rgb(124 45 18 / 0.4) !important; /* orange-900/40 */
}

/* ─── Tablas con scroll vertical hasta el viewport ─────────────── */
.viewport-scroll-table {
    --table-viewport-offset: 17rem;
    --table-footer-offset: 4.5rem;
}

.viewport-scroll-table .fi-ta-content-ctn {
    max-height: calc(100svh - var(--table-viewport-offset));
    overflow-y: auto;
}

.viewport-scroll-table .fi-ta-ctn-with-footer .fi-ta-content-ctn {
    max-height: calc(100svh - var(--table-viewport-offset) - var(--table-footer-offset));
}

.viewport-scroll-table .fi-ta-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}

.viewport-scroll-table .fi-ta-table thead th,
.viewport-scroll-table .fi-ta-table .fi-ta-table-stacked-header-cell {
    background-color: var(--gray-50);
}

.dark .viewport-scroll-table .fi-ta-table thead th,
.dark .viewport-scroll-table .fi-ta-table .fi-ta-table-stacked-header-cell {
    background-color: var(--gray-900);
}


/* ─── Manual de usuario ─────────────────────────────────────────── */

/* Layout principal */
.manual-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.manual-sidebar {
    width: 14rem;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.manual-content {
    flex: 1;
    min-width: 0;
}

.manual-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* Ícono de chevron en secciones */
.manual-chevron {
    width: 0.875rem;
    height: 0.875rem;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.manual-chevron.open {
    transform: rotate(180deg);
}

/* Navegación anterior/siguiente */
.manual-page-nav {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
}

.manual-page-nav-both { justify-content: space-between; }
.manual-page-nav-end  { justify-content: flex-end; }

.manual-page-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.1s;
}

.manual-page-nav-link:hover { color: #b45309; }

.manual-page-nav-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.manual-page-nav-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.125rem;
}

.manual-page-nav-title {
    font-weight: 500;
    color: #374151;
}

/* Tipografía del contenido Markdown */
.manual-prose {
    color: #111827;
    line-height: 1.75;
    font-size: 0.9375rem;
}

.manual-prose h1 {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    margin: 0 0 1.25rem !important;
    color: #111827;
    line-height: 1.3;
}

.manual-prose h2 {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    margin: 1.75rem 0 0.75rem !important;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
    line-height: 1.4;
}

.manual-prose h3 {
    font-size: 1.0625rem !important;
    font-weight: 600 !important;
    margin: 1.25rem 0 0.5rem !important;
    color: #374151;
}

.manual-prose h4 {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    margin: 1rem 0 0.25rem !important;
    color: #374151;
}

.manual-prose p {
    margin: 0.75rem 0 !important;
}

.manual-prose ul {
    margin: 0.75rem 0 !important;
    padding-left: 1.5rem !important;
    list-style-type: disc !important;
}

.manual-prose ol {
    margin: 0.75rem 0 !important;
    padding-left: 1.5rem !important;
    list-style-type: decimal !important;
}

.manual-prose li {
    margin: 0.3rem 0 !important;
    display: list-item !important;
}

.manual-prose li > ul,
.manual-prose li > ol {
    margin: 0.2rem 0 !important;
}

.manual-prose strong {
    font-weight: 700 !important;
}

.manual-prose em {
    font-style: italic !important;
}

.manual-prose a {
    color: #d97706;
    text-decoration: underline;
}

.manual-prose a:hover {
    color: #b45309;
}

.manual-prose code {
    background: #f3f4f6;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
    font-family: ui-monospace, monospace;
    color: #1f2937;
}

.manual-prose pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
}

.manual-prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.manual-prose blockquote {
    border-left: 4px solid #fbbf24;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    background: #fffbeb;
    color: #78350f;
    font-style: italic;
    border-radius: 0 0.25rem 0.25rem 0;
}

.manual-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.manual-prose thead th {
    background: #f9fafb;
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
}

.manual-prose tbody td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    vertical-align: top;
}

.manual-prose tbody tr:nth-child(even) {
    background: #f9fafb;
}

.manual-prose hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2rem 0;
}

.manual-prose img {
    max-width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Sidebar del manual */
.manual-nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    transition: background 0.1s, color 0.1s;
    color: #4b5563;
    text-decoration: none;
}

.manual-nav-link:hover {
    background: #f3f4f6;
    color: #111827;
}

.manual-nav-link.active {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.manual-nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.manual-nav-section-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.1s;
}

.manual-nav-section-btn:hover {
    background: #f3f4f6;
}

.manual-nav-section-btn.active-section {
    color: #92400e;
}

.manual-nav-children {
    margin-left: 0.5rem;
    padding-left: 0.625rem;
    border-left: 2px solid #e5e7eb;
    margin-top: 0.125rem;
}

.manual-nav-children.active-section {
    border-left-color: #fbbf24;
}


/* ─── Manual de usuario — modo oscuro ───────────────────────────── */

/* Prose */
.dark .manual-prose {
    color: #e5e7eb;
}

.dark .manual-prose h1 {
    color: #f9fafb;
}

.dark .manual-prose h2 {
    color: #f9fafb;
    border-bottom-color: #374151;
}

.dark .manual-prose h3 {
    color: #e5e7eb;
}

.dark .manual-prose h4 {
    color: #e5e7eb;
}

.dark .manual-prose a {
    color: #fbbf24;
}

.dark .manual-prose a:hover {
    color: #fcd34d;
}

.dark .manual-prose code {
    background: #374151;
    color: #e5e7eb;
}

.dark .manual-prose blockquote {
    background: #1c1917;
    color: #fde68a;
    border-left-color: #fbbf24;
}

.dark .manual-prose thead th {
    background: #1f2937;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark .manual-prose tbody td {
    border-color: #374151;
}

.dark .manual-prose tbody tr:nth-child(even) {
    background: #111827;
}

.dark .manual-prose hr {
    border-top-color: #374151;
}

.dark .manual-prose img {
    border-color: #374151;
}

/* Sidebar nav */
.dark .manual-nav-link {
    color: #9ca3af;
}

.dark .manual-nav-link:hover {
    background: #1f2937;
    color: #f3f4f6;
}

.dark .manual-nav-link.active {
    background: #451a03;
    color: #fde68a;
}

.dark .manual-nav-section-btn {
    color: #d1d5db;
}

.dark .manual-nav-section-btn:hover {
    background: #1f2937;
}

.dark .manual-nav-section-btn.active-section {
    color: #fde68a;
}

.dark .manual-nav-children {
    border-left-color: #374151;
}

/* Navegación anterior/siguiente */
.dark .manual-page-nav {
    border-top-color: #374151;
}

.dark .manual-page-nav-link {
    color: #9ca3af;
}

.dark .manual-page-nav-link:hover {
    color: #fbbf24;
}

.dark .manual-page-nav-title {
    color: #d1d5db;
}
