@font-face { font-family: "Fraunces"; font-weight: 500; src: url(fonts/fraunces-500.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Fraunces"; font-weight: 700; src: url(fonts/fraunces-700.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 400; src: url(fonts/inter-400.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 500; src: url(fonts/inter-500.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 600; src: url(fonts/inter-600.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 700; src: url(fonts/inter-700.ttf) format("truetype"); font-display: swap; }

:root {
  --bg: #f6f1e8;
  --surface: #fffdf9;
  --surface-2: #f1ebe0;
  --ink: #1e2721;
  --muted: #69705f;
  --line: #e4dccd;
  --accent: #2f5d3a;
  --accent-ink: #f7f3ec;
  --accent-soft: #e2ecdf;
  --terra: #c4552d;
  --terra-soft: #f8e4d9;
  --warn: #9a6200;
  --warn-soft: #fbefd3;
  --danger: #b42318;
  --danger-soft: #fbe2df;
  --ok: #2f7d4a;
  --ok-soft: #dff1e4;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 20px rgba(40, 30, 10, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121512; --surface: #1a1e1a; --surface-2: #222722; --ink: #ebe6dc; --muted: #a09b8f;
    --line: #2d332d; --accent: #82b48d; --accent-ink: #102014; --accent-soft: #233328;
    --terra: #e7845b; --terra-soft: #3a261d; --warn: #e7b450; --warn-soft: #362b14;
    --danger: #f08a7e; --danger-soft: #3b1f1c; --ok: #7fc795; --ok-soft: #1d3324;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121512; --surface: #1a1e1a; --surface-2: #222722; --ink: #ebe6dc; --muted: #a09b8f;
  --line: #2d332d; --accent: #82b48d; --accent-ink: #102014; --accent-soft: #233328;
  --terra: #e7845b; --terra-soft: #3a261d; --warn: #e7b450; --warn-soft: #362b14;
  --danger: #f08a7e; --danger-soft: #3b1f1c; --ok: #7fc795; --ok-soft: #1d3324;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, sans-serif; font-feature-settings: "cv11", "tnum" 0;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
a { color: var(--accent); }
.ic { flex: none; vertical-align: middle; }
.num, td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- cabecera */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 700 20px "Fraunces", serif; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font: 700 17px "Fraunces", serif; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.top-actions { display: flex; gap: 4px; align-items: center; }
.top-actions form { margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: inline; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .when-dark { display: inline; }
  :root:not([data-theme]) .when-light { display: none; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 24px 64px; }

/* ---------- avisos */
.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 10px;
  background: var(--ok-soft); color: var(--ok); font-weight: 500;
}
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash-x { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; display: grid; }

/* ---------- piezas comunes */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card, .section + .section { margin-top: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }
.grid-2 .card + .card { margin-top: 0; }
.stack { display: grid; gap: 20px; align-content: start; }
.stack > .card + .card { margin-top: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 14px "Inter", sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn-icon { padding: 6px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon:disabled { opacity: .3; cursor: default; background: none; }
form.inline { display: inline; margin: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.terra { background: var(--terra-soft); color: var(--terra); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.allergens { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.al {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px;
  border: 1px solid var(--terra); color: var(--terra); font-size: 11px; font-weight: 700; cursor: help;
}

.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; display: block; }
.thumb-ph {
  display: grid; place-items: center; font: 700 19px "Fraunces", serif;
  background: hsl(var(--h) 40% 88%); color: hsl(var(--h) 35% 30%);
}
:root[data-theme="dark"] .thumb-ph { background: hsl(var(--h) 20% 22%); color: hsl(var(--h) 40% 78%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb-ph { background: hsl(var(--h) 20% 22%); color: hsl(var(--h) 40% 78%); } }

/* ---------- formularios */
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 15px "Inter", sans-serif;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip-check span b { font-size: 11px; color: var(--muted); }
.chip-check input:checked + span { background: var(--terra-soft); border-color: var(--terra); color: var(--terra); }
.chip-check input:checked + span b { color: var(--terra); }
.chip-check.tag input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- tablas */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; }
tr.dim td { opacity: .55; }
tr.cat-row td { background: var(--surface-2); font: 700 15px "Fraunces", serif; padding: 8px 10px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.prod-cell .name { font-weight: 600; }
.prod-cell .desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- panel */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 28px;
  border-radius: 20px; background: #2f5d3a; color: #f7f3ec; margin-bottom: 22px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: color-mix(in srgb, var(--terra) 55%, transparent); filter: blur(4px); opacity: .5;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 36px; }
.hero p { margin: 6px 0 0; opacity: .85; font-size: 16px; }
.hero-info { display: grid; gap: 6px; font-size: 14px; }
.hero-info div { display: flex; gap: 8px; align-items: center; }
.hero .btn { background: #f7f3ec; color: #2f5d3a; border-color: transparent; }
:root[data-theme="dark"] .hero { background: #1f3b27; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: #1f3b27; } }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font: 700 26px "Fraunces", serif; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat.alert .value { color: var(--danger); }

.alerts { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 22px; }
.alerts .card + .card { margin-top: 0; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list li .right { margin-left: auto; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 320px; }
.toolbar .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { padding-left: 34px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips button {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: 500 13px "Inter", sans-serif; cursor: pointer;
}
.filter-chips button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.cat-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.cat-title .count { color: var(--muted); font-size: 13px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.pcard .photo.thumb-ph { aspect-ratio: 16 / 6; }
.pcard .photo { aspect-ratio: 16 / 10; width: 100%; height: auto; border-radius: 0; font-size: 46px; }
.pcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard .title { display: flex; gap: 10px; align-items: baseline; }
.pcard .title h3 { flex: 1; }
.pcard .price { font: 700 18px "Fraunces", serif; color: var(--accent); white-space: nowrap; }
.pcard .desc { color: var(--muted); font-size: 14px; margin: 0; }
.pcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 4px; }
.pcard .admin-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-top: 1px solid var(--line); padding: 10px 16px; font-size: 12px; color: var(--muted); background: var(--surface-2); }
.pcard .admin-meta b { display: block; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.pcard.hidden-prod { opacity: .6; }
.featured-badge { position: absolute; top: 10px; left: 10px; }
.photo-wrap { position: relative; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- receta */
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 90px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.recipe-row .unit { font-size: 13px; color: var(--muted); }
.recipe-row .line-cost { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.recipe-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.recipe-summary div { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.recipe-summary b { display: block; font: 700 20px "Fraunces", serif; color: var(--ink); text-transform: none; letter-spacing: 0; }
.photo-edit { display: flex; gap: 14px; align-items: center; }
.photo-edit .thumb { width: 92px; height: 92px; border-radius: 12px; font-size: 34px; }

/* ---------- inventario */
.stock-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; width: 90px; margin-left: auto; margin-top: 4px; }
.stock-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.stock-bar.low i { background: var(--danger); }
.stock-bar.mid i { background: var(--warn); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.kind { font-weight: 600; font-size: 12px; }
.delta-pos { color: var(--ok); }
.delta-neg { color: var(--danger); }

dialog {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink);
  padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(10, 14, 10, .45); }
dialog h2 { margin-bottom: 16px; }

/* ---------- carta */
.pdf-frame { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: block; }
.carta-meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.carta-meta .live { display: inline-flex; align-items: center; gap: 6px; }
.carta-meta .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.carta-meta .live.busy::before { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.login-card { max-width: 380px; margin: 8vh auto; }
.login-card h1 { margin-bottom: 6px; }

/* ---------- móvil */
@media (max-width: 900px) {
  .grid-2, .alerts { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { padding-bottom: 72px; }
  .top { padding: 10px 16px; gap: 10px; backdrop-filter: none; background: var(--bg); }
  .top-actions { margin-left: auto; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; justify-content: space-around;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; flex: 1; text-align: center; }
  .wrap { padding: 18px 16px 40px; }
  h1 { font-size: 25px; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero h1 { font-size: 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .recipe-row { grid-template-columns: minmax(0, 1fr) 72px auto 32px; gap: 6px; }
  .recipe-row .unit { font-size: 11px; }
  .recipe-summary b { font-size: 17px; }
  .products { grid-template-columns: 1fr; }
  .pdf-frame { height: 70vh; }
  /* tablas apiladas */
  table.rtable thead { display: none; }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.rtable tr.cat-row { padding: 0; border: 0; }
  table.rtable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.rtable td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  table.rtable td.main { display: block; text-align: left; }
  table.rtable td .row-actions { margin-left: auto; }
  table.rtable .stock-bar { margin-left: 0; }
  .table-wrap { overflow: visible; }
  .card { padding: 16px; }
}

/* ---------- pedidos */
.badge { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--terra); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.order-banner { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 22px; border: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.order-banner div { display: grid; gap: 2px; flex: 1; min-width: 220px; }
.order-banner b { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.order-banner span { color: var(--muted); font-size: 14px; }
.order-banner.open { background: var(--ok-soft); border-color: transparent; }
.order-banner.open b { color: var(--ok); }
.add-row { margin-top: 6px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 2px; }
.stepper .btn-icon { color: var(--ink); }
.stepper .q { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper input.q { width: 46px; padding: 5px 2px; border: 0; background: transparent; -moz-appearance: textfield; font: 700 15px "Inter", sans-serif; }
.stepper input.q::-webkit-inner-spin-button { -webkit-appearance: none; }
.cart-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 25; display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); text-decoration: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; white-space: nowrap;
}
.cart-bar[hidden] { display: none; }
.cart-total { font: 700 17px "Fraunces", serif; }
.cart-bar .go { font-weight: 700; padding-left: 12px; border-left: 1px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); }
.order-line.picked b { color: var(--accent); }
.order-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.order-total b { font: 700 24px "Fraunces", serif; }

.track-card { max-width: 560px; margin: 0 auto; }
.track-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.track-head h1 { font-size: 46px; }
.track-time { font: 700 30px "Fraunces", serif; color: var(--accent); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps li { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; position: relative; }
.steps li::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li.now::before { background: var(--accent); }
.steps i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: transparent; position: relative; z-index: 1; border: 2px solid var(--line); }
.steps li.done i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.now i { background: var(--surface); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.steps li.now { color: var(--ink); }

.sched { display: grid; gap: 6px; }
.sched-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.sched-row > b { width: 90px; }
.sched-iv { display: inline-flex; align-items: center; gap: 6px; }
.sched-iv input { width: 118px; padding: 6px 8px; }
input[type=time], input[type=tel] { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 400 15px "Inter", sans-serif; width: 100%; }

/* ---------- pantalla del negocio */
body.screen .wrap { max-width: none; padding: 18px 20px 30px; }
.screen-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.screen-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.screen-head h1 span { font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; }
.switch-btn { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px "Inter", sans-serif; cursor: pointer; }
.switch-btn .sw { width: 40px; height: 24px; border-radius: 12px; background: var(--danger); position: relative; transition: background .2s; }
.switch-btn .sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch-btn[aria-pressed="true"] .sw { background: var(--ok); }
.switch-btn[aria-pressed="true"] .sw i { left: 19px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-2); border-radius: 16px; padding: 12px; min-height: 50vh; }
.col h2 { font-size: 18px; padding: 4px 6px 12px; display: flex; align-items: center; gap: 8px; }
.col h2 .count { font: 700 13px "Inter", sans-serif; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 1px 8px; }
.col h2 .count:empty { display: none; }
.col[data-col="nuevo"] h2 { color: var(--terra); }
.col[data-col="listo"] h2 { color: var(--ok); }
.col-body { display: grid; gap: 12px; }
.col-empty { color: var(--muted); text-align: center; padding: 30px 0; margin: 0; }
.ocard { background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); border-left: 5px solid var(--line); }
.ocard.is-new { border-left-color: var(--terra); animation: flashin 1.2s ease 2; }
.col[data-col="preparando"] .ocard { border-left-color: var(--warn); }
.col[data-col="listo"] .ocard { border-left-color: var(--ok); }
.ocard.soon .otime b { color: var(--warn); }
.ocard.late .otime b { color: var(--danger); }
@keyframes flashin { 50% { box-shadow: 0 0 0 4px var(--terra-soft), var(--shadow); } }
.ocard header { display: flex; justify-content: space-between; align-items: flex-start; }
.onum { font: 700 28px "Fraunces", serif; line-height: 1; }
.otime { display: grid; text-align: right; }
.otime b { font: 700 22px "Fraunces", serif; line-height: 1.1; }
.otime small { color: var(--muted); font-size: 12px; }
.ocust { font-size: 14px; margin: 6px 0 8px; color: var(--muted); }
.ocust a { color: inherit; }
.oitems { list-style: none; padding: 0; margin: 0; font-size: 17px; line-height: 1.5; }
.oitems b { color: var(--accent); margin-right: 4px; }
.onotes { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; }
.ocard footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.ototal { font-weight: 700; font-variant-numeric: tabular-nums; }
.oacts { display: flex; gap: 2px; align-items: center; }
.oacts .btn-icon { font-size: 16px; width: 34px; height: 34px; text-decoration: none; }
.oacts .btn.primary { padding: 8px 16px; font-size: 15px; margin-left: 4px; }
.history { margin-top: 18px; }
.history summary { cursor: pointer; }
.history .hist-body { margin-top: 12px; }
@media (max-width: 1000px) { .board { grid-template-columns: 1fr; } .col { min-height: 0; } }
@media (max-width: 760px) {
  .cart-bar { bottom: 78px; padding: 10px 16px; gap: 8px; }
  .steps li span { font-size: 10px; }
  body.screen .wrap { padding: 14px 12px 30px; }
}

/* ---------- visor de la carta */
.viewer { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); transition: box-shadow .3s; }
.viewer.updated { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.viewer-bar { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.viewer-bar .live { display: inline-flex; align-items: center; gap: 6px; }
.viewer-bar .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.viewer-bar .live.busy::before { background: var(--warn); animation: pulse 1s infinite; }
.vb-pages { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.vb-group { display: inline-flex; align-items: center; gap: 2px; }
.vb-right { margin-left: auto; gap: 4px; }
.vb-right .btn { margin-left: 4px; }
.vb-zoom { min-width: 58px; padding: 6px 8px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--ink); font: 600 13px "Inter", sans-serif; cursor: pointer; font-variant-numeric: tabular-nums; }
.viewer-desk {
  height: calc(100vh - 250px); min-height: 480px; overflow: auto; padding: 32px 32px 48px;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 0) 0 0 / 18px 18px, var(--surface-2);
}
.sheet { flex: none; max-width: none; background: #fbf7f0; border-radius: 4px; box-shadow: 0 1px 3px rgba(40, 30, 10, .12), 0 14px 40px rgba(40, 30, 10, .16); overflow: hidden; }
.sheet canvas { display: block; width: 100%; height: 100%; }
.viewer-loading { margin: auto; color: var(--muted); }
.viewer-desk .pdf-frame { border: 0; border-radius: 0; height: 100%; min-height: 0; }
@media (max-width: 760px) {
  .viewer { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .viewer-desk { height: calc(100vh - 230px); padding: 12px 12px 30px; gap: 14px; }
  .vb-hide-sm, #carta-updated { display: none; }
  .viewer-bar { gap: 8px; }
}

/* ---------- personalización */
.recipe-row { grid-template-columns: minmax(0, 1fr) 110px 80px auto 36px; }
.rm-flag { display: none; flex-direction: row; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.rm-flag input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--terra); margin: 0; }
.is-custom .rm-flag { display: inline-flex; }
.custom-only { display: none; }
.is-custom .custom-only { display: block; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.price-in { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.price-in input { text-align: right; }
@media (max-width: 760px) {
  .recipe-row { grid-template-columns: minmax(0, 1fr) 72px auto 32px; }
  .recipe-row .rm-flag { grid-column: 1 / -1; order: 5; }
  .extra-row { grid-template-columns: minmax(0, 1fr) 110px 32px; }
}
.mods { display: block; font-size: 13px; color: var(--terra); font-weight: 600; }
.omods { display: block; font-size: 14px; color: var(--terra); font-weight: 600; margin: -2px 0 4px 26px; line-height: 1.3; }
.cart-lines .order-line { align-items: flex-start; gap: 12px; }
.ol-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.link-btn { background: none; border: 0; padding: 2px 0; color: var(--accent); font: 600 13px "Inter", sans-serif; text-decoration: underline; cursor: pointer; justify-self: start; }
.cart-empty { text-align: center; padding: 18px 0 10px; color: var(--muted); }
.more { margin-top: 14px; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { margin-bottom: 8px; }
.dc-h { font-size: 15px; margin: 4px 0 10px; }
.dc-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.dc-scope { display: grid; gap: 8px; padding: 12px 0 0; border-top: 1px solid var(--line); }
.dc-price { font: 700 18px "Fraunces", serif; }
.cart-lines .stepper .btn-icon { font-size: 19px; width: 34px; height: 34px; line-height: 1; color: var(--ink); }

/* ---------- logo */
.brand-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.hero-logo { margin: 0; }
.hero-logo img { display: block; height: 130px; width: auto; max-width: 100%; filter: brightness(0) invert(1); opacity: .95; }
.hero-brand p { margin-top: 10px; }
.login-logo { display: block; width: 150px; margin: 0 auto 18px; }
.logo-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-prev { display: grid; place-items: center; width: 120px; height: 100px; border-radius: 12px; background: var(--surface-2); padding: 10px; }
.logo-prev.sm { width: 64px; height: 64px; padding: 6px; }
.logo-prev img { max-width: 100%; max-height: 100%; }
.empty-logo { color: var(--muted); font-size: 13px; }
:root[data-theme="dark"] .logo-img { filter: brightness(0) invert(.92); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-img { filter: brightness(0) invert(.92); } }
@media (max-width: 760px) { .hero-logo img { height: 96px; } .brand-logo { width: 40px; height: 40px; } }

/* ---------- mis pedidos */
.my-orders { display: grid; gap: 8px; margin-bottom: 18px; }
.my-order { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-size: 14px; box-shadow: var(--shadow); }
.my-order .go { margin-left: auto; font-weight: 700; white-space: nowrap; }
.my-order.st-listo { background: var(--ok); }
.my-order.st-cancelado { background: var(--danger-soft); color: var(--danger); }
.my-order.st-entregado { background: var(--surface-2); color: var(--ink); }
.nav a { position: relative; }
.nav .dot { position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--terra); }
@media (max-width: 760px) { .my-order { flex-wrap: wrap; } .my-order .go { margin-left: 28px; } }
@media (max-width: 760px) { .nav .dot { right: calc(50% - 20px); top: 4px; } }
.call-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 500; }
.call-note a { color: inherit; font-weight: 700; }

/* ---------- informes */
:root { --chart: #2e8048; }
:root[data-theme="dark"] { --chart: #46a866; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart: #46a866; } }
.report-filters { justify-content: space-between; }
.chip-link { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px "Inter", sans-serif; text-decoration: none; }
.chip-link.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.range-in { display: inline-flex; align-items: center; gap: 6px; }
.range-in input { width: 150px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 400 14px "Inter", sans-serif; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.report-grid .card + .card { margin-top: 0; }
.report-grid .wide { grid-column: 1 / -1; }
.chart { width: 100%; min-height: 60px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .bar { fill: var(--chart); transition: opacity .1s; }
.chart-svg:hover .bar { opacity: .55; }
.chart-svg .bar.hot { opacity: 1; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart-svg .tick { fill: var(--muted); font: 500 11px "Inter", sans-serif; font-variant-numeric: tabular-nums; }
.chart-svg .cat { fill: var(--ink); font: 500 13px "Inter", sans-serif; }
.chart-svg .val { fill: var(--muted); font: 600 12px "Inter", sans-serif; font-variant-numeric: tabular-nums; }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.4; box-shadow: var(--shadow); white-space: nowrap; }
.chart-card .table-wrap { margin-top: 12px; }
@media (max-width: 900px) { .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .nav a { padding: 6px 2px; font-size: 10px; } .range-in input { width: 132px; } }
@media (max-width: 760px) { .stat .value { font-size: 21px; } }
