/* Moviltech web · identidad "Moviltech" (negro #0d0d0d + azul eléctrico #0a5cff, tipografía Manrope).
   Tema oscuro por defecto y tema claro alternativo via <html data-theme="light|dark">. */
:root {
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --accent: #0a5cff;
  --accent-2: #2f79ff;
  --brand-black: #0d0d0d;
  --nav-h: 60px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  /* Oscuro (por defecto) */
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #131720;
  --surface-2: #1b202b;
  --surface-3: #232935;
  --border: #2a3140;
  --border-strong: #3a4356;
  --text: #e9edf4;
  --text-2: #97a1b5;
  --text-3: #7f899d;              /* 5.10:1 sobre --surface, 5.52:1 sobre --bg (antes #6b7588, 3.86:1) */
  --primary: #0a5cff;
  --primary-hover: #2f79ff;
  --primary-soft: rgba(10, 92, 255, .18);
  --primary-text: #6ea0ff;
  --on-primary: #ffffff;
  --danger: #ff5d68;
  --danger-hover: #ff7b84;
  --danger-bg: rgba(255, 93, 104, .16);
  --success: #2fd07a;
  --success-hover: #4ddb8f;
  --success-bg: rgba(47, 208, 122, .16);
  --warning: #ffb828;
  --warning-bg: rgba(255, 184, 40, .16);
  --info: #6ea0ff;
  --info-bg: rgba(10, 92, 255, .2);
  --purple: #b48cff;
  --purple-bg: rgba(180, 140, 255, .16);
  --teal: #3ad1d1;
  --teal-bg: rgba(58, 209, 209, .16);
  --neutral-bg: #2a3140;
  --sidebar: #0d0d0d;
  --sidebar-text: #aab3c5;
  --sidebar-muted: #8a93a6;        /* 6.30:1 sobre #0d0d0d: etiquetas de grupo del menú */
  --sidebar-border: #1f2430;
  --sidebar-hover: #161a23;
  --sidebar-active: var(--accent);
  --input-bg: #0f131a;
  --btn-secondary: #2a3140;
  --btn-secondary-hover: #353d4f;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --focus: 0 0 0 3px rgba(10, 92, 255, .4);
  --row-hover: rgba(10, 92, 255, .1);
  --row-selected: rgba(10, 92, 255, .22);
  --toast-bg: #1b202b;
  --backdrop: rgba(4, 6, 10, .7);
  --viz-series-1: #3d7dff;
  --viz-series-1-hover: #6ea0ff;
  --viz-grid: #232935;
  --viz-axis: #3a4356;
  --viz-muted: #97a1b5;
  --viz-ink: #e9edf4;
  --viz-ink-2: #97a1b5;
  --viz-surface: #131720;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e4e8f0;
  --border: #d7dce6;
  --border-strong: #b9c1d0;
  --text: #0f1420;
  --text-2: #5b6478;
  --text-3: #657085;              /* 4.99:1 sobre blanco, 4.57:1 sobre --bg (antes #8a92a5, 3.12:1) */
  --primary: #0a5cff;
  --primary-hover: #0047d6;
  --primary-soft: rgba(10, 92, 255, .1);
  --primary-text: #0a5cff;
  --on-primary: #ffffff;
  --danger: #ce1a28;              /* blanco encima 5.52:1; sobre la tarjeta activa (#e6efff) 4.77:1 (antes #d81b2a, 4.42:1) */
  --danger-hover: #b01622;
  --danger-bg: #ffe1e3;
  --success: #147a3b;             /* blanco encima 5.42:1; sobre --success-bg 4.70:1 (antes #178a43, 4.42:1) */
  --success-hover: #116532;
  --success-bg: #dcf5e5;
  --warning: #945700;             /* blanco encima 5.80:1; sobre --warning-bg 5.16:1 (antes #b26b00, 3.74:1) */
  --warning-bg: #fff1cc;
  --info: #0357ff;             /* sobre --info-bg 4.52:1 (antes #0a5cff, 4.32:1: etiqueta "Lista" a 12 px) */
  --info-bg: #dfe9ff;
  --purple: #6929c4;
  --purple-bg: #ece3ff;
  --teal: #007d79;
  --teal-bg: #d9fbfb;
  --neutral-bg: #e4e8f0;
  --input-bg: #ffffff;
  --btn-secondary: #3b4457;
  --btn-secondary-hover: #4b5569;
  --shadow: 0 8px 24px rgba(15, 20, 32, .14);
  --shadow-sm: 0 2px 8px rgba(15, 20, 32, .1);
  --focus: 0 0 0 3px rgba(10, 92, 255, .3);
  --row-hover: #eef4ff;
  --row-selected: #dfe9ff;
  --toast-bg: #1b202b;
  --backdrop: rgba(15, 20, 32, .55);
  --viz-series-1: #0a5cff;
  --viz-series-1-hover: #0047d6;
  --viz-grid: #e1e4ec;
  --viz-axis: #c3c8d4;
  --viz-muted: #8a92a5;
  --viz-ink: #0f1420;
  --viz-ink-2: #5b6478;
  --viz-surface: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: var(--primary-text); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 8px; }
img { max-width: 100%; }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); }
.skip-link { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { position: fixed; left: 16px; top: calc(16px + var(--sat)); width: auto; height: auto; padding: 12px 16px; background: var(--surface); color: var(--text); border: 2px solid var(--primary); border-radius: var(--radius); z-index: 2000; box-shadow: var(--shadow); }
.visually-hidden { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
p.help { max-width: 65ch; }
.importe-oculto { letter-spacing: .08em; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ojo-importes { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat .l .ojo-importes .btn { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
@media (min-width: 769px) { .solo-movil { display: none !important; } }
::selection { background: var(--primary-soft); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: 236px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; border-right: 1px solid var(--sidebar-border); }
.sidebar .brand { padding: 16px 16px 14px; font-weight: 800; font-size: 16px; color: #fff; border-bottom: 1px solid var(--sidebar-border); display: flex; align-items: center; gap: 10px; letter-spacing: .01em; }
.sidebar .brand img { height: 36px; width: 36px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.sidebar .brand small { display: block; font-weight: 600; font-size: 12px; color: var(--accent-2); letter-spacing: .04em; margin-top: 1px; }
.sidebar nav { flex: 1; padding: 8px 0; }
.sidebar ul.items { list-style: none; margin: 0; padding: 0; }
.sidebar .group { padding: 12px 16px 4px; font-size: 12px; letter-spacing: .02em; color: var(--sidebar-muted); font-weight: 700; }   /* M-42 ≥ 12 px; M-44 sin mayúsculas sostenidas */
.sidebar a.item { display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 13px; margin: 1px 8px; color: var(--sidebar-text); border-left: 3px solid transparent; border-radius: 8px; font-weight: 500; }
.sidebar a.item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar a.item.active { background: rgba(10, 92, 255, .16); color: #fff; border-left-color: var(--sidebar-active); }
.sidebar a.item .ico { width: 20px; display: inline-flex; justify-content: center; opacity: .9; }
.sidebar a.item .ico .icono { width: 18px; height: 18px; }
.sidebar .user { padding: 12px 16px; border-top: 1px solid var(--sidebar-border); font-size: 12px; }
.sidebar .user b { color: #fff; display: block; }
.sidebar .user .acciones-user { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sidebar .btn.secondary { background: #1f2430; }
.sidebar .btn.secondary:hover { background: #2a3140; }
.sidebar .cerrar-drawer { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 5; min-height: 54px; }
.topbar .title { margin: 0; font-weight: 700; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* es el h1 de la pantalla (D-63) */
.topbar .badge { font-size: 12px; }
.topbar .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; padding: 0; }
.topbar .icon-btn:hover { border-color: var(--border-strong); }
.topbar .icon-btn svg { width: 18px; height: 18px; }
.content { padding: 20px; flex: 1; }
.menu-toggle { display: none; }
.drawer-backdrop { display: none; }
.bottom-nav { display: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.tight { padding: 10px 12px; }
.card-title { font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-title .spacer, .spacer { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--text-2); }

/* ---------- Formularios ---------- */
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); min-height: 38px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
input[type="file"] { min-height: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
input[readonly] { background: var(--surface-2); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
textarea { min-height: 70px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2397a1b5' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; }
.help { font-size: 12px; color: var(--text-2); }

/* ---------- Botones ---------- */
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; min-height: 38px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); cursor: pointer; white-space: nowrap; transition: background .12s, box-shadow .12s, transform .05s; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--btn-secondary); color: #fff; }
.btn.secondary:hover { background: var(--btn-secondary-hover); }
.btn.ghost { background: transparent; color: var(--primary-text); border-color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { background: var(--danger); color: #2a0608; }   /* tema oscuro: texto oscuro sobre #ff5d68 (6.22:1); blanco daba 2.99:1 */
:root[data-theme="light"] .btn.danger { color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.success { background: var(--success); color: #062b14; }
.btn.success:hover { background: var(--success-hover); }
:root[data-theme="light"] .btn.success { color: #fff; }
.btn.warning { background: var(--warning); color: #2b1d00; }
.btn.sm { padding: 4px 9px; font-size: 12px; min-height: 30px; }
.btn.lg { padding: 12px 20px; font-size: 16px; min-height: 48px; }
.btn.block { width: 100%; justify-content: center; }
.btn.icon { padding: 0; width: 38px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn.sm svg { width: 15px; height: 15px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.tbl th { background: var(--surface-2); font-weight: 700; position: sticky; top: 0; white-space: nowrap; cursor: pointer; user-select: none; font-size: 12px; color: var(--text-2); z-index: 1; }
table.tbl tbody tr:hover { background: var(--row-hover); }
table.tbl tbody tr.selected { background: var(--row-selected); }
table.tbl tr.clickable { cursor: pointer; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl.dense th, table.tbl.dense td { padding: 5px 8px; }
.tbl-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--surface); border-top: 1px solid var(--border); }
.empty { padding: 30px; text-align: center; color: var(--text-2); }

/* ---------- Etiquetas de estado ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--neutral-bg); color: var(--text); white-space: nowrap; line-height: 1.5; }
.tag.Pendiente { background: var(--warning-bg); color: var(--warning); }
.tag.Listo { background: var(--info-bg); color: var(--info); }
.tag.Entregado { background: var(--success-bg); color: var(--success); }
.tag.Vencido { background: var(--danger-bg); color: var(--danger); }
.tag.Cancelado { background: var(--neutral-bg); color: var(--text-2); text-decoration: line-through; }
.tag.Pagado { background: var(--success-bg); color: var(--success); }
.tag.Exitoso { background: var(--success-bg); color: var(--success); }
.tag.Fallido { background: var(--danger-bg); color: var(--danger); }
.tag.Sin_Concluir { background: var(--neutral-bg); color: var(--text-2); }
.tag.Abierto { background: var(--info-bg); color: var(--info); }
.tag.Cerrado { background: var(--neutral-bg); color: var(--text-2); }
.tag.Activo { background: var(--success-bg); color: var(--success); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding: 40px 12px; z-index: 50; overflow: auto; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 640px; }
.modal.lg { max-width: 960px; }
.modal.xl { max-width: 1200px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.modal-head .close { margin-left: auto; background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-2); width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }
.modal-head .close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--toast-bg); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 240px; max-width: 360px; border-left: 4px solid var(--accent); font-weight: 500; white-space: pre-line; }
.toast.error { border-left-color: #ff5d68; }
.toast.success { border-left-color: #2fd07a; }
.toast.warning { border-left-color: #ffb828; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); background: var(--brand-black); background-image: radial-gradient(ellipse 70% 55% at 50% -10%, rgba(10, 92, 255, .38), transparent 60%), radial-gradient(ellipse 50% 40% at 85% 110%, rgba(10, 92, 255, .18), transparent 60%), linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: auto, auto, 28px 28px, 28px 28px; }
.login .box { background: #12151c; color: #e9edf4; padding: 30px 28px 26px; border-radius: 18px; width: 100%; max-width: 400px; border: 1px solid #262b36; box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(10, 92, 255, .12); }
.login .box input { background: #0f131a; border-color: #2a3140; color: #e9edf4; min-height: 46px; }
.login .box label.field > span { color: #97a1b5; }
.login .marca { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; }
.login .marca img { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; box-shadow: 0 8px 26px rgba(10, 92, 255, .35); }
.login .marca img.taller { border-radius: 12px; object-fit: contain; background: #fff; padding: 4px; }
.login .marca h1 { margin: 6px 0 0; font-size: 24px; font-weight: 800; letter-spacing: .02em; text-align: center; color: #fff; }
.login .marca h1 small { display: block; font-size: 13px; font-weight: 500; color: #97a1b5; letter-spacing: 0; margin-top: 2px; }
.login .marca .sub { font-size: 12px; letter-spacing: .08em; color: var(--accent-2); font-weight: 600; }
.login .box .btn { margin-top: 6px; }
.login .pie { text-align: center; margin-top: 16px; font-size: 12px; color: #8a93a6; }   /* 6.3:1 sobre el fondo del inicio de sesión */
.error-msg { color: var(--danger); font-size: 13px; margin: 6px 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 500; background: none; border: none; padding: 9px 14px; min-height: 44px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: 700; }

/* ---------- Utilidades ---------- */
.kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; background: var(--surface-2); color: var(--text-2); }
.money { font-variant-numeric: tabular-nums; }
.big-total { font-size: 34px; font-weight: 800; text-align: right; letter-spacing: -.02em; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.img-preview { max-width: 100%; max-height: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.split { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-list .pill, .notas-lista .pill { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 12px; font-weight: 500; user-select: none; }
.pill-list .pill.on, .notas-lista .pill.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.chip-scroll::-webkit-scrollbar { display: none; }

/* Input con botón de cámara (escáner) */
.input-scan { display: flex; gap: 6px; align-items: stretch; }
.input-scan > input { flex: 1; min-width: 0; }
.input-scan > .btn { flex-shrink: 0; padding: 0 10px; }

/* Escáner de cámara */
.scan-view { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-view .marco { position: absolute; inset: 14% 12%; border: 2px solid rgba(255, 255, 255, .55); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.scan-view .marco::before { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); animation: scanline 1.8s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-60px); opacity: .4; } 50% { transform: translateY(60px); opacity: 1; } }
.scan-view .estado { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; text-align: center; }
.scan-manual { margin-top: 10px; }

/* Estado Bluetooth */
.bt-estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--neutral-bg); color: var(--text-2); }
.bt-estado.on { background: var(--info-bg); color: var(--info); }
.bt-estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Impresión (tickets en la misma página) ---------- */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ---------- Escritorio angosto ---------- */
@media (max-width: 1000px) {
  .sidebar { width: 208px; }
  .content { padding: 14px; }
}

/* ======================================================================
   MÓVIL (≤ 768 px): barra inferior, cajón "Más", modales a pantalla completa,
   inputs de 44 px y safe areas de iOS.
   ====================================================================== */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .solo-escritorio { display: none !important; }
  .app { flex-direction: column; }
  .main { padding-bottom: calc(var(--nav-h) + var(--sab)); }
  .topbar { padding: calc(8px + var(--sat)) calc(12px + var(--sar)) 8px calc(12px + var(--sal)); min-height: calc(54px + var(--sat)); }
  .topbar .title { font-size: 17px; }
  .ord-stats .stat .l { font-size: 12px; }
  .topbar .badge { display: none; }
  .content { padding: 12px calc(12px + var(--sar)) 16px calc(12px + var(--sal)); }
  .card { padding: 12px; margin-bottom: 12px; border-radius: 12px; }

  /* Sidebar → cajón lateral derecho ("Más") */
  .sidebar { position: fixed; top: 0; right: 0; bottom: 0; left: auto; height: 100%; width: min(320px, 86vw); transform: translateX(105%); transition: transform .22s ease; z-index: 60; box-shadow: none; padding-top: var(--sat); padding-bottom: var(--sab); border-right: 0; border-left: 1px solid var(--sidebar-border); }
  .sidebar.open { transform: translateX(0); box-shadow: -12px 0 40px rgba(0, 0, 0, .5); }
  .sidebar .cerrar-drawer { display: inline-flex; margin-left: auto; background: none; border: 0; color: #fff; font-size: 24px; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; align-items: center; justify-content: center; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; background: var(--backdrop); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
  .sidebar a.item { padding: 12px 14px; min-height: 46px; }

  /* Barra de navegación inferior */
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--sab)); padding: 0 var(--sar) var(--sab) var(--sal); background: var(--sidebar); border-top: 1px solid var(--sidebar-border); z-index: 40; }
  .bottom-nav.n3 { grid-template-columns: repeat(3, 1fr); }
  .bottom-nav.n4 { grid-template-columns: repeat(4, 1fr); }
  .bottom-nav a, .bottom-nav button { font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8a93a6; background: none; border: 0; padding: 6px 2px; font-size: 12px; font-weight: 600; letter-spacing: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; position: relative; }
  .bottom-nav svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav a.active, .bottom-nav button.active { color: #fff; }
  .bottom-nav a.active::after { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; transform: translateX(-50%); background: var(--accent); border-radius: 0 0 3px 3px; }
  .bottom-nav .nueva svg { width: 30px; height: 30px; color: var(--accent-2); }
  .bottom-nav .lbl-corto { display: none; }   /* etiqueta completa (D-20); la corta solo donde no cabe a 12 px */
  @media (max-width: 379px) { .bottom-nav .lbl-largo { display: none; } .bottom-nav .lbl-corto { display: inline; } }
  .bottom-nav .nueva.active svg { color: #fff; }

  /* Controles táctiles */
  input, select, textarea { min-height: 44px; padding: 10px 12px; font-size: 16px; }
  textarea { min-height: 80px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 20px; height: 20px; }
  .btn { min-height: 44px; padding: 10px 14px; font-size: 15px; }
  .btn.sm { min-height: 44px; min-width: 44px; padding: 6px 12px; font-size: 14px; }   /* en celular no hay botones chicos (D-33) */
  .topbar .icon-btn { width: 44px; height: 44px; }
  .check { min-height: 44px; margin-bottom: 4px; }
  .check input[type=checkbox], .check input[type=radio] { width: 20px; height: 20px; }
  .btn.lg { min-height: 52px; }
  .btn.icon { width: 44px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: 11px 12px; }
  .toolbar { gap: 6px; }
  .stat { padding: 10px 12px; }
  .stat .v { font-size: 20px; }

  /* Tablas: scroll horizontal y columnas no esenciales ocultas */
  .table-wrap { border-radius: 10px; }
  table.tbl th.hm, table.tbl td.hm { display: none; }
  table.tbl th, table.tbl td { padding: 9px 8px; }

  /* Modales a pantalla completa; los .sm como hoja inferior */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { max-width: none !important; width: 100%; min-height: 100%; min-height: 100dvh; border-radius: 0; border: 0; display: flex; flex-direction: column; }
  .modal-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: calc(10px + var(--sat)) 14px 10px; min-height: calc(52px + var(--sat)); }
  .modal-head .close { width: 44px; height: 44px; }
  .modal-body { flex: 1; padding: 14px; padding-bottom: 20px; }
  .modal-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding: 10px 14px calc(10px + var(--sab)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .help { display: none; }
  .modal-backdrop:has(> .modal.sm) { align-items: flex-end; }
  .modal.sm { min-height: 0; max-height: 92dvh; border-radius: 18px 18px 0 0; border: 1px solid var(--border); border-bottom: 0; overflow: auto; }
  .modal.sm .modal-head { padding-top: 12px; min-height: 0; }
  .modal.sm .modal-foot { padding-bottom: calc(12px + var(--sab)); }

  /* Toasts arriba para no tapar la barra inferior ni el teclado */
  .toasts { left: 12px; right: 12px; bottom: auto; top: calc(10px + var(--sat)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }

  .split { gap: 12px; }
  .big-total { font-size: 28px; }
  .login .box { padding: 26px 20px 22px; }
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Configuración > Formulario de nueva orden */
.cfg-campo { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cfg-campo:last-child { border-bottom: 0; }
.cfg-campo input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.cfg-campo.fija { cursor: default; opacity: .75; }
.cfg-campo.off .cfg-nombre { color: var(--text-2); text-decoration: line-through; }

/* Las columnas de .split y .grid pueden encogerse: el contenido ancho (tablas) hace scroll dentro de su recuadro */
.split > *, .grid > * { min-width: 0; }

/* ---------- Autocompletar propio (public/app/autocompletar.js) ---------- */
.ac { position: relative; }
.ac input { width: 100%; }
.ac.abierto input { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ac-lista { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--primary); border-top: 0; border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .28); padding: 4px 0; }
.ac-grupo { position: sticky; top: -4px; z-index: 1; padding: 6px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface); }
.ac-op { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; min-height: 40px; }
.ac-op.activa { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.ac-valor { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.ac-valor mark { background: none; color: var(--primary); font-weight: 700; padding: 0; }
.ac-info { flex: none; font-size: 11px; color: var(--text-2); }
.ac-usos { flex: none; font-size: 11px; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.ac-muestra { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.ac-muestra.vacia { background: repeating-linear-gradient(45deg, #ccc 0 3px, #fff 3px 6px); }
.ac-nuevo { padding: 8px 12px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); cursor: pointer; }
@media (max-width: 768px) { .ac-lista { max-height: 45vh; } .ac-op { min-height: 46px; } }

/* ---------- Captura en MAYÚSCULAS (el servidor también las guarda así) ----------
   body.mayus se activa fuera de Configuración del sistema; .no-mayus exceptúa códigos, correos, web, PIN y usuarios. */
body.mayus .content input:not([type]):not(.no-mayus), body.mayus .content input[type="text"]:not(.no-mayus), body.mayus .content input[type="search"]:not(.no-mayus),
body.mayus .content textarea:not(.no-mayus), body.mayus .modal input:not([type]):not(.no-mayus), body.mayus .modal input[type="text"]:not(.no-mayus),
body.mayus .modal textarea:not(.no-mayus) { text-transform: uppercase; }
body.mayus .content input::placeholder, body.mayus .content textarea::placeholder, body.mayus .modal input::placeholder, body.mayus .modal textarea::placeholder { text-transform: none; }

/* Celular con teclado abierto: sin barras fijas inferiores; el campo enfocado queda bajo la barra superior */
@media (max-width: 768px) {
  body.teclado .bottom-nav, body.teclado .barra-fija { display: none !important; }
  .ac input { scroll-margin-top: 72px; }
  .ac-lista { border-radius: 0 0 14px 14px; }
  .ac-op { font-size: 15px; }
}


/* Menú de acciones (ui.js Menu): desplegable en escritorio, hoja inferior en celular */
.menu-capa { position: fixed; inset: 0; z-index: 80; }
.menu-pop { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; max-height: 70vh; overflow-y: auto; }
.menu-titulo { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px 6px; }
.menu-item { font: inherit; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; min-height: 40px; color: var(--text); cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item .icono { width: 20px; height: 20px; color: var(--text-2); }
.menu-item.peligro .icono { color: inherit; }
.menu-item .sub { display: block; font-size: 12px; color: var(--text-2); }
.menu-item.peligro { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-cancelar { font: inherit; font-weight: 600; margin-top: 6px; min-height: 48px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.btn.activo { box-shadow: var(--focus); }
@media (max-width: 768px) {
  .menu-capa { background: var(--backdrop); }
  .menu-pop { left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; width: auto !important; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 8px 12px calc(12px + var(--sab)); max-height: 85dvh; animation: menu-sube .18s ease-out; }
  .menu-pop::before { content: ""; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 2px 0 6px; }
  .menu-titulo { text-align: center; font-size: 13px; }
  .menu-item { min-height: 52px; font-size: 16px; padding: 10px 12px; }
}
@keyframes menu-sube { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .menu-pop { animation: none !important; } }

/* Iconos (iconos.js, Lucide): escalan con la letra y toman el color del texto */
.icono { flex-shrink: 0; vertical-align: -0.18em; }
.btn .icono { width: 1.15em; height: 1.15em; }
.btn .icono.flecha { width: .95em; height: .95em; margin-left: -2px; opacity: .8; }

/* Configuración > Seguridad */
.seg-admin .card { margin-bottom: 14px; }
.seg-admin .card-title { display: flex; align-items: center; gap: 8px; }
.seg-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.seg-item:first-of-type { border-top: 0; }
.seg-info { flex: 1; min-width: 0; }
.seg-detalle { word-break: break-all; font-size: 13px; }
.seg-acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.seg-codigo { max-width: 460px; }
.seg-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.seg-form .field { flex: 1 1 180px; margin: 0; }
@media (max-width: 768px) {
  .seg-item { flex-direction: column; align-items: stretch; }
  .seg-acciones { justify-content: stretch; }
  .seg-acciones .btn, .seg-form .btn { flex: 1 1 auto; min-height: 44px; }
}

/* Cambiar contraseña (views/CambiarPassword.js), sobre el estilo de .login */
.cambiar-pass .marca img { width: 64px; height: 64px; }
.cambiar-pass .marca .sub { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: #c5cbd6; text-align: center; line-height: 1.45; }
.cambiar-pass .ver-pass { margin: 2px 0 8px; color: #6ea0ff; border-color: transparent; padding-left: 0; }
.reglas-pass { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 13px; color: #97a1b5; }
.reglas-pass li { display: flex; align-items: center; gap: 6px; }
.reglas-pass li .icono { color: #ff5d68; }
.reglas-pass li.ok { color: #c5cbd6; }
.reglas-pass li.ok .icono { color: #2fd07a; }

/* Configuración > Usuarios: contraseña temporal y restablecer */
.pass-temporal { display: grid; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 10px 0; }
.pass-temporal > div { display: flex; flex-direction: column; gap: 2px; }
.pass-temporal b { font-size: 18px; word-break: break-all; }
.pass-temporal b.pass { font-family: var(--mono); font-size: 24px; letter-spacing: .08em; user-select: all; }
.pass-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.pass-acciones .btn { flex: 1 1 auto; }
.pass-restablecer { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }

/* Configuración > Impresión: calibración de la impresora de esta computadora */
.calib { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.calib-titulo { font-weight: 700; margin-bottom: 6px; }
.calib-campos { display: flex; gap: 10px; flex-wrap: wrap; }
.calib-campos .field { flex: 1 1 160px; }

/* Configuración > Instalar impresora */
.guia-imp .card { margin-bottom: 14px; }
.guia-imp .card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guia-paso { display: flex; gap: 14px; align-items: flex-start; }
.guia-paso .paso-num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.guia-paso .paso-cuerpo { flex: 1; min-width: 0; }
.guia-paso ol, .guia-problemas { margin: 10px 0 6px; padding-left: 20px; display: grid; gap: 4px; }
.guia-img { display: block; max-width: 100%; width: 480px; height: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; }
.aviso-guia { background: var(--warning-bg); color: var(--text); border: 1px solid var(--warning); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
@media (max-width: 768px) {
  .guia-paso { flex-direction: column; align-items: stretch; gap: 8px; }
  .guia-paso .row .btn { width: 100%; white-space: normal; text-align: center; justify-content: center; }
}

/* Paginador de listados grandes (ui.js Paginador / DataTable modo servidor) */
.paginador { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }
.paginador .pag-info { color: var(--text-2); font-size: 13px; }
.paginador .pag-botones { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.paginador .pag-actual { font-size: 13px; font-weight: 600; padding: 0 4px; white-space: nowrap; }
.paginador-tarjetas { margin: 10px 0 4px; }
@media (max-width: 768px) {
  .paginador { justify-content: center; }
  .paginador .pag-info { width: 100%; text-align: center; }
  .paginador .pag-botones { margin: 0 auto; }
  .paginador .btn.sm { min-width: 44px; min-height: 44px; font-size: 18px; }
}

/* Impresión directa (Configuración > Instalar impresora, paso 5) */
.estado-directa { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.estado-directa .punto, .lista-agentes .punto { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.punto.ok { background: var(--success); }
.punto.no { background: var(--text-3); }
.check-directa { display: flex; align-items: center; gap: 8px; margin-top: 12px; cursor: pointer; min-height: 44px; }
.lista-agentes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.lista-agentes li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
