/* ═══════════════════════════════════════════════════════════
   恆光學院 · 靈魂崛起 — 設計系統核心（前台、後台共用）
   顏色由後台「主題色彩」覆寫 :root 變數
   ═══════════════════════════════════════════════════════════ */

:root {
  --c-night: #0b1b36;
  --c-ink: #4c2b27;
  --c-cream: #fffaf0;
  --c-surface: #fffdf7;
  --c-accent: #d9b76d;
  --c-accent-deep: #a06b24;
  --c-cocoa: #58332d;
  --c-sky: #e9f0f4;

  --c-night-2: color-mix(in oklab, var(--c-night) 78%, #2b4a72);
  --c-cocoa-2: color-mix(in oklab, var(--c-cocoa) 80%, #8a4a36);
  --c-gold-line: color-mix(in oklab, var(--c-accent) 62%, transparent);
  --c-gold-line-soft: color-mix(in oklab, var(--c-accent) 34%, transparent);
  --c-muted: color-mix(in oklab, var(--c-ink) 62%, var(--c-cream));
  --c-faint: color-mix(in oklab, var(--c-ink) 40%, var(--c-cream));
  --c-line: color-mix(in oklab, var(--c-ink) 11%, transparent);
  --c-line-strong: color-mix(in oklab, var(--c-ink) 20%, transparent);
  --c-soft: color-mix(in oklab, var(--c-accent) 9%, var(--c-cream));
  --c-gold-glow: color-mix(in oklab, var(--c-accent) 45%, transparent);
  --c-success: #2f7d5b;
  --c-success-bg: #e8f4ee;
  --c-danger: #b4433c;
  --c-danger-bg: #fbeceb;
  --c-warning: #9a6b14;
  --c-warning-bg: #fbf2df;
  --c-info: #4a5aa8;
  --c-info-bg: #ecefff;

  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", "Noto Serif CJK TC", "PMingLiU", Georgia, serif;
  --font-display: Georgia, "Noto Serif TC", serif;
  --font-ui: "Helvetica Neue", Arial, "Noto Sans TC", "PingFang TC", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(94, 67, 37, 0.06), 0 4px 12px -4px rgba(94, 67, 37, 0.1);
  --shadow: 0 16px 37px rgba(94, 67, 37, 0.12);
  --shadow-lg: 0 24px 60px -18px rgba(85, 60, 33, 0.32);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 72px;
  color-scheme: light;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--c-ink);
  background: var(--c-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 0;
  overflow-x: hidden;
}
img,
svg,
video,
iframe {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
a {
  color: var(--c-accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--c-ink);
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
  color: inherit;
}
p {
  margin: 0 0 1em;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 6px;
}
::selection {
  background: color-mix(in oklab, var(--c-accent) 35%, transparent);
}
[hidden] {
  display: none !important;
}
hr {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin: 2rem 0;
}

/* ── Layout helpers ── */
.container,
.container-wide,
.container-narrow {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container {
  max-width: calc(var(--container) + var(--gutter) * 2);
}
.container-wide {
  max-width: 1440px;
}
.container-narrow {
  max-width: calc(820px + var(--gutter) * 2);
}
.stack > * + * {
  margin-top: 1.1rem;
}
/* 堆疊表單中的勾選框獨佔一行，避免與後面的按鈕排在同一行而重疊 */
.stack > .checkbox {
  display: flex;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.row-wrap.center,
.center {
  justify-content: center;
  text-align: center;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 720px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
.mt-3 {
  margin-top: 0.75rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-6 {
  margin-top: 2rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.small {
  font-size: 0.875rem;
}
.muted {
  color: var(--c-muted);
}
.muted-light {
  color: rgba(247, 241, 230, 0.7);
}
.text-danger {
  color: var(--c-danger);
}
.right {
  text-align: right;
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: 0.02em;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.inline-form {
  display: inline;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--c-night);
  color: #fff;
  border-radius: 8px;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 12px;
}
.icon {
  flex-shrink: 0;
}

/* ── Typography ── */
.eyebrow,
.kicker {
  display: block;
  font: 700 12px/1.5 var(--font-ui);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--c-accent-deep);
  margin: 0 0 1.1rem;
}
.eyebrow-light {
  color: var(--c-accent);
}
.prose {
  color: color-mix(in oklab, var(--c-ink) 88%, var(--c-cream));
  line-height: 1.95;
  word-break: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose > :last-child {
  margin-bottom: 0;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 1.1em;
}
.prose h2 {
  font-size: 1.45rem;
  margin: 1.8em 0 0.6em;
}
.prose h3 {
  font-size: 1.2rem;
  margin: 1.5em 0 0.5em;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li + li {
  margin-top: 0.35em;
}
.prose strong {
  color: var(--c-ink);
  font-weight: 700;
}
.prose blockquote {
  border-left: 3px solid var(--c-accent);
  padding: 0.3em 0 0.3em 1.2em;
  color: var(--c-muted);
  font-family: var(--font-serif);
}
.prose img {
  border-radius: var(--radius);
  margin: 1.5em 0;
}
.prose code {
  font-family: var(--font-mono);
  background: var(--c-soft);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.95em;
}
.prose th,
.prose td {
  border-bottom: 1px solid var(--c-line);
  padding: 0.6em 0.75em;
  text-align: left;
}
.prose-lg {
  font-size: 1.06rem;
}

/* ── Buttons ── */
.btn {
  --btn-bg: var(--c-surface);
  --btn-fg: var(--c-ink);
  --btn-border: var(--c-gold-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 50px;
  padding: 0.75rem 1.6rem;
  border-radius: 4px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 700 15px/1.35 var(--font-ui);
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background-color 0.2s,
    color 0.2s,
    border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  color: var(--btn-fg);
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
}
.btn[disabled],
.btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.btn-primary {
  --btn-fg: #fff9eb;
  --btn-border: transparent;
  background: linear-gradient(120deg, var(--c-cocoa-2), var(--c-cocoa));
  box-shadow: 0 12px 24px -14px rgba(78, 44, 43, 0.7);
}
.btn-primary:hover {
  box-shadow: 0 18px 30px -14px rgba(78, 44, 43, 0.75);
}
.btn-gold {
  --btn-fg: #3a2216;
  --btn-border: transparent;
  background: linear-gradient(135deg, #f6e6b8 0%, var(--c-accent) 50%, color-mix(in oklab, var(--c-accent) 70%, var(--c-accent-deep)) 100%);
  box-shadow:
    0 10px 26px -12px color-mix(in oklab, var(--c-accent) 70%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-night {
  --btn-bg: var(--c-night);
  --btn-fg: #f5e9cc;
  --btn-border: transparent;
}
.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--c-cocoa);
  --btn-border: color-mix(in oklab, var(--c-accent-deep) 55%, transparent);
}
.btn-outline:hover {
  --btn-border: var(--c-accent-deep);
  --btn-fg: var(--c-accent-deep);
  background: color-mix(in oklab, var(--c-accent) 10%, transparent);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--c-muted);
}
.btn-ghost:hover {
  --btn-fg: var(--c-ink);
  background: color-mix(in oklab, var(--c-ink) 6%, transparent);
}
.btn-glass {
  --btn-bg: rgba(255, 255, 255, 0.08);
  --btn-fg: #f5e9cc;
  --btn-border: rgba(245, 233, 204, 0.4);
  backdrop-filter: blur(8px);
}
.btn-glass:hover {
  --btn-bg: rgba(255, 255, 255, 0.16);
  --btn-border: rgba(245, 233, 204, 0.7);
}
.btn-danger {
  --btn-bg: var(--c-danger);
  --btn-fg: #fff;
  --btn-border: transparent;
}
.btn-sm {
  min-height: 38px;
  padding: 0.45rem 1rem;
  font-size: 13px;
}
.btn-lg {
  min-height: 58px;
  padding: 0.9rem 2rem;
  font-size: 16px;
}
.btn-block {
  width: 100%;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 500;
  text-decoration: none;
}

/* ── Forms ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.field-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--c-ink);
  letter-spacing: 0.04em;
}
.req {
  color: var(--c-danger);
}
.field-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--c-muted);
}
.field-error {
  margin: 0;
  font-size: 0.84rem;
  color: var(--c-danger);
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--c-line-strong);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: 1rem;
  line-height: 1.5;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  appearance: none;
}
.input::placeholder {
  color: var(--c-faint);
}
.input:hover {
  border-color: color-mix(in oklab, var(--c-ink) 32%, transparent);
}
.input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--c-accent) 18%, transparent);
}
.input[readonly] {
  background: color-mix(in oklab, var(--c-ink) 3%, var(--c-surface));
  color: var(--c-muted);
}
.has-error .input,
.input[aria-invalid="true"] {
  border-color: var(--c-danger);
}
.textarea {
  min-height: 110px;
  resize: vertical;
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6680' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.4rem;
}
.password-wrap {
  position: relative;
}
.password-wrap .input {
  padding-right: 3rem;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--c-muted);
  display: grid;
  place-items: center;
}
.password-toggle:hover {
  color: var(--c-ink);
  background: var(--c-soft);
}
.checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.94rem;
  line-height: 1.6;
}
.checkbox input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.checkbox-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--c-line-strong);
  background: var(--c-surface);
  display: grid;
  place-items: center;
  color: transparent;
  transition: all 0.15s;
}
.checkbox input:checked + .checkbox-box {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-night);
}
.checkbox input:focus-visible + .checkbox-box {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.checkbox-label small {
  display: block;
  color: var(--c-muted);
}

/* ── Feedback ── */
.alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.7;
  border: 1px solid transparent;
}
.alert > .icon {
  margin-top: 3px;
}
.alert-title {
  display: block;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.alert-info {
  background: var(--c-info-bg);
  color: var(--c-info);
  border-color: color-mix(in oklab, var(--c-info) 18%, transparent);
}
.alert-success {
  background: var(--c-success-bg);
  color: var(--c-success);
  border-color: color-mix(in oklab, var(--c-success) 18%, transparent);
}
.alert-warning {
  background: var(--c-warning-bg);
  color: var(--c-warning);
  border-color: color-mix(in oklab, var(--c-warning) 20%, transparent);
}
.alert-error {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border-color: color-mix(in oklab, var(--c-danger) 18%, transparent);
}
.alert a {
  color: inherit;
  font-weight: 700;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.badge + .badge {
  margin-left: 0.35rem;
}
.badge-gold {
  background: color-mix(in oklab, var(--c-accent) 18%, transparent);
  color: var(--c-accent-deep);
}
.badge-violet {
  background: color-mix(in oklab, var(--c-cocoa) 10%, transparent);
  color: var(--c-cocoa);
}
.badge-green {
  background: var(--c-success-bg);
  color: var(--c-success);
}
.badge-red {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}
.badge-blue {
  background: var(--c-info-bg);
  color: var(--c-info);
}
.badge-gray {
  background: color-mix(in oklab, var(--c-ink) 7%, transparent);
  color: var(--c-muted);
}
.badge-night {
  background: color-mix(in oklab, var(--c-cocoa) 12%, transparent);
  color: var(--c-cocoa);
  border: 1px solid color-mix(in oklab, var(--c-cocoa) 22%, transparent);
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  border: 1px solid var(--c-line-strong);
  color: var(--c-muted);
  white-space: nowrap;
}
.chip-gold {
  border-color: color-mix(in oklab, var(--c-accent) 50%, transparent);
  color: var(--c-accent-deep);
  background: color-mix(in oklab, var(--c-accent) 10%, transparent);
}
.progress {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--c-ink) 9%, transparent);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-deep));
  transition: width 0.6s var(--ease);
}
.empty {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
  border: 1px dashed var(--c-line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--c-surface) 60%, transparent);
}
.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--c-accent-deep);
  background: radial-gradient(circle, color-mix(in oklab, var(--c-accent) 22%, transparent), transparent 70%);
}
.empty h3 {
  font-size: 1.2rem;
}
.empty-body {
  color: var(--c-muted);
  max-width: 420px;
  margin: 0 auto;
}
.empty-action {
  margin-top: 1.25rem;
}
.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid color-mix(in oklab, var(--c-accent) 25%, transparent);
  border-top-color: var(--c-accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Tables & panels ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-surface);
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--c-muted);
  background: color-mix(in oklab, var(--c-ink) 2.5%, var(--c-surface));
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--c-line);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: color-mix(in oklab, var(--c-accent) 4%, transparent);
}
.table-compact td,
.table-compact th {
  padding: 0.55rem 0.75rem;
}
.total-row td {
  font-weight: 700;
  border-top: 1px solid var(--c-line-strong);
}
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  box-shadow: var(--shadow-sm);
}
.panel + .panel {
  margin-top: 1.25rem;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0;
  font-size: 0.94rem;
}
.dl dt {
  color: var(--c-muted);
}
.dl dd {
  margin: 0;
  word-break: break-all;
}
.dl-compact {
  gap: 0.25rem 1rem;
}
.pagination {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.page-link {
  min-width: 38px;
  height: 38px;
  padding: 0 0.6rem;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.page-link.is-current {
  background: var(--c-night);
  color: #fff;
  border-color: var(--c-night);
}

/* ── Price ── */
.price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.price-now {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: 0.02em;
}
.price-list {
  color: var(--c-faint);
  font-size: 0.85em;
}
.price-md .price-now {
  font-size: 1.25rem;
}
.price-sm .price-now {
  font-size: 1.05rem;
}
.price-lg .price-now {
  font-size: 2rem;
}

/* ── Avatar ── */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent-deep), var(--c-cocoa));
  color: #fff9eb;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.avatar-lg {
  width: 46px;
  height: 46px;
  font-size: 1.15rem;
}
.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.6rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

h1,
h2,
.section-title,
.hero-title,
.cta-inner h2 {
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
