:root {
  --pos-primary: #2f5fda;
  --pos-primary-dark: #1f3fa8;
  --pos-bg: #f4f6fb;
  --pos-sidebar: #121a2e;
  --pos-sidebar-active: #2f5fda;
  --pos-border: #e4e8f2;
  --pos-text-muted: #6b7280;
  --radius: 12px;
}

* { box-sizing: border-box; }
body { background: var(--pos-bg); font-family: 'Segoe UI', Roboto, -apple-system, sans-serif; color: #1f2430; }

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

.sidebar {
  width: 240px; background: var(--pos-sidebar); color: #fff; flex-shrink: 0;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030; transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.sidebar-brand { padding: 22px 20px; font-size: 1.15rem; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.sidebar-brand i { color: var(--pos-sidebar-active); font-size: 1.4rem; }
.sidebar-nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow-y: auto; }
.sidebar-nav a {
  color: #c3c9dc; text-decoration: none; padding: 11px 14px; border-radius: 10px;
  display: flex; align-items: center; gap: 12px; font-size: .93rem; font-weight: 500;
}
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--pos-sidebar-active); color: #fff; }

.main-col { margin-left: 240px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--pos-border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 1020;
}
.topbar-spacer { flex: 1; }
.btn-new-order { border-radius: 10px; font-weight: 600; padding: 8px 16px; }
.btn-icon {
  border: none; background: transparent; width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #444;
}
.btn-icon:hover { background: var(--pos-bg); }
.badge-dot {
  position: absolute; top: 4px; right: 4px; background: #e5484d; color: #fff;
  font-size: .62rem; min-width: 16px; height: 16px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; padding: 0 3px; font-weight: 700;
}
.btn-user { border: none; background: transparent; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; font-weight: 600; }
.btn-user:hover { background: var(--pos-bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--pos-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
}

.page-content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

.notif-panel { width: 340px; padding: 0; border-radius: 12px; overflow: hidden; }
.notif-header { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--pos-border); }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--pos-border); font-size: .85rem; }
.notif-item .title { font-weight: 600; }
.notif-item .time { font-size: .72rem; color: var(--pos-text-muted); }

/* ---------- Guest / login ---------- */
.guest-body { background: linear-gradient(135deg, #1f3fa8, #2f5fda 60%, #4d7bff); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.guest-card { background: #fff; border-radius: 18px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.guest-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.guest-card .subtitle { color: var(--pos-text-muted); margin-bottom: 24px; font-size: .9rem; }

/* ---------- Cards / tables ---------- */
.card { border: 1px solid var(--pos-border); border-radius: var(--radius); box-shadow: none; }
.stat-card { border-radius: var(--radius); padding: 18px 20px; background: #fff; border: 1px solid var(--pos-border); }
.stat-card .value { font-size: 1.7rem; font-weight: 800; }
.stat-card .label { color: var(--pos-text-muted); font-size: .82rem; font-weight: 600; }
.stat-card i { font-size: 1.3rem; opacity: .55; }

.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--pos-text-muted); border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }

.status-badge { padding: 5px 10px; border-radius: 20px; font-size: .74rem; font-weight: 700; display: inline-block; }
.status-pendiente_alistamiento { background: #fff3cd; color: #997404; }
.status-en_alistamiento { background: #cfe2ff; color: #084298; }
.status-despachado { background: #e2d9f3; color: #59359a; }
.status-entregado { background: #d1e7dd; color: #0f5132; }
.status-cancelado { background: #f8d7da; color: #842029; }

/* ---------- Catalog (touch-friendly cards) ---------- */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.product-card {
  background: #fff; border: 1px solid var(--pos-border); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow .15s ease, transform .15s ease;
}
.product-card:hover { box-shadow: 0 10px 24px rgba(31,63,168,.12); transform: translateY(-2px); }
.product-card .thumb { height: 130px; background: #eef1fa; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb i { font-size: 2.2rem; color: #b7c0dd; }
.product-card .body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card .name { font-weight: 700; font-size: .92rem; line-height: 1.25; }
.product-card .code { font-size: .72rem; color: var(--pos-text-muted); }
.product-card .price { font-size: 1.05rem; font-weight: 800; color: var(--pos-primary); margin-top: auto; }
.product-card .price .old { text-decoration: line-through; color: var(--pos-text-muted); font-size: .78rem; font-weight: 500; margin-left: 6px; }
.product-card .stock { font-size: .72rem; }
.product-card .stock.low { color: #b02a37; font-weight: 700; }
.product-card .add-row { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--pos-border); }
.qty-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--pos-border); background: #fff;
  font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.qty-input { width: 100%; text-align: center; border: 1px solid var(--pos-border); border-radius: 10px; height: 38px; font-weight: 700; }
.btn-add-cart {
  width: 100%; border: none; background: var(--pos-primary); color: #fff; border-radius: 10px;
  padding: 12px; font-weight: 700; font-size: .95rem;
}
.btn-add-cart:active { background: var(--pos-primary-dark); }

/* ---------- Cart / order builder ---------- */
.cart-panel { position: sticky; top: 84px; background: #fff; border: 1px solid var(--pos-border); border-radius: var(--radius); }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--pos-border); gap: 8px; }
.cart-item .name { font-weight: 600; font-size: .85rem; }
.cart-item .meta { font-size: .74rem; color: var(--pos-text-muted); }

/* ---------- Touch-friendly buttons everywhere ---------- */
.btn { border-radius: 10px; }
.btn-lg, .btn-touch { padding: 14px 22px; font-size: 1rem; font-weight: 700; border-radius: 12px; }

/* ---------- Timeline (order status history) ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--pos-border); }
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before { content: ''; position: absolute; left: -28px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--pos-primary); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--pos-primary); }
.timeline-item .status-name { font-weight: 700; }
.timeline-item .meta { font-size: .78rem; color: var(--pos-text-muted); }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
}
