:root {
  color-scheme: light;
  --ink: #24292c;
  --muted: #6b7479;
  --line: #dce2e4;
  --soft-line: #edf0f1;
  --panel: #ffffff;
  --page: #f1f4f5;
  --brand: #06c755;
  --brand-dark: #087a3c;
  --brand-soft: #eaf8ef;
  --coral: #dd625c;
  --coral-soft: #fff1f0;
  --amber: #a96b0b;
  --focus: #1769aa;
  --shadow: 0 10px 24px rgba(27, 38, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
.admin-link,
.customer-link,
.sb-link {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 750;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.28);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.secondary,
.admin-link,
.customer-link,
.sb-link {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.app {
  line-height: 1.5;
}

.phone-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px calc(110px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-inline: 1px solid var(--soft-line);
}

.line-header,
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.line-header {
  min-height: 76px;
  border-bottom: 1px solid var(--soft-line);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
}

.line-header h1,
.admin-topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
}

.connection-status {
  flex: 0 0 auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
  color: var(--muted);
  background: #f7f9f9;
  font-size: 11px;
  font-weight: 700;
}

.connection-status.is-connected {
  border-color: #bfe8ce;
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.connection-status.is-test {
  border-color: #f0c7c4;
  color: #9a3e39;
  background: var(--coral-soft);
}

.message-bar {
  margin: 12px 0 0;
  border: 1px solid #efc0bd;
  border-radius: 6px;
  background: var(--coral-soft);
  color: #8e322d;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 700;
}

.message-bar.is-success {
  border-color: #bfe8ce;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.loading-state {
  min-height: 55vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d9e9df;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--soft-line);
}

.step {
  position: relative;
  min-width: 0;
  color: #969da0;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.step::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 14px;
  left: calc(50% + 15px);
  width: calc(100% - 30px);
  height: 1px;
  background: var(--line);
}

.step:last-child::after {
  display: none;
}

.step::before {
  content: attr(data-step-dot);
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  margin: 0 auto 5px;
  background: #ffffff;
  color: #8d969a;
  font-weight: 800;
}

.step.is-active {
  color: var(--brand-dark);
}

.step.is-active::before {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.step.is-current {
  font-weight: 800;
}

.booking-flow {
  min-width: 0;
}

.existing-reservation-button {
  width: 100%;
  min-height: 72px;
  justify-content: space-between;
  margin-bottom: 18px;
  border-color: #bfe8ce;
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-align: left;
}

.existing-reservation-button > span:first-child {
  display: grid;
  gap: 4px;
}

.existing-reservation-button small {
  font-size: 11px;
}

.existing-reservation-button strong {
  color: var(--ink);
  font-size: 14px;
}

.reservation-detail-panel {
  padding: 24px 0 18px;
}

.reservation-detail-panel h2 {
  margin: 4px 0 18px;
  font-size: 22px;
}

.reservation-list {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.reservation-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.reservation-list-card strong,
.reservation-list-card small {
  display: block;
}

.reservation-list-card small {
  color: var(--muted);
  margin-top: 4px;
}

.reservation-list-card.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.detail-back-button {
  min-height: 40px;
  margin-bottom: 24px;
  padding-inline: 12px;
}

.reservation-management-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.danger-button {
  border-color: #efc0bd;
  background: #ffffff;
  color: #a23933;
}

.flow-step {
  padding: 24px 0 18px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 16px;
}

.section-number {
  margin: 0;
  color: var(--coral);
  font-size: 12px;
  font-weight: 850;
}

.flow-step h2,
.panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.flow-step h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.search-field {
  display: block;
  margin-bottom: 12px;
}

.menu-change-notice {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  border: 1px solid #bfe8ce;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 12px;
}

.menu-change-notice strong {
  color: var(--ink);
  font-size: 14px;
}

.menu-change-notice span {
  font-size: 12px;
  line-height: 1.5;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.choice-card {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.menu-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.menu-copy strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
}

.menu-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.menu-meta {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.choice-card.is-selected,
.slot-button.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.choice-card.is-locked:disabled {
  cursor: default;
  opacity: 1;
}

.category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 0 10px;
  margin-bottom: 3px;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  padding: 0 11px;
}

.category-tab.is-selected {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfd7da;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
}

input::placeholder {
  color: #9aa2a6;
}

textarea {
  resize: vertical;
}

.inline-status {
  min-height: 20px;
  margin: 3px 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.slot-button {
  min-width: 0;
  min-height: 60px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 6px 4px;
}

.slot-button strong {
  font-size: 14px;
}

.slot-button span {
  color: var(--brand-dark);
  font-size: 10px;
  font-weight: 750;
}

.slot-button.is-disabled {
  border-color: var(--soft-line);
  background: #f5f6f6;
  color: #a5abad;
  opacity: 1;
}

.slot-button.is-disabled span {
  color: #a5abad;
}

.slot-skeleton {
  min-height: 60px;
  border-radius: 6px;
  background: #eef1f2;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.5; }
}

.empty-state,
.slot-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #f8f9f9;
  color: var(--muted);
  padding: 14px;
  font-size: 13px;
}

.confirmation-summary {
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
}

.confirmation-summary > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--soft-line);
}

.confirmation-summary dt,
.confirmation-summary dd {
  margin: 0;
}

.confirmation-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.confirmation-summary dd {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.customer-fields {
  border-top: 3px solid var(--coral);
  border-radius: 6px;
  background: #f8f9f9;
  padding: 14px;
}

.returning-customer {
  display: grid;
  gap: 3px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  padding: 12px 14px;
}

.returning-customer span,
.returning-customer small {
  color: var(--muted);
  font-size: 12px;
}

.returning-customer strong {
  font-size: 15px;
}

.final-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.complete-step {
  padding-top: 52px;
  text-align: center;
}

.completion-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
}

.complete-step h2 {
  margin-bottom: 22px;
  font-size: 21px;
}

.result-box {
  display: grid;
  border-top: 1px solid var(--line);
  text-align: left;
}

.result-box > div {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--soft-line);
}

.result-box span {
  color: var(--muted);
  font-size: 12px;
}

.result-box strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.flow-actions {
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 50%;
  width: min(100%, 520px);
  min-height: 78px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 9px;
  align-items: start;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
}

.flow-actions button:last-child:not(.is-hidden) {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.panel p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-app {
  padding: 20px;
}

.admin-topbar {
  max-width: 1180px;
  margin: 0 auto 16px;
}

.admin-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
}

.toolbar-panel {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.reservation-list,
.booking-list,
.log-list {
  display: grid;
  gap: 10px;
}

.reservation-card,
.booking-item,
.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.reservation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.reservation-main {
  min-width: 0;
}

.reservation-main strong,
.reservation-main span,
.booking-item strong,
.booking-item span,
.log-item strong,
.log-item span {
  display: block;
  overflow-wrap: anywhere;
}

.reservation-main span,
.booking-item span,
.log-item span {
  color: var(--muted);
  font-size: 13px;
}

.status {
  width: fit-content;
  min-height: 25px;
  display: inline-flex !important;
  align-items: center;
  border-radius: 4px;
  padding: 0 8px;
  background: var(--muted);
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 800;
}

.status.pending_confirmation,
.status.writing_salon_board,
.status.manual_queued,
.status.manual_retry {
  background: var(--amber);
}

.status.confirmed,
.status.salon_board_written_test {
  background: var(--brand-dark);
}

.status.needs_review,
.status.write_failed,
.status.manual_attention {
  background: var(--coral);
}

.status.rejected {
  background: #5d6870;
}

.reservation-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reservation-actions button {
  min-width: 110px;
}

.reject-button {
  background: var(--coral-soft);
  color: #7d2540;
  border-color: #efcfcd;
}

.compact-field {
  max-width: 240px;
}

.services-app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 12% 8%, rgba(221, 98, 92, 0.12), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(6, 199, 85, 0.12), transparent 34%),
    var(--page);
}

.services-shell {
  width: min(100%, 760px);
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 48px);
}

.services-header {
  text-align: center;
}

.services-header .brand-mark {
  margin: 0 auto 14px;
}

.services-header h1 {
  margin: 0;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.2;
}

.services-header > p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.service-card {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(27, 38, 43, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: #b9c4c8;
  box-shadow: 0 12px 26px rgba(27, 38, 43, 0.1);
}

.service-card__type {
  color: var(--coral);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.service-card strong {
  margin-top: 16px;
  font-size: 22px;
}

.service-card > span:not(.service-card__type) {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.service-card small {
  margin-top: auto;
  padding-top: 22px;
  color: var(--brand-dark);
  font-weight: 800;
}

.service-card--staff small {
  color: var(--coral);
}

.services-note {
  margin: 24px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 540px) {
  .phone-shell {
    border-inline: 0;
  }

  .services-app {
    padding: 0;
  }

  .services-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: 32px 18px;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .service-card {
    min-height: 180px;
  }
}

@media (max-width: 370px) {
  .phone-shell {
    padding-inline: 14px;
  }

  .choice-card {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .menu-meta {
    white-space: normal;
  }

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

  .flow-actions {
    padding-inline: 14px;
  }
}

@media (max-width: 780px) {
  .admin-app {
    padding: 12px;
  }

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

  .toolbar-panel,
  .reservation-card {
    display: grid;
  }

  .reservation-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

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