:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #f4f6f2);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --surface-strong: #ffffff;
  --text: var(--tg-theme-text-color, #171b18);
  --muted: var(--tg-theme-hint-color, #6f7771);
  --line: rgba(23, 27, 24, 0.11);
  --accent: var(--tg-theme-button-color, #218a59);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --green: #218a59;
  --green-soft: #dff3e7;
  --coral: #d95d45;
  --coral-soft: #fae6e1;
  --yellow: #b98017;
  --yellow-soft: #fbf0d2;
  --shadow: 0 8px 24px rgba(23, 27, 24, 0.08);
  --nav-height: 70px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 280px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 18px);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
}

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

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle:active {
  transform: scale(0.96);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-mark,
.loading-mark,
.access-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: #fff;
  background: #171b18;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 16px;
}

.brand-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.connection-pill,
.plan-badge,
.metric {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
}

.connection-pill.connected .status-dot {
  background: var(--green);
}

.connection-pill.disconnected .status-dot {
  background: var(--coral);
}

.main-content {
  padding: 24px 18px 12px;
}

.view[hidden] {
  display: none;
}

.view.active {
  animation: view-in 180ms ease-out;
}

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

.profile-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 4px 0 22px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--surface-strong);
  border-radius: 50%;
  color: #fff;
  background-color: var(--coral);
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 0 1px var(--line);
  font-size: 22px;
  font-weight: 800;
}

.profile-copy,
.page-heading,
.section-heading div,
.status-item div {
  min-width: 0;
}

.profile-copy h1,
.page-heading h1,
.section-heading h2,
.command-dialog h2 {
  margin: 0;
  line-height: 1.15;
}

.profile-copy h1 {
  overflow-wrap: anywhere;
  font-size: 24px;
}

.profile-copy > p:last-child {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-heading > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.plan-badge {
  border-color: color-mix(in srgb, var(--green) 22%, transparent);
  color: var(--green);
  background: var(--green-soft);
}

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

.status-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-icon,
.module-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}

.status-icon.green,
.module-icon.green {
  color: var(--green);
  background: var(--green-soft);
}

.status-icon.coral,
.module-icon.coral {
  color: var(--coral);
  background: var(--coral-soft);
}

.module-icon.yellow {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.module-icon.neutral {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 9%, transparent);
}

.status-item span:not(.status-icon) {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.status-item strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  font-size: 14px;
}

.dashboard-section,
.settings-section {
  margin-top: 28px;
}

.referral-hero {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  min-height: 88px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.referral-hero h2,
.referral-hero p {
  margin: 0;
}

.referral-hero h2 {
  font-size: 19px;
}

.referral-hero div > p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.referral-hero > strong {
  align-self: start;
  color: var(--green);
  font-size: 14px;
  white-space: nowrap;
}

.level-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  color: #fff;
  background: #171b18;
  font-size: 24px;
  font-weight: 850;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 240ms ease;
}

.section-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pricing-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 22px;
  font-weight: 850;
}

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

.pricing-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(23, 27, 24, 0.04);
}

.pro-pricing-card {
  padding-top: 42px;
  border-color: color-mix(in srgb, var(--coral) 42%, var(--line));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--coral) 12%, transparent);
}

.pricing-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  padding: 6px 10px;
  border-radius: 0 7px 0 7px;
  color: var(--coral);
  background: var(--coral-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.pricing-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pricing-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.pricing-mark.neutral {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 9%, transparent);
}

.pricing-mark.coral {
  color: var(--coral);
  background: var(--coral-soft);
}

.pricing-description {
  min-height: 48px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pricing-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 18px;
}

.pricing-value strong {
  font-size: 24px;
  line-height: 1;
}

.pricing-value span {
  color: var(--muted);
  font-size: 11px;
}

.pricing-features {
  display: grid;
  gap: 9px;
  margin: 20px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  list-style: none;
}

.pricing-features li::before {
  margin-right: 7px;
  color: var(--green);
  content: "✓";
  font-weight: 800;
}

.pricing-button {
  margin-top: 20px;
}

.pricing-highlight {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--coral) 22%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--coral-soft) 46%, var(--surface));
}

.pricing-highlight-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: var(--coral);
  background: var(--coral-soft);
  font-size: 14px;
  font-weight: 850;
}

.pricing-highlight p,
.pricing-highlight strong,
.pricing-highlight span {
  display: block;
  margin: 0;
}

.pricing-highlight strong {
  font-size: 12px;
}

.pricing-highlight span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.duration-picker {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}

.duration-picker-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.duration-picker-heading label {
  font-size: 12px;
  font-weight: 800;
}

.duration-picker-heading span {
  color: var(--muted);
  font-size: 10px;
}

.duration-stepper {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 7px;
  align-items: center;
  margin-top: 10px;
}

.stepper-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.stepper-button:hover,
.stepper-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

#pro-months {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

#pro-months:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 1px;
}

.duration-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
}

.duration-total strong {
  font-size: 18px;
}

.duration-total span {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.pricing-options {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.period-option {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.period-option:hover,
.period-option:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  outline: none;
}

.period-option:active {
  transform: translateY(1px);
}

.period-option > span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.period-option strong,
.period-option small {
  overflow-wrap: anywhere;
}

.period-option strong {
  font-size: 12px;
}

.period-option small {
  color: var(--muted);
  font-size: 10px;
}

.period-action {
  flex: 0 0 auto;
  color: var(--coral);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.period-action span {
  font-size: 17px;
  line-height: 0;
  vertical-align: -2px;
}

.featured-period {
  border-color: color-mix(in srgb, var(--coral) 38%, var(--line));
  background: color-mix(in srgb, var(--coral-soft) 42%, var(--surface));
}

.pricing-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.pricing-assurance {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 75%, var(--bg));
}

.assurance-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 850;
}

.pricing-assurance p,
.pricing-assurance strong,
.pricing-assurance span {
  display: block;
  margin: 0;
}

.pricing-assurance strong {
  font-size: 12px;
}

.pricing-assurance span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.program-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
}

.program-row + .program-row {
  border-top: 1px solid var(--line);
}

.program-row > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 800;
}

.program-row p,
.program-row strong,
.program-row small {
  display: block;
  margin: 0;
}

.program-row strong {
  font-size: 14px;
}

.program-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

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

.page-heading h1 {
  font-size: 28px;
}

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

.section-heading.compact {
  align-items: center;
}

.section-heading h2,
.command-dialog h2 {
  font-size: 19px;
}

.text-action {
  padding: 8px 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.module-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.module-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
}

.module-row + .module-row {
  border-top: 1px solid var(--line);
}

.module-copy strong,
.module-copy span {
  display: block;
}

.module-copy strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.module-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 23%, transparent);
  transition: background 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.switch input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}

.switch input:disabled + span {
  opacity: 0.5;
}

.metric strong {
  color: var(--text);
}

.copy-field,
.command-example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 4px 5px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.copy-field > span,
.command-example code {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
  font-size: 20px;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  color: var(--accent-text);
  background: var(--accent);
}

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.plan-select {
  min-width: 76px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}

.plan-select.selected {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.plan-select:disabled {
  cursor: default;
  opacity: 0.62;
}

.full-width {
  width: 100%;
  margin-top: 18px;
}

.auto-reply-editor textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: var(--surface);
  line-height: 1.45;
}

.auto-reply-editor textarea:focus,
.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
}

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

.search-field {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-field > span:first-child {
  color: var(--muted);
  font-size: 24px;
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-field input::placeholder {
  color: var(--muted);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  margin: 12px 0 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented-control button {
  min-width: 0;
  min-height: 34px;
  padding: 0 5px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.segmented-control button.active {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}

.command-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.command-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.command-row + .command-row {
  border-top: 1px solid var(--line);
}

.command-row code {
  overflow: hidden;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-row strong,
.command-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-row strong {
  font-size: 13px;
}

.command-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.command-row > span:last-child {
  color: var(--muted);
  font-size: 22px;
  text-align: right;
}

.empty-state {
  padding: 36px 0;
  color: var(--muted);
  text-align: center;
}

.guide-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.steps-list {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.steps-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.steps-list li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: #171b18;
  font-size: 12px;
  font-weight: 800;
}

.steps-list p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.legal-links a {
  color: var(--muted);
}

.faq-section {
  margin-top: 28px;
}

.faq-section details {
  border-top: 1px solid var(--line);
}

.faq-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  padding: 15px 2px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.faq-section details p {
  margin: -3px 2px 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 720px);
  min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}

.agreement-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 18px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.agreement-guide code {
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-weight: 800;
}

.agreement-guide p,
.agreement-row p {
  margin: 0;
}

.agreement-guide p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.agreement-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.agreement-row {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.agreement-row-top,
.agreement-meta,
.agreement-actions {
  display: flex;
  align-items: center;
}

.agreement-row-top {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.agreement-row > p {
  font-size: 14px;
  line-height: 1.45;
}

.agreement-status {
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 10px;
  font-weight: 800;
}

.agreement-status.done {
  color: var(--muted);
}

.agreement-status.cancelled,
.agreement-warning {
  color: var(--coral, #cf5c4f);
}

.agreement-meta {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.agreement-meta span {
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
}

.agreement-warning {
  margin-top: 9px !important;
  font-size: 11px !important;
  font-weight: 700;
}

.agreement-actions {
  gap: 8px;
  margin-top: 13px;
}

.agreement-actions button {
  flex: 1;
  min-height: 38px;
  padding: 8px 10px;
}

@media (max-width: 380px) {
  .agreement-guide {
    grid-template-columns: 1fr;
  }
}

.bottom-nav button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.bottom-nav button > span {
  height: 25px;
  font-size: 22px;
  line-height: 25px;
}

.bottom-nav button small {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav button.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.bottom-nav button:focus-visible,
.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.loading-screen,
.access-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text);
  background: var(--bg);
  text-align: center;
}

.loading-screen.hidden {
  display: none;
}

.loading-mark,
.access-icon {
  width: 54px;
  height: 54px;
  font-size: 24px;
}

.loading-screen p,
.access-screen p {
  margin: 0;
  color: var(--muted);
}

.loading-screen .loading-mark {
  animation: pulse 900ms ease-in-out infinite alternate;
}

@keyframes pulse {
  to { transform: scale(1.06); opacity: 0.72; }
}

.access-screen h1 {
  margin: 6px 0 0;
  font-size: 24px;
}

.access-screen .primary-button {
  margin-top: 10px;
}

.command-dialog {
  width: min(calc(100% - 32px), 520px);
  margin: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.command-dialog::backdrop {
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(3px);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.command-dialog h2 {
  padding-right: 40px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 23px;
}

.command-dialog > p:not(.eyebrow) {
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.command-example {
  margin-top: 16px;
  background: var(--bg);
}

.command-example code {
  color: var(--text);
}

.plan-dialog {
  max-width: 420px;
}

.plan-benefits {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

.plan-price {
  display: block;
  margin-top: 18px;
  font-size: 18px;
}

.pro-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 16px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 14px);
  left: 16px;
  max-width: 460px;
  min-height: 44px;
  margin: auto;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  .main-content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-copy span,
  .connection-pill #connection-label {
    display: none;
  }

  .connection-pill {
    min-width: 30px;
    padding: 0 10px;
  }

  .profile-heading {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .avatar {
    width: 50px;
    height: 50px;
  }

  .profile-copy h1 {
    font-size: 21px;
  }

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

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

  .referral-hero {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .level-mark {
    width: 46px;
    height: 46px;
  }

  .referral-hero > strong {
    grid-column: 2;
    margin-top: -8px;
  }

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

  .command-row {
    grid-template-columns: 70px minmax(0, 1fr) 22px;
  }
}

@media (max-width: 720px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --surface-strong: #1b1f1c;
    --line: rgba(255, 255, 255, 0.11);
    --green-soft: #173b29;
    --coral-soft: #43251f;
    --yellow-soft: #40351d;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  }

  .brand-mark,
  .steps-list li > span {
    color: #171b18;
    background: #f3f5f1;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #171b18;
  --muted: #6f7771;
  --line: rgba(23, 27, 24, 0.11);
  --accent: #218a59;
  --accent-text: #ffffff;
  --green: #218a59;
  --green-soft: #dff3e7;
  --coral: #d95d45;
  --coral-soft: #fae6e1;
  --yellow: #b98017;
  --yellow-soft: #fbf0d2;
  --shadow: 0 8px 24px rgba(23, 27, 24, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101211;
  --surface: #171a18;
  --surface-strong: #252a26;
  --text: #eef3ee;
  --muted: #9aa59e;
  --line: rgba(238, 243, 238, 0.12);
  --accent: #7fc89f;
  --accent-text: #101612;
  --green: #7fc89f;
  --green-soft: rgba(127, 200, 159, 0.16);
  --coral: #ed8772;
  --coral-soft: rgba(237, 135, 114, 0.16);
  --yellow: #d8b46e;
  --yellow-soft: rgba(216, 180, 110, 0.16);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .steps-list li > span {
  color: #171b18;
  background: #f3f5f1;
}
