/* Oltixa — ajustes mínimos sobre Bootstrap. Sin gradientes ni efectos. */

body { min-height: 100vh; }

/* Layout del panel — DESKTOP (≥992px): sidebar fijo a la izquierda. */
@media (min-width: 992px) {
  .ox-sidebar {
    width: 250px;
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    overflow-y: auto;
    background-color: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
  }
  .ox-content { margin-left: 250px; }
}

/* MOBILE (<992px): el sidebar es un CAJÓN deslizable (offcanvas-lg de Bootstrap),
   barra superior fija con hamburguesa, y barra inferior de accesos tipo app. */
.ox-sidebar.offcanvas-lg { --bs-offcanvas-width: min(82vw, 320px); }
@media (max-width: 991.98px) {
  /* El cajón DEBE ser fixed (fuera del flujo) o deja un hueco vacío arriba.
     Algunos builds de Bootstrap no fijan position en .offcanvas-lg → forzado. */
  .ox-sidebar.offcanvas-lg { position: fixed; top: 0; bottom: 0; z-index: 1045; }
  .ox-content { margin-left: 0; }
  .ox-main { padding-bottom: 5rem !important; }  /* espacio para la barra inferior */
}

/* Barra inferior tipo app (móvil) */
.ox-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1035;
  display: flex; gap: .15rem;
  background-color: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}
.ox-bnav-item {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: .45rem .1rem; border: 0; background: none;
  font-size: .66rem; line-height: 1;
  color: var(--bs-secondary-color); text-decoration: none;
  border-radius: .6rem;
}
.ox-bnav-item i { font-size: 1.3rem; }
.ox-bnav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ox-bnav-item.active { color: var(--bs-primary); font-weight: 600; }
.ox-bnav-item:active { background-color: var(--bs-secondary-bg); }

/* Estados que Bootstrap no resuelve para un sidebar fijo */
.ox-sidebar .nav-link { color: var(--bs-secondary-color); }
.ox-sidebar .nav-link:hover { color: var(--bs-emphasis-color); background-color: var(--bs-secondary-bg); }
.ox-sidebar .nav-link.active { color: var(--bs-primary-text-emphasis); background-color: var(--bs-primary-bg-subtle); }
.ox-sidebar .nav-link i { width: 1.25rem; }

/* Marca */
.ox-brand { font-weight: 700; letter-spacing: .3px; }

/* Código/script en bloque monoespaciado con scroll */
pre.ox-code {
  background: var(--bs-tertiary-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color);
  border-radius: .5rem; padding: 1rem; max-height: 420px; overflow: auto;
  font-size: .82rem; line-height: 1.5; white-space: pre; margin: 0;
}

.ox-table-wrap { overflow-x: auto; }
.ox-table-wrap table { min-width: 760px; }
.ox-stat-link { color: inherit; text-decoration: none; }
.ox-stat-link:hover { color: var(--bs-primary-text-emphasis); }

.ox-metric-card { transition: border-color .15s ease; }
.ox-metric-card:hover { border-color: var(--bs-primary-border-subtle); }
.ox-pon-bar { height: .5rem; min-width: 5rem; background: var(--bs-secondary-bg); }
.ox-pon-bar > span { display: block; height: 100%; background: var(--bs-danger); }

/* Menú agrupado: el chevron del grupo gira al expandir. */
.ox-sidebar .nav-link[aria-expanded="true"] .ox-caret { transform: rotate(180deg); }
.ox-sidebar .ox-caret { transition: transform .15s ease; }

/* ── Identidad OLTIXA: granate #7E1F2E + crema (marca de la landing) ────── */
:root, [data-bs-theme=light], [data-bs-theme=dark] {
  --bs-primary: #691717;
  --bs-primary-rgb: 105, 23, 23;
  --bs-link-color: #691717;
  --bs-link-color-rgb: 105, 23, 23;
  --bs-link-hover-color: #4d1010;
  --bs-link-hover-color-rgb: 77, 16, 16;
}
[data-bs-theme=light] { --bs-primary-bg-subtle: #f1dddd; --bs-primary-text-emphasis: #4d1010; --bs-primary-border-subtle: #d6aaaa; }
[data-bs-theme=dark]  {
  --bs-primary-bg-subtle: #3a1219;
  --bs-primary-text-emphasis: #e8a3ad;
  --bs-primary-border-subtle: #5E1622;
  --bs-body-bg: #1d2023;
  --bs-body-color: #f2ecdc;
  --bs-secondary-bg: #2a2927;
  --bs-tertiary-bg: #252522;
  --bs-border-color: #655d4c;
  --bs-secondary-color: #bbb3a2;
}
.btn-primary { --bs-btn-bg: #691717; --bs-btn-border-color: #691717; --bs-btn-hover-bg: #4d1010; --bs-btn-hover-border-color: #4d1010; --bs-btn-active-bg: #3f0d0d; --bs-btn-active-border-color: #3f0d0d; --bs-btn-disabled-bg: #9b6262; --bs-btn-disabled-border-color: #9b6262; }
.btn-outline-primary { --bs-btn-color: #691717; --bs-btn-border-color: #691717; --bs-btn-hover-bg: #691717; --bs-btn-hover-border-color: #691717; --bs-btn-active-bg: #4d1010; --bs-btn-active-border-color: #4d1010; }
.text-primary { color: #691717 !important; }
.bg-primary { background-color: #691717 !important; }
.form-check-input:checked { background-color: #691717; border-color: #691717; }
.progress-bar { background-color: #691717; }
.text-bg-primary { background-color: #691717 !important; color: #fff !important; }
[data-bs-theme=light] body, [data-bs-theme=light] .bg-body { background-color: #fcf9ea !important; }
.ox-brand img { height: 30px; }

/* ── Sistema visual de la aplicación ─────────────────────────────────── */
:root {
  --ox-sidebar-width: 272px;
  --ox-radius: .75rem;
  --ox-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .045);
}
[data-bs-theme=light] {
  --bs-body-bg: #fcf9ea;
  --bs-body-color: #211b18;
  --bs-emphasis-color: #1c1512;
  --bs-secondary-bg: #f3eedf;
  --bs-tertiary-bg: #f8f4e7;
  --bs-border-color: #ded4b8;
  --bs-secondary-color: #71685a;
  --bs-light: #f8f4e7;
  --bs-light-rgb: 248, 244, 231;
}
[data-bs-theme=light] body,
[data-bs-theme=light] .bg-body { background-color: #fcf9ea !important; }

body.ox-app-shell { font-size: .925rem; letter-spacing: -.005em; }
.ox-main { max-width: 1440px; margin-inline: auto; }

@media (min-width: 992px) {
  .ox-sidebar { width: var(--ox-sidebar-width); background: #fffdf4; }
  .ox-content { margin-left: var(--ox-sidebar-width); }
}
[data-bs-theme=dark] .ox-sidebar { background: #171b21; }
[data-bs-theme=light] .ox-sidebar { background-color: #fffdf4 !important; }
.ox-sidebar-body { scrollbar-width: thin; }
.ox-sidebar.offcanvas-lg .ox-sidebar-body { display: block; width: 100%; overflow-x: hidden; }
.ox-sidebar .ox-brand { padding: .25rem .5rem; letter-spacing: .08em; }
.ox-sidebar .nav { width: 100%; min-width: 0; }
.ox-sidebar .nav-item, .ox-sidebar .nav-link { min-width: 0; max-width: 100%; }
.ox-sidebar .nav-link span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ox-sidebar .nav-link {
  min-height: 40px; padding: .55rem .7rem; border-radius: .55rem;
  font-weight: 500; transition: color .15s ease, background-color .15s ease;
}
.ox-sidebar .nav-link i { font-size: 1rem; text-align: center; }
.ox-sidebar .nav-link.active {
  color: #fff; background: #691717;
  box-shadow: 0 4px 12px rgba(105,23,23,.2);
}
.ox-sidebar .nav-link.active i { color: #fff; }
.ox-sidebar .nav-item.mt-2 > .nav-link {
  min-height: 30px; padding-block: .3rem; margin-top: .2rem;
  font-size: .72rem; letter-spacing: .055em;
}
.ox-sidebar .nav-item.mt-2 > .nav-link:hover { background: transparent; }
.ox-sidebar .collapse .nav-link { min-height: 34px; padding-block: .4rem; }

.ox-topbar { min-height: 68px; background: rgba(255,253,244,.95) !important; backdrop-filter: blur(12px); }
[data-bs-theme=dark] .ox-topbar { background: rgba(24,28,34,.94) !important; }
.ox-topbar.shadow-sm { box-shadow: 0 1px 0 rgba(15,23,42,.04) !important; }
.ox-workspace-icon {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  color: var(--bs-primary); background: var(--bs-primary-bg-subtle); border-radius: .55rem;
}
.ox-olt-modal-button { max-width: 230px; }
.ox-olt-modal-button span { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; max-width: 175px; }
.ox-olt-picker-list .list-group-item { min-height: 62px; border: 0; margin-bottom: .25rem; }
.ox-olt-picker-list .list-group-item.active { background: var(--bs-primary); color: #fff; }
.min-w-0 { min-width: 0; }
.ox-icon-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; }
.ox-record-menu { width: 245px; }
.ox-section-nav { overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--bs-border-color); }
.ox-section-nav::-webkit-scrollbar { display: none; }
.ox-section-nav .nav-tabs { width: max-content; min-width: 100%; border-bottom: 0; }
.ox-section-nav .nav-link { white-space: nowrap; color: var(--bs-secondary-color); border-radius: .5rem .5rem 0 0; }
.ox-section-nav .nav-link.active { color: var(--bs-primary); font-weight: 600; }
.ox-user-menu-button {
  width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center;
  border: 1px solid var(--bs-border-color); border-radius: 50%; color: var(--bs-body-color);
  background: var(--bs-secondary-bg); font-size: 1.05rem;
}
.ox-user-menu-button:hover, .ox-user-menu-button[aria-expanded="true"] {
  color: #fff; background: var(--bs-primary); border-color: var(--bs-primary);
}
.ox-user-menu { width: 250px; }
.ox-user-menu .dropdown-item i { width: 1.2rem; display: inline-block; }

/* Componentes Bootstrap: una misma geometría en todas las vistas. */
.card { border-color: var(--bs-border-color); border-radius: var(--ox-radius); box-shadow: var(--ox-shadow); }
[data-bs-theme=light] .card, [data-bs-theme=light] .modal-content, [data-bs-theme=light] .dropdown-menu { background-color: #fffdf5; }
[data-bs-theme=dark] .card,
[data-bs-theme=dark] .modal-content,
[data-bs-theme=dark] .dropdown-menu {
  background-color: #25272a;
  border-color: rgba(186,169,124,.42);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
[data-bs-theme=dark] .card-header,
[data-bs-theme=dark] .card-footer,
[data-bs-theme=dark] .list-group-item,
[data-bs-theme=dark] .table > :not(caption) > * > * {
  border-color: rgba(186,169,124,.32);
}
[data-bs-theme=dark] .list-group-item { background-color: #25272a; }
.card.border-0 { border: 1px solid var(--bs-border-color) !important; }
.card-header { min-height: 48px; padding: .75rem 1rem; font-weight: 600; }
.card-footer { padding: .75rem 1rem; }
.btn { border-radius: .5rem; font-weight: 600; }
.btn-sm { --bs-btn-padding-y: .38rem; --bs-btn-padding-x: .7rem; }
.form-control, .form-select, .input-group-text { min-height: 40px; border-radius: .5rem; }
.form-control:focus, .form-select:focus { border-color: #baa97c; box-shadow: 0 0 0 .2rem rgba(105,23,23,.1); }
.badge { font-weight: 600; letter-spacing: .01em; }
.alert { border-radius: .65rem; border-width: 1px; }
.dropdown-menu { border-radius: .65rem; box-shadow: 0 12px 32px rgba(15,23,42,.12); padding: .4rem; }
.dropdown-item { border-radius: .4rem; padding: .5rem .65rem; }

/* Tablas compactas, legibles y consistentes. */
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .72rem .8rem; border-bottom-color: var(--bs-border-color); }
.table thead th {
  color: var(--bs-secondary-color); background: var(--bs-tertiary-bg);
  font-size: .72rem; line-height: 1.2; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap;
}
[data-bs-theme=light] .table thead th { background: #f3eedf; color: #655b4d; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: rgba(var(--bs-primary-rgb), .025); }
.table-responsive { border-radius: 0 0 var(--ox-radius) var(--ox-radius); }

/* Encabezados y métricas: menos texto, mejor jerarquía. */
.ox-main h1, .ox-main .h1, .ox-main h2, .ox-main .h2, .ox-main h3, .ox-main .h3 { letter-spacing: -.025em; font-weight: 700; }
.ox-metric-card { overflow: hidden; border: 0 !important; }
.ox-metric-card::before { content: ''; display: block; height: 3px; background: var(--bs-primary); opacity: .85; }
.ox-metric-card .card-body { padding: 1.05rem 1.15rem 1.15rem; }
.ox-metric-card .display-6 { margin: .25rem 0; line-height: 1; letter-spacing: -.04em; }
.ox-metric-card:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(15,23,42,.09); }
[data-bs-theme=dark] .ox-metric-card {
  background: #27282a;
  border: 1px solid rgba(186,169,124,.4) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
}
[data-bs-theme=dark] .ox-metric-card::before { background: #baa97c; opacity: .8; }
[data-bs-theme=dark] .ox-metric-card:hover {
  border-color: rgba(186,169,124,.72) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.ox-onboarding .card-body { padding: .85rem; }
.ox-onboarding-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: .6rem; color: var(--bs-primary); background: var(--bs-primary-bg-subtle); font-size: 1.1rem; }

@media (max-width: 767.98px) {
  .ox-main { padding: 1rem !important; padding-bottom: 5.5rem !important; }
  .ox-topbar { min-height: 58px; }
  .card-header { min-height: 44px; }
  .ox-metric-card .card-body { padding: .85rem; }
  .ox-metric-card .display-6 { font-size: 2rem; }
  .ox-onboarding .progress { max-width: 120px !important; }
  .ox-onboarding .card-body { padding: .75rem; }
  .ox-onboarding .progress { order: 5; flex-basis: 100%; max-width: none !important; }
  .ox-record-header { position: relative; }
  .ox-record-title h1 { font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ox-record-title .small { font-size: .72rem; }
  .ox-back-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; }
  .ox-section-nav { position: sticky; top: 58px; z-index: 1015; margin-inline: -1rem; padding-inline: 1rem; background: var(--bs-body-bg); }
  .ox-section-nav .nav-link { padding: .7rem .75rem; font-size: .82rem; }
  .ox-section-nav .ox-refresh-tab { position: sticky; right: 0; background: var(--bs-body-bg); }
}

@media (max-width: 575.98px) {
  .ox-topbar { padding-inline: .65rem !important; flex-wrap: nowrap; gap: .35rem; }
  .ox-topbar > .btn-link { flex: 0 0 auto; }
  .ox-mobile-brand { flex: 0 0 auto; margin-right: 0 !important; }
  .ox-mobile-brand svg { width: 25px; height: 25px; }
  .ox-mobile-brand-word { display: none; }
  .ox-topbar > .ms-auto { min-width: 0; margin-left: auto !important; gap: .35rem !important; }
  .ox-olt-modal-button { flex: 0 0 auto; max-width: none; }
  .ox-topbar .btn-sm { min-width: 34px; padding-inline: .5rem; }
}

/* ── Menú: letra más grande y legible (palabras cortas → cabe bien) ────── */
.ox-sidebar .nav-link { font-size: 1rem; }
.ox-sidebar .nav-link span { font-size: 1rem; }
.ox-sidebar .nav-link i { font-size: 1.15rem; }
/* Encabezados de sección (RED, SERVICIOS…): un poco más chicos que los items */
.ox-sidebar .nav-item.mt-2 > .nav-link,
.ox-sidebar .nav-item.mt-2 > .nav-link span { font-size: .82rem; }

/* ── Menú lateral responsivo (contraer/expandir) ─────────────────────────
   Móvil (<768): cajón offcanvas-md + barra inferior.
   Tablet/PC (≥768): fijo; expandido = iconos+texto, contraído (html.ox-sb-collapsed)
   = solo iconos (64px) con flyout lateral por grupo. El contenido ocupa el hueco. */
html, body { overflow-x: hidden; }
.ox-content { min-width: 0; }
.ox-sb-flytitle { display: none; }
.ox-sb-toggle { width: 100%; color: var(--bs-secondary-color); border: 0; border-top: 1px solid var(--bs-border-color); border-radius: 0; justify-content: center; white-space: nowrap; }
.ox-sb-toggle:hover { color: var(--bs-emphasis-color); background: var(--bs-secondary-bg); }
.ox-sidebar.offcanvas-md { --bs-offcanvas-width: min(82vw, 320px); }
@media (max-width: 767.98px) {
  .ox-sidebar.offcanvas-md { position: fixed; top: 0; bottom: 0; z-index: 1045; }
  body.ox-app-shell .ox-content { margin-left: 0; }
}
@media (min-width: 768px) {
  .ox-sidebar {
    width: var(--ox-sidebar-width); min-height: 100vh; height: 100vh; position: fixed; top: 0; left: 0; z-index: 1030;
    overflow-y: auto; overflow-x: hidden; border-right: 1px solid var(--bs-border-color); background: #fffdf4;
    transition: width .18s ease;
  }
  [data-bs-theme=dark] .ox-sidebar { background: #171b21; }
  body.ox-app-shell .ox-content { margin-left: var(--ox-sidebar-width); transition: margin-left .18s ease; }
  .ox-main { padding-bottom: 1.5rem !important; }

  html.ox-sb-collapsed { --ox-sidebar-width: 64px; }
  html.ox-sb-collapsed .ox-sidebar { overflow: visible; }
  html.ox-sb-collapsed .ox-sidebar .ox-sidebar-body { padding: .75rem .4rem !important; overflow: visible !important; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-text,
  html.ox-sb-collapsed .ox-sidebar .ox-caret { display: none !important; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-brand { justify-content: center; padding: .25rem 0; }
  html.ox-sb-collapsed .ox-sidebar .nav-link { justify-content: center; padding-inline: 0; }
  html.ox-sb-collapsed .ox-sidebar .nav-link > i.me-2 { margin-right: 0 !important; }
  html.ox-sb-collapsed .ox-sidebar .nav-item.mt-2 { margin-top: .25rem !important; }
  html.ox-sb-collapsed .ox-sb-toggle i { transform: rotate(180deg); }
  /* Flyout: el submenú del grupo se despliega a la derecha al pasar el mouse o al pulsar. */
  html.ox-sb-collapsed .ox-sb-group { position: relative; }
  html.ox-sb-collapsed .ox-sb-group > .collapse {
    display: none; position: absolute; left: calc(100% + .4rem); top: 0; z-index: 1050; min-width: 210px;
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem; box-shadow: var(--ox-shadow); padding: .35rem;
  }
  html.ox-sb-collapsed .ox-sb-group > .collapse::before { content: ""; position: absolute; left: -.6rem; top: 0; bottom: 0; width: .6rem; }
  html.ox-sb-collapsed .ox-sb-group:hover > .collapse,
  html.ox-sb-collapsed .ox-sb-group:focus-within > .collapse,
  html.ox-sb-collapsed .ox-sb-group.ox-fly-open > .collapse { display: block; height: auto !important; }
  html.ox-sb-collapsed .ox-sb-sub { margin: 0 !important; padding: 0 !important; border: 0 !important; }
  html.ox-sb-collapsed .ox-sb-sub .nav-link { justify-content: flex-start; padding-inline: .6rem; }
  html.ox-sb-collapsed .ox-sb-sub .nav-link > i.me-2 { margin-right: .5rem !important; }
  html.ox-sb-collapsed .ox-sb-flytitle { display: block; list-style: none; padding: .25rem .6rem .35rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
}

/* ── Correcciones del menú contraído (fase E1) ───────────────────────────
   Bootstrap pone `.offcanvas-md .offcanvas-body { display:flex }` (fila) a
   partir de 768px: marca, lista y botón quedaban uno AL LADO del otro. Se
   fuerza columna: marca arriba, lista, y el botón contraer al pie. */
@media (min-width: 768px) {
  .ox-sidebar { display: flex; flex-direction: column; }
  .ox-sidebar .ox-sidebar-body {
    display: flex !important; flex-direction: column; flex: 1 1 auto;
    width: 100%; min-height: 100%; overflow-x: hidden;
  }
  .ox-sidebar .ox-sidebar-body > .nav { flex: 0 0 auto; }
  .ox-sidebar .ox-sb-toggle { margin-top: auto !important; flex: 0 0 auto; padding-top: .6rem; }
  .ox-sidebar .ox-sb-single .nav-link { position: relative; }
  .ox-sidebar .ox-sb-single .nav-link .badge { margin-left: auto; }

  html.ox-sb-collapsed .ox-sidebar .ox-sidebar-body { width: 64px; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-brand { width: 100%; margin-bottom: 1rem !important; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-brand svg { width: 32px; height: 32px; flex: 0 0 32px; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-toggle { padding-inline: 0; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-toggle .ox-sb-text { display: none !important; }
  /* Hijos solo en el flyout: ni en línea ni durante la animación de collapse. */
  html.ox-sb-collapsed .ox-sb-group > .collapsing { display: none !important; }
  html.ox-sb-collapsed .ox-sb-group > .nav-link { justify-content: center; }
  /* Badge (avisos) pequeño en la esquina del icono. */
  html.ox-sb-collapsed .ox-sidebar .nav-link { position: relative; }
  html.ox-sb-collapsed .ox-sidebar .ox-sb-single .nav-link .badge {
    position: absolute; top: 2px; right: 6px; margin: 0 !important;
    font-size: .58rem; padding: .15em .35em; line-height: 1.1;
  }
}
