/* =====================================================================
   Listo System — Sistema de diseño
   Colores, tipografía, layout y componentes reutilizables.
   ===================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../assets/vendor/inter/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Marca */
  --fe-navy-900: #0b1629;
  --fe-navy-800: #102039;
  --fe-navy-700: #182d4d;
  --fe-navy-600: #233c63;
  --fe-blue-600: #1f5fbf;
  --fe-blue-500: #2b6fd6;
  --fe-blue-100: #e3edfb;
  --fe-blue-50:  #f1f6fd;

  /* Estados */
  --fe-green: #188a5b;   --fe-green-bg: #e3f5ec;
  --fe-orange: #c46a00;  --fe-orange-bg: #fdf0dc;
  --fe-red: #c83a3a;     --fe-red-bg: #fbe6e6;
  --fe-violet: #6a4bc4;  --fe-violet-bg: #efe9fb;
  --fe-gray-bg: #eef1f5;

  /* Superficies y texto */
  --fe-bg: #f4f6fa;
  --fe-surface: #ffffff;
  --fe-border: #e3e8ef;
  --fe-border-strong: #cfd7e3;
  --fe-text: #17233a;
  --fe-text-2: #4b5870;
  --fe-text-muted: #7c879b;

  --fe-radius: 12px;
  --fe-radius-sm: 8px;
  --fe-shadow: 0 1px 2px rgba(16, 32, 57, .05), 0 1px 3px rgba(16, 32, 57, .06);
  --fe-shadow-lg: 0 10px 30px rgba(16, 32, 57, .12);
  --fe-sidebar-w: 260px;
  --fe-topbar-h: 64px;

  /* Bootstrap overrides */
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--fe-text);
  --bs-body-bg: var(--fe-bg);
  --bs-primary: var(--fe-blue-600);
  --bs-primary-rgb: 31, 95, 191;
  --bs-border-color: var(--fe-border);
  --bs-link-color: var(--fe-blue-600);
  --bs-link-color-rgb: 31, 95, 191;
}

html, body { height: 100%; }
body {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

/* ---------- Botones ---------- */
.btn { border-radius: var(--fe-radius-sm); font-weight: 500; font-size: 14px; }
.btn-primary { --bs-btn-bg: var(--fe-blue-600); --bs-btn-border-color: var(--fe-blue-600);
  --bs-btn-hover-bg: #1a52a6; --bs-btn-hover-border-color: #1a52a6;
  --bs-btn-active-bg: #164890; --bs-btn-disabled-bg: var(--fe-blue-600); --bs-btn-disabled-border-color: var(--fe-blue-600); }
.btn-success { --bs-btn-bg: var(--fe-green); --bs-btn-border-color: var(--fe-green);
  --bs-btn-hover-bg: #13744c; --bs-btn-hover-border-color: #13744c; }
.btn-light { --bs-btn-bg: var(--fe-surface); --bs-btn-border-color: var(--fe-border-strong);
  --bs-btn-hover-bg: var(--fe-blue-50); --bs-btn-hover-border-color: var(--fe-border-strong); color: var(--fe-text); }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; }
.form-control, .form-select { border-radius: var(--fe-radius-sm); border-color: var(--fe-border-strong); font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--fe-blue-500); box-shadow: 0 0 0 3px rgba(43,111,214,.15); }
.form-label { font-weight: 500; font-size: 13px; color: var(--fe-text-2); margin-bottom: 4px; }
.form-text { font-size: 12px; }

/* ---------- Layout ---------- */
.fe-app { display: flex; min-height: 100vh; }

.fe-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--fe-sidebar-w);
  background: var(--fe-navy-900); color: #c9d4e6; display: flex; flex-direction: column;
  z-index: 1040; transition: transform .2s ease;
}
.fe-brand-row { display: flex; align-items: center; height: var(--fe-topbar-h); border-bottom: 1px solid rgba(255,255,255,.06); }
.fe-brand { display: flex; align-items: center; gap: 12px; padding: 18px 4px 18px 20px; height: 100%; flex: 1; min-width: 0; text-decoration: none; }
.fe-nav-search-btn { flex: none; width: 36px; height: 36px; margin-right: 12px; border: 0; border-radius: 9px; background: rgba(255,255,255,.06); color: #c9d4e6; font-size: 15px; }
.fe-nav-search-btn:hover, .fe-nav-search-btn.on { background: var(--fe-blue-600); color: #fff; }
.fe-nav-search { position: relative; padding: 10px 12px 2px; }
.fe-nav-search .bi { position: absolute; left: 24px; top: 50%; transform: translateY(-35%); color: #7f93b5; font-size: 13px; pointer-events: none; }
.fe-nav-search input { width: 100%; background: var(--fe-navy-800); border: 1px solid var(--fe-navy-600); color: #fff; border-radius: 9px; padding: 8px 10px 8px 34px; font-size: 13.5px; outline: none; }
.fe-nav-search input:focus { border-color: var(--fe-blue-600); }
.fe-nav-search input::placeholder { color: #7084a6; }
.fe-nav-empty { padding: 14px 10px; font-size: 12.5px; color: #7f93b5; }
.fe-nav.filtering .fe-nav-group.collapsed .fe-nav-items { display: block; }
.fe-nav-link.first-hit { outline: 1px solid var(--fe-blue-600); }
.fe-brand-logo { width: 38px; height: 38px; border-radius: 10px; flex: none; object-fit: contain; }
.fe-brand-name { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .4px; line-height: 1.1; }
.fe-brand-sub { color: #7f93b5; font-size: 10.5px; font-weight: 500; line-height: 1.25; margin-top: 2px; }

.fe-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; scrollbar-width: thin; scrollbar-color: #2a3c5c transparent; }
.fe-nav-group { margin-top: 10px; }
.fe-nav-group-title { display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; color: #7084a6; font-size: 11px; font-weight: 600; letter-spacing: .8px;
  padding: 8px 10px 6px; text-transform: uppercase; cursor: pointer; }
.fe-nav-group-title .bi { transition: transform .15s; font-size: 10px; }
.fe-nav-group.collapsed .fe-nav-group-title .bi { transform: rotate(-90deg); }
.fe-nav-group.collapsed .fe-nav-items { display: none; }
.fe-nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0;
  color: #c3cee0; text-decoration: none; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.fe-nav-link .bi { font-size: 16px; width: 18px; text-align: center; color: #8ea2c3; }
.fe-nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.fe-nav-link.active { background: var(--fe-blue-600); color: #fff; }
.fe-nav-link.active .bi { color: #fff; }
.fe-nav-badge { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
  background: rgba(255,255,255,.1); color: #dce5f3; }
.fe-nav-link.active .fe-nav-badge { background: rgba(255,255,255,.25); }
.fe-nav-badge.warn { background: #c46a00; color: #fff; }

.fe-sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; color: #7084a6; }

.fe-main { flex: 1; margin-left: var(--fe-sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.fe-demo-bar { background: #fff4e0; color: #8a4b00; border-bottom: 1px solid #f3dcb3; font-size: 12.5px;
  padding: 6px 24px; display: flex; align-items: center; gap: 8px; }

.fe-topbar { position: sticky; top: 0; z-index: 1030; height: var(--fe-topbar-h); background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--fe-border); display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.fe-search { position: relative; flex: 1; max-width: 520px; }
.fe-search .bi-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fe-text-muted); }
.fe-search input { padding-left: 36px; background: var(--fe-bg); border-color: transparent; height: 40px; }
.fe-search input:focus { background: #fff; }
.fe-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #fff; color: var(--fe-text-muted);
  border: 1px solid var(--fe-border-strong); font-size: 11px; padding: 1px 6px; box-shadow: none; }
.fe-search-results { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--fe-border);
  border-radius: var(--fe-radius); box-shadow: var(--fe-shadow-lg); max-height: 420px; overflow-y: auto; display: none; z-index: 1050; }
.fe-search-results.show { display: block; }
.fe-search-section { padding: 8px 14px 4px; font-size: 11px; font-weight: 600; color: var(--fe-text-muted); text-transform: uppercase; letter-spacing: .6px; }
.fe-search-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--fe-text); text-decoration: none; cursor: pointer; }
.fe-search-item:hover, .fe-search-item.focused { background: var(--fe-blue-50); }
.fe-search-item .bi { color: var(--fe-text-muted); }
.fe-search-item small { color: var(--fe-text-muted); margin-left: auto; white-space: nowrap; }

.fe-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.fe-rate-chip { font-size: 12px; color: var(--fe-text-2); background: var(--fe-bg); border-radius: 20px; padding: 6px 12px; white-space: nowrap; }
.fe-user { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 8px; border-radius: 10px; }
.fe-user:hover { background: var(--fe-bg); }
.fe-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--fe-blue-100); color: var(--fe-blue-600);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.fe-user-name { font-weight: 600; font-size: 13px; line-height: 1.1; text-align: left; }
.fe-user-role { font-size: 11.5px; color: var(--fe-text-muted); text-align: left; }

.fe-content { padding: 24px; flex: 1; }
.fe-content-inner { max-width: 1480px; margin: 0 auto; }

/* ---------- Encabezado de página ---------- */
.fe-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.fe-breadcrumb { font-size: 12px; color: var(--fe-text-muted); margin-bottom: 4px; }
.fe-page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.3px; }
.fe-page-sub { color: var(--fe-text-2); margin: 4px 0 0; font-size: 13.5px; }
.fe-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tarjetas ---------- */
.fe-card { background: var(--fe-surface); border: 1px solid var(--fe-border); border-radius: var(--fe-radius); box-shadow: var(--fe-shadow); }
.fe-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.fe-card-title { font-size: 15px; font-weight: 600; margin: 0; }
.fe-card-sub { font-size: 12.5px; color: var(--fe-text-muted); margin: 2px 0 0; }
.fe-card-body { padding: 16px 18px 18px; }

.fe-section-title { font-size: 12px; font-weight: 600; color: var(--fe-text-muted); text-transform: uppercase; letter-spacing: .7px; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.fe-section-title::after { content: ""; flex: 1; height: 1px; background: var(--fe-border); }

/* KPI */
.fe-kpi { padding: 16px 18px; height: 100%; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.fe-kpi:hover { border-color: var(--fe-border-strong); box-shadow: var(--fe-shadow-lg); color: inherit; }
.fe-kpi-top { display: flex; align-items: center; justify-content: space-between; }
.fe-kpi-label { font-size: 12.5px; color: var(--fe-text-2); font-weight: 500; }
.fe-kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.fe-kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-kpi-foot { font-size: 12px; color: var(--fe-text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fe-delta { font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.fe-delta.up { color: var(--fe-green); }
.fe-delta.down { color: var(--fe-red); }

.tone-blue   { background: var(--fe-blue-100); color: var(--fe-blue-600); }
.tone-green  { background: var(--fe-green-bg); color: var(--fe-green); }
.tone-orange { background: var(--fe-orange-bg); color: var(--fe-orange); }
.tone-red    { background: var(--fe-red-bg); color: var(--fe-red); }
.tone-violet { background: var(--fe-violet-bg); color: var(--fe-violet); }
.tone-gray   { background: var(--fe-gray-bg); color: var(--fe-text-2); }

/* Accesos rápidos */
.fe-quick { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
.fe-quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px 8px;
  background: var(--fe-surface); border: 1px solid var(--fe-border); border-radius: var(--fe-radius); color: var(--fe-text);
  font-weight: 500; font-size: 13px; text-align: center; box-shadow: var(--fe-shadow); transition: all .15s; cursor: pointer; }
.fe-quick-btn .fe-kpi-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 11px; }
.fe-quick-btn:hover { border-color: var(--fe-blue-500); transform: translateY(-1px); box-shadow: var(--fe-shadow-lg); }
.fe-quick-btn.primary { background: var(--fe-blue-600); color: #fff; border-color: var(--fe-blue-600); }
.fe-quick-btn.primary .fe-kpi-icon { background: rgba(255,255,255,.18); color: #fff; }

/* Segmentado (filtro de período) */
.fe-segment { display: inline-flex; background: var(--fe-surface); border: 1px solid var(--fe-border-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.fe-segment button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--fe-text-2); }
.fe-segment button.active { background: var(--fe-blue-600); color: #fff; }

/* ---------- Tablas ---------- */
.fe-table-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--fe-border); }
.fe-table-toolbar .fe-table-search { position: relative; min-width: 240px; flex: 1; max-width: 360px; }
.fe-table-toolbar .fe-table-search .bi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--fe-text-muted); }
.fe-table-toolbar .fe-table-search input { padding-left: 32px; }
.fe-table-toolbar .form-select { width: auto; min-width: 150px; }
.fe-table-wrap { overflow-x: auto; }
.fe-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.fe-table th { font-size: 12px; font-weight: 600; color: var(--fe-text-muted); text-transform: uppercase; letter-spacing: .4px;
  background: #f8fafc; padding: 10px 14px; border-bottom: 1px solid var(--fe-border); white-space: nowrap; user-select: none; }
.fe-table th.sortable { cursor: pointer; }
.fe-table th.sortable:hover { color: var(--fe-text); }
.fe-table th .bi { font-size: 10px; margin-left: 3px; }
.fe-table td { padding: 11px 14px; border-bottom: 1px solid var(--fe-border); vertical-align: middle; }
.fe-table tbody tr:last-child td { border-bottom: 0; }
.fe-table tbody tr.clickable { cursor: pointer; }
.fe-table tbody tr:hover td { background: #fafbfd; }
.fe-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fe-table .muted { color: var(--fe-text-muted); font-size: 12.5px; }
.fe-table-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--fe-border); font-size: 13px; color: var(--fe-text-2); flex-wrap: wrap; gap: 10px; }
.fe-pager { display: flex; gap: 4px; }
.fe-pager button { min-width: 32px; height: 32px; border: 1px solid var(--fe-border-strong); background: #fff; border-radius: 7px; font-size: 13px; }
.fe-pager button.active { background: var(--fe-blue-600); border-color: var(--fe-blue-600); color: #fff; }
.fe-pager button:disabled { opacity: .45; }

.fe-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.fe-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.fe-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--fe-text-2); }
.fe-strong { font-weight: 600; }

/* ---------- Estados vacíos / planificado ---------- */
.fe-empty { text-align: center; padding: 48px 20px; color: var(--fe-text-2); }
.fe-empty-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 28px; }
.fe-empty h3 { font-size: 17px; font-weight: 600; color: var(--fe-text); margin-bottom: 6px; }
.fe-empty p { max-width: 520px; margin: 0 auto; }
.fe-planned-list { list-style: none; padding: 0; margin: 20px auto 0; max-width: 620px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.fe-planned-list li { background: var(--fe-bg); border-radius: 8px; padding: 8px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.fe-planned-list .bi { color: var(--fe-blue-600); }

/* ---------- Tablero (kanban) ---------- */
.fe-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.fe-col { background: #eef1f6; border-radius: var(--fe-radius); padding: 10px; min-height: 200px; }
.fe-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 600; font-size: 13px; }
.fe-col-count { background: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; color: var(--fe-text-2); }
.fe-tcard { background: #fff; border: 1px solid var(--fe-border); border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: var(--fe-shadow); cursor: pointer; }
.fe-tcard:hover { border-color: var(--fe-blue-500); }
.fe-tcard-title { font-weight: 600; font-size: 13.5px; margin: 4px 0; }
.fe-tcard-meta { font-size: 12px; color: var(--fe-text-muted); display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- POS ---------- */
.fe-pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.fe-pos-scan { position: relative; }
.fe-pos-scan input { height: 52px; font-size: 16px; padding-left: 46px; border-width: 2px; }
.fe-pos-scan .bi { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--fe-blue-600); }
.fe-pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.fe-pos-prod { background: #fff; border: 1px solid var(--fe-border); border-radius: 10px; padding: 12px; text-align: left; cursor: pointer; transition: all .12s; }
.fe-pos-prod:hover { border-color: var(--fe-blue-500); box-shadow: var(--fe-shadow-lg); }
.fe-pos-prod-name { font-weight: 600; font-size: 13px; line-height: 1.25; min-height: 33px; }
.fe-pos-prod-price { font-weight: 700; color: var(--fe-blue-600); margin-top: 6px; }
/* Elementos exclusivos del rediseño en celular (ocultos en escritorio) */
.fe-pos-mstrip, .fe-pos-msum, .fe-pos-mtools, .fe-pos-mpay { display: none; }
.fe-cart-scroll { display: contents; }   /* transparente salvo en Ampliar, donde pasa a ser el área que se desplaza */
.fe-pos-cart { position: sticky; top: calc(var(--fe-topbar-h) + 16px); display: flex; flex-direction: column; max-height: calc(100vh - var(--fe-topbar-h) - 64px); }
.fe-cart-items { overflow-y: auto; flex: 1; min-height: 120px; }
.fe-cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 18px; border-bottom: 1px solid var(--fe-border); }
.fe-cart-line-name { font-weight: 600; font-size: 13px; }
.fe-cart-line-qty { display: flex; align-items: center; gap: 6px; }
.fe-cart-line-qty input { width: 84px; height: 30px; text-align: right; padding: 2px 8px; }
.fe-cart-totals { padding: 14px 18px; border-top: 1px solid var(--fe-border); background: #fafbfd; }
.fe-cart-totals .row-t { display: flex; justify-content: space-between; font-size: 13px; color: var(--fe-text-2); margin-bottom: 4px; }
.fe-cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 24px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }

/* ---------- Detalle / ficha ---------- */
.fe-dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13.5px; margin: 0; }
.fe-dl dt { color: var(--fe-text-muted); font-weight: 500; }
.fe-dl dd { margin: 0; }
.fe-stock-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fe-stock-box { background: var(--fe-bg); border-radius: 10px; padding: 12px; text-align: center; }
.fe-stock-box .v { font-size: 20px; font-weight: 700; }
.fe-stock-box .l { font-size: 12px; color: var(--fe-text-muted); }

/* Lista de ranking */
.fe-rank { list-style: none; margin: 0; padding: 0; }
.fe-rank li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--fe-border); }
.fe-rank li:last-child { border-bottom: 0; }
.fe-rank-n { width: 24px; height: 24px; border-radius: 7px; background: var(--fe-bg); font-size: 12px; font-weight: 700; display: grid; place-items: center; color: var(--fe-text-2); }
.fe-rank-bar { height: 4px; background: var(--fe-blue-100); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.fe-rank-bar span { display: block; height: 100%; background: var(--fe-blue-500); border-radius: 4px; }

.fe-alert-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--fe-border); }
.fe-alert-row:last-child { border-bottom: 0; }

/* ---------- Modales y avisos ---------- */
.modal-content { border: 0; border-radius: 14px; box-shadow: var(--fe-shadow-lg); }
.modal-header { border-bottom-color: var(--fe-border); padding: 16px 20px; }
.modal-title { font-weight: 700; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-footer { border-top-color: var(--fe-border); padding: 12px 20px; }
.fe-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.fe-toast { min-width: 300px; max-width: 420px; background: #fff; border-radius: 10px; box-shadow: var(--fe-shadow-lg); border-left: 4px solid var(--fe-blue-600);
  padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; animation: fe-in .2s ease; }
.fe-toast.success { border-left-color: var(--fe-green); } .fe-toast.success .bi { color: var(--fe-green); }
.fe-toast.warning { border-left-color: var(--fe-orange); } .fe-toast.warning .bi { color: var(--fe-orange); }
.fe-toast.error { border-left-color: var(--fe-red); } .fe-toast.error .bi { color: var(--fe-red); }
.fe-toast .bi { font-size: 18px; color: var(--fe-blue-600); }
.fe-toast-title { font-weight: 600; }
.fe-toast-msg { color: var(--fe-text-2); font-size: 13px; }
@keyframes fe-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.fe-loading { display: grid; place-items: center; padding: 80px; color: var(--fe-text-muted); }
.fe-skeleton { background: linear-gradient(90deg, #eef1f5 25%, #f6f8fa 50%, #eef1f5 75%); background-size: 200% 100%; animation: fe-sk 1.2s infinite; border-radius: 8px; }
@keyframes fe-sk { to { background-position: -200% 0; } }

.fe-chart-box { position: relative; height: 280px; }
.fe-restricted { color: var(--fe-text-muted); font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }

/* ---------- Responsive ---------- */
.fe-backdrop { display: none; }
@media (max-width: 1399.98px) { .fe-quick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Compras: comparación de costos (más caro en rojo, más barato en verde) */
.fe-cmp { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.fe-cmp.up { background: #fde2e1; color: #b42318; }
.fe-cmp.down { background: #dcf5e6; color: #166534; }
.fe-cmp.eq { background: #eef1f6; color: var(--fe-text-2); }
.fe-po-summary { position: sticky; top: calc(var(--fe-topbar-h) + 16px); }
/* El buscador de la orden queda fijo arriba: lo que se desplaza es el listado */
.fe-po-search { position: sticky; top: var(--fe-topbar-h); z-index: 6; background: #fff; margin: -8px -4px 8px; padding: 8px 4px 10px; border-bottom: 1px solid var(--fe-border); }
.fe-po-results { position: absolute; left: 4px; right: 4px; top: 66px; z-index: 7; max-height: 320px; overflow-y: auto; box-shadow: var(--fe-shadow-lg); }
.fe-po-search kbd { background: #fff; color: var(--fe-text); border: 1px solid var(--fe-border); border-radius: 4px; padding: 0 4px; font-size: 11px; box-shadow: none; }
/* En la venta, el buscador también queda fijo al desplazar la lista de productos */
.fe-pos-searchbar { position: sticky; top: var(--fe-topbar-h); z-index: 6; background: var(--fe-bg); padding: 8px 0 6px; margin-top: -8px; }
body.fe-focus .fe-pos-searchbar { position: relative; top: auto; margin-top: 0; padding-top: 0; background: transparent; }
/* Pantalla ampliada en pantallas que no son la venta: el panel se desplaza por dentro */
body.fe-focus .fe-content-inner { overflow-y: auto; }
body.fe-focus .fe-po-search { top: -1px; }
body.fe-focus .fe-po-summary { top: 0; }
.fe-po-table td { vertical-align: middle; }

/* Llegadas de mercadería y pedidos para clientes */
.fe-arrival { white-space: nowrap; }
.fe-client-order { display: flex; gap: 10px; align-items: flex-start; background: var(--fe-violet-bg); color: #4c1d95; border: 1px solid #ddd0fb; border-radius: 10px; padding: 10px 14px; }
.fe-client-order > .bi { font-size: 20px; line-height: 1.1; }
.fe-arrivals .fe-arr-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--fe-border); }
.fe-arrivals .fe-arr-row:last-child { border-bottom: 0; }
@media (max-width: 767.98px) { .fe-arrivals .fe-arr-row { grid-template-columns: 1fr; } }

/* Alertas de ventas en el dashboard */
.fe-alert-bar { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; border: 1px solid; }
.fe-alert-bar > .bi { font-size: 20px; line-height: 1.2; }
.fe-alert-bar.warn { background: #fff4e5; border-color: #f5c98b; color: #6b3a00; }
.fe-alert-bar.warn > .bi { color: #d97706; }
.fe-alert-bar.ok { background: #effaf3; border-color: #bfe8cd; color: #1d5c36; padding: 8px 14px; font-size: 13px; }
.fe-alert-bar.ok > .bi { color: #1f9254; font-size: 16px; }
.fe-alert-bar.info { background: #f1f6fd; border-color: #cddcf3; color: #2a4365; padding: 8px 14px; font-size: 13px; }
.fe-alert-bar.info > .bi { font-size: 16px; }
.fe-alert-pct { display: inline-block; background: #fde2e1; color: #b42318; font-weight: 700; border-radius: 6px; padding: 0 6px; }
.fe-alert-bar li { margin-bottom: 2px; }

/* Atajos de teclado y línea marcada en la venta */
.fe-pos-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--fe-text-2); }
.fe-pos-keys kbd, #pos-focus kbd { background: #fff; color: var(--fe-text); border: 1px solid var(--fe-border); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; font-size: 11px; font-family: inherit; font-weight: 600; margin-right: 2px; box-shadow: none; }
.fe-cart-line.is-selected { background: #eef5ff; box-shadow: inset 3px 0 0 var(--fe-blue-600); }

/* Venta ampliada (F10): el panel ocupa --fe-focus-pct % de la ventana */
body.fe-focus { overflow: hidden; }
body.fe-focus .fe-sidebar, body.fe-focus .fe-topbar { display: none !important; }
body.fe-focus .fe-main { margin-left: 0; }
body.fe-focus::before { content: ''; position: fixed; inset: 0; background: rgba(11, 22, 41, .6); z-index: 1039; }
body.fe-focus .fe-content { position: fixed; z-index: 1040; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(var(--fe-focus-pct, 90) * 1vw); height: calc(var(--fe-focus-pct, 90) * 1vh);
  background: var(--fe-bg); border-radius: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, .35); padding: 16px 20px; overflow: hidden; }
body.fe-focus .fe-content-inner { max-width: none; height: 100%; display: flex; flex-direction: column; min-height: 0; }
body.fe-focus .fe-page-header { margin-bottom: 12px; align-items: center; }
body.fe-focus .fe-breadcrumb, body.fe-focus .fe-page-sub { display: none; }
body.fe-focus .fe-pos { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 460px; align-items: stretch; }
body.fe-focus .fe-pos > div:first-child { display: flex; flex-direction: column; min-height: 0; }
body.fe-focus #pos-grid { flex: 1; min-height: 0; overflow-y: auto; align-content: start; padding: 2px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
body.fe-focus .fe-pos-cart { position: static; max-height: none; height: 100%; min-height: 0; overflow: hidden; }
body.fe-focus .fe-pos-cart > .fe-card-header, body.fe-focus .fe-cart-totals { flex-shrink: 0; }
body.fe-focus .fe-cart-scroll { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
body.fe-focus .fe-cart-items { flex: none; min-height: 0; overflow: visible; }
body.fe-focus .fe-pos-scan input { height: 60px; font-size: 19px; }
body.fe-focus .fe-pos-prod { padding: 14px; }
body.fe-focus .fe-pos-prod-name { font-size: 14.5px; }
body.fe-focus .fe-cart-line-name { font-size: 14px; }
body.fe-focus .fe-cart-total { font-size: 30px; }

@media (max-width: 1199.98px) {
  .fe-pos { grid-template-columns: minmax(0, 1fr); }
  .fe-pos-cart { position: static; max-height: none; }

  /* ====== Rediseño celular de Venta / Presupuesto (≤1199 px) ======
     Buscador de arriba = escáner · lo que cambia (ítems + total) va arriba en
     una franja fija · datos de la venta plegados · botón Cobrar fijo abajo.
     Solo aplica a estas rutas; el escritorio queda intacto. */

  /* El catálogo y los atajos no se usan en celular: se carga desde el buscador de arriba */
  body[data-route="ventas"] .fe-pos-browse,
  body[data-route="ventas/presupuesto"] .fe-pos-browse { display: none; }

  /* Botones del encabezado (Faltante · Historial · Modo presupuesto): en celular
     se ocultan porque esas acciones ya están en la barra de abajo del carrito. */
  body[data-route="ventas"] .fe-page-actions,
  body[data-route="ventas/presupuesto"] .fe-page-actions { display: none; }

  /* La venta sube arriba de todo; la tarjeta se vuelve transparente para montar franja + cuerpo + total */
  body[data-route="ventas"] .fe-pos-cart,
  body[data-route="ventas/presupuesto"] .fe-pos-cart {
    order: -1; margin-bottom: 14px; border: 0; background: transparent; box-shadow: none; overflow: visible; }
  body[data-route="ventas"] .fe-pos-cart > .fe-card-header,
  body[data-route="ventas/presupuesto"] .fe-pos-cart > .fe-card-header { display: none; }

  /* Franja de total fija bajo el buscador */
  .fe-pos-mstrip {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: var(--fe-topbar-h); z-index: 20;
    background: var(--fe-navy-900); color: #fff; padding: 11px 14px;
    border-radius: var(--fe-radius) var(--fe-radius) 0 0; cursor: pointer; }
  .fe-pos-mstrip .l { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
  .fe-pos-mstrip-count { background: rgba(255, 255, 255, .16); border-radius: 20px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
  .fe-pos-mstrip-tot { font-size: 17px; font-weight: 800; letter-spacing: .2px; }

  /* Cuerpo blanco (cliente + líneas + herramientas) con orden: líneas primero */
  body[data-route="ventas"] .fe-pos-cart .fe-cart-scroll,
  body[data-route="ventas/presupuesto"] .fe-pos-cart .fe-cart-scroll {
    display: flex; flex-direction: column; background: #fff;
    border-left: 1px solid var(--fe-border); border-right: 1px solid var(--fe-border); }
  body[data-route="ventas"] #pos-lines,
  body[data-route="ventas/presupuesto"] #pos-lines {
    order: 1; display: flex; flex-direction: column-reverse; overflow: visible; flex: none; min-height: 0; }
  /* Estado vacío (panel de Últimas ventas): no invertir el orden */
  body[data-route="ventas"] .fe-pos-cart.recent-mode #pos-lines { display: block; }
  body[data-route="ventas"] #pos-head,
  body[data-route="ventas/presupuesto"] #pos-head { order: 2; }
  body[data-route="ventas"] #pos-mtools,
  body[data-route="ventas/presupuesto"] #pos-mtools { order: 3; }

  /* El ítem recién agregado (seleccionado) queda arriba y resaltado */
  body[data-route="ventas"] #pos-lines .fe-cart-line.is-selected::before,
  body[data-route="ventas/presupuesto"] #pos-lines .fe-cart-line.is-selected::before {
    content: "＋ Agregado"; display: block; grid-column: 1 / -1; order: -1;
    font-size: 10.5px; font-weight: 700; color: var(--fe-green); }

  /* El resumen plegado de datos (Editar) no se usa en el flujo de dos pasos */
  .fe-pos-msum { display: none; }
  .fe-pos-mstrip-fwd { display: inline-flex; align-items: center; gap: 6px; }

  /* Barra chica de herramientas */
  .fe-pos-mtools { display: flex; gap: 7px; padding: 10px 12px 12px; border-top: 1px solid var(--fe-border); }
  .fe-pos-mtool { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 1px solid var(--fe-border); background: #fff; border-radius: 10px; padding: 9px 4px;
    font-size: 11.5px; font-weight: 600; color: var(--fe-text-2); text-decoration: none; }
  .fe-pos-mtool i { font-size: 15px; }

  /* Totales (paso 2): Descuento + Total grande + "Guardar sin cobrar". Se ocultan
     Subtotal, IVA y el botón inline. (Descuento = única .row-t con input.) */
  body[data-route="ventas"] #pos-pay,
  body[data-route="ventas/presupuesto"] #pos-pay { display: none; }
  body[data-route="ventas"] .fe-cart-totals .row-t:not(.align-items-center),
  body[data-route="ventas/presupuesto"] .fe-cart-totals .row-t:not(.align-items-center) { display: none; }
  body[data-route="ventas"] .fe-cart-totals,
  body[data-route="ventas/presupuesto"] .fe-cart-totals {
    border: 1px solid var(--fe-border); border-top: 0; border-radius: 0 0 var(--fe-radius) var(--fe-radius); }

  /* El total no se repite en el botón: queda solo la etiqueta (Continuar / Cobrar) */
  .fe-pos-mpay-amt { display: none; }
  .fe-pos-mpay-btn { justify-content: center; }

  /* ===== Flujo en dos pasos: 1) Cargar mercadería  2) Cliente y cobro ===== */
  /* Paso 1: se ve la lista; se ocultan datos, herramientas y totales */
  body[data-route="ventas"] .fe-pos-cart.mpaso-1 #pos-head,
  body[data-route="ventas"] .fe-pos-cart.mpaso-1 #pos-mtools,
  body[data-route="ventas"] .fe-pos-cart.mpaso-1 .fe-cart-totals,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-1 #pos-head,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-1 #pos-mtools,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-1 .fe-cart-totals { display: none; }
  /* Paso 2: cliente + datos + herramientas + total grande; se oculta la lista */
  body[data-route="ventas"] .fe-pos-cart.mpaso-2 #pos-lines,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-2 #pos-lines { display: none; }
  body[data-route="ventas"] .fe-pos-cart.mpaso-2 #pos-head,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-2 #pos-head { display: flex; }
  body[data-route="ventas"] .fe-pos-cart.mpaso-2 .fe-cart-total,
  body[data-route="ventas/presupuesto"] .fe-pos-cart.mpaso-2 .fe-cart-total { display: flex; }

  /* La franja: en el paso 2 pasa a "← Volver a cargar", sin total */
  .fe-pos-mstrip-back { display: none; }
  .fe-pos-cart.mpaso-2 .fe-pos-mstrip-fwd { display: none; }
  .fe-pos-cart.mpaso-2 .fe-pos-mstrip-back { display: inline-flex; align-items: center; gap: 6px; }
  .fe-pos-cart.mpaso-2 .fe-pos-mstrip-tot { display: none; }

  /* Barra de acción (Continuar / Cobrar): pegada al fondo con position:sticky,
     dentro del flujo normal de la página (NO 'fixed' ni alto completo). Así nunca
     se esconde ni se descoloca al abrir/cerrar el teclado, y no desborda a lo ancho. */
  .fe-pos-mpay {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; gap: 9px; margin-top: 12px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--fe-border); box-shadow: 0 -4px 14px rgba(16, 32, 57, .08); }
  .fe-pos-mpay-quote { flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 1.5px solid var(--fe-orange); color: var(--fe-orange); border-radius: 11px; font-size: 11px; font-weight: 700; text-decoration: none; }
  .fe-pos-mpay-quote i { font-size: 15px; }
  .fe-pos-mpay-btn { flex: 1; display: flex; align-items: center; justify-content: space-between;
    background: var(--fe-green); color: #fff; border: 0; border-radius: 11px; padding: 13px 16px; font-weight: 800; font-size: 16px; }
  .fe-pos-mpay-btn:disabled { opacity: .5; }
  .fe-pos-mpay-amt { font-size: 17px; }

  /* Presupuesto: franja y Cobrar en ámbar; el acceso de la izquierda va a Venta (azul) */
  .fe-pos--quote .fe-pos-mstrip { background: #7c3a05; }
  .fe-pos--quote .fe-pos-mpay-btn { background: var(--fe-orange); }
  .fe-pos--quote .fe-pos-mpay-quote { border-color: var(--fe-blue-600); color: var(--fe-blue-600); }
}

@media (max-width: 991.98px) {
  .fe-sidebar { transform: translateX(-100%); }
  .fe-app.nav-open .fe-sidebar { transform: none; box-shadow: var(--fe-shadow-lg); }
  .fe-app.nav-open .fe-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,22,41,.45); z-index: 1035; }
  .fe-main { margin-left: 0; }
  .fe-rate-chip, .fe-user-text { display: none; }
}
@media (max-width: 767.98px) {
  .fe-content { padding: 16px; }
  .fe-topbar { padding: 0 12px; gap: 8px; }
  .fe-search kbd { display: none; }
  .fe-demo-bar { padding: 6px 12px; }
  .fe-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fe-planned-list { grid-template-columns: 1fr; }
  .fe-dl { grid-template-columns: 1fr; gap: 2px; } .fe-dl dd { margin-bottom: 8px; }
  .fe-page-title { font-size: 19px; }
  .fe-kpi { padding: 14px; }
  .fe-kpi-value { font-size: 17px; white-space: normal; overflow-wrap: anywhere; }
}
@media print { .fe-sidebar, .fe-topbar, .fe-demo-bar { display: none !important; } .fe-main { margin: 0; } }

/* =====================================================================
   Códigos de navegación y Menú rápido (Ctrl + M)
   ===================================================================== */
.fe-nav-gcode { display: inline-block; min-width: 16px; margin-right: 6px; color: #5d7196; font-variant-numeric: tabular-nums; }
.fe-nav-code { margin-left: auto; font-size: 11px; font-weight: 500; color: #5d7196; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.fe-nav-link.active .fe-nav-code { color: rgba(255,255,255,.75); }
.fe-nav-code + .fe-nav-badge { margin-left: 6px; }

.fe-quick-btn { position: relative; }
.fe-quick-code { position: absolute; top: 7px; right: 9px; font-size: 10.5px; font-weight: 600; color: var(--fe-text-muted); letter-spacing: .3px; }
.fe-quick-btn.primary .fe-quick-code { color: rgba(255,255,255,.75); }

.fe-pal-btn { height: 40px; display: inline-flex; align-items: center; white-space: nowrap; }
.fe-pal-btn kbd, .fe-pal kbd { background: #fff; color: var(--fe-text-muted); border: 1px solid var(--fe-border-strong); font-size: 11px; padding: 1px 6px; box-shadow: none; font-family: inherit; }

.fe-pal-overlay { position: fixed; inset: 0; z-index: 2100; background: rgba(11, 22, 41, .45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; animation: fe-in .12s ease; }
.fe-pal { width: 100%; max-width: 620px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(11,22,41,.35); display: flex; flex-direction: column; max-height: 76vh; overflow: hidden; }
.fe-pal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--fe-border); }
.fe-pal-head > .bi { font-size: 20px; color: var(--fe-blue-600); }
.fe-pal-input { flex: 1; border: 0; outline: 0; font-size: 18px; font-weight: 500; color: var(--fe-text); background: none; min-width: 0; }
.fe-pal-input::placeholder { color: var(--fe-text-muted); font-weight: 400; font-size: 15px; }
.fe-pal-list { overflow-y: auto; padding: 6px 8px 10px; }
.fe-pal-group { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; color: var(--fe-text-muted); }
.fe-pal-gcode { background: var(--fe-blue-100); color: var(--fe-blue-600); border-radius: 5px; min-width: 20px; text-align: center; padding: 1px 5px; letter-spacing: 0; }
.fe-pal-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 14px; color: var(--fe-text); }
.fe-pal-item .bi { color: var(--fe-text-muted); font-size: 16px; }
.fe-pal-item.focused { background: var(--fe-blue-600); color: #fff; }
.fe-pal-item.focused .bi, .fe-pal-item.focused .fe-pal-code, .fe-pal-item.focused .fe-pal-lock { color: #fff; }
.fe-pal-item.locked { color: var(--fe-text-muted); }
.fe-pal-code { width: 34px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--fe-blue-600); }
.fe-pal-lock { font-size: 12px; color: var(--fe-text-muted); white-space: nowrap; }
.fe-pal-empty { padding: 28px; text-align: center; color: var(--fe-text-muted); }
.fe-pal-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--fe-border); background: #fafbfd; font-size: 12px; color: var(--fe-text-2); }
.fe-pal-foot kbd { margin-right: 3px; }
@media (max-width: 767.98px) {
  .fe-pal-overlay { padding-top: 12px; }
  .fe-pal-foot span { display: none; }
}
:root { --fe-sidebar-w: 272px; }
.fe-nav-link > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Ingreso (modo Supabase) ---------- */
.fe-login { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #1b3560 0, var(--fe-navy-900) 55%); }
.fe-login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.fe-boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--fe-bg); z-index: 2900; color: var(--fe-text-muted); }

/* ---------- Fase 6: servicios técnicos ---------- */
.fe-segment a { display: inline-block; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--fe-text-2); text-decoration: none; }
.fe-segment a.active { background: var(--fe-blue-600); color: #fff; }
.fe-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fe-step { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--fe-bg); color: var(--fe-text-3); }
.fe-step.done { background: #e7f6ee; color: #146c43; }
.fe-step.now { background: var(--fe-blue-600); color: #fff; font-weight: 600; }
.fe-ot-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fe-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 4px; }
.fe-photo { aspect-ratio: 1; border-radius: 8px; background: var(--fe-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--fe-border); }
.fe-photo img { width: 100%; height: 100%; object-fit: cover; }
.fe-signature { position: relative; height: 180px; border: 2px dashed var(--fe-border-strong); border-radius: 10px; background: #fff; touch-action: none; }
.fe-signature canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.fe-signature-hint { position: absolute; inset: auto 0 10px 0; text-align: center; font-size: 12px; color: var(--fe-text-3); pointer-events: none; }
.fe-signature.signed .fe-signature-hint { display: none; }
.fe-used-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--fe-border); }
.fe-used-row .btn-icon { width: 38px; height: 38px; font-size: 18px; padding: 0; }
.fe-mytasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.fe-mytask { display: block; padding: 14px; color: inherit; text-decoration: none; }
.fe-mytask:hover { border-color: var(--fe-blue-600); }
.fe-mytask.is-today { border-left: 4px solid var(--fe-blue-600); }
.fe-mytask-title { font-weight: 600; font-size: 15px; margin: 6px 0 4px; }
.fe-agenda th, .fe-agenda td { vertical-align: top; min-width: 120px; }
.fe-agenda .is-today { background: #f0f6ff; }
.fe-agenda-item { display: block; font-size: 12px; padding: 5px 7px; border-radius: 6px; margin-bottom: 4px; text-decoration: none; color: var(--fe-text); background: #eef4ff; border-left: 3px solid var(--fe-blue-600); }
.fe-agenda-item.tone-violet { background: #f3effe; border-color: #7c5cdb; }
.fe-agenda-item.tone-green { background: #e7f6ee; border-color: #1f9d55; }
.fe-agenda-item.tone-gray { background: #f1f3f5; border-color: #adb5bd; }
/* Agenda en el celular: un bloque por día en lugar de la tabla semanal */
.fe-agenda-days { display: none; }
@media (max-width: 767.98px) {
  .fe-card:has(> .fe-table-wrap > .fe-agenda) { display: none; }
  .fe-agenda-days { display: flex; flex-direction: column; gap: 10px; }
  .fe-agenda-day { padding: 12px 14px; }
  .fe-agenda-day.is-today { border-color: var(--fe-blue-600); }
  .fe-agenda-day-h { font-weight: 700; font-size: 14px; margin-bottom: 8px; text-transform: capitalize; }
  .fe-agenda-day .fe-agenda-item { font-size: 13.5px; padding: 10px 12px; margin-bottom: 6px; }
}
@media (max-width: 767px) {
  .fe-ot-actions { position: sticky; bottom: 0; z-index: 5; background: var(--fe-surface, #fff); padding: 8px; margin: 0 -12px; border-top: 1px solid var(--fe-border); box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
  .fe-ot-actions .btn { flex: 1 1 45%; }
}
@media (max-width: 767px) {
  .fe-toasts { top: 10px; bottom: auto; left: 10px; right: 10px; }
  .fe-toast { min-width: 0; max-width: none; }
}

/* ---------- Fase 7: finanzas e informes ---------- */
.fe-period { display: inline-flex; align-items: center; gap: 6px; background: var(--fe-surface, #fff); border: 1px solid var(--fe-border-strong); border-radius: 10px; padding: 4px 8px; flex-wrap: wrap; }
.fe-period .bi { color: var(--fe-text-3); }
.fe-period select { width: auto; border: 0; box-shadow: none; font-weight: 600; padding-right: 26px; }
.fe-period input[type=date] { width: 140px; }
.fe-report-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fe-bank-balance { font-size: 26px; font-weight: 700; margin: 12px 0 8px; letter-spacing: -.3px; }
.fe-pl { width: 100%; font-size: 14px; }
.fe-pl td { padding: 6px 4px; border-bottom: 1px solid var(--fe-border); }
.fe-pl td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fe-pl tr.sub td { padding-left: 22px; color: var(--fe-text-2); font-size: 13px; }
.fe-pl tr.total td { font-weight: 700; border-top: 2px solid var(--fe-border-strong); }
.fe-pl tr.big td { font-size: 16px; }
.fe-pl .neg { color: #b42318; }
.fe-pl .pos { color: #146c43; }
.fe-chart-box { position: relative; height: 260px; }
.fe-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--fe-text-2); margin-bottom: 6px; }
.fe-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.fe-aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.fe-aging div { background: var(--fe-bg); border-radius: 8px; padding: 8px 10px; }
.fe-aging small { display: block; color: var(--fe-text-3); font-size: 11.5px; }
.fe-aging strong { font-size: 14px; }
.fe-aging .late strong { color: #b42318; }
.fe-note { font-size: 12px; color: var(--fe-text-3); }
@media (max-width: 767px) { .fe-aging { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Fase 8: seguridad y auditoría ---------- */
.fe-perm-table th, .fe-perm-table td { padding: 8px 6px; }
.fe-perm-table thead th { font-size: 10px; white-space: normal; min-width: 58px; max-width: 86px; line-height: 1.25; vertical-align: bottom; }
.fe-perm-table thead tr:first-child th:first-child { position: sticky; left: 0; z-index: 2; background: var(--fe-surface, #fff); }
.fe-perm-table th.alt, .fe-perm-table td.alt { background: #f6f9fe; }
.fe-perm-group { background: var(--fe-bg); letter-spacing: .5px; }
.fe-perm-table td:first-child { position: sticky; left: 0; background: var(--fe-surface, #fff); z-index: 1; min-width: 170px; white-space: normal; box-shadow: 1px 0 0 var(--fe-border); }
.fe-changed { background: #fff6e0 !important; }
.fe-savebar { position: sticky; bottom: 12px; z-index: 20; margin-top: 12px; display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  background: var(--fe-navy-900); color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.fe-savebar span { margin-right: auto; font-weight: 600; }
.fe-check { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--fe-border); }
.fe-check:last-of-type { border-bottom: 0; }
.fe-check .bi { font-size: 18px; margin-top: 1px; }
.fe-check.ok .bi { color: #1f9d55; }
.fe-check.warn .bi { color: #c46a00; }
.fe-pre { background: var(--fe-bg); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.fe-ellipsis { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fe-offline { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3000; background: #b42318; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }

/* POS: cliente de la venta */
.fe-pos-client-list { position: absolute; left: calc(var(--bs-gutter-x) * .5); right: calc(var(--bs-gutter-x) * .5); top: 34px; z-index: 30;
  background: var(--fe-surface); border: 1px solid var(--fe-border); border-radius: 10px; box-shadow: var(--fe-shadow-lg); max-height: 320px; overflow-y: auto; padding: 4px; }
.fe-pos-client-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 7px 10px; color: inherit; }
.fe-pos-client-item:hover, .fe-pos-client-item.active { background: color-mix(in srgb, var(--fe-blue-600) 12%, transparent); }
.fe-pos-client { border: 1px solid var(--fe-border); border-radius: 10px; padding: 8px 10px; background: var(--fe-gray-bg); }
.fe-recent-item { display: block; width: 100%; text-align: left; border: 1px solid var(--fe-border); background: var(--fe-surface); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; color: inherit; }
button.fe-recent-item:hover { border-color: var(--fe-blue-600); }
.fe-recent-item.is-held { border-left: 3px solid var(--fe-orange); background: var(--fe-orange-bg); }

/* Modo presupuesto: tono ámbar para no confundirlo con la venta (azul/verde) */
.fe-quote-banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 10px;
  background: #fff7e6; border: 1px solid #f5c26b; border-left: 6px solid #d97706; color: #7c3d06; }
.fe-quote-banner > .bi { font-size: 22px; color: #d97706; }
.fe-quote-banner strong { letter-spacing: .04em; margin-right: 8px; }
.fe-quote-banner a { color: #92400e; font-weight: 600; }
body.fe-focus .fe-quote-banner { flex-shrink: 0; }
.fe-pos--quote .fe-pos-scan input { border-color: #f5c26b; }
.fe-pos--quote .fe-pos-scan input:focus { border-color: #d97706; box-shadow: 0 0 0 .2rem rgba(217, 119, 6, .18); }
.fe-pos--quote .fe-pos-scan .bi { color: #d97706; }
.fe-pos--quote .fe-pos-prod { background: #fffdf7; }
.fe-pos--quote .fe-pos-prod:hover { border-color: #d97706; }
.fe-pos--quote .fe-pos-prod-price { color: #b45309; }
.fe-pos--quote .fe-pos-cart { border: 2px solid #f5c26b; }
.fe-pos--quote .fe-pos-cart > .fe-card-header { background: #fff7e6; border-radius: 10px 10px 0 0; }
.fe-pos--quote .fe-pos-cart > .fe-card-header .fe-card-title { color: #92400e; }
.fe-pos--quote .fe-cart-totals { background: #fffbeb; }
.fe-pos--quote #pos-pay { background: #d97706; border-color: #d97706; }
.fe-pos--quote #pos-pay:hover:not(:disabled) { background: #b45309; border-color: #b45309; }
.fe-pos--quote [data-cat].btn-primary { background: #d97706; border-color: #d97706; }
.fe-pos--quote .fe-cart-line.is-selected { background: #fff3d6; box-shadow: inset 3px 0 0 #d97706; }

/* Productos sin stock (Local + Depósito = 0): se distinguen y en la venta no se pueden agregar */
.fe-pos-prod { position: relative; }
.fe-pos-prod.is-out { background: #fdf2f2; border-color: #f3b4b4; border-left: 4px solid #dc2626; }
.fe-pos-prod.is-out .fe-pos-prod-name { color: #7f1d1d; }
.fe-pos-prod.is-out .fe-pos-prod-price { color: #9ca3af; text-decoration: line-through; }
.fe-pos-prod.is-out[aria-disabled="true"] { cursor: not-allowed; opacity: .85; }
.fe-pos-prod.is-out[aria-disabled="true"]:hover { box-shadow: none; border-color: #f3b4b4; }
.fe-pos-out-badge { display: inline-block; margin-bottom: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  color: #fff; background: #dc2626; border-radius: 6px; padding: 2px 7px; }

.fe-pos--quote .fe-pos-prod.is-out { background: #fdf2f2; }
.fe-pos--quote .fe-pos-prod.is-out .fe-pos-prod-price { color: #b45309; text-decoration: none; }

/* Solo en Depósito (0 en el Local, pero hay en el Depósito): se puede vender, sale desde el Depósito */
.fe-pos-prod.is-dep { background: #fff6e6; border-color: #eccf94; border-left: 4px solid #d97706; }
.fe-pos-prod.is-dep:hover { border-color: #d99a3a; }

.fe-pos-out-badge.dep { background: #d97706; }
.fe-pos--quote .fe-pos-prod.is-dep { background: #fff6e6; }

/* Botón "Ocultar sin stock" del punto de venta */
.fe-hideout { background: #fff; border: 1px solid var(--fe-border); color: var(--fe-text-2, #475569); }
.fe-hideout:hover { border-color: #dc2626; color: #b91c1c; }
.fe-hideout.on { background: #fdf2f2; border-color: #f3b4b4; color: #b91c1c; font-weight: 600; }
/* Celular: botón "Mostrar / Ocultar sin stock" debajo del buscador (en la computadora está junto a las categorías) */
.fe-hideout-m { display: none; }
@media (max-width: 1199.98px) {
  .fe-hideout-m { display: inline-flex; align-items: center; margin: 8px 0 10px; min-height: 36px; }
}

/* ---------- Punto de equilibrio y meta diaria ---------- */
.fe-goal-track { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.fe-goal-track.sm { height: 8px; }
.fe-goal-track > div { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 6px; transition: width .4s ease; }
.fe-goal.is-done .fe-goal-track > div { background: #16a34a; }
.fe-goal.is-compact { padding: 6px 10px 8px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; margin-bottom: 8px; }
.fe-goal.is-compact .fe-goal-track { height: 6px; margin-top: 4px; background: #dcfce7; }
.fe-goal.is-compact .fe-goal-track > div { background: #16a34a; }
.fe-goal.is-compact.is-done { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: #166534; }
.fe-pe-track { position: relative; height: 22px; background: #eef1f6; border-radius: 11px; }
.fe-pe-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 11px; }
.fe-pe-mark { position: absolute; top: -3px; bottom: -3px; }
.fe-pe-mark.be { border-left: 3px dashed #d97706; }
.fe-pe-mark.tg { border-left: 3px solid #16a34a; transform: translateX(-3px); }
.fe-pe-owner td { background: #fff7e6; }
.fe-sim-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: .85rem; }
.fe-sim-out > div { background: var(--fe-bg, #f6f8fb); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.fe-sim-out strong { font-size: 1rem; }
@media (max-width: 576px) { .fe-sim-out { grid-template-columns: 1fr; } }
[data-bs-theme="dark"] .fe-goal-track, [data-bs-theme="dark"] .fe-pe-track { background: #2b3240; }
[data-bs-theme="dark"] .fe-goal.is-compact { background: #12261a; border-color: #1f4d2e; }
[data-bs-theme="dark"] .fe-pe-owner td { background: #3a2f17; }
.fe-pe-margin td:nth-child(2), .fe-pe-margin td:nth-child(3) { white-space: nowrap; }
.fe-pe-margin td:nth-child(3) { width: 3.5rem; }

/* Auditoría: en celular, los botones-enlace pequeños ("Sub", "Renombrar") tienen al menos 32 px de alto para el dedo */
@media (max-width: 767.98px) { .fe-content .btn-link.p-0 { min-height: 32px; display: inline-flex; align-items: center; gap: 4px; } }
/* Auditoría: selectores de período anchos no desbordan la pantalla del celular */
@media (max-width: 575.98px) { .fe-segment { max-width: 100%; overflow-x: auto; } .fe-segment > * { flex: 0 0 auto; } }

/* ---------------------------------------------------------------------
   Punto de venta a pantalla completa (sin "Ampliar"): la grilla de
   productos se desplaza sola y el carrito queda fijo con el Total y el
   botón Cobrar SIEMPRE visibles. Solo en pantallas anchas; en celular o
   tablet se mantiene el desplazamiento normal de la página.
   --------------------------------------------------------------------- */
@media (min-width: 1200px) {
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-app { height: 100vh; overflow: hidden; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-content { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) #fe-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) #fe-view > .fe-pos { flex: 1; min-height: 0; align-items: stretch; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos > div:first-child { display: flex; flex-direction: column; min-height: 0; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos > div:first-child > :not(#pos-grid) { flex-shrink: 0; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos > div:first-child > #pos-grid { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; align-content: start; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos-searchbar { position: relative; top: auto; margin-top: 0; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos-cart { position: static; max-height: none; height: 100%; min-height: 0; overflow: hidden; }
  /* Fijos: el encabezado del carrito y el total+cobro. En el medio, cliente y productos se desplazan juntos. */
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-pos-cart > .fe-card-header,
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-cart-totals { flex-shrink: 0; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-cart-scroll { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-cart-items { flex: none; min-height: 0; overflow: visible; }
  /* Recupera el espacio de arriba: en el POS a pantalla completa el encabezado va compacto */
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-page-header { margin-bottom: 10px; }
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-page-header .fe-breadcrumb,
  body[data-route^="ventas"]:not([data-route="ventas/historial"]):not(.fe-focus) .fe-page-header .fe-page-sub { display: none; }
}

/* Venta: el último producto cargado queda arriba y los anteriores van bajando
   (en el celular ya era así). El panel de Últimas ventas mantiene su orden. */
#pos-lines { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.fe-pos-cart.recent-mode #pos-lines { display: block; }

/* ---------------------------------------------------------------------
   Presupuesto técnico: mismos criterios que la venta
   · El último material cargado queda arriba; − y + grandes; precio unitario visible.
   · Importes con punto de miles. En el celular, total y botón fijos abajo.
   --------------------------------------------------------------------- */
.fe-tq-lines { display: flex; flex-direction: column-reverse; justify-content: flex-end; overflow: visible; min-height: 0; margin: 0 -18px; }
.fe-tq-lines .fe-cart-line { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
.fe-tq-lines .fe-cart-line-qty { gap: 6px; }
.fe-tq-lines .fe-cart-line-qty .btn-icon { width: 34px; height: 34px; padding: 0; font-size: 17px; }
.fe-tq-lines .fe-cart-line-qty [data-id] { margin-left: 6px; }
.fe-tq-price { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.fe-tq-price input { width: 120px; }
.fe-tq-amt { width: 140px; }
.fe-tq-mbar { display: none; }
@media (max-width: 1199.98px) {
  .fe-tq-lines .fe-cart-line { padding: 12px 14px; }
  .fe-tq-lines .fe-cart-line-name { font-size: 14px; }
  .fe-tq-lines .fe-cart-line-sub { font-size: 15px; }
  .fe-tq-lines .fe-cart-line-qty { grid-column: 1 / -1; gap: 8px; }
  .fe-tq-lines .fe-cart-line-qty .btn-icon { width: 44px !important; height: 44px !important; font-size: 18px; }
  .fe-tq-lines .fe-cart-line-qty input { width: 72px; height: 44px; font-size: 16px; text-align: center; }
  .fe-tq-lines .fe-cart-line-qty [data-del], .fe-tq-lines .fe-cart-line-qty [data-id] { margin-left: auto !important; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
  .fe-tq-price { grid-column: 1 / -1; justify-content: space-between; }
  .fe-tq-price input { width: 150px; height: 44px; font-size: 16px; }
  .fe-tq-amt { width: 150px; height: 40px; font-size: 16px; }
  .fe-tq .fe-pos-client-item { padding: 11px 12px; }
  .fe-tq .fe-po-results .list-group-item { padding: 12px 14px; min-height: 56px; }
  /* Total y botón principal siempre a la vista, como Continuar / Cobrar en la venta */
  .fe-tq-mbar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px; margin-top: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--fe-border); box-shadow: 0 -4px 14px rgba(16, 32, 57, .08); }
  .fe-tq-mbar-tot { display: flex; flex-direction: column; line-height: 1.15; }
  .fe-tq-mbar-tot span { font-size: 12px; color: var(--fe-text-muted); }
  .fe-tq-mbar-tot strong { font-size: 18px; }
  .fe-tq-mbar .btn { flex: 1; min-height: 48px; font-size: 16px; }
  .fe-tq .fe-po-summary { position: static; }
  /* Tres pasos en el celular: servicio → materiales → cliente y envío */
  .fe-tq-steps { display: flex; gap: 6px; margin-bottom: 12px; }
  .fe-tq-step { flex: 1; border: 0; border-radius: 10px; background: #eef1f6; color: var(--fe-text-muted); font-size: 13px; padding: 8px 2px; white-space: nowrap; }
  .fe-tq-step i { display: none; }
  .fe-tq-step.is-on { background: var(--fe-blue-600); color: #fff; font-weight: 600; }
  .fe-tq-step.is-done { background: #e6f4ec; color: #15803d; }
  .fe-tq-step.is-done i { display: inline; }
  .fe-tq[data-step="1"] .fe-tq-s2, .fe-tq[data-step="1"] .fe-tq-s3,
  .fe-tq[data-step="2"] .fe-tq-s1, .fe-tq[data-step="2"] .fe-tq-s3,
  .fe-tq[data-step="3"] .fe-tq-s1, .fe-tq[data-step="3"] .fe-tq-s2 { display: none !important; }
  .fe-tq .fe-po-search { margin-top: 0; }
  .fe-tq-donly { display: none; }
  .fe-tq-main { display: flex; flex-direction: column; }
}
@media (min-width: 1200px) { .fe-tq-steps, .fe-tq-monly, .fe-tq-back, .fe-tq-svc { display: none !important; } }

/* Productos: tarjetas de resumen de lo filtrado (compactas) */
.fe-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.fe-kpis.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fe-kc { background: #fff; border: 1px solid var(--fe-border); border-radius: 10px; padding: 9px 14px; min-width: 0; }
.fe-kc .l { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--fe-text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.fe-kc .l a { text-transform: none; font-weight: 600; text-decoration: none; white-space: nowrap; }
.fe-kc .v { font-size: 20px; font-weight: 800; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-kc .s { font-size: 12px; color: var(--fe-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-kc .s a { font-weight: 700; }
.fe-kc.is-main { background: #f3f7ff; border-color: #9ec0fb; }
.fe-kc.is-main .v { color: var(--fe-blue-600); }
.fe-kc.is-warn { background: #fff7ed; border-color: #fdba74; }
.fe-kc.is-warn .l, .fe-kc.is-warn .s a { color: #9a3412; }
.fe-kc.is-warn .v { color: #c2410c; }
.fe-kc.is-ok { background: #f0fdf4; border-color: #86efac; }
.fe-kc.is-ok .l { color: #166534; } .fe-kc.is-ok .v { color: #15803d; }
.fe-kc-vv { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; min-width: 0; }
.fe-kc-vv span { flex: none; width: 44px; font-size: 12px; color: var(--fe-text-muted); font-weight: 600; }
.fe-kc-vv b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
.fe-kc-vv.is-cost b { font-size: 15px; color: #475569; }
.fe-kc-vv em { font-style: normal; font-size: 10.5px; font-weight: 700; color: #c2410c; background: #ffedd5; border-radius: 999px; padding: 0 6px; }
.fe-two { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.fe-two small { font-size: 12px; color: var(--fe-text-muted); white-space: nowrap; }
.fe-two small b { color: #334155; }
.fe-nocost { color: #c2410c; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.fe-table-toolbar .form-select.is-on { border-color: #86b7fe; background-color: #f3f7ff; }
[data-bs-theme="dark"] .fe-kc { background: var(--fe-surface, #1b2230); }
@media (max-width: 991.98px) { .fe-kpis, .fe-kpis.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .fe-table--cards .fe-two { align-items: flex-end; } }

/* Productos › Importar productos: resumen de la revisión */
.fe-imp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.fe-imp-st { background: var(--fe-bg, #f8fafc); border: 1px solid var(--fe-border); border-radius: 10px; padding: 8px 10px; }
.fe-imp-st b { display: block; font-size: 20px; }
.fe-imp-st span { font-size: 12px; color: var(--fe-text-muted); }
@media (max-width: 575.98px) { .fe-imp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* El selector de depósito de cada línea no se sale del carrito: ancho máximo fijo
   (un ancho en % dentro de la grilla hacía que el selector aplastara el nombre del producto) */
.fe-cart-line-dep select { max-width: 150px; text-overflow: ellipsis; }

/* ---------------------------------------------------------------------
   Celular: coincidencias del buscador visibles sobre el teclado, y se
   ocultan los atajos de teclado (no sirven sin teclado físico).
   --------------------------------------------------------------------- */
.fe-pos-suggest { display: none; }
@media (max-width: 1199.98px) {
  .fe-pos-keys { display: none; }
  /* En el celular, el POS gana espacio arriba: sin migas ni subtítulo largo (el buscador ya lo explica) */
  body[data-route="ventas"] .fe-page-header .fe-breadcrumb,
  body[data-route="ventas"] .fe-page-header .fe-page-sub,
  body[data-route="ventas/presupuesto"] .fe-page-header .fe-breadcrumb,
  body[data-route="ventas/presupuesto"] .fe-page-header .fe-page-sub { display: none; }
  .fe-pos-suggest { display: block; margin-bottom: 12px; max-height: 46vh; overflow-y: auto;
    border: 1px solid var(--fe-border); border-radius: 12px; background: var(--fe-surface, #fff);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12); -webkit-overflow-scrolling: touch; }
  .fe-pos-suggest:empty { display: none; }
}
.fe-pos-suggest-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--fe-border); background: transparent; }
.fe-pos-suggest-item:last-child { border-bottom: 0; }
.fe-pos-suggest-item:active { background: var(--fe-hover, #f1f5f9); }
.fe-pos-suggest-info { min-width: 0; flex: 1; }
.fe-pos-suggest-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-pos-suggest-price { font-weight: 700; white-space: nowrap; }

/* Versión visible en la pantalla de ingreso */
.fe-login-ver { text-align: center; margin-top: 14px; }
.fe-login-ver span { display: inline-block; font-size: 12px; font-weight: 600; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 20px; padding: 2px 12px; letter-spacing: .2px; }

/* ---------- Punto de equilibrio y meta diaria ---------- */
.fe-goal-track { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.fe-goal-track.sm { height: 8px; }
.fe-goal-track > div { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 6px; transition: width .4s ease; }
.fe-goal.is-done .fe-goal-track > div { background: #16a34a; }
.fe-goal.is-compact { padding: 6px 10px 8px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; margin-bottom: 8px; }
.fe-goal.is-compact .fe-goal-track { height: 6px; margin-top: 4px; background: #dcfce7; }
.fe-goal.is-compact .fe-goal-track > div { background: #16a34a; }
.fe-goal.is-compact.is-done { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: #166534; }
.fe-pe-track { position: relative; height: 22px; background: #eef1f6; border-radius: 11px; }
.fe-pe-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 11px; }
.fe-pe-mark { position: absolute; top: -3px; bottom: -3px; }
.fe-pe-mark.be { border-left: 3px dashed #d97706; }
.fe-pe-mark.tg { border-left: 3px solid #16a34a; transform: translateX(-3px); }
.fe-pe-owner td { background: #fff7e6; }
.fe-sim-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: .85rem; }
.fe-sim-out > div { background: var(--fe-bg, #f6f8fb); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.fe-sim-out strong { font-size: 1rem; }
@media (max-width: 576px) { .fe-sim-out { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------
   Venta en el celular (≤1199 px), ajustes de noviembre 2026:
   · La venta arranca lista para buscar: buscador grande arriba (sin
     catálogo ni categorías) y sin la lista de últimas ventas de entrada.
   · Línea del carrito sin cortes: nombre + subtotal, precio unitario
     visible, cantidad con − / + grandes y el depósito debajo.
   · Botón "Cancelar" en la barra de abajo.
   --------------------------------------------------------------------- */
.fe-cart-line-unit { font-size: 12.5px; font-weight: 400; color: var(--fe-text-2); margin-top: 2px; }
.fe-cart-line-unit b { font-weight: 700; color: var(--fe-text); }
.fe-pos-mpay-cancel { display: none; }
@media (max-width: 1199.98px) {
  body[data-route="ventas"] .fe-pos-browse,
  body[data-route="ventas/presupuesto"] .fe-pos-browse { display: block; order: -2; }
  body[data-route="ventas"] #pos-cats, body[data-route="ventas"] #pos-grid,
  body[data-route="ventas/presupuesto"] #pos-cats, body[data-route="ventas/presupuesto"] #pos-grid { display: none !important; }
  body[data-route^="ventas"] .fe-pos-searchbar { position: relative; top: auto; margin: 0 0 4px; padding: 0; background: transparent; }
  body[data-route^="ventas"] .fe-pos-searchbar .fe-pos-scan { margin-bottom: 0 !important; }
  body[data-route^="ventas"] #pos-scan { height: 52px; font-size: 16px; border-width: 2px; }
  body[data-route^="ventas"] .fe-pos-suggest-item { min-height: 56px; }

  body[data-route^="ventas"] #pos-lines .fe-cart-line { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; row-gap: 8px; }
  body[data-route^="ventas"] .fe-cart-line-name { font-size: 14px; }
  body[data-route^="ventas"] .fe-cart-line-sub { font-size: 15px; }
  body[data-route^="ventas"] .fe-cart-line-unit { font-size: 13.5px; }
  body[data-route^="ventas"] .fe-cart-line-qty { grid-column: 1 / -1; gap: 8px; }
  body[data-route^="ventas"] .fe-cart-line-qty .btn-icon { width: 44px !important; height: 44px !important; font-size: 18px; }
  body[data-route^="ventas"] .fe-cart-line-qty input { width: 72px; height: 44px; font-size: 16px; text-align: center; }
  body[data-route^="ventas"] .fe-cart-line-qty [data-del] { margin-left: auto !important; width: 44px; height: 44px; justify-content: center; font-size: 18px; }
  body[data-route^="ventas"] .fe-cart-line-dep { grid-column: 1 / -1; text-align: left !important; }
  body[data-route^="ventas"] .fe-cart-line-dep:empty { display: none; }
  body[data-route^="ventas"] .fe-cart-line-dep select { width: 100% !important; height: 40px; font-size: 14px; }

  .fe-pos-mpay-cancel { flex: none; width: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 1.5px solid #dc2626; color: #b91c1c; background: #fff; border-radius: 11px; font-size: 11px; font-weight: 700; padding: 0; }
  .fe-pos-mpay-cancel[hidden] { display: none; }
  .fe-pos-mpay-cancel i { font-size: 15px; }
}

/* ---------------------------------------------------------------------
   Celular (≤767 px): listas como tarjetas, botones a medida del dedo
   y letra chica más legible.
   --------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  /* Tablas del componente de listas: cada fila es una tarjeta con "etiqueta · valor" */
  .fe-table--cards thead { display: none; }
  .fe-table--cards, .fe-table--cards tbody, .fe-table--cards tfoot { display: block; width: 100%; }
  .fe-table--cards tr { display: flex; flex-direction: column; padding: 10px 16px; border-bottom: 1px solid var(--fe-border); }
  .fe-table--cards tbody tr:last-child { border-bottom: 0; }
  .fe-table--cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 3px 0; border: 0 !important;
    text-align: right; min-width: 0; overflow-wrap: anywhere; white-space: normal; background: transparent !important; }
  .fe-table--cards td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 12px; font-weight: 600;
    color: var(--fe-text-muted); text-transform: uppercase; letter-spacing: .3px; }
  .fe-table--cards td[data-label=""]::before { content: none; }
  .fe-table--cards td[data-label=""] { justify-content: flex-end; }
  .fe-table--cards td.fe-td-title { order: -1; display: block; text-align: left; padding-bottom: 6px; font-size: 14px; }
  .fe-table--cards td.fe-td-title::before { content: none; }
  .fe-table--cards td:empty { display: none; }
  .fe-table--cards td[colspan] { display: block; text-align: center; }
  .fe-table--cards td[colspan]::before { content: none; }
  .fe-table--cards .fe-an-total td { display: flex; text-align: right; }

  /* Botones táctiles de al menos 44 px */
  .fe-content .btn { min-height: 44px; }
  .fe-content .btn.btn-icon, .fe-content .btn-sm:has(> .bi:only-child) { min-width: 44px; justify-content: center; }
  .fe-content .btn-sm { display: inline-flex; align-items: center; }
  .fe-segment button { min-height: 40px; }
  .fe-content .form-range { height: 44px; }
  .fe-table--cards td a { display: inline-block; padding: 6px 0; }

  /* Letra chica legible (mínimo 12,5 px) */
  .fe-table td .muted, .fe-table td .small, .fe-table .muted { font-size: 12.5px; }
  .fe-content .small, .fe-content small { font-size: 12.5px; }
}
@media (max-width: 1199.98px) {
  /* En la venta hay un solo buscador (el grande de la pantalla): se oculta el de la barra superior */
  body[data-route="ventas"] .fe-topbar .fe-search,
  body[data-route="ventas/presupuesto"] .fe-topbar .fe-search { visibility: hidden; }
  body[data-route="ventas"] .fe-page-header,
  body[data-route="ventas/presupuesto"] .fe-page-header { margin-bottom: 10px; }
}
@media (max-width: 1199.98px) { .fe-pos.is-paso2 > .fe-pos-browse { display: none !important; } }
@media (max-width: 767.98px) {
  /* Leyendas de gráficos y chapas: también legibles en el celular */
  .fe-an-legend, .fe-an-bar, .fe-an-col, .fe-an-col b { font-size: 12.5px !important; }
  .fe-plate { font-size: 12.5px; }
}

/* Cobro: el efectivo se calcula solo (total menos los otros medios) */
.fe-pay-auto[readonly] { background: #f0fdf4; border-color: #bbf7d0; color: #166534; font-weight: 700; }

/* Cobro: foto del comprobante y lectura automática */
.fe-shot-info { font-size: 12.5px; margin-top: 4px; line-height: 1.35; }
.fe-shot-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid var(--fe-border); margin-right: 6px; vertical-align: middle; }

/* Cobro: botón "Todo" y doble toque en los medios de pago */
.fe-pay-in { touch-action: manipulation; }
.fe-pay-all { font-size: 12.5px; font-weight: 600; padding-left: 10px; padding-right: 10px; }
.fe-pay-flash { box-shadow: 0 0 0 3px rgba(22, 163, 74, .35) !important; transition: box-shadow .3s; }

/* Celular: el valor del stock y la 4.ª tarjeta ocupan todo el ancho para que los importes no se corten (igual que Listo Sabra) */
@media (max-width: 575.98px) {
  .fe-kpis .fe-kc:nth-child(n+3) { grid-column: 1 / -1; }
  .fe-kc .s { white-space: normal; }
}

/* App instalable (v1.6.0) */
.fe-app-pasos { padding-left: 20px; line-height: 1.6; }
.fe-app-pasos li { margin-bottom: 6px; }
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
/* La guía de instalación se abre también desde la pantalla de ingreso (que está por encima de todo) */
body:has(.fe-login) .modal { z-index: 3100; }
body:has(.fe-login) .modal-backdrop { z-index: 3050; }

/* Cambio de precio en la venta (v1.7.0) */
.fe-pc { display: inline-flex; align-items: center; gap: 3px; position: relative; }
.fe-pc.is-edit { border-bottom: 1px dashed #1f5fbf; cursor: text; }
.fe-pc-pen { border: 0; background: none; padding: 0 2px; color: #1f5fbf; font-size: 11px; line-height: 1; }
@media (hover: hover) and (pointer: fine) { .fe-pc-pen { opacity: .55; } .fe-pc.is-edit:hover .fe-pc-pen { opacity: 1; } }
.fe-pc.is-chg { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; border-radius: 6px; padding: 0 5px; cursor: help; }
.fe-pc.is-chg > b { color: #92400e; }
.fe-pc.is-chg > i { font-size: 12px; }
.fe-cart-line-sub.is-chg { color: #92400e; }
.fe-pc-tip { display: none; position: absolute; left: 0; top: calc(100% + 8px); z-index: 1060; min-width: 250px; background: #111827; color: #fff;
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 10px 30px rgba(0,0,0,.25); white-space: nowrap; text-align: left; cursor: default; }
.fe-pc-tip.is-right { left: auto; right: 0; }
.fe-pc-tip:before { content: ''; position: absolute; top: -6px; left: 18px; border: 6px solid transparent; border-top: 0; border-bottom-color: #111827; }
.fe-pc-tip.is-right:before { left: auto; right: 18px; }
/* El detalle se muestra en una ventanita flotante (fe-pc-float), fuera del panel: así nunca lo ensancha ni lo corre de lugar */
.fe-pc-float { position: fixed; z-index: 2000; pointer-events: none; display: block; }
.fe-pc-float .fe-pc-tip { display: block; position: static; }
.fe-pc-float.up .fe-pc-tip:before { top: auto; bottom: -6px; border-top: 6px solid #111827; border-bottom: 0; }
.fe-pc-float .fe-pc-tip:before { left: var(--arrow, 18px); right: auto; }
.fe-pos-cart, #pos-lines { overflow-x: hidden; }
.fe-pc-tip .t { display: block; font-weight: 700; margin-bottom: 4px; }
.fe-pc-tip .r { display: flex; justify-content: space-between; gap: 16px; }
.fe-pc-tip .r > span { color: #cbd5e1; }
.fe-pc-tip b { color: #fff; font-weight: 700; }
.fe-pc-tip b.old { text-decoration: line-through; color: #fca5a5; }
.fe-pc-tip b.d { color: #fcd34d; }
.fe-pc-tip .s { display: block; margin-top: 4px; color: #94a3b8; font-size: 11.5px; }
.fe-pc-ed { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-weight: 400; }
.fe-pc-ed input { width: 130px; font-weight: 700; text-align: right; border: 2px solid #1f5fbf; background: #f3f7ff; }
.fe-pc-hint { width: 100%; font-size: 11.5px; color: var(--fe-text-muted); }
.fe-pc.is-chg .fe-pc-pen { color: #92400e; }
/* El panel de la venta nunca se desplaza de costado: la cabecera (fila de Bootstrap con márgenes negativos)
   sobresalía 4 px y permitía correr todo el panel, cortando el importe de la derecha */
.fe-cart-scroll { overflow-x: hidden !important; }
#pos-head.row { margin-left: 0; margin-right: 0; }
/* La línea del carrito siempre entra en el ancho del panel: la 1.ª columna puede achicarse,
   la cantidad es más angosta y el selector de depósito tiene un ancho máximo (antes, con
   algunas fuentes o pantallas, la línea quedaba más ancha que el panel y se cortaba el importe) */
.fe-cart-line { grid-template-columns: minmax(0, 1fr) auto; }
.fe-cart-line > * { min-width: 0; }
.fe-cart-line-qty { flex-wrap: wrap; row-gap: 4px; }
.fe-cart-line-qty input { width: 64px; }
@media (min-width: 1200px) { .fe-cart-line-dep select { max-width: 140px; text-overflow: ellipsis; } }
.fe-cart-line-name { overflow-wrap: anywhere; }

/* PDV en la computadora: venta sin empezar = panel limpio (solo cliente) */
@media (min-width: 1200px) {
  .fe-pos-cart.is-idle #pos-head > .col-6,
  .fe-pos-cart.is-idle #pos-client-card { display: none; }
  .fe-pos-cart.idle-no-recent .fe-recent-sales { display: none; }
}

/* Foto del comprobante de un pago (detalle de la venta y Verificar pago) */
.fe-pphoto { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
