:root {
  color-scheme: light;
  --bg: #f5f8f5;
  --surface: #ffffff;
  --surface-soft: #eef7f0;
  --surface-muted: #f7faf7;
  --text: #10231a;
  --text-muted: #60716a;
  --text-soft: #7c8b84;
  --line: #dce7df;
  --line-strong: #c5d8cb;
  --primary: #167a45;
  --primary-strong: #0f6337;
  --primary-soft: #dff3e8;
  --primary-tint: #f0faf4;
  --accent: #2f6f8f;
  --success: #15834f;
  --success-bg: #e4f7ed;
  --warning: #a86600;
  --warning-bg: #fff4d8;
  --danger: #b42332;
  --danger-bg: #fde8ea;
  --info: #276a9f;
  --info-bg: #e6f2fb;
  --neutral: #697971;
  --neutral-bg: #edf2ef;
  --shadow-sm: 0 8px 22px rgba(16, 35, 26, 0.07);
  --shadow-md: 0 18px 42px rgba(16, 35, 26, 0.11);
  --radius-md: 16px;
  --radius-lg: 22px;
  --tap: 48px;
  --app-width: 430px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #f8fbf8 0%, var(--bg) 46%, #eef5f1 100%);
  color: var(--text);
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(100%, var(--app-width));
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(16, 35, 26, 0.04);
}

.app-main {
  display: grid;
  gap: 16px;
  padding: 14px 14px 96px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 14px;
  background: rgba(245, 248, 245, 0.88);
  border-bottom: 1px solid rgba(220, 231, 223, 0.82);
  backdrop-filter: blur(18px);
}

.header-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.header-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.16;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-subtitle {
  margin: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: var(--tap);
  height: var(--tap);
  place-items: center;
  flex: 0 0 auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: min(100%, var(--app-width));
  margin: 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.93);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.bottom-nav-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bottom-nav-link {
  display: grid;
  min-height: 54px;
  place-items: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--text-soft);
  border-radius: 14px;
  font-size: 10px;
  font-weight: 680;
  line-height: 1.1;
}

.bottom-nav-link.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.card,
.bento-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(220, 231, 223, 0.94);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.bento-card {
  padding: 16px;
}

.card-section {
  padding: 16px;
}

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

.section-title {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
  line-height: 1.2;
}

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

.hero-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    background: linear-gradient(145deg, rgba(240, 250, 244, 0.95), rgba(255, 255, 255, 0.98) 54%),
    var(--surface);
}

.hero-card__content {
    display: grid;
    gap: 10px;
}

.hero-title {
    margin: 0;
    color: var(--text);
    font-size: 24px;
    font-weight: 820;
    line-height: 1.08;
}

.hero-clarity {
    margin: 0;
    padding: 10px 12px;
    color: #235742;
    background: rgba(223, 243, 232, 0.72);
    border: 1px solid #ccead8;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
}

.landing-section .section-title {
    margin-bottom: 8px;
}

.value-list,
.important-list {
    display: grid;
    gap: 10px;
}

.value-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
}

.value-marker {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid #c6e7d4;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 780;
}

.value-title {
    margin: 0 0 3px;
    color: var(--text);
    font-size: 14px;
    font-weight: 780;
    line-height: 1.25;
}

.value-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.38;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.section-heading .section-title {
    margin-bottom: 4px;
}

.pool-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 13px;
  padding: 12px;
}

.pool-card-body {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.pool-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 760;
  line-height: 1.23;
}

.pool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.25;
}

.product-thumb {
  position: relative;
  overflow: hidden;
  width: 92px;
  aspect-ratio: 1;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--primary);
  background: linear-gradient(145deg, var(--primary-tint), #e7f1ed);
  font-size: 12px;
  font-weight: 720;
  text-align: center;
}

.progress {
  display: grid;
  gap: 7px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.progress-track {
  overflow: hidden;
  height: 9px;
  background: #e7eee9;
  border-radius: 999px;
}

.progress-fill {
  width: var(--progress, 0%);
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #39a86c);
  border-radius: inherit;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  width: max-content;
  max-width: 100%;
  padding: 5px 9px;
  color: var(--neutral);
  background: var(--neutral-bg);
  border: 1px solid rgba(105, 121, 113, 0.14);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.15;
}

.badge--active,
.badge--completed {
  color: var(--success);
  background: var(--success-bg);
}

.badge--funded,
.badge--purchased,
.badge--purchase-in-progress {
  color: var(--info);
  background: var(--info-bg);
}

.badge--expired,
.badge--cancelled,
.badge--failed {
  color: var(--danger);
  background: var(--danger-bg);
}

.amount-summary {
  display: grid;
  gap: 10px;
}

.amount-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.28;
}

.amount-value {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 760;
}

.amount-row--total {
  margin-top: 2px;
  padding-top: 12px;
  color: var(--text);
  border-top: 1px solid var(--line);
  font-size: 16px;
  font-weight: 760;
}

.notice,
.warning-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.42;
}

.notice {
  color: #235742;
  background: var(--primary-tint);
  border: 1px solid #ccead8;
}

.notice--info {
  color: var(--info);
  background: var(--info-bg);
  border-color: #c8e3f7;
}

.warning-box,
.notice--warning {
  color: #714600;
  background: var(--warning-bg);
  border: 1px solid #f0d692;
}

.notice--danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #f5c9cf;
}

.notice-title {
  margin: 0;
  font-size: 14px;
  font-weight: 780;
  line-height: 1.25;
}

.notice-text {
  margin: 0;
}

.create-page {
    gap: 14px;
}

.create-hero {
    display: grid;
    gap: 12px;
}

.create-hero__content {
    display: grid;
    gap: 10px;
}

.form,
.create-form {
    display: grid;
    gap: 16px;
}

.field,
.create-page .field {
    display: grid;
    gap: 7px;
}

.field-label,
.create-page .field-label {
    color: var(--text);
    font-size: 14px;
    font-weight: 760;
    line-height: 1.25;
}

.field-hint,
.create-page .field-hint {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.38;
}

.input,
.textarea,
.create-page .input,
.create-page .textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 13px;
    color: var(--text);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.textarea,
.create-page .textarea {
    min-height: 128px;
    resize: vertical;
}

.input::placeholder,
.textarea::placeholder,
.create-page .input::placeholder,
.create-page .textarea::placeholder {
    color: var(--text-soft);
}

.input:focus,
.textarea:focus,
.create-page .input:focus,
.create-page .textarea:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 122, 69, 0.14);
}

.input:invalid:not(:placeholder-shown),
.create-page .input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

.create-page .button {
    margin-top: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  width: 100%;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 780;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.button:disabled,
.button.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button--primary {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 12px 22px rgba(22, 122, 69, 0.2);
}

.button--secondary {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c6e7d4;
}

.button--ghost {
    color: var(--text-muted);
    background: var(--surface);
    border-color: var(--line);
}

.button-row,
.stack {
  display: grid;
  gap: 10px;
}

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

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.timeline-step {
    position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
}

.timeline--connected {
    gap: 0;
}

.timeline--connected .timeline-step {
    padding-bottom: 18px;
}

.timeline--connected .timeline-step::before {
    content: "";
    position: absolute;
    top: 28px;
    bottom: 0;
    left: 13px;
    width: 2px;
    background: var(--line);
}

.timeline--connected .timeline-step:last-child {
    padding-bottom: 0;
}

.timeline--connected .timeline-step:last-child::before {
    display: none;
}

.timeline-dot {
    position: relative;
    z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--text-soft);
  background: var(--neutral-bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
}

.timeline-step.is-current .timeline-dot,
.timeline-step.is-done .timeline-dot {
  color: #ffffff;
  background: var(--primary);
}

.timeline-title {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.timeline-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.38;
}

.final-cta {
    display: grid;
    gap: 14px;
    background: linear-gradient(145deg, var(--surface), var(--primary-tint)),
    var(--surface);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 220px;
  padding: 28px 18px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-title {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 760;
}

.empty-state-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.receipt {
    display: grid;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid rgba(220, 231, 223, 0.94);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.receipt-title {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 16px;
    font-weight: 760;
    line-height: 1.25;
}

.receipt-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.payment-summary {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.contribution-fee-toggle .split {
    align-items: center;
}

.contribution-fee-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    accent-color: var(--brand);
}

.contribution-live-summary {
    padding: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.quick-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-amounts__button {
    gap: 6px;
    width: auto;
    min-height: 36px;
    padding: 8px 11px;
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #c6e7d4;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 760;
    line-height: 1.2;
    box-shadow: none;
}

.quick-amounts__button strong {
    color: var(--text);
    font: inherit;
    font-weight: 820;
    white-space: nowrap;
}

.quick-amounts__button:disabled {
    display: none;
}

@media (max-width: 420px) {
    .quick-amounts__button {
        flex: 1 1 100%;
    }
}

#contribution-preview.is-stale .receipt {
    opacity: 0.62;
}

#contribution-preview.is-stale::before {
    content: "Расчет устарел. Дождитесь обновления.";
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.text-soft {
  color: var(--text-soft);
}

.text-muted {
    color: var(--text-muted);
}

.badge--paid {
    color: var(--success);
    background: var(--success-bg);
}

.badge--pending,
.badge--created,
.badge--waiting-for-payment,
.badge--review-required,
.badge--noop {
    color: var(--info);
    background: var(--info-bg);
}

.badge--refund-pending,
.badge--refunded,
.badge--refund-failed {
    color: var(--warning);
    background: var(--warning-bg);
}

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

@media (min-width: 720px) {
  :root {
    --app-width: 680px;
  }

  .pool-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .product-thumb {
    width: 112px;
  }
}
