/* Estilos de la interfaz. Mobile-first. Los tokens viven en src/assets/tokens.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); min-height: 100vh; overflow-x: hidden; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; line-height: 1.3; }
h3 { font-size: 1rem; }
ul, ol { list-style: none; }
a { color: var(--primary); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r1); }
.main:focus { outline: none; box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s4); top: -60px; background: var(--primary); color: var(--on-primary); padding: var(--s2) var(--s4); border-radius: var(--r1); z-index: 100; }
.skip-link:focus { top: var(--s2); }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.block { display: block; }
.strong { font-weight: 600; }
.txt-danger { color: var(--danger); }
.icon { flex: none; }
.loading { color: var(--text-muted); padding: var(--s6) 0; }

/* Estructura */
.shell { display: block; min-height: 100vh; }
.sidebar { display: contents; }
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--nav-text); }
.brand-text { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.badge { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge-prov { background: var(--saffron); color: var(--ink); }
.main { padding: var(--s4) var(--s4) 110px; max-width: 1100px; margin: 0 auto; }

/* Cabecera móvil: la marca es una barra fija arriba */
.brand { position: sticky; top: 0; z-index: 20; background: var(--nav-bg); padding: var(--s3) var(--s4); padding-top: calc(var(--s3) + env(safe-area-inset-top)); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 14px rgba(58, 26, 51, .08); }
.nav-link { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--text-muted); text-decoration: none; font-size: .64rem; border-radius: var(--r1); }
.nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link[aria-current="page"] { color: var(--primary); font-weight: 700; }
.nav-link[aria-current="page"] svg { stroke-width: 2.4; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: var(--s5); background: var(--nav-bg); color: var(--nav-text); padding: var(--s5) var(--s4); position: sticky; top: 0; height: 100vh; }
  .brand { position: static; padding: 0; background: none; }
  .nav { position: static; flex-direction: column; background: none; border: 0; box-shadow: none; padding: 0; gap: var(--s1); }
  .nav-link { flex-direction: row; gap: var(--s3); padding: var(--s3); color: var(--nav-text); font-size: .95rem; opacity: .85; }
  .nav-link:hover { background: var(--surface-3); opacity: 1; }
  .nav-link[aria-current="page"] { background: var(--ink); color: var(--on-ink); opacity: 1; }
  .nav-link span { overflow: visible; }
  .main { padding: var(--s6) var(--s6) var(--s7); width: 100%; }
  :focus-visible { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--focus); }
  .sidebar :focus-visible { box-shadow: var(--ring); }
}

.banner-host { position: sticky; top: 0; z-index: 60; }
.banner { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); font-weight: 600; }
.banner-danger { background: var(--danger); color: #fff; }
.banner-info { background: var(--info-soft); color: var(--ink); border-bottom: 1px solid var(--info); }

/* Páginas y tarjetas */
.page { display: flex; flex-direction: column; gap: var(--s5); }
.page-narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); justify-content: space-between; align-items: flex-end; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.stack { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.grid-2 { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); box-shadow: var(--shadow-1); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
@media (min-width: 600px) { .card { padding: var(--s5); } }
.cards { display: flex; flex-direction: column; gap: var(--s3); }
.item { flex-direction: column; }
.item-main { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.item-main h3 a { text-decoration: none; color: var(--text); }
.item-main h3 a:hover { color: var(--primary); text-decoration: underline; }
.item-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
@media (min-width: 700px) { .item { flex-direction: row; align-items: center; justify-content: space-between; } .item-actions { justify-content: flex-end; } }
.pair { display: flex; gap: var(--s5); flex-wrap: wrap; }
.pair > div { display: flex; flex-direction: column; }
.xl { font-size: 1.6rem; }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.row-wrap { display: flex; gap: var(--s4); align-items: flex-end; flex-wrap: wrap; }
.row-wrap .field { flex: 1 1 220px; }
.toolbar { display: flex; gap: var(--s3); flex-wrap: wrap; }
.toolbar .search { flex: 1 1 240px; }
.back-link { display: inline-flex; align-items: center; gap: var(--s1); text-decoration: none; font-size: .9rem; }
.bullets { list-style: disc; padding-left: var(--s5); display: flex; flex-direction: column; gap: var(--s1); margin-top: var(--s1); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s4); }
.kv dt { color: var(--text-muted); }
.kv dd { text-align: right; font-weight: 600; }

/* Botones y controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4); border-radius: var(--r1); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 var(--s3); font-size: .9rem; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not([disabled]) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--r1); border: 0; background: transparent; color: var(--text-muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }
.input { width: 100%; min-height: 44px; padding: 0 var(--s3); border-radius: var(--r1); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.input-sm { width: auto; min-height: 44px; }
.input:focus-visible { box-shadow: 0 0 0 3px var(--focus); border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: var(--s3); color: var(--text-muted); pointer-events: none; }
.search .input { padding-left: 40px; }
.form { display: flex; flex-direction: column; gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.field-head { display: flex; align-items: center; gap: var(--s2); }
.field label, .mini-label { font-weight: 600; font-size: .9rem; }
.field-hint { font-size: .8rem; color: var(--text-muted); }
.field-error, .form-error { color: var(--danger); font-size: .85rem; min-height: 0; }
.field-error:empty, .form-error:empty { display: none; }
.grid-fields { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .grid-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check { display: flex; gap: var(--s3); align-items: center; min-height: 44px; cursor: pointer; }
.check input, .seg input, .option input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.tip { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); font-size: .7rem; font-weight: 700; cursor: help; position: relative; margin-left: 4px; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-30%); width: 220px; max-width: 70vw; background: var(--plum-900); color: #fff; padding: var(--s2) var(--s3); border-radius: var(--r1); font-weight: 400; font-size: .8rem; z-index: 40; box-shadow: var(--shadow-2); }
.tip[title]:hover { }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-off { background: var(--surface-2); color: var(--text-muted); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r1); background: var(--info-soft); color: var(--text); }
.notice > .icon { margin-top: 2px; color: var(--info); }
.notice > div { flex: 1; min-width: 0; }
.notice-ok { background: var(--ok-soft); } .notice-ok > .icon { color: var(--ok); }
.notice-warn { background: var(--warn-soft); } .notice-warn > .icon { color: var(--warn); }
.notice-danger { background: var(--danger-soft); } .notice-danger > .icon { color: var(--danger); }

/* Estados */
.state { text-align: center; padding: var(--s6) var(--s4); border: 1px dashed var(--border); border-radius: var(--r3); background: var(--surface); display: flex; flex-direction: column; gap: var(--s3); align-items: center; }
.state p { color: var(--text-muted); max-width: 46ch; }
.state-error { border-color: var(--danger); border-style: solid; }
.state-actions { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: center; }

/* Inicio */
.steps { display: flex; flex-direction: column; gap: var(--s3); }
.step { display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r2); background: var(--surface-2); }
.step .btn { grid-column: 2; justify-self: start; }
@media (min-width: 600px) { .step { grid-template-columns: 32px 1fr auto; } .step .btn { grid-column: auto; } }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; }
.step.done .step-n { background: var(--ok); color: var(--on-ink); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); padding: var(--s4); text-decoration: none; color: var(--text); display: flex; flex-direction: column; box-shadow: var(--shadow-1); }
.stat strong { font-size: 2rem; line-height: 1.1; color: var(--primary); }
.list-link { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.list li:last-child .list-link { border-bottom: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s1) 0; font-size: .9rem; flex-wrap: wrap; }
.history { margin-top: var(--s2); }

/* Editor de recetas */
.editor-grid { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .editor-grid { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); } .side { position: sticky; top: var(--s5); } }
.lines { display: flex; flex-direction: column; gap: var(--s3); }
.line-row { padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r1); background: var(--surface-2); }
/* Línea de ingrediente (GENESIS-019): el selector de ingrediente ocupa SIEMPRE una fila propia (nunca se recorta) y el
   botón de quitar queda centrado a su lado; cantidad, unidad, merma y costo van debajo con etiquetas a la misma altura. */
.line-grid { display: grid; gap: var(--s2) var(--s3); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; align-items: end; }
.lf { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lf-ing { grid-column: 1 / 3; grid-row: 1; flex-direction: row; align-items: center; }
.lf-ing select { flex: 1; min-width: 0; text-overflow: ellipsis; }
.lf-del { grid-column: 3; grid-row: 1; align-self: center; align-items: center; }
.lf-qty { grid-column: 1; grid-row: 2; }
.lf-unit { grid-column: 2 / 4; grid-row: 2; }
.lf-waste { grid-column: 1; grid-row: 3; }
.lf-cost { grid-column: 2 / 4; grid-row: 3; text-align: right; font-weight: 700; align-self: end; justify-content: flex-end; min-height: 44px; display: flex; flex-direction: row; align-items: center; }
.lf .mini-label { display: flex; align-items: center; gap: 4px; min-height: 20px; font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-del { margin: 0; }
@media (max-width: 699px) { .lf-ing .line-ico { display: none; } }   /* en móvil, todo el ancho para el nombre del ingrediente */
@media (min-width: 700px) {
  .line-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1fr) 44px; }
  .lf-ing { grid-column: 1 / 5; grid-row: 1; }
  .lf-del { grid-column: 5; grid-row: 1; }
  .lf-qty { grid-column: 1; grid-row: 2; } .lf-unit { grid-column: 2; grid-row: 2; } .lf-waste { grid-column: 3; grid-row: 2; }
  .lf-cost { grid-column: 4 / 6; grid-row: 2; }
}
.line-error { margin-top: var(--s2); }
.result { display: flex; flex-direction: column; gap: var(--s2); }
.rrow { display: flex; justify-content: space-between; gap: var(--s3); }
.rtotal { border-top: 1px solid var(--border); padding-top: var(--s2); }
.big { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s3) var(--s4); border-radius: var(--r1); background: var(--plum-100); color: var(--plum-900); gap: var(--s3); flex-wrap: wrap; }
.big strong { font-size: 1.7rem; }
.big-accent { background: var(--accent-soft); color: var(--text); border-left: 4px solid var(--accent); }
@media (prefers-color-scheme: dark) { .big { background: var(--surface-2); color: var(--text); } }
.small-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-top: var(--s2); }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--r1); padding: 3px; gap: 3px; align-self: flex-start; }
.seg { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s4); border-radius: 6px; cursor: pointer; font-weight: 600; }
.seg input { position: absolute; opacity: 0; width: 100%; height: 100%; left: 0; top: 0; margin: 0; cursor: pointer; }
.seg:has(input:checked) { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.seg:has(input:focus-visible) { box-shadow: var(--ring); }
.explain { font-size: .88rem; color: var(--text-muted); background: var(--surface-2); padding: var(--s3); border-radius: var(--r1); }
.save-status { font-size: .85rem; font-weight: 600; color: var(--text-muted); display: inline-block; min-height: 1.3em; }
.save-status.ok { color: var(--ok); }
.save-status.dirty { color: var(--warn); }
.sticky-summary { position: fixed; left: var(--s3); right: var(--s3); bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 25; display: flex; gap: var(--s2) var(--s3); align-items: baseline; justify-content: center; flex-wrap: wrap;
  background: var(--plum-900); color: #fff; padding: var(--s2) var(--s4); border-radius: 999px; box-shadow: var(--shadow-2); font-size: .85rem; }
.sticky-summary strong { font-size: 1.05rem; margin-right: var(--s2); }
@media (min-width: 1000px) { .sticky-summary { display: none; } }

/* Pedido */
.verdict { display: flex; gap: var(--s4); align-items: center; padding: var(--s5); border-radius: var(--r3); }
.verdict h2 { font-size: 1.7rem; }
.verdict-ok { background: var(--ok-soft); color: var(--ok); }
.verdict-warn { background: var(--warn-soft); color: var(--warn); }
.verdict-danger { background: var(--danger-soft); color: var(--danger); }
.verdict p { color: var(--text); }
.stack-bar { position: relative; display: flex; height: 36px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: var(--s3) 0; }
.seg-bar { height: 100%; }
.seg-cost, .dot.seg-cost { background: var(--plum-500); }
.seg-fee, .dot.seg-fee { background: #9a9aa0; }
.seg-profit, .dot.seg-profit { background: var(--ok); }
.rev-marker { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: .9rem; }
.legend li { display: flex; align-items: center; gap: var(--s2); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.gauge { position: relative; height: 14px; background: var(--surface-2); border-radius: 999px; margin: var(--s3) 0 var(--s2); }
.gauge-fill { height: 100%; border-radius: 999px; background: var(--ok); }
.gauge-fill.warn { background: var(--warn); } .gauge-fill.danger { background: var(--danger); }
.gauge-tick { position: absolute; top: -5px; bottom: -5px; width: 3px; background: var(--text); border-radius: 2px; }
.gauge-labels { display: flex; justify-content: space-between; font-size: .85rem; color: var(--text-muted); gap: var(--s3); flex-wrap: wrap; }
.gauge-block { margin-top: var(--s3); }
.scn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.scn { background: var(--surface-2); border-radius: var(--r1); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; min-width: 0; }
.scn .kv { width: 100%; font-size: .9rem; }
.warnings { display: flex; flex-direction: column; gap: var(--s2); }
.warning { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: var(--r1); }
.warning-danger { background: var(--danger-soft); color: var(--text); } .warning-danger .icon { color: var(--danger); }
.warning-warning { background: var(--warn-soft); color: var(--text); } .warning-warning .icon { color: var(--warn); }
.warning-info { background: var(--info-soft); color: var(--text); } .warning-info .icon { color: var(--info); }
.note { display: flex; gap: var(--s2); font-size: .85rem; color: var(--text-muted); align-items: flex-start; }
.note .icon { margin-top: 3px; }

/* Respaldo */
.options { border: 0; display: flex; flex-direction: column; gap: var(--s3); }
.options legend { font-weight: 700; margin-bottom: var(--s2); }
.option { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r1); cursor: pointer; }
.option:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.compare { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 560px) { .compare { grid-template-columns: 1fr 1fr; } }

/* Diálogos y avisos */
.dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(520px, calc(100vw - 24px)); width: 100%; max-height: calc(100vh - 24px); overflow: visible; }
.dialog-wide { max-width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(20, 20, 20, .45); }   /* sin desenfoque (requisito: nada de blur) */
.dialog-card { background: var(--surface); border-radius: var(--r3); box-shadow: var(--shadow-3); display: flex; flex-direction: column; max-height: calc(100vh - 24px); overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) 0 var(--s5); }
.dialog-body { padding: var(--s4) var(--s5); overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s3); padding: var(--s3) var(--s5) var(--s4); flex-wrap: wrap; }
.toast-host { position: fixed; z-index: 90; left: var(--s4); right: var(--s4); bottom: calc(150px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--s2); align-items: center; pointer-events: none; }
@media (min-width: 900px) { .toast-host { bottom: var(--s5); align-items: flex-end; right: var(--s5); left: auto; } }
.toast { display: flex; gap: var(--s2); align-items: center; padding: var(--s3) var(--s4); border-radius: var(--r2); background: var(--plum-900); color: #fff; box-shadow: var(--shadow-2); animation: toast-in .2s ease-out; transition: opacity .3s; }
.toast.out { opacity: 0; }
.toast-danger { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===================== Capa Happcook (0.2 / 0.2.1) =====================
   Tema claro y plano (gris claro + negro): botones píldora, tarjetas planas con borde de 1 px, sin sombras pesadas ni degradados.
   Movimiento: solo opacity / transform / clip-path. NINGÚN desenfoque. */
@media screen {
  body { background: var(--bg); color: var(--text); }
  a { color: var(--ink); text-underline-offset: 3px; }
  h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.8rem); font-weight: 900; letter-spacing: -.035em; line-height: 1.02; }
  h2 { font-weight: 800; letter-spacing: -.015em; }
  .page-head p.muted { color: var(--text-muted); font-size: 1.02rem; margin-top: var(--s2); }
  .muted, .field-hint { color: var(--text-muted); }
  .brand-name { font-weight: 900; font-size: 1.3rem; letter-spacing: -.03em; color: var(--ink); }
  .badge-prov { background: transparent; color: var(--text-muted); border: 1px solid var(--gray-500); }
  .nav { background: var(--bg-deep); border-top: 1px solid var(--border-soft); box-shadow: none; }
  .nav-link { color: var(--nav-text); position: relative; }
  .nav-link[aria-current="page"] { color: var(--ink); }
  .nav-link::after { content: ""; position: absolute; left: 22%; right: 22%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink);
    clip-path: inset(0 50% 0 50%); transition: clip-path var(--t-med) var(--ease); }
  .nav-link[aria-current="page"]::after { clip-path: inset(0 0 0 0); }
  @media (min-width: 900px) {   /* barra lateral: el elemento activo es una píldora negra con texto blanco */
    .nav-link[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
    .nav-link::after { display: none; }
  }

  /* tarjetas planas */
  .card, .stat, .state { background: var(--surface); border: 1px solid var(--border-soft); box-shadow: none; border-radius: var(--r2); }
  .stat strong { color: var(--ink); font-weight: 900; letter-spacing: -.03em; }
  .stat span { color: var(--text-muted); }
  .item .item-main h3 a { color: var(--ink); }

  /* botones píldora con relleno por máscara (cut-out reveal) y magnificación sutil */
  .btn { border-radius: var(--pill); font-weight: 700; letter-spacing: .005em; position: relative; isolation: isolate; overflow: hidden;
    transition: transform var(--t-fast) var(--ease), background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
  .btn:hover:not([disabled]) { transform: scale(1.03); }
  .btn:active:not([disabled]) { transform: scale(.98); }
  .btn-primary { background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); }
  .btn-primary::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink-2); clip-path: circle(0% at 50% 50%); transition: clip-path var(--t-slow) var(--ease); }
  .btn-primary:hover:not([disabled]) { background: var(--primary); }
  .btn-primary:hover:not([disabled])::before { clip-path: circle(75% at 50% 50%); }
  .btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--gray-500); }
  .btn-secondary:hover:not([disabled]) { background: var(--surface-2); }
  .btn-ghost { color: var(--ink); border: 1px solid transparent; }
  .btn-ghost:hover:not([disabled]) { background: var(--surface-3); color: var(--ink); }
  .btn-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger); }
  .btn-danger:hover:not([disabled]) { background: var(--danger-soft); }
  .btn[disabled] { opacity: .45; }
  .icon-btn { border-radius: var(--pill); background: transparent; color: var(--text-muted); transition: transform var(--t-fast) var(--ease); }
  .icon-btn:hover { transform: scale(1.06); color: var(--ink); background: var(--surface-3); }

  /* campos */
  .input { background: var(--field); border: 1px solid var(--field-border); color: var(--ink); border-radius: var(--r1); }
  .input::placeholder { color: #6e6e73; }
  .input:focus-visible { box-shadow: 0 0 0 1px var(--ink); border-color: var(--ink); }
  select.input option, select.input optgroup { background: var(--field); color: var(--ink); }
  .field-error { color: var(--danger); }

  /* estados: icono + texto + borde, nunca solo color */
  .notice { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-left-width: 4px; }
  .notice-ok { background: var(--ok-soft); border-color: var(--ok); }
  .notice-warn { background: var(--warn-soft); border-color: var(--warn); }
  .notice-danger { background: var(--danger-soft); border-color: var(--danger); }
  .notice-info { background: var(--info-soft); border-color: var(--info); } .notice-info > .icon { color: var(--info); }
  .verdict { border: 1px solid currentColor; }
  .verdict-denied { background: var(--surface-2); color: var(--text-muted); }
  .toast { background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); box-shadow: none; }
  .toast-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
  .dialog-card { background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
  .tip:hover::after, .tip:focus::after { background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); box-shadow: none; }
  .sticky-summary { background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); box-shadow: none; }
  .big { background: var(--surface-2); color: var(--text); }
}

/* iconos de categoría */
.cat-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.1em; height: 2.1em; border-radius: var(--pill);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }
.cat-ico .icon { width: 60%; height: 60%; }
.item { display: flex; gap: var(--s3); }
.item > .cat-ico { font-size: 1.15rem; }
@media (min-width: 700px) { .item > .item-main { flex: 1; } }
.with-icon { display: flex; gap: var(--s3); align-items: flex-end; }
.with-icon > .field, .with-icon > select { flex: 1; min-width: 0; }
.recipe-icon, .line-ico { display: inline-flex; padding-bottom: 6px; }
.lf-ing.with-icon { align-items: center; }
.line-ico { padding-bottom: 0; }

/* autocompletado */
.combo-list { position: fixed; z-index: 120; margin: 0; padding: 6px; overflow-y: auto; background: var(--field); border: 1px solid var(--border); border-radius: var(--r2); list-style: none; }
.combo-opt { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 6px 10px; border-radius: var(--r1); cursor: pointer; color: var(--ink); }
.combo-opt[aria-selected="true"], .combo-opt:hover { background: var(--surface-3); outline: 1px solid var(--ink); }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: var(--pill); border: 1px solid var(--border); color: var(--text-muted); }
.combo-tag.tag-tuyo { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.dup-host:empty { display: none; }

/* decisión del pedido */
.decision-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.decision-actions .btn { flex: 1 1 140px; }
.decision-msg:empty { display: none; }
.reveal { animation: hc-reveal var(--t-slow) var(--ease) both; }
@keyframes hc-reveal { from { clip-path: inset(0 100% 0 0 round var(--r1)); opacity: .3; } to { clip-path: inset(0 0 0 0 round var(--r1)); opacity: 1; } }
.verdict { animation: hc-mask-in var(--t-slow) var(--ease) both; }
@keyframes hc-mask-in { from { clip-path: inset(0 0 100% 0 round var(--r3)); } to { clip-path: inset(0 0 0 0 round var(--r3)); } }

/* historial */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; }
.card.toolbar { flex-direction: row; }
.segmented { border-radius: var(--pill); }
.seg { border-radius: var(--pill); }
.seg:has(input:checked) { background: var(--ink); color: var(--on-ink); }
.seg:has(input:focus-visible) { box-shadow: var(--ring); }
.toolbar .input { flex: 1 1 220px; max-width: 360px; height: 44px; }
@media (max-width: 599px) { .toolbar .input { max-width: none; } }
/* etiquetas de navegación: corta en la barra inferior, completa en la barra lateral */
.nav-link .lbl-full { display: none; }
@media (min-width: 900px) { .nav-link .lbl-full { display: inline; } .nav-link .lbl-short { display: none; } }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chip-btn { min-height: 40px; padding: 0 var(--s4); border-radius: var(--pill); border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: transform var(--t-fast) var(--ease); }
.chip-btn:hover { transform: scale(1.04); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.hist-list { display: flex; flex-direction: column; gap: var(--s3); }
.hist-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); align-items: center; padding: var(--s4); background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r2); color: var(--text); text-decoration: none; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast); }
.hist-card:hover { transform: scale(1.01); border-color: var(--ink); }
.hist-card > .cat-ico { font-size: 1.2rem; }
.hist-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hist-top { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.hist-num { grid-column: 1 / -1; display: flex; gap: 2px var(--s3); align-items: baseline; flex-wrap: wrap; }
.hist-num strong { font-size: 1.25rem; font-weight: 900; }
@media (min-width: 640px) { .hist-card { grid-template-columns: auto minmax(0, 1fr) auto; } .hist-num { grid-column: auto; flex-direction: column; align-items: flex-end; text-align: right; } }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--pill); font-size: .78rem; font-weight: 800; border: 1px solid; }
.status-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.status-denied { color: var(--text-muted); border-color: var(--gray-500); background: var(--surface-2); }
.verdict h2 .status-badge { font-size: 1rem; }
.line-list { display: flex; flex-direction: column; gap: var(--s2); }
.line-list li { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* fundido cruzado entre pantallas: la copia saliente queda encima, inerte y sin capturar clics */
.main { position: relative; }
.xf-ghost { position: absolute; left: var(--s4); right: var(--s4); top: var(--s4); max-height: 100%; overflow: hidden; pointer-events: none; z-index: 1; }
@media (min-width: 900px) { .xf-ghost { left: var(--s6); right: var(--s6); top: var(--s6); } }

@media (prefers-reduced-motion: reduce) {
  .btn:hover:not([disabled]), .btn:active:not([disabled]), .icon-btn:hover, .chip-btn:hover, .hist-card:hover { transform: none; }
  .btn-primary::before, .nav-link::after { transition: none; }
  .xf-ghost { display: none; }
}

/* Impresión */
.print-area { display: none; }
.print-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.print-table th, .print-table td { border-bottom: 1px solid #bbb; padding: 6px 8px; text-align: left; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing .print-area { display: block !important; color: #000; background: #fff; }
  body.printing { background: #fff; }
  .print-area .kv { max-width: 420px; }
  .print-area .muted { color: #444; }
}

/* ===================== GENESIS-019: marca, idioma, licencia ===================== */
.brand-logo { display: block; height: 30px; width: auto; flex: none; }
.brand .badge { font-size: .62rem; }
.topbar { position: fixed; z-index: 45; top: calc(8px + env(safe-area-inset-top)); right: 12px; display: flex; gap: var(--s2); align-items: center; }
@media (min-width: 900px) { .topbar { position: absolute; top: 22px; right: 28px; } .main { padding-top: 84px; } }
.plan-host:empty { display: none; }
.plan-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--pill); border: 1px solid var(--ink);
  background: var(--ink); color: var(--on-ink); font-size: .8rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: transform var(--t-fast) var(--ease); }
.plan-pill:hover { transform: scale(1.03); }
.plan-pill.plan-test { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
@media (max-width: 420px) { .plan-pill span { display: none; } .plan-pill { width: 36px; padding: 0; justify-content: center; } }

.lang-menu { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 8px; border-radius: var(--pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: border-color var(--t-fast), background-color var(--t-fast), transform var(--t-fast) var(--ease); }
.lang-btn:hover { border-color: var(--ink); }
.lang-btn:active { transform: scale(.98); }
.lang-flag, .lang-opt .flag { display: inline-flex; flex: none; }
.flag { display: block; border-radius: 3px; }
.lang-chev { display: inline-flex; color: var(--text-muted); transition: transform var(--t-med) var(--ease); }
.lang-menu.open .lang-chev { transform: rotate(180deg); }
@media (max-width: 520px) { .lang-btn .lang-name { display: none; } .lang-btn { padding: 0 8px; } }
.lang-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 130; min-width: 210px; margin: 0; padding: 6px; list-style: none;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--r2); outline: none;
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top right; clip-path: inset(0 0 100% 0 round var(--r2));
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), clip-path var(--t-med) var(--ease), visibility 0s linear var(--t-med); }
.lang-menu.open .lang-list { opacity: 1; visibility: visible; transform: none; clip-path: inset(0 0 0 0 round var(--r2)); transition-delay: 0s; }
.lang-opt { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; border-radius: var(--r1); cursor: pointer; color: var(--ink); font-weight: 500; }
.lang-opt-name { flex: 1; white-space: nowrap; }
.lang-opt.active { background: var(--surface-3); }
.lang-list:focus-visible .lang-opt.active { outline: 2px solid var(--ink); outline-offset: -2px; }
.lang-opt[aria-selected="true"] { font-weight: 800; }
.lang-check { width: 16px; display: inline-flex; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .lang-list, .lang-chev { transition: none !important; } }

.welcome-logo { display: block; width: min(228px, 70%); height: auto; margin-bottom: var(--s2); }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; font-size: .9rem; }
.meter-bar { height: 8px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--ink); border-radius: var(--pill); }
.textarea { min-height: 88px; padding: var(--s3); font-family: var(--font-mono); font-size: .85rem; resize: vertical; word-break: break-all; }
.inst-steps { list-style: decimal; padding-left: var(--s5); display: flex; flex-direction: column; gap: var(--s2); }
.page-head h1, .card h2, .state h2 { overflow-wrap: anywhere; }
.btn span, .chip-btn { overflow-wrap: anywhere; }

/* ===================== GENESIS-019A: país y moneda, grupos de sugerencias, impuesto, información legal ===================== */
.cur-btn .cur-text { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cur-panel { width: min(360px, calc(100vw - 24px)); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cur-search { min-height: 40px; }
.cur-list { list-style: none; margin: 0; padding: 0; max-height: min(360px, 55vh); overflow-y: auto; overscroll-behavior: contain; }
.cur-opt { gap: 10px; }
.cur-opt .lang-opt-name { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
.cur-meta { flex: none; font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cur-code-badge { flex: none; min-width: 40px; text-align: center; font-size: .72rem; font-weight: 800; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.cur-mode { align-self: flex-start; min-height: 36px; padding: 0 12px; border-radius: var(--pill); border: 1px solid var(--border); background: transparent; color: var(--ink); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.cur-mode:hover { border-color: var(--ink); }
.cur-empty { padding: 12px; color: var(--text-muted); }
.lang-host + .lang-host { margin-left: 0; }
@media (max-width: 520px) { .cur-btn { padding: 0 8px; } .cur-btn .cur-text { font-size: .82rem; }
  .cur-menu .cur-panel { position: fixed; left: 12px; right: 12px; top: calc(56px + env(safe-area-inset-top)); width: auto; } }
.flag-badge text { letter-spacing: .02em; }
.combo-head { padding: 8px 10px 4px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); list-style: none; }
.combo-head[data-group="catalogo"] { border-top: 1px solid var(--border-soft); margin-top: 4px; }
.combo-alias { color: var(--text-muted); font-weight: 500; }
.chip-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.tax-chips { margin-top: -6px; }
.legal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.legal-list a { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border-soft); color: var(--ink); text-decoration: none; }
.legal-list li:last-child a { border-bottom: 0; }
.legal-list a:hover .legal-name { text-decoration: underline; }
.legal-doc { max-width: 72ch; display: flex; flex-direction: column; gap: var(--s4); }
.legal-doc h2 { font-size: 1.1rem; margin-top: var(--s3); }
.legal-doc p, .legal-doc li { line-height: 1.65; color: var(--text); }
.legal-doc ul { list-style: disc; padding-left: var(--s5); display: flex; flex-direction: column; gap: 6px; }
.legal-meta { font-size: .85rem; color: var(--text-muted); }
.legal-draft { color: var(--text-muted); font-size: .85rem; }   /* aviso discreto de borrador (sin recuadro) */
.pending { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); border-radius: 6px; padding: 0 6px; font-weight: 700; }
@media (max-width: 480px) { .brand .badge-prov { display: none; } }   /* en móvil, espacio para plan + moneda + idioma */
.legal-doc section { display: flex; flex-direction: column; gap: 8px; }
.legal-doc section + section { margin-top: var(--s2); }
.legal-doc h2 { margin-top: 0; }

/* GENESIS-019B: mensaje de conversión (amable, minimalista) */
.conv { display: flex; flex-direction: column; gap: var(--s3); }
.conv-logo { display: block; width: 140px; height: auto; margin-bottom: var(--s1); }
.conv-text { font-size: 1.05rem; line-height: 1.55; color: var(--text); }
.dialog-conv .dialog-actions .btn { min-width: 9.5rem; }
@media (max-width: 520px) { .dialog-conv .dialog-actions .btn { flex: 1 1 100%; } }
