:root {
  --bg: #f4f7fb;
  --text: #111625;
  --muted: #5f6983;
  --card: rgba(255, 255, 255, 0.88);
  --border: rgba(17, 22, 37, 0.08);
  --primary: #0f9d8f;
  --primary-strong: #0a7f74;
  --accent: #ff7f3f;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 20px 40px rgba(17, 22, 37, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: Manrope, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 157, 143, 0.2), transparent 35%),
    radial-gradient(circle at 92% 82%, rgba(255, 127, 63, 0.2), transparent 30%),
    linear-gradient(145deg, #f7fbff 0%, #eef4fb 100%);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.6;
  pointer-events: none;
}

.orb-1 {
  width: 230px;
  height: 230px;
  top: -60px;
  right: -50px;
  background: rgba(15, 157, 143, 0.35);
}

.orb-2 {
  width: 260px;
  height: 260px;
  bottom: -80px;
  left: -70px;
  background: rgba(255, 127, 63, 0.3);
}

.container {
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: calc(50px + env(safe-area-inset-top, 0px)) 12px 12px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.card {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: fadeSlide 0.45s ease both;
}

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

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-strong);
  font-weight: 800;
  text-align: center;
}

.hero h1 {
  margin: 8px 0;
  font-family: Unbounded, sans-serif;
  font-size: 24px;
  line-height: 1.25;
}

.hero {
  text-align: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.status-main {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
}

.status-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.purchase-card {
  grid-column: 1 / span 8;
}

.history-card {
  grid-column: 9 / span 4;
  align-self: start;
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.plan {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: white;
  cursor: pointer;
  transition: 0.2s ease;
}

.plan:hover {
  border-color: rgba(15, 157, 143, 0.5);
  transform: translateY(-1px);
}

.plan.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: rgba(15, 157, 143, 0.06);
}

.plan .title {
  font-weight: 800;
}

.plan .price {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  outline: none;
  margin-bottom: 10px;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 157, 143, 0.12);
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 14px;
  cursor: pointer;
}

.btn + .btn {
  margin-top: 8px;
}

.btn-primary {
  color: white;
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-strong) 100%);
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.btn-ghost:hover {
  border-color: rgba(15, 157, 143, 0.5);
}

.btn-small {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
  background: #fff;
}

.error {
  margin: 10px 0 0;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}

.success {
  margin: 10px 0 0;
  color: var(--success);
  font-weight: 700;
  font-size: 13px;
}

.payments-list {
  display: grid;
  gap: 8px;
}

.payment-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
}

.payment-item .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 4px;
}

.payment-item .meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.paid {
  background: rgba(6, 118, 71, 0.14);
  color: #055e3b;
}

.badge.pending {
  background: rgba(217, 119, 6, 0.14);
  color: #8a4a02;
}

.badge.failed {
  background: rgba(180, 35, 24, 0.14);
  color: #8d1f16;
}

.badge.canceled {
  background: rgba(71, 84, 103, 0.14);
  color: #344054;
}

.hidden {
  display: none !important;
}

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

.doc-modal {
  --doc-top-offset: calc(60px + env(safe-area-inset-top, 0px));
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--doc-top-offset) 12px 12px;
}

.doc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 22, 37, 0.5);
}

.doc-sheet {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 24px));
  height: min(calc(100dvh - var(--doc-top-offset) - 12px), 820px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.doc-head h3 {
  margin: 0;
  font-size: 17px;
}

.doc-content {
  overflow: auto;
  padding: 14px 16px 22px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .container {
    padding: calc(50px + env(safe-area-inset-top, 0px)) 10px 10px;
    gap: 10px;
  }

  .card {
    border-radius: 16px;
    padding: 14px;
  }

  .hero h1 {
    font-size: 20px;
  }

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

  .legal-actions {
    grid-template-columns: 1fr;
  }

  .doc-modal {
    --doc-top-offset: calc(60px + env(safe-area-inset-top, 0px));
    padding: var(--doc-top-offset) 8px 8px;
  }

  .doc-sheet {
    width: 100%;
    height: calc(100dvh - var(--doc-top-offset) - 8px);
    border-radius: 14px;
  }

  .doc-head {
    padding: 12px;
  }

  .doc-content {
    padding: 12px 12px 18px;
  }
}

@media (max-width: 980px) {
  .purchase-card,
  .history-card {
    grid-column: 1 / -1;
  }

  .history-card {
    max-height: none;
    overflow: visible;
  }
}
