/* VEXUM x Cheques — mismos tokens que vexum.site y VEXUM Control */
:root {
  --black: #0b0b0b; --black-2: #111214; --black-3: #17181b; --black-4: #1f2024;
  --gray-mid: #c9cdd3; --gray-mute: #8a8f98;
  --blue: #0066ff; --blue-soft: #3d85ff; --blue-deep: #0047b3;
  --line: rgba(255,255,255,.1); --line-soft: rgba(255,255,255,.06);
  --ok: #34d399; --ok-soft: rgba(52,211,153,.12);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.12);
  --err: #f87171; --err-soft: rgba(248,113,113,.12);
  --radius: 14px;
  --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--black); }
body { margin: 0; font-family: var(--font); color: #fff; background: transparent; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body::after { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(560px at 80% 0%, rgba(0,102,255,.22), transparent 60%), radial-gradient(900px at 0% 100%, rgba(0,102,255,.08), transparent 55%); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-soft); }
.muted { color: var(--gray-mute); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-soft); }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); }

/* ---------- barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(16px, 3vw, 32px); min-height: 64px;
  background: rgba(11,11,11,.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: #fff; }
.brand img { width: 26px; height: 26px; }
.brand strong { font-weight: 800; letter-spacing: .04em; }
.brand span { font-weight: 600; color: var(--blue-soft); }
.nav { display: flex; gap: .25rem; margin-left: 1rem; }
.nav button { background: none; border: 0; color: var(--gray-mid); font-weight: 600; font-size: .92rem; border-radius: 999px; padding: .45rem .9rem; cursor: pointer; }
.nav button:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav button.active { background: rgba(0,102,255,.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(0,102,255,.35); }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: .6rem; color: var(--gray-mute); font-size: .85rem; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 999px; padding: .55rem 1.05rem; font-weight: 700; font-size: .9rem; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: #fff; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.09); }
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-soft); }
.btn.danger { color: var(--err); border-color: rgba(248,113,113,.35); }
.btn.small { padding: .32rem .7rem; font-size: .8rem; }
.btn.icon { padding: .45rem .7rem; }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-size: .75rem; font-weight: 700; color: var(--gray-mute); letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .field textarea { background: var(--black-3); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; min-width: 0; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: none; }

/* ---------- contenido ---------- */
main { padding: clamp(16px, 3vw, 32px); max-width: 1400px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.head h1 { margin: .35rem 0 0; font-size: clamp(1.45rem, 2.4vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; }
.mes-nav { display: flex; align-items: center; gap: .4rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi { background: rgba(17,18,20,.85); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi .t { font-size: .72rem; font-weight: 700; color: var(--gray-mute); letter-spacing: .06em; text-transform: uppercase; }
.kpi .v { font-size: 1.35rem; font-weight: 800; margin-top: .2rem; letter-spacing: -.01em; }
.kpi .s { font-size: .8rem; color: var(--gray-mute); }
.kpi.accent { border-color: rgba(0,102,255,.45); background: linear-gradient(180deg, rgba(0,102,255,.14), rgba(17,18,20,.85)); }

/* ---------- calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, .8fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(17,18,20,.8); }
.cal .dow { padding: .55rem .7rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-soft); background: var(--black-3); border-bottom: 1px solid var(--line); }
.cal .dow.sem { color: var(--gray-mute); text-align: right; }
.day { min-height: 128px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: .45rem .5rem .5rem; display: flex; flex-direction: column; gap: .2rem; cursor: pointer; position: relative; transition: background .12s; min-width: 0; }
.day:hover { background: rgba(255,255,255,.03); }
.day.fuera { background: rgba(0,0,0,.25); cursor: default; }
.day.hoy { box-shadow: inset 0 0 0 1px var(--blue); background: rgba(0,102,255,.06); }
.day .n { font-weight: 800; font-size: .85rem; color: var(--gray-mid); display: flex; justify-content: space-between; align-items: center; }
.day.hoy .n b { background: var(--blue); color: #fff; border-radius: 999px; padding: 0 .45rem; }
.dname { display: none; color: var(--blue-soft); font-weight: 700; }
.day .add { opacity: 0; color: var(--blue-soft); font-weight: 800; font-size: 1rem; line-height: 1; }
.day:hover .add, .day:focus-visible .add { opacity: 1; }
.day .ln { display: flex; font-size: clamp(.7rem, .95vw, .8rem) !important; justify-content: space-between; gap: .4rem; font-size: .78rem; line-height: 1.3; min-width: 0; }
.day .ln span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-mid); }
.day .ln.cobrado span:first-child::before { content: "✓ "; color: var(--ok); }
.day .ln.anulado { text-decoration: line-through; opacity: .45; }
.day .mas { font-size: .74rem; color: var(--blue-soft); font-weight: 700; }
.day .tot { margin-top: auto; padding-top: .3rem; border-top: 1px dashed var(--line); text-align: right; font-weight: 800; font-size: .84rem; }
.semana { border-bottom: 1px solid var(--line-soft); padding: .55rem .7rem; text-align: right; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(255,255,255,.02); }
.semana .v { font-weight: 800; font-size: clamp(.72rem, 1.1vw, .95rem); }
.semana { min-width: 0; overflow: hidden; }
.semana .s { font-size: .74rem; color: var(--gray-mute); }

/* ---------- panel lateral ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-bg.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--black-2); border-left: 1px solid var(--line); z-index: 41; transform: translateX(100%);
  transition: transform .25s cubic-bezier(.16,1,.3,1); display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer header { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.drawer header h2 { margin: .25rem 0 0; font-size: 1.15rem; }
.drawer .body { padding: 1rem 1.2rem; overflow-y: auto; flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }
.lista-dia { margin-top: 1.4rem; }
.lista-dia h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-mute); margin: 0 0 .5rem; display: flex; justify-content: space-between; }
.item { display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--line-soft); border-radius: 10px; margin-bottom: .4rem; background: rgba(255,255,255,.02); }
.item .p { font-weight: 700; }
.item .meta { font-size: .76rem; color: var(--gray-mute); }
.item.editando { border-color: var(--blue); }
.item.anulado .p, .item.anulado .num { text-decoration: line-through; opacity: .5; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--gray-mid); margin-left: .3rem; vertical-align: middle; }
.badge.cobrado { background: var(--ok-soft); color: var(--ok); }
.badge.anulado { background: var(--err-soft); color: var(--err); }

/* ---------- tablas ---------- */
.filtros { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: .7rem; align-items: end; margin-bottom: 1rem; }
.tabla-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: rgba(17,18,20,.8); max-height: calc(100vh - 300px); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { position: sticky; top: 0; background: var(--black-3); text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-soft); padding: .6rem .8rem; white-space: nowrap; cursor: default; }
th.r, td.r { text-align: right; }
td { padding: .5rem .8rem; border-top: 1px solid var(--line-soft); white-space: nowrap; }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody tr.click { cursor: pointer; }
tfoot td { font-weight: 800; background: var(--black-3); position: sticky; bottom: 0; }

/* ---------- ingreso ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); background: rgba(17,18,20,.9); border: 1px solid var(--line); border-radius: 18px; padding: 2rem 1.6rem; display: flex; flex-direction: column; gap: .9rem; box-shadow: 0 30px 80px -30px rgba(0,102,255,.35); }
.login .logo { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; margin-bottom: .4rem; }
.login .logo img { width: 34px; height: 34px; }
.login .err { color: var(--err); font-size: .85rem; min-height: 1.2em; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--black-4); border: 1px solid var(--line); padding: .65rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; opacity: 0; transition: all .2s; z-index: 60; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: var(--err); color: var(--err); }
.vacio { padding: 2rem; text-align: center; color: var(--gray-mute); }

/* ---------- móvil ---------- */
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal { grid-template-columns: 1fr; }
  .cal .dow, .cal .semana { display: none; }
  .day { min-height: 0; border-right: 0; }
  .day.fuera, .day.vacio-movil { display: none; }
  .dname { display: inline; }
.day .add { opacity: 1; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .4rem; }
  .nav { order: 3; margin-left: 0; width: 100%; overflow-x: auto; }
  .brand .x { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .head { align-items: flex-start; }
}
