:root {
  color-scheme: light;
  --ink: #162827;
  --muted: #667573;
  --line: #dce4e1;
  --surface: #ffffff;
  --canvas: #f4f6f5;
  --deep: #102a2b;
  --green: #0a8f68;
  --green-dark: #087456;
  --green-soft: #e5f4ee;
  --amber: #bf791f;
  --amber-soft: #fbf0dd;
  --red: #bd4343;
  --red-soft: #faeaea;
  --radius: 8px;
  --shadow: 0 14px 34px rgba(23, 52, 48, 0.08);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #e8efec 0, #f4f6f5 270px, #f4f6f5 100%);
  letter-spacing: 0;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 18px 0;
  color: #f8fbfa;
  background: var(--deep);
}

.brand-logo {
  display: block;
  width: 142px;
  height: 38px;
  object-fit: contain;
  object-position: left center;
}

.topbar-service {
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px 14px 0;
}

.welcome {
  position: relative;
  min-height: 138px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 24px 22px;
  color: #fff;
  background:
    linear-gradient(115deg, rgba(16, 42, 43, 0.96), rgba(26, 78, 67, 0.86)),
    var(--deep);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise-in 420ms ease-out both;
}

.welcome::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.welcome-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.welcome .eyebrow {
  color: #8ddac1;
}

.welcome h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
}

.welcome p:last-child {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.welcome-mark {
  position: absolute;
  z-index: 1;
  right: 22px;
  top: 24px;
  width: 58px;
  height: 58px;
  object-fit: contain;
  opacity: 0.86;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 18px 0 0;
  border-bottom: 1px solid var(--line);
}

.mode-tab {
  position: relative;
  height: 50px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
  cursor: pointer;
}

.mode-tab::after {
  content: "";
  position: absolute;
  right: 28%;
  bottom: -1px;
  left: 28%;
  height: 3px;
  background: var(--green);
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.mode-tab.is-active {
  color: var(--ink);
  font-weight: 700;
}

.mode-tab.is-active::after {
  transform: scaleX(1);
}

.view {
  display: none;
  padding: 24px 6px 4px;
}

.view.is-active {
  display: block;
  animation: fade-slide 220ms ease-out both;
}

.step-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.step-heading h2,
.success-view h2,
.status-result h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.step-heading > span {
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.step-track {
  height: 3px;
  margin-bottom: 25px;
  overflow: hidden;
  background: #dfe6e3;
}

.step-track-fill {
  display: block;
  width: 33.333%;
  height: 100%;
  background: var(--green);
  transition: width 260ms ease;
}

.form-step {
  display: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-step.is-active {
  display: block;
  animation: fade-slide 220ms ease-out both;
}

.field,
.field-group {
  display: block;
  min-width: 0;
  margin-bottom: 19px;
}

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

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #344947;
  font-size: 13px;
  font-weight: 600;
}

.field-label b {
  color: var(--red);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #ccd7d3;
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field textarea {
  min-height: 86px;
  padding-top: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10, 143, 104, 0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #99a5a2;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--red);
}

.field-error,
.consent-error {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  color: var(--red);
  font-size: 11px;
}

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

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid #ced8d5;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  text-align: center;
}

.segmented-control input:checked + span {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 700;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.consent input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: var(--green);
}

.consent-error {
  margin: 4px 0 8px 27px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
}

.button {
  min-height: 49px;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  border: 1px solid var(--green);
  color: #fff;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(10, 143, 104, 0.16);
}

.button-primary:active {
  background: var(--green-dark);
  transform: translateY(1px);
}

.button-secondary {
  border: 1px solid #cbd6d2;
  color: var(--ink);
  background: #fff;
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.is-loading .button-loader {
  display: block;
}

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

.form-message {
  min-height: 20px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

.success-view,
.status-result {
  display: none;
}

.success-view.is-active,
.status-result.is-active {
  display: block;
  animation: fade-slide 260ms ease-out both;
}

.success-view {
  padding: 16px 0 8px;
  text-align: center;
}

.success-symbol {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--green-soft);
  animation: soft-pulse 1.8s ease-out 2;
}

.success-symbol span {
  width: 24px;
  height: 13px;
  border-bottom: 3px solid var(--green);
  border-left: 3px solid var(--green);
  transform: rotate(-45deg) translate(2px, -2px);
}

.success-view > p:not(.section-kicker) {
  max-width: 300px;
  margin: 10px auto 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.reservation-code {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: center;
  padding: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.reservation-code span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.reservation-code strong {
  font-size: 20px;
  letter-spacing: 0;
}

.reservation-code button,
.text-button {
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.success-summary,
.status-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 24px;
  padding: 20px 0;
  text-align: left;
}

.success-summary div,
.status-details div {
  min-width: 0;
  padding: 8px 14px;
  border-left: 1px solid var(--line);
}

.success-summary div:nth-child(odd),
.status-details div:nth-child(odd) {
  border-left: 0;
}

.success-summary dt,
.status-details dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.success-summary dd,
.status-details dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.success-view .button,
.status-result .button,
.lookup-form .button {
  width: 100%;
}

.text-button {
  margin-top: 18px;
}

.lookup-heading {
  margin-bottom: 22px;
}

.lookup-form {
  padding-bottom: 12px;
}

.status-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.status-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-badge.approved {
  color: var(--green-dark);
  background: var(--green-soft);
}

.status-badge.rejected {
  color: var(--red);
  background: var(--red-soft);
}

.status-timeline {
  margin: 2px 0 26px;
  padding: 0;
  list-style: none;
}

.status-timeline li {
  position: relative;
  min-height: 58px;
  padding: 0 0 20px 34px;
  color: var(--muted);
  font-size: 12px;
}

.status-timeline li::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 10px;
  height: 10px;
  border: 2px solid #aebbb7;
  border-radius: 50%;
  background: var(--canvas);
}

.status-timeline li::after {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 11px;
  width: 1px;
  background: #cfd9d5;
}

.status-timeline li:last-child::after {
  display: none;
}

.status-timeline li.is-complete::before {
  border-color: var(--green);
  background: var(--green);
}

.status-timeline strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.page-footer {
  width: min(100%, 520px);
  margin: 24px auto 0;
  padding: 0 20px calc(26px + env(safe-area-inset-bottom));
  color: #8b9794;
  font-size: 11px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 20;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 15px;
  border-radius: 5px;
  color: #fff;
  background: rgba(22, 40, 39, 0.92);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-slide {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes soft-pulse {
  0% { box-shadow: 0 0 0 0 rgba(10, 143, 104, 0.22); }
  100% { box-shadow: 0 0 0 18px rgba(10, 143, 104, 0); }
}

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

@media (min-width: 560px) {
  .app-shell {
    padding-top: 26px;
  }

  .view {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 360px) {
  .welcome {
    min-height: 128px;
    padding: 20px 18px;
  }

  .welcome h1 {
    font-size: 23px;
  }

  .welcome-mark {
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .segmented-control span {
    font-size: 12px;
  }
}

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