/* Roja Bar · sistema visual */
:root {
  --wine-900: #3f0a12;
  --wine-800: #5e0d19;
  --wine-700: #7d1424;
  --wine-600: #9b1c31;
  --gold: #c9a255;
  --gold-soft: #ead9ae;
  --gold-tint: rgba(201, 162, 85, .14);
  --cream: #f6f2ed;
  --paper: #ffffff;
  --ink: #241a1c;
  --ink-2: #4e4043;
  --muted: #7f7275;
  --line: #e9e1db;
  --line-2: #dcd2cc;
  --ok: #2f7d4f;
  --ok-bg: #e8f3ec;
  --warn: #8a6417;
  --warn-bg: #f7efd9;
  --err: #a4262c;
  --err-bg: #f9e6e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36, 26, 28, .04), 0 4px 14px rgba(36, 26, 28, .05);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
a { color: inherit; }

html, body {
  margin: 0;
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ico-svg { flex: none; display: block; }

/* ---------- Estructura ---------- */
.nav-toggle { display: none; }
.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.backdrop { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 60;
  display: flex; flex-direction: column;
  padding: 24px 14px 18px;
  background: linear-gradient(180deg, var(--wine-900) 0%, #22070c 100%);
  color: #e8dadd;
}
.side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 10px 26px; text-decoration: none; color: #fff;
}
.logo {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--gold); color: var(--wine-800);
}
.brand-txt strong {
  display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .3px;
}
.brand-txt small { display: block; font-size: 11px; color: #bd9ea5; letter-spacing: .6px; text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  color: #d8c4c9; text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { background: var(--gold-tint); color: #f1dca8; font-weight: 600; }
.nav-item.on::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--gold);
}
.nav-item.sub { padding-left: 38px; font-size: 13.5px; }
.nav-item.sub .ico-svg { opacity: .8; }
.count {
  margin-left: auto; background: #b3263e; color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px;
}

.side-group { margin-top: 14px; }
.side-group > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-radius: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: #a98a91;
}
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after {
  content: ""; width: 6px; height: 6px; margin-right: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease;
}
.side-group[open] > summary::after { transform: rotate(-135deg); }
.side-group > summary:hover { color: #fff; }
.side-foot { margin-top: auto; padding: 16px 14px 0; font-size: 12px; color: #8f7379; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 28px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.hamburger {
  display: none; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink-2); cursor: pointer; flex: none;
}
.page-title {
  margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.content { padding: 28px; width: 100%; max-width: 1140px; }

/* ---------- Menús desplegables y cuenta ---------- */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--muted);
}
.user-pill:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.user-txt { display: flex; flex-direction: column; line-height: 1.2; text-align: left; color: var(--ink); }
.user-txt strong { font-size: 13px; font-weight: 600; }
.user-txt small { font-size: 11px; color: var(--muted); }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--wine-700); color: #f6e7c4; font-weight: 600; font-size: 13px; flex: none;
}
.dd-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
  background: var(--paper); color: var(--ink);
  border-radius: 12px; border: 1px solid var(--line); padding: 6px;
  box-shadow: 0 14px 34px rgba(36, 26, 28, .14); z-index: 70;
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.dd-info { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.dd-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border-radius: 8px; border: 0; background: none;
  color: var(--ink-2); font: inherit; font-weight: 500; text-decoration: none; text-align: left; cursor: pointer;
}
.dd-item:hover { background: #f8f2f3; color: var(--wine-700); }
.dd-item.danger { color: var(--err); }
.dd-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- Tipografía ---------- */
.eyebrow {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px;
  color: #a07d36; margin-bottom: 4px;
}
h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -.2px; margin: 0; line-height: 1.15; }
h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 12px; }
h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin: 14px 0 4px; color: var(--wine-700); }
.small { font-size: 13px; }
.muted { color: var(--muted); }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0 0 22px; }
.kpi {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.kpi > div:first-child { min-width: 0; }
.kpi .num { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 8px; }
.kpi .ico-box {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center; color: var(--wine-700); background: var(--gold-tint);
}

/* ---------- Tarjetas ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin: 14px 0;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-evento { padding: 18px 22px; }
.card-evento h3 { margin: 0 0 2px; font-size: 19px; }
.card summary {
  cursor: pointer; font-weight: 600; color: var(--wine-700);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.card summary::-webkit-details-marker { display: none; }
.fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.tag {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; background: #efe9e6; color: var(--ink-2);
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }

.stock-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.stock-num { font-family: var(--serif); font-size: 19px; display: block; margin-bottom: 2px; }
.nota { font-size: 13px; color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; }

/* ---------- Mensajes ---------- */
.flash {
  padding: 11px 15px; border-radius: 10px; margin: 0 0 18px;
  background: var(--ok-bg); color: #1f5d39; border-left: 3px solid var(--ok);
  font-weight: 500;
}
.flash.error { background: var(--err-bg); color: #7a1a1f; border-left-color: var(--err); }
.flash.aviso { background: var(--warn-bg); color: #6b4d10; border-left-color: var(--gold); }

.chip {
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 99px;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  background: var(--ok-bg); color: var(--ok);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.off { background: var(--err-bg); color: var(--err); }

/* ---------- Botones ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink-2);
  border-radius: 9px; padding: 9px 16px; margin: 4px 0; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: #cbbcb5; background: #faf7f5; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--wine-700); border-color: var(--wine-700); color: #fbf3e2; }
.btn.primary:hover { background: var(--wine-800); border-color: var(--wine-800); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 13px 18px; font-size: 15px; width: 100%; }
.btn.link { border: 0; background: none; color: var(--wine-700); padding: 4px 0; }
.link-sm { font-size: 13px; font-weight: 600; color: var(--wine-700); text-decoration: none; }
.link-sm:hover { text-decoration: underline; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--wine-700); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acciones.fin { justify-content: flex-end; margin-top: 18px; }
.inline-form { display: inline; margin: 0 0 0 12px; }

/* ---------- Pestañas (vista de evento) ---------- */
.tabs {
  display: flex; gap: 2px; overflow-x: auto; margin: 18px 0 10px;
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; padding: 10px 14px; border: 0; background: transparent;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--wine-700); border-bottom-color: var(--wine-700); }

/* ---------- Formularios ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-fila { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.form-fila label { flex: 1 1 200px; margin: 0; }
.form-fila .acciones { margin-bottom: 4px; }

label { display: block; margin: 12px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, textarea, select {
  width: 100%; font: inherit; font-weight: 400; color: var(--ink);
  padding: 10px 12px; margin-top: 5px;
  border: 1px solid var(--line-2); border-radius: 9px; background: var(--paper);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--wine-600); box-shadow: 0 0 0 3px rgba(155, 28, 49, .12);
}
input[type=checkbox] { width: 17px; height: 17px; margin: 0; accent-color: var(--wine-700); }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); }
label.check input { width: 17px; margin: 0; }
textarea { font-size: 14px; line-height: 1.55; resize: vertical; }
h3 + .personal, .personal { margin-bottom: 8px; }
.personal { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
.persona {
  margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fcfaf9;
}
.form-evento h3 { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-evento h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* ---------- Stock interactivo ---------- */
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px 18px; margin: 0 0 18px; }
.toolbar .inline { flex: 1 1 280px; margin: 0; }
.toolbar .btn { margin: 0; }

.stock-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.panel-cat, .panel-sel { margin: 0; }

.buscador {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fcfaf9; color: var(--muted);
}
.buscador:focus-within { border-color: var(--wine-600); box-shadow: 0 0 0 3px rgba(155,28,49,.12); }
.buscador input { border: 0; padding: 10px 0; margin: 0; box-shadow: none; background: transparent; }
.buscador input:focus { box-shadow: none; }

.catalogo { max-height: 56vh; overflow-y: auto; margin-right: -4px; padding-right: 4px; }
.cat { border-top: 1px solid var(--line); }
.cat:first-child { border-top: 0; }
.cat > summary {
  padding: 11px 2px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink-2); display: flex; align-items: center; gap: 10px;
}
.cat > summary::after {
  content: ""; order: 3; margin-left: auto; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease;
}
.cat[open] > summary::after { transform: rotate(-135deg); }
.cat > summary span:first-child { order: 1; }
.cuenta { order: 2; font-size: 11px; color: var(--muted); background: #f1ebe7; border-radius: 99px; padding: 1px 8px; }
.cat-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 4px 9px 2px; border-radius: 8px;
}
.cat-item + .cat-item { border-top: 1px dashed var(--line); }
.cat-item:hover { background: #fcfaf9; }
.cat-item strong { font-size: 14px; font-weight: 600; display: block; }
.cat-item small { font-size: 12px; color: var(--muted); }

.otra { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fila-input { display: flex; gap: 8px; margin-top: 4px; }
.fila-input input { margin: 0; }
.fila-input .btn { margin: 0; }

.tabla-sel { overflow-x: auto; }
.tabla-stock { width: 100%; border-collapse: collapse; background: transparent; box-shadow: none; border: 0; display: table; }
.tabla-stock th {
  background: transparent; font-size: 11px; color: var(--muted); padding: 0 8px 10px 0; border-bottom: 1px solid var(--line);
}
.tabla-stock td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla-stock tr:last-child td { border-bottom: 0; }
.tabla-stock tbody tr:hover td { background: transparent; }
.tabla-stock select { margin: 0; padding: 7px 9px; font-size: 13.5px; width: auto; min-width: 120px; }
.fila-stock { transition: background .3s ease; }
.fila-stock.pulse td { animation: resalta 1.2s ease; }
@keyframes resalta { 0% { background: var(--gold-tint); } 100% { background: transparent; } }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--paper); }
.qty input {
  width: 64px; margin: 0; border: 0; border-radius: 0; text-align: center; font-weight: 600; padding: 7px 4px;
  -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { box-shadow: none; }
.qbtn {
  width: 34px; height: 34px; border: 0; background: #f7f2f0; color: var(--ink-2);
  font-size: 17px; font-weight: 600; cursor: pointer; flex: none;
}
.qbtn:hover { background: #efe6e2; color: var(--wine-700); }

.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.icon-btn:hover { background: var(--err-bg); color: var(--err); }
.td-acc { width: 44px; text-align: right; }

.barra-guardar { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Vacíos ---------- */
.vacio {
  color: var(--muted); text-align: center; padding: 34px 20px;
  background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--radius);
}

/* ---------- Login ---------- */
body.login {
  display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background:
    radial-gradient(800px 460px at 12% -10%, rgba(201,162,85,.22), transparent 62%),
    linear-gradient(160deg, var(--wine-700) 0%, var(--wine-900) 100%);
}
.card-login {
  width: min(94vw, 380px); background: var(--paper); border-radius: 18px; padding: 34px 30px 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo.lg { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; }
.card-login h1 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--wine-800); }
.card-login .login-brand p { margin: 4px 0 0; font-size: 13px; }
.card-login form label { margin: 14px 0; }
.card-login .btn.big { margin-top: 10px; padding: 12px; }

/* ---------- Tablas ---------- */
table {
  width: 100%; border-collapse: collapse; font-size: 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--muted);
  background: #fbf8f6; font-weight: 700;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fcf9f8; }
tr.inactiva td { color: var(--muted); }
td strong { font-weight: 600; }
td .muted { display: block; }
td.acc { white-space: nowrap; }
td.acc a { color: var(--wine-700); font-weight: 600; text-decoration: none; margin-right: 14px; }
td.acc a:hover { text-decoration: underline; }
td.acc .inline-form { margin-left: 0; }
code { background: #f3ece8; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

@media (max-width: 620px) {
  .content table:not(.tabla-stock) { display: block; overflow-x: auto; }
  .content table:not(.tabla-stock) tr { display: table-row; }
  .content table:not(.tabla-stock) thead,
  .content table:not(.tabla-stock) tbody { display: table-row-group; }
}

.form-evento, .stock-box, .card-form { background: var(--paper); }
.card-form {
  background: var(--paper); padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow); margin: 14px 0;
}
.admin .conflicto { padding: 22px; margin: 14px 0; }
.admin .conflicto .grid2 > div { background: #fbf8f6; border-radius: 10px; padding: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stock-grid { grid-template-columns: 1fr; }
  .catalogo { max-height: 40vh; }
}
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: -280px; width: 264px; height: auto;
    visibility: hidden; transition: left .25s ease, visibility .25s; box-shadow: 12px 0 40px rgba(0,0,0,.3);
  }
  .nav-toggle:checked ~ .layout .sidebar { left: 0; visibility: visible; }
  .nav-toggle:checked ~ .layout .backdrop {
    display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 6, 10, .45);
  }
  .hamburger { display: grid; }
  .topbar { padding: 10px 14px; }
  .content { padding: 18px; }
}
@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
  h2 { font-size: 25px; }
  .user-txt { display: none; }
  .user-pill { padding: 3px; }
  .topbar .chip { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px; }
  .kpi .num { font-size: 20px; }
  .kpi .ico-box { width: 34px; height: 34px; }
  .toolbar { padding: 14px; }
  .qty input { width: 54px; }
}
