/* Llantería · Inventario — estilos */

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #16181d;
  --ink-2: #3a3d45;
  --muted: #6b6f78;
  --line: #e6e5e1;
  --line-2: #d6d4cf;
  --accent: #e8a33d;
  --accent-soft: #fbf1df;
  --ok: #2f7d4f;
  --ok-soft: #e7f3ec;
  --warn: #a8650b;
  --warn-soft: #fcf1de;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .05), 0 4px 16px rgba(22, 24, 29, .05);
  --shadow-lg: 0 10px 40px rgba(22, 24, 29, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600; letter-spacing: .005em;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #2a2d35; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn--danger { background: var(--bad); color: #fff; }
.btn--danger:hover { background: #9a1f18; }
.btn--sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn--block { width: 100%; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 8px; color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

.link {
  border: 0; background: none; padding: 6px 4px;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px;
}
.link:hover { color: var(--ink); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px 0 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.chip:hover { border-color: var(--line-2); }
.chip__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
}
.chip--static { cursor: default; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(245, 245, 243, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1160px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand__sub { color: var(--muted); font-weight: 500; margin-left: 4px; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); position: relative; flex: none;
}
.brand__mark::after {
  content: ""; position: absolute; inset: 8px;
  border: 3px solid var(--accent); border-radius: 50%;
}
.brand__logo { width: 40px; height: auto; display: block; }

/* ---------- Pantallas ---------- */
.screen { animation: fadeUp .35s var(--ease); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Inicio */
.screen--login {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
}
.login { width: 100%; max-width: 440px; text-align: center; }
.login__brand { display: grid; justify-items: center; gap: 8px; margin-bottom: 28px; }
.login__logo { width: min(280px, 72vw); height: auto; display: block; filter: drop-shadow(0 10px 24px rgba(22,24,29,.14)); animation: logoIn .6s var(--ease); }
@keyframes logoIn { from { opacity: 0; transform: scale(.94) rotate(-2deg); } }
.login__brand p { color: var(--muted); }
.login__wa { display: inline-block; color: var(--ok); font-weight: 600; font-size: 14px; text-decoration: none; padding: 6px; }
.login__wa:hover { text-decoration: underline; }
.login__title {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 14px;
}
.login__roles { display: grid; gap: 12px; }
.role {
  display: flex; align-items: center; gap: 16px; text-align: left;
  width: 100%; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.role:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: 0 8px 28px rgba(22,24,29,.10); }
.role:active { transform: translateY(0) scale(.99); }
.role__ico {
  width: 52px; height: 52px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: var(--bg);
}
.role__ico svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.role__text { flex: 1; display: grid; gap: 2px; }
.role__text strong { font-size: 18px; }
.role__text small { color: var(--muted); font-size: 14px; }
.role__arrow { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.role:hover .role__arrow { transform: translateX(3px); stroke: var(--ink); }
.login__note { color: var(--muted); font-size: 13px; margin: 26px 0 6px; }

/* Encabezado de página */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 4px;
}
.page-title { font-size: 28px; letter-spacing: -.02em; line-height: 1.2; }
.section-title { font-size: 17px; margin-bottom: 12px; }

/* ---------- Resumen ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); text-align: left;
  display: grid; gap: 4px; align-content: start;
}
.stat__label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat__value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat__foot { font-size: 13px; color: var(--muted); }
.stat--alert { cursor: pointer; transition: border-color .2s, transform .2s var(--ease); }
.stat--alert:hover { border-color: var(--line-2); transform: translateY(-1px); }
.stat--alert.has-alerts { border-color: #efc98c; background: linear-gradient(0deg, var(--warn-soft), var(--surface) 70%); }
.stat--alert.has-alerts .stat__value { color: var(--warn); }
.stat--alert.has-out { border-color: #eab0aa; background: linear-gradient(0deg, var(--bad-soft), var(--surface) 70%); }
.stat--alert.has-out .stat__value { color: var(--bad); }
.stat.bump .stat__value { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.06); } }

.alerts {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; margin-bottom: 14px; animation: fadeUp .25s var(--ease);
}
.alert-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
}
.alert-row + .alert-row { border-top: 1px solid var(--line); border-radius: 0; }
.alert-row__name { flex: 1; font-weight: 600; min-width: 0; }
.alert-empty { padding: 12px; color: var(--muted); }

/* ---------- Pestañas ---------- */
.tabs {
  display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line);
  margin: 26px 0 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tab {
  border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.panel { animation: fadeUp .25s var(--ease); }

/* ---------- Barra de herramientas ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar__selects { display: flex; gap: 8px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,24,29,.08); }
.search .ico { color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; height: 100%; font-size: 15px; }
select {
  height: 44px; padding: 0 34px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6f78' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
select:focus { outline: 0; border-color: var(--ink); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #ebeae6; border-radius: var(--radius-sm);
}
.segmented button {
  border: 0; background: none; height: 38px; padding: 0 14px; border-radius: 8px;
  font-weight: 600; font-size: 14px; color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Listas tipo tabla ---------- */
.list {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.row {
  display: grid; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line);
  animation: rowIn .3s var(--ease) both;
}
.row:first-child { border-top: 0; }
.row--head {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--surface-2); animation: none;
  padding-top: 10px; padding-bottom: 10px;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.row.flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }

.list--inv .row { grid-template-columns: minmax(0, 2.4fr) .9fr 1.3fr 1fr 264px; }
.list--hist .row { grid-template-columns: 1.3fr minmax(0, 2fr) .6fr 1fr 1fr 1.1fr; }
.list--mine .row { grid-template-columns: .8fr minmax(0, 2fr) .6fr 1fr; }

.cell-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.cell-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.right { text-align: right; justify-self: end; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .btn { height: 34px; padding: 0 10px; font-size: 13px; }
.row-actions .btn--del { color: var(--bad); }
.row-actions .btn--del:hover { border-color: #eab0aa; background: var(--bad-soft); }

.stock { display: flex; align-items: center; gap: 8px; }
.stock__n { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; min-width: 2ch; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--low { background: var(--warn-soft); color: var(--warn); }
.badge--out { background: var(--bad-soft); color: var(--bad); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.list-foot { font-size: 13px; margin-top: 10px; }

.hist-summary {
  display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; color: var(--muted);
}
.hist-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Tarjetas del trabajador ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  display: grid; gap: 12px; align-content: space-between;
  animation: rowIn .3s var(--ease) both;
  transition: border-color .2s, transform .2s var(--ease);
}
.card:hover { border-color: var(--line-2); }
.card.flash { animation: flashCard 1.4s var(--ease); }
@keyframes flashCard { 0%, 30% { background: var(--accent-soft); border-color: #efc98c; } 100% { background: var(--surface); } }
.card.is-out { background: var(--surface-2); }
.card.is-out .card__name, .card.is-out .card__price { color: var(--muted); }
.card__name { font-weight: 700; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.card__mid { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__price { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.card__left { font-size: 14px; color: var(--muted); text-align: right; }
.card__left strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.card.is-low .card__left strong { color: var(--warn); }
.card .btn { width: 100%; }

.mine { margin-top: 32px; }

.fab-bar { display: none; }

/* ---------- Ventana modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal__backdrop {
  position: absolute; inset: 0; background: rgba(22, 24, 29, .45);
  animation: fade .2s ease;
}
.modal__box {
  position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .28s var(--ease);
}
.modal.is-closing .modal__backdrop { animation: fade .18s ease reverse forwards; }
.modal.is-closing .modal__box { animation: pop .18s ease reverse forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 20px 6px;
}
.modal__head h2 { font-size: 19px; letter-spacing: -.01em; }
.modal__body { padding: 8px 20px 20px; }

/* Formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-size: 13px; }
.input {
  height: 48px; padding: 0 14px; width: 100%;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,24,29,.08); }
.input.is-invalid { border-color: var(--bad); }
.input-money { position: relative; }
.input-money::before {
  content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px;
}
.input-money .input { padding-left: 28px; }
.field select { height: 48px; font-size: 16px; width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--bad); font-size: 13px; min-height: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions .btn { flex: 1; height: 48px; }

.stepper {
  display: grid; grid-template-columns: 52px 1fr 52px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; height: 52px;
}
.stepper button {
  border: 0; background: var(--surface-2); font-size: 22px; font-weight: 500;
  transition: background .15s;
}
.stepper button:hover:not(:disabled) { background: var(--bg); }
.stepper button:disabled { color: var(--line-2); cursor: not-allowed; }
.stepper input {
  border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center; font-size: 20px; font-weight: 700; min-width: 0; outline: 0;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sale-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
}
.sale-info > div { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.sale-info small { display: block; color: var(--muted); font-size: 12px; }
.sale-info strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.sale-total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 0 4px; border-top: 1px dashed var(--line-2); margin-top: 4px;
}
.sale-total span { color: var(--muted); }
.sale-total strong { font-size: 28px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.btn--sold { height: 56px !important; font-size: 17px; }

.worker-pick { display: grid; gap: 8px; margin-bottom: 16px; }
.worker-pick button {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 600; transition: border-color .15s, background .15s;
}
.worker-pick button:hover { border-color: var(--ink); }
.worker-pick button.is-last { border-color: var(--ink); background: var(--surface-2); }
.worker-pick .chip__avatar { width: 34px; height: 34px; font-size: 14px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.confirm-text { color: var(--ink-2); margin-bottom: 16px; }

/* ---------- Avisos ---------- */
.toasts {
  position: fixed; z-index: 60; right: 20px; bottom: 20px;
  display: grid; gap: 8px; justify-items: end; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; max-width: 380px;
  animation: toastIn .35s var(--ease); pointer-events: auto;
}
.toast .ico { color: var(--accent); }
.toast--ok .ico { color: #7fd3a0; }
.toast--bad .ico { color: #ff9b92; }
.toast.is-leaving { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Servicios ---------- */
.toolbar--between { justify-content: space-between; }
.toolbar__note { flex: 1 1 320px; font-size: 14px; }
.list--svc .row { grid-template-columns: minmax(0, 2fr) 1fr 200px; }
.list--svc .row-actions .btn--del { width: 40px; }
.badge--svc { background: #eceae6; color: var(--ink-2); }
.badge--svc::before { display: none; }
.price-note { display: block; font-size: 12px; color: var(--warn); font-weight: 600; }
.svc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.svc-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, transform .2s var(--ease);
}
.svc-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.svc-card strong { display: block; font-size: 15px; }
.svc-card small { color: var(--muted); font-size: 13px; }
.svc-card__price { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; white-space: nowrap; }
.svc-card--other { border-style: dashed; box-shadow: none; background: transparent; }

.pass { position: relative; }
.pass .input { padding-right: 84px; }
.pass__toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 8px;
}
.pass__toggle:hover { color: var(--ink); background: var(--bg); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login-role { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.login-role .role__ico { width: 44px; height: 44px; }

/* ---------- Tablet ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .list--hist .row { grid-template-columns: 1.2fr minmax(0, 2fr) .5fr 1fr 1fr; }
  .list--hist .col-price { display: none; }
  .list--inv .row { grid-template-columns: minmax(0, 2fr) .9fr 1.3fr 264px; }
  .list--inv .c-value { display: none; }
}

/* ---------- Celular ---------- */
@media (max-width: 680px) {
  body { font-size: 15px; }
  .wrap { padding: 18px 16px 120px; }
  .topbar__inner { padding: 8px 16px; }
  .brand__sub { display: none; }
  .brand__name { white-space: nowrap; font-size: 15px; }
  .topbar .btn span { display: none; }
  .topbar .btn--sm { width: 36px; padding: 0; }
  .chip { max-width: 140px; }
  .chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .page-title { font-size: 24px; }
  .page-head { align-items: stretch; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .page-head__actions .btn--primary { order: -1; flex-basis: 100%; height: 50px; }
  .page-head__actions .btn--ghost { height: 38px; font-size: 14px; color: var(--muted); }
  #screenWorker .page-head__actions { display: none; }

  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 22px; }

  .toolbar { gap: 8px; }
  .search { flex-basis: 100%; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 0 6px; }
  .toolbar__selects { width: 100%; }
  .toolbar__selects select { flex: 1; min-width: 0; }

  /* Las tablas pasan a tarjetas */
  .list .row--head { display: none; }
  .list--inv .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name price" "stock stock" "actions actions";
    gap: 8px 12px; padding: 14px;
  }
  .list--inv .c-name { grid-area: name; }
  .list--inv .c-price { grid-area: price; font-weight: 700; font-size: 16px; }
  .list--inv .c-stock { grid-area: stock; }
  .list--inv .c-value { display: none; }
  .list--inv .c-actions { grid-area: actions; }
  .row-actions { justify-content: stretch; }
  .row-actions .btn { flex: 1; height: 40px; }

  .list--hist .row, .list--mine .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name total" "meta meta";
    gap: 2px 12px; padding: 12px 14px;
  }
  .list--hist .col-name, .list--mine .col-name { grid-area: name; }
  .list--hist .col-total, .list--mine .col-total { grid-area: total; font-weight: 700; }
  .list--hist .col-date, .list--hist .col-qty, .list--hist .col-price, .list--hist .col-worker,
  .list--mine .col-date, .list--mine .col-qty { display: none; }
  .col-meta { grid-area: meta; display: block !important; font-size: 13px; color: var(--muted); }

  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { grid-template-columns: 1fr auto; align-items: center; padding: 14px; gap: 10px 12px; }
  .card__name { grid-column: 1 / -1; }
  .card__mid { grid-column: 1 / -1; }
  .card .btn { grid-column: 1 / -1; height: 46px; }

  .list--svc .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name price" "actions actions";
    gap: 8px 12px; padding: 14px;
  }
  .list--svc .c-name { grid-area: name; }
  .list--svc .c-price { grid-area: price; font-weight: 700; }
  .list--svc .c-actions { grid-area: actions; }
  .toolbar--between .btn { width: 100%; }
  .svc-cards { grid-template-columns: 1fr 1fr; }
  .svc-card { flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; }

  .fab-bar {
    display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 70%, rgba(245,245,243,0));
  }

  .modal { place-items: end center; padding: 0; }
  .modal__box {
    max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet .32s var(--ease);
  }
  .modal.is-closing .modal__box { animation: sheet .2s ease reverse forwards; }
  @keyframes sheet { from { transform: translateY(100%); } }

  .toasts { left: 16px; right: 16px; bottom: 88px; justify-items: stretch; }
  .toast { max-width: none; }
  body:not([data-role="worker"]) .toasts { bottom: 16px; }
}

.col-meta { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.charge-hint { color: var(--muted); font-size: 13px; margin: -6px 0 6px; }
.charge-hint__diff { color: var(--warn); }

@media (max-width: 400px) {
  .brand__name { display: none; }
}

/* ---------- Conexión ---------- */
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -3px;
}
.spinner--dark { border-color: var(--line-2); border-top-color: var(--ink); margin-right: 8px; }
.btn--ghost .spinner { border-color: var(--line-2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-busy { cursor: progress; opacity: .85; }
.offline {
  position: fixed; z-index: 40; left: 50%; top: 12px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: var(--shadow-lg); animation: fadeUp .3s var(--ease);
}
