:root {
  color-scheme: light;
  --ink: #24302f;
  --muted: #60706e;
  --line: #d9e4df;
  --surface: #ffffff;
  --soft: #eef7f3;
  --accent: #d94f3d;
  --accent-2: #217c7e;
  --gold: #f2b84b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  color: var(--ink);
  background: #f7faf8;
}

.hidden { display: none !important; }
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr minmax(320px, 440px);
  background: linear-gradient(120deg, rgba(33,124,126,.82), rgba(217,79,61,.55)), url("/assets/travel-family.svg") center/cover;
}
.login-art { min-height: 360px; }
.login-panel {
  align-self: center;
  margin: 32px;
  padding: 32px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0,0,0,.16);
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 22px; }
.eyebrow { color: var(--accent-2); font-weight: 700; letter-spacing: 0; }
label { display: grid; gap: 8px; margin: 16px 0; font-weight: 650; }
.field-note { color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.45; }
.fixed-field {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f6;
  color: var(--muted);
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #b8c9c4;
  border-radius: 6px;
  font: inherit;
  background: white;
}
button, a {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 750;
  cursor: pointer;
}
button { color: white; background: var(--accent-2); }
button:disabled { background: #9badab; cursor: not-allowed; }
a { display: inline-flex; align-items: center; color: white; background: var(--accent); text-decoration: none; }
a.disabled-link {
  color: var(--muted);
  background: #e3ebe8;
  cursor: not-allowed;
}
.hint, .error, .form-note { min-height: 20px; color: var(--muted); }
.error { color: #b42318; }
.app-shell { min-height: 100vh; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px clamp(16px, 4vw, 48px);
  background: white;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 24px; }
.userbox { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px clamp(16px, 4vw, 48px);
  background: #e8f2ee;
  overflow-x: auto;
}
.tabs button { background: transparent; color: var(--ink); border: 1px solid transparent; }
.tabs button.active { background: white; border-color: var(--line); }
.band, .section {
  padding: 28px clamp(16px, 4vw, 48px);
}
.trip-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 24px;
  background: var(--soft);
}
.capacity-grid, .two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.capacity-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}
.capacity-note {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
#reserveArea {
  grid-template-columns: minmax(320px, 560px);
}
.panel, .announcement, .capacity, .payment-row, .participant-card, .participant-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.capacity {
  display: grid;
  gap: 14px;
}
.capacity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.capacity-head h3 {
  margin: 0;
  font-size: 18px;
}
.capacity-head span {
  border: 1px solid #a8decf;
  border-radius: 999px;
  color: #0d665b;
  background: #e9fbf6;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 9px;
  white-space: nowrap;
}
.capacity.closed .capacity-head span {
  color: #7a4d00;
  background: #fff3cd;
  border-color: #f2d48a;
}
.capacity-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.capacity-main div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
}
.capacity small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.capacity strong { font-size: 30px; color: var(--accent-2); }
.capacity-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8e5e1;
}
.capacity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}
.capacity p { margin: 0; color: var(--muted); }
.form-note {
  line-height: 1.6;
  margin: 4px 0 16px;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.announcement-list { display: grid; gap: 12px; }
.announcement.pinned { border-left: 5px solid var(--gold); }
.announcement-content p { margin: 0 0 8px; }
.announcement-content ul, .announcement-content ol { margin: 8px 0 8px 22px; padding: 0; }
.announcement-content a { color: var(--accent); font-weight: 700; }
.admin-preview { min-width: 220px; }
.html-editor-field { grid-column: 1 / -1; }
.html-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.html-toolbar button {
  padding: 8px 10px;
  font-size: 0.9rem;
}
.html-editor {
  min-height: 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  line-height: 1.7;
}
.html-editor:focus {
  outline: 2px solid rgba(30, 122, 124, 0.2);
  border-color: var(--accent);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}
#registrationState {
  max-width: 760px;
}
#registrationState p {
  overflow-wrap: anywhere;
}
#registrationFeeSummary {
  margin-bottom: 16px;
}
.participant-list, #participantsEditor { display: grid; gap: 16px; }
.participant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}
.participant-row p {
  margin-bottom: 0;
  color: var(--muted);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  vertical-align: middle;
}
.status-badge.complete {
  color: #0b5e4d;
  background: #dff5ed;
  border: 1px solid #a8decf;
}
.status-badge.reserved {
  color: #7a4d00;
  background: #fff3cd;
  border: 1px solid #f2d48a;
}
.participant-editor {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.participant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  line-height: 1.65;
}
.checkline { display: flex; align-items: center; gap: 10px; }
.checkline input { width: auto; }
canvas {
  width: 100%;
  max-width: 720px;
  height: 220px;
  display: block;
  border: 1px solid #9db3ae;
  border-radius: 8px;
  background: white;
  touch-action: none;
}
.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stats div { background: #fff7e3; padding: 14px 18px; border-radius: 8px; border: 1px solid #f3d891; }
.admin-menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 22px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f3;
}
.admin-menu button {
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
}
.admin-menu button.active {
  color: white;
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.admin-page {
  max-width: 100%;
}
.admin-block {
  margin: 18px 0;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 12px;
  align-items: end;
}
.inline-form label {
  margin: 0;
}
.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 920px;
  margin: 16px 0;
}
.admin-form label:nth-child(2) {
  grid-column: 1 / -1;
}
.admin-form button {
  justify-self: start;
}
.admin-output {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.payment-row { margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; }
.fee-summary {
  margin: 16px 0;
  padding: 14px;
  background: #fbfdfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.fee-summary h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.table-scroll {
  overflow-x: auto;
}
.admin-output table {
  min-width: 920px;
}
.fee-summary table {
  min-width: 720px;
  margin-top: 0;
}
.fee-summary th {
  color: var(--muted);
  font-size: 13px;
}
.total-row td {
  font-weight: 800;
  background: #eef7f3;
}

@media (max-width: 820px) {
  .login-shell, .trip-band, .two-col, .capacity-grid, .participant-grid { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { margin: 18px; }
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .participant-row { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .admin-form { grid-template-columns: 1fr; }
}
