/* ==========================================================================
   AGAPSA PUNTO DE VENTA — Estilos
   ========================================================================== */

:root {
  --bg: #070b14;
  --bg-2: #0a1120;
  --surface: #0f172a;
  --surface-2: #131e35;
  --surface-3: #1a2743;
  --border: #223252;
  --border-soft: #182642;
  --text: #eaf0fb;
  --muted: #8fa2c2;
  --muted-2: #64748b;
  --primary: #6366f1;
  --primary-2: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #22d3ee;
  --success: #10b981;
  --success-2: #34d399;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --danger-2: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
  --sidebar: 264px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 700px at 88% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(34, 211, 238, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
code, .mono { font-family: var(--mono); }
.hidden { display: none !important; }
svg.icon { flex: none; vertical-align: middle; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #24365a; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #33507f; background-clip: content-box; }

/* ==========================================================================
   Login
   ========================================================================== */

.login-screen {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center; padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(900px 620px at 82% 10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(760px 500px at 10% 90%, rgba(34, 211, 238, 0.12), transparent 60%),
    linear-gradient(160deg, #060a12 0%, #0a1222 60%, #070b14 100%);
}
.login-screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
}
.login-card {
  position: relative; width: 100%; max-width: 440px;
  background: linear-gradient(180deg, rgba(19, 30, 53, 0.94), rgba(11, 18, 32, 0.96));
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 22px; padding: 38px 34px 26px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  animation: rise 0.45s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.logo-mark {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-weight: 800; font-size: 20px; letter-spacing: -0.5px;
  box-shadow: 0 12px 28px -10px rgba(99, 102, 241, 0.8);
}
.logo-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; }
.login-brand h1 { font-size: 21px; letter-spacing: 0.3px; line-height: 1.15; }
.login-brand p { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; }
.login-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.field { margin-bottom: 15px; }
.field label, .label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.9px;
  text-transform: uppercase; color: #a8b8d4; margin-bottom: 7px;
}
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.input-wrap input { padding-left: 41px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="search"], input[type="email"], select, textarea {
  width: 100%; background: #0a1324; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13.5px; color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: #55678a; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); background: #0b1528;
}
input:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }
select {
  appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238fa2c2' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { resize: vertical; min-height: 74px; }
input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
.form-error {
  background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af; padding: 10px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 12px;
}
.form-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #cdd9ec; }
.check-row input { flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 15px; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 8px 22px -10px rgba(99, 102, 241, 0.8); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7377ff, #5b52ea); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: #fff; box-shadow: 0 8px 22px -10px rgba(16, 185, 129, 0.7); }
.btn-success:hover:not(:disabled) { background: linear-gradient(135deg, #16c78d, #048a61); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2645); color: #fff; }
.btn-danger:hover:not(:disabled) { background: linear-gradient(135deg, #fb5270, #e11d48); }
.btn-outline { background: rgba(148, 163, 184, 0.04); border-color: var(--border); color: #c3d0e5; }
.btn-outline:hover:not(:disabled) { background: var(--surface-3); border-color: #32496f; color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: #fff; background: rgba(148, 163, 184, 0.08); }
.btn-block { width: 100%; }
.btn-login { padding: 13px; font-size: 14.5px; margin-top: 6px; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-icon { padding: 8px; border-radius: 9px; }
.btn .spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-hint {
  margin-top: 18px; background: rgba(34, 211, 238, 0.07); border: 1px dashed rgba(34, 211, 238, 0.35);
  padding: 12px 14px; border-radius: 11px; font-size: 12px; color: #a9dbe6;
}
.login-hint strong { color: #e6fbff; }
.login-hint code { color: #fff; background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 5px; }
.login-hint .hint-actions { margin-top: 9px; display: flex; gap: 8px; flex-wrap: wrap; }
.login-net { margin-top: 16px; font-size: 11.5px; color: var(--muted-2); text-align: center; }
.login-net code { color: #9fb3d4; }
.login-footer { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border-soft); text-align: center; color: var(--muted-2); font-size: 11px; }

/* ==========================================================================
   Layout
   ========================================================================== */

.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar); flex: none; background: linear-gradient(180deg, #0b1424, #0a101c);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  z-index: 40; transition: transform 0.22s ease;
}
.brand {
  display: flex; align-items: center; gap: 11px; padding: 20px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-text h2 { font-size: 16px; letter-spacing: 0.4px; line-height: 1.1; }
.brand-text p { font-size: 9.5px; letter-spacing: 2.1px; color: var(--accent); text-transform: uppercase; font-weight: 700; margin-top: 3px; }
.brand-text small { display: block; margin-top: 5px; color: var(--muted-2); font-size: 10px; letter-spacing: 0.2px; text-transform: none; font-weight: 500; }

.nav { flex: 1; overflow-y: auto; padding: 14px 11px 20px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-title {
  font-size: 9.5px; letter-spacing: 1.7px; text-transform: uppercase;
  color: #536588; font-weight: 700; padding: 0 11px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: 9px; background: transparent; border: none;
  color: #93a5c4; font-weight: 500; font-size: 13px; text-align: left;
  transition: background 0.15s, color 0.15s; position: relative;
}
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { background: rgba(99, 102, 241, 0.08); color: #dbe5f6; }
.nav-item.active { background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.06)); color: #dfe4ff; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px;
  border-radius: 0 4px 4px 0; background: linear-gradient(var(--primary-2), var(--accent));
}
.nav-item .nav-badge { margin-left: auto; font-size: 10px; font-weight: 700; background: rgba(34, 211, 238, 0.15); color: var(--accent); padding: 1px 7px; border-radius: 20px; }

.sidebar-footer { padding: 13px; border-top: 1px solid var(--border-soft); }
.profile {
  display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 11px;
  background: rgba(148, 163, 184, 0.04); border: 1px solid var(--border-soft); margin-bottom: 9px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f46e5, #0891b2); color: #fff; font-weight: 700; font-size: 13px;
}
.avatar.ring { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5); }
.profile-meta { min-width: 0; }
.profile-meta h4 { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-meta p { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { width: 100%; color: #c9a2ad; border-color: rgba(244, 63, 94, 0.25); }
.btn-logout:hover { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: transparent; }
.topbar {
  height: 64px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 17, 32, 0.72); backdrop-filter: blur(12px); z-index: 20;
}
.menu-btn { display: none; }
.topbar-title { min-width: 0; }
.topbar-title h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  border: 1px solid var(--border); border-radius: 30px; background: rgba(148, 163, 184, 0.04);
  font-size: 11.5px; color: #b7c6de; white-space: nowrap;
}
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); padding: 6px 11px; border-radius: 30px; border: 1px solid var(--border); }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12); }
.conn.online .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); animation: pulse 2s infinite; }
.conn.offline .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.15); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,0.03); } }
.clock { font-family: var(--mono); font-size: 12.5px; color: #b7c6de; letter-spacing: 0.4px; }
.clock small { display: block; font-size: 9.5px; color: var(--muted-2); letter-spacing: 0.3px; text-align: right; }

.view-root { flex: 1; overflow-y: auto; padding: 22px; scroll-behavior: smooth; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.4px; }
.page-head p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.store-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.store-tab {
  border: 1px solid var(--border); background: rgba(148, 163, 184, 0.04); color: var(--muted);
  border-radius: 9px; padding: 7px 13px; font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; transition: all 0.15s; white-space: nowrap;
}
.store-tab:hover { color: #fff; border-color: #334a72; }
.store-tab.active { background: rgba(99, 102, 241, 0.18); border-color: rgba(99, 102, 241, 0.55); color: #dfe3ff; }
.store-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.store-tab .dot.off { background: var(--muted-2); }

.seg { display: inline-flex; background: #0a1324; border: 1px solid var(--border); padding: 3px; border-radius: 10px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--muted); padding: 6px 11px;
  border-radius: 7px; font-size: 12px; font-weight: 600; transition: all 0.15s; white-space: nowrap;
}
.seg button:hover { color: #e3eaf7; }
.seg button.active { background: var(--surface-3); color: #fff; box-shadow: var(--shadow-sm); }

.select-inline { min-width: 160px; width: auto; max-width: 260px; }
.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .grow { flex: 1; min-width: 180px; }
.filter-bar .search { position: relative; }
.filter-bar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.filter-bar .search input { padding-left: 38px; }
.spacer { flex: 1; }

/* ==========================================================================
   Cards / KPI / tablas
   ========================================================================== */

.card {
  background: linear-gradient(180deg, rgba(19, 30, 53, 0.72), rgba(13, 21, 38, 0.82));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; font-weight: 700; letter-spacing: -0.1px; display: flex; align-items: center; gap: 8px; }
.card-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.card-head .icon { color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  position: relative; overflow: hidden; padding: 15px 16px;
  background: linear-gradient(160deg, rgba(19, 30, 53, 0.9), rgba(12, 20, 36, 0.9));
  border: 1px solid var(--border); border-radius: 14px;
}
.kpi::after { content: ""; position: absolute; right: -30px; top: -40px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, 0.14), transparent 70%); }
.kpi-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.kpi-icon { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: rgba(99, 102, 241, 0.14); color: var(--primary-2); flex: none; }
.kpi-value { margin-top: 10px; font-size: 22px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.6px; line-height: 1.1; }
.kpi-value.small { font-size: 17px; }
.kpi-sub { margin-top: 5px; font-size: 11px; color: var(--muted-2); }
.kpi.green .kpi-icon { background: rgba(16, 185, 129, 0.14); color: var(--success-2); }
.kpi.cyan .kpi-icon { background: rgba(34, 211, 238, 0.12); color: var(--accent); }
.kpi.amber .kpi-icon { background: rgba(245, 158, 11, 0.14); color: var(--warning); }
.kpi.rose .kpi-icon { background: rgba(244, 63, 94, 0.13); color: var(--danger-2); }
.kpi.violet .kpi-icon { background: rgba(139, 92, 246, 0.14); color: #a78bfa; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }

.table-wrap { overflow-x: auto; border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase;
  color: #7488aa; font-weight: 700; padding: 10px 12px; background: rgba(148, 163, 184, 0.04);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); color: #ccd8ea; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: rgba(99, 102, 241, 0.045); }
table.data .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data .actions .btn + .btn { margin-left: 4px; }
.cell-main { font-weight: 600; color: #e8eefa; }
.cell-sub { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.empty-cell { text-align: center; color: var(--muted-2); padding: 26px 12px !important; font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 10.5px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-green { background: rgba(16, 185, 129, 0.12); color: #4ade9f; border-color: rgba(16, 185, 129, 0.25); }
.badge-red { background: rgba(244, 63, 94, 0.12); color: #fda4af; border-color: rgba(244, 63, 94, 0.25); }
.badge-amber { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.25); }
.badge-cyan { background: rgba(34, 211, 238, 0.1); color: #67e8f9; border-color: rgba(34, 211, 238, 0.25); }
.badge-violet { background: rgba(139, 92, 246, 0.13); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.28); }
.badge-slate { background: rgba(148, 163, 184, 0.1); color: #b6c4dc; border-color: rgba(148, 163, 184, 0.22); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); animation: livePulse 1.8s infinite; display: inline-block; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); } 70% { box-shadow: 0 0 0 9px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

.chart-card { padding: 18px; }
.chart-wrap { position: relative; height: 218px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); font-size: 12px; pointer-events: none; }

.live-feed { display: flex; flex-direction: column; gap: 8px; max-height: 246px; overflow-y: auto; }
.feed-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  background: rgba(148, 163, 184, 0.035); border: 1px solid var(--border-soft);
}
.feed-item.new { animation: feedIn 0.5s ease both; border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.06); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.feed-avatar { width: 30px; height: 30px; border-radius: 9px; background: rgba(99, 102, 241, 0.18); color: #c7d2fe; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.feed-main { flex: 1; min-width: 0; }
.feed-main h5 { font-size: 12px; font-weight: 600; color: #e6edfa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-main p { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-amount { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--success-2); white-space: nowrap; }
.feed-time { font-size: 10px; color: var(--muted-2); white-space: nowrap; }

.presence-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.presence-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-soft); background: rgba(148,163,184,0.03); }
.presence-item .avatar { width: 30px; height: 30px; font-size: 11px; border-radius: 9px; }
.presence-main { flex: 1; min-width: 0; }
.presence-main h5 { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence-main p { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presence-state { font-size: 10px; color: var(--muted-2); text-align: right; white-space: nowrap; }
.presence-state strong { display: block; color: var(--success-2); font-size: 10px; font-weight: 700; }

.mini-list { display: flex; flex-direction: column; gap: 9px; }
.mini-row { display: flex; align-items: center; gap: 10px; }
.mini-row .rank { width: 20px; height: 20px; border-radius: 6px; background: rgba(148,163,184,0.08); color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.mini-row .rank.top { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.mini-row .bar-wrap { flex: 1; min-width: 0; }
.mini-row .bar-label { display: flex; justify-content: space-between; font-size: 11.5px; gap: 8px; margin-bottom: 4px; }
.mini-row .bar-label span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .bar-label b { font-family: var(--mono); font-weight: 600; color: #d8e2f2; }
.bar { height: 5px; border-radius: 20px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.empty-state { text-align: center; color: var(--muted-2); padding: 26px 10px; font-size: 12px; }
.empty-state .icon { opacity: 0.4; margin-bottom: 8px; }
.empty-state p { max-width: 320px; margin: 0 auto; }

/* ==========================================================================
   POS
   ========================================================================== */

.pos-view { display: grid; grid-template-columns: minmax(0, 1.62fr) 390px; gap: 16px; height: calc(100vh - 182px); min-height: 540px; }
.pos-catalog { display: flex; flex-direction: column; min-height: 0; padding: 16px; }
.pos-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pos-search { position: relative; flex: 1; min-width: 220px; }
.pos-search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.pos-search input { padding-left: 42px; height: 44px; font-size: 14px; }
.pos-store { min-width: 190px; }
.pos-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 11.5px; color: var(--muted); }
.pos-meta .sep { color: var(--border); }
.pos-meta strong { color: #dbe5f6; font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; margin-bottom: 12px; scrollbar-width: thin; }
.chip {
  border: 1px solid var(--border); background: rgba(148, 163, 184, 0.04); color: var(--muted);
  padding: 5px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: all 0.15s;
}
.chip:hover { color: #fff; border-color: #334a72; }
.chip.active { background: rgba(34, 211, 238, 0.13); border-color: rgba(34, 211, 238, 0.45); color: #a5f3fc; }

.product-grid {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); align-content: start;
  padding-right: 3px;
}
.product-card {
  position: relative; text-align: left; padding: 12px; border-radius: 12px;
  background: linear-gradient(165deg, rgba(26, 39, 67, 0.75), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--border); color: var(--text);
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 6px; min-height: 118px;
}
.product-card:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(99, 102, 241, 0.55); box-shadow: 0 12px 26px -14px rgba(99, 102, 241, 0.6); }
.product-card:active:not(:disabled) { transform: translateY(0); }
.product-card:disabled { opacity: 0.45; cursor: not-allowed; }
.product-card .pc-cat { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--accent); font-weight: 700; }
.product-card h4 { font-size: 12.8px; font-weight: 600; line-height: 1.3; color: #edf2fb; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .pc-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-card .pc-price { font-family: var(--mono); font-weight: 700; font-size: 15px; color: #fff; }
.product-card .pc-stock { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.product-card .pc-stock.low { color: var(--warning); }
.product-card .pc-stock.out { color: var(--danger-2); }
.product-card .pc-add { position: absolute; right: 9px; top: 9px; width: 22px; height: 22px; border-radius: 7px; background: rgba(99, 102, 241, 0.2); color: #c7d2fe; display: grid; place-items: center; }
.product-card .pc-code { font-size: 9.5px; color: var(--muted-2); font-family: var(--mono); }

.cart { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.cart-head { padding: 15px 16px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-head h3 { font-size: 14px; font-weight: 700; }
.cart-head p { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.cart-lines { flex: 1; min-height: 120px; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.cart-line { display: flex; gap: 9px; align-items: flex-start; padding: 9px; border-radius: 10px; background: rgba(148, 163, 184, 0.035); border: 1px solid var(--border-soft); }
.cart-line .cl-main { flex: 1; min-width: 0; }
.cart-line h5 { font-size: 12px; font-weight: 600; line-height: 1.25; color: #e8eefa; }
.cart-line p { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.cart-line .cl-total { font-family: var(--mono); font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; }
.qty-box { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; background: #0a1324; border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.qty-box button { width: 22px; height: 22px; border: none; background: transparent; color: var(--muted); border-radius: 5px; display: grid; place-items: center; }
.qty-box button:hover { background: var(--surface-3); color: #fff; }
.qty-box input { width: 46px; height: 22px; border: none; background: transparent; text-align: center; font-family: var(--mono); font-size: 11.5px; padding: 0; box-shadow: none; }
.qty-box input:focus { box-shadow: none; background: transparent; }
.cart-line .remove { border: none; background: transparent; color: var(--muted-2); padding: 3px; border-radius: 5px; }
.cart-line .remove:hover { color: var(--danger-2); background: rgba(244, 63, 94, 0.1); }
.cart-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted-2); padding: 24px; }
.cart-empty .icon { opacity: 0.3; margin-bottom: 10px; }
.cart-empty p { font-size: 12px; max-width: 220px; }
.cart-foot { border-top: 1px solid var(--border-soft); padding: 12px 14px 14px; background: rgba(8, 14, 26, 0.55); }
.cart-inputs { display: grid; gap: 7px; margin-bottom: 10px; }
.cart-inputs input { height: 35px; font-size: 12px; padding: 7px 10px; }
.cart-inputs .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.totals { display: flex; flex-direction: column; gap: 5px; padding: 10px 0 4px; }
.total-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.total-row span:last-child { font-family: var(--mono); color: #cbd6e8; }
.total-row.discount span:last-child { color: var(--warning); }
.total-row.grand { font-size: 15px; color: #fff; font-weight: 700; padding-top: 8px; margin-top: 3px; border-top: 1px dashed var(--border); }
.total-row.grand span:last-child { font-size: 22px; color: #fff; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 9px 0; }
.pay-btn { border: 1px solid var(--border); background: rgba(148, 163, 184, 0.035); color: var(--muted); border-radius: 9px; padding: 8px 5px; font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.15s; }
.pay-btn:hover { color: #fff; border-color: #334a72; }
.pay-btn.active { background: rgba(99, 102, 241, 0.16); border-color: rgba(99, 102, 241, 0.55); color: #dde2ff; }
.btn-charge { width: 100%; padding: 13px; font-size: 14.5px; border-radius: 11px; }
.pos-today { display: flex; gap: 12px; font-size: 10.5px; color: var(--muted-2); }
.pos-today b { font-family: var(--mono); color: var(--success-2); }

/* ==========================================================================
   Modales / toasts / ticket
   ========================================================================== */

.modal-root:empty { display: none; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(3, 7, 15, 0.72);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade 0.16s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, #121d32, #0c1424); border: 1px solid #2a3c5f;
  border-radius: 18px; box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal.lg { max-width: 720px; }
.modal.sm { max-width: 420px; }
.modal.xl { max-width: 900px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border-soft); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.modal-close { border: 1px solid var(--border); background: transparent; color: var(--muted); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.modal-close:hover { color: #fff; background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.4); }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 0 20px 18px; flex-wrap: wrap; }
.modal-footer.between { justify-content: space-between; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section + .form-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.form-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #8fa2c2; margin-bottom: 11px; }
.help { font-size: 11px; color: var(--muted-2); line-height: 1.45; }
.help.warn { color: #fbbf24; }
.divider { height: 1px; background: var(--border-soft); margin: 16px 0; }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 250px; max-width: 380px;
  background: #111c31; border: 1px solid #2a3c5f; border-radius: 12px; padding: 11px 14px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.9); font-size: 12.5px; color: #dfe8f7;
  animation: toastIn 0.24s ease both; pointer-events: auto;
}
.toast.hide { animation: toastOut 0.2s ease both; }
.toast .icon { margin-top: 1px; }
.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.success .icon { color: var(--success-2); }
.toast.error { border-color: rgba(244, 63, 94, 0.45); }
.toast.error .icon { color: var(--danger-2); }
.toast.info .icon { color: var(--accent); }
.toast strong { display: block; font-size: 12.5px; margin-bottom: 1px; }
.toast p { color: var(--muted); font-size: 11.5px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(14px); } }

.receipt-preview { background: #f8fafc; color: #0b1220; border-radius: 12px; padding: 18px; max-height: 56vh; overflow-y: auto; }
.ticket { width: 300px; max-width: 100%; margin: 0 auto; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: #111827; }
.ticket.center { text-align: center; }
.ticket h2 { font-size: 15px; letter-spacing: 0.4px; margin-bottom: 2px; text-transform: uppercase; }
.ticket .t-sub { font-size: 9.5px; color: #4b5563; }
.ticket .t-sep { border-top: 1px dashed #9ca3af; margin: 9px 0; }
.ticket table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.ticket th { text-align: left; font-size: 9px; text-transform: uppercase; color: #4b5563; padding: 2px 0; border-bottom: 1px dashed #9ca3af; }
.ticket th.r, .ticket td.r { text-align: right; }
.ticket td { padding: 3px 0; vertical-align: top; }
.ticket .t-row { display: flex; justify-content: space-between; gap: 8px; }
.ticket .t-row.total { font-size: 14px; font-weight: 700; padding-top: 5px; margin-top: 4px; border-top: 1px dashed #6b7280; }
.ticket .t-small { font-size: 9px; color: #4b5563; }
.ticket .t-folio { font-size: 10px; letter-spacing: 0.6px; }
.ticket .t-footer { margin-top: 10px; font-size: 10px; }

.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.sale-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.summary-cell { padding: 9px 11px; border-radius: 9px; background: rgba(148, 163, 184, 0.04); border: 1px solid var(--border-soft); }
.summary-cell span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted-2); margin-bottom: 3px; }
.summary-cell b { font-size: 12.5px; font-weight: 600; color: #e5ecf9; }

.print-area { display: none; }

/* ==========================================================================
   Utilidades de tabla / estados
   ========================================================================== */

.stock-pill { font-family: var(--mono); font-weight: 700; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; display: inline-block; }
.stock-ok { color: var(--success-2); background: rgba(16, 185, 129, 0.1); }
.stock-low { color: #fbbf24; background: rgba(245, 158, 11, 0.12); }
.stock-out { color: #fda4af; background: rgba(244, 63, 94, 0.12); }
.stock-na { color: var(--muted-2); background: rgba(148, 163, 184, 0.08); }

.role-chip { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; }
.online-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--success-2); font-weight: 600; }
.online-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
.offline-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted-2); }
.offline-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }

.store-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.store-card { padding: 17px; position: relative; }
.store-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.store-card .addr { font-size: 11.5px; color: var(--muted); min-height: 16px; }
.store-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 12px; }
.store-stat { padding: 8px; border-radius: 9px; background: rgba(148, 163, 184, 0.04); border: 1px solid var(--border-soft); text-align: center; }
.store-stat b { display: block; font-family: var(--mono); font-size: 13px; color: #e8eefa; }
.store-stat span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted-2); }
.store-card .card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.store-card.inactive { opacity: 0.65; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--muted); font-size: 13px; }
.loading .spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
.skeleton { background: linear-gradient(90deg, rgba(148,163,184,0.06) 25%, rgba(148,163,184,0.11) 37%, rgba(148,163,184,0.06) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.banner {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border-radius: 11px;
  border: 1px solid rgba(34, 211, 238, 0.25); background: rgba(34, 211, 238, 0.06);
  font-size: 12px; color: #b6e8f2; margin-bottom: 16px;
}
.banner.warn { border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.07); color: #fde68a; }
.banner.danger { border-color: rgba(244, 63, 94, 0.32); background: rgba(244, 63, 94, 0.07); color: #fecdd3; }
.banner .icon { flex: none; margin-top: 1px; }
.banner strong { color: #fff; }
.banner p { margin-top: 2px; color: inherit; opacity: 0.9; }

.chip-soft { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 20px; background: rgba(148,163,184,0.07); border: 1px solid var(--border-soft); font-size: 10.5px; color: var(--muted); }

.sidebar-overlay { display: none; }

/* ==========================================================================
   Checador, caja, compras y traspasos
   ========================================================================== */

.shift-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: 20px; border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08); color: #6ee7b7; font-size: 11.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: filter 0.15s, background 0.15s;
}
.shift-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.shift-chip:not(.on) { border-color: var(--border); background: rgba(148, 163, 184, 0.06); color: var(--muted); }
.shift-chip:not(.on) .dot { background: var(--muted-2); }
.shift-chip:hover { filter: brightness(1.18); }

.cash-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 11px; border: 1px dashed rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.06); margin-bottom: 14px; font-size: 12px; color: #fde68a;
}
.cash-banner > div { display: flex; align-items: center; gap: 10px; }
.cash-banner strong { color: #fff; }
.cash-banner p { color: inherit; opacity: 0.85; margin-top: 1px; }
.cash-banner.open { border-color: rgba(16, 185, 129, 0.33); background: rgba(16, 185, 129, 0.06); color: #a7f3d0; }
.cash-current { margin-bottom: 14px; }

.shift-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.shift-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border-soft); border-radius: 11px; background: rgba(148, 163, 184, 0.03);
}
.shift-card-main { flex: 1; min-width: 0; }
.shift-card-main h5 { font-size: 12.5px; }
.shift-card-main p { font-size: 10.5px; color: var(--muted); }
.shift-card-time { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.shift-card-time b { font-family: var(--mono); font-size: 13px; }

.line-editor { border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px; background: rgba(148, 163, 184, 0.03); }
.line-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.line-editor-head strong { font-size: 12px; color: #dbe5f6; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 100px 90px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.line-row select, .line-row input { height: 34px; }
.line-amount { font-family: var(--mono); font-size: 12px; color: #dbe5f6; text-align: right; white-space: nowrap; }
.line-totals {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  padding: 10px 12px; border-radius: 10px; background: rgba(129, 140, 248, 0.08);
  border: 1px solid rgba(129, 140, 248, 0.2); font-size: 12px; color: var(--muted);
}
.line-totals b { font-family: var(--mono); font-size: 16px; color: #fff; }

.transfer-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.transfer-arrow { display: grid; place-items: center; color: var(--accent); }

.count-input { width: 90px; height: 30px; text-align: right; font-family: var(--mono); font-weight: 700; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1500px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1240px) {
  .pos-view { grid-template-columns: minmax(0, 1.4fr) 350px; }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,0.6); }
  .sidebar.open { transform: none; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(3,7,15,0.6); z-index: 35; backdrop-filter: blur(3px); }
  .menu-btn { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pos-view { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .pos-catalog { min-height: 480px; }
  .cart { min-height: 480px; }
  .view-root { padding: 16px; }
}
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .topbar-chip, .clock { display: none; }
  .topbar-title h2 { font-size: 15px; }
  .page-head h1 { font-size: 20px; }
  .pos-view { display: flex; flex-direction: column; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; max-width: 100%; }
  .modal-footer .btn { flex: 1; }
  .receive-options { grid-template-columns: repeat(2, 1fr) !important; }
  .store-stats { grid-template-columns: repeat(3, 1fr); }
  .sale-summary { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: minmax(0, 1fr) 64px 84px 30px; }
  .line-row .line-amount { display: none; }
  .shift-list { grid-template-columns: 1fr; }
  .transfer-route { grid-template-columns: 1fr; }
  .transfer-arrow { transform: rotate(90deg); }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .pos-meta { display: none; }
  .toast-root { left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .login-card { padding: 28px 20px 20px; }
}

/* ==========================================================================
   Precios por sucursal y cotizaciones
   ========================================================================== */

.row-link { cursor: pointer; }
.row-link:hover { background: rgba(99, 102, 241, 0.07); }

.price-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 10px; }
.price-summary .summary-cell b { font-size: 14px; }
.price-table td { vertical-align: middle; }
.price-table td:first-child { min-width: 150px; white-space: nowrap; }
.price-input { width: 120px; text-align: right; height: 36px; }

.quote-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.quote-add-row select { flex: 1; }
.quote-lines td { vertical-align: top; }
.quote-lines .cell-main { font-size: 12.5px; }
.quote-desc { width: 100%; margin-top: 6px; height: 31px; font-size: 11.5px; padding: 5px 8px; }
.quote-qty { width: 78px; text-align: right; }
.quote-price { width: 105px; text-align: right; }
.quote-line-total { font-family: var(--mono); white-space: nowrap; padding-top: 13px !important; }
.quote-total-box { display: flex; justify-content: flex-end; align-items: flex-start; gap: 22px; margin-top: 14px; }
.quote-discount-row { min-width: 170px; }
.quote-discount-row input { height: 36px; }
.quote-total-box .totals { min-width: 270px; padding-top: 0; }
.quote-total-box .total-row.grand span:last-child { font-size: 20px; }
.quote-status-select { height: 38px; max-width: 160px; }
.quote-preview-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.quote-preview-wrap { background: #dfe3ea; border-radius: 12px; padding: 16px; max-height: 58vh; overflow: auto; }

.quote-sheet {
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  padding: 0.55in 0.58in;
  background: #fff;
  color: #172033;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.q-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.q-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.q-logo { width: 132px; height: auto; object-fit: contain; flex: none; }
.q-company { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; color: #4b5563; }
.q-company strong { font-size: 14px; color: #111827; letter-spacing: 0.2px; }
.q-doc { text-align: right; border-left: 3px solid #b91c1c; padding-left: 16px; flex: none; }
.q-doc-kicker { display: block; font-size: 10px; letter-spacing: 3px; color: #b91c1c; font-weight: 800; }
.q-doc strong { display: block; font-size: 18px; color: #111827; font-family: var(--mono); margin: 3px 0 2px; }
.q-doc span:last-child { font-size: 10.5px; color: #6b7280; }
.q-rule { height: 3px; background: linear-gradient(90deg, #b91c1c 0 30%, #111827 30% 100%); margin: 16px 0 22px; border-radius: 2px; }
.q-title h1 { font-size: 23px; line-height: 1.2; color: #111827; letter-spacing: -0.3px; margin-bottom: 6px; }
.q-valid { font-size: 10.5px; color: #b91c1c; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.q-intro { margin-top: 10px; color: #374151; font-size: 12px; white-space: pre-line; max-width: 6.9in; }
.q-parties { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; margin: 22px 0 20px; }
.q-panel { border: 1px solid #e5e7eb; border-top: 3px solid #b91c1c; background: #fafafa; border-radius: 4px; padding: 12px 14px; font-size: 11px; color: #4b5563; display: flex; flex-direction: column; gap: 3px; }
.q-panel-alt { border-top-color: #111827; }
.q-panel-title { font-size: 9px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: #9ca3af; margin-bottom: 4px; }
.q-panel strong { font-size: 13px; color: #111827; }
.q-panel p { margin: 0; color: #374151; }
.q-detail { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed #e5e7eb; padding: 3px 0; }
.q-detail:last-child { border-bottom: 0; }
.q-detail span { color: #6b7280; }
.q-detail b { color: #111827; font-weight: 600; }
.q-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.q-table thead th { background: #111827; color: #fff; font-size: 9px; letter-spacing: 0.8px; text-transform: uppercase; padding: 8px 7px; text-align: left; }
.q-table thead th:first-child { border-radius: 4px 0 0 4px; }
.q-table thead th:last-child { border-radius: 0 4px 4px 0; }
.q-table td { padding: 8px 7px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.q-table tbody tr:nth-child(even) { background: #fafafa; }
.q-table td strong { font-size: 11.5px; color: #111827; }
.q-num { width: 34px; color: #9ca3af; font-family: var(--mono); }
.q-code { width: 70px; color: #6b7280; font-family: var(--mono); font-size: 9.5px; }
.q-right { text-align: right; white-space: nowrap; }
.q-center { text-align: center; }
.q-strong { font-weight: 700; color: #111827; }
.q-sub { font-size: 9.5px; color: #6b7280; margin-top: 2px; }
.q-empty { text-align: center; color: #9ca3af; padding: 20px !important; }
.q-close { display: grid; grid-template-columns: 1fr 300px; gap: 22px; margin-top: 18px; align-items: start; }
.q-terms h4 { font-size: 9.5px; letter-spacing: 1.2px; text-transform: uppercase; color: #b91c1c; margin-bottom: 6px; }
.q-terms ul { margin: 0 0 10px 16px; padding: 0; color: #374151; font-size: 10.5px; }
.q-terms li { margin-bottom: 4px; }
.q-terms p { font-size: 10.5px; color: #374151; white-space: pre-line; }
.q-note { margin-top: 2px; }
.q-muted { color: #9ca3af; }
.q-totals { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; }
.q-total-row { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: #4b5563; padding: 4px 0; }
.q-total-row span:last-child { font-family: var(--mono); color: #111827; }
.q-discount span:last-child { color: #b45309; }
.q-grand { border-top: 2px solid #111827; margin-top: 6px; padding-top: 8px; font-size: 13px; font-weight: 800; color: #111827; }
.q-grand span:last-child { font-size: 19px; }
.q-tax-note { margin-top: 6px; font-size: 8.5px; color: #9ca3af; text-align: right; }
.q-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 46px; }
.q-sign { text-align: center; font-size: 10.5px; color: #374151; }
.q-sign-line { display: block; height: 1px; background: #9ca3af; margin-bottom: 6px; }
.q-sign small { color: #9ca3af; font-size: 9px; }
.q-sign-area { height: 52px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 4px; }
.q-sign-img { max-height: 50px; max-width: 100%; object-fit: contain; }
.q-legal { margin-top: 26px; padding-top: 10px; border-top: 1px solid #e5e7eb; font-size: 8.5px; color: #9ca3af; text-align: center; }

.sig-section { margin-top: 16px; border-top: 1px solid #e5e7eb; padding-top: 14px; }
.sig-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.sig-section-head strong { font-size: 13px; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sig-box { border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 10px 10px; background: #fafafa; }
.sig-box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-2, #4b5563); }
.sig-box-head .btn { height: 26px; padding: 0 8px; font-size: 11px; }
.sig-canvas { display: block; width: 100%; background: #fff; border: 1px dashed #cbd5e1; border-radius: 7px; touch-action: none; cursor: crosshair; }
@media (max-width: 700px) { .sig-grid { grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  .price-summary { grid-template-columns: repeat(2, 1fr); }
  .quote-total-box { flex-direction: column; align-items: stretch; }
  .quote-total-box .totals { min-width: 0; }
  .quote-preview-wrap { padding: 8px; }
}

/* ==========================================================================
   Impresión de tickets
   ========================================================================== */

@media print {
  @page { size: 80mm auto; margin: 4mm; }
  html, body { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; }
  body > *:not(#printArea) { display: none !important; }
  .print-area { display: block !important; }
  .print-area .ticket { width: 72mm; margin: 0; color: #000; font-size: 10.5px; }
  .print-area .ticket h2 { font-size: 14px; }
  .print-area .ticket .t-sub, .print-area .ticket .t-small { color: #333; }
  .print-area .ticket .t-sep { border-top: 1px dashed #777; }
  .print-area .ticket table { font-size: 10px; }
  .print-area .ticket th { color: #333; border-bottom: 1px dashed #777; }
  .print-area .ticket th, .print-area .ticket td { padding: 2px 0; }

  .print-area .quote-sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    font-size: 10.5px;
  }
  .print-area .quote-sheet .q-head,
  .print-area .quote-sheet .q-parties,
  .print-area .quote-sheet .q-table tr,
  .print-area .quote-sheet .q-terms,
  .print-area .quote-sheet .q-signatures { break-inside: avoid; page-break-inside: avoid; }
  .print-area .quote-sheet .q-table thead { display: table-header-group; }
  .print-area .quote-sheet a { color: inherit; text-decoration: none; }
}

@page {
  size: letter portrait;
  margin: 12mm;
}
