* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f5f7;
    color: #222;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    margin-bottom: 5px;
}

header p {
    color: #666;
}

.panel {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.panel h2 {
    margin-top: 0;
}

.personas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.persona {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    text-align: center;
}

.persona strong {
    display: block;
    margin-bottom: 5px;
}

.persona span {
    font-size: 13px;
    color: #777;
}

form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: bold;
    margin-top: 8px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 7px;
    font-size: 15px;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

button {
    margin-top: 15px;
    padding: 13px;
    border: none;
    border-radius: 8px;
    background: #222;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    opacity: 0.85;
}

.inventario {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(220px, 1fr)
    );

    gap: 12px;
}

.prenda {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
}

.prenda h3 {
    margin-top: 0;
}

.prenda p {
    margin: 6px 0;
}

@media (max-width: 600px) {

    .container {
        padding: 10px;
    }

    .panel {
        padding: 15px;
    }

}


/* Acciones discretas de cada prenda */

.acciones-prenda {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eeeeee;
}

.acciones-prenda form {
    margin: 0;
}

.acciones-prenda .accion-editar,
.acciones-prenda .accion-eliminar {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    padding: 5px 2px;
    color: #777777;
    font-size: 12px;
    font-weight: normal;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}

.acciones-prenda .accion-editar:hover {
    color: #2563eb;
}

.acciones-prenda .accion-eliminar:hover {
    color: #dc2626;
}


/* ------------------------------
   BUSCADOR DEL INVENTARIO
------------------------------ */

.form-buscador {
    margin-top: 15px;
}

.form-buscador label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
}

.form-buscador input,
.form-buscador select {
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    border: 1px solid #dddddd;
    border-radius: 8px;
    background: #ffffff;
}

.campo-busqueda {
    margin-bottom: 16px;
}

.grid-filtros {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.botones-buscador {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.form-buscador .boton-buscar {
    width: auto;
    margin: 0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.boton-limpiar {
    color: #666666;
    font-size: 13px;
    text-decoration: none;
}

.boton-limpiar:hover {
    text-decoration: underline;
}

.cabecera-inventario {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.contador-prendas {
    color: #777777;
    font-size: 13px;
}

.aviso-filtros {
    font-size: 13px;
    color: #666666;
    margin: 10px 0 18px;
}

/* Pantallas pequeñas */

@media (max-width: 600px) {
    .grid-filtros {
        grid-template-columns: 1fr;
    }
}


/* ------------------------------
   FOTOGRAFÍAS DE PRENDAS
------------------------------ */

.seccion-fotografias {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.seccion-fotografias h3 {
    margin-bottom: 15px;
}

.seccion-fotografias input[type="file"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0;
    padding: 10px;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.ayuda-foto {
    font-size: 12px;
    color: #777777;
    margin: 5px 0 18px;
}

.foto-prenda {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 10px;
    margin: 12px 0;
}

.foto-etiqueta {
    display: block;
    max-width: 220px;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
    margin: 10px 0;
}

.enlace-etiqueta {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 12px;
    color: #777777;
    text-decoration: none;
}

.enlace-etiqueta:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ------------------------------
   SUGERENCIAS DE GEMINI
------------------------------ */
.panel-ia {
    margin-top: 18px;
    padding: 15px;
    border: 1px solid #dce4ee;
    border-radius: 10px;
    background: #f8faff;
}
.panel-ia h3 { margin: 0 0 8px; font-size: 16px; }
.panel-ia p { color: #505a66; font-size: 13px; line-height: 1.5; }
.panel-ia .boton-ia,
.panel-ia .aplicar-ia {
    display: inline-block;
    width: auto;
    background: #294e85;
    color: white;
    font-size: 13px;
    padding: 10px 14px;
    margin-top: 6px;
    border-radius: 7px;
}
.panel-ia .aplicar-ia { background: #227447; }
.panel-ia button:disabled { opacity: 0.55; cursor: not-allowed; }
.panel-ia .estado-ia { min-height: 20px; }
.panel-ia .resultado-ia {
    margin-top: 12px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e1e6f0;
}
.panel-ia .resultado-ia[hidden] { display: none; }
.panel-ia .lista-sugerencias { font-size: 13px; padding-left: 20px; line-height: 1.8; }
.panel-ia .aviso-ia { font-size: 12px; }

/* Acciones de fotografía: cámara o galería, con vista previa. */
.foto-selector {
    margin: 12px 0 22px;
    padding: 12px;
    border: 1px solid #e5e9ee;
    border-radius: 10px;
}
.foto-selector .titulo-foto {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}
.opciones-foto {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.opciones-foto .opcion-foto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto;
    padding: 10px 12px;
    margin: 0;
    background: #f1f5fa;
    border: 1px solid #d6e0eb;
    border-radius: 8px;
    color: #263e5e;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.opciones-foto .opcion-foto:hover { background: #e6eef8; }
.opciones-foto .opcion-foto:focus-within { outline: 2px solid #356ac3; }
/* Ocultar visualmente, pero mantener el input accesible a etiquetas. */
.foto-selector .archivo-foto-oculto {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    opacity: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.foto-elegida {
    font-size: 12px;
    color: #697584;
    margin: 10px 0 0;
    overflow-wrap: anywhere;
}
.vista-previa-foto {
    display: block;
    width: 100%;
    max-height: 200px;
    margin-top: 12px;
    border-radius: 8px;
    object-fit: contain;
    background: #f6f8fb;
}
.vista-previa-foto[hidden] { display: none; }

/* ------------------------------
   REGISTRO RÁPIDO 0.5
------------------------------ */
html { scroll-behavior: smooth; }
#anadir-prenda { scroll-margin-top: 12px; }
#inventario { scroll-margin-top: 12px; }
.cabecera-registro { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.cabecera-registro h2 { margin-bottom:10px; }
.marca-registro { font-size:12px; color:#48637f; background:#f0f5fa; padding:5px 9px; border-radius:20px; }
.grid-registro { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.campo-registro { min-width:0; }
.campo-registro label { display:block; margin:10px 0 5px; font-size:13px; }
.campo-registro select, .campo-registro input { width:100%; }
.nota-registro { font-size:12px; color:#667585; line-height:1.45; margin:6px 0 10px; }
.aviso-guardado { background:#eef8f1; color:#25623a; border:1px solid #cce9d4; border-radius:8px; padding:11px 13px; margin:10px 0 16px; }
.titulo-revision { margin:20px 0 7px; font-size:17px; }
.detalles-adicionales { margin:16px 0 7px; border:1px solid #e3e9ef; border-radius:9px; padding:12px; }
.detalles-adicionales summary { font-weight:600; font-size:14px; cursor:pointer; color:#34536e; }
.detalles-adicionales .grid-registro { margin-top:10px; }
.detalles-adicionales > label { display:block; margin:12px 0 6px; font-size:13px; }
.botones-registro { display:flex; gap:10px; flex-wrap:wrap; margin-top:19px; }
.botones-registro button { margin:0; width:auto; flex:1 1 200px; font-size:14px; line-height:1.3; padding:13px 10px; }
.botones-registro .boton-guardar-otra { background:#245b42; color:#fff; }
.botones-registro .boton-guardar-normal { background:#edf1f5; color:#234; border:1px solid #cbd5df; }
@media (max-width:600px) {
  .grid-registro { grid-template-columns:1fr; gap:3px; }
  .botones-registro { flex-direction:column; }
  .botones-registro button { flex:unset; width:100%; }
}

/* Pantalla privada para hosting, compatible con móvil */
.acceso-contenedor { max-width: 440px; margin: 10vh auto 0; padding: 16px; }
.acceso-contenedor .panel { padding: 25px; }
.acceso-error { color: #9a2d30; background: #fff1f2; padding: 10px; border-radius: 8px; }
.salir-contenedor { display: flex; justify-content: flex-end; margin: 8px 0 16px; }
.salir-contenedor button { width: auto; font-size: 13px; background: transparent; color: #5b5b5b; border: 1px solid #ddd; padding: 8px 12px; margin: 0; }


/* Gestión de personas: acción secundaria y confirmación explícita */
.persona { display: flex; flex-direction: column; align-items: center; }
.persona-total { display: block; color: #697584; font-size: 12px; margin-top: 5px; }
.persona-eliminar { margin-top: 9px; padding: 7px 12px; color: #666;
  font-size: 12px; text-decoration: underline; text-underline-offset: 3px;
  border-radius: 6px; }
.persona-eliminar:hover, .persona-eliminar:focus-visible { color: #a52d2d; }
.confirmacion-persona { max-width: 620px; margin-top: 20px; }
.aviso-eliminar-persona { background: #fff4ef; color: #7c3024; border: 1px solid #f2cec2;
  padding: 13px; border-radius: 8px; line-height: 1.6; }
.botones-confirmacion { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.cancelar-eliminacion { padding: 12px 16px; border-radius: 8px; background: #e9eef3;
  color: #243549; text-decoration: none; text-align: center; }
.confirmar-eliminacion { background: #a72c2c; color: white; margin: 0; }
@media (max-width: 600px) {
  .botones-confirmacion { flex-direction: column; align-items: stretch; }
  .botones-confirmacion > * { width: 100%; text-align: center; }
}


/* =============================================================
   VESTIDOR v0.6.3 · Color geométrico (original, accesible y ligero)
   Colores en los contornos y acentos, textos sobre superficies claras.
   ============================================================= */
:root {
  --tinta: #21243e;
  --violeta: #5933ae;
  --coral: #dc4059;
  --turquesa: #006e73;
  --azul: #214a9e;
  --mostaza: #f9ca42;
  --fondo: #fffaf4;
  --borde: #e3dfeb;
  --sombra: 0 8px 28px rgba(33, 36, 62, .075);
}
body { background: var(--fondo); color: var(--tinta); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.5; }
.container { max-width: 1040px; padding: 16px; }
.panel { border: 1px solid var(--borde); border-radius: 18px; box-shadow: var(--sombra); padding: clamp(16px, 3vw, 26px); }
.panel h2 { color: var(--tinta); font-size: clamp(1.2rem, 3vw, 1.55rem); }
.cabecera-colorida {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 175px; padding: 28px clamp(18px, 4vw, 36px);
  border-radius: 22px; text-align: left; background: #262e72; color: #fff;
  margin: 8px 0 14px;
}
.cabecera-colorida::before, .cabecera-colorida::after, .formas-decorativas {
  position: absolute; z-index: -1; pointer-events: none;
}
.cabecera-colorida::before {
  content: ""; right: -4%; top: -38px; width: 42%; height: 210px;
  background: #ffce43;
  clip-path: polygon(44% 0, 100% 0, 100% 60%, 51% 100%, 0 57%);
  transform: rotate(-9deg);
}
.cabecera-colorida::after {
  content: ""; right: 11%; top: 48%; width: 140px; height: 140px;
  background: #f35b70; clip-path: polygon(50% 0, 100% 45%, 61% 100%, 0 64%);
  transform: rotate(18deg);
}
.formas-decorativas {
  display: block; right: 28%; bottom: -36px; width: 110px; height: 130px;
  background: #18c4bf; clip-path: polygon(0 0, 100% 20%, 77% 100%, 20% 80%);
}
.cabecera-colorida h1 { font-size: clamp(1.65rem, 4.5vw, 2.8rem); line-height: 1.12; margin: 8px 0 14px; max-width: 560px; color: #fff; }
.cabecera-colorida h1 span { color: #ffeb99; }
.cabecera-colorida p { color: #fff; max-width: 510px; margin: 8px 0; font-weight: 500; }
.cabecera-colorida .cabecera-etiqueta { font-size: 11px; letter-spacing: .12em; font-weight: 800; }
.navegacion-rapida { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 22px; }
.navegacion-rapida a {
  display: inline-flex; align-items: center; text-decoration: none; color: #283366;
  background: #fff; border: 1px solid #dcd7e9; border-radius: 999px;
  font-size: 13px; font-weight: 700; padding: 9px 14px;
}
.navegacion-rapida a:hover, .navegacion-rapida a:focus-visible { background: #f1eaff; }
#personas { border-top: 5px solid var(--mostaza); }
#anadir-prenda { border-top: 5px solid var(--coral); }
.panel-buscador { border-top: 5px solid var(--azul); }
.panel-inventario { border-top: 5px solid var(--turquesa); }
.panel-anadir-persona { border-top: 5px solid var(--violeta); }
.personas { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
.persona { background: #fffcf8; border: 1px solid #e5dfed; border-radius: 14px; }
.persona:nth-child(4n+1) { border-top: 4px solid #e3526b; }
.persona:nth-child(4n+2) { border-top: 4px solid #6d43c8; }
.persona:nth-child(4n+3) { border-top: 4px solid #008c90; }
.persona:nth-child(4n+4) { border-top: 4px solid #e4a700; }
.persona span, .persona-total { color: #50536a; }
input, select, textarea { background: #fff; border: 1px solid #acaabf; border-radius: 10px; color: var(--tinta); min-height: 44px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid #0b9ca4; outline-offset: 3px;
}
button { background: var(--violeta); color: #fff; border-radius: 10px; font-weight: 700; min-height: 44px; }
button:hover { opacity: 1; filter: brightness(.94); }
.marca-registro { color: #532e91; background: #f3ebff; border: 1px solid #e3d6ff; }
.foto-selector { border: 1px solid #d9d5e8; background: #fffbff; border-radius: 14px; }
.opciones-foto .opcion-foto { color: #242a65; background: #f4eefe; border: 1px solid #dcd2ee; min-height: 44px; }
.opciones-foto .opcion-foto:hover { background: #ece0fc; }
.panel-ia { background: #f1f8ff; border: 1px solid #b7d5eb; border-radius: 14px; }
.panel-ia .boton-ia { background: #224c98; }
.panel-ia .aplicar-ia { background: #08706b; }
.botones-registro .boton-guardar-otra { background: #006e73; }
.botones-registro .boton-guardar-normal { background: #f0ebff; color: #392179; border: 1px solid #ab97dd; }
.form-buscador .boton-buscar { background: #244eaa; }
.boton-limpiar { color: #3f3882; font-weight: 600; }
.fechas-registro { margin: 14px 0; padding: 14px; background: #fff7e5; border: 1px solid #f0d58b; border-radius: 13px; }
.fechas-registro p { margin: 7px 0 0; color: #514b54; font-size: 13px; }
.fechas-registro label { display: block; margin-bottom: 7px; font-size: 14px; }
.fechas-registro .campo-registro { max-width: 320px; }
.prenda { position: relative; background: #fff; border: 1px solid #ddd7e9; border-radius: 16px; padding: 16px; overflow: hidden; box-shadow: 0 3px 14px rgba(36,40,74,.045); }
.prenda::before { content:""; position:absolute; top:0; left:0; right:0; height:5px; background: linear-gradient(90deg, #dc4059 0 24%, #f9ca42 24% 49%, #008b8e 49% 73%, #6941be 73% 100%); }
.prenda h3 { margin: 7px 0 12px; line-height:1.25; font-size: 1.05rem; }
.prenda .foto-prenda { border-radius: 11px; max-height: 190px; background: #f8f6fb; margin-top: 2px; }
.prenda .etiqueta-estado { display: inline-flex; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: capitalize; padding: 4px 10px; background: #f1eef6; color: #33334d; }
.prenda .estado-en_uso { background: #d8f7ec; color: #125c49; }
.prenda .estado-almacenada { background: #dceeff; color: #1b497d; }
.prenda .estado-para_donar { background: #ffe5dd; color: #843f2f; }
.prenda .estado-para_vender { background: #fff0c6; color: #775111; }
.prenda .estado-desechada { background: #eeeef1; color: #434652; }
.metadatos-fechas { display: flex; flex-direction: column; gap: 4px; color: #494e62; font-size: 12px; padding: 11px 0 4px; line-height:1.5; }
.metadatos-fechas time { font-weight: 700; }
.acciones-prenda { border-top-color: #ddd8e7; }
.acciones-prenda .accion-editar, .acciones-prenda .accion-eliminar { color: #49465e; font-size: 13px; min-height: 44px; padding: 10px 4px; }
.pagina-editar { min-height: 100vh; padding: 18px; }
.pagina-editar .contenedor { max-width: 760px; margin: 0 auto; padding: clamp(16px,3vw,32px); border: 1px solid var(--borde); border-top: 6px solid var(--coral); background: #fff; border-radius: 18px; box-shadow: var(--sombra); }
.pagina-editar .contenedor h1 { margin: 12px 0 22px; }
.pagina-editar .contenedor label { display: block; margin: 15px 0 7px; }
.pagina-editar .contenedor .guardar { background: #006e73; }
.pagina-editar .contenedor .cancelar { display: inline-flex; align-items:center; justify-content:center; background: #f1ebfb; color: #373067; text-decoration:none; padding: 12px 20px; border-radius: 10px; font-weight:700; min-height:44px; }
.pagina-editar .botones { display: flex; gap: 12px; flex-wrap:wrap; margin-top:22px; }
.pagina-editar .botones button { margin: 0; }
.pagina-editar .volver-enlace { color: #382b83; font-weight: 700; text-decoration: none; }
.ayuda-fecha { font-size: 13px; color: #52546a; margin: 6px 0 16px; }
.salir-contenedor button { color: #313759; border-color: #b3b3ca; }
@media (max-width: 600px) {
  .cabecera-colorida { min-height: 192px; padding: 24px 18px; }
  .cabecera-colorida::before { right: -80px; top: -20px; width: 190px; }
  .cabecera-colorida::after { right: 0; top: 105px; width: 105px; height: 105px; }
  .formas-decorativas { right: 120px; bottom: -44px; }
  .cabecera-colorida h1, .cabecera-colorida p { max-width: 75%; }
  .navegacion-rapida a { flex: 1 1 44%; justify-content:center; }
  .botones-registro { flex-direction: column; }
  .form-buscador .boton-buscar { width: 100%; }
  .prenda .foto-prenda { max-height: 220px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* v0.6.3.1: botón secundario para quitar fecha sin borrar otros campos. */
.boton-limpiar-fecha {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  width: auto;
  margin: 8px 0 2px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid #d1c4df;
  border-radius: 10px;
  background: #f4effa;
  color: #392b73;
  font-size: 13px;
  font-weight: 700;
}
.boton-limpiar-fecha:hover { background: #e9dff4; }
