:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #1c2230; --border: #30363d;
  --text: #e6edf3; --muted: #8b949e; --accent: #2f81f7; --accent2: #3fb950;
  --warn: #d29922; --danger: #f85149; --doc: #f0883e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
body { background: var(--bg); color: var(--text); }
a { color: var(--accent); }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: #21262d; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: inherit; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.on { background: var(--doc); border-color: var(--doc); color: #111; font-weight: 600; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
input[type=text], input[type=email], select, .field {
  width: 100%; background: #0d1117; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font-size: 13px; font-family: inherit; }
input[type=text]:focus, select:focus { outline: none; border-color: var(--accent); }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.brand svg { color: var(--accent); flex: none; }
.brand small { color: var(--muted); font-weight: 400; }
.brand .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.user img, .user .avatar { width: 26px; height: 26px; border-radius: 50%; }
.user .avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 600; }
.user .uname { color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pantalla de login */
#login { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 10%, #13233f 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; text-align: center; }
.login-card h1 { font-size: 20px; margin: 12px 0 6px; }
.login-card p { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 20px; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid #dadce0; background: #fff; color: #1f1f1f; font-size: 15px; font-weight: 500; cursor: pointer; font-family: inherit; }
.gbtn:hover { background: #f5f7fa; }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 1em; }
.tiny { font-size: 11px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .user .uname { display: none; }
  header.top { padding: 8px 12px; }
}

/* ── Notificaciones (campana, panel, tarjeta) y ventana de la página de ventas ── */
.btn.bell { position: relative; padding: 6px 8px; }
.btn.bell.ring svg { color: var(--warn); animation: bell 2.4s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes bell { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(14deg); } 93% { transform: rotate(-12deg); } 97% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .btn.bell.ring svg { animation: none; } }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.npanel { color-scheme: dark; position: fixed; z-index: 120; width: min(380px, calc(100vw - 16px)); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.5); overflow: hidden; }
.np-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.np-list { overflow: auto; flex: 1; }
.np-it { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.np-it:hover { background: var(--panel2); }
.np-it.nueva { background: rgba(47,129,247,.08); box-shadow: inset 3px 0 0 var(--accent); }
.np-ic { font-size: 18px; line-height: 1.2; }
.np-tx { flex: 1; min-width: 0; }
.np-t { font-size: 13px; font-weight: 600; }
.np-b { font-size: 12px; color: var(--muted); margin: 3px 0 6px; line-height: 1.4; }
.np-f { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 4px; }
.np-cta { font-size: 11px; color: var(--accent2); font-weight: 600; white-space: nowrap; }
.np-empty { padding: 22px 14px; font-size: 13px; color: var(--muted); text-align: center; }
.np-push { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.avbar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.avbar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; }
.avbar-txt { font-size: 11px; color: var(--muted); margin-top: 3px; }
.avbar-txt strong { color: var(--text); }
.avchip { display: inline-flex; flex-direction: column; min-width: 110px; margin-left: 6px; cursor: pointer; }
.avchip .avbar-txt { margin-top: 2px; white-space: nowrap; font-weight: 400; }

.ncard { position: fixed; right: 16px; bottom: 44px; z-index: 110; width: min(360px, calc(100vw - 32px)); padding: 14px; padding-right: 30px;
  background: var(--panel); border: 1px solid var(--accent2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.55);
  transform: translateY(20px); opacity: 0; transition: transform .3s, opacity .3s; display: flex; flex-direction: column; gap: 8px; }
.ncard.on { transform: none; opacity: 1; }
.ncard-t { font-size: 14px; font-weight: 600; }
.ncard-b { font-size: 13px; color: var(--muted); line-height: 1.45; }
.ncard-p { font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.35); }
.ncard-p b { color: var(--accent2); }
.ncard-a { display: flex; gap: 8px; flex-wrap: wrap; }

.vm-x { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; }
.vm-x:hover { color: var(--text); }
dialog.vmodal { color-scheme: dark; position: fixed; margin: auto; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 22px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; }
dialog.vmodal::backdrop { background: rgba(0,0,0,.65); }
.vm-head { display: flex; flex-direction: column; gap: 8px; padding-right: 20px; }
.vm-kicker { font-size: 12px; color: var(--muted); }
.vm-head h2 { font-size: 21px; line-height: 1.25; margin-top: 4px; text-wrap: balance; }
.vm-pitch { font-size: 14px; color: var(--muted); line-height: 1.55; }
.vm-stat { display: flex; align-items: center; gap: 14px; margin: 16px 0 12px; padding: 12px 14px; border-radius: 10px;
  background: rgba(63,185,80,.1); border: 1px solid rgba(63,185,80,.35); }
.vm-stat b { font-size: 30px; color: var(--accent2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vm-stat span { font-size: 13px; line-height: 1.45; }
.vm-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.vm-list li { font-size: 13px; line-height: 1.45; padding-left: 22px; position: relative; color: var(--muted); }
.vm-list li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent2); font-weight: 700; }
.vm-list li b { color: var(--text); }
.vm-form { display: flex; flex-direction: column; gap: 10px; }
.vm-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.vm-form input { width: 100%; background: #0d1117; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 9px 10px; font-size: 14px; font-family: inherit; }
.vm-form input:focus { outline: none; border-color: var(--accent); }
.vm-row { display: flex; gap: 10px; flex-wrap: wrap; }
.vm-row label { min-width: 180px; }
.vm-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.vm-cta { padding: 10px 16px; font-size: 14px; background: var(--accent2); border-color: var(--accent2); }
.vm-msg { font-size: 12px; min-height: 1em; color: var(--muted); }
.vm-msg.err { color: var(--danger); }
.vm-ok { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 8px; background: rgba(47,129,247,.1); border: 1px solid rgba(47,129,247,.35); margin-bottom: 12px; }
.vm-ok.big { font-size: 15px; padding: 16px; margin: 0; }
@media (max-width: 640px) {
  .ncard { right: 8px; left: 8px; width: auto; bottom: 34px; }
  .avchip { display: none; }
}
