:root {
  --bg-top: #00143d;
  --bg-bottom: #0b2a64;
  --surface: #f3f4f7;
  --surface-border: #d6dae2;
  --text: #0f1320;
  --text-muted: #5d6680;
  --gold: #c7ac6b;
  --gold-strong: #b59445;
  --danger: #b32727;
  --danger-strong: #971d1d;
  --ok: #0f7d43;
  --sidebar-bg: #132232;
  --sidebar-bg-2: #182c42;
  --sidebar-border: #28405c;
  --sidebar-text: #c8d4e8;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 76px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, rgba(199, 172, 107, 0.15), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background: linear-gradient(180deg, rgba(3, 22, 63, 0.16), rgba(7, 36, 95, 0.14) 50%, rgba(10, 52, 127, 0.16)),
    url("./images/FONDO-appsdq-2026.jpg") center 20% / cover no-repeat fixed;
}

#app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(0, 12, 37, 0.85);
  border-bottom: 1px solid rgba(199, 172, 107, 0.25);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-main-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-main {
  color: var(--gold);
  font-weight: 800;
  font-size: 22px;
}

.hosting-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(107, 255, 190, 0.55);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(18, 166, 114, 0.18);
  color: #a7ffd7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(18, 166, 114, 0.18);
}

.brand-sub {
  color: #fff;
  letter-spacing: 0.04em;
  font-size: 12px;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.scope-badge {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.scope-badge.scope-all {
  background: rgba(199, 172, 107, 0.22);
  color: #f5e6bc;
}

.scope-badge.scope-futbol {
  background: rgba(72, 136, 255, 0.18);
  color: #dce8ff;
}

.scope-badge.scope-basket {
  background: rgba(255, 139, 61, 0.18);
  color: #ffe1c6;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0, 8, 25, 0.2);
}

.card h1,
.card h2,
.card h3 {
  margin-top: 10;
  margin-bottom: 12px;
}

.narrow {
  max-width: 440px;
  margin: 64px auto;
}

.auth-panel {
  border-top: 1px solid var(--surface-border);
  margin-top: 14px;
  padding-top: 14px;
}

.auth-link-btn {
  margin-top: 8px;
}

.auth-message {
  margin-top: 12px;
}

.muted {
  color: var(--text-muted);
  margin-top: -4px;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  /*margin-bottom: 12px;*/
}

.field.inline {
  margin-bottom: 0;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #253155;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  min-height: 46px;
  border: 1px solid #bcc4d4;
  border-radius: 10px;
  background: #fff;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #18203b;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}

input,
select {
  width: 100%;
  border: 1px solid #bcc4d4;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: #18203b;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef1f7;
  border-color: #cfd7e6;
  color: #6d7897;
  cursor: not-allowed;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

input:disabled::placeholder,
textarea:disabled::placeholder {
  color: #8a94af;
}

input:focus,
select:focus,
button:focus,
summary:focus {
  outline: 2px solid rgba(181, 148, 69, 0.4);
  outline-offset: 1px;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  color: #11203c;
  background: #e2e6ef;
}

.btn:hover {
  filter: brightness(0.96);
}

.btn.primary {
  background: linear-gradient(180deg, #dbc080, var(--gold-strong));
  color: #1f1a0e;
}

.btn.ghost {
  background: #edf0f6;
  color: #172443;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  background: var(--danger-strong);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.message {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.92);
  color: #0f1a32;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 8, 25, 0.18);
}

.error {
  color: #a21f1f;
  min-height: 20px;
  font-weight: 700;
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 96px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  border: 1px solid var(--sidebar-border);
  border-radius: 14px;
  min-height: calc(100vh - 130px);
  overflow: hidden;
  transition: width 220ms ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-title {
  color: #e6edf8;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.menu-toggle {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.side-nav {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-link {
  width: 100%;
  border: 0;
  text-align: left;
  padding: 12px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.side-link.active {
  background: linear-gradient(90deg, rgba(199, 172, 107, 0.33), rgba(199, 172, 107, 0.16));
  color: #fff;
  border: 1px solid rgba(199, 172, 107, 0.45);
}

.menu-group {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.08);
}

.menu-group summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 10px;
  color: #e2ecfc;
  font-weight: 700;
  border-radius: 8px;
}

.menu-group summary::-webkit-details-marker {
  display: none;
}

.menu-group[open] summary {
  background: rgba(255, 255, 255, 0.08);
}

.admin-content {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-head h2 {
  color: #f4f7ff;
  margin: 0;
}

.card .panel-head h2 {
  color: #152449;
}

.form-card {
  max-width: 900px;
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.admin-sales-emit-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
}

.admin-sale-price-card,
.admin-sale-qty-card {
  margin-top: 16px;
  padding: 14px;
}

.admin-sale-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-sale-card-title {
  font-weight: 900;
  color: #1f2f59;
}

.admin-sale-price-grid,
.admin-sale-qty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-sale-price-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-sale-price-field > span:first-child,
.admin-sale-qty-label {
  font-weight: 900;
  color: #1f2f59;
}

.admin-sale-qty-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  padding: 16px;
  border: 1px solid #c7cede;
  border-radius: 12px;
  background: #fff;
}

.admin-sale-qty-label {
  font-size: 22px;
  line-height: 1.1;
}

.admin-sale-stepper {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.admin-sale-stepper input {
  height: 54px;
  padding: 8px 6px;
  text-align: center;
  font-size: 28px;
  font-weight: 900;
}

.admin-sale-stepper-btn {
  height: 54px;
  min-width: 52px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-totals-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.table-wrap {
  max-height: 560px;
  overflow: auto;
  border: 1px solid #d6dbe6;
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  text-align: left;
  background: #eef1f7;
  color: #2f3d66;
  padding: 10px 8px;
  border-bottom: 1px solid #dde3ef;
}

tbody td {
  border-bottom: 1px solid #edf0f6;
  padding: 8px;
  vertical-align: top;
}

tbody tr:hover {
  background: #f8f9fc;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.panel-head .row-actions {
  margin-top: 0;
  align-items: end;
}

.dashboard-toolbar {
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-scope-field {
  min-width: 180px;
  margin-top: 0;
}

.dashboard-scope-field label {
  font-size: 12px;
  white-space: nowrap;
}

.row-space {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.search-bar {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.grow {
  flex: 1;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.report-card {
  border: 1px solid #d6dbe6;
  background: #fbfcff;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-card span {
  font-size: 12px;
  color: #5d6680;
}

.report-card strong {
  font-size: 24px;
  color: #152449;
}

.taquilla-regularization-entry-table {
  width: max-content;
  min-width: 100%;
}

.taquilla-regularization-entry-table thead th {
  white-space: nowrap;
}

.taquilla-regularization-sales-grid th:nth-child(1),
.taquilla-regularization-sales-grid td:nth-child(1) {
  min-width: 160px;
}

.taquilla-regularization-sales-grid th:nth-child(2),
.taquilla-regularization-sales-grid td:nth-child(2),
.taquilla-regularization-sales-grid th:nth-child(3),
.taquilla-regularization-sales-grid td:nth-child(3),
.taquilla-regularization-sales-grid th:nth-child(4),
.taquilla-regularization-sales-grid td:nth-child(4),
.taquilla-regularization-sales-grid th:nth-child(5),
.taquilla-regularization-sales-grid td:nth-child(5),
.taquilla-regularization-sales-grid th:nth-child(7),
.taquilla-regularization-sales-grid td:nth-child(7) {
  min-width: 84px;
}

.taquilla-regularization-sales-grid th:nth-child(6),
.taquilla-regularization-sales-grid td:nth-child(6) {
  min-width: 110px;
  white-space: normal;
}

.taquilla-regularization-sales-grid th:nth-child(8),
.taquilla-regularization-sales-grid td:nth-child(8) {
  min-width: 88px;
}

.taquilla-regularization-courtesy-grid th:nth-child(1),
.taquilla-regularization-courtesy-grid td:nth-child(1) {
  min-width: 180px;
}

.taquilla-regularization-courtesy-grid th:nth-child(2),
.taquilla-regularization-courtesy-grid td:nth-child(2) {
  min-width: 110px;
}

.taquilla-regularization-courtesy-grid th:nth-child(3),
.taquilla-regularization-courtesy-grid td:nth-child(3) {
  min-width: 88px;
}

.taquilla-regularization-entry-table tbody td {
  padding: 6px 8px;
}

.taquilla-regularization-entry-table input,
.taquilla-regularization-entry-table select {
  min-width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #bcc8df;
  border-radius: 10px;
  background: #fff;
  color: #152449;
  font-size: 13px;
  font-weight: 600;
}

.taquilla-regularization-entry-table input[type="number"] {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.taquilla-regularization-entry-table .btn.small {
  min-width: 68px;
  min-height: 32px;
  border-radius: 10px;
  font-size: 12px;
}

.taquilla-regularization-entry-table select {
  padding-right: 28px;
}

.localidades-box {
  border: 1px solid #d7dce8;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
}

.localidad-item {
  border: 1px solid #e3e7f1;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fafbfe;
}

.localidad-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.localidad-name {
  font-weight: 700;
}

.localidad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.localidad-grid .field {
  margin: 0;
}

.localidad-grid.localidad-grid-fee {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #d7dce8;
}

.localidad-fee-hint {
  margin-top: 6px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 700;
  background: #dce4f5;
  color: #324a86;
}

.badge.off {
  background: #f3d8d8;
  color: #812626;
}

.small-text {
  font-size: 12px;
  color: var(--text-muted);
}

.admin-sale-error-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 14, 34, 0.62);
  z-index: 90;
}

.admin-sale-error-modal[hidden] {
  display: none !important;
}

.admin-sale-error-card {
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid rgba(162, 31, 31, 0.28);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(0, 8, 25, 0.32);
}

.admin-sale-error-head {
  margin: -20px -20px 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(162, 31, 31, 0.18);
  border-radius: 14px 14px 0 0;
  background: #fff1f1;
}

.admin-sale-error-head h3 {
  margin: 0;
  color: #711818;
}

#admin-sale-error-message {
  margin: 0;
  color: #172443;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 800;
}

.admin-sale-error-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.ticket-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
}

.ticket-modal[hidden] {
  display: none !important;
}

.ticket-modal-card {
  width: min(980px, 100%);
  height: min(90vh, 920px);
  background: #f3f4f7;
  border: 1px solid #ccd3e3;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.ticket-modal-head {
  padding: 10px 12px;
  border-bottom: 1px solid #d6dbe6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
}

.ticket-modal-head h3 {
  margin: 0;
}

#ticket-preview-content {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #fff;
  padding: 12px;
}

.ticket-batch-item.with-break {
  page-break-after: always;
  break-after: page;
}

@media print {
  html,
  body,
  body.print-mode {
    background: #fff !important;
    background-image: none !important;
  }

  #sdq-admin-build-badge {
    display: none !important;
  }

  body.print-mode #app {
    display: none !important;
  }

  body.print-mode #print-root {
    display: block !important;
    background: #fff !important;
    min-height: 100vh;
  }

  #print-root {
    display: none;
    margin: 0;
    padding: 0;
    background: #fff !important;
  }

  #print-root .ticket-batch {
    background: #fff !important;
  }

  #print-root .ticket-batch-item {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  #ticket-preview-content {
    padding: 0;
  }
  .ticket-modal-head {
    display: none !important;
  }
}

body.sidebar-collapsed .admin-shell {
  grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .menu-group summary,
body.sidebar-collapsed .menu-group .side-link {
  display: none;
}

body.sidebar-collapsed .side-nav {
  padding: 10px 8px;
}

body.sidebar-collapsed .side-link {
  text-align: center;
  padding: 12px 6px;
}

@media (max-width: 1200px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .localidad-grid {
    grid-template-columns: 1fr 1fr;
  }

  .localidad-grid.localidad-grid-fee {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .admin-sale-price-grid,
  .admin-sale-qty-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .admin-shell,
  body.sidebar-collapsed .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    display: block;
  }

  .sidebar .side-nav {
    display: none;
  }

  body.mobile-sidebar-open .sidebar .side-nav {
    display: flex;
  }

  body:not(.mobile-sidebar-open) .sidebar .sidebar-title {
    display: none;
  }

  body.sidebar-collapsed .sidebar-title,
  body.sidebar-collapsed .menu-group summary,
  body.sidebar-collapsed .menu-group .side-link {
    display: block;
  }

  body.sidebar-collapsed .side-link {
    text-align: left;
    padding: 12px 12px;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 12px;
  }

  .topbar {
    padding: 14px;
    flex-wrap: wrap;
  }

  .narrow {
    margin: 28px auto;
  }

  .row-space {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .localidad-grid {
    grid-template-columns: 1fr;
  }

  .localidad-grid.localidad-grid-fee {
    grid-template-columns: 1fr;
  }

  .taquilla-regularization-entry-table input,
  .taquilla-regularization-entry-table select {
    min-height: 34px;
    font-size: 13px;
    border-radius: 10px;
  }

  .taquilla-regularization-entry-table .btn.small {
    min-height: 34px;
    font-size: 12px;
  }
}
