/* Lanbi Control — estilos. Tokens en :root, modo oscuro automático. */
:root {
  color-scheme: light;
  --bg: #f4f4f1; --surface: #fcfcfb; --surface-2: #f0efec; --ink: #0b0b0b; --ink-2: #52514e; --muted: #75746f;
  --line: #e3e2dd; --line-2: #d3d2cc;
  --accent: #1c5cab; --accent-ink: #ffffff; --accent-soft: #e4eefb;
  --s1: #2a78d6; --s2: #eb6834; --tail: #9ec5f4;
  --ok: #0ca30c; --ok-ink: #006300; --warn: #fab219; --warn-ink: #7a4f00; --bad: #d03b3b; --bad-ink: #a52727;
  --ok-soft: #e3f4e3; --warn-soft: #fdf1d3; --bad-soft: #fbe4e4;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #242423; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a998f;
    --line: #2e2e2c; --line-2: #3d3d3a; --accent: #3987e5; --accent-ink: #0b0b0b; --accent-soft: #15283f;
    --s1: #3987e5; --s2: #d95926; --tail: #1c5cab;
    --ok: #0ca30c; --ok-ink: #62d462; --warn-ink: #fab219; --bad: #d03b3b; --bad-ink: #f08a8a;
    --ok-soft: #12301a; --warn-soft: #3a2c0a; --bad-soft: #3b1616;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #242423; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a998f;
  --line: #2e2e2c; --line-2: #3d3d3a; --accent: #3987e5; --accent-ink: #0b0b0b; --accent-soft: #15283f;
  --s1: #3987e5; --s2: #d95926; --tail: #1c5cab;
  --ok: #0ca30c; --ok-ink: #62d462; --warn-ink: #fab219; --bad: #d03b3b; --bad-ink: #f08a8a;
  --ok-soft: #12301a; --warn-soft: #3a2c0a; --bad-soft: #3b1616;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
:focus-visible { outline: 3px solid var(--s1); outline-offset: 2px; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); }
.small { font-size: .85rem; } .tiny { font-size: .75rem; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad-ink); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; border-radius: 10px; }
.btn.big { min-height: 64px; font-size: 1.2rem; border-radius: 16px; padding: 12px 24px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); font-weight: 500; font-size: .92rem; }
.chip[aria-pressed="true"], .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .85; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 14px; min-height: 36px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

input[type=text], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); }
textarea { min-height: 96px; resize: vertical; }
label.f { display: block; }
label.f > span, .lbl { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; letter-spacing: .01em; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Estructura ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 8px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; font-size: 1.1rem; text-decoration: none; color: var(--ink); }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 1rem; }
.nav { display: flex; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .ico { font-size: 1.15rem; }
.iconbtn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent; background: transparent; font-size: 1.25rem; display: grid; place-items: center; }
.iconbtn:hover { background: var(--surface-2); }
.badge-n { position: absolute; top: 2px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); min-height: 44px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 120px; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead .t { flex: 1; min-width: 200px; }
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; min-height: 60px; padding: 0 24px; border-radius: 30px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 1.05rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h3 { margin-bottom: 2px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 1.7rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.kpi .l { font-size: .82rem; color: var(--ink-2); }
.kpi .d { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.kpi.bad .v { color: var(--bad-ink); } .kpi.warn .v { color: var(--warn-ink); } .kpi.ok .v { color: var(--ok-ink); }

/* ---------- Etiquetas / estados ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.critica { background: var(--bad-soft); color: var(--bad-ink); } .tag.alta { background: var(--warn-soft); color: var(--warn-ink); }
.tag.media { background: var(--accent-soft); color: var(--accent); } .tag.baja { background: var(--surface-2); color: var(--ink-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok-ink); } .tag.bad { background: var(--bad-soft); color: var(--bad-ink); } .tag.warn { background: var(--warn-soft); color: var(--warn-ink); }
.risk { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: .85rem; }
.risk i { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .75rem; color: #fff; }
.risk.rojo i { background: var(--bad); } .risk.ambar i { background: var(--warn); color: #3a2800; } .risk.verde i { background: var(--ok); }
.risk.rojo { color: var(--bad-ink); } .risk.ambar { color: var(--warn-ink); } .risk.verde { color: var(--ok-ink); }

/* ---------- Identidad ---------- */
.ident { max-width: 980px; margin: 0 auto; padding: 32px 16px 64px; }
.ident .hero { text-align: center; margin-bottom: 24px; }
.ident .hero .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 12px; }
.people { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.person { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 64px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; }
.person:hover { border-color: var(--accent); background: var(--accent-soft); }
.person .avatar { width: 40px; height: 40px; flex: none; }
.group-t { margin: 22px 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; margin: 16px 0; }
.pad button { height: 64px; font-size: 1.5rem; font-weight: 700; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.pad button:active { background: var(--accent-soft); }
.dots { display: flex; gap: 12px; justify-content: center; margin: 8px 0; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); } .dots i.on { background: var(--accent); border-color: var(--accent); }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 18px; padding: 20px; max-width: 520px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 12px; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); z-index: 51; overflow: auto; box-shadow: -8px 0 32px rgba(0,0,0,.25); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .dh { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 10px; align-items: center; }
.drawer .db { padding: 16px; display: grid; gap: 14px; }
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 100; display: grid; gap: 8px; width: min(520px, calc(100% - 24px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 550; }
.toast.err { background: var(--bad); color: #fff; }
.popover { position: absolute; right: 0; top: 52px; width: min(400px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); z-index: 70; }
.notif { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.notif.new { background: var(--accent-soft); } .notif:hover { background: var(--surface-2); }

/* ---------- Asistente de captura ---------- */
.wiz { position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow: auto; }
.wiz .in { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
.wiz .top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.steps { display: flex; gap: 6px; flex: 1; } .steps i { height: 6px; flex: 1; border-radius: 3px; background: var(--line-2); } .steps i.on { background: var(--accent); }
.wiz h1 { margin: 12px 0 16px; font-size: 1.75rem; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tile { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); text-align: left; font-weight: 650; font-size: 1.05rem; }
.tile:hover { border-color: var(--accent); } .tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile .e { font-size: 2rem; line-height: 1; } .tile small { display: block; font-weight: 450; color: var(--ink-2); font-size: .85rem; }
.wiz .foot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px; z-index: 2; }
.wiz .foot .in { padding: 0; display: flex; gap: 12px; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photos .ph { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; }
.ok-screen { text-align: center; padding: 48px 8px; }
.ok-screen .tick { width: 96px; height: 96px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 3rem; margin: 0 auto 20px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); }

/* ---------- Progreso legible para operarios ---------- */
.prog { display: flex; align-items: center; gap: 0; margin: 8px 0 2px; }
.prog .p { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; font-size: .72rem; color: var(--muted); text-align: center; }
.prog .p::before { content: ''; position: absolute; top: 9px; left: -50%; right: 50%; height: 3px; background: var(--line-2); }
.prog .p:first-child::before { display: none; }
.prog .p b { width: 20px; height: 20px; border-radius: 50%; background: var(--line-2); z-index: 1; display: grid; place-items: center; color: #fff; font-size: .7rem; }
.prog .p.done b, .prog .p.cur b { background: var(--accent); } .prog .p.done::before, .prog .p.cur::before { background: var(--accent); }
.prog .p.cur { color: var(--ink); font-weight: 700; } .prog .p.fin.cur b { background: var(--ok); }

/* ---------- Pedidos ---------- */
.pedido { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px; }
.pedido.rojo { border-left-color: var(--bad); } .pedido.ambar { border-left-color: var(--warn); } .pedido.verde { border-left-color: var(--ok); }
.pedido .head { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(260px, 2.4fr) minmax(140px, .9fr) minmax(160px, 1.1fr) auto; gap: 14px; align-items: center; cursor: pointer; }
.pnum { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.flow { display: flex; align-items: center; }
.flow .f { flex: 1; text-align: center; font-size: .7rem; color: var(--muted); position: relative; padding-top: 22px; min-width: 0; }
.flow .f::before { content: ''; position: absolute; top: 8px; left: 50%; width: 100%; height: 3px; background: var(--line-2); }
.flow .f:last-child::before { display: none; }
.flow .f::after { content: ''; position: absolute; top: 3px; left: 50%; transform: translateX(-50%); width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-2); z-index: 1; }
.flow .f.done::before { background: var(--accent); } .flow .f.done::after { background: var(--accent); border-color: var(--accent); }
.flow .f.cur { color: var(--ink); font-weight: 700; } .flow .f.cur::after { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.flow .f span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pedido .more { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.incrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.incrow:hover { outline: 1px solid var(--accent); }
.phases { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); overflow-x: auto; padding-bottom: 8px; }
.phcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.phcol.over { outline: 2px dashed var(--accent); }
.phcol h3 { font-size: .9rem; display: flex; justify-content: space-between; }
.mini { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line-2); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.mini.rojo { border-left-color: var(--bad); } .mini.ambar { border-left-color: var(--warn); } .mini.verde { border-left-color: var(--ok); }

/* ---------- Incidencias: lista y tablero ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 240px; min-width: 200px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr { cursor: pointer; } table.t tbody tr:hover { background: var(--surface-2); }
table.t.plain tbody tr { cursor: default; }
.ttl { font-weight: 600; } .sub { font-size: .8rem; color: var(--muted); }
.due.bad { color: var(--bad-ink); font-weight: 700; } .due.soon { color: var(--warn-ink); font-weight: 650; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.bcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; min-height: 140px; align-content: start; }
.bcol.over { outline: 2px dashed var(--accent); }
.bcol h3 { font-size: .88rem; display: flex; justify-content: space-between; padding: 2px 4px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: grab; display: grid; gap: 6px; }
.bcard:hover { border-color: var(--accent); } .bcard.crit { border-left: 5px solid var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

/* ---------- Detalle ---------- */
.lifecycle { display: flex; flex-wrap: wrap; gap: 6px; }
.lifecycle button { flex: 1 0 auto; min-height: 40px; padding: 4px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: .82rem; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.lifecycle button.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.lifecycle button.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lifecycle button[disabled] { cursor: default; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fields > * { min-width: 0; }
input[type=date], input[type=datetime-local] { min-width: 0; max-width: 100%; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.sec > h3 { display: flex; align-items: center; gap: 8px; }
.why { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; }
.why b { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .85rem; }
.tl { display: grid; gap: 10px; }
.tl .ev { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.tl .ev .ic { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .85rem; }
.tl .ev.comentario .ic { background: var(--accent-soft); }
.tl .ev.escalado .ic { background: var(--bad-soft); }
.gallery { display: flex; gap: 10px; flex-wrap: wrap; } .gallery img { width: 128px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 16px; } .lightbox img { max-width: 100%; max-height: 100%; }

/* ---------- Análisis ---------- */
.hb { display: grid; gap: 6px; }
.hb .r { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 54px; gap: 10px; align-items: center; font-size: .88rem; }
.hb .r .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hb .r .trk { height: 20px; position: relative; }
.hb .r .bar { height: 20px; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hb .r .bar.tail { background: var(--tail); }
.hb .r .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.hb .r:hover .bar { filter: brightness(1.12); }
.hb .r.withacc { grid-template-columns: minmax(110px, 34%) 1fr 40px 46px; }
.hb .acc { text-align: right; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.tip { position: fixed; z-index: 120; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 10px; font-size: .82rem; max-width: 280px; }
.cardhead { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }

/* ---------- Adaptación a móvil ---------- */
@media (max-width: 980px) {
  .pedido .head { grid-template-columns: 1fr 1fr; } .pedido .head .flow { grid-column: 1 / -1; order: 5; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; z-index: 35; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .nav a { flex-direction: column; gap: 0; font-size: .7rem; padding: 4px 8px; min-height: 52px; flex: 1; justify-content: center; }
  .userchip .nm { display: none; } .userchip { padding: 4px; }
  .fab { bottom: 76px; right: 12px; }
  main { padding-bottom: 150px; }
  .toast-wrap { bottom: 140px; }
  table.t.resp thead { display: none; } table.t.resp tr { display: block; padding: 10px 4px; border-bottom: 1px solid var(--line); } table.t.resp td { display: block; border: 0; padding: 2px 8px; }
  .drawer { width: 100%; }
  .hb .r { grid-template-columns: minmax(90px, 40%) 1fr 48px; }
}
@media print {
  .topbar, .fab, .toolbar, .nav, .no-print, .toast-wrap { display: none !important; }
  body { background: #fff; color: #000; } main { padding: 0; max-width: none; }
  .card, .kpi { break-inside: avoid; box-shadow: none; }
  .print-only { display: block !important; }
  body.printing-qr > *:not(.qrsheet) { display: none !important; }
}
.print-only { display: none; }
.qrsheet { position: fixed; inset: 0; z-index: 90; background: var(--bg); overflow: auto; padding: 16px; }
.qrgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.qrcard { background: #fff; color: #000; border: 2px solid #000; border-radius: 12px; padding: 14px; text-align: center; break-inside: avoid; }
.qrcard svg { width: 100%; max-width: 170px; height: auto; }
.qrcard .code { font-size: 1.6rem; font-weight: 800; } .qrcard .how { font-size: .8rem; margin-top: 4px; }
@media print { .qrsheet { position: static; padding: 0; background: #fff; } .qrsheet .no-print { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
