/* ==========================================================================
   Marchante PVC — DEMO del área de clientes. Se apoya en /css/estilo.css
   (mismas variables, tipografías y botones). Mobile first.
   ========================================================================== */

body.portal { background: var(--papel-2); padding-bottom: 0; min-height: 100vh; display: flex; flex-direction: column; }
body.portal main { flex: 1; }

/* Franja de demo, visible en todas las pantallas */
.franja-demo { position: sticky; top: 0; z-index: 120; display: flex; justify-content: center; align-items: center; gap: 0.5rem; min-height: 1.9rem; padding: 0.25rem 1rem; background: var(--tinta); color: #fff; font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }
.franja-demo::before { content: ""; width: 0.5rem; height: 0.5rem; background: var(--rojo); border-radius: 50%; flex: none; }

/* Cabecera del portal */
.p-cabecera { background: var(--papel); border-bottom: 1px solid var(--linea); }
.p-cabecera__barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.p-cabecera__logo { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: var(--tinta); min-height: 2.75rem; }
.p-cabecera__logo img { height: 2.5rem; width: auto; }
.p-cabecera__logo span { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gris-medio); padding-left: 0.9rem; border-left: 1px solid var(--linea); line-height: 1.3; }
.p-usuario { display: flex; align-items: center; gap: 0.25rem; font-size: 0.9063rem; }
.p-usuario__nombre { display: none; color: var(--texto); margin-right: 0.75rem; }
.p-usuario a, .p-usuario button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; min-width: 2.75rem; padding: 0 0.6rem; font: 500 0.9063rem var(--sans); color: var(--tinta); background: none; border: 0; text-decoration: none; cursor: pointer; }
.p-usuario a:hover, .p-usuario button:hover { color: var(--rojo-ui); }
@media (min-width: 48em) { .p-usuario__nombre { display: inline; } }
@media (max-width: 23em) { .p-cabecera__logo span { display: none; } }

/* Navegación de secciones: en escritorio, pestañas bajo la cabecera; en móvil, barra inferior fija */
.p-nav { background: var(--papel); border-bottom: 1px solid var(--linea); }
.p-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.p-nav ul::-webkit-scrollbar { display: none; }
.p-nav a { display: flex; align-items: center; gap: 0.5rem; min-height: 3rem; padding: 0 0.9rem; font-size: 0.9375rem; font-weight: 500; color: var(--texto); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.p-nav a:hover { color: var(--tinta); }
.p-nav a[aria-current] { color: var(--tinta); border-bottom-color: var(--rojo); }
.p-nav svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.p-nav li:first-child a { padding-left: 0; }
@media (max-width: 59.99em) {
  .p-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 110; border-bottom: 0; border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 24px rgba(18, 28, 34, 0.08); }
  .p-nav .contenedor { padding-inline: 0; }
  .p-nav ul { gap: 0; overflow: visible; display: grid; grid-template-columns: repeat(5, 1fr); }
  .p-nav li.p-nav__secundario { display: none; }
  .p-nav a { flex-direction: column; justify-content: center; gap: 0.2rem; min-height: 3.5rem; padding: 0.35rem 0.1rem; font-size: 0.75rem; border-bottom: 0; border-top: 2px solid transparent; }
  .p-nav li:first-child a { padding-left: 0.1rem; }
  .p-nav a[aria-current] { border-top-color: var(--rojo); }
  body.portal--sesion { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 59.99em) and (max-height: 30em) { .p-nav a { flex-direction: row; min-height: 2.75rem; gap: 0.4rem; } body.portal--sesion { padding-bottom: 2.75rem; } .franja-demo { position: static; } }

/* Estructura de página */
.p-pagina { padding-block: clamp(1.75rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem); }
.p-titulo { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
.p-titulo h1 { font-size: clamp(2.1rem, 4.5vw, 3.1rem); }
.p-titulo p { margin: 0.5rem 0 0; max-width: 40em; }
.p-volver { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; margin-bottom: 0.25rem; font-size: 0.9375rem; color: var(--texto); text-decoration: none; }
.p-volver::before { content: "←"; }
.p-volver:hover { color: var(--rojo-ui); }
.p-seccion { margin-top: clamp(2rem, 4vw, 3rem); }
.p-seccion__cab { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.p-seccion__cab h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
.p-seccion__cab a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: 0.9375rem; font-weight: 500; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.p-seccion__cab a::after { content: " →"; color: var(--rojo-ui); margin-left: 0.3rem; }

.p-panel { background: var(--papel); border: 1px solid var(--linea); padding: clamp(1.1rem, 3vw, 1.75rem); }
.p-panel + .p-panel { margin-top: 1rem; }
.p-panel h2, .p-panel h3 { font-family: var(--sans); font-size: 1.0625rem; font-weight: 600; margin-bottom: 0.9rem; }
.p-rejilla { display: grid; gap: 1rem; }
@media (min-width: 48em) { .p-rejilla--2 { grid-template-columns: 1fr 1fr; } .p-rejilla--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64em) { .p-rejilla--detalle { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.p-rejilla > * { min-width: 0; }
.p-rejilla > .p-panel + .p-panel { margin-top: 0; }

/* Resumen del panel de inicio */
.p-resumen { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--linea); border: 1px solid var(--linea); }
@media (min-width: 48em) { .p-resumen { grid-template-columns: repeat(4, 1fr); } }
.p-resumen a { display: grid; gap: 0.25rem; padding: 1.1rem 1.1rem 1.25rem; background: var(--papel); text-decoration: none; min-height: 6rem; align-content: start; }
.p-resumen a:hover strong { color: var(--rojo-ui); }
.p-resumen span { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris-medio); line-height: 1.35; }
.p-resumen strong { font-family: var(--serif); font-weight: 400; font-size: clamp(2.1rem, 5vw, 2.75rem); line-height: 1; color: var(--tinta); transition: color 0.2s; }
.p-resumen em { font-style: normal; font-size: 0.875rem; color: var(--texto); }

/* Pastillas de estado */
.pastilla { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.65rem; font-size: 0.8125rem; font-weight: 500; line-height: 1.3; border: 1px solid currentColor; white-space: nowrap; }
.pastilla::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.pastilla--aviso { color: #8a5a00; background: #fdf6e7; }
.pastilla--curso { color: #1d4f7a; background: #eef5fb; }
.pastilla--ok { color: #1f6b3a; background: #eef8f1; }
.pastilla--neutro { color: #5b6368; background: #f3f4f5; }
.pastilla--alerta { color: var(--rojo-ui); background: #fdf0f0; }

/* Listados: tarjetas en móvil, filas en escritorio */
.p-filtros { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.p-filtros button { min-height: 2.75rem; padding: 0 1rem; font: 500 0.9375rem var(--sans); color: var(--tinta); background: var(--papel); border: 1px solid var(--linea); cursor: pointer; }
.p-filtros button[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.p-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.p-item { display: grid; gap: 0.6rem; padding: 1.1rem 1.1rem 1.2rem; background: var(--papel); border: 1px solid var(--linea); text-decoration: none; color: inherit; position: relative; transition: border-color 0.2s; }
a.p-item:hover { border-color: var(--tinta); }
.p-item__cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.p-item__id { font-weight: 600; color: var(--tinta); font-variant-numeric: tabular-nums; }
.p-item__titulo { font-family: var(--serif); font-size: 1.45rem; line-height: 1.15; color: var(--tinta); }
.p-item__meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.9063rem; }
.p-item__meta b { font-weight: 600; color: var(--tinta); }
.p-item__pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding-top: 0.75rem; border-top: 1px solid var(--linea); }
.p-item__importe { font-weight: 600; color: var(--tinta); font-variant-numeric: tabular-nums; }
.p-acciones { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.p-boton { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 1rem; font: 500 0.9375rem var(--sans); text-decoration: none; color: var(--tinta); background: var(--papel); border: 1px solid var(--tinta); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.p-boton:hover { background: var(--tinta); color: #fff; }
.p-boton--primario { background: var(--rojo-ui); border-color: var(--rojo-ui); color: #fff; }
.p-boton--primario:hover { background: var(--tinta); border-color: var(--tinta); }
.p-boton--pdf::before { content: "PDF"; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.1rem 0.3rem; border: 1px solid currentColor; }
.p-vacio { padding: 2rem 1.25rem; text-align: center; background: var(--papel); border: 1px dashed var(--gris); }

/* Progreso del pedido por fases */
.fases { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
.fases li { display: grid; gap: 0.45rem; font-size: 0.75rem; line-height: 1.25; color: var(--gris-medio); }
.fases li::before { content: ""; height: 0.3rem; background: var(--linea); }
.fases li.hecha::before { background: var(--tinta); }
.fases li.actual::before { background: var(--rojo); }
.fases li.hecha, .fases li.actual { color: var(--tinta); font-weight: 500; }
.fases small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--gris-medio); }
.fases--grande { gap: 0.5rem; }
.fases--grande li { font-size: 0.875rem; }
.fases--grande li::before { height: 0.4rem; }
@media (max-width: 26em) { .fases li { font-size: 0.75rem; } .fases--grande li { font-size: 0.75rem; } }

/* Detalle: pares dato/valor y líneas de presupuesto */
.p-datos { margin: 0; display: grid; gap: 0; }
.p-datos > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--linea); }
.p-datos > div:last-child { border-bottom: 0; }
.p-datos dt { color: var(--texto); }
.p-datos dd { margin: 0; text-align: right; font-weight: 600; color: var(--tinta); }
.p-datos .total dt, .p-datos .total dd { font-size: 1.125rem; color: var(--tinta); font-weight: 600; }
.p-lineas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.p-linea { display: grid; grid-template-columns: 2rem 1fr; gap: 0.25rem 0.75rem; padding: 1.1rem 0; border-top: 1px solid var(--linea); }
.p-linea:first-child { border-top: 0; padding-top: 0; }
.p-linea__pos { font-size: 0.8125rem; color: var(--rojo-ui); padding-top: 0.2rem; font-variant-numeric: tabular-nums; }
.p-linea h3 { margin: 0 0 0.15rem; font-family: var(--sans); font-size: 1rem; font-weight: 600; }
.p-linea p { margin: 0; font-size: 0.9063rem; line-height: 1.5; }
.p-linea__color { display: inline-flex; align-items: center; gap: 0.4rem; }
.p-linea__color img { width: 1.75rem; height: 1.1rem; object-fit: cover; border: 1px solid rgba(23, 38, 47, 0.2); }
.p-linea__importe { grid-column: 2; display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.35rem; font-size: 0.9375rem; }
.p-linea__importe b { color: var(--tinta); }
@media (min-width: 48em) { .p-linea { grid-template-columns: 2rem 1fr auto; } .p-linea__importe { grid-column: 3; grid-row: 1 / span 3; flex-direction: column; text-align: right; justify-content: start; margin-top: 0; min-width: 9rem; } }

/* Historial (incidencias) */
.p-historial { list-style: none; margin: 0; padding: 0; }
.p-historial li { position: relative; padding: 0 0 1.25rem 1.5rem; border-left: 1px solid var(--linea); margin-left: 0.3rem; }
.p-historial li:last-child { padding-bottom: 0; border-left-color: transparent; }
.p-historial li::before { content: ""; position: absolute; left: -0.3rem; top: 0.45rem; width: 0.55rem; height: 0.55rem; background: var(--tinta); border-radius: 50%; }
.p-historial time { display: block; font-size: 0.8125rem; color: var(--gris-medio); }
.p-historial b { color: var(--tinta); font-weight: 600; }

/* Formularios del portal (campos ≥ 16 px) */
.portal .campo input, .portal .campo select, .portal .campo textarea { font-size: 1rem; }
.p-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.p-fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--linea); }
.p-fotos__marcador { display: grid; place-items: center; aspect-ratio: 1; background: repeating-linear-gradient(135deg, #f7f5f2 0 10px, #efece7 10px 20px); border: 1px solid var(--linea); font-size: 0.75rem; color: var(--gris-medio); text-align: center; padding: 0.25rem; }
.p-subir { display: flex; align-items: center; justify-content: center; gap: 0.6rem; min-height: 4.5rem; padding: 1rem; border: 1.5px dashed #8d9499; background: var(--papel); color: var(--tinta); font-weight: 500; cursor: pointer; text-align: center; }
.p-subir:hover { border-color: var(--tinta); }
.p-subir input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.p-subir:focus-within { outline: 2px solid var(--rojo-ui); outline-offset: 3px; }

/* Avisos y nota de propuesta */
.p-aviso { display: flex; gap: 0.75rem; padding: 0.9rem 1rem; margin-bottom: 1.25rem; background: #eef8f1; border-left: 2px solid #1f6b3a; color: #173f26; font-size: 0.9375rem; }
.p-aviso--info { background: #eef5fb; border-left-color: #1d4f7a; color: #163a59; }
.p-propuesta { margin-top: 0.9rem; font-size: 0.8125rem; line-height: 1.5; color: var(--gris-medio); }
.p-propuesta::before { content: "Propuesta · "; font-weight: 600; letter-spacing: 0.04em; color: var(--rojo-ui); }
.p-interruptores { list-style: none; margin: 0; padding: 0; }
.p-interruptores label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3rem; border-bottom: 1px solid var(--linea); cursor: pointer; }
.p-interruptores li:last-child label { border-bottom: 0; }
.p-interruptores input { width: 1.5rem; height: 1.5rem; accent-color: var(--tinta); flex: none; }

/* Acceso */
.p-acceso { display: grid; min-height: calc(100vh - 1.9rem); }
.p-acceso__form { display: grid; align-content: center; gap: 0; padding: clamp(2rem, 6vw, 4rem) var(--margen); background: var(--papel); }
.p-acceso__form > div { width: 100%; max-width: 26rem; margin-inline: auto; }
.p-acceso__form img.logo { height: 3.25rem; width: auto; margin-bottom: 2.5rem; }
.p-acceso__form h1 { font-size: clamp(2.4rem, 6vw, 3.25rem); margin-bottom: 0.75rem; }
.p-acceso__foto { display: none; position: relative; }
.p-acceso__foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 60em) { .p-acceso { grid-template-columns: minmax(28rem, 5fr) 7fr; } .p-acceso__foto { display: block; } }
.p-acceso .formulario { margin-top: 1.75rem; gap: 1.1rem; }
.p-acceso .boton { width: 100%; }
.p-acceso__enlaces { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; margin-top: 1rem; }
.p-acceso__enlaces a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: 0.9375rem; color: var(--tinta); }

/* Pie del portal */
.p-pie { padding: 1.5rem 0 2rem; font-size: 0.875rem; color: var(--gris-medio); border-top: 1px solid var(--linea); background: var(--papel); }
.p-pie .contenedor { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 1.5rem; }
.p-pie a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--tinta); text-decoration: none; }
.p-pie a:hover { color: var(--rojo-ui); }
.p-pie nav { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }

/* Ajustes tras la revisión con capturas */
.p-panel h2, .p-panel h3, .p-linea h3 { letter-spacing: 0; word-spacing: 0.08em; }
.p-linea__colores { display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; margin-top: 0.2rem !important; }
.p-linea__colores > span { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
@media (max-width: 35.99em) { .p-cabecera__logo span { display: none; } }
@media (max-width: 22.4em) { .p-usuario a:first-of-type { display: none; } }
.p-subir input { inset: 0; width: 100%; height: 100%; cursor: pointer; }
.p-datos dd a { display: inline-flex; align-items: center; justify-content: flex-end; min-height: 2.75rem; min-width: 2.75rem; color: var(--rojo-ui); }
