/* Customer portal only. Staff workspaces keep their own stylesheet. */
:root {
  color-scheme: light;
  --sky: #A8BEDF;
  --pale-blue: #C7D5E8;
  --sand: #D8C9BA;
  --ivory: #EFE4D4;
  --ink: #2C4258;
  --muted: #526478;
  --primary: #3D5875;
  --surface: #fff;
  --page: #F6F4EF;
  --line: #E0E5EB;
  --field-line: #8191A3;
  --radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { scroll-padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
body { margin: 0; color: var(--ink); background: var(--page); line-height: 1.7; overflow-wrap: anywhere; }
a { color: var(--primary); text-underline-offset: 4px; }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, summary { scroll-margin-bottom: calc(130px + env(safe-area-inset-bottom)); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.625rem, 3vw, 2.125rem); font-weight: 650; line-height: 1.35; letter-spacing: -.025em; margin-bottom: 12px; text-wrap: balance; }
h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.5; margin-bottom: 16px; text-wrap: balance; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.5; }
p { margin-bottom: 16px; text-wrap: pretty; }
small, .muted { color: var(--muted); }
small { font-size: .875rem; }
ul { padding-left: 22px; }
img { max-width: 100%; height: auto; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.member-icon { display: inline-block; flex: 0 0 auto; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 20px; background: white; border: 2px solid var(--primary); border-radius: 12px; }
.skip-link:focus { top: 12px; }
.site-header { max-width: 1120px; margin: auto; padding: 32px 32px 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: block; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 2rem; letter-spacing: -.05em; text-decoration: none; line-height: 1.2; }
.brand span { display: block; font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; font-weight: 400; font-size: .75rem; letter-spacing: .075em; margin-top: 9px; color: var(--muted); }
.header-help { min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .875rem; text-decoration: none; }
main { max-width: 1120px; min-width: 0; margin: auto; padding: 28px 32px 8px; }
main.page--form { max-width: 800px; }
main.page--reading { max-width: 52rem; }
main.page--orders { max-width: 56rem; }
.member-page-heading { margin-bottom: 28px; }
.member-page-heading > p { color: var(--muted); margin-bottom: 0; }
.member-page-heading > p, main > p, .panel > p, .welcome-card > p { max-width: 65ch; }
.portal-dashboard { display: grid; gap: 28px; }
.portal-dashboard > .member-page-heading { margin-bottom: 0; }
.portal-dashboard > .panel, .portal-dashboard > .card { margin: 0; }
.card, .panel { padding: 28px; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.public-content-list { display: grid; gap: 20px; }
.public-content-list > .card { margin: 0; }
.content-category { display: block; margin-bottom: 8px; font-weight: 500; }
.reading-prose { max-width: 65ch; }
.reading-prose > :last-child { margin-bottom: 0; }
.content-text-link { display: inline-flex; align-items: center; min-height: 44px; }
.activity-detail { margin-top: 0; }
.activity-cover { display: block; width: 100%; border-radius: 12px; margin: 0 0 24px; }
.activity-action { margin-top: 28px; }
.welcome-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.welcome-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; padding: 32px; border-radius: var(--radius); background: white; overflow: hidden; border: 1px solid var(--line); }
.welcome-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 14px; background: var(--sky); border-radius: 0 0 50% 50%; }
.welcome-card h1, .welcome-card h2, .welcome-card p { margin: 0; }
.welcome-card h1, .welcome-card h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
.welcome-card > .member-icon { width: 42px; height: 42px; margin-bottom: 8px; }
.quick-stack { display: grid; grid-template-rows: 1fr 1fr; gap: 16px; }
.quick-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 24px; min-height: 156px; border-radius: var(--radius); text-decoration: none; color: var(--ink); overflow: hidden; }
.quick-card h2, .quick-card p { margin: 0; }
.quick-card p { font-size: .875rem; }
.quick-card > .member-icon { width: 36px; height: 36px; align-self: flex-end; }
.quick-card--blue { background: var(--sky); }
.quick-card--sand { background: var(--sand); }
.quick-card:hover { box-shadow: inset 0 0 0 2px var(--primary); }
.membership-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 34px; min-height: 240px; padding: 28px; color: var(--ink); border: 1px solid #A1B7D1; border-radius: var(--radius); background: var(--pale-blue); overflow: hidden; }
.membership-card::after { content: ""; position: absolute; width: 230px; height: 230px; right: -75px; top: -90px; border: 1px solid rgba(44,66,88,.17); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 22px rgba(255,255,255,.1), 0 0 0 44px rgba(255,255,255,.1); }
.membership-card h2 { font: 1.875rem/1.2 Georgia, serif; letter-spacing: -.025em; margin: 0 0 8px; }
.membership-card__meta { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.membership-card__meta p { margin: 0; }
.membership-card__meta > div > span, .membership-card__meta > div > strong { display: block; }
.membership-card__meta > div > span { font-size: .8125rem; margin-bottom: 3px; }
.membership-card__meta > div > strong { font-size: .875rem; font-variant-numeric: tabular-nums; }
.membership-card small { color: var(--ink); }
.membership-card__meta, .order-meta, .order-id, .calendar-grid, .calendar-month, .slot-choice, .pagination { font-variant-numeric: tabular-nums; }
.member-identity { display: flex; align-items: center; gap: 16px; }
.member-identity h1, .member-identity h2, .member-identity p { margin: 0; }
.member-avatar { flex: 0 0 auto; width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--ivory); }
.member-avatar .member-icon { width: 30px; height: 30px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.section-heading h2 { margin: 0; }
.section-heading > a { display: flex; align-items: center; min-height: 44px; font-size: .875rem; text-decoration: none; }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 14px 0; text-decoration: none; border-bottom: 1px solid var(--line); }
.link-row:last-child { border-bottom: 0; }
.link-row > .member-icon:last-child { width: 20px; height: 20px; }
.link-row span { min-width: 0; }
.link-row small { display: block; margin-top: 3px; }
.member-menu { padding: 6px 24px; }
.member-menu .link-row { min-height: 70px; }
.order-card { margin: 20px 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.order-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.order-id { font-size: 1.125rem; font-weight: 650; }
.status-pill { display: inline-flex; align-items: center; flex-shrink: 0; gap: 5px; border-radius: 30px; padding: 5px 12px; font-size: .875rem; color: var(--ink); background: var(--ivory); }
.queue-panel { display: flex; flex-direction: column; gap: 4px; margin: 16px 0; padding: 18px 20px; border-radius: 14px; background: var(--pale-blue); }
.queue-panel p { margin: 0; }
.queue-panel strong { font-size: 1.125rem; }
.order-meta { display: grid; gap: 8px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px 0; color: var(--muted); font-size: .875rem; }
.order-meta p { margin: 0; }
.order-amount { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; }
.order-amount strong { color: var(--ink); font-size: 1.125rem; font-weight: 650; }
.order-dates { display: block; line-height: 1.8; }
.order-details > ul, .order-details > p { max-width: 65ch; }
.order-details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; }
.order-details summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--primary); font-weight: 600; }
.order-details summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; font-weight: 400; }
.order-details[open] summary::after { content: "−"; }
.order-details li { margin: 8px 0; }
.order-details p { margin: 10px 0; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--muted); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.empty-state > .member-icon { width: 44px; height: 44px; margin-bottom: 14px; color: var(--primary); }
.empty-state h2 { color: var(--ink); }
.empty-state p:last-child { margin-bottom: 0; }
.panel .empty-state { padding: 12px 0; border: 0; background: transparent; }
.empty-state a:not(.button):not(.button-secondary) { display: inline-flex; align-items: center; min-height: 44px; }
.field { margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 20px 0; }
.form-grid > .field { min-width: 0; margin: 0; }
.form-grid > .field > label { margin-top: 0; }
.form-grid > label.field { display: block; }
.form-grid > label.field > input { margin-top: 6px; }
.field--full { grid-column: 1 / -1; }
label { display: block; margin: 20px 0 6px; font-weight: 550; }
label > input, label > select, label > textarea { margin-top: 6px; }
input, select, textarea { width: 100%; display: block; min-height: 48px; padding: 10px 12px; color: var(--ink); background: white; border: 1px solid var(--field-line); border-radius: 10px; }
textarea { resize: vertical; min-height: 110px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { flex: 0 0 auto; display: inline-block; width: 20px; height: 20px; min-height: 20px; margin: 3px 0; padding: 0; accent-color: var(--primary); vertical-align: middle; }
.checkbox-row, .slot-choice { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 10px 0; font-weight: 400; margin: 8px 0; }
.slot-choice { padding: 14px; border: 1px solid var(--field-line); border-radius: 12px; }
.slot-choice:has(input:checked) { background: #EDF2F8; border-color: var(--primary); }
.slot-choice:has(input:disabled) { color: var(--muted); background: var(--page); border-color: var(--line); }
.slot-choices { margin: 24px 0; }
.slot-choices legend { font-weight: 600; margin-bottom: 12px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 28px; }
.booking-composer, .booking-history, .booking-date-panel, .booking-details { min-width: 0; }
.booking-composer > .card { margin: 0; }
.booking-composer > .muted { margin: 16px 0 0; }
.booking-history > .card { margin: 16px 0; }
.booking-form { display: grid; gap: 28px; }
.booking-details > :first-child { margin-top: 0; }
.booking-date-panel > h2 { margin-bottom: 20px; }
.booking-calendar { margin-top: 12px; }
.booking-calendar > label { margin-top: 0; }
[data-calendar-ui] { max-width: 480px; margin: 16px auto; }
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calendar-month { margin: 0; font-size: 1.125rem; font-weight: 650; }
.calendar-nav button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 6px; border-radius: 50%; font-size: 1.5rem; background: white; border: 1px solid var(--field-line); }
.calendar-nav button:disabled { border-color: var(--line); background: var(--page); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; text-align: center; }
.calendar-weekdays { margin-bottom: 6px; color: var(--muted); font-size: .875rem; }
.calendar-day { min-height: 44px; width: 100%; padding: 6px 0; border-radius: 12px; background: white; border: 1px solid transparent; font-size: 1rem; font-weight: 450; }
.calendar-day.is-today { border-color: var(--field-line); }
.calendar-day.is-selected { background: var(--sky); font-weight: 750; }
.calendar-day:disabled { background: white; color: var(--muted); text-decoration: line-through; cursor: default; }
.calendar-selected { margin: 0 0 20px; padding: 12px 14px; color: var(--ink); background: var(--ivory); border-radius: 12px; font-size: .875rem; }
.booking-calendar [data-calendar-submit] { width: 100%; margin-top: 12px; }
.order-fill-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 28px; }
.order-fill-overview, .order-fill-form { min-width: 0; }
.order-fill-overview > .card, .order-fill-layout > .panel { margin: 0; }
.order-fill-overview > p { margin-top: 20px; }
.order-fill-form > .form-grid:first-of-type { margin-top: 0; }
button, .button, .button-secondary { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; max-width: 100%; padding: 11px 22px; border: 1px solid transparent; border-radius: 30px; background: var(--sky); color: var(--ink); font-weight: 650; line-height: 1.5; cursor: pointer; text-decoration: none; text-align: center; }
button:hover, .button:hover { background: var(--pale-blue); color: var(--ink); }
button:active, .button:active, .quick-card:active { background: var(--pale-blue); box-shadow: inset 0 0 0 2px var(--primary); transform: translateY(1px); }
button:disabled { color: var(--muted); background: var(--line); cursor: default; }
.button-secondary { background: white; border-color: var(--field-line); }
.button-secondary:hover { background: var(--page); }
form > button, form > .button { margin-top: 20px; }
.warning, .errorlist { padding: 14px 18px; margin: 16px 0; border-radius: 12px; background: var(--ivory); color: #664628; font-size: .9375rem; }
.errorlist { list-style: none; }
.warning .errorlist { padding: 0; margin: 0; }
.warning > :last-child { margin-bottom: 0; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; margin: 28px 0; }
.pagination a, .page-back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.page-back-link { text-decoration: none; margin-bottom: 12px; }
.site-footer { max-width: 1120px; margin: auto; padding: 44px 24px calc(130px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: .8125rem; }
.site-footer > a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; margin: 0 10px; }
.site-footer p { margin: 8px 0 14px; }
.site-footer small { font: 1.15rem Georgia, serif; }
.member-tabbar { position: fixed; z-index: 20; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(480px, calc(100% - 32px)); min-height: 72px; padding: 7px 10px; background: white; border: 1px solid var(--line); border-radius: 38px; box-shadow: 0 4px 24px rgba(44,66,88,.1); }
.member-tabbar a { display: flex; position: relative; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; min-width: 0; border-radius: 20px; text-decoration: none; color: var(--muted); font-size: .75rem; }
.member-tabbar a[aria-current="page"] { color: var(--ink); background: #EDF2F8; font-weight: 700; }
.member-tabbar a:hover { background: var(--page); }
.member-tabbar .tab-booking { margin-top: -19px; gap: 5px; background: transparent; }
.tab-booking__icon { width: 48px; height: 48px; display: grid; place-items: center; background: var(--sky); border: 3px solid white; border-radius: 16px; transform: rotate(45deg); box-shadow: 0 2px 10px rgba(44,66,88,.08); }
.tab-booking__icon .member-icon { transform: rotate(-45deg); width: 25px; height: 25px; color: var(--ink); }
.member-tabbar .tab-booking[aria-current="page"] .tab-booking__icon { border-color: var(--primary); }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
  .slot-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .slot-choice { margin: 0; padding: 12px; gap: 10px; }
  .slot-choices > p { grid-column: 1 / -1; margin: 0; }
}
@media (min-width: 900px) {
  .portal-dashboard--guest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-dashboard--guest > .member-page-heading, .portal-dashboard--guest > .welcome-grid { grid-column: 1 / -1; }
  .portal-dashboard--guest > .panel { display: flex; flex-direction: column; min-width: 0; }
  .portal-dashboard--guest > .panel > .link-row { margin-top: auto; }
  .portal-dashboard--guest .quick-card { display: grid; grid-template-columns: minmax(0, 1fr) 36px; grid-template-rows: auto auto; align-content: center; min-height: 144px; gap: 8px 16px; }
  .portal-dashboard--guest .quick-card h2 { grid-area: 1 / 1; align-self: center; }
  .portal-dashboard--guest .quick-card p { grid-area: 2 / 1; align-self: center; }
  .portal-dashboard--guest .quick-card > .member-icon:first-child { grid-area: 1 / 2; align-self: center; }
  .portal-dashboard--guest .quick-card > .member-icon:last-child { grid-area: 2 / 2; justify-self: end; align-self: center; width: 20px; height: 20px; }
  .booking-layout:not(.booking-layout--selected) { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 28px; }
  .booking-form { grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr); gap: 32px; }
  .booking-date-panel { position: sticky; top: 24px; align-self: start; }
}
@media (min-width: 960px) {
  .order-fill-layout { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 32px; align-items: start; }
  .order-fill-overview { position: sticky; top: 24px; }
}
@media (max-width: 600px) {
  .site-header { padding: 26px 20px 16px; }
  .brand { font-size: 1.875rem; }
  .header-help span { display: none; }
  main { padding: 16px 20px 8px; }
  .welcome-grid { gap: 12px; grid-template-columns: 1.05fr 1fr; }
  .welcome-card { padding: 28px 18px 22px; gap: 12px; }
  .welcome-card p { font-size: .875rem; }
  .welcome-card .button { padding: 10px 15px; font-size: .875rem; }
  .quick-stack { gap: 12px; }
  .quick-card { padding: 18px 16px; min-height: 154px; gap: 8px; }
  .quick-card h2 { font-size: 1rem; }
  .quick-card p { font-size: .8125rem; }
  .quick-card > .member-icon { width: 30px; height: 30px; }
  .portal-dashboard { gap: 20px; }
  .panel, .card, .order-card { padding: 20px; }
  .member-page-heading { margin-bottom: 24px; }
  .booking-layout { margin-top: 24px; gap: 28px; }
  .booking-form { gap: 24px; }
  .booking-details > button[type="submit"], .order-fill-form > button[type="submit"], .page--form form > button[type="submit"] { width: 100%; }
  .form-grid { margin: 20px 0; gap: 18px; }
  .member-menu { padding: 6px 20px; }
  .membership-card { min-height: 218px; padding: 24px; gap: 26px; }
  .member-overview { grid-template-columns: minmax(0, 1fr); }
  .member-overview .quick-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr; }
  .membership-card__meta { gap: 12px; flex-wrap: wrap; }
  .order-header { gap: 10px; flex-wrap: wrap; }
  .order-meta { grid-template-columns: minmax(0, 1fr); }
  .site-footer { padding-top: 28px; }
  /* Keep the focused field clear of the floating navigation while entering data. */
  body:has(input:focus:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea:focus, select:focus) .member-tabbar { visibility: hidden; pointer-events: none; }
}
@media (max-width: 359px) {
  main { padding-left: 16px; padding-right: 16px; }
  .site-header { padding-left: 16px; padding-right: 16px; }
  .welcome-card { padding-left: 14px; padding-right: 14px; }
  .quick-card { padding-left: 14px; padding-right: 14px; }
  .welcome-card .button { padding-left: 12px; padding-right: 12px; }
  .member-tabbar { width: calc(100% - 24px); padding-left: 6px; padding-right: 6px; }
  /* Seven 44px date targets fit at 320px without horizontal scrolling. */
  .booking-calendar { margin-left: -31px; margin-right: -31px; }
  .booking-calendar > label, .booking-calendar > input, .booking-calendar > button { margin-left: 12px; margin-right: 12px; }
  .booking-calendar > input { width: calc(100% - 24px); }
  .booking-calendar [data-calendar-submit] { width: calc(100% - 24px); }
  .calendar-nav { padding: 0 8px; }
}
@media (min-width: 360px) and (max-width: 389px) {
  .booking-calendar { margin-left: -16px; margin-right: -16px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .button, .button-secondary, .quick-card, .link-row, .member-tabbar a { transition: background-color .18s, color .18s, box-shadow .18s, transform .18s; }
}
@media (prefers-contrast: more) {
  :root { --line: #8191A3; --muted: #2C4258; }
  .member-tabbar { border-color: var(--primary); }
}
@media print {
  .member-tabbar, .header-help, .skip-link { display: none; }
  .site-footer { padding-bottom: 24px; }
  body { background: white; }
  .card, .panel, .order-card { break-inside: avoid; }
}
