:root {
  color-scheme: light;
  --page: #f5f7f9;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #626d7a;
  --line: #e5e7eb;
  --active: #15803d;
  --warning: #b45309;
  --expired: #dc2626;
  --quiet: #667085;
  --telegram: #229ed9;
  --shadow: 0 14px 38px rgba(27, 45, 61, 0.07);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.customer-shell {
  width: calc(100% - 32px);
  max-width: 440px;
  margin: 0 auto;
  padding: max(30px, calc(env(safe-area-inset-top) + 18px)) 0 max(28px, calc(env(safe-area-inset-bottom) + 18px));
  animation: appear 180ms ease-out both;
}

.brand {
  display: grid;
  justify-items: center;
  margin: 0 0 18px;
  text-align: center;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 18px;
  background: #14231f;
  color: #fff;
}

.brand-mark svg { width: 25px; height: 25px; }

.brand h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.16;
  text-wrap: balance;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.subscription-card,
.renewal-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.subscription-card {
  padding: 18px 19px 17px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  font-size: 15px;
  font-weight: 600;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: currentColor;
}

.status-active { color: var(--active); }
.status-soon { color: var(--warning); }
.status-expired { color: var(--expired); }
.status-unknown,
.status-paused { color: var(--quiet); }

.countdown {
  padding: 12px 0 17px;
  border-bottom: 1px solid var(--line);
}

.countdown p {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 15px;
}

.countdown-value {
  display: block;
  font-size: clamp(40px, 11vw, 48px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-wrap: balance;
}

.countdown-pending { font-size: 30px; }

.status-soon + .countdown .countdown-value { color: var(--warning); }
.status-expired + .countdown .countdown-value { color: var(--expired); }

.date-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 18px;
  padding-top: 16px;
}

.date-row span {
  color: var(--muted);
  font-size: 15px;
}

.date-row strong {
  font-size: 16px;
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.renewal-card {
  margin-top: 14px;
  padding: 18px 19px;
}

.renewal-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.renewal-card p {
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.telegram-button {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--telegram);
  color: #071923;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  transition: transform 180ms ease, filter 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.telegram-button svg { width: 19px; height: 19px; flex: 0 0 19px; }

.telegram-button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.telegram-button:active { transform: scale(0.985); }

.telegram-handle {
  display: block;
  width: fit-content;
  margin: 11px auto 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.home-card,
.message-card { margin-top: 14px; }

.home-card p,
.message-card p { margin-top: 0; }

@media (hover: hover) and (pointer: fine) {
  .telegram-button:hover { filter: brightness(0.96); transform: translateY(-1px); }
}

@media (max-width: 360px) {
  .subscription-card,
  .renewal-card { padding-left: 16px; padding-right: 16px; }
  .date-row { align-items: flex-start; flex-direction: column; gap: 3px; }
  .date-row strong { text-align: left; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111318;
    --surface: #1c2028;
    --ink: #f9fafb;
    --muted: #a4acb8;
    --line: #303641;
    --active: #4ade80;
    --warning: #fbbf24;
    --expired: #f87171;
    --quiet: #a4acb8;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  }
  .brand-mark { background: #25332e; }
  .telegram-button { color: #071923; }
}

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

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