/* Sumo · Dosificador — mismos colores y letras que la web de Sumo */
@font-face { font-family: "Archivo"; src: url(fuentes/archivo-latin-wdth-normal.woff2) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fuentes/inter-latin-wght-normal.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ocre: #C4943C;
  --ocre-texto: #7F5812;
  --ocre-hover: #D3A44E;
  --tinta: #15303A;
  --tinta-2: #1E3D48;
  --hueso: #F1F1EE;
  --concreto: #D3D6D2;
  --niebla: #E3E5E1;
  --blanco: #fff;
  --alerta: #8A3B12;
  --alerta-fondo: #F6E7DA;
  --wa: #1F7A4D;
  --titulo: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --texto: "Inter", ui-sans-serif, system-ui, sans-serif;
  --radio: 14px;
  --pestanas: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--hueso); color: var(--tinta); font: 16px/1.45 var(--texto); -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--pestanas) + 56px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ocre); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--titulo); font-weight: 800; letter-spacing: -0.025em; line-height: 1; margin: 0; }
h2 { font-size: 1.35rem; font-stretch: 108%; }
h3 { font-size: 1.05rem; }
.display { font-family: var(--titulo); font-weight: 850; font-stretch: 112%; letter-spacing: -0.035em; line-height: .92; font-size: clamp(2.3rem, 11vw, 3.4rem); }
.acento { color: var(--ocre-texto); }
.etiqueta { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; }
.etiqueta-suave { opacity: .65; margin: 1.2rem 0 .5rem; }
small { display: block; font-size: .8rem; opacity: .72; margin-top: .3rem; }

/* Barra superior */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(.8rem + env(safe-area-inset-top)) 1.1rem .8rem; background: var(--tinta); color: var(--hueso); }
.logo { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.logo-punto { width: .95em; height: .95em; border-radius: 50%; background: var(--ocre); box-shadow: inset -3px -3px 0 rgb(0 0 0 / .12); }
.logo-texto { font-family: var(--titulo); font-weight: 900; font-stretch: 125%; letter-spacing: -.045em; font-size: 1.45em; line-height: 1; }
.barra-sub { color: var(--ocre); }

main { max-width: 640px; margin: 0 auto; padding: 0 1rem; }
.intro { padding: 1.6rem .2rem 1rem; }
.intro p { margin: .6rem 0 0; opacity: .8; }
.bloque { background: var(--blanco); border-radius: var(--radio); padding: 1.1rem; margin: .9rem 0; box-shadow: 0 1px 0 var(--concreto); }
.bloque > h2 { margin-bottom: .9rem; }
.bloque-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.pildora { background: var(--niebla); border-radius: 99px; padding: .25rem .7rem; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }

/* Campos */
.campo { display: block; margin: 0 0 1rem; }
.campo > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.campo-obra { margin-top: 1.2rem; }
input[type=text], input[type=number], input[inputmode], select, textarea { width: 100%; border: 1.5px solid var(--concreto); background: var(--blanco); border-radius: 10px; padding: .7rem .8rem; font-size: 16px; min-height: 48px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--tinta); outline: none; }
input[type=range] { width: 100%; accent-color: var(--ocre-texto); height: 32px; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.tres-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.con-unidad { position: relative; }
.con-unidad input { padding-right: 2.6rem; }
.con-unidad i { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-style: normal; font-size: .85rem; opacity: .6; pointer-events: none; }
.mini { display: block; }
.mini > span { display: block; font-size: .75rem; font-weight: 600; margin-bottom: .25rem; opacity: .8; }

.segmentos { display: flex; flex-wrap: wrap; gap: .35rem; background: var(--niebla); padding: .25rem; border-radius: 12px; }
.segmentos button { flex: 1 1 auto; border: 0; background: transparent; padding: .6rem .7rem; border-radius: 9px; font-weight: 600; font-size: .9rem; min-height: 44px; cursor: pointer; }
.segmentos button[aria-pressed=true] { background: var(--tinta); color: var(--hueso); }
.segmentos button:disabled { opacity: .35; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips button { border: 1.5px solid var(--concreto); background: var(--blanco); border-radius: 99px; padding: .45rem .75rem; font-weight: 600; font-size: .85rem; min-height: 40px; cursor: pointer; font-variant-numeric: tabular-nums; }
.chips button[aria-pressed=true] { background: var(--ocre); border-color: var(--ocre); color: var(--tinta); }

/* Elementos */
.elemento { border: 1.5px solid var(--concreto); border-radius: 12px; padding: .9rem; margin-bottom: .8rem; }
.elemento-cab { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.elemento-cab svg { width: 34px; height: 34px; flex: none; }
.elemento-cab h3 { flex: 1; }
.elemento-vol { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icono-btn { border: 0; background: var(--niebla); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.icono-btn svg { width: 18px; height: 18px; }
.elemento .campos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.elemento .campos .completo { grid-column: 1 / -1; }
.elemento .fc { margin-bottom: .6rem; }
.elemento .fc-uso { font-size: .78rem; opacity: .7; margin-top: .3rem; }
.elemento .extras { display: flex; gap: .5rem; flex-wrap: wrap; }
.interruptor { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; cursor: pointer; padding: .3rem .1rem; }
.interruptor input { width: 20px; height: 20px; accent-color: var(--ocre-texto); }

.rejilla-agregar { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.rejilla-agregar button { border: 1.5px dashed var(--concreto); background: var(--hueso); border-radius: 12px; padding: .6rem .2rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; line-height: 1.1; cursor: pointer; min-height: 78px; }
.rejilla-agregar button:active { background: var(--niebla); }
.rejilla-agregar svg { width: 30px; height: 30px; }
.dibujo { fill: none; stroke: var(--tinta); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.dibujo .relleno { fill: var(--ocre); stroke: none; opacity: .55; }

/* Avisos dentro de la app */
.nota { border-radius: 10px; padding: .7rem .8rem; font-size: .85rem; margin: .6rem 0; background: var(--niebla); }
.nota-alerta { background: var(--alerta-fondo); color: var(--alerta); }
.nota b { font-weight: 700; }
.pendiente { display: inline-block; background: #FFE066; color: #3d3200; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 4px; vertical-align: middle; }

/* Resultado */
.resultado { background: var(--tinta); color: var(--hueso); box-shadow: none; }
.resultado h2 { color: var(--hueso); }
.resultado .etiqueta { color: var(--ocre); }
.res-vol { display: flex; align-items: baseline; gap: .5rem; margin: .4rem 0 .2rem; }
.res-vol strong { font-family: var(--titulo); font-weight: 850; font-stretch: 112%; font-size: 3rem; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.res-vol span { font-size: 1.1rem; opacity: .8; }
.res-sub { opacity: .75; font-size: .85rem; }
.materiales { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.materiales li { background: var(--tinta-2); border-radius: 12px; padding: .75rem .9rem; display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; align-items: baseline; }
.materiales .mat-nombre { font-weight: 600; }
.materiales .mat-valor { font-family: var(--titulo); font-weight: 800; font-stretch: 108%; font-size: 1.35rem; font-variant-numeric: tabular-nums; text-align: right; }
.materiales .mat-detalle { grid-column: 1 / -1; font-size: .8rem; opacity: .7; }
.grupo { border-top: 1px solid rgb(241 241 238 / .15); margin-top: 1rem; padding-top: .9rem; }
.grupo h3 { color: var(--hueso); margin-bottom: .5rem; }
.tabla-bulto { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.tabla-bulto td { padding: .35rem 0; border-bottom: 1px solid rgb(241 241 238 / .1); }
.tabla-bulto td:last-child { text-align: right; font-weight: 700; }
.resultado .nota { background: var(--tinta-2); color: var(--hueso); }
.resultado .nota-alerta { background: #5a2a12; color: #FBE3CF; }
.vacio { opacity: .75; padding: .4rem 0; }

/* Botones */
.acciones { display: grid; gap: .6rem; margin: 1rem 0 2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: 99px; padding: .95rem 1.4rem; font-weight: 600; font-size: 15px; border: 0; cursor: pointer; min-height: 52px; text-decoration: none; }
.btn svg { width: 22px; height: 22px; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-ocre { background: var(--ocre); color: var(--tinta); }
.btn-oscuro { background: var(--tinta); color: var(--hueso); }
.btn-linea { background: transparent; border: 1.5px solid var(--tinta); color: var(--tinta); }
.btn-texto { background: transparent; color: var(--tinta); opacity: .7; text-decoration: underline; min-height: 44px; }
.btn-peligro { background: transparent; color: var(--alerta); border: 1.5px solid var(--alerta); }
.ancho { width: 100%; }

/* Listas (obras, productos) */
.fila { display: flex; gap: .7rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--niebla); }
.fila:last-child { border-bottom: 0; }
.fila-texto { flex: 1; min-width: 0; }
.fila-texto b { display: block; }
.fila-texto span { font-size: .82rem; opacity: .72; }
.fila .btn { min-height: 40px; padding: .5rem .9rem; font-size: .85rem; }

/* Tablas de fuentes */
.tabla-wrap { overflow-x: auto; margin: .7rem -.2rem; }
table.datos { border-collapse: collapse; width: 100%; font-size: .85rem; font-variant-numeric: tabular-nums; }
table.datos th, table.datos td { padding: .45rem .5rem; text-align: right; border-bottom: 1px solid var(--niebla); white-space: nowrap; }
table.datos th:first-child, table.datos td:first-child { text-align: left; }
table.datos thead th { background: var(--tinta); color: var(--hueso); font-weight: 600; }
.lista-simple { margin: .4rem 0; padding-left: 1.1rem; font-size: .88rem; }
.lista-simple li { margin: .3rem 0; }
.cita { font-size: .8rem; opacity: .75; font-style: italic; }

/* Resumen fijo y pestañas */
.resumen-fijo { position: fixed; left: 0; right: 0; bottom: calc(var(--pestanas) + env(safe-area-inset-bottom)); z-index: 25; display: flex; justify-content: space-between; align-items: center; gap: .6rem; background: var(--ocre); color: var(--tinta); padding: .6rem 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .92rem; }
.resumen-ir { color: var(--tinta); font-weight: 700; background: rgb(255 255 255 / .35); padding: .35rem .9rem; border-radius: 99px; text-decoration: none; }
.pestanas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--tinta); padding-bottom: env(safe-area-inset-bottom); }
.pestanas button { background: none; border: 0; color: rgb(241 241 238 / .6); height: var(--pestanas); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; font-size: .7rem; font-weight: 600; cursor: pointer; }
.pestanas svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.pestanas button.activa { color: var(--ocre); }

/* Diálogo de producto */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, 94vw); max-height: 90vh; color: var(--tinta); }
dialog::backdrop { background: rgb(21 48 58 / .6); }
dialog form { padding: 1.2rem; overflow-y: auto; max-height: 90vh; }
dialog h2 { margin-bottom: 1rem; }
.dlg-botones { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }

.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--pestanas) + 70px); background: var(--tinta); color: var(--hueso); padding: .7rem 1.1rem; border-radius: 99px; z-index: 50; font-size: .9rem; box-shadow: 0 6px 20px rgb(0 0 0 / .25); }

@media (min-width: 700px) {
  .rejilla-agregar { grid-template-columns: repeat(8, 1fr); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.dos-col .segmentos { flex-wrap: nowrap; }
.dos-col .segmentos button { padding: .6rem .35rem; font-size: .82rem; }
table.datos { font-size: .8rem; }
table.datos th, table.datos td { padding: .4rem .3rem; }
table.datos thead th { white-space: normal; line-height: 1.15; vertical-align: bottom; }
.chips-grava { margin-top: .5rem; }
.chips button:disabled { opacity: .35; cursor: not-allowed; }
