:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --line: #d9e0e6;
  --ink: #172635;
  --muted: #66717d;
  --blue: #245f9d;
  --blue-weak: #e8f1fb;
  --green: #2f8f6b;
  --green-weak: #e8f6f0;
  --red: #ba4a45;
  --red-weak: #fbebe9;
  --gold: #b58326;
  --gold-weak: #fff4d8;
  --teal: #1f7a76;
  --teal-weak: #e3f3f1;
  --shadow: 0 10px 28px rgba(23, 38, 53, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.passkey-login-button {
  background: var(--teal-weak);
  border-color: #9ccac5;
  color: var(--teal);
  font-weight: 800;
}

button.active-filter {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  box-shadow: 0 8px 18px rgba(31, 122, 118, 0.2);
}

button.line-action {
  background: #06c755;
  border-color: #06c755;
  color: white;
  font-weight: 800;
}

button.line-action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.7);
}

.logout-button {
  background: #ffe5ea;
  border-color: #f2b6c3;
  color: #a8324b;
  font-weight: 800;
}

.pwa-install-button {
  background: var(--teal-weak);
  border-color: #9ccac5;
  color: var(--teal);
  font-weight: 800;
}

.small-button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

[data-refresh-line-name] {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 800;
}

.line-message-actions {
  align-items: center;
}

.line-reminder-button {
  margin-left: auto;
  background: var(--gold);
  border-color: var(--gold);
  color: white;
  font-weight: 800;
}

.line-reminder-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.55);
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
}

.line-login-button {
  width: 100%;
  background: #06c755;
  border-color: #06c755;
  color: white;
  font-weight: 700;
}

button.danger {
  background: var(--red-weak);
  border-color: #e5bbb8;
  color: var(--red);
}

button.force-danger {
  background: #151515;
  border-color: #151515;
  color: #fff;
}

button.ghost {
  background: transparent;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  text-align: left;
  font-weight: 700;
}

.link-button:hover {
  text-decoration: underline;
}

button:disabled,
.slot.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: white;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef2f4;
  color: var(--muted);
  border-color: #cbd5dc;
  cursor: not-allowed;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #162433;
  color: white;
  padding: 20px 16px;
}

.menu-button,
.sidebar-backdrop,
.member-mobile-tabs {
  display: none;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f8f6b, #245f9d);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  color: #dfe8ef;
  border: 0;
  background: transparent;
  text-align: left;
}

.nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: -24px -24px 20px;
  padding: 18px 24px;
  background: rgba(245, 247, 248, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.muted {
  color: var(--muted);
}

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-weak);
  color: var(--gold);
  border: 1px solid #ecd19a;
  font-size: 12px;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.flat-panel {
  box-shadow: none;
  margin-bottom: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 38, 53, 0.42);
}

.modal {
  width: min(1180px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 38, 53, 0.24);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  white-space: pre-line;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.modal-head-save {
  white-space: nowrap;
}

.modal-close {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  padding: 18px;
}

.popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 38, 53, 0.34);
}

.popup {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 22px 60px rgba(23, 38, 53, 0.22);
}

.popup h3 {
  margin: 0 0 8px;
  text-align: center;
}

.popup p {
  white-space: pre-line;
  text-align: center;
}

.pwa-popup {
  width: min(520px, 100%);
}

.pwa-popup p {
  text-align: left;
  line-height: 1.7;
}

.popup-action-row {
  justify-content: center;
}

.popup-action-row button {
  min-width: 128px;
}

.popup-ok-button {
  min-width: 160px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--blue);
}

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

.toolbar input,
.toolbar select {
  max-width: 240px;
}

.member-toolbar input {
  width: 100%;
  max-width: none;
}

.member-search-field {
  width: min(780px, 100%);
}

.member-filter-field,
.reservation-filter-field {
  width: 190px;
}

.member-filter-row,
.reservation-quick-row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.members-table {
  table-layout: fixed;
}

.members-col-name {
  width: 24ch;
}

.members-col-phone {
  width: 120px;
}

.members-col-email {
  width: 20%;
}

.members-col-line {
  width: 12%;
}

.members-col-booked {
  width: 190px;
}

.members-col-actions {
  width: 230px;
}

.reservation-table {
  table-layout: fixed;
}

.line-pending-table,
.line-webhook-table {
  table-layout: fixed;
}

.line-pending-col-id {
  width: 28%;
}

.line-pending-col-name {
  width: 15%;
}

.line-pending-col-phone {
  width: 120px;
}

.line-pending-col-email {
  width: 20%;
}

.line-pending-col-time {
  width: 116px;
}

.line-pending-col-actions {
  width: 310px;
}

.line-webhook-col-time {
  width: 116px;
}

.line-webhook-col-event {
  width: 82px;
}

.line-webhook-col-source {
  width: 82px;
}

.line-webhook-col-id {
  width: calc((100% - 280px) / 4);
}

.id-wrap,
.id-wrap code {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.date-time-stack {
  white-space: nowrap;
}

.date-time-stack span {
  display: block;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell .row-actions {
  flex-wrap: nowrap;
}

.reservation-col-date {
  width: 116px;
}

.reservation-col-time {
  width: 78px;
}

.reservation-col-member {
  width: 24ch;
}

.reservation-col-service {
  width: 26ch;
}

.reservation-col-status {
  width: 116px;
}

.reservation-col-payment {
  width: 110px;
}

.reservation-col-payment-method {
  width: 112px;
}

.reservation-col-actions {
  width: 260px;
}

.reservation-table td[data-label="會員"],
.reservation-table td[data-label="服務"],
.reservation-table td[data-label="收款方式"] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reservation-table td[data-label="會員"] .link-button {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.truncate-cell,
.truncate-link,
.truncate-inline {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncate-link {
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
}

.member-record-tabs {
  margin-bottom: 14px;
}

.product-status-help {
  margin: 4px 0 14px;
  font-size: 13px;
}

.product-usage-link,
.product-report-link {
  font-weight: 700;
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.member-products-table td[data-label="商品名稱"] {
  font-weight: 650;
}

.member-products-table {
  table-layout: fixed;
}

.member-products-table th:nth-child(1) {
  width: 30%;
}

.member-products-table th:nth-child(2),
.member-products-table th:nth-child(3),
.member-products-table th:nth-child(4) {
  width: 13%;
}

.member-products-table th:nth-child(5) {
  width: 31%;
}

.product-usage-table tbody tr:nth-child(odd) {
  background: #eaf3ff;
}

.product-usage-table tbody tr:nth-child(even) {
  background: #eaf7f1;
}

.member-product-record-head {
  flex-wrap: nowrap;
}

.member-product-record-head .toolbar {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-bottom: 0;
}

.member-product-record-head .toolbar button {
  min-width: 104px;
  white-space: nowrap;
}

.member-product-status-filter {
  min-width: 138px;
}

.product-search-results {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(23, 122, 102, .28);
  border-radius: 10px;
  background: #f3faf7;
  box-shadow: 0 10px 24px rgba(27, 44, 39, .10);
}

.product-search-option {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.product-search-option:hover,
.product-search-option:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 122, 102, .12);
}

.product-search-option strong {
  font-size: 15px;
  color: var(--ink);
}

.product-search-option span,
.product-search-empty {
  font-size: 13px;
  color: var(--muted);
}

.member-product-used-up {
  background: #fde8e8;
}

.member-product-expired {
  background: #e7f1ff;
}

.member-product-inactive {
  background: #eef0f2;
}

.muted-row {
  opacity: 0.62;
}

.booked-count-cell {
  white-space: nowrap;
}

.reservation-filter-row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.member-filter-field select,
.reservation-filter-field select {
  width: 100%;
  max-width: none;
}

.date-toolbar {
  align-items: end;
}

.date-toolbar > button {
  min-height: 41px;
  box-shadow: 0 3px 0 rgba(23, 38, 53, 0.16);
}

.date-range-picker,
.date-stepper,
.tabs,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.settings-split,
.message-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.compact-tabs {
  margin: 10px 0;
}

.compact-table input[type="number"] {
  width: 82px;
}

.section-head .row-actions {
  margin-left: auto;
}

.daily-slot-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
}

.capacity-stepper {
  display: grid;
  grid-template-columns: 30px minmax(48px, 1fr) 30px;
  align-items: center;
  gap: 6px;
  max-width: 150px;
}

.capacity-stepper input {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.capacity-step {
  width: 30px;
  height: 30px;
  padding: 0;
  font-weight: 900;
}

.capacity-step-plus {
  background: var(--green);
  border-color: var(--green);
}

.action-label {
  display: none;
}

.responsive-action,
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 36px;
  padding: 0;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.svg-icon {
  width: 1em;
  height: 1em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-rule-range {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 8px;
}

.date-rule-range input {
  width: 100%;
  max-width: none;
}

.date-rule-period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.message-setting-card textarea {
  width: 100%;
  max-width: none;
  min-height: 190px;
  font-family: inherit;
}

.message-setting-card input {
  width: 100%;
  max-width: none;
}

.message-setting-card select {
  width: 100%;
  max-width: none;
}

.message-rule-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #b6d7d0;
  background: #eef8f5;
}

.message-rule-box > .muted {
  grid-column: 1 / -1;
  margin: 0;
}

.message-rule-box [hidden],
.message-setting-card[hidden] {
  display: none !important;
}

.message-direction-tabs {
  width: min(520px, 100%);
  margin: 18px 0 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.message-direction-tabs button {
  width: 100%;
  min-height: 44px;
}

.message-number-field {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.message-number-field span {
  white-space: nowrap;
  font-weight: 700;
}

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

.variable-palette button {
  background: var(--teal-weak);
  border-color: #b6d7d0;
  color: var(--teal);
  font-weight: 700;
}

.date-stepper {
  flex-wrap: nowrap;
  min-width: max-content;
}

.date-range-picker {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  align-items: end;
}

.date-range-picker label {
  width: 160px;
}

.date-range-picker > span {
  align-self: end;
  padding-bottom: 10px;
  color: var(--muted);
}

.date-range-picker input,
.date-stepper input {
  width: 160px;
  max-width: 160px;
}

.tabs {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f3f6f8;
}

.tabs button {
  border: 0;
  min-width: 64px;
  background: transparent;
}

.tabs button.active {
  background: var(--blue);
  color: white;
}

.row-actions {
  gap: 6px;
}

.icon-action {
  min-width: 34px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.calendar-action {
  background: var(--gold-weak);
  border-color: #e4cf9c;
  color: #765315;
  font-weight: 800;
}

.calendar-action .action-icon {
  display: inline-flex;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.panel {
  overflow-x: auto;
}

.list-meta {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

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

.count-inline {
  margin-left: 12px;
  font-size: 13px;
  font-weight: 600;
}

.sort-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #24384c;
  font-weight: 700;
}

.sort-icon {
  display: inline-flex;
  color: var(--teal);
  font-size: 15px;
  font-weight: 900;
}

.sort-icon .svg-icon {
  width: 15px;
  height: 15px;
}

.date-range-field {
  min-width: 260px;
}

.date-range-control {
  position: relative;
  width: 100%;
}

.date-range-trigger {
  width: 100%;
  min-height: 41px;
  text-align: left;
  background: white;
  box-shadow: 0 3px 0 rgba(23, 38, 53, 0.12);
}

.date-range-popover {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 38, 53, 0.28);
}

.date-range-dialog {
  width: min(320px, 88vw);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 42px rgba(23, 38, 53, 0.18);
}

.date-range-monthbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.date-range-monthbar button {
  width: 36px;
  height: 32px;
  padding: 0;
  font-size: 20px;
  font-weight: 900;
}

.date-range-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.date-range-calendar span,
.date-range-calendar button {
  min-height: 34px;
  padding: 0;
  text-align: center;
}

.date-range-calendar span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-range-calendar button {
  border-color: transparent;
}

.date-range-calendar button.in-range {
  background: var(--teal-weak);
  border-color: #b6d7d0;
}

.date-range-calendar button.range-start,
.date-range-calendar button.range-end {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 900;
}

.date-range-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.date-range-footer button {
  min-width: 78px;
}

.member-reservation-head {
  align-items: center;
}

.member-modal-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.member-modal-filters select {
  width: 140px;
  text-align: center;
  text-align-last: center;
}

.member-modal-filters .date-range-control {
  width: 220px;
}

.member-modal-filters .date-range-trigger,
#member-modal-sort {
  text-align: center;
  text-align-last: center;
}

.mobile-only,
.mobile-inline,
.payment-mobile {
  display: none;
}

.slot-hidden-row {
  opacity: 0.48;
  background: #f1f3f4;
}

.slot-hidden-row input[type="checkbox"][data-slot-hidden-time] {
  accent-color: var(--green);
}

.settings-slot-table input[type="checkbox"][data-slot-hidden-time]:checked {
  accent-color: var(--green);
}

.calendar-status-filter {
  width: 140px;
  margin-left: auto;
}

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

.reservation-member-field,
.reservation-service-field,
.reservation-form-grid .full {
  grid-column: span 2;
}

.reservation-status-field {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reservation-status-field.status-booked {
  background: var(--blue-weak);
}

.reservation-status-field.status-completed {
  background: var(--green-weak);
}

.reservation-status-field.status-cancelled {
  background: var(--red-weak);
}

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

.record-note-field {
  grid-column: span 2;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf3f8;
  color: #24384c;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.badge.active,
.badge.booked {
  background: var(--blue-weak);
  color: var(--blue);
}

.badge.completed {
  background: var(--green-weak);
  color: var(--green);
}

.badge.bound {
  background: var(--green-weak);
  color: var(--green);
}

.badge.cancelled,
.badge.inactive {
  background: var(--red-weak);
  color: var(--red);
}

.badge.no_show,
.badge.pending {
  background: var(--gold-weak);
  color: var(--gold);
}

.status-badge-button {
  border: 0;
  background: transparent;
  padding: 0;
}

.badge.BR,
.badge.br {
  background: var(--blue-weak);
  color: var(--blue);
}

.badge.BL,
.badge.bl {
  background: var(--red-weak);
  color: var(--red);
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #30485d;
}

.record-form {
  display: grid;
  gap: 12px;
}

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

.record-basic textarea {
  min-height: 58px;
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.member-login-wrap {
  background: #000;
  color: white;
}

.login-box {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.login-box.member-login-only {
  grid-template-columns: minmax(260px, 420px);
  justify-content: center;
}

.login-box.admin-login-only {
  grid-template-columns: minmax(300px, 440px);
  justify-content: center;
}

.login-logo {
  display: block;
  object-fit: cover;
}

.member-login-panel {
  text-align: center;
  background: #0c0c0c;
  border-color: #2b2b2b;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
}

.member-login-media {
  position: relative;
  width: min(220px, 72vw);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: #000;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52);
}

.member-login-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .42s ease;
}

.member-login-video.is-ready {
  opacity: 1;
}

.member-login-video.is-fading {
  opacity: 0;
  transition-duration: 2s;
}

.member-login-panel h1 {
  color: white;
  margin-top: 0;
}

.member-login-title {
  font-size: 24px;
  line-height: 1.25;
}

.member-login-copy {
  color: #d4d4d4;
}

.member-login-install {
  width: 100%;
  margin-bottom: 10px;
  background: #f3efe7;
  border-color: #dac7a8;
  color: #5b3f23;
}

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

.admin-line-test-link {
  justify-content: center;
  width: 100%;
}

.sidebar-install-button {
  width: 100%;
  justify-content: flex-start;
  margin-top: 10px;
  background: rgba(227, 243, 241, 0.12);
  border-color: rgba(156, 202, 197, 0.55);
  color: #e3f3f1;
}

.login-message {
  width: min(420px, 100%);
  margin: 0 auto 16px;
}

.line-profile-panel {
  width: min(720px, 100%);
}

.line-profile-wrap {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 244, 216, 0.95), transparent 28%),
    radial-gradient(circle at 85% 16%, rgba(227, 243, 241, 0.95), transparent 30%),
    linear-gradient(135deg, #f8fbf7 0%, #eaf6f2 52%, #fff7df 100%);
}

.line-profile-panel {
  border-color: #b6d7d0;
  box-shadow: 0 22px 60px rgba(31, 122, 118, 0.16);
}

.line-profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  justify-content: center;
  gap: 10px;
}

.line-profile-actions button {
  width: 100%;
}

.required-mark {
  color: var(--red);
  font-weight: 900;
}

.member-reservations-panel {
  background: #d0e5df;
  border-color: #b6d7d0;
}

.version-label {
  position: fixed;
  right: 14px;
  bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.member-booking-panel .step-title,
.member-booking-panel h2 {
  color: var(--teal);
}

.member-booking-panel h2 {
  font-size: 18px;
  font-weight: 800;
}

.member-me-topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: white;
}

.slot.available {
  border-color: #a7d9c3;
  background: var(--green-weak);
}

.slot.booked {
  background: #edf1f5;
}

.slot.selected {
  outline: 4px solid rgba(31, 122, 118, 0.32);
  border-color: var(--teal);
  background: var(--teal);
  color: white;
  box-shadow: 0 8px 20px rgba(31, 122, 118, 0.22);
  transform: translateY(-1px);
}

.slot.selected strong {
  color: inherit;
}

.service-choice-grid {
  margin-top: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.service-choice {
  cursor: pointer;
}

.inline-control {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.inline-control input {
  width: auto;
}

.booking-date-stepper {
  margin-top: 10px;
  justify-content: center;
}

.booking-date-stepper button {
  background: var(--gold-weak);
  border-color: #e4cf9c;
  color: #765315;
  font-weight: 700;
}

.booking-date-stepper input,
.booking-selected-date {
  text-align: center;
}

.booking-selected-date {
  min-width: 160px;
  color: var(--ink);
}

.booking-month-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 10px 0 12px;
}

.booking-month-toolbar button {
  width: 46px;
  height: 42px;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.booking-month-toolbar strong {
  min-width: 160px;
  text-align: center;
  font-size: 1.18rem;
}

.booking-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  margin: 0;
}

.booking-calendar-weekday {
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.booking-calendar-day,
.booking-calendar-empty {
  min-height: 42px;
  padding: 6px 4px;
  text-align: center;
}

.booking-calendar-day {
  border-color: #c8ddd8;
  background: var(--teal-weak);
  color: var(--ink);
  font-weight: 800;
}

.booking-calendar-day.available:hover,
.booking-calendar-day.selected {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.booking-calendar-day.disabled,
.booking-calendar-day:disabled {
  border-color: #e2e5e7;
  background: #eef0f1;
  color: #a6adb1;
  cursor: not-allowed;
  opacity: 1;
}

.booking-calendar-day.selected.disabled,
.booking-calendar-day.selected:disabled {
  border-color: #d5a62f;
  background: #eef0f1;
  color: #767f84;
  outline: 3px solid rgba(213, 166, 47, 0.45);
  box-shadow: inset 0 0 0 1px rgba(213, 166, 47, 0.4);
}

.booking-calendar-loading,
.booking-loading {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px 0;
  text-align: center;
}

.calendar {
  display: grid;
  grid-template-columns: 86px 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.time-col,
.events-col {
  display: grid;
  grid-auto-rows: 44px;
}

.time-cell,
.event-cell {
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

.time-cell {
  background: #f3f6f8;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.slot-add {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
}

.event-pill {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--blue-weak);
  color: var(--blue);
  cursor: pointer;
}

.event-pill.booked {
  background: var(--blue-weak);
  color: var(--blue);
}

.event-pill.completed {
  background: var(--green-weak);
  color: var(--green);
}

.event-pill.cancelled {
  background: var(--red-weak);
  color: var(--red);
}

.slot-unavailable {
  background: #fde4df;
}

.slot-unavailable:hover {
  background: #fbd8d1;
}

.slot-option-unavailable {
  color: var(--muted);
  background: var(--red-weak);
}

.step-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.week-grid {
  display: grid;
  grid-template-columns: 70px repeat(7, 1fr);
  border: 1px solid var(--line);
  overflow-x: auto;
  background: white;
}

.week-grid > div {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 44px;
  padding: 6px;
}

.week-slot-cell {
  cursor: pointer;
}

.week-slot-cell:empty:hover {
  background: #f8fbfd;
}

.week-slot-cell.slot-unavailable:empty:hover {
  background: #fbd8d1;
}

.week-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.week-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  border-color: #b6d7d0;
  background: var(--teal-weak);
  color: var(--teal);
  font-weight: 900;
}

.calendar-slot-list {
  display: grid;
  gap: 8px;
}

.calendar-slot-list button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.mobile-date {
  display: none;
}

.calendar-booked-count {
  margin-left: auto;
  min-width: 44px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--teal-weak);
  color: var(--teal);
  font-weight: 800;
}

.calendar-status-filter + .calendar-booked-count {
  margin-left: 0;
}

.calendar-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}

.calendar-topbar h1 {
  justify-self: start;
}

.calendar-topbar .date-stepper {
  justify-self: center;
}

.date-stepper input,
#cal-date {
  text-align: center;
}

.time-cell,
.event-cell {
  min-height: 44px;
  height: 44px;
}

.slot-setting-meta {
  min-height: 41px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-split > .panel > .list-meta {
  min-height: 41px;
  align-items: center;
}

.empty-table-card {
  margin: 0;
  padding: 14px;
  border: 1px dashed #b6d7d0;
  border-radius: 8px;
  background: #eef8f5;
}

.slot-setting-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-setting-controls input {
  width: 150px;
}

.slot-setting-controls button {
  white-space: nowrap;
}

.spine-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.spine-map {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  padding: 14px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.spine-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

.spine-section-title {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

.spine-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.vertebra-row {
  display: grid;
  grid-template-columns: 96px minmax(72px, 1fr) 96px;
  gap: 8px;
  align-items: center;
}

.vertebra-row-multi {
  grid-template-columns: minmax(86px, 128px) minmax(0, 1fr);
}

.spine-state-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 8px;
}

.spine-state-options .spine-state {
  width: 100%;
}

.spine-state,
.vertebra-label {
  min-height: 34px;
  border-radius: 6px;
  font-weight: 700;
}

.vertebra-label {
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.spine-state {
  width: 96px;
  padding: 0;
  background: white;
}

.spine-summary-panel {
  min-width: 0;
}

.spine-summary-table th:nth-child(1),
.spine-summary-table td:nth-child(1) {
  width: 64px;
}

.spine-summary-table th:nth-child(2),
.spine-summary-table td:nth-child(2) {
  width: 76px;
}

.spine-summary-table th:nth-child(4),
.spine-summary-table td:nth-child(4) {
  width: 44px;
}

.spine-note-input {
  width: 100%;
  min-width: 120px;
}

.record-reservation-time-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.record-reservation-time-row label {
  min-width: 0;
}

.record-time-strip {
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid #d7e5e2;
  border-radius: 6px;
  background: #f1f8f6;
  color: var(--muted);
  font-size: 13px;
}

.record-time-strip span {
  color: var(--ink);
  font-weight: 700;
}

.record-report-button {
  background: var(--gold-weak);
  border-color: #ecd19a;
  color: var(--gold);
  font-weight: 800;
  white-space: nowrap;
}

.record-next-reservation-button {
  background: var(--teal-weak);
  border-color: #9ccac5;
  color: var(--teal);
  font-weight: 800;
  white-space: nowrap;
}

.record-report {
  display: grid;
  gap: 16px;
}

.record-report-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.record-report-meta div {
  display: grid;
  gap: 4px;
}

.record-report-meta span {
  color: var(--muted);
  font-size: 12px;
}

.record-report-meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-report-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.report-spine-figure {
  position: relative;
  width: min(320px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report-spine-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.report-spine-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 54px;
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 5px 14px rgba(23, 38, 53, 0.2);
}

.report-spine-marker.bl {
  background: var(--red);
}

.report-spine-marker.br {
  background: var(--green);
}

.record-report-summary h3 {
  margin-top: 0;
}

.record-report-table {
  table-layout: fixed;
  width: 100%;
}

.record-report-entry td {
  display: table-cell;
  padding: 10px;
  width: 100%;
}

.record-report-entry-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 6px;
  font-weight: 700;
  text-align: left;
}

.record-report-entry-note {
  display: block;
  width: 100%;
  color: var(--muted);
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.spine-state-bl.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.spine-state-br.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.spine-state-blue.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.spine-status-badge.spine-state-bl {
  background: var(--red);
  color: white;
}

.spine-status-badge.spine-state-br {
  background: var(--green);
  color: white;
}

.spine-status-badge.spine-state-blue {
  background: var(--blue);
  color: white;
}

.spine-status-empty {
  background: #e7edf2;
  color: #52606d;
}

.report-spine-marker.spine-state-bl {
  background: var(--red);
}

.report-spine-marker.spine-state-br {
  background: var(--green);
}

.report-spine-marker.spine-state-blue {
  background: var(--blue);
}

.vertebra-label {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: #24384c;
}

.vertebra-label.vertebra-c {
  background: #fde7f0;
  border-color: #f2b8cd;
}

.vertebra-label.vertebra-c.active {
  background: #b6224e;
  border-color: #b6224e;
  color: white;
}

.vertebra-label.vertebra-t {
  background: #fff6cf;
  border-color: #eadb92;
}

.vertebra-label.vertebra-t.active {
  background: #a67c00;
  border-color: #a67c00;
  color: white;
}

.vertebra-label.vertebra-l {
  background: #ffe2c2;
  border-color: #efb476;
}

.vertebra-label.vertebra-l.active {
  background: #b85c00;
  border-color: #b85c00;
  color: white;
}

.vertebra-label.vertebra-s {
  background: #efe5ff;
  border-color: #cbb8ef;
}

.vertebra-label.vertebra-s.active {
  background: #6f42c1;
  border-color: #6f42c1;
  color: white;
}

.vertebra-label.vertebra-r {
  background: #e7f2ff;
  border-color: #aacced;
}

.vertebra-label.vertebra-r.active {
  background: #1f6fb2;
  border-color: #1f6fb2;
  color: white;
}

.vertebra-label.vertebra-ilium {
  background: #e7f7e9;
  border-color: #aad7b1;
}

.vertebra-label.vertebra-ilium.active {
  background: #2d7d46;
  border-color: #2d7d46;
  color: white;
}

.vertebra-label.vertebra-hip {
  background: #fff0e6;
  border-color: #efc09f;
}

.vertebra-label.vertebra-hip.active {
  background: #b8672b;
  border-color: #b8672b;
  color: white;
}

.notice {
  border-left: 4px solid var(--gold);
  background: var(--gold-weak);
  padding: 12px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

@media print {
  body:not(.print-report-body) > * {
    display: none !important;
  }

  .print-report-body {
    background: white;
  }

  .print-report-page {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    color: #172635;
  }

  .print-report-page h1 {
    margin: 0 0 14px;
    font-size: 24px;
  }

  .print-report-page .record-report-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
  }

  .print-report-page .report-spine-figure {
    width: 240px;
    padding: 6px;
    break-inside: avoid;
  }

  .print-report-page .record-report-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    break-inside: avoid;
  }

  .print-report-page .record-report-entry {
    break-inside: avoid;
  }

  .print-report-page .record-report-entry-note {
    color: #172635;
  }
}

@media (max-width: 900px) {
  body {
    background: #edf2f5;
  }

  .login-box,
  .grid.two,
  .grid.three,
  .spine-layout,
  .record-basic,
  .reservation-form-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
    background: #edf2f5;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(300px, 82vw);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 18px 0 40px rgba(23, 38, 53, 0.2);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-color: #c8d2db;
    background: white;
    box-shadow: 0 8px 22px rgba(23, 38, 53, 0.14);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: none;
    background: rgba(23, 38, 53, 0.32);
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  .sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
  }

  .main {
    padding: 72px 14px 18px;
  }

  .member-shell .menu-button,
  .member-shell .sidebar,
  .member-shell .sidebar-backdrop,
  .member-shell.sidebar-open .sidebar-backdrop {
    display: none;
  }

  .member-mobile-tabs {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 12px;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    height: 42px;
    background: #edf2f5;
  }

  .member-mobile-tabs::before {
    content: "";
    position: absolute;
    inset: -12px -14px -8px;
    z-index: -1;
    background: #edf2f5;
  }

  .member-mobile-tabs button {
    height: 42px;
    padding: 0 8px;
    border-color: #c8d2db;
    background: white;
    box-shadow: 0 8px 22px rgba(23, 38, 53, 0.12);
    white-space: nowrap;
  }

  .member-mobile-tabs button.active {
    border-color: var(--teal);
    background: var(--teal);
    color: white;
  }

  #main.member-swipe-left {
    animation: memberSwipeLeft .24s cubic-bezier(.22, .61, .36, 1);
  }

  #main.member-swipe-right {
    animation: memberSwipeRight .24s cubic-bezier(.22, .61, .36, 1);
  }

  #main.member-swipe-dragging {
    transition: none;
    will-change: transform, opacity;
  }

  #main.member-swipe-reset {
    transition: transform .18s ease-out, opacity .18s ease-out;
    will-change: transform, opacity;
  }

  #main.member-swipe-exit-next {
    animation: memberSwipeExitNext .24s cubic-bezier(.55, .06, .68, .19) forwards;
  }

  #main.member-swipe-exit-prev {
    animation: memberSwipeExitPrev .24s cubic-bezier(.55, .06, .68, .19) forwards;
  }

  .member-login-title {
    font-size: 21px;
  }

  .member-shell .main {
    padding-top: 66px;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    touch-action: pan-y;
  }

  .member-swipe-preview {
    position: absolute;
    inset: 66px 0 0;
    z-index: 2;
    min-height: calc(100dvh - 66px);
    padding: 0 14px 24px;
    pointer-events: none;
    background: #edf2f5;
    will-change: transform, opacity;
  }

  .member-swipe-preview-next {
    animation: memberSwipePreviewNext .24s cubic-bezier(.22, .61, .36, 1) forwards;
  }

  .member-swipe-preview-prev {
    animation: memberSwipePreviewPrev .24s cubic-bezier(.22, .61, .36, 1) forwards;
  }

  .member-swipe-preview-topbar,
  .member-swipe-preview-panel {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(23, 38, 53, .08);
  }

  .member-swipe-preview-topbar {
    display: flex;
    align-items: center;
    min-height: 58px;
    margin-bottom: 16px;
    padding: 14px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
  }

  .member-swipe-preview-panel {
    height: 220px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f1faf6 100%);
  }

  .member-swipe-preview-panel.short {
    height: 96px;
    opacity: .78;
  }

  .member-shell .topbar {
    margin: 0 -14px 16px;
    padding: 12px 14px;
  }

  .topbar {
    margin: -72px -14px 16px;
    padding: 70px 14px 14px;
  }

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

  .topbar {
    flex-wrap: wrap;
  }

  .member-toolbar,
  .date-toolbar,
  .section-head,
  .settings-split,
  .message-settings-grid {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .message-rule-box {
    grid-template-columns: 1fr;
  }

  .member-toolbar input,
  .member-search-field,
  .toolbar input,
  .toolbar select {
    width: 100%;
    max-width: none;
  }

  .member-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .member-filter-field {
    width: auto;
    min-width: 0;
  }

  .date-range-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    width: 100%;
    order: -1;
  }

  .date-range-field {
    width: 100%;
    min-width: 0;
    order: -2;
  }

  .date-range-dialog {
    width: min(330px, calc(100vw - 36px));
  }

  .date-range-picker label {
    width: auto;
  }

  .date-range-picker .field-label {
    display: none;
  }

  .reservation-filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .reservation-filter-field {
    width: auto;
    min-width: 0;
  }

  .reservation-filter-field .filter-label {
    display: none;
  }

  .reservation-quick-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    order: -1;
  }

  .reservation-quick-row button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .calendar-topbar {
    grid-template-columns: 1fr;
  }

  .calendar-topbar .date-stepper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .calendar-topbar .date-stepper input {
    min-width: 0;
    width: 100%;
    max-width: none;
    text-align: center;
  }

  .calendar-booked-count {
    margin-left: 0;
    justify-self: end;
    white-space: nowrap;
  }

  .calendar-status-filter {
    width: min(140px, 42vw);
    margin-left: auto;
  }

  .toolbar .calendar-status-filter {
    max-width: min(140px, 42vw);
  }

  .panel:has(table),
  .reservation-card-list,
  .reservation-list-panel,
  .member-reservations-panel {
    background: #d0e5df;
  }

  .empty-table-card {
    background: transparent;
    border-color: #9fcfc5;
  }

  .member-reservations-panel .empty-table-card {
    background: transparent;
  }

  table,
  tbody {
    background: transparent;
  }

  .settings-slot-table,
  .settings-slot-table tbody {
    display: block;
    background: transparent;
  }

  .settings-slot-table tr {
    display: grid;
    grid-template-columns: 52px 62px 86px minmax(120px, 1fr);
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    border-color: #b6d7d0;
  }

  .settings-slot-table td {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border-bottom: 0;
  }

  .settings-slot-table td::before {
    display: none;
  }

  .settings-slot-table input[type="number"] {
    width: 100%;
    max-width: none;
  }

  .capacity-stepper {
    max-width: none;
  }

  .date-rule-range {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .date-rule-period {
    width: 100%;
    justify-content: space-between;
  }

  .daily-slot-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .record-reservation-time-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    overflow: hidden;
  }

  .members-table {
    table-layout: auto;
  }

  .members-table colgroup {
    display: none;
  }

  .reservation-table colgroup {
    display: none;
  }

  .line-pending-table colgroup,
  .line-webhook-table colgroup {
    display: none;
  }

  .reservation-table td[data-label="收款方式"],
  .payment-desktop {
    display: none !important;
  }

  .payment-mobile {
    display: inline;
  }

  .mobile-only {
    display: block;
  }

  .desktop-inline {
    display: none !important;
  }

  .mobile-inline {
    display: inline-flex;
  }

  .copy-line-id {
    width: 34px;
    height: 32px;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  .members-table .truncate-cell {
    display: grid;
  }

  .members-table .truncate-link,
  .members-table .truncate-inline {
    max-width: 100%;
  }

  .members-table td[data-label="Email"],
  .members-table td[data-label="Line User ID"] {
    display: none !important;
  }

  .booked-count-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
  }

  .booked-count-cell::before {
    width: 68px;
    flex: 0 0 68px;
    margin-right: 0;
  }

  .booked-count-cell .count-chip {
    margin-left: auto;
    flex: 0 0 auto;
  }

  .modal .reservation-table td {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .member-reservation-head {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }

  .member-reservation-head h3 {
    margin: 0;
  }

  .member-product-record-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .member-product-record-head h3 {
    margin: 0;
  }

  .member-product-record-head .toolbar {
    display: grid;
    grid-template-columns: minmax(138px, 1fr) minmax(104px, max-content);
    width: 100%;
    gap: 8px;
  }

  .member-product-record-head .toolbar button,
  .member-product-record-head .toolbar select {
    white-space: nowrap;
  }

  .member-modal-filters {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
    order: 3;
  }

  .member-modal-filters select,
  .member-modal-filters .date-range-control,
  .member-modal-filters button {
    width: 100%;
    min-width: 0;
  }

  .member-modal-filters .date-range-control {
    grid-column: 1 / -1;
    order: 1;
  }

  .member-modal-filters select {
    order: 2;
  }

  .member-modal-filters button {
    order: 3;
  }

  .member-modal-filters select,
  .member-modal-filters button,
  #member-modal-sort,
  .date-range-trigger {
    text-align: center;
    text-align-last: center;
  }

  .member-reservation-head > .primary {
    grid-column: 1 / -1;
    order: 4;
  }

  .calendar-toolbar {
    display: grid;
    grid-template-columns: auto minmax(96px, 1fr) minmax(46px, auto);
    align-items: center;
    gap: 8px;
  }

  .calendar-toolbar .tabs {
    min-width: 0;
  }

  .calendar-toolbar .tabs button {
    min-width: 44px;
    padding-inline: 8px;
  }

  .calendar-toolbar .calendar-status-filter {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .calendar-toolbar .calendar-booked-count {
    min-width: 46px;
  }

  .reservation-member-field,
  .reservation-form-grid .full,
  .record-note-field {
    grid-column: 1 / -1;
  }

  .reservation-form-grid,
  .record-basic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reservation-service-field {
    grid-column: 1;
    grid-row: 2;
  }

  .reservation-status-field {
    grid-column: 2;
    grid-row: 2;
  }

  .reservation-date-field {
    grid-column: 1;
    grid-row: 3;
  }

  .reservation-time-field {
    grid-column: 2;
    grid-row: 3;
  }

  .reservation-payment-method-field {
    grid-column: 1;
    grid-row: 4;
  }

  .reservation-payment-field,
  .reservation-voucher-field {
    grid-column: 2;
    grid-row: 4;
  }

  .record-member-field,
  .record-service-field,
  .record-note-field {
    grid-column: 1 / -1;
  }

  .record-date-field,
  .record-payment-method-field {
    grid-column: 1;
  }

  .record-time-field,
  .record-payment-field,
  .record-voucher-field {
    grid-column: 2;
  }

  .record-basic textarea {
    min-height: 64px;
  }

  .flat-panel {
    padding: 12px;
    margin-bottom: 8px;
  }

  .flat-panel h3 {
    margin: 0 0 8px;
  }

  .flat-panel p {
    margin: 6px 0;
  }

  .week-grid {
    overflow-x: auto;
  }

  .week-corner-cell,
  .week-time-cell {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f8fafb;
    box-shadow: 1px 0 0 var(--line);
  }

  .week-date-count {
    display: none;
  }

  .week-slot-cell {
    min-width: 58px;
  }

  .week-count-pill {
    min-width: 32px;
    padding: 4px 6px;
  }

  .spine-summary-table,
  .spine-summary-table tbody {
    display: block;
    background: transparent;
  }

  .spine-summary-table tr {
    display: grid;
    grid-template-columns: 54px 64px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px;
  }

  .spine-summary-table td {
    display: flex;
    padding: 0;
    border-bottom: 0;
  }

  .spine-summary-table td::before {
    display: none;
  }

  .spine-note-input {
    min-width: 0;
  }

  .member-reservations-panel table,
  .member-reservations-panel tbody {
    background: transparent;
  }

  .member-reservations-panel tr {
    margin-bottom: 16px;
    border-color: #9fcfc5;
    box-shadow: 0 8px 18px rgba(31, 122, 118, 0.12);
  }

  td {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 1px solid var(--line);
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    justify-self: start;
    text-align: left;
    white-space: nowrap;
  }

  .member-products-table td {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .status-badge-button {
    justify-self: start;
  }

  td:last-child {
    border-bottom: 0;
  }
}

@keyframes memberSwipeLeft {
  from {
    opacity: .86;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes memberSwipeRight {
  from {
    opacity: .86;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes memberSwipeExitNext {
  from {
    opacity: 1;
    transform: translateX(var(--swipe-x, 0));
  }
  to {
    opacity: .86;
    transform: translateX(-100%);
  }
}

@keyframes memberSwipeExitPrev {
  from {
    opacity: 1;
    transform: translateX(var(--swipe-x, 0));
  }
  to {
    opacity: .86;
    transform: translateX(100%);
  }
}

@keyframes memberSwipePreviewNext {
  from {
    opacity: .86;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes memberSwipePreviewPrev {
  from {
    opacity: .86;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 520px) {
  .member-me-topbar {
    flex-wrap: nowrap;
    align-items: center;
  }

  .member-me-topbar h1 {
    font-size: 22px;
  }

  .member-me-topbar .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .member-me-topbar .topbar-actions button {
    padding-inline: 8px;
    white-space: nowrap;
  }

  .topbar,
  .date-stepper {
    align-items: stretch;
  }

  .date-stepper {
    flex-wrap: wrap;
  }

  .calendar-topbar .date-stepper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .booking-date-stepper {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(72px, auto);
    gap: 8px;
  }

  .date-stepper:not(.booking-date-stepper) input,
  .date-range-picker input {
    width: 100%;
    max-width: none;
  }

  .calendar-topbar .date-stepper input {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .daily-slot-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-slot-toolbar #daily-slot-date {
    grid-column: 1 / -1;
  }

  .daily-slot-toolbar button {
    width: 100%;
  }

  .desktop-date {
    display: none;
  }

  .mobile-date {
    display: inline;
  }

  .booking-date-stepper input {
    min-width: 0;
    width: 100%;
  }

  .booking-selected-date {
    min-width: 0;
    width: 100%;
  }

  .booking-calendar-day,
  .booking-calendar-empty {
    min-height: 38px;
  }

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

  .record-report-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-report-layout {
    grid-template-columns: 1fr;
  }

  .service-record-modal .modal-head {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) 38px;
  }

  .service-record-modal .modal-head h2 {
    grid-column: 1 / 4;
    grid-row: 1;
    align-self: center;
  }

  .service-record-modal .modal-head-actions {
    display: contents;
  }

  .service-record-modal .modal-close {
    grid-column: 4;
    grid-row: 1;
  }

  .service-record-modal .record-report-button,
  .service-record-modal .record-next-reservation-button,
  .service-record-modal .modal-head-save {
    grid-row: 2;
    width: 100%;
    padding: 8px 6px;
    font-size: 13px;
  }

  .service-record-modal .record-report-button {
    grid-column: 1 / 2;
  }

  .service-record-modal .record-next-reservation-button {
    grid-column: 2 / 3;
  }

  .service-record-modal .modal-head-save {
    grid-column: 3 / 4;
  }

  .report-spine-figure {
    width: min(260px, 100%);
  }

  .report-spine-marker {
    min-width: 48px;
    padding: 3px 5px;
    font-size: 11px;
  }

  .record-report-table,
  .record-report-table tbody,
  .record-report-table tr,
  .record-report-table td {
    display: block;
    width: 100%;
  }

  .record-report-table tr {
    background: white;
  }

  .record-report-table td {
    grid-template-columns: 1fr;
  }

  .record-report-table td::before {
    display: none;
  }

  .record-report-entry-head {
    display: flex;
    justify-content: flex-start;
    gap: 14px;
  }

  .record-report-entry-note {
    width: 100%;
  }

  .service-choice-grid {
    grid-template-columns: 1fr;
  }

  .vertebra-row {
    grid-template-columns: 76px minmax(48px, 1fr) 76px;
  }

  .spine-state {
    width: 76px;
  }
}

@media print {
  .print-report-page .record-report-table,
  .print-report-page .record-report-table tbody,
  .print-report-page .record-report-table tr,
  .print-report-page .record-report-table td {
    display: block !important;
    width: 100% !important;
  }

  .print-report-page .record-report-table td {
    padding: 8px 10px !important;
    border-bottom: 1px solid #d9e0e6;
  }

  .print-report-page .record-report-table td::before {
    display: none !important;
    content: "" !important;
  }

  .print-report-page .record-report-entry-head {
    display: flex !important;
    justify-content: flex-start !important;
    gap: 18px !important;
    text-align: left !important;
    white-space: nowrap;
  }

  .print-report-page .record-report-entry-note {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: left !important;
  }
}
