:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--tg-theme-text-color, #1c2738);
  background: var(--tg-theme-secondary-bg-color, #f4f6fa);
  --surface: var(--tg-theme-bg-color, #fff);
  --muted: var(--tg-theme-hint-color, #8590a3);
  --accent: var(--tg-theme-button-color, #4070ed);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --line: color-mix(in srgb, currentColor 9%, transparent);
  --soft: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --danger: var(--tg-theme-destructive-text-color, #d84b57);
  --safe-top: calc(
    max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) +
      var(--tg-content-safe-area-inset-top, 0px)
  );
  --safe-bottom: calc(
    max(
        env(safe-area-inset-bottom, 0px),
        var(--tg-safe-area-inset-bottom, 0px)
      ) +
      var(--tg-content-safe-area-inset-bottom, 0px)
  );
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button,
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 840px;
  margin: auto;
  padding: calc(14px + var(--safe-top)) 22px 14px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-size: 17px;
  font-weight: 750;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: -0.5px;
}
.mini-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 19px;
  letter-spacing: -2px;
}
.topbar > .icon-button:last-child {
  margin-left: auto;
}
.icon-button {
  border: 0;
  background: transparent;
  font-size: 25px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 12px;
  line-height: 1;
}
.icon-button:hover {
  background: var(--line);
}
main {
  max-width: 840px;
  margin: 0 auto;
  padding: 24px 22px calc(105px + var(--safe-bottom));
  min-height: 65vh;
}
.eyebrow {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  font-weight: 750;
  margin-bottom: 7px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.35;
  letter-spacing: -0.8px;
  margin-bottom: 9px;
  font-weight: 750;
}
h2 {
  font-size: 17px;
  line-height: 1.45;
  margin-bottom: 12px;
}
h3 {
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 5px;
}
.subtitle,
.muted {
  color: var(--muted);
}
.subtitle {
  margin-bottom: 24px;
  font-size: 13px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 12px;
}
.section-head h2 {
  margin: 0;
}
.section-head .text-button {
  white-space: nowrap;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 5px 0;
}
.hero {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 22px;
  padding: 25px;
  margin: 22px 0 20px;
  position: relative;
  overflow: hidden;
}
.hero:after {
  content: "↑";
  position: absolute;
  right: 12px;
  bottom: -43px;
  font-size: 190px;
  line-height: 1;
  font-weight: 250;
  opacity: 0.1;
  transform: rotate(20deg);
  pointer-events: none;
}
.hero .eyebrow {
  color: inherit;
  opacity: 0.65;
}
.hero h2 {
  font-size: 20px;
  margin-bottom: 22px;
}
.stats {
  display: flex;
  gap: 30px;
}
.stat strong {
  display: block;
  font-size: 29px;
  font-weight: 650;
  letter-spacing: -1px;
  line-height: 1.3;
}
.stat span {
  font-size: 11px;
  opacity: 0.7;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 17px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.quick svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 18px;
  margin-bottom: 12px;
  overflow: hidden;
}
.card.clickable {
  display: block;
  width: 100%;
  text-align: left;
}
.card.clickable:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.row.spread {
  justify-content: space-between;
}
.grow {
  min-width: 0;
  flex: 1;
}
.avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 650;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.small {
  font-size: 12px;
}
.tiny {
  font-size: 10px;
}
.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 7px;
  background: var(--soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.green {
  background: color-mix(in srgb, #1ca784 10%, var(--surface));
  color: #1ca784;
}
.badge.red {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.badge.amber {
  background: color-mix(in srgb, #b57b17 10%, var(--surface));
  color: #b57b17;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 15px 0;
}
.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  min-height: 46px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.button.secondary {
  background: var(--soft);
  color: var(--accent);
}
.button.danger {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.button.plain {
  background: transparent;
  color: var(--muted);
}
.button.full {
  width: 100%;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 17px;
}
.actions > * {
  flex: 1;
}
.empty {
  text-align: center;
  padding: 35px 18px;
}
.empty .empty-icon {
  font-size: 30px;
  margin-bottom: 12px;
  color: var(--accent);
}
.empty p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}
.empty h2 {
  margin-bottom: 8px;
}
label.field {
  display: block;
  margin: 0 0 19px;
}
label.field > span {
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 7px;
}
.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: var(--surface);
  color: inherit;
  outline: 0;
  font-size: 16px;
  min-height: 48px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.field textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.7;
}
.field .hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 400;
}
.field:last-child {
  margin-bottom: 0;
}
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  gap: 15px;
  cursor: pointer;
}
.switch-row input {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.note {
  background: var(--soft);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 12px;
  color: var(--muted);
  margin: 15px 0;
  line-height: 1.8;
}
.note.warning {
  border-left: 3px solid #cf9435;
}
.note.error {
  border-left: 3px solid var(--danger);
  color: var(--danger);
}
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 9px max(8px, calc((100vw - 800px) / 2))
    calc(9px + var(--safe-bottom));
  display: flex;
  z-index: 5;
}
.nav button {
  display: flex;
  flex: 1;
  align-items: center;
  flex-direction: column;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 2px;
  font-size: 10px;
  min-height: 48px;
}
.nav button svg {
  width: 21px;
  height: 21px;
}
.nav button.active {
  color: var(--accent);
}
.gate {
  max-width: 500px;
  padding: 20vh 26px 40px;
  text-align: center;
  margin: auto;
}
.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 25px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 24px;
  font-size: 51px;
  font-weight: 650;
  position: relative;
  line-height: 1;
}
.brand-mark span {
  position: absolute;
  right: 12px;
  top: 10px;
  font-size: 28px;
}
.gate .eyebrow {
  margin-bottom: 17px;
}
.gate h1 {
  font-size: 25px;
}
.gate p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  margin-top: 15px;
}
.spinner {
  width: 25px;
  height: 25px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 23px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(95px + var(--safe-bottom));
  background: #243044;
  color: white;
  border-radius: 12px;
  padding: 12px 20px;
  width: max-content;
  max-width: 90vw;
  font-size: 13px;
  box-shadow: 0 6px 25px #0002;
}
.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
}
.metadata {
  display: grid;
  grid-template-columns: 65px 1fr;
  gap: 9px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.metadata dt {
  color: var(--muted);
}
.metadata dd {
  margin: 0;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1ca784;
  margin-right: 5px;
}
.mail-item {
  text-align: left;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 16px 0;
  color: inherit;
}
.mail-item:last-child {
  border-bottom: 0;
}
.mail-item h3 {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.mail-item .row {
  margin-bottom: 6px;
}
.mail-item .arrow {
  font-size: 21px;
  color: var(--muted);
}
.progress {
  text-align: center;
  padding: 35px 16px;
}
.progress h2 {
  margin-top: 25px;
}
.progress p {
  font-size: 12px;
  color: var(--muted);
}
dialog {
  background: var(--surface);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 25px;
  width: calc(100% - 40px);
  max-width: 430px;
}
dialog::backdrop {
  background: #15203466;
}
dialog p {
  white-space: pre-line;
  color: var(--muted);
  font-size: 13px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.native-form .primary-submit {
  display: none;
}
.native-form .nav {
  display: none;
}
.native-form main {
  padding-bottom: 35px;
}
body.locked #shell {
  visibility: hidden;
}
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 10px;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chips span {
  font-size: 11px;
  background: var(--soft);
  border-radius: 7px;
  padding: 5px 9px;
  color: var(--accent);
}
details > summary {
  cursor: pointer;
  color: var(--accent);
  padding: 8px 0;
  font-size: 12px;
}
details[open] > summary {
  margin-bottom: 12px;
}
.error-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
svg {
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (min-width: 650px) {
  main {
    padding-top: 35px;
  }
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }
  .quick {
    padding: 22px 8px;
  }
  .hero {
    padding: 30px;
  }
  .stats {
    gap: 50px;
  }
  .form-card {
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
  }
  .gate {
    padding-top: 23vh;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.recipient-field {
  margin-bottom: 19px;
}
.recipient-field > .field {
  margin-bottom: 0;
}
.recipient-picker {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.recipient-caption {
  margin: 0;
  padding: 9px 12px;
  font-size: 11px;
  color: var(--muted);
  background: var(--soft);
}
#recipient-options {
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.recipient-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.recipient-option > span:first-child {
  overflow-wrap: anywhere;
}
.recipient-option:last-child {
  border-bottom: 0;
}
.recipient-option:hover,
.recipient-option[aria-selected="true"] {
  background: var(--soft);
  color: var(--accent);
}
.recipient-fill {
  color: var(--muted);
  flex-shrink: 0;
}
.recipient-message {
  padding: 12px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
