/* Tema basado en Design/index.html: lienzo claro, tarjetas blancas, azul primario y barra lateral de iconos.
   Se apoya en Bootstrap (autoalojado) porque la CSP no permite CDN ni fuentes externas. */
:root {
  --bs-primary: #0056c4;
  --bs-primary-rgb: 0, 86, 196;
  --bs-link-color: #0056c4;
  --bs-link-color-rgb: 0, 86, 196;
  --bs-link-hover-color: #1d6fec;
  --bs-body-color: #0a1d2f;
  --bs-body-color-rgb: 10, 29, 47;
  --bs-secondary-color: #515d6d;
  --bs-body-bg: #f4f7fc;
  --bs-tertiary-bg: #f4f7fc;
  --bs-tertiary-bg-rgb: 244, 247, 252;
  --bs-border-color: #e8edf5;
  --bs-success: #00b871;
  --bs-success-rgb: 0, 184, 113;
  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245, 158, 11;
  --bs-danger: #ef4444;
  --bs-danger-rgb: 239, 68, 68;
  --bs-border-radius: .5rem;
  --bs-font-sans-serif: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .8125rem;
  --bs-body-line-height: 1.55;
  --sidebar-w: 5rem;
}
body { -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3 { letter-spacing: -.015em; font-weight: 600; }
h1.h3 { font-size: 1.5rem; }

/* Estructura: barra lateral + cabecera + contenido */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1030;
  background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.04);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 1.5rem 0;
}
.app-sidebar nav, .app-sidebar .app-sidebar-pie { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.app-logo {
  width: 2.5rem; height: 2.5rem; border-radius: .75rem; background: var(--bs-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.app-nav-link {
  width: 3rem; height: 3rem; border: 0; background: transparent; border-radius: .75rem; color: #424754;
  display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.login-logo { display: block; max-height: 4rem; max-width: 12rem; margin: 0 auto 1.25rem; object-fit: contain; }
.app-nav-link:hover { background: #dbe9ff; color: #0a1d2f; }
.app-nav-link.activo { background: #1d6fec; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.app-nav-link svg, .app-logo svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-cuerpo { padding-left: var(--sidebar-w); min-height: 100vh; }
.app-header {
  position: sticky; top: 0; z-index: 1020; height: 4rem; padding: 0 1.75rem;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px); box-shadow: 0 1px 8px rgba(0,0,0,.04);
  display: flex; align-items: center; justify-content: space-between;
}
.app-titulo { display: flex; align-items: center; gap: .875rem; font-weight: 600; font-size: .95rem; color: #0a1d2f; text-decoration: none; min-width: 0; }
.app-titulo-logo { height: 2.75rem; max-width: 11rem; object-fit: contain; }
.app-titulo-logo + span { padding-left: .875rem; border-left: 1px solid var(--bs-border-color); white-space: nowrap; }
.app-usuario { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.app-avatar {
  width: 2rem; height: 2rem; border-radius: 50%; background: var(--bs-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600;
}
.app-main { padding: 1.75rem; max-width: 1400px; }
.app-sin-sesion .app-cuerpo { padding-left: 0; }
.app-sin-sesion .app-main { margin: 0 auto; max-width: 960px; }

/* Tarjetas */
.card { border: 0; border-radius: .75rem; background: #fff; }
.card.shadow-sm { box-shadow: 0 1px 8px rgba(0,0,0,.05) !important; }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color); padding: 1rem 1.25rem; font-size: .95rem; }
.card-header.text-bg-primary { background: var(--bs-primary) !important; border-radius: .75rem .75rem 0 0; }
.card-body { padding: 1.25rem; }
.card.border-primary { border: 1px solid var(--bs-primary) !important; }
.list-group-item { border-color: var(--bs-border-color); }

/* Tablas de alta densidad */
.table { --bs-table-hover-bg: rgba(238, 244, 255, .6); --bs-table-border-color: #eef2f8; }
.table > thead > tr > th {
  background: #eef4ff; color: #515d6d; font-size: .6875rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: .75rem 1rem; border-bottom: 0;
}
.table > tbody > tr > td { padding: .75rem 1rem; }

/* Botones y formularios */
.btn { border-radius: .5rem; font-weight: 600; font-size: .8125rem; }
.btn-primary { --bs-btn-bg: #0056c4; --bs-btn-border-color: #0056c4; --bs-btn-hover-bg: #1d6fec; --bs-btn-hover-border-color: #1d6fec;
  --bs-btn-active-bg: #004299; --bs-btn-active-border-color: #004299; --bs-btn-disabled-bg: #0056c4; --bs-btn-disabled-border-color: #0056c4; }
.btn-outline-primary { --bs-btn-color: #0056c4; --bs-btn-border-color: #0056c4; --bs-btn-hover-bg: #0056c4; --bs-btn-hover-border-color: #0056c4;
  --bs-btn-active-bg: #0056c4; --bs-btn-active-border-color: #0056c4; }
.form-control, .form-select { background-color: #eef4ff; border-color: transparent; border-radius: .5rem; }
.form-control:focus, .form-select:focus { background-color: #fff; border-color: #0056c4; box-shadow: 0 0 0 .2rem rgba(0, 86, 196, .15); }
.form-label { font-weight: 600; font-size: .75rem; color: #424754; }
.badge { border-radius: 999px; font-weight: 600; font-size: .6875rem; padding: .35em .7em; }
.alert { border: 0; border-radius: .5rem; }

.btn-group.is-invalid .btn-outline-primary { border-color: var(--bs-form-invalid-border-color); }
.list-group.is-invalid { outline: 1px solid var(--bs-form-invalid-border-color); border-radius: .5rem; }

/* Indicador de etapas de la nueva ficha */
.pasos { display: flex; gap: .5rem; list-style: none; padding: .5rem; margin: 0 0 1.25rem; background: #fff; border-radius: .75rem; box-shadow: 0 1px 8px rgba(0,0,0,.05); }
.pasos li { flex: 1; min-width: 0; }
.pasos button {
  width: 100%; display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem;
  border: 0; border-radius: .5rem; background: transparent; color: #515d6d; font-weight: 600; text-align: left;
}
.pasos button:hover { background: #eef4ff; color: #0a1d2f; }
.pasos-num {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #e5eeff; color: #0056c4; font-size: .75rem;
}
.pasos-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pasos .activo button { background: #eef4ff; color: #0a1d2f; }
.pasos .activo .pasos-num { background: #0056c4; color: #fff; }
.pasos .hecho .pasos-num { background: #00b871; color: #fff; }
@media (max-width: 767.98px) {
  .pasos-texto { display: none; }
  .pasos .activo .pasos-texto { display: inline; }
}
#disponibilidad:empty { display: none; }

/* Móvil: la barra lateral pasa a barra superior */
@media (max-width: 767.98px) {
  :root { --sidebar-w: 0rem; }
  .app-sidebar { position: static; width: 100%; flex-direction: row; padding: .5rem 1rem; }
  .app-sidebar > div:first-child { display: flex; align-items: center; gap: .5rem; }
  .app-sidebar nav, .app-sidebar .app-sidebar-pie { flex-direction: row; }
  .app-logo { margin: 0; }
  .app-nav-link { width: 2.5rem; height: 2.5rem; }
  .app-header { padding: 0 1rem; position: static; }
  .app-main { padding: 1rem; }
  .app-usuario .d-none-movil { display: none; }
  .app-titulo-logo { height: 2.25rem; max-width: 7rem; }
  .app-titulo-logo + span { display: none; }
}
@media print { .app-sidebar, .app-header { display: none; } .app-cuerpo { padding-left: 0; } }
