/* =========================================================
   ALPHATRACK — Design System (réplica imagen referencia)
   Dark mode · Blue accent · Dot grid · Soft radii · Responsive
   ========================================================= */

:root {
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --surface-3: #1a1a1a;
  --border: #222222;
  --border-soft: #1c1c1c;
  --text: #ffffff;
  --text-muted: #888888;
  --text-dim: #666666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --accent-glow: rgba(37, 99, 235, 0.35);
  --warning: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --topbar-h: 72px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --transition: all 0.3s ease-in-out;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ocultar barras de scroll (sigue pudiendo hacer scroll) */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* Dot grid background */
.dot-grid {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.app-shell.no-sidebar .main-wrap {
  margin-left: 0;
  width: 100%;
}

.main-wrap {
  flex: 1;
  margin-left: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: visible;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}

.topbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.topbar-brand img {
  display: block;
  height: 26px;
  width: auto;
  max-width: 150px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.top-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.top-nav-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.top-nav-item:hover {
  color: var(--text);
}

.top-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.35);
}

.topbar-titles { min-width: 0; }
.breadcrumb { color: var(--text-dim); font-size: 12px; }
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: visible;
  flex-shrink: 0;
}

.mobile-only { display: none !important; }

.brand-login {
  display: flex;
  justify-content: center;
  padding: 0 0 12px;
  min-height: auto;
  visibility: visible;
}

.brand-login .brand-logo-full {
  width: 220px;
  height: auto;
  display: block;
  opacity: 1;
  visibility: visible;
}

.brand-login .brand-logo-mark {
  display: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  max-width: 220px;
}

.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1;
  padding: 24px 28px 40px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: #444; background: var(--surface); }

.btn-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); border-color: transparent; }
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Notification bell — círculo azul + campana + badge rojo */
.notif-wrap {
  position: relative;
  overflow: visible;
}

.notif-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: visible;
  box-shadow: 0 0 0 3px var(--accent-soft);
  transition: var(--transition);
}

.notif-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.notif-btn:active {
  transform: scale(0.96);
}

.notif-icon {
  width: 18px;
  height: 18px;
  fill: #fff;
  stroke: none;
  display: block;
}

.notif-btn.has-alerts .notif-icon {
  animation: bellShake 0.55s ease-in-out;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
  pointer-events: none;
  z-index: 2;
}

@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(12deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(6deg); }
  80% { transform: rotate(-4deg); }
}

/* ---------- Cards / panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover { border-color: #2a2a2a; }

.hero-card h2 { font-size: 20px; margin-bottom: 6px; }
.hero-card p { color: var(--text-muted); max-width: 520px; }

.layout-split {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
}
.metric-card:hover {
  transform: translateY(-3px);
  border-color: #333;
  box-shadow: var(--shadow);
}
.metric-card .label { color: var(--text-muted); font-size: 12px; margin-bottom: 8px; }
.metric-card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }

.search-bar {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  outline: none;
  transition: var(--transition);
  margin: 12px 0 16px;
}
.search-bar:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.empty-state {
  min-height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.side-panel { display: flex; flex-direction: column; gap: 16px; }

.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.finance-row:last-child { border-bottom: none; }
.finance-row .label { color: var(--text-muted); }
.finance-row .amount { font-weight: 700; }
.finance-row .amount.warn { color: var(--warning); }

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}

.filter-group { margin-bottom: 16px; }
.filter-group label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.select-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  appearance: none;
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.select-input:focus { border-color: var(--accent); }

.pill-group {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  isolation: isolate;
}

.pill-bubble {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  width: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translateX(0);
  transition: transform 0.3s ease-in-out, width 0.3s ease-in-out, opacity 0.2s ease-in-out;
  will-change: transform, width;
}

.pill-bubble.is-ready {
  opacity: 1;
}

.pill-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.3s ease-in-out;
}

.pill-btn:hover { color: var(--text); }

.pill-btn.active {
  color: var(--accent);
  background: transparent;
  border-color: transparent;
}

/* ---------- Products grid ---------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: #333;
  box-shadow: var(--shadow);
}
.product-card:hover .product-actions { opacity: 1; transform: translateY(0); }

.product-img {
  height: 140px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  overflow: hidden;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img.no-image {
  background:
    radial-gradient(circle at 50% 45%, rgba(37, 99, 235, 0.12), transparent 60%),
    var(--surface-3);
}
.product-img-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px dashed #444;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}
.product-img-placeholder svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.product-body { padding: 14px; }
.product-body h3 { font-size: 15px; margin-bottom: 6px; }
.product-meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 13px; }
.product-price { color: var(--text); font-weight: 700; }
.product-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-6px);
  transition: var(--transition);
}
.product-actions .btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.7); border-color: var(--border); }

/* ---------- Orders list ---------- */
.orders-list { display: flex; flex-direction: column; gap: 10px; }

.order-row {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 80px 1.4fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
}
.order-row:hover {
  transform: translateY(-2px);
  border-color: #333;
  box-shadow: var(--shadow);
}
.order-id { color: var(--accent); font-weight: 700; }

.empleado-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.empleado-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.empleado-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font: inherit;
  min-height: 56px;
}

.empleado-pick:hover {
  border-color: #333;
  transform: translateY(-1px);
}

.empleado-pick.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}

.empleado-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.empleado-name {
  font-weight: 600;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.badge-pendiente { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-en_proceso { background: var(--accent-soft); color: var(--accent); }
.badge-entregado { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-cancelado { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-urgente { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-alta { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-normal { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-baja { background: rgba(255,255,255,0.04); color: var(--text-dim); }

/* ---------- Detalle pedido: acciones ---------- */
.detail-manage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.detail-action {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

.detail-action-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.detail-action-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.detail-estado-pills {
  width: 100%;
}

.detail-estado-pills .pill-btn {
  white-space: nowrap;
  font-size: 11px;
  padding: 8px 6px;
}

.detail-abono-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.detail-abono-field {
  margin: 0;
}

.detail-action-btn {
  align-self: stretch;
  min-height: 42px;
}

.detail-abono-row .detail-action-btn {
  align-self: end;
  padding-left: 18px;
  padding-right: 18px;
}

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  outline: none;
  transition: var(--transition);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 90px; resize: vertical; }

/* ---------- Modal + Wizard ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transform: translateY(16px) scale(0.97);
  transition: var(--transition);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-lg { width: min(920px, 100%); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
}

.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.wizard-steps::-webkit-scrollbar { display: none; }
.wizard-step {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
  cursor: default;
  font: inherit;
}
.wizard-step-num {
  display: none;
}
.wizard-step-lbl {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.wizard-step.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.wizard-step.done { color: var(--success); }
.wizard-progress {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-muted);
}
.wizard-progress strong {
  color: var(--text);
  font-weight: 700;
}

.wizard-pane {
  animation: fadeSlide 0.3s ease-in-out;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.client-results {
  margin-top: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.client-result {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: var(--transition);
}
.client-result:hover { background: var(--surface-2); }
.client-result.selected { background: var(--accent-soft); color: var(--accent); }

.wizard-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow: auto;
}
.wiz-prod {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface-2);
}
.wiz-prod:hover { transform: scale(1.02); border-color: #444; }
.wiz-prod.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.wiz-prod .qty {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wiz-prod .qty input {
  width: 56px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px;
  text-align: center;
}
.wizard-total {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  animation: fadeSlide 0.4s ease-in-out;
}
.login-card .brand-login { justify-content: center; padding-bottom: 8px; }
.login-card h1 {
  text-align: center;
  font-size: 22px;
  margin: 8px 0 6px;
}
.login-card .sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  width: 100%;
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 8px;
  transition: var(--transition);
}
.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle .hidden { display: none; }

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.sim-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
}
.sim-result.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.sim-result.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ---------- Resumen charts ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 300px;
}
.chart-box h3 { margin-bottom: 14px; font-size: 15px; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ---------- Dropdown notifications ---------- */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform-origin: top right;
  animation: fadeSlide 0.25s ease-in-out;
}
.notif-dropdown h4 {
  padding: 0;
  border-bottom: 0;
  font-size: 13px;
  margin: 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.notif-clear-all {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.notif-clear-all:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  transition: var(--transition);
  cursor: default;
}
.notif-item-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread {
  background: rgba(37, 99, 235, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}
.notif-item .t { font-size: 13px; font-weight: 600; }
.notif-item .s { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.notif-dismiss svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.notif-dismiss:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.2);
}
.notif-empty { padding: 20px; text-align: center; color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  min-width: 240px;
  box-shadow: var(--shadow);
  animation: fadeSlide 0.3s ease-in-out;
}

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.text-muted { color: var(--text-muted); }
.text-warn { color: var(--warning); }
.w-full { width: 100%; }

/* ---------- Configuración (admin) ---------- */
.config-page { max-width: 820px; }

.empleados-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empleado-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: var(--transition);
  flex-wrap: wrap;
}

.empleado-row.is-inactive {
  opacity: 0.55;
}

.empleado-row:hover {
  border-color: #333;
}

.empleado-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.empleado-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.empleado-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.empleado-actions {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.color-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
}

.color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.color-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.color-preset {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: var(--transition);
}

.color-preset:hover {
  transform: scale(1.15);
}

.color-preset.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .layout-split { grid-template-columns: 1fr 260px; }
}

@media (max-width: 1100px) {
  .layout-split { grid-template-columns: 1fr; }
  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .order-row {
    grid-template-columns: 70px 1.2fr 1fr auto;
  }
}

@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .btn-label { display: none; }
  .btn.btn-primary,
  .btn.btn-ghost { padding: 10px 12px; }
  .user-name { display: none; }
  .user-chip { padding: 4px; }
}

@media (max-width: 768px) {
  .content {
    padding: 14px 14px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    height: auto;
    min-height: 56px;
    gap: 10px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 200;
    --topbar-h: auto;
  }

  .notif-wrap {
    position: static;
  }

  .notif-dropdown {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    bottom: auto;
    width: auto;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  }

  .topbar-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-brand img {
    height: 22px;
    max-width: 120px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar { display: none; }

  .top-nav-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .top-nav-item span { display: none; }

  .topbar-titles { display: none; }

  .page-title { font-size: 20px; }
  .form-grid.two { grid-template-columns: 1fr; }

  .detail-abono-row {
    grid-template-columns: 1fr;
  }

  .detail-estado-pills {
    flex-wrap: wrap;
    border-radius: 16px;
  }

  .detail-estado-pills .pill-btn {
    flex: 1 1 calc(50% - 4px);
  }

  .topbar-right {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .metric-card .value { font-size: 22px; }
  .hero-card h2 { font-size: 18px; }

  .order-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .order-row .order-id { grid-column: 1 / -1; }

  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal,
  .modal-lg {
    width: 100%;
    max-height: 100%;
    min-height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .modal-header,
  .modal-footer {
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .modal-footer {
    flex-wrap: wrap;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .wizard-steps {
    gap: 6px;
    margin-bottom: 8px;
  }

  .wizard-step {
    min-width: 0;
    flex: 1 1 0;
    padding: 8px 2px;
    font-size: 10px;
  }

  .wizard-step-num {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    font-size: 13px;
    font-weight: 700;
  }

  .wizard-step.active .wizard-step-num {
    background: var(--accent);
    color: #fff;
  }

  .wizard-step.done .wizard-step-num {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
  }

  .wizard-step-lbl {
    display: none;
  }

  .wizard-progress {
    display: flex;
  }

  .wizard-products {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    max-height: none;
  }

  .empleado-pick-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .empleado-pick {
    padding: 14px 12px;
  }

  .search-input,
  input[placeholder*="Buscar"] {
    font-size: 16px;
  }

  .filters-bar input,
  .orders-toolbar input {
    font-size: 16px;
  }

  .toast-wrap {
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  .pill-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pill-btn {
    white-space: nowrap;
    flex: 1 0 auto;
  }

  .login-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .empleado-row {
    align-items: flex-start;
  }

  .empleado-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .color-picker-row {
    flex-wrap: wrap;
  }

  .chart-box {
    min-height: 240px;
    padding: 14px;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-card .value {
    font-size: 20px;
  }

  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .product-img { height: 110px; }

  .order-row {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .search-bar {
    font-size: 16px; /* evita zoom iOS */
  }

  .field input,
  .field textarea,
  .field select,
  .select-input {
    font-size: 16px;
  }

  .wizard-steps {
    display: flex;
    grid-template-columns: none;
  }

  .topbar-right .btn-ghost#btn-refresh {
    display: none;
  }

  .metrics-grid {
    gap: 10px;
  }

  .modal-footer {
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .modal,
  .modal-lg {
    min-height: 100%;
  }

  .login-screen {
    align-items: flex-start;
    padding: 16px;
  }
}
