:root {
  --primary: #f5c200;
  --primary-dark: #d4a800;
  --gold: #d4a800;
  --gold-dark: #b8900a;
  --green: #1a9e4e;
  --green-bg: #dcfce7;
  --green-border: #86efac;
  --green-text: #166534;
  --blue: #2473a8;
  --blue-bg: #dbeafe;
  --blue-border: #93c5fd;
  --blue-text: #1e40af;
  --amber-bg: #fef3c7;
  --amber-border: #fcd34d;
  --amber-text: #92400e;
  --purple-bg: #f3e8ff;
  --purple-text: #6b21a8;
  --gray: #6b7280;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #e5e7eb;
  --text: #111214;
  --text-muted: #6b7280;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  touch-action: manipulation;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header (alineado a Rifa · Fondo Familiar Herrera) */
header {
  background: #ffffff;
  padding: 12px 16px 0;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-bottom: 4px solid var(--primary);
  position: relative;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

header img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

header h1 {
  font-size: 1.65rem;
  font-weight: 900;
  color: #111214;
  letter-spacing: -0.5px;
}

header p {
  font-size: 0.86rem;
  color: #111214;
  opacity: 0.65;
  margin-top: 1px;
}

.header-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--surface2);
}

.sync-badge.live {
  background: var(--green-bg);
  color: var(--green-text);
  border-color: var(--green-border);
}

.admin-link {
  background: rgba(0, 0, 0, 0.07);
  color: #333;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s;
}

.admin-link:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.14);
}

/* Tabs Bar */
.tabs-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  color: var(--text);
  background: rgba(245, 194, 0, 0.1);
}

.tab-btn.active {
  color: var(--text);
  background: rgba(245, 194, 0, 0.2);
  border-bottom-color: var(--gold-dark);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 10px 16px;
  background: var(--surface);
  flex-wrap: wrap;
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat {
  text-align: center;
  min-width: 68px;
}

.stat-number {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 3px;
}

.stat.total .stat-number { color: var(--primary-dark); }
.stat.sealed .stat-number { color: var(--gray); }
.stat.opened .stat-number { color: var(--green); }
.stat.mine .stat-number { color: var(--blue); }

/* Main container */
.main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 16px 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Selector / Active user card */
.selector-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 18px;
  max-width: 620px;
  margin: 0 auto 14px;
  border: 1px solid var(--surface2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.selector-card h2 {
  text-align: center;
  font-size: 1rem;
  color: var(--gold-dark);
  margin-bottom: 3px;
}

.selector-card p {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.selector-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pin-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pin-input {
  width: 110px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 2px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
}

.pin-input:focus {
  border-color: var(--gold);
}

.login-error {
  display: none;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 0.83rem;
  font-weight: 600;
  text-align: center;
}

.login-error.visible {
  display: block;
}

.login-help {
  margin-top: 8px;
  margin-bottom: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.my-items-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.my-items-strip:empty,
.mini-pills:empty {
  display: none;
}

select.participant-select {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 2px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

select.participant-select:focus {
  border-color: var(--gold);
}

.user-banner {
  background: linear-gradient(135deg, rgba(245, 194, 0, 0.22), rgba(245, 194, 0, 0.07));
  border: 1.5px solid var(--primary);
  border-radius: 14px;
  padding: 12px 16px;
  max-width: 780px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.user-banner-info strong {
  font-size: 1.02rem;
}

.user-banner-sub {
  font-size: 0.84rem;
  color: #4b5563;
  margin-top: 2px;
}

.quota-pill {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--gold);
  color: var(--gold-dark);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 6px;
}

.btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn-gold {
  background: linear-gradient(135deg, var(--primary), var(--gold));
  color: #111214;
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 168, 0, 0.35);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* 2-Column Workspace: Tablero (izq) + Lista en vivo (der) */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.panel-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid var(--surface2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.panel-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.dot-sealed { background: var(--surface2); border: 1px solid #d1d5db; }
.dot-opened { background: var(--green-bg); border: 1px solid var(--green-border); }
.dot-mine { background: var(--primary); border: 1px solid var(--gold-dark); }

/* Boxes Grid (35 cajoncitos) */
.boxes-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.box-tile {
  position: relative;
  border-radius: 12px;
  min-height: 86px;
  padding: 6px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid #d1d5db;
  background: #f3f4f6;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.2s ease;
  user-select: none;
}

.box-tile.sealed {
  cursor: pointer;
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
  border-color: #d1d5db;
}

.box-tile.sealed:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(212, 168, 0, 0.22);
}

.box-tile.sealed.locked-hint {
  opacity: 0.78;
}

.box-tile.opened {
  background: var(--green-bg);
  border-color: var(--green-border);
  cursor: default;
}

.box-tile.opened.is-mine {
  background: #fef9c3;
  border: 2px solid var(--gold);
  box-shadow: 0 3px 10px rgba(212, 168, 0, 0.18);
}

.box-tile.just-opened {
  animation: popReveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popReveal {
  0% { transform: scale(0.75) rotateY(70deg); opacity: 0.4; }
  65% { transform: scale(1.06) rotateY(0deg); opacity: 1; }
  100% { transform: scale(1); }
}

.box-num {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--text-muted);
}

.box-gift {
  font-size: 1.55rem;
  line-height: 1.1;
  margin-bottom: 3px;
}

.box-sealed-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.box-emoji {
  font-size: 1.6rem;
  line-height: 1.1;
  margin-top: 8px;
  margin-bottom: 2px;
}

.box-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 3px;
}

.basket-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  margin-bottom: 2px;
}

.basket-1 {
  background: var(--amber-bg);
  color: var(--amber-text);
  border: 1px solid var(--amber-border);
}

.basket-2 {
  background: var(--blue-bg);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
}

.basket-extra {
  background: var(--purple-bg);
  color: var(--purple-text);
  border: 1px solid #d8b4fe;
}

.box-owner {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--green-text);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Sidebar: Live Lists */
.sidebar-card {
  position: sticky;
  top: 16px;
}

.progress-wrap,
.basket-mini-stats,
.filter-pills,
.list-section {
  margin-bottom: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.progress-track {
  height: 9px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #4ade80);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.basket-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.basket-stat-box {
  background: var(--bg);
  border: 1px solid var(--surface2);
  border-radius: 10px;
  padding: 7px 8px;
  text-align: center;
}

.basket-stat-box .b-title {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
}

.basket-stat-box .b-count {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  border: 1px solid #d1d5db;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.pill-btn.active {
  background: var(--primary);
  border-color: var(--gold);
  color: var(--text);
}

.list-section:last-child {
  margin-bottom: 0;
}

.list-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-section-title.done { color: var(--green-text); }
.list-section-title.pending { color: var(--blue-text); }

.items-scroll {
  max-height: 245px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--surface2);
  font-size: 0.8rem;
}

.item-row.done-row {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.item-row-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.item-row-name {
  font-weight: 700;
  color: var(--text);
}

.item-row-owner {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--green-text);
  white-space: nowrap;
}

.empty-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 8px;
  background: var(--bg);
  border-radius: 10px;
}

/* Collapsible Participants Section */
.collapsible-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--surface2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.collapsible-header:hover {
  background: rgba(245, 194, 0, 0.08);
}

.collapsible-header h2 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--gold-dark);
}

.collapsible-body {
  padding: 2px 16px 14px;
  display: none;
}

.collapsible-body.open {
  display: block;
}

.participants-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.participant-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--surface2);
}

.participant-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.participant-card-name {
  font-weight: 800;
  font-size: 0.9rem;
}

.participant-card-quota {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.mini-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.mini-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-border);
}

/* Rifa Tab */
.rifa-header-card,
.rifa-my-profile,
.rifa-board-card,
.tab-panel .collapsible-card {
  margin-bottom: 12px;
}

.tab-panel .collapsible-card:last-child {
  margin-bottom: 0;
}

.rifa-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.rifa-extra-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1.5px solid #93c5fd;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 3px 12px rgba(36, 115, 168, 0.1);
}

.rifa-extra-card.complete {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
}

.rifa-extra-left {
  flex: 1 1 320px;
}

.rifa-extra-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--blue-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.extra-pool-badge {
  display: inline-block;
  background: var(--blue);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  padding: 2px 11px;
  border-radius: 999px;
}

.rifa-extra-card.complete .extra-pool-badge {
  background: var(--green);
}

.rifa-extra-left h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 3px;
}

.rifa-extra-left p {
  font-size: 0.83rem;
  color: #374151;
}

.rifa-extra-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.rifa-price-box {
  font-size: 0.82rem;
  color: var(--blue-text);
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.rifa-claim-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rifa-qty-select {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1.5px solid #93c5fd;
  background: #ffffff;
  font-weight: 700;
  font-size: 0.86rem;
}

.rifa-my-profile {
  margin-bottom: 18px;
}

.rifa-profile-splits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.rifa-split-box {
  background: var(--bg);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  padding: 10px 12px;
}

.rifa-split-lbl {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
}

.dot-rifa-init { background: var(--blue-bg); border: 1px solid var(--blue-border); }
.dot-rifa-extra { background: #ede9fe; border: 1px solid #c4b5fd; }

/* Grilla 20 casillas de 5 números */
.rifa-boxes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rifa-box-tile {
  position: relative;
  border-radius: 14px;
  min-height: 104px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid #d1d5db;
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  user-select: none;
}

.rifa-box-tile.sealed {
  cursor: pointer;
}

.rifa-box-tile.sealed:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(212, 168, 0, 0.22);
}

.rifa-box-tile.sealed.locked-hint {
  opacity: 0.78;
}

.rifa-box-tile.opened.initial {
  background: var(--blue-bg);
  border-color: var(--blue-border);
}

.rifa-box-tile.opened.extra {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.rifa-box-tile.opened.is-mine {
  border: 2px solid var(--primary);
  box-shadow: 0 4px 12px rgba(212, 168, 0, 0.22);
}

.rifa-box-tile.just-opened {
  animation: popReveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rifa-box-nums {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin: 10px 0 4px;
}

.rifa-mini-ball {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.rifa-mini-ball.sold {
  background: var(--green-bg);
  color: var(--green-text);
  border-color: var(--green-border);
}

.rifa-box-owner {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text);
}

.rifa-box-type {
  font-size: 0.64rem;
  font-weight: 800;
  margin-top: 2px;
  color: var(--text-muted);
}

.num-pill.clickable {
  cursor: pointer;
}

.num-pill.clickable:hover {
  filter: brightness(0.95);
}

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

.rifa-cell {
  border-radius: 10px;
  min-height: 62px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px solid #d1d5db;
  background: #e5e7eb;
  color: #6b7280;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.rifa-cell.initial {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue-text);
}

.rifa-cell.extra {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}

.rifa-cell.sold {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green-text);
}

.rifa-cell.is-mine {
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(212, 168, 0, 0.25);
  cursor: pointer;
}

.rifa-cell.is-mine:hover {
  transform: scale(1.06);
}

.rifa-cell.just-claimed {
  animation: popReveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rifa-num {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
}

.rifa-owner {
  font-size: 0.56rem;
  font-weight: 700;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.rifa-badge-corner {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.62rem;
  font-weight: 900;
}

.num-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
}

.num-pill.extra {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

.num-pill.sold {
  background: var(--green-bg);
  color: var(--green-text);
  border-color: var(--green-border);
}

.admin-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-rifa-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.admin-field input {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--surface2);
  font-size: 0.84rem;
}

.admin-dist-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.admin-confirmed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.admin-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

/* Modal Admin */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 18, 20, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h3 {
  font-size: 1.08rem;
  color: var(--gold-dark);
}

.admin-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-input-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--surface2);
  font-size: 0.95rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  margin: 12px 0;
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111214;
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 12px;
  border-left: 4px solid var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  max-width: calc(100vw - 24px);
  width: max-content;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1200;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

footer {
  text-align: center;
  padding: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .sidebar-card {
    position: static;
  }
}

@media (max-width: 600px) {
  header {
    padding: 36px 10px 0;
  }
  .header-actions {
    top: 8px;
    right: 10px;
  }
  .header-inner {
    gap: 10px;
    padding-bottom: 8px;
  }
  header img {
    width: 46px;
    height: 46px;
  }
  header h1 {
    font-size: 1.22rem;
  }
  header p {
    font-size: 0.76rem;
  }
  .tabs-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .tab-btn {
    padding: 8px 6px;
    min-height: 42px;
    font-size: 0.84rem;
  }
  .stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 6px;
  }
  .stat {
    min-width: 0;
  }
  .stat-number {
    font-size: 1.25rem;
  }
  .stat-label {
    font-size: 0.58rem;
    letter-spacing: 0.3px;
  }
  .main {
    padding: 10px 8px 20px;
  }
  .workspace-grid {
    gap: 10px;
    margin-bottom: 10px;
  }
  .panel-card,
  .selector-card,
  .user-banner,
  .rifa-extra-card {
    padding: 12px 10px;
    border-radius: 14px;
    margin-bottom: 10px;
  }
  .rifa-header-card,
  .rifa-my-profile,
  .rifa-board-card,
  .tab-panel .collapsible-card {
    margin-bottom: 10px;
  }
  .btn {
    min-height: 44px;
    padding: 9px 12px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 6px 10px;
  }
  select.participant-select,
  .pin-input,
  .admin-input-row input,
  .admin-field input {
    font-size: 16px;
    min-height: 44px;
  }
  .selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pin-group {
    width: 100%;
  }
  .pin-input {
    flex: 1;
  }
  .user-banner .btn,
  .rifa-extra-controls .btn {
    width: 100%;
  }
  .boxes-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .box-tile {
    min-height: 90px;
    padding: 6px 4px;
    border-radius: 12px;
  }
  .box-gift,
  .box-emoji {
    font-size: 1.4rem;
    margin-top: 4px;
  }
  .box-name {
    font-size: 0.69rem;
  }
  .rifa-boxes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .rifa-box-tile {
    min-height: 106px;
    padding: 10px 6px;
  }
  .rifa-mini-ball {
    font-size: 0.78rem;
    padding: 3px 6px;
  }
  .rifa-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .rifa-cell {
    min-height: 50px;
  }
  .rifa-extra-controls {
    align-items: stretch;
    width: 100%;
  }
  .pill-btn {
    min-height: 38px;
    padding: 6px 11px;
  }
  .modal-box {
    max-height: 90dvh;
    padding: 14px 12px;
  }
  .admin-row {
    flex-wrap: wrap;
  }
  .admin-rifa-config,
  .admin-confirmed-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .boxes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
