:root {
  color-scheme: light;
  --canvas: #f5f5f0;
  --paper: #ffffff;
  --paper-soft: #fafaf7;
  --ink: #17211b;
  --ink-soft: #314039;
  --muted: #718078;
  --muted-light: #98a39d;
  --line: #dfe5df;
  --line-strong: #cbd5cd;
  --green: #06c755;
  --green-deep: #079543;
  --green-wash: #eaf9f0;
  --green-ink: #07391d;
  --amber: #a86200;
  --amber-wash: #fff3dc;
  --danger: #b63131;
  --danger-wash: #fff0ef;
  --shadow: 0 18px 55px rgba(24, 47, 34, 0.08);
  --shadow-soft: 0 8px 24px rgba(24, 47, 34, 0.055);
  --radius-lg: 28px;
  --radius-md: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
  background:
    radial-gradient(circle at 8% 2%, rgba(6, 199, 85, 0.07), transparent 29rem),
    linear-gradient(180deg, #f9faf6 0, var(--canvas) 38rem);
  color: var(--ink);
}

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

.page-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 33, 27, 0.09);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 15px;
  font-weight: 850;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.07);
}

.brand-copy strong,
.brand-copy small { display: block; }
.brand-copy strong { font-size: 15px; letter-spacing: 0.035em; }
.brand-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.connection-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a5afa9;
  box-shadow: 0 0 0 4px #edf0ed;
}

.connection-pill.is-online { border-color: #bce8cd; background: #f3fcf6; color: var(--green-deep); }
.connection-pill.is-online .status-dot { background: var(--green); box-shadow: 0 0 0 4px #dff7e8; }
.connection-pill.is-warning { border-color: #efd6a8; background: #fff9ed; color: var(--amber); }
.connection-pill.is-warning .status-dot { background: #e59a26; box-shadow: 0 0 0 4px #ffefd2; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(350px, 0.8fr);
  gap: clamp(46px, 8vw, 116px);
  align-items: center;
  padding: 78px 0 66px;
}

.intro-copy { padding-left: clamp(0px, 2.5vw, 32px); }

.eyebrow,
.section-label,
.card-kicker {
  margin: 0;
  color: var(--green-deep);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}

.eyebrow > span {
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 700px;
  margin-bottom: 24px;
  font-size: clamp(48px, 6vw, 74px);
  font-weight: 820;
  letter-spacing: -0.065em;
  line-height: 1.06;
}

.lead {
  max-width: 620px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

.assurance-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}

.assurance-list li { display: inline-flex; align-items: center; gap: 6px; }
.assurance-list li span { color: var(--green-deep); font-weight: 900; }

.account-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.account-card::before {
  position: absolute;
  top: -76px;
  right: -64px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--green-wash);
  content: "";
}

.card-topline {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.secure-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}
.secure-tag span { color: var(--green); font-size: 7px; }

.account-identity {
  position: relative;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.account-symbol {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  background: var(--green);
}
.account-symbol svg { width: 28px; fill: white; }

.account-identity small,
.account-identity strong { display: block; }
.account-identity small { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.account-identity strong { overflow: hidden; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }

.account-note {
  position: relative;
  min-height: 42px;
  margin: 20px 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.account-actions { position: relative; display: flex; gap: 10px; }

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 760;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.button-primary { background: var(--green); color: #032f15; box-shadow: 0 8px 18px rgba(6, 199, 85, 0.2); }
.button-primary:hover:not(:disabled) { background: #12d761; box-shadow: 0 10px 22px rgba(6, 199, 85, 0.26); }
.button-secondary { border-color: var(--line); background: white; color: var(--ink-soft); box-shadow: 0 3px 10px rgba(24, 47, 34, 0.035); }
.button-secondary:hover:not(:disabled) { border-color: var(--line-strong); background: var(--paper-soft); }

.brand:focus-visible,
.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.tab:focus-visible,
.time-preset:focus-visible,
.recipient-row:focus-visible,
.dialog-close:focus-visible,
.cancel-button:focus-visible {
  outline: 3px solid rgba(6, 199, 85, 0.28);
  outline-offset: 3px;
}

.journey {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  list-style: none;
}

.journey-step {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  color: var(--muted);
}
.journey-step + .journey-step { border-left: 1px solid var(--line); }

.journey-number {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.journey-step small,
.journey-step strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journey-step small { margin-bottom: 3px; font-size: 9px; letter-spacing: 0.05em; }
.journey-step strong { color: var(--ink-soft); font-size: 12px; }
.journey-step.is-current { background: var(--green-wash); color: var(--green-deep); }
.journey-step.is-current .journey-number { border-color: var(--green); background: var(--green); color: var(--green-ink); }
.journey-step.is-complete .journey-number { border-color: #b8dfc7; background: #f0fbf4; color: var(--green-deep); font-size: 0; }
.journey-step.is-complete .journey-number::before { content: "✓"; font-size: 12px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(390px, 1.06fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.panel-heading { margin-bottom: 24px; }
.panel-heading h2,
.section-heading h2 { margin: 7px 0 5px; font-size: 22px; letter-spacing: -0.035em; }
.panel-heading p:not(.section-label),
.section-heading p:not(.section-label) { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.count-label { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; background: var(--paper-soft); color: var(--muted); font-size: 11px; font-weight: 750; }

.search-field {
  display: flex;
  height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-field:focus-within { border-color: #8bd7a9; box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.09); }
.search-field svg { width: 18px; fill: none; stroke: var(--muted); stroke-linecap: round; stroke-width: 1.8; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-field input::placeholder,
textarea::placeholder { color: var(--muted-light); }

.tabs { display: flex; gap: 6px; margin: 14px 0 10px; }
.tab,
.time-preset {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 730;
}
.tab { padding: 0 14px; }
.tab:hover { color: var(--ink); }
.tab.is-active { border-color: #c6ead3; background: var(--green-wash); color: var(--green-deep); }

.recipient-list {
  min-height: 358px;
  max-height: 500px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: #ccd7cf transparent;
}

.recipient-row {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.recipient-row:hover { background: var(--paper-soft); }
.recipient-row.is-selected { border-color: #bde7cd; background: var(--green-wash); }
.recipient-row strong,
.recipient-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipient-row strong { margin-bottom: 4px; color: var(--ink); font-size: 13px; }
.recipient-row small,
.recipient-kind { color: var(--muted); font-size: 10px; }

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #e1f6e9;
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 850;
}
.avatar.is-group { border-radius: 17px; background: #eaf0e9; color: #476052; }
.avatar-placeholder { border: 1px dashed var(--line-strong); background: var(--paper-soft); color: var(--muted); }

.empty-state {
  display: grid;
  min-height: 290px;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.empty-state.compact { min-height: 145px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.44); }
.empty-state strong { color: var(--ink-soft); font-size: 13px; }
.empty-state p { max-width: 280px; margin: 7px 0 0; font-size: 11px; line-height: 1.65; }
.empty-illustration { display: grid; width: 62px; height: 62px; margin-bottom: 18px; place-items: center; border-radius: 20px; background: var(--green-wash); }
.empty-illustration svg { width: 34px; fill: none; stroke: var(--green-deep); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.selected-recipient {
  display: grid;
  min-height: 70px;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid #bde7cd;
  border-radius: 15px;
  background: var(--green-wash);
}
.selected-recipient.is-empty { border-color: var(--line); background: var(--paper-soft); }
.selected-recipient strong,
.selected-recipient small { display: block; }
.selected-recipient small { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.selected-recipient strong { font-size: 13px; }

.field { display: block; margin-bottom: 18px; }
.field > span,
.time-fieldset legend { display: block; margin-bottom: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 780; }
.field textarea,
.date-field input {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  background: var(--paper-soft);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field textarea { min-height: 142px; padding: 14px; resize: vertical; line-height: 1.65; }
.field textarea:focus,
.date-field input:focus { border-color: #8bd7a9; box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.09); }
.field > small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; text-align: right; }

.time-fieldset { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.time-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.time-preset { padding: 0 12px; border-color: var(--line); background: white; }
.time-preset:hover { border-color: #a8dab9; color: var(--green-deep); }
.time-preset.is-active { border-color: #9bd8b2; background: var(--green-wash); color: var(--green-deep); }
.date-field input { min-height: 46px; padding: 0 13px; color-scheme: light; }
.time-fieldset > small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; text-align: right; }

.form-notice { margin: 0 0 13px; padding: 11px 13px; border-radius: 11px; background: var(--green-wash); color: var(--green-deep); font-size: 11px; line-height: 1.5; }
.form-notice.is-error { background: var(--danger-wash); color: var(--danger); }

.button-large {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px;
}
.button-arrow { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.28); font-size: 16px; }
.submit-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }
.submit-note span { margin-right: 4px; color: var(--green-deep); }

.schedule-section { padding: 72px 0 0; }
.section-heading { margin-bottom: 20px; }
.section-heading .button { flex: 0 0 auto; }
.schedule-list { display: grid; gap: 9px; }
.schedule-row {
  display: grid;
  grid-template-columns: 150px minmax(130px, 0.6fr) minmax(240px, 1.4fr) auto;
  gap: 18px;
  align-items: center;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 5px 15px rgba(24, 47, 34, 0.03);
}
.schedule-time strong,
.schedule-time small,
.schedule-recipient strong,
.schedule-recipient small { display: block; }
.schedule-time strong { margin-bottom: 3px; font-size: 12px; }
.schedule-time small,
.schedule-recipient small { color: var(--muted); font-size: 10px; }
.schedule-recipient strong { margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.schedule-message { margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.schedule-end { display: flex; align-items: center; gap: 8px; }
.status-badge { padding: 6px 9px; border-radius: 999px; background: #f0f2f0; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-badge.is-sent { background: var(--green-wash); color: var(--green-deep); }
.status-badge.is-failed,
.status-badge.is-unknown { background: var(--danger-wash); color: var(--danger); }
.cancel-button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.cancel-button:hover { color: var(--ink); }

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 64px;
  padding: 24px 0 34px;
  border-top: 1px solid rgba(23, 33, 27, 0.09);
  color: var(--muted);
  font-size: 10px;
}
.footer span:first-child { color: var(--ink-soft); font-weight: 800; }

.connect-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(24, 47, 34, 0.22);
  text-align: center;
}
.connect-dialog::backdrop { background: rgba(19, 29, 23, 0.56); backdrop-filter: blur(7px); }
.connect-dialog h2 { margin: 8px 0; font-size: 26px; letter-spacing: -0.035em; }
.dialog-copy { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.dialog-close { position: absolute; top: 9px; right: 10px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 26px; }
.qr-code { display: grid; width: 260px; min-height: 260px; margin: 0 auto 17px; place-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.qr-code svg { display: block; width: 100%; height: auto; }
.spinner { width: 30px; height: 30px; border: 3px solid #dce4de; border-top-color: var(--green); border-radius: 50%; animation: spin 700ms linear infinite; }
.pin-panel { margin: 15px 0; padding: 14px; border-radius: 14px; background: var(--amber-wash); color: var(--amber); }
.pin-panel span,
.pin-panel strong { display: block; }
.pin-panel span { margin-bottom: 5px; font-size: 10px; }
.pin-panel strong { font-size: 28px; letter-spacing: 0.18em; }
.privacy-note { margin: 20px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.privacy-note span { margin-right: 5px; color: var(--green-deep); }

.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 spin { to { transform: rotate(360deg); } }

@media (max-width: 880px) {
  .page-shell { width: min(100% - 32px, 680px); }
  .intro { grid-template-columns: 1fr; gap: 38px; padding: 58px 0 48px; }
  .intro-copy { padding-left: 0; }
  .account-card { max-width: 560px; }
  .workspace { grid-template-columns: 1fr; }
  .recipient-list { max-height: 400px; }
  .schedule-row { grid-template-columns: 125px 1fr auto; }
  .schedule-message { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 600px) {
  .page-shell { width: min(100% - 22px, 520px); }
  .topbar { min-height: 72px; }
  .brand-copy small { display: none; }
  .connection-pill { min-height: 36px; padding: 0 10px; }
  .intro { gap: 30px; padding: 42px 0 38px; }
  h1 { margin-bottom: 20px; font-size: clamp(41px, 12vw, 54px); }
  .lead { font-size: 14px; line-height: 1.75; }
  .assurance-list { display: grid; gap: 8px; }
  .account-card { padding: 23px; border-radius: 22px; }
  .account-actions { flex-direction: column; }
  .account-actions .button { width: 100%; }
  .journey { grid-template-columns: 1fr; }
  .journey-step { min-height: 62px; padding: 13px 16px; }
  .journey-step + .journey-step { border-top: 1px solid var(--line); border-left: 0; }
  .panel { padding: 24px 18px; border-radius: 22px; }
  .panel-heading { margin-bottom: 21px; }
  .panel-heading h2,
  .section-heading h2 { font-size: 20px; }
  .recipient-list { min-height: 310px; }
  .empty-state { min-height: 260px; padding: 22px 12px; }
  .field textarea { min-height: 132px; }
  .time-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .time-preset { min-width: 0; padding: 0 5px; font-size: 10px; }
  .schedule-section { padding-top: 54px; }
  .schedule-row { grid-template-columns: 1fr auto; gap: 12px; }
  .schedule-recipient { grid-column: 1; grid-row: 2; }
  .schedule-message { grid-column: 1 / -1; grid-row: 3; white-space: normal; }
  .schedule-end { grid-column: 2; grid-row: 1 / 3; align-self: start; flex-direction: column; align-items: end; }
  .connect-dialog { padding: 30px 20px; }
  .qr-code { width: min(260px, 100%); min-height: 220px; }
}

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