/* Prototipo — Gestión de pedidos y cortes. Paleta propia (petróleo + grafito), tono claro y oscuro por usuario. */
:root {
  --p-50: #eef7f8; --p-100: #d5ecef; --p-200: #aedadf; --p-300: #7cc0c9; --p-400: #4aa2ae;
  --p-500: #2b8693; --p-600: #1f6d79; --p-700: #1b5963; --p-800: #194a52; --p-900: #173e45; --p-950: #0b2328;

  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --border: #e2e7e9;
  --border-strong: #c9d1d4;
  --text: #15201f;
  --text-2: #3e4b4d;
  --muted: #66757a;
  --primary: var(--p-600);
  --primary-hover: var(--p-700);
  --primary-soft: var(--p-50);
  --primary-text: var(--p-700);
  --on-primary: #ffffff;
  --ring: var(--p-500);
  --bar: var(--p-500);

  --ok-bg: #ecfdf3; --ok-text: #166534; --ok-ring: rgba(22, 101, 52, .2);
  --warn-bg: #fff8eb; --warn-text: #92400e; --warn-ring: rgba(146, 64, 14, .2);
  --err-bg: #fef2f2; --err-text: #b42318; --err-ring: rgba(180, 35, 24, .2);
  --info-bg: var(--p-50); --info-text: var(--p-700); --info-ring: rgba(31, 109, 121, .2);
  --off-bg: #eef1f2; --off-text: #556367; --off-ring: rgba(85, 99, 103, .2);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --radius: 10px;
  --radius-lg: 14px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #0d1416;
  --surface: #141d20;
  --surface-2: #192427;
  --border: #253235;
  --border-strong: #34454a;
  --text: #e7eeef;
  --text-2: #c3cfd1;
  --muted: #8fa0a4;
  --primary: var(--p-400);
  --primary-hover: var(--p-300);
  --primary-soft: rgba(74, 162, 174, .12);
  --primary-text: var(--p-300);
  --on-primary: #08191c;
  --ring: var(--p-400);
  --bar: var(--p-400);

  --ok-bg: rgba(34, 197, 94, .12); --ok-text: #86efac; --ok-ring: rgba(134, 239, 172, .25);
  --warn-bg: rgba(245, 158, 11, .12); --warn-text: #fcd34d; --warn-ring: rgba(252, 211, 77, .25);
  --err-bg: rgba(239, 68, 68, .12); --err-text: #fca5a5; --err-ring: rgba(252, 165, 165, .25);
  --info-bg: rgba(74, 162, 174, .14); --info-text: var(--p-300); --info-ring: rgba(124, 192, 201, .25);
  --off-bg: rgba(143, 160, 164, .12); --off-text: #a9b6b9; --off-ring: rgba(169, 182, 185, .25);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.hidden { display: none !important; }
[data-lucide], svg.lucide { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.i-20 { width: 20px !important; height: 20px !important; }
.i-32 { width: 32px !important; height: 32px !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
  transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--p-700); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; text-decoration: none; margin-bottom: 2px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.main { flex: 1; margin-left: 252px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.topbar .ctx { display: flex; flex-direction: column; min-width: 0; }
.topbar .ctx b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ctx span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn .dot {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: #d92d20; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center;
}
.hamburger { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--p-100); color: var(--p-800); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
[data-theme='dark'] .avatar { background: var(--p-800); color: var(--p-100); }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip .who b { font-size: 13px; }
.user-chip .who span { font-size: 11px; color: var(--muted); }

.content { padding: 24px; width: 100%; max-width: 1240px; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer { padding: 16px 24px 24px; font-size: 12px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; max-width: 1240px; margin: 0 auto; width: 100%; }

.bottom-nav { display: none; }
.scrim { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack > * + * { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer;
  white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--primary-text); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: transparent; color: var(--err-text); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 500; color: var(--text-2); font-size: 13px; }
.help { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--err-text); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.invalid { border-color: var(--err-text); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .prefix { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-wrap .input.has-prefix { padding-left: 28px; padding-right: 12px; }
.input-wrap .eye { position: absolute; right: 4px; }
.input-money { text-align: right; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.choice {
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; background: var(--surface);
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; user-select: none;
}
.choice .top { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.choice input[type='checkbox'], .choice input[type='radio'] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.choice.on { border-color: var(--ring); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--ring) inset; }
.choice .input { height: 38px; }
.choice.disabled { opacity: .55; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
[data-theme='dark'] .seg button.on { background: var(--border); }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn { border: 1px solid var(--border-strong); background: var(--surface); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--text-2); }
.pill-btn.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; white-space: nowrap; box-shadow: 0 0 0 1px var(--ring-c, transparent) inset; }
.b-ok { background: var(--ok-bg); color: var(--ok-text); --ring-c: var(--ok-ring); }
.b-warn { background: var(--warn-bg); color: var(--warn-text); --ring-c: var(--warn-ring); }
.b-err { background: var(--err-bg); color: var(--err-text); --ring-c: var(--err-ring); }
.b-info { background: var(--info-bg); color: var(--info-text); --ring-c: var(--info-ring); }
.b-off { background: var(--off-bg); color: var(--off-text); --ring-c: var(--off-ring); }
.badge svg { width: 12px; height: 12px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.notice svg { margin-top: 2px; }
.n-info { background: var(--info-bg); color: var(--info-text); }
.n-warn { background: var(--warn-bg); color: var(--warn-text); }
.n-err { background: var(--err-bg); color: var(--err-text); }
.n-ok { background: var(--ok-bg); color: var(--ok-text); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num, .table .right { text-align: right; }
.table tfoot td { font-weight: 600; background: var(--surface-2); }
.neg { color: var(--err-text); }
.pos { color: var(--ok-text); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .k-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.kpi .k-value { font-size: 24px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .ic { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; margin: 0 auto 12px; }
.empty b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }

.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--primary-text); border-bottom-color: var(--primary); }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.sum-line + .sum-line { border-top: 1px dashed var(--border); }
.sum-line.total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--border-strong) !important; padding-top: 10px; }
.letter { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 11px; font-weight: 700; margin-right: 6px; }

/* Dirección y Maps */
.maps-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.addr { line-height: 1.35; }
.addr small { display: block; color: var(--muted); }
.suggest { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; margin-top: 4px; box-shadow: var(--shadow-lg); z-index: 20; max-height: 260px; overflow-y: auto; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.on { background: var(--primary-soft); }

/* Tarjetas de pedido (móvil y tablero) */
.order-cards { display: none; }
.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.order-card + .order-card { margin-top: 12px; }
.order-card .oc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.order-card .oc-folio { font-weight: 700; font-family: var(--font-mono); }
.order-card .oc-amount { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.order-card .oc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.order-card .oc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Denominaciones */
.den-list { display: grid; gap: 6px; }
.den-row { display: grid; grid-template-columns: 1fr 96px 110px; align-items: center; gap: 10px; }
.den-row .den-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.den-row .input { height: 36px; text-align: center; font-size: 15px; }
.den-row .den-sub { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.den-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }

/* Barras */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 12px; font-size: 13px; position: relative; }
.bar-row .bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 22px; position: relative; }
.bar-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .3s ease; }
.bar-row .bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.bar-row:hover .bar-fill { filter: brightness(1.1); }
.bar-tip { position: absolute; left: 160px; top: -34px; background: var(--text); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5; }
.bar-row:hover .bar-tip { opacity: 1; }

/* Menús desplegables */
.dropdown { position: absolute; top: 52px; right: 16px; width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; }
.dropdown .dd-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dropdown .dd-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.dropdown .dd-item:hover { background: var(--surface-2); }
.dropdown .dd-item.unread { background: var(--primary-soft); }
.dropdown .dd-item:last-child { border-bottom: 0; }
.dropdown .dd-body { max-height: 380px; overflow-y: auto; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; text-decoration: none; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }

/* Ventanas */
.modal-back { position: fixed; inset: 0; background: rgba(9, 18, 20, .55); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 16px 16px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #10191b; color: #fff; padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; align-items: center; gap: 8px; opacity: 0; transition: all .2s; z-index: 120; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme='dark'] .toast { background: #e7eeef; color: #10191b; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 410px; }
.login-logo { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 20px; background: var(--p-700); color: #fff; display: grid; place-items: center; font-size: 30px; font-weight: 700; overflow: hidden; }
.login-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-title { text-align: center; margin-bottom: 22px; }
.login-title h1 { font-size: 20px; }
.login-title p { margin: 4px 0 0; color: var(--muted); }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.demo-users button { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 12px; line-height: 1.3; }
.demo-users button:hover { border-color: var(--ring); }
.demo-users button b { display: block; font-size: 12px; }

/* Barra del prototipo */
.proto-bar { position: fixed; right: 16px; bottom: 16px; z-index: 70; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.proto-bar .tag { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; color: var(--muted); }

/* Recibo impreso */
.receipt { font-family: 'Courier New', monospace; font-size: 12px; width: 300px; margin: 0 auto; color: #000; background: #fff; padding: 12px; line-height: 1.35; }
.receipt .c { text-align: center; }
.receipt .b { font-weight: 700; }
.receipt .sep { border-top: 1px dashed #000; margin: 6px 0; }
.receipt .ln { display: flex; justify-content: space-between; gap: 8px; }
#print-area { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * { visibility: visible !important; }
  #print-area { display: block !important; position: absolute; left: 0; top: 0; }
}

/* ---------- Adaptación ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(9, 18, 20, .45); z-index: 35; }
  .main { margin-left: 0; }
  .hamburger { display: grid; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  body { font-size: 15px; }
  .content { padding: 16px 16px 96px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .user-chip .who { display: none; }
  .user-chip { padding: 3px; border: 0; }
  .page-head h1 { font-size: 20px; }
  .g-2, .g-3, .g-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .k-value { font-size: 19px; }
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .only-desktop { display: none !important; }
  .order-cards { display: block; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 2px; text-decoration: none; font-weight: 500; position: relative; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--primary-text); }
  .bottom-nav .nb { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: #d92d20; color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .proto-bar { bottom: 76px; right: 10px; }
  .proto-bar .tag { display: none; }
  .bar-row { grid-template-columns: 96px 1fr 72px; gap: 8px; }
  .bar-tip { left: 100px; }
  .den-row { grid-template-columns: 1fr 76px 92px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .modal-foot .btn { flex: 1; }
  .dropdown { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; }
  .footer { padding: 0 16px 96px; }
}
@media (min-width: 768px) {
  .only-mobile { display: none !important; }
}

/* SweetAlert2 con los colores del sistema (claro y oscuro) */
.swal2-popup { background: var(--surface) !important; color: var(--text) !important; border-radius: 16px !important; font-family: var(--font) !important; border: 1px solid var(--border); }
.swal2-title { color: var(--text) !important; font-size: 19px !important; font-weight: 600 !important; }
.swal2-html-container { color: var(--text-2) !important; font-size: 14px !important; }
.swal2-input { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; border-radius: 9px !important; font-size: 15px !important; box-shadow: none !important; }
.swal2-input:focus { border-color: var(--ring) !important; box-shadow: 0 0 0 3px var(--primary-soft) !important; }
.swal2-confirm { background: var(--primary) !important; color: var(--on-primary) !important; border-radius: 9px !important; font-weight: 600 !important; }
.swal2-cancel { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; border-radius: 9px !important; font-weight: 600 !important; }
.swal2-validation-message { background: var(--err-bg) !important; color: var(--err-text) !important; }
div:where(.swal2-container).swal2-backdrop-show { background: rgba(9, 18, 20, .55) !important; }
