:root {
  /* Marca AVENVOX */
  --navy-950: #030b22; --navy-900: #061433; --navy-800: #0a1f4d; --navy: #0b2a6b;
  --cyan: #06d6e6; --cyan-2: #00b8d4; --azul: #2563eb;
  --grad: linear-gradient(135deg, #1d4ed8 0%, #0ea5c6 100%);
  --bg: #f3f6fb; --panel: #ffffff; --ink: #0b1733; --muted: #5b6780; --line: #e2e8f2;
  --brand: #1d4ed8; --brand-2: #1e3a8a; --brand-soft: #e5eeff;
  --ok: #1f9d55; --ok-soft: #e4f6ec; --warn: #b7791f; --warn-soft: #fdf3e1; --bad: #c53030; --bad-soft: #fde8e8;
  --radius: 12px; --shadow: 0 1px 2px rgba(11,23,51,.05), 0 6px 20px rgba(11,23,51,.06);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: "Montserrat", "Inter", system-ui, sans-serif; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(6,214,230,.22); border-color: var(--cyan-2); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #c9d3cf; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(29,78,216,.25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(600px 380px at 25% 30%, rgba(6,214,230,.22), transparent 70%),
  radial-gradient(700px 420px at 80% 75%, rgba(37,99,235,.28), transparent 70%),
  linear-gradient(160deg, var(--navy-900), var(--navy-950)); }
.login > div { width: 100%; max-width: 380px; }
.login .card { width: 100%; padding: 28px 26px; border: 0; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login .marca { display: grid; justify-items: center; gap: 10px; margin-bottom: 20px; text-align: center; }
.login .marca img.iso { width: 74px; height: auto; }
.login .marca img.txt { width: 190px; height: auto; }
.login .marca .lema { font-size: 9px; letter-spacing: .14em; white-space: nowrap; text-transform: uppercase; color: var(--muted); }
.login .marca h2 { font-size: 15px; font-weight: 700; margin-top: 4px; }
.login .pie { color: rgba(255,255,255,.45); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; margin-top: 18px; text-align: center; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; font-family: "Montserrat", sans-serif; }
.logo img.iso { width: 34px; height: auto; flex: none; }
.logo img.txt { height: 17px; width: auto; }

/* Layout */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #cbd6ee; border-right: 1px solid rgba(6,214,230,.12); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { color: #fff; padding: 6px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 4px; }
.side .nitem { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: #cbd6ee; text-decoration: none; cursor: pointer; border-left: 3px solid transparent; }
.side .nitem:hover { background: rgba(255,255,255,.06); }
.side .nitem.on { background: linear-gradient(90deg, rgba(6,214,230,.16), rgba(37,99,235,.08)); color: #fff; border-left-color: var(--cyan); }
.side .nitem .badge { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.14); padding: 1px 7px; border-radius: 99px; }
.side .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6f84b3; padding: 6px 10px 0; }
.side .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.2); justify-content: center; }
.side .foot { margin-top: auto; display: grid; gap: 6px; }
.main { padding: 22px 26px 60px; min-width: 0; }
.menu-btn { display: none; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-105%); transition: transform .2s; }
  .side.open { transform: none; }
  .main { padding: 14px 16px 60px; }
  .menu-btn { display: inline-flex; }
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: #9aa9a4; flex: none; }
.dot.open { background: #37d67a; } .dot.close, .dot.no_existe { background: #f56565; } .dot.connecting { background: #f6ad55; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #eef1f0; color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { text-decoration: none; padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab.on { color: var(--brand); border-bottom-color: var(--cyan-2); }
.stat { padding: 14px 16px; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); }
.stat b { display: block; font-size: 24px; font-family: "Montserrat", sans-serif; margin-top: 2px; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
td input { min-width: 70px; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd8d5; border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 99px; transition: .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

.day { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .x { margin-left: 4px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink); margin: 0 12px 6px 0; }
.check input { width: auto; }

.cita { display: grid; grid-template-columns: 80px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cita:last-child { border-bottom: 0; }
.cita .hora { font-weight: 700; font-variant-numeric: tabular-nums; }
.cita.cancelada, .cita.no_asistio { opacity: .5; }
.cita.cancelada .hora { text-decoration: line-through; }
@media (max-width: 800px) { .cita { grid-template-columns: 64px 1fr; } .cita .acc { grid-column: 1 / -1; } }
.fecha-h { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; margin: 14px 0 2px; }

/* Chat simulador */
.chat { background: #e9e2d8; border-radius: var(--radius); height: 460px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 7px 10px; border-radius: 10px; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.msg.user { align-self: flex-end; background: #d9fdd3; }
.msg.model { align-self: flex-start; background: #fff; }
.msg.sys { align-self: center; background: #fff7d6; font-size: 12px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 12px; font-style: italic; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,18,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; }
.qr { display: grid; place-items: center; min-height: 270px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; }
.qr img, .qr canvas { width: 260px; height: 260px; image-rendering: pixelated; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 26px; letter-spacing: .15em; font-weight: 700; }
ol.steps { padding-left: 18px; margin: 8px 0; } ol.steps li { margin: 3px 0; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 99; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--bad); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.warnbox { background: var(--warn-soft); color: #7a5214; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* Panel del dueño (/mi) */
.mi-top { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: linear-gradient(90deg, var(--navy-900), var(--navy-800)); border-bottom: 2px solid var(--cyan); color: #fff; position: sticky; top: 0; z-index: 20; }
.mi-top .logo { color: #fff; font-size: 16px; }
.mi-top .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.mi-top .mi-user { color: #a9b8da; }
.mi-top .by { display: flex; align-items: center; gap: 6px; opacity: .8; }
.mi-top .by img { height: 11px; }
@media (max-width: 600px) { .mi-top .by { display: none; } }
.creditos { text-align: center; padding: 26px 0 8px; opacity: .55; }
.creditos img { height: 12px; vertical-align: middle; }
.main.mi { max-width: 1180px; width: 100%; }
@media (max-width: 600px) { .mi-top .mi-user { display: none; } }

[hidden] { display: none !important; }
.login .btn { justify-content: center; }

/* Inventario y ventas */
details > summary { list-style: none; padding: 8px 10px; background: var(--brand-soft); border-radius: 8px; color: var(--brand-2); }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 4px; }
.pos-item:hover { border-color: var(--cyan-2) !important; background: #f7fbff; }
@media print {
  body.imprimiendo > *:not(.modal-bg) { display: none !important; }
  body.imprimiendo .modal-bg { position: static; background: none; padding: 0; }
  body.imprimiendo .modal { box-shadow: none; max-width: 80mm; margin: 0; padding: 0; }
  body.imprimiendo .no-print { display: none !important; }
}
.drop { display: grid; justify-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed #b8c6e0; border-radius: 14px; background: #f7faff; cursor: pointer; text-align: center; margin: 0; color: var(--ink); font-weight: 500; }
.drop:hover, .drop.on { border-color: var(--cyan-2); background: #eefbfd; }
.tono { display: grid; gap: 2px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; margin: 0; color: var(--ink); font-weight: 400; }
.tono:hover { border-color: #b8c6e0; }
.tono.on { border-color: var(--cyan-2); background: #eefbfd; box-shadow: 0 0 0 3px rgba(6,214,230,.15); }
/* Packs */
.pack-grid { grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); align-items: start; }
.pack-ico { width: 64px; height: 64px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; font-size: 28px; flex: none; }
.pk-op, .ord-item { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fff; gap: 8px; }
.pk-op:hover { border-color: var(--cyan-2); background: #f5fdff; }
.pk-drop { min-height: 120px; border: 2px dashed #b8c6e0; border-radius: 12px; padding: 8px; margin-top: 8px; display: grid; gap: 6px; align-content: start; background: #fafcff; }
.pk-drop.on { border-color: var(--cyan-2); background: #eefbfd; }
.pk-item { padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.pk-foto { width: 84px; height: 84px; border-radius: 12px; border: 1px dashed #b9c4c0; display: grid; place-items: center; cursor: pointer; overflow: hidden; margin: 0; background: #f7f9f8; flex: none; text-align: center; }
.pk-foto img { width: 100%; height: 100%; object-fit: cover; }
.ord-item { cursor: grab; }
.ord-item.sobre { border-color: var(--cyan-2); box-shadow: 0 -3px 0 var(--cyan) inset; }
.tasas-box { background: #f5f9ff; border: 1px solid #d9e6ff; border-radius: 12px; padding: 12px 14px; }

/* Menú lateral con las secciones del negocio */
.side .nav { display: grid; gap: 2px; }
.side .sub-nav { margin: -6px 0 4px 12px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.1); }
.side .nitem.sub { padding: 7px 10px; font-weight: 500; font-size: 14px; }
.side .logo .nom { font-size: 16px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.side .side-user { color: #8fa3cf; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .by { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: #6f84b3; padding-top: 4px; }
.side .by img { height: 10px; }
.side-bg { display: none; }
@media (max-width: 800px) {
  .menu-btn { margin-bottom: 10px; }
  .side-bg.open { display: block; position: fixed; inset: 0; background: rgba(3,10,30,.45); z-index: 25; }
  .side { inset: 0 auto 0 0; width: min(280px, 82vw); }
}
