:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #1c2430;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #002860;
  --brand-dark: #001d47;
  --gold: #d4a33b;
  --green: #13805a;
  --red: #b42318;
  --panel: #ffffff;
  --shadow: 0 18px 50px rgba(19, 29, 46, 0.11);
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Helvetica Neue",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

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

input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(176, 22, 47, 0.12);
}

label span,
.choice-block > span {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.h5-shell {
  width: 100%;
  max-width: 720px;
  overflow-x: clip;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.hero {
  min-height: clamp(164px, 42vw, 212px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-radius: 0 0 8px 8px;
  padding: clamp(22px, 6vw, 34px) clamp(18px, 5vw, 28px);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(0, 29, 71, 0.98), rgba(0, 40, 96, 0.93)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='420' viewBox='0 0 900 420'%3E%3Cpath fill='%23ffffff' fill-opacity='.12' d='M0 330 170 260l130 38 180-134 160 63 260-160v353H0z'/%3E%3Cpath fill='%23ffffff' fill-opacity='.10' d='M60 95h780v38H60zM60 165h510v18H60zM60 210h620v18H60z'/%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.hero-brand img {
  width: clamp(44px, 13vw, 64px);
  height: clamp(44px, 13vw, 64px);
  flex: 0 0 auto;
  border: 2px solid rgba(212, 163, 59, 0.75);
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 16, 38, 0.28);
}

.hero-brand .eyebrow {
  margin: 0;
}

.hero h1,
.admin-topbar h1,
.login-box h1 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(26px, 8vw, 36px);
  line-height: 1.15;
  word-break: keep-all;
}

.hero-copy {
  max-width: 460px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(14px, 4vw, 17px);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.hero-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  font-weight: 900;
}

.form-panel {
  margin-top: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.form-section,
.login-box,
.table-wrap,
.toolbar,
.stats article {
  background: var(--panel);
  border: 1px solid rgba(217, 222, 231, 0.8);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(19, 29, 46, 0.06);
}

.form-section {
  padding: clamp(16px, 5vw, 24px);
  margin-bottom: 12px;
}

.form-section h2 {
  margin: 0 0 clamp(14px, 4vw, 18px);
  font-size: clamp(18px, 5vw, 21px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(14px, 4vw, 18px);
}

.section-head h2 {
  margin: 0;
}

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

.wide {
  grid-column: 1 / -1;
}

.choice-block {
  margin-top: 18px;
}

.inline-choice {
  margin-top: 0;
}

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

.chips.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chip {
  display: flex;
  align-items: center;
  min-height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.chip input {
  width: auto;
  margin: 0 8px 0 0;
  accent-color: var(--brand);
}

.chip span {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented label {
  min-height: 47px;
  cursor: pointer;
}

.segmented label + label {
  border-left: 1px solid var(--line);
}

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

.segmented span {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 47px;
  margin: 0;
  color: #344054;
  font-weight: 800;
}

.segmented input:checked + span {
  background: #fff5f6;
}

.segmented input:checked + span,
.chip input:checked + span {
  color: var(--brand-dark);
}

.other-time {
  margin-top: 10px;
}

.education-list {
  display: grid;
  gap: 12px;
}

.education-card {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

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

.education-card-head strong {
  font-size: 15px;
}

.mini-button,
.text-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.mini-button {
  min-height: 34px;
  padding: 0 12px;
  background: #eaf0f8;
  color: var(--brand);
}

.text-button {
  min-height: 30px;
  padding: 0 8px;
  background: transparent;
  color: var(--red);
}

.text-button[hidden] {
  display: none;
}

.upload-box {
  display: block;
  margin-bottom: 16px;
  border: 1px dashed #c3cad7;
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfe;
}

.upload-box strong {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.upload-box input {
  display: block;
  max-width: 100%;
  margin-top: 12px;
  padding: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.primary-button,
.ghost-button,
.actions button,
.tabs button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 24px rgba(176, 22, 47, 0.25);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.message.success {
  color: var(--green);
}

.message.error {
  color: var(--red);
}

.admin-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.login-layout {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.login-box {
  width: min(420px, 100%);
  padding: 30px;
}

.login-box label {
  display: block;
  margin-top: 18px;
}

.login-box .primary-button {
  margin-top: 22px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.ghost-button {
  min-width: 98px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav a,
.admin-activity-card .actions a,
.registration-dialog-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.admin-nav a.active {
  background: var(--brand);
  color: #fff;
}

.activity-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 20px;
}

.activity-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.activity-brand img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.activity-brand p { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.activity-brand h1 { margin: 0; font-size: 24px; }
.member-button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; white-space: nowrap; }

.member-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding: 13px 15px; border-radius: 8px; background: #eaf2ef; color: #164d3f;
}
.member-bar strong, .member-bar span { display: block; }
.member-bar span { margin-top: 3px; font-size: 12px; opacity: .78; }
.member-bar button { border: 0; background: transparent; color: inherit; }

.activity-list { display: grid; gap: 13px; }
.activity-card, .activity-detail-card, .admin-activity-card {
  border: 1px solid rgba(217, 222, 231, .9); border-radius: 10px; background: #fff; box-shadow: 0 9px 28px rgba(19, 29, 46, .07);
}
.activity-card { padding: 18px; cursor: pointer; }
.activity-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.activity-phase, .my-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.activity-phase.registering { background: #e6f5ee; color: var(--green); }
.activity-phase.upcoming { background: #fff7df; color: #8a5a00; }
.activity-phase.full, .activity-phase.closed, .activity-phase.ended, .activity-phase.cancelled { background: #f1f2f4; color: #596273; }
.my-status { background: #e9eff9; color: var(--brand); }
.activity-card h2 { margin: 14px 0 7px; font-size: 21px; }
.activity-card > p { margin: 0; color: var(--muted); line-height: 1.65; }
.activity-card dl { display: grid; gap: 7px; margin: 15px 0; }
.activity-card dl div { display: grid; grid-template-columns: 42px 1fr; gap: 10px; font-size: 14px; }
.activity-card dt { color: var(--muted); }
.activity-card dd { margin: 0; }
.card-link, .back-button { border: 0; background: transparent; color: var(--brand); font-weight: 700; padding: 5px 0; }
.activity-empty { padding: 48px 20px; border-radius: 10px; background: #fff; text-align: center; color: var(--muted); }
.activity-empty strong { color: var(--ink); }

.activity-detail-card { overflow: hidden; padding: 22px; }
.back-button { margin: 0 0 12px; }
.activity-detail-card h1 { margin: 16px 0 8px; font-size: clamp(25px, 7vw, 34px); }
.activity-summary { color: var(--muted); line-height: 1.7; }
.activity-meta { margin: 20px -22px; padding: 18px 22px; background: #f4f7f9; }
.activity-meta div { display: grid; grid-template-columns: 78px 1fr; gap: 12px; margin: 9px 0; }
.activity-meta dt { color: var(--muted); }
.activity-meta dd { margin: 0; line-height: 1.55; }
.activity-content, .activity-contact { padding: 7px 0; }
.activity-content h2, .activity-contact h2 { font-size: 18px; }
.activity-content p { line-height: 1.85; }
.activity-action { padding-top: 16px; }
.danger-button { width: 100%; min-height: 48px; border: 1px solid #f2b8b5; background: #fff1f0; color: var(--red); }
.member-dialog { width: min(calc(100% - 28px), 440px); }
.member-dialog label { display: block; margin: 16px 0; }
.sms-code-row { display: flex; align-items: center; gap: 12px; }
.sms-code-row label { flex: 1; min-width: 0; }
.sms-code-row button { margin-top: 20px; white-space: nowrap; padding: 0 12px; }
.sms-code-row button:disabled { opacity: .6; cursor: not-allowed; }
.dialog-tip { color: var(--muted); line-height: 1.65; }

.activity-admin-layout { display: grid; grid-template-columns: minmax(390px, .8fr) minmax(430px, 1.2fr); gap: 18px; align-items: start; }
.activity-form { position: sticky; top: 14px; }
.check-line { display: flex; align-items: center; gap: 8px; }
.check-line input { width: auto; }
.check-line span { margin: 0; }
.activity-admin-heading { display: flex; align-items: center; justify-content: space-between; }
.activity-admin-heading h2 { margin-top: 0; }
.activity-admin-heading span { color: var(--muted); }
.admin-activity-list { display: grid; gap: 12px; }
.admin-activity-card { padding: 17px; }
.admin-activity-card h3 { margin: 13px 0 7px; font-size: 19px; }
.admin-activity-card p { color: var(--muted); }
.registration-progress { display: flex; justify-content: space-between; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.admin-activity-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-activity-card .actions a { min-height: 36px; background: #eef1f6; font-size: 14px; }
.registrations-dialog { width: min(1100px, calc(100% - 28px)); }
.registration-dialog-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.registration-dialog-actions .export-button { color: #fff; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stats article {
  padding: 16px;
}

.stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs button,
.actions button {
  min-height: 36px;
  padding: 0 12px;
  background: #eef1f6;
  color: #344054;
}

.tabs button.active,
.actions button[data-action="approve"] {
  background: var(--brand);
  color: #fff;
}

.actions button[data-action="reject"] {
  background: #fff1f0;
  color: var(--red);
}

.toolbar input {
  max-width: 340px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.export-button {
  min-height: 40px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475467;
  background: #f9fafb;
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.status.pending {
  background: #fff7e6;
  color: #9a6700;
}

.status.approved {
  background: #e8f7f0;
  color: var(--green);
}

.status.rejected {
  background: #fff1f0;
  color: var(--red);
}

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

.empty {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.48);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.detail-body {
  max-height: 70vh;
  overflow: auto;
  padding: 18px 20px 24px;
}

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

dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 0;
  line-height: 1.6;
  word-break: break-word;
}

@media (max-width: 720px) {
  .h5-shell {
    max-width: none;
    padding: 12px max(12px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .hero {
    border-radius: 8px;
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }

  .hero-badge {
    display: none;
  }

  .form-section {
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(19, 29, 46, 0.06);
  }

  .form-grid,
  .chips,
  .chips.compact,
  .stats,
  dl {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
  }

  .primary-button {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .admin-topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-nav { flex-wrap: wrap; }
  .activity-admin-layout { grid-template-columns: 1fr; }
  .activity-form { position: static; }

  .toolbar input {
    max-width: none;
  }

  .toolbar-actions {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .form-section {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  input,
  select,
  textarea {
    min-height: 48px;
    padding: 12px;
    font-size: 16px;
  }

  .chips.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-block .chips:not(.compact) {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .hero {
    min-height: 150px;
  }

  .hero h1 {
    font-size: 25px;
  }

  .hero-copy {
    font-size: 14px;
  }

  .chips.compact {
    grid-template-columns: 1fr;
  }

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

  .segmented label + label {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
