/* ============================================================
   BILHETES SOLIDÁRIOS — style.css
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:          #0c6b6b;
  --teal-dark:     #084f4f;
  --teal-mid:      #0f8888;
  --teal-bg:       #e6f4f4;
  --bg:            #f0ede6;
  --white:         #ffffff;
  --text:          #1a1a1a;
  --text-mid:      #444;
  --text-muted:    #888;
  --border:        #e4dfd6;
  --shadow:        0 1px 4px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --radius:        14px;
  --radius-sm:     8px;
  --gold:          #b8860b;
  --gold-bg:       #fef9ee;
  --silver:        #7a7a8a;
  --silver-bg:     #f4f4f8;
  --bronze:        #a0522d;
  --bronze-bg:     #fdf2ec;
  --green-row:     #f0faf4;
  --red-row:       #fff5f5;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-body { padding-top: 2rem; padding-bottom: 3rem; }

/* ---------- Navbar ---------- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--teal);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}

.brand-icon { font-size: 1.3rem; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.navbar-username {
  font-size: .9rem;
  color: var(--text-mid);
  margin-right: .25rem;
}

.inline-form { display: inline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-weight: 600;
  font-size: .95rem;
  border-radius: var(--radius-sm);
  padding: .6rem 1.25rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  text-decoration: none;
}

.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { opacity: .75; }

.btn-primary  { background: var(--teal); color: var(--white); border-color: var(--teal); }
.btn-outline  { background: transparent; color: var(--teal); border-color: var(--teal); }
.btn-ghost    { background: transparent; color: var(--text-mid); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm       { font-size: .85rem; padding: .4rem .9rem; }
.btn-block    { width: 100%; display: flex; margin-top: .5rem; }

/* Hero button */
.btn-hero {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,.7);
  font-size: 1rem;
  padding: .65rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}

.btn-hero:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* ---------- Flash Messages ---------- */
.flash-container {
  max-width: 1040px;
  margin: 1rem auto 0;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.flash {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
}

.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.flash-close {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  opacity: .6; padding: 0 .2rem; line-height: 1; color: inherit;
}

.flash-close:hover { opacity: 1; }

/* ---------- Hero Section ---------- */
.hero {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--white);
  padding: 3rem 0 3.5rem;
  margin-bottom: 0;
}

.hero .container { max-width: 1040px; }

.hero-eyebrow {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: .75rem;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: .75rem;
}

.hero-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,.8);
  max-width: 520px;
  margin-bottom: 1.5rem;
}

/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.stat-icon { font-size: 1.6rem; flex-shrink: 0; }

.stat-body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

/* ---------- Progress Bar ---------- */
.progress-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.progress-label { font-weight: 600; font-size: .95rem; }

.progress-remaining { font-size: .88rem; color: var(--text-muted); }

.progress-track {
  background: #e5e7eb;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  background: var(--teal);
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
  min-width: 4px;
}

/* ---------- Ranking Card ---------- */
.ranking-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ranking-card-header {
  padding: 1.25rem 1.4rem .9rem;
  border-bottom: 1px solid var(--border);
}

.ranking-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
}

.ranking-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--green { background: var(--teal); }
.legend-dot--red   { background: #e53e3e; }

/* ---------- Ranking List ---------- */
.ranking-list {
  list-style: none;
  margin: 0; padding: 0;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.ranking-row:last-child { border-bottom: none; }
.ranking-row--green { background: var(--green-row); }
.ranking-row--red   { background: var(--red-row); }

/* Position badge */
.rank-badge {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  font-weight: 700;
}

.rank-badge--gold   { background: var(--gold-bg);   color: var(--gold);   font-size: 1.35rem; }
.rank-badge--silver { background: var(--silver-bg); color: var(--silver); font-size: 1.25rem; }
.rank-badge--bronze { background: var(--bronze-bg); color: var(--bronze); font-size: 1.25rem; }
.rank-badge--num    {
  background: var(--teal-bg);
  color: var(--teal);
  font-size: .95rem;
  border: 1.5px solid rgba(12,107,107,.2);
}

/* Name / meta */
.rank-info { flex: 1; min-width: 0; }

.rank-name {
  font-weight: 700;
  font-size: 1rem;
  display: block;
  margin-bottom: .2rem;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}

.rank-tickets { font-size: .82rem; color: var(--text-muted); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 99px;
}

.badge--green { background: var(--teal); color: var(--white); }
.badge--red   { background: #e53e3e;     color: var(--white); }

/* Value */
.rank-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  flex-shrink: 0;
  text-align: right;
  min-width: 100px;
}

.ranking-footer {
  padding: .8rem 1.4rem;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #fafaf9;
}

/* ---------- Auth Page ---------- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 60px);
  padding: 4rem 1.25rem;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: .35rem;
}

.auth-subtitle {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.auth-hint {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1.25rem;
  line-height: 1.6;
}

.auth-footer {
  text-align: center;
  margin-top: 1.1rem;
  font-size: .88rem;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: .4rem;
}

.required { color: #e53e3e; }

.form-input {
  width: 100%;
  padding: .6rem .85rem;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(12,107,107,.12);
}

.form-input::placeholder { color: #b0aba3; }

/* ---------- Form card ---------- */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 520px;
  box-shadow: var(--shadow);
}

.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ---------- Action grid (painel) ---------- */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.action-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}

.action-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.action-icon { font-size: 1.8rem; }

.action-label {
  font-weight: 700;
  font-size: 1rem;
}

.action-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---------- Tables ---------- */
.table-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th {
  background: #fafaf9;
  padding: .75rem 1rem;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafaf9; }

.table-total td {
  font-weight: 700;
  background: #fafaf9;
  border-top: 2px solid var(--border);
}

.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-bold   { font-weight: 700; }

/* ---------- Section title ---------- */
.section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.section-title--no-margin { margin-bottom: 0; }

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}

.status-pill--active {
  background: #d4edda;
  color: #155724;
}

.status-pill--inactive {
  background: #f8d7da;
  color: #721c24;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-divider {
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.modal-subtitle {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.form-error {
  color: #721c24;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .875rem;
  margin-bottom: .75rem;
}

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

.empty-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow);
}

.empty-icon { font-size: 2.5rem; }

/* ---------- Error pages ---------- */
.error-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  text-align: center;
  padding: 2rem 1.25rem;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1;
  margin-bottom: .5rem;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.error-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero-title { font-size: 1.7rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
  .rank-value { min-width: 80px; font-size: .95rem; }
  .form-card { padding: 1.25rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid--3 { grid-template-columns: 1fr; }
  .ranking-row { flex-wrap: wrap; gap: .6rem; }
  .ranking-legend { flex-direction: column; gap: .4rem; }
  .form-actions { flex-direction: column; }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: .6rem .75rem; }
  .navbar-username { display: none; }
  .modal-card {
    max-width: 100%;
    padding: .9rem;
  }
  .modal-actions {
    flex-direction: column;
  }
  .modal-actions .btn {
    width: 100%;
  }
  .student-summary-table thead {
    display: none;
  }
  .student-summary-table,
  .student-summary-table tbody,
  .student-summary-table tr,
  .student-summary-table td {
    display: block;
    width: 100%;
  }
  .student-summary-table tr {
    border-bottom: 1px solid var(--border);
    padding: .55rem .75rem;
  }
  .student-summary-table td {
    border: 0;
    padding: .25rem 0;
    text-align: left !important;
  }
  .student-summary-table td::before {
    content: attr(data-label);
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .1rem;
    font-weight: 700;
    letter-spacing: .04em;
  }
  .student-summary-table tfoot td {
    display: table-cell;
  }
  .student-summary-table tfoot td::before {
    content: none;
  }
}

/* ============================================================
   BILHETES — Grade, estados e layout principal
   ============================================================ */

/* ---- Layout principal (desktop: 2 colunas) ---- */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.main-col { min-width: 0; }
.side-col  { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }

/* ---- Card genérico ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .9rem;
}

/* ---- Stats campanha ---- */
.campaign-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}

/* ---- Seção de bilhetes ---- */
.tickets-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tickets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: .9rem;
}

.tickets-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  font-size: .8rem;
  color: var(--text-muted);
}

.tickets-legend .legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* ---- Bilhete card ---- */
.ticket {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border: none;
  padding: 0;
  line-height: 1;
  transition: transform .1s, opacity .1s;
  -webkit-tap-highlight-color: transparent;
}

.ticket:active { transform: scale(.92); }

.ticket-available {
  background: #c8f0d0;
  color: #155724;
}

.ticket-sold {
  background: #f5c6cb;
  color: #721c24;
  cursor: not-allowed;
  opacity: .85;
}

.ticket-selected {
  background: #0c6b6b;
  color: #fff;
  box-shadow: 0 0 0 2px #0c6b6b, 0 0 0 4px rgba(12,107,107,.25);
}

/* Legend sample (smaller) */
.legend-sample {
  width: 32px !important;
  height: 24px !important;
  aspect-ratio: unset !important;
  border-radius: 4px;
  font-size: .7rem;
  cursor: default;
}

/* ---- Grid ---- */
.tickets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
}

/* ---- Selection info ---- */
.selection-info {
  background: var(--teal-bg);
  border: 1px solid rgba(12,107,107,.2);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  margin: .75rem 0;
  font-size: .85rem;
}

.selection-counter { font-weight: 700; color: var(--teal); margin-bottom: .2rem; }
.selection-numbers { color: var(--text-mid); word-break: break-all; }

/* ---- Confirm box ---- */
.confirm-box {
  background: var(--teal-bg);
  border: 1px solid rgba(12,107,107,.2);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}

.confirm-title { font-weight: 700; margin-bottom: .6rem; font-size: .95rem; }

.confirm-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .2rem .75rem;
  font-size: .875rem;
}

.confirm-details dt { font-weight: 600; color: var(--text-mid); }
.confirm-details dd { margin: 0; word-break: break-word; }

/* ---- Sale header ---- */
.sale-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

.sale-greeting { font-size: .95rem; color: var(--text-mid); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  /* Mobile order: stats → login/sale → ranking → grade */
  .main-layout .main-col { order: 2; }
  .main-layout .side-col { order: 1; }

  .campaign-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .campaign-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }

  .tickets-grid {
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 3px;
  }

  .ticket { font-size: .62rem; border-radius: 4px; }

  .confirm-details { font-size: .82rem; }
}
