:root {
  --pg-sidebar: #152238;
  --pg-sidebar-text: #9eb0c9;
  --pg-accent: #3b82f6;
  --pg-accent-2: #22c1c3;
  --pg-accent-hover: #2563eb;
  --pg-bg: #eef3fb;
  --pg-card: #ffffff;
  --pg-line: #e3ebf5;
  --pg-text: #1e293b;
  --pg-muted: #64748b;
  --pg-radius: 1rem;
  --pg-tabbar-height: 4.35rem;
}

html {
  font-size: 16px;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  color: var(--pg-text);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(59, 130, 246, 0.16), transparent 55%),
    radial-gradient(700px 380px at 108% 0%, rgba(34, 193, 195, 0.14), transparent 50%),
    var(--pg-bg);
}

body.login-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(59, 130, 246, 0.22), transparent 50%),
    radial-gradient(900px 400px at 110% 10%, rgba(34, 193, 195, 0.16), transparent 45%),
    var(--pg-bg);
}

.login-card {
  max-width: 28rem;
  border: 0;
  border-radius: 1.35rem;
  box-shadow: 0 22px 50px rgba(21, 34, 56, 0.1);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--pg-accent), var(--pg-accent-2));
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.28);
}

.sidebar {
  --pg-sidebar-width: 16.25rem;
  position: relative;
  width: var(--pg-sidebar-width);
  flex: 0 0 auto;
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.16), transparent 28%),
    var(--pg-sidebar);
  color: #fff;
  min-height: 100vh;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 0.4rem;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.sidebar-resizer:hover,
.sidebar.is-resizing .sidebar-resizer {
  background: rgba(59, 130, 246, 0.45);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
}

.sidebar-mark {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.85rem;
  flex: 0 0 auto;
}

.sidebar.is-icons .nav-link-text,
.sidebar.is-icons .sidebar-brand-text {
  display: none;
}

.sidebar.is-icons .nav-link {
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

.sidebar.is-icons .sidebar-brand {
  display: flex;
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.sidebar-brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand a {
  color: #fff;
  text-decoration: none;
}

.sidebar-nav {
  gap: 0.15rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--pg-sidebar-text);
  border-radius: 0.75rem;
  padding: 0.62rem 0.85rem;
  font-weight: 500;
}

.sidebar-nav .nav-link-icon {
  display: inline-flex;
  opacity: 0.9;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.32), rgba(34, 193, 195, 0.12));
}

.topbar {
  border-bottom: 1px solid rgba(227, 235, 245, 0.9);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  min-height: 3.75rem;
}

.page-title {
  font-weight: 650;
  letter-spacing: -0.02em;
}

.user-chip {
  color: var(--pg-muted);
  background: #eef4ff;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  max-width: 22rem;
}

.content {
  background: transparent;
  flex: 1;
}

.offcanvas {
  width: 16.5rem;
  background: var(--pg-sidebar);
  color: #fff;
}

.offcanvas .btn-close {
  filter: invert(1);
}

.offcanvas-title {
  font-weight: 700;
}

.card {
  border: 1px solid var(--pg-line);
  border-radius: var(--pg-radius);
  box-shadow: 0 10px 28px rgba(21, 34, 56, 0.05);
  background: var(--pg-card);
}

.card .card-body {
  padding: 1.15rem 1.25rem;
}

.btn {
  border-radius: 0.75rem;
  font-weight: 550;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pg-accent), #4f8ef7);
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--pg-accent-hover), var(--pg-accent));
  border-color: transparent;
}

.form-control,
.form-select {
  border-radius: 0.75rem;
  border-color: #d5deed;
}

.form-control:focus,
.form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pg-muted);
  font-weight: 600;
  background: #f5f8fd;
  border-bottom-color: var(--pg-line);
}

.alert {
  border: 0;
  border-radius: 0.9rem;
}

.page-lead {
  color: var(--pg-muted);
  max-width: 44rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.org-card + .org-card {
  margin-top: 0.85rem;
}

.org-actions .form-control {
  min-width: 12rem;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 11rem;
  padding: 1.5rem;
  text-align: center;
  border: 2px dashed #c5d3e6;
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #f8fbff, #f3f7fc);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--pg-accent);
  background: rgba(59, 130, 246, 0.08);
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.receipt-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  padding: 0.5rem;
  border: 1px solid var(--pg-line);
  border-radius: 0.9rem;
  background: #f8f9fb;
  overflow: hidden;
}

.receipt-preview img {
  max-width: 100%;
  max-height: 18rem;
  object-fit: contain;
}

.prize-row {
  padding: 0.75rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--pg-line);
  border-radius: 0.9rem;
  background: #fbfcff;
}

.prize-row-fields {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.prize-place-to,
.prize-place-range {
  display: none;
}

.prize-row.is-multiprize .prize-place-to,
.prize-row.is-multiprize .prize-place-range {
  display: block;
}

.prize-row.is-multiprize .prize-place-single {
  display: none;
}

.prize-row.is-multiprize .prize-row-fields {
  grid-template-columns: 5rem 5rem minmax(0, 1fr) auto auto;
}

.prize-name {
  min-width: 0;
}

.prize-multi {
  padding-bottom: 0.2rem;
}

.prize-delete {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.prize-delete .js-prize-delete {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.prize-delete-btn {
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
}

.prize-row-deleted {
  display: none;
}

.ticket-void,
.ticket-void td {
  text-decoration: line-through;
  color: #6c757d;
}

.results-table input[type="number"] {
  max-width: 8rem;
}

.tickets-board td {
  font-size: 1.05rem;
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  align-items: stretch;
  min-height: var(--pg-tabbar-height);
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--pg-line);
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 24px rgba(21, 34, 56, 0.06);
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  border: 0;
  background: transparent;
  color: var(--pg-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 0;
}

.mobile-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-tab.active {
  color: var(--pg-accent);
}

.modal-content {
  border: 0;
  border-radius: 1.1rem;
}

.table-shell {
  overflow: hidden;
}

.table-title-link {
  font-weight: 600;
  color: var(--pg-text);
  text-decoration: none;
}

.table-title-link:hover {
  color: var(--pg-accent);
}

.ticket-number {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.filter-card .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pg-muted);
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.empty-state {
  padding: 2.4rem 1.25rem;
  text-align: center;
  color: var(--pg-muted);
  background: linear-gradient(180deg, #f8fbff, #f3f7fc);
}

.empty-state-title {
  font-weight: 650;
  color: var(--pg-text);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.stat-chip {
  padding: 0.85rem 1rem;
  border: 1px solid var(--pg-line);
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: 0 8px 20px rgba(21, 34, 56, 0.04);
}

.stat-chip-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.stat-chip-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-chip-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.stat-chip-action .stat-chip-label {
  display: none;
}

.status-pill.draft,
.status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.collecting,
.status-pill.accepted,
.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.finished,
.status-pill.rejected,
.status-pill.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.queued {
  background: #e0e7ff;
  color: #3730a3;
}

.manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.85rem;
}

.manager-card {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--pg-line);
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: 0 10px 24px rgba(21, 34, 56, 0.05);
}

.manager-card.is-blocked {
  opacity: 0.78;
}

.manager-card-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pg-accent), var(--pg-accent-2));
  color: #fff;
  font-weight: 700;
}

.manager-card-body {
  flex: 1 1 8rem;
  min-width: 0;
}

.manager-card-action {
  margin: 0;
}

.manager-create {
  max-width: 40rem;
}

.status-pill.new {
  background: #e0e7ff;
  color: #3730a3;
}

@media (max-width: 991.98px) {
  .sidebar {
    min-height: auto;
  }

  body.dashboard {
    padding-bottom: calc(var(--pg-tabbar-height) + env(safe-area-inset-bottom));
  }

  .content {
    padding-bottom: 1.25rem;
  }

  .prize-row-fields,
  .prize-row.is-multiprize .prize-row-fields {
    grid-template-columns: 1fr 1fr;
  }

  .prize-name,
  .prize-multi,
  .prize-delete {
    grid-column: 1 / -1;
  }

  .prize-delete {
    justify-content: flex-start;
  }

  .table td,
  .table th {
    white-space: nowrap;
  }

  .tickets-board td {
    white-space: normal;
    font-size: 0.95rem;
  }
}

@media (max-width: 575.98px) {
  .card .card-body {
    padding: 1rem;
  }

  .topbar {
    min-height: 3.25rem;
  }
}
