:root {
  --primary: #1668dc;
  --primary-dark: #0b4fb0;
  --primary-soft: #eaf3ff;
  --primary-line: #c9defb;
  --text: #172033;
  --sub: #667085;
  --light-sub: #8a97a8;
  --line: #e3e8f0;
  --bg: #f3f6fb;
  --card: #ffffff;
  --success: #12a150;
  --warning: #b54708;
  --danger: #d92d20;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(16, 42, 82, .08);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  font-synthesis: none;
}

body:has(.sheet-backdrop) { overflow: hidden; }

a {
  color: var(--primary);
  text-decoration: none;
}

h1, h2, h3, h4, p { overflow-wrap: anywhere; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 12px calc(22px + env(safe-area-inset-bottom));
}

.hero {
  margin: 4px 0 16px;
  padding: 26px 22px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, #0f4fc0, #1684dc);
}

.hero h1 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card h2, .card h3 { margin-top: 0; }

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  width: 100%;
  min-height: 46px;
  margin: 5px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  font-size: 16px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22, 104, 220, .1);
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary, button.secondary {
  color: var(--text);
  background: #edf1f6;
}

.internal-logout {
  margin-top: 16px;
  text-align: right;
}

.internal-logout form {
  margin: 0;
}

.internal-logout button {
  min-height: 40px;
  padding: 8px 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-weight: 700;
}

.muted { color: var(--sub); }
.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 700;
}
.badge.green { color: var(--success); background: #e9f8ef; }
.badge.orange { color: var(--warning); background: #fff4e5; }
.errorlist { color: var(--danger); }
.messages { margin: 0 0 14px; padding: 0; list-style: none; }
.messages li {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff8eb;
}
.footer {
  padding: 24px 14px calc(24px + env(safe-area-inset-bottom));
  color: var(--sub);
  text-align: center;
  font-size: 13px;
}

/* 参赛端：手机优先 */
.seat-page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.hero-card {
  position: relative;
  margin: 2px 0 14px;
  padding: 24px 20px 26px;
  overflow: hidden;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(147, 211, 255, .38), transparent 34%),
    linear-gradient(135deg, #102d68 0%, #1158bf 56%, #1785db 100%);
  box-shadow: 0 18px 42px rgba(17, 75, 150, .2);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -70px;
  bottom: -110px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
}

.hero-kicker {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  opacity: .86;
}

.hero-kicker-line {
  display: block;
  line-height: 1.45;
}

.hero-card h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 32px;
  line-height: 1.18;
}

.hero-card p {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  font-size: 14.5px;
  opacity: .9;
}

.hero-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
}

.hero-status, .hero-place {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
}

.hero-status::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #72f2b6;
}

.hero-status.pending::before { background: #ffd166; }

.query-card {
  position: relative;
  margin: -22px 0 16px;
  padding: 16px;
  border: 1px solid #e6ecf4;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 14px 36px rgba(16, 42, 82, .1);
}

.section-title { margin-bottom: 14px; }
.section-kicker {
  display: inline-block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}
.section-title h2, .results-header h2 {
  margin: 2px 0 0;
  font-size: 21px;
  line-height: 1.25;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  background: #edf2f8;
}

.segment {
  display: flex;
  min-height: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #5d6b80;
  transition: all .16s ease;
}

.segment strong { font-size: 15px; }
.segment small { font-size: 11.5px; color: var(--light-sub); }
.segment.active {
  color: var(--primary-dark);
  border-color: #d9e8fb;
  background: #fff;
  box-shadow: 0 5px 14px rgba(22, 104, 220, .1);
}

.query-form {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.query-label {
  margin-bottom: -4px;
  color: #344054;
  font-size: 14px;
  font-weight: 750;
}

.query-input {
  min-height: 52px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #d7e0ec;
  border-radius: 15px;
  background: #fbfdff;
  font-size: 16px;
}

.query-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 104, 220, .11);
}

.primary-btn {
  min-height: 52px;
  width: 100%;
  border-radius: 15px;
  background: linear-gradient(135deg, #176de2, #0f55bd);
  box-shadow: 0 8px 18px rgba(22, 104, 220, .2);
}

.primary-btn:active { transform: translateY(1px); }

.helper-text {
  margin: 0;
  color: var(--sub);
  font-size: 12.5px;
}

.form-alert {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #fed7aa;
  border-radius: 13px;
  color: var(--warning);
  background: #fff8eb;
  font-size: 14px;
}

/* 底部抽屉 */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(5px);
}

.bottom-sheet {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -12px 44px rgba(15, 23, 42, .24);
}

.sheet-grabber {
  display: block;
  width: 42px;
  height: 4px;
  margin: 4px auto 14px;
  border-radius: 999px;
  background: #d0d8e3;
}

.sheet-header h2 { margin: 3px 0 4px; font-size: 22px; }
.sheet-header p { margin: 0; color: var(--sub); font-size: 13.5px; }

.pick-list {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #dce4ee;
  border-radius: 15px;
  cursor: pointer;
  transition: all .15s ease;
}

.pick-item:last-child { margin-bottom: 0; }
.pick-item input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.pick-body { min-width: 0; }
.pick-body strong { display: block; font-size: 15.5px; }
.pick-body small { display: block; color: var(--sub); font-size: 12.5px; }
.pick-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 18px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 15px;
  color: #344054;
  background: #edf1f6;
  font-weight: 700;
}

/* 结果 */
.results { display: grid; gap: 14px; }
.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 2px 0;
}
.result-filters {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.filter-select select {
  width: 145px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}
.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stat-pills span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid #e0e7f0;
  border-radius: 999px;
  color: var(--sub);
  background: #fff;
  font-size: 13px;
}
.stat-pills strong { color: var(--primary-dark); font-size: 15px; }

.person-grid, .org-grid { display: grid; gap: 14px; }
.person-card {
  overflow: hidden;
  border: 1px solid #e0e7f0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 42, 82, .06);
}

.person-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f6;
  background: linear-gradient(120deg, #fff, #f8fbff);
}

.person-meta { min-width: 0; flex: 1; }
.person-meta h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.person-meta p { margin: 2px 0 0; color: var(--sub); font-size: 12px; }
.bib {
  display: inline-block;
  margin-right: 6px;
  color: var(--primary-dark);
  font-weight: 800;
}
.count-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
}

.seat-cards {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  list-style: none;
}

.seat-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #dfe7f1;
  border-radius: 14px;
  background: #fbfdff;
}

.event-row {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  align-items: center;
}

.event-category {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
}

.event-row h4 {
  margin: 0;
  min-width: 0;
  font-size: 15px;
  line-height: 1.25;
}

.seat-full {
  margin-top: 0;
  padding: 7px 8px;
  border-radius: 10px;
  color: #0d56b7;
  background: #e9f2ff;
  text-align: center;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.seat-meta-list {
  display: grid;
  gap: 4px;
  margin: 0;
  align-content: center;
}

.meta-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.meta-row dt { color: var(--light-sub); font-size: 11.5px; font-weight: 750; }
.meta-row dd { margin: 0; font-size: 12px; line-height: 1.25; font-variant-numeric: tabular-nums; }

.org-result {
  padding: 15px;
  border: 1px solid #dce6f2;
  border-radius: 20px;
  background: #f7faff;
}
.org-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.org-header h3 { margin: 2px 0 0; font-size: 19px; }
.org-header > span { color: var(--sub); font-size: 12.5px; text-align: right; }
.person-grid.nested { gap: 12px; }

.empty-state, .empty-result {
  padding: 34px 20px;
  border: 1px dashed #ccd8e7;
  border-radius: 20px;
  color: var(--sub);
  background: #fff;
  text-align: center;
}
.empty-state h2 { margin: 10px 0 6px; color: #344054; }
.empty-state p { margin: 0; font-size: 14px; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  background: #edf3fb;
  color: var(--primary);
  font-weight: 900;
}
.empty-compact {
  padding: 18px;
  color: var(--sub);
  font-size: 13.5px;
}

.notice-card {
  margin: 18px 0 4px;
  padding: 15px 16px;
  border-left: 4px solid #75a5e9;
  border-radius: 0 14px 14px 0;
  color: #5f6e83;
  background: #edf4fd;
  font-size: 13px;
}
.notice-card strong { display: block; color: #315c96; margin-bottom: 3px; }
.notice-card p { margin: 0; }
.notice-important {
  display: inline;
  margin: 0;
  color: #d92d20;
  font-weight: 800;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 380px) {
  .container { padding-left: 10px; padding-right: 10px; }
  .hero-card { padding: 21px 17px 23px; }
  .hero-card h1 { font-size: 29px; }
  .query-card { padding: 14px; }
  .segment { min-height: 58px; padding: 9px 6px; }
  .segment strong { font-size: 14px; }
  .event-row { gap: 7px; }
  .event-category { min-width: 40px; padding: 0 7px; }
  .event-row h4 { font-size: 14.5px; }
  .seat-card { grid-template-columns: 96px minmax(0, 1fr); gap: 7px 8px; }
  .seat-full { font-size: 17px; }
  .meta-row { grid-template-columns: 50px minmax(0, 1fr); gap: 5px; }
}

@media (min-width: 760px) {
  .container { padding: 24px 18px 34px; }
  .hero-card {
    min-height: 245px;
    padding: 38px 42px;
    border-radius: 28px;
  }
  .hero-card h1 { font-size: 44px; }
  .hero-card p { max-width: 620px; font-size: 16px; }
  .hero-kicker { font-size: 13px; }
  .query-card {
    margin-top: -28px;
    padding: 26px;
    border-radius: 24px;
  }
  .segment { min-height: 76px; }
  .query-form { max-width: 620px; margin-left: auto; margin-right: auto; }
  .sheet-backdrop { align-items: center; padding: 24px; }
  .bottom-sheet {
    width: 560px;
    max-height: 86vh;
    padding: 22px 24px;
    border-radius: 24px;
  }
  .sheet-grabber { display: none; }
  .sheet-actions { grid-template-columns: 140px 1fr; }
  .results { gap: 18px; }
  .person-grid:not(.nested) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .person-grid.nested .person-card { background: #fff; }
  .org-result { padding: 20px; }
  .notice-card { font-size: 14px; }
}

@media (min-width: 980px) {
  .seat-page { max-width: 960px; }
}

@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
