:root {
  --fondo: #fafaf7;
  --papel: #ffffff;
  --texto: #1d2420;
  --suave: #66706a;
  --linea: #e1e5df;
  --verde: #2f6b3c;
  --verde-claro: #e8f2e9;
  --aviso: #8a5a00;
  --aviso-fondo: #fff5dc;
  --error: #9b2c2c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #141815;
    --papel: #1c221e;
    --texto: #e8ece8;
    --suave: #9aa59e;
    --linea: #2e3731;
    --verde: #7fc08c;
    --verde-claro: #223126;
    --aviso: #f0c674;
    --aviso-fondo: #3a3018;
    --error: #f19999;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 5rem;
}
h1 { font-size: 1.5rem; margin: .1rem 0 0; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
.suave { color: var(--suave); }
.centro { text-align: center; }
[hidden] { display: none !important; }

.cabecera {
  position: sticky; top: 0; z-index: 2;
  background: var(--papel);
  border-bottom: 1px solid var(--linea);
  padding: .75rem 1rem;
}
.marca { color: var(--verde); font-weight: 600; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
#subtitulo { margin: .1rem 0 .6rem; font-size: .9rem; }
.buscador { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.buscador input[type=search] { flex: 1 1 16rem; }
.conmutador { display: flex; gap: .35rem; align-items: center; font-size: .9rem; white-space: nowrap; }

input, textarea, button { font: inherit; color: inherit; }
input[type=search], input[type=email], input[type=number], textarea {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 6px;
  padding: .5rem .6rem;
  width: 100%;
}
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--verde); outline-offset: 1px; }
button {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 6px;
  padding: .5rem .9rem;
  cursor: pointer;
}
button.principal { white-space: nowrap; background: var(--verde); border-color: var(--verde); color: var(--papel); font-weight: 600; }
button.discreto { border-color: transparent; color: var(--suave); }
button:disabled { opacity: .55; cursor: default; }

main { max-width: 60rem; margin: 0 auto; padding: 0 1rem; }
.aviso { background: var(--aviso-fondo); color: var(--aviso); padding: .75rem 1rem; border-radius: 6px; margin-top: 1rem; }
.nota { font-size: .85rem; margin: 1rem 0; }

table { width: 100%; border-collapse: collapse; margin-top: .5rem; background: var(--papel); }
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); font-weight: 600; }
.c-tamano { width: 8rem; }
.c-precio { width: 6.5rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-cantidad { width: 6.5rem; text-align: right; }
.c-cantidad input { text-align: right; padding: .35rem .45rem; }
tr.pedida { background: var(--verde-claro); }
.consultar { color: var(--aviso); font-size: .9rem; }

.pedido {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}
.pedido label { display: block; font-size: .9rem; margin: .9rem 0 .3rem; }
.resumen { list-style: none; margin: 0; padding: 0; }
.resumen li { display: flex; gap: .75rem; justify-content: space-between; padding: .3rem 0; border-bottom: 1px dashed var(--linea); }
.resumen .importe { white-space: nowrap; font-variant-numeric: tabular-nums; }
.total { font-weight: 600; text-align: right; margin: .6rem 0 0; }
#envio button { margin-top: .75rem; width: 100%; padding: .7rem; }
.acciones { display: flex; gap: .5rem; margin-top: .9rem; }
.resultado { margin: .9rem 0 0; padding: .6rem .8rem; border-radius: 6px; background: var(--verde-claro); }
.resultado.error { background: var(--aviso-fondo); color: var(--error); }

.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  background: var(--papel);
  border-top: 1px solid var(--linea);
  padding: .6rem 1rem;
  font-variant-numeric: tabular-nums;
}

/* Móvil: cada planta es una ficha. Arriba el nombre y el precio; debajo el tamaño y la cantidad. */
@media (max-width: 640px) {
  thead { display: none; }
  table, tbody { display: block; width: 100%; }
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6rem;
    column-gap: .75rem;
    row-gap: .3rem;
    align-items: center;
    padding: .6rem .25rem;
    border-bottom: 1px solid var(--linea);
  }
  tbody td { display: block; border: 0; padding: 0; width: auto; }
  td.c-planta { grid-column: 1; grid-row: 1; font-weight: 600; }
  td.c-precio { grid-column: 2; grid-row: 1; }
  td.c-tamano { grid-column: 1; grid-row: 2; font-size: .9rem; color: var(--suave); }
  td.c-cantidad { grid-column: 2; grid-row: 2; }
  td.c-cantidad input { width: 100%; }
  .buscador input[type=search] { flex-basis: 100%; }
}
