/* =========================================================
   RocaLab · Panel interno (staff) — layout tipo app
   ========================================================= */

.rl-app {
  display: flex;
  min-height: 100vh;
  background: var(--rl-gray-100);
}

/* ---------- Sidebar ---------- */
.rl-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--rl-white);
  color: var(--rl-gray-900);
  border-right: 1px solid var(--rl-gray-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rl-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--rl-black);
  border-bottom: 1px solid var(--rl-gray-300);
}
.rl-sidebar__brand img { height: 34px; }

.rl-sidebar__nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.rl-sidebar__group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rl-gray-500);
  padding: 14px 12px 6px;
}

.rl-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--rl-gray-700);
  font-family: var(--rl-font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--rl-transition);
  margin-bottom: 2px;
}
.rl-nav-item .ico { width: 20px; text-align: center; }
.rl-nav-item:hover { background: var(--rl-red-light); color: var(--rl-red-dark); }
.rl-nav-item.active { background: var(--rl-red); color: #fff; }
/* Indicador de "nuevo"/no leído (ej. Resultados, Cotizaciones enviadas del
   portal de referencias) — un conteo chico a la derecha del texto, mismo
   lenguaje visual que .rl-nav-item .soon pero en rojo (esto SÍ requiere
   atención, no es "próximamente"). */
.rl-nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rl-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.rl-nav-item.active .rl-nav-badge { background: #fff; color: var(--rl-red); }
.rl-nav-item.disabled { color: var(--rl-gray-500); cursor: not-allowed; }
.rl-nav-item.disabled:hover { background: transparent; color: var(--rl-gray-500); }
.rl-nav-item .soon {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  background: var(--rl-gray-100);
  color: var(--rl-gray-500);
  border: 1px solid var(--rl-gray-300);
  padding: 2px 6px;
  border-radius: 999px;
}

.rl-sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid var(--rl-gray-300);
}
.rl-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.rl-sidebar__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--rl-red);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.rl-sidebar__user-info { overflow: hidden; }
.rl-sidebar__user-info .name { font-size: 0.85rem; font-weight: 600; color: var(--rl-black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-sidebar__user-info .role { font-size: 0.72rem; color: var(--rl-gray-500); text-transform: capitalize; }

/* ---------- Main area ---------- */
.rl-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rl-topbar {
  background: var(--rl-white);
  border-bottom: 1px solid var(--rl-gray-300);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rl-topbar h1 { font-size: 1.25rem; margin: 0; }
.rl-topbar p { margin: 2px 0 0; font-size: 0.85rem; color: var(--rl-gray-500); }

.rl-content {
  padding: 28px 32px 60px;
  flex: 1;
}

.rl-panel-section { display: none; }
.rl-panel-section.active { display: block; animation: fadeIn .25s ease; }

/* ---------- Toolbar / búsqueda ---------- */
.rl-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.rl-toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--rl-gray-300);
  font-family: var(--rl-font);
  font-size: 0.9rem;
}
.rl-toolbar input[type="search"]:focus { outline: none; border-color: var(--rl-red); }

/* ---------- Tabla ---------- */
.rl-table-wrap {
  background: var(--rl-white);
  border: 1px solid var(--rl-gray-300);
  border-radius: var(--rl-radius);
  overflow: hidden;
}
table.rl-table { width: 100%; border-collapse: collapse; }
table.rl-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rl-gray-500);
  padding: 14px 20px;
  background: var(--rl-gray-100);
  border-bottom: 1px solid var(--rl-gray-300);
}
table.rl-table td {
  padding: 14px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--rl-gray-100);
}
table.rl-table tbody tr { cursor: pointer; transition: var(--rl-transition); }
table.rl-table tbody tr:hover { background: var(--rl-red-light); }
table.rl-table tbody tr:last-child td { border-bottom: none; }

.rl-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--rl-gray-500);
}
.rl-empty-state .ico { font-size: 2.2rem; margin-bottom: 12px; }

.rl-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.rl-pill--adulto { background: #e6f6ec; color: #1c7c4c; }
.rl-pill--menor { background: #fff4e0; color: #9a6700; }
.rl-pill--especial { background: #eee7fb; color: #6b3fbf; }
.rl-pill--adulto_mayor { background: #e0f0ff; color: #1a5fa8; }
.rl-pill--pendiente { background: #fff4e0; color: #9a6700; }
.rl-pill--aceptada { background: #e6f6ec; color: #1c7c4c; }
.rl-pill--rechazada { background: #fdecec; color: #a3222f; }
.rl-pill--vencida { background: var(--rl-gray-100); color: var(--rl-gray-500); }
.rl-pill--pagada { background: #e6f0ff; color: #1d4fa8; }
.rl-pill--confirmada { background: #e0f0ff; color: #1a5fa8; }
.rl-pill--en_espera { background: #fff4e0; color: #9a6700; }
.rl-pill--atendida { background: #e6f6ec; color: #1c7c4c; }
.rl-pill--no_asistio { background: #fdecec; color: #a3222f; }
.rl-pill--cancelada { background: var(--rl-gray-100); color: var(--rl-gray-500); }

/* ---------- Subtabs (dentro de una sección) ---------- */
.rl-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rl-gray-300);
}
.rl-subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  margin-right: 18px;
  font-family: var(--rl-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--rl-gray-500);
  cursor: pointer;
  transition: var(--rl-transition);
}
.rl-subtab-btn:hover { color: var(--rl-red-dark); }
.rl-subtab-btn.active { color: var(--rl-red); border-bottom-color: var(--rl-red); }
.rl-subtab-panel { display: none; }
.rl-subtab-panel.active { display: block; animation: fadeIn .2s ease; }

/* ---------- Resultados de búsqueda (buscador paciente / servicio) ---------- */
.rl-search-results {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--rl-gray-300);
  border-radius: 10px;
}
.rl-search-results:empty { display: none; border: none; }
.rl-search-result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rl-gray-100);
  cursor: pointer;
  text-align: left;
  font-family: var(--rl-font);
}
.rl-search-result-item:last-child { border-bottom: none; }
.rl-search-result-item:hover { background: var(--rl-red-light); }
.rl-search-result-item strong { font-size: 0.88rem; }
.rl-search-result-item span { font-size: 0.78rem; color: var(--rl-gray-500); }

/* ---------- Carrito de servicios (armador de cotizaciones) ---------- */
.rl-carrito-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rl-gray-100);
}
.rl-carrito-item:last-child { border-bottom: none; }
.rl-carrito-item .nombre { flex: 1; font-size: 0.88rem; }
.rl-carrito-item .precio { font-size: 0.85rem; color: var(--rl-gray-500); white-space: nowrap; }
.rl-carrito-item input[type="number"] {
  width: 56px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--rl-gray-300);
  text-align: center;
  font-family: var(--rl-font);
}
.rl-carrito-item .quitar {
  background: transparent;
  border: none;
  color: var(--rl-red);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
}
.rl-carrito-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 4px;
  font-weight: 700;
  font-size: 1.05rem;
  border-top: 1.5px solid var(--rl-gray-300);
  margin-top: 8px;
}

/* ---------- Drawer / ficha lateral ---------- */
.rl-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.45);
  display: none;
  z-index: 200;
}
.rl-drawer-overlay.show { display: block; }

.rl-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  background: var(--rl-white);
  box-shadow: -10px 0 40px rgba(0,0,0,0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 201;
  overflow-y: auto;
  overflow-x: hidden;
}
.rl-drawer.show { transform: translateX(0); }

.rl-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--rl-gray-300);
  position: sticky;
  top: 0;
  background: var(--rl-white);
}
.rl-drawer__close {
  background: var(--rl-gray-100);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}
.rl-drawer__body { padding: 24px; }
/* Dentro del drawer, la tarjeta del carnet (código/QR/barras) debe ocupar el
   mismo ancho que las cajas de abajo (review-box) — el max-width:360px de
   .rl-carnet es para cuando se usa suelta en una página ancha (registro.html),
   pero aquí, dentro de un panel angosto, solo hacía que se viera más chica. */
.rl-drawer .rl-carnet { max-width: none; }

.rl-loading {
  text-align: center;
  padding: 40px;
  color: var(--rl-gray-500);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .rl-sidebar { position: fixed; left: -260px; z-index: 300; transition: left 0.25s ease; }
  .rl-sidebar.open { left: 0; }
  .rl-app { flex-direction: column; }
}
