:root {
  --brand:       #e8601a;
  --brand-dark:  #b84510;
  --brand-light: #fff7ed;
  --text:        #1e1614;
  --muted:       #6b7280;
  --border:      #e5e7eb;
  --bg:          #faf8f6;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter var', 'Inter', 'Noto Sans TC', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  margin: 0;
}

/* ── Layout ── */
.page-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Topbar ── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .01em;
}
.topbar-brand span {
  color: var(--brand);
}
.topbar-user {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 18px;
  background: var(--brand);
  border-radius: 2px;
}

/* ── Forms ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.form-label .req { color: #dc2626; }
.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="tel"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232,96,26,.12);
}
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: #dc2626;
}
.error-msg {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline {
  background: #fff;
  color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-outline:hover { background: var(--brand-light); }
.btn-gray { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.btn-gray:hover { background: #e5e7eb; }
.btn-lg { padding: 13px 30px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: 9px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Step progress bar ── */
.step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}
.step-item.done:not(:last-child)::after { background: var(--brand); }
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  position: relative; z-index: 1;
  background: #e5e7eb; color: #9ca3af;
}
.step-item.done .step-dot  { background: var(--brand); color: #fff; }
.step-item.active .step-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(232,96,26,.2); }
.step-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  text-align: center;
  white-space: nowrap;
}
.step-item.active .step-label { color: var(--brand); font-weight: 600; }

/* ── Essay textarea ── */
.essay-wrap { position: relative; }
.word-count {
  position: absolute;
  right: 10px; bottom: 8px;
  font-size: 11px;
  color: #9ca3af;
}
.word-count.over { color: #dc2626; }

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}
.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}
.auth-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
}

/* ── 簡章排版（首頁與註冊頁共用；來源 includes/brochure_content.php） ── */
.br-head {
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.br-org   { font-size: 13px; color: var(--muted); margin: 0 0 2px; }
.br-title { font-size: 15px; font-weight: 700; color: #222; margin: 0; }
.br-h     { font-size: 14px; font-weight: 700; color: var(--brand); margin: 14px 0 6px; }
.br-p     { margin: 4px 0; text-align: justify; }
.br-i1    { padding-left: 1em; }
.br-i2    { padding-left: 2.2em; }

/* ── 首頁（index.php） ── */
.landing {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.landing-banner {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #f0efed;
  line-height: 0;
}
.landing-banner img { width: 100%; height: auto; display: block; }

.landing-hero { text-align: center; margin: 28px 0 24px; }
.landing-hero h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: .01em;
}
.landing-hero p { font-size: 14px; color: var(--muted); margin: 0; }

.landing-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 640px) { .landing-meta { grid-template-columns: 1fr; } }
.meta-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.meta-item i {
  color: var(--brand);
  font-size: 16px;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
}
.meta-label { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
.meta-value { font-size: 14px; font-weight: 600; margin: 0; }

/* 首頁文件下載卡 */
.doc-download {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}
.doc-download > i {
  color: var(--brand);
  font-size: 18px;
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
}
.doc-download-text { flex: 1; min-width: 0; }
.doc-download-title { font-size: 14px; font-weight: 600; margin: 0 0 3px; }
.doc-download-note  { font-size: 12px; color: var(--muted); margin: 0; }
.doc-download .btn { flex-shrink: 0; }
@media (max-width: 640px) {
  .doc-download { flex-wrap: wrap; }
  .doc-download .btn { width: 100%; justify-content: center; }
}

/* 簡章：預設收合，點「展開全文」看完整內容 */
.brochure-read {
  position: relative;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
}
.brochure-read.is-collapsed { max-height: 460px; overflow: hidden; }
.brochure-read.is-collapsed::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 110px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 85%);
  pointer-events: none;
}
.brochure-toggle {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.landing-cta {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
}
.landing-cta h2 { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.landing-cta p  { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.landing-cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.landing-cta-actions .btn { min-width: 160px; justify-content: center; }
.btn.is-disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border: 1px solid var(--border);
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Step 1 區段標題與條件區塊 ── */
.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: .02em;
  padding-bottom: 6px;
  margin: 24px 0 14px;
  border-bottom: 1px solid var(--border);
}
.section-label:first-of-type { margin-top: 8px; }
.cond-block { display: none; }
