/* Florería POS — interfaz táctil para mostrador y tablet */
:root {
  --bg: #f7f3f0;
  --surface: #ffffff;
  --surface-2: #fbf8f6;
  --ink: #2b2226;
  --muted: #7d7075;
  --line: #e9e1dc;
  --primary: #7a2e4d;
  --primary-ink: #ffffff;
  --primary-soft: #f6e7ee;
  --accent: #5b7f5f;
  --accent-soft: #e6f0e6;
  --ok: #2f7d4f;
  --ok-soft: #e1f3e8;
  --warn: #b26a00;
  --warn-soft: #fff1d9;
  --danger: #b3263a;
  --danger-soft: #fde6e9;
  --info: #2c5d8f;
  --info-soft: #e4eef9;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 30, 40, .06), 0 4px 16px rgba(60, 30, 40, .06);
  --tap: 48px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; margin-top: 1rem; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.warn { color: var(--warn); }
.lead { font-size: 1.1rem; }
.loading, .empty { color: var(--muted); padding: 2rem; text-align: center; }
.spacer { flex: 1; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--primary); color: #fff; display: flex; flex-direction: column;
  padding: 12px 10px; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 18px; font-weight: 700; font-size: 1.15rem; }
.brand-icon { font-size: 1.6rem; }
.sidebar a {
  display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 12px; border-radius: var(--radius-sm);
  min-height: var(--tap); opacity: .85; position: relative;
}
.sidebar a:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.sidebar a.active { background: rgba(255, 255, 255, .18); opacity: 1; font-weight: 600; }
.ni { font-size: 1.25rem; width: 1.6rem; text-align: center; }
.badge { margin-left: auto; background: #fff; color: var(--primary); border-radius: 999px; font-size: .75rem; padding: 1px 8px; min-width: 22px; text-align: center; }
.badge-warn { background: #ffd27a; color: #5a3b00; }
.nav-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px; opacity: .85; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #e66; box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
.live-dot.on { background: #6ee09a; }
.view { flex: 1; min-width: 0; padding: 22px 26px 60px; }

@media (max-width: 1024px) {
  .sidebar { width: 72px; }
  .sidebar .nl, .brand-name { display: none; }
  .badge { position: absolute; top: 4px; right: 4px; }
  .view { padding: 16px; }
}
@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; position: fixed; bottom: 0; top: auto; z-index: 20; padding: 4px; overflow-x: auto; }
  .brand, .nav-foot { display: none; }
  .sidebar a { flex: 1; justify-content: center; padding: 10px 6px; }
  .view { padding: 14px 16px 90px; }
}

/* ---------- Layout ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head.tight { margin-bottom: 10px; }
.page-head p { margin: 0; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.panel.narrow { max-width: 460px; margin: 40px auto; }
.panel.center { text-align: center; }
.panel.center .form { text-align: left; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-main { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat b { font-size: 1.6rem; }
.stat-ok b { color: var(--ok); }

.banner { display: block; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; text-decoration: none; font-weight: 500; }
.banner-warn { background: var(--warn-soft); color: #6a4100; }
.banner-danger { background: var(--danger-soft); color: var(--danger); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button, .tabs button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.pills button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.tabs button { border-radius: var(--radius-sm); }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none;
  color: var(--ink); font-weight: 500; white-space: nowrap; transition: transform .05s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: #f0d29b; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-ghost { color: var(--danger); border-color: #f2c4cb; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-sm { min-height: 36px; padding: 4px 10px; font-size: .88rem; }
.btn-lg { min-height: 52px; padding: 10px 22px; font-size: 1.05rem; }
.btn-xl { min-height: 60px; width: 100%; font-size: 1.15rem; font-weight: 700; }
.btn:hover:not(:disabled) { filter: brightness(.97); }
.icon-btn { border: 0; background: transparent; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }

input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
input[readonly] { background: var(--surface-2); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); font-weight: 500; }
.form label > input, .form label > select, .form label > textarea { color: var(--ink); font-weight: 400; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.inline-form { flex-direction: row; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form > * { flex: 1 1 140px; width: auto; }
.inline-form .btn { flex: 0 0 auto; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; align-items: center; }
.actions.wrap { flex-wrap: wrap; }

/* Segmentado (radios grandes) */
.seg { display: flex; gap: 6px; }
.seg-wrap { flex-wrap: wrap; }
.seg label { flex: 1; position: relative; min-width: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 6px 10px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; color: var(--ink); font-weight: 500; font-size: .92rem;
}
.seg input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-soft { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-pendiente_pago { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-en_proceso { background: var(--info-soft); color: var(--info); border-color: transparent; }
.st-listo { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.st-entregado { background: #ececec; color: #555; border-color: transparent; }
.st-cancelado { background: var(--danger-soft); color: var(--danger); border-color: transparent; text-decoration: line-through; }
.mv-entrada, .mv-devolucion { background: var(--ok-soft); color: var(--ok); }
.mv-salida { background: var(--info-soft); color: var(--info); }
.mv-merma { background: var(--danger-soft); color: var(--danger); }
.mv-ajuste { background: var(--warn-soft); color: var(--warn); }
.ev-confirmado { background: var(--ok-soft); color: var(--ok); }
.ev-cotizacion { background: var(--warn-soft); color: var(--warn); }
.ev-cancelado { background: var(--danger-soft); color: var(--danger); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; align-items: center; }
.kv.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: 1.05rem; }

/* ---------- Tablas y listas ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr[data-order], .table tbody tr[data-session] { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table tr.late td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.table tr.low td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.table tr.inactive { opacity: .5; }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stock { font-weight: 700; font-size: 1.05rem; }
.bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
tr.low .bar i { background: var(--warn); }

.list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; margin-bottom: 8px;
}
.row-card:hover { border-color: var(--primary); }
.row-card.late { border-left: 4px solid var(--danger); }
.row-card.ev { border-left: 4px solid var(--accent); }
.rc-time { display: flex; flex-direction: column; min-width: 74px; }
.rc-time small { color: var(--muted); }
.rc-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-mini { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.scroll-list { max-height: 360px; overflow-y: auto; }

/* ---------- POS ---------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.pos-ticket { position: sticky; top: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; max-height: calc(100vh - 32px); overflow-y: auto; }
@media (max-width: 1100px) { .pos-layout { grid-template-columns: 1fr; } .pos-ticket { position: static; max-height: none; } }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.product {
  display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; overflow: hidden; text-align: left; box-shadow: var(--shadow); transition: transform .08s;
}
.product:active { transform: scale(.97); }
.product:hover { border-color: var(--primary); }
.product.no-stock { opacity: .6; }
.product-img { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); display: grid; place-items: center; font-size: 3rem; width: 100%; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img.sm { width: 90px; aspect-ratio: 1; border-radius: var(--radius-sm); font-size: 2.2rem; overflow: hidden; }
.product-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.price { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.cart { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cl-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cl-main .chip { align-self: flex-start; }
.cl-amt { min-width: 80px; text-align: right; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 1.1rem; }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }
.ticket-total { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; }
.ticket-total .total { font-size: 1.35rem; color: var(--primary); }
.change { margin: 0; font-size: 1.1rem; }
.comp-row { display: grid; grid-template-columns: 1fr 110px 40px; gap: 8px; margin-bottom: 6px; }
.cost-box { background: var(--accent-soft); padding: 10px 14px; border-radius: var(--radius-sm); margin: 4px 0; }

/* ---------- Detalle de pedido ---------- */
.detail-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.line-main { min-width: 0; }
.recipe { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.recipe span { font-size: .78rem; background: var(--accent-soft); color: #2f4d32; border-radius: 6px; padding: 2px 8px; }
.card-msg { background: var(--primary-soft); color: var(--primary); padding: 12px 14px; border-radius: var(--radius-sm); font-style: italic; margin: 10px 0; }
.note { background: var(--warn-soft); color: #6a4100; padding: 10px 14px; border-radius: var(--radius-sm); margin: 10px 0; }
.totals { margin-top: 8px; }

/* ---------- Sesión / usuarios ---------- */
body.logged-out .shell { display: none; }
#login { position: fixed; inset: 0; z-index: 150; background: linear-gradient(160deg, var(--primary) 0%, #4d1a31 100%);
  display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.login-card { background: var(--surface); border-radius: 22px; padding: 26px 22px; width: min(560px, 100%); box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; position: relative; }
.login-card .form { text-align: left; margin-top: 12px; }
.login-brand { font-size: 2.6rem; }
.login-brand h1 { font-size: 1.4rem; margin: 2px 0 14px; color: var(--primary); }
.login-back { position: absolute; left: 14px; top: 14px; border: 0; background: none; color: var(--primary); font-weight: 600; cursor: pointer; min-height: 40px; }
.user-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.user-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-2); cursor: pointer; min-height: 120px; justify-content: center; }
.user-tile:hover { border-color: var(--primary); }
.user-tile small { color: var(--muted); }
.ut-icon { font-size: 2rem; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 14px 0 4px; min-height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.pin-error { color: var(--danger); min-height: 1.4em; margin: 4px 0; font-weight: 600; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 6px auto 0; }
.pin-pad button { min-height: 66px; font-size: 1.6rem; font-weight: 600; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.pin-pad button:active { transform: scale(.96); background: var(--primary-soft); }
.pin-pad .pin-ok { background: var(--primary); color: #fff; border-color: var(--primary); }
.pin-pad.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

.nav-foot { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 4px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: rgba(255,255,255,.1); border-radius: var(--radius-sm); }
.uc-icon { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.uc-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.uc-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-text small { opacity: .8; }
.logout-btn { display: flex; align-items: center; gap: 12px; background: transparent; border: 0; color: #fff; opacity: .85; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; min-height: 40px; text-align: left; }
.logout-btn:hover { background: rgba(255,255,255,.08); opacity: 1; }
.nav-status { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.badge-wa { background: #25d366; color: #073b1d; }
@media (max-width: 640px) { .nav-foot { display: flex; flex-direction: row; padding: 0; } .user-chip, .nav-status { display: none; } .logout-btn { justify-content: center; } }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.user-card { display: flex; gap: 14px; align-items: center; }
.user-card.inactive { opacity: .55; }
.user-card-main { flex: 1; min-width: 0; }
.user-name { text-transform: none; letter-spacing: 0; font-size: 1.05rem; color: var(--ink); margin: 0 0 4px; }
.uc-big { font-size: 2.2rem; }
.role-admin { background: var(--primary-soft); color: var(--primary); }
.role-recepcion { background: var(--info-soft); color: var(--info); }
.role-florista { background: var(--accent-soft); color: #2f4d32; }
.role-repartidor { background: var(--warn-soft); color: var(--warn); }
.role-option span { font-weight: 400; color: var(--ink); }

/* ---------- Repartidor ---------- */
.dlist { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.dsection { margin-top: 24px; }
.dcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-left: 6px solid var(--ok); }
.dcard.onroute { border-left-color: var(--info); }
.dcard.late { border-left-color: var(--danger); }
.dcard.done { opacity: .65; border-left-color: var(--line); }
.dcard-head { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; }
.ditems { font-weight: 600; }
.daddress { display: flex; flex-direction: column; background: var(--primary-soft); color: var(--primary); padding: 12px 14px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.daddress small { font-weight: 400; }
.dwho { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dcash { background: var(--warn-soft); color: #6a4100; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 1.05rem; }
.dactions { display: flex; gap: 8px; flex-wrap: wrap; }
.dactions .kbtn { min-height: 58px; font-size: 1.1rem; }

/* ---------- Avisos ---------- */
.notif-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.notif-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.notif.enviado, .notif.omitido { opacity: .7; }
.notif-err { color: var(--warn); margin: 0 0 8px; font-size: .9rem; }
.notif-st.enviado { color: var(--ok); }
.notif-st.pendiente { color: var(--warn); font-weight: 600; }
.notif-st.omitido { color: var(--muted); }

#offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: var(--danger); color: #fff; text-align: center;
  padding: 10px 16px; font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Fotos, ticket WhatsApp, seguimiento ---------- */
.field-label { font-size: .9rem; color: var(--muted); font-weight: 500; margin-bottom: -6px; }
.img-field { display: flex; gap: 14px; align-items: center; }
.img-preview { width: 96px; height: 96px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; display: grid; place-items: center; font-size: 2rem;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); border: 1px dashed var(--line); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.form .img-actions label.btn { flex-direction: row; color: var(--ink); font-weight: 500; cursor: pointer; }
.btn-wa { background: #25d366; color: #073b1d; border-color: #25d366; font-weight: 700; }
.ticket-preview { white-space: pre-wrap; font: .95rem/1.5 var(--font); background: #e7f8ee; border-radius: var(--radius-sm); padding: 14px 16px; max-height: 50vh; overflow-y: auto; margin: 0 0 8px; }
.link-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.detail-head { align-items: center; }

/* ---------- Catálogo / recetas ---------- */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.recipe-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; grid-template-columns: 90px 1fr; gap: 14px; }
.recipe-card.inactive { opacity: .55; }
.recipe-list { margin: 6px 0 10px; padding-left: 18px; font-size: .9rem; }

/* ---------- Agenda ---------- */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav h2 { margin: 0 6px; min-width: 190px; text-align: center; text-transform: capitalize; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--surface); padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow); }
.cal-wd { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 0; }
.cal-cell {
  min-height: 96px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px; display: flex; flex-direction: column;
  gap: 3px; align-items: stretch; text-align: left; cursor: pointer; overflow: hidden;
}
.cal-cell.other { opacity: .45; }
.cal-cell.today .cal-num { background: var(--primary); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.cal-cell.sel { outline: 2px solid var(--primary); }
.cal-num { font-weight: 700; font-size: .9rem; }
.cal-pill { font-size: .72rem; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-pill.or { background: var(--primary-soft); color: var(--primary); }
.cal-pill.ev { background: var(--accent-soft); color: #2f4d32; }
.cal-dot { font-size: .72rem; color: var(--muted); }
.cal-day h2 { text-transform: capitalize; }
@media (max-width: 640px) { .cal-cell { min-height: 64px; } .cal-pill { font-size: .62rem; } }

/* ---------- Modal y toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 15, 22, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); color: var(--ink); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.modal .panel { box-shadow: none; border: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); transition: opacity .4s, transform .4s; font-weight: 500; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-error { background: var(--danger); }
.toast-warn { background: #8a5300; }
.toast-info { background: var(--info); }
.toast-ready { background: var(--ok); font-size: 1.1rem; padding: 16px 18px; }
@media (max-width: 640px) { #toasts { bottom: 80px; } }

/* =================== TALLER / KDS (modo oscuro, alto contraste) =================== */
body.kds-mode { background: #16121a; color: #f3eef2; }
body.kds-mode .sidebar { display: none; }
body.kds-mode .view { padding: 12px 14px; }
body.kds-mode .btn { background: #2a2330; color: #f3eef2; border-color: #3b3242; }
.kds-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.kds-head h1 { margin: 0; font-size: 1.8rem; }
.kds-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.kds-clock { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 8px; }
.kds-legend { display: flex; gap: 6px; }
.lg { font-size: .75rem; padding: 3px 8px; border-radius: 6px; font-weight: 700; }
.lg.late { background: #e5484d; color: #fff; }
.lg.soon { background: #f5a524; color: #2a1a00; }
.lg.today { background: #3e8ed0; color: #fff; }
.lg.later { background: #3b3242; color: #ddd; }
.kds-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; height: calc(100vh - 90px); }
@media (max-width: 900px) { .kds-board { grid-template-columns: 1fr; height: auto; } }
.kcol { background: #1f1925; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.kcol h2 { padding: 12px 14px; margin: 0; font-size: 1.15rem; border-bottom: 1px solid #2f2736; display: flex; justify-content: space-between; }
.kcount { background: #3b3242; border-radius: 999px; padding: 0 10px; }
.kcol-body { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kempty { text-align: center; color: #6d6372; font-size: 2rem; margin: 20px 0; }
.kcard { background: #2a2330; border-radius: var(--radius); padding: 12px 14px; border-top: 6px solid #3b3242; display: flex; flex-direction: column; gap: 8px; }
.kcard.u-late { border-top-color: #e5484d; box-shadow: 0 0 0 2px #e5484d inset; animation: pulse 2s infinite; }
.kcard.u-soon { border-top-color: #f5a524; }
.kcard.u-today { border-top-color: #3e8ed0; }
.kcard.u-ok { border-top-color: #46a758; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px transparent inset; } }
.kcard-head { display: flex; justify-content: space-between; align-items: flex-start; }
.kfolio { font-weight: 800; font-size: 1.1rem; letter-spacing: .03em; }
.ktime { display: flex; flex-direction: column; align-items: flex-end; }
.ktime b { font-size: 1.15rem; }
.ktime small { color: #b9aebd; }
.u-late .ktime small { color: #ff8b8f; font-weight: 700; }
.kdelivery { color: #cfc4d3; font-size: .95rem; }
.kitem { background: #221c27; border-radius: var(--radius-sm); padding: 10px; }
.kitem-head { display: flex; gap: 10px; align-items: center; }
.kitem-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.kicon { font-size: 2rem; }
.kitem h3 { color: #fff; text-transform: none; letter-spacing: 0; font-size: 1.2rem; margin: 0; }
.kqty { color: #f5a524; }
.kdesc { margin: 6px 0; color: #dcd2e0; }
.krecipe { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
.krecipe li { background: #34503a; color: #dff2e1; padding: 3px 8px; border-radius: 6px; font-size: .88rem; }
.kmsg { background: #4a2338; color: #ffd9ea; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 1.05rem; font-style: italic; }
.kmsg-none { background: transparent; color: #6d6372; font-style: normal; font-size: .85rem; padding: 0; }
.knote { background: #4a3a10; color: #ffe6a6; padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.kactions { display: flex; gap: 8px; margin-top: 4px; }
.kbtn { flex: 1; min-height: 64px; border: 0; border-radius: var(--radius-sm); font-size: 1.25rem; font-weight: 800; cursor: pointer; color: #fff; }
.kbtn:active { transform: scale(.97); }
.kbtn:disabled { opacity: .5; }
.kbtn-elaborando { background: #3e8ed0; }
.kbtn-listo { background: #46a758; }
.kbtn-back { flex: 0 0 64px; background: #3b3242; color: #ddd; }

@media print {
  .sidebar, .actions, .modal-head .icon-btn, #toasts { display: none !important; }
  .modal-backdrop { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; max-height: none; width: 100%; }
  body:has(.modal-backdrop) .view { display: none; }
}
