/* ============ Sistema de diseño — Mi Tienda POS ============ */
:root {
  --c-bg: #f4f6f8;
  --c-surface: #ffffff;
  --c-border: #dde3ea;
  --c-text: #1c2733;
  --c-muted: #64748b;
  --c-primary: #0d7a4f;
  --c-primary-dark: #0a5f3e;
  --c-primary-light: #e6f4ee;
  --c-accent: #1d6fd1;
  --c-danger: #d13d3d;
  --c-danger-light: #fdecec;
  --c-warn: #b97a08;
  --c-warn-light: #fdf3dd;
  --c-cold: #1d8fd1;
  --c-cold-light: #e3f2fb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 30, 46, .1);
  --shadow-lg: 0 8px 30px rgba(16, 30, 46, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.45;
}
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 10px; }
a { color: var(--c-accent); text-decoration: none; }
.muted { color: var(--c-muted); }
small.muted { font-weight: normal; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #123527;
  color: #fff;
  padding: 0 12px;
  min-height: 54px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}
.topbar-brand { font-weight: 700; font-size: 1.05rem; margin-right: 8px; white-space: nowrap; }
.topbar-nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cfe3d8;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: .95rem;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.active { background: var(--c-primary); color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 6px; }
.user-name { font-size: .9rem; color: #cfe3d8; }

/* ---------- Contenido ---------- */
.main { padding: 18px; max-width: 1280px; margin: 0 auto; }
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  transition: background .12s, transform .05s;
}
.btn:hover { background: #eef2f6; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #b53232; }
.btn-cold { background: var(--c-cold); border-color: var(--c-cold); color: #fff; }
.btn-cold:hover { background: #1679b3; }
.btn-warn { background: var(--c-warn); border-color: var(--c-warn); color: #fff; }
.btn-outline { background: transparent; border-color: var(--c-primary); color: var(--c-primary); }
.btn-sm { padding: 5px 10px; font-size: .875rem; border-radius: 8px; }
.btn-lg { padding: 15px 22px; font-size: 1.15rem; }
.btn-xl { padding: 20px 26px; font-size: 1.4rem; font-weight: 600; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .9rem; color: var(--c-muted); margin-bottom: 4px; }
.input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--c-text);
}
.input:focus { outline: 2px solid var(--c-primary); outline-offset: -1px; border-color: var(--c-primary); }
.input-lg { padding: 14px 16px; font-size: 1.2rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.form-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--c-muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--c-border);
}
.table td { padding: 10px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #f8fafb; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }

/* ---------- Badges y avisos ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  font-size: .8rem;
  border-radius: 99px;
  background: #e5e9ee;
  color: var(--c-muted);
  font-weight: 600;
}
.badge-ok { background: var(--c-primary-light); color: var(--c-primary-dark); }
.badge-danger { background: var(--c-danger); color: #fff; }
.badge-warn { background: var(--c-warn-light); color: var(--c-warn); }
.badge-cold { background: var(--c-cold-light); color: var(--c-cold); }
.flash {
  max-width: 1280px;
  margin: 12px auto 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 500;
}
.flash-ok { background: var(--c-primary-light); color: var(--c-primary-dark); }
.flash-error { background: var(--c-danger-light); color: var(--c-danger); }
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #1c2733;
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 1rem;
  opacity: 0;
  transition: all .25s;
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--c-danger); }

/* ---------- Modales ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 30, .55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--c-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-box h2 { margin-top: 0; }
.modal-box.modal-wide { max-width: 680px; }

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #123527, #0d7a4f);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.login-title { text-align: center; margin: 0 0 20px; font-size: 1.4rem; }

/* ---------- Utilidades ---------- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.big-money { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.danger-text { color: var(--c-danger); font-weight: 600; }
.ok-text { color: var(--c-primary-dark); font-weight: 600; }

@media (max-width: 700px) {
  .nav-label { display: none; }
  .nav-link { padding: 8px; font-size: 1.1rem; }
  .main { padding: 10px; }
  .topbar-brand { display: none; }
}

/* ---------- Scanner Overlay (cámara en escanear y en modal de registro) ---------- */
.scan-video-container {
  position: relative;
  width: 100%;
  max-height: 55vh;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-video-container video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}
.scan-target-box {
  width: 70%;
  height: 35%;
  border: 3px solid #0d7a4f; /* Green target border for positive brand styling */
  border-radius: 8px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); /* Dims the outside of the scan area */
}
.scan-target-box::before {
  content: '';
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 12px;
}
.scan-laser-line {
  position: absolute;
  width: 70%;
  height: 3px;
  background-color: #ff3b30;
  box-shadow: 0 0 8px #ff3b30, 0 0 2px #ffffff;
  animation: laser-scan 2.2s infinite ease-in-out;
  border-radius: 99px;
  z-index: 15;
}
@keyframes laser-scan {
  0% { top: 32.5%; }
  50% { top: 67.5%; }
  100% { top: 32.5%; }
}

