/* Estilos del módulo de Desarrollo de AsturPeaks.
   Los colores de marca se inyectan como variables desde config.json (app.js),
   con estos valores por defecto por si la API no responde. */
:root {
  --primario: #FF6600;
  --neutro-oscuro: #0E2841;
  --neutro-claro: #E8E8E8;
  --turquesa: #75C0C7;
  --coral: #D6786B;
  --amarillo: #E4C35C;
  --texto: #1c2733;
  --borde: #d8dde3;
  --fondo: #f5f7f9;
  --ok: #2e8b57;
  --alerta: #c0392b;
  --fuente: 'Montserrat', system-ui, sans-serif;
}

* { box-sizing: border-box; }
/* El atributo `hidden` debe ocultar SIEMPRE, aunque otra regla (p.ej. .modal con
   display:flex) tenga la misma especificidad. Sin esto, la modal queda visible
   y vacía al cargar y bloquea los clics de toda la página. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--fondo);
  font-weight: 400;
}
h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; }
a { color: var(--primario); }
button { font-family: var(--fuente); cursor: pointer; }

/* ── Cabecera ─────────────────────────────────────────────── */
.cabecera {
  background: var(--neutro-oscuro);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.cabecera__marca { display: flex; align-items: center; gap: 16px; }
.cabecera__logo { height: 46px; width: auto; }
.cabecera__titulo { margin: 0; font-size: 1.15rem; }
.cabecera__tagline { margin: 2px 0 0; font-size: .78rem; font-weight: 300; color: var(--turquesa); }

/* ── Acceso (login) ───────────────────────────────────────── */
.login { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: var(--neutro-oscuro); padding: 20px; }
.login__caja { background: #fff; border-radius: 16px; padding: 30px; width: 360px; max-width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.35); text-align: center; }
.login__logo { height: 40px; background: var(--neutro-oscuro); padding: 12px 18px; border-radius: 12px; }
.login__titulo { margin: 16px 0 0; font-size: 1.15rem; }
.login__sub { margin: 2px 0 18px; color: #8595a4; font-size: .82rem; font-weight: 300; }
.login__caja .campo { text-align: left; }
.login__error { color: var(--alerta); font-size: .82rem; min-height: 1.1em; margin: 10px 0 0; }

/* ── Barra de usuario ─────────────────────────────────────── */
.usuario { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usuario__email { color: #cdd6e0; font-size: .8rem; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav__item {
  background: transparent; color: #cdd6e0; border: 1px solid transparent;
  padding: 8px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600;
}
.nav__item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav__item.is-activo { background: var(--primario); color: #fff; }

/* ── Contenido ────────────────────────────────────────────── */
.contenido { padding: 24px; max-width: 1200px; margin: 0 auto; }

.barra {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.barra h2 { margin: 0; }

/* ── Botones ──────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600;
  font-size: .85rem; background: var(--neutro-claro); color: var(--texto);
}
.btn:hover { filter: brightness(.96); }
.btn--primario { background: var(--primario); color: #fff; }
.btn--oscuro { background: var(--neutro-oscuro); color: #fff; }
.btn--peligro { background: #fdecea; color: var(--alerta); }
.btn--mini { padding: 5px 10px; font-size: .75rem; }
.btn--enlace { background: none; color: var(--primario); padding: 4px; }

/* ── Tarjetas (listado de prendas) ────────────────────────── */
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.inicio__grupo { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primario); font-weight: 700; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--borde); }
.inicio__grupo:first-of-type { margin-top: 4px; }
/* Portada: layout con sidebar de Administración (solo admins) + módulos */
.inicio-layout { display: flex; gap: 20px; align-items: flex-start; }
.inicio-main { flex: 1; min-width: 0; }
.inicio-admin { flex: 0 0 220px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 12px; }
.inicio-admin__t { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #7a849a; font-weight: 700; margin: 2px 0 8px; }
.inicio-admin__item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--texto); font-family: inherit; }
.inicio-admin__item:hover { background: var(--fondo); border-color: var(--borde); }
@media (max-width: 760px) { .inicio-layout { flex-direction: column; } .inicio-admin { flex: auto; width: 100%; } }
/* Conmutador de idioma (cabecera) */
.lang-switch { display: inline-flex; background: rgba(255,255,255,.14); border-radius: 6px; overflow: hidden; }
.lang-switch button { background: transparent; border: none; color: #cdd6e0; padding: 3px 9px; cursor: pointer; font-weight: 700; font-size: 11px; font-family: inherit; }
.lang-switch button.on { background: var(--primario); color: #fff; }
/* Campo bilingüe (formularios) */
.bil { margin: 10px 0; }
.bil__cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.bil__label { font-weight: 600; }
.bil__btn { white-space: nowrap; }
.bil__campos { display: flex; flex-direction: column; gap: 6px; }
.bil__lang { display: flex; align-items: flex-start; gap: 6px; }
.bil__tag { flex: 0 0 30px; font-size: 11px; font-weight: 700; color: var(--primario); padding-top: 8px; text-align: center; }
.bil__lang input, .bil__lang textarea { flex: 1; }
.bil__msg { font-size: 12px; margin-top: 4px; color: var(--neutro, #555); }
.bil__msg--err { color: #c0392b; }
.tarjeta {
  background: #fff; border: 1px solid var(--borde); border-radius: 12px;
  padding: 16px; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.tarjeta:hover { box-shadow: 0 6px 18px rgba(14,40,65,.10); transform: translateY(-2px); }
.tarjeta h3 { margin: 0 0 6px; font-size: 1rem; }
.modulo { text-align: center; padding: 22px 16px; }
.modulo__icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.modulo .tarjeta__meta { min-height: 2.4em; }
.tarjeta__meta { font-size: .8rem; color: #5b6b7b; }

/* ── Etiquetas de estado ──────────────────────────────────── */
.estado {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.estado--en\.testeo, .estado--en-testeo { background: #eef2f6; color: #5b6b7b; }
.estado--muestra { background: #fff3e0; color: #b9690f; }
.estado--aprobada { background: #e8f5ee; color: var(--ok); }
.estado--catalogo { background: #e7f0ff; color: #1a5fb4; }
.estado--descartada { background: #fdecea; color: var(--alerta); }

/* ── Formularios ──────────────────────────────────────────── */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: 4px; color: #4a5a6a; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px;
  font-family: var(--fuente); font-size: .88rem;
}
.campo textarea { min-height: 64px; resize: vertical; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Tablas ───────────────────────────────────────────────── */
.tabla { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.tabla th, .tabla td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--borde); font-size: .85rem; }
.tabla th { background: var(--neutro-oscuro); color: #fff; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.tabla tr:hover td { background: #fafcfd; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.mejor { color: var(--ok); font-weight: 700; }
.peor { color: var(--alerta); font-weight: 700; }
.tabla .grupo { background: var(--neutro-claro); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--neutro-oscuro); }

/* ── Matriz de medidas ────────────────────────────────────── */
.matriz { width: 100%; border-collapse: collapse; background: #fff; }
.matriz th, .matriz td { border: 1px solid var(--borde); padding: 6px; text-align: center; font-size: .8rem; }
.matriz th { background: var(--neutro-oscuro); color: #fff; }
.matriz td input { width: 60px; border: 1px solid var(--borde); border-radius: 6px; padding: 4px; text-align: center; font-family: var(--fuente); }
.matriz .punto { text-align: left; font-weight: 600; background: #f0f4f7; }
.celda-doble input { width: 52px; }
.fuera { background: #fdecea !important; }
.fuera input { color: var(--alerta); font-weight: 700; }

/* ── Secciones / paneles ──────────────────────────────────── */
.panel { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.panel h3 { margin-top: 0; }
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid var(--borde); }
.subtab { background: none; border: none; padding: 10px 14px; font-weight: 600; color: #5b6b7b; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subtab.is-activo { color: var(--primario); border-bottom-color: var(--primario); }

/* ── Galería ──────────────────────────────────────────────── */
.galeria { display: flex; flex-wrap: wrap; gap: 10px; }
.galeria__item { position: relative; }
.galeria__item img { height: 110px; width: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); }
.galeria__borrar { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; }

/* ── Organigrama (árbol de puestos) ───────────────────────── */
.org { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 14px; }
.org-nodo { border-left: 2px solid var(--neutro-claro); padding-left: 10px; margin-top: 8px; }
.org-fila { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-nombre { font-weight: 700; color: var(--neutro-oscuro); }
.org-acc { display: inline-flex; gap: 5px; margin-left: auto; }
.org-desc { font-size: .8rem; margin: 2px 0 0; }

/* ── Materiales (partes y abalorios) ──────────────────────── */
.material { border: 1px solid var(--borde); border-radius: 10px; padding: 14px; margin-bottom: 14px; background: #fafcfd; }
.material__cab { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.material__cab .m-nombre { flex: 1; min-width: 180px; padding: 9px 11px; border: 1px solid var(--borde); border-radius: 8px; font-family: var(--fuente); font-weight: 700; font-size: 1rem; }
.material__cab .m-clase { padding: 8px; border: 1px solid var(--borde); border-radius: 8px; font-family: var(--fuente); }
/* La sub-tabla de composición no debe competir con el nombre del material:
   cabecera suave en lugar del azul oscuro general de .tabla th. */
.material .tabla th { background: #eef2f6; color: #5b6b7b; text-transform: none; font-weight: 600; font-size: .72rem; }

/* ── Esquema técnico interactivo ──────────────────────────── */
.esquema {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  touch-action: none;
}
.esquema__img { display: block; max-width: 460px; width: 100%; height: auto; user-select: none; }
.esquema__placeholder {
  width: 420px; max-width: 100%; min-height: 320px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  color: #8595a4; background: repeating-linear-gradient(45deg, #fafcfd, #fafcfd 12px, #f1f5f8 12px, #f1f5f8 24px);
}
.marcador {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 5px;
  cursor: grab; touch-action: none; user-select: none; z-index: 2;
}
.marcador.arrastrando { cursor: grabbing; z-index: 5; }
.marcador__dot {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--primario); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); flex: 0 0 auto;
}
.marcador__etq {
  background: var(--neutro-oscuro); color: #fff; font-size: .68rem; font-weight: 600;
  padding: 2px 7px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Resultado calculadora ────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.kpi { background: var(--fondo); border-radius: 10px; padding: 12px; }
.kpi__valor { font-size: 1.35rem; font-weight: 800; color: var(--neutro-oscuro); }
.kpi__etq { font-size: .72rem; color: #5b6b7b; text-transform: uppercase; }
.kpi--pos .kpi__valor { color: var(--ok); }
.kpi--neg .kpi__valor { color: var(--alerta); }

/* ── Modal ────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(14,40,65,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal__caja { background: #fff; border-radius: 14px; padding: 24px; max-width: 720px; width: 100%; position: relative; }
.modal__cerrar { position: absolute; top: 12px; right: 14px; border: none; background: none; font-size: 1.6rem; line-height: 1; color: #889; }

/* ── Aviso flotante ───────────────────────────────────────── */
.aviso { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--neutro-oscuro); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: .85rem; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

.vacio { text-align: center; color: #8595a4; padding: 40px; }
.muted { color: #8595a4; font-size: .82rem; }
@media (max-width: 640px) { .fila { grid-template-columns: 1fr; } }
