:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #111827;
  --muted: #607085;
  --line: #dce4ee;
  --brand: #0f8b8d;
  --brand-strong: #0b6f71;
  --accent: #f2a541;
  --success: #1f9d66;
  --danger: #d04a3a;
  --shadow: 0 16px 40px rgba(23, 36, 55, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(15, 139, 141, 0.14), transparent 28rem),
    linear-gradient(180deg, #f9fbfd 0%, var(--bg) 48%, #edf2f7 100%);
  color: var(--text);
}

body.dark {
  color-scheme: dark;
  --bg: #0e141b;
  --surface: #141c25;
  --surface-2: #1d2834;
  --text: #f7fafc;
  --muted: #a6b4c4;
  --line: #2a3746;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

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

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.topbar,
.brand,
.quick-actions,
.action-grid,
.metric-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #173f5f);
  box-shadow: var(--shadow);
}

.brand-mark img,
.theme-icon,
.copy-icon {
  display: block;
  position: relative;
}

.brand-mark img {
  width: 28px;
  height: 28px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.15;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.theme-icon {
  width: 18px;
  height: 18px;
  margin: auto;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 7px 0 0 -3px currentColor;
}

.status-panel,
.tab-panel,
.ref-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

body.dark .status-panel,
body.dark .tab-panel,
body.dark .ref-card {
  background: rgba(20, 28, 37, 0.88);
}

.status-panel {
  padding: 18px;
}

.status-ring {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  margin: 2px auto 16px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 82%, var(--surface-2) 82% 100%);
}

body.is-loading .status-ring {
  background: conic-gradient(var(--surface-2) 0 100%, var(--surface-2) 100% 100%);
}

.status-ring span {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(31, 157, 102, 0.18), transparent),
    var(--surface);
}

.status-ring.is-paid {
  background: conic-gradient(var(--success) 0 82%, var(--surface-2) 82% 100%);
}

.status-ring.is-demo {
  background: conic-gradient(var(--accent) 0 58%, var(--surface-2) 58% 100%);
}

.status-ring.is-demo span {
  background:
    linear-gradient(135deg, rgba(242, 165, 65, 0.2), transparent),
    var(--surface);
}

.status-ring.is-inactive {
  background: conic-gradient(var(--line) 0 100%, var(--surface-2) 100% 100%);
}

.status-ring.is-inactive span {
  background:
    linear-gradient(135deg, rgba(96, 112, 133, 0.12), transparent),
    var(--surface);
}

.status-label {
  margin-bottom: 6px;
  color: var(--success);
  font-weight: 800;
  text-align: center;
}

.status-label.is-warning {
  color: var(--accent);
}

.status-copy {
  text-align: center;
}

.status-copy p:last-child {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.45;
}

.quick-actions,
.action-grid {
  gap: 10px;
}

.action-grid > * {
  flex: 1;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

body.is-loading .quick-actions {
  min-height: 58px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2), rgba(255, 255, 255, 0.75), var(--surface-2));
  background-size: 220% 100%;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}

.hero-action {
  width: 100%;
  min-height: 58px;
  font-size: 17px;
}

.primary-button,
.secondary-button,
.tab,
.support-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:active {
  background: var(--brand-strong);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.secondary-button,
.support-link {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.button-icon.copy-icon {
  width: 15px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.button-icon.copy-icon::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 4px;
  width: 11px;
  height: 12px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 3px 0 0 3px;
  opacity: 0.55;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-height: 38px;
  padding: 0 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.tab-panel {
  display: none;
  padding: 18px;
}

.tab-panel.is-active {
  display: block;
}

.section-heading {
  margin-bottom: 14px;
}

.guide-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.skeleton-line {
  min-height: 14px;
  border-radius: 7px;
  color: transparent !important;
  background: linear-gradient(90deg, var(--surface-2), rgba(255, 255, 255, 0.75), var(--surface-2));
  background-size: 220% 100%;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}

.skeleton-line.short {
  width: 44%;
  margin-left: auto;
  margin-right: auto;
}

.skeleton-line.title {
  width: 68%;
  min-height: 28px;
  margin-left: auto;
  margin-right: auto;
}

body.dark .skeleton-line,
body.dark.is-loading .quick-actions {
  background: linear-gradient(90deg, var(--surface-2), rgba(42, 55, 70, 0.9), var(--surface-2));
  background-size: 220% 100%;
}

.skeleton-steps .guide-step strong {
  background: var(--surface-2);
}

@keyframes skeleton-pulse {
  0% {
    background-position: 160% 0;
  }

  100% {
    background-position: -60% 0;
  }
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.guide-step,
.faq-item,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.guide-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 12px;
}

.guide-step strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 139, 141, 0.12);
  color: var(--brand);
}

.guide-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.plans-list,
.periods-list {
  display: grid;
  gap: 10px;
}

.plan-card,
.period-card {
  padding: 14px;
}

.plan-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.plan-card h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.plan-card p {
  margin: 0;
  color: var(--muted);
}

.price {
  min-width: 84px;
  text-align: right;
  font-size: 20px;
  font-weight: 900;
}

.plan-card footer {
  margin-top: 12px;
}

.period-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.period-card h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.period-card p {
  margin: 0;
  color: var(--muted);
}

.period-card footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.back-button {
  display: none;
  min-height: 40px;
  margin: -2px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.back-button.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ref-card {
  padding: 14px;
  margin-bottom: 12px;
}

.ref-card p {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.metric-row {
  gap: 10px;
}

.metric-row div {
  flex: 1;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
}

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

.wide {
  width: 100%;
}

.diagnostics {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(31, 157, 102, 0.12);
  color: var(--success);
  font-weight: 700;
  line-height: 1.4;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.faq-item {
  padding: 12px;
}

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.support-link {
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100% - 32px), 420px);
  padding: 12px 14px;
  border-radius: 8px;
  background: #101828;
  color: #fff;
  font-weight: 800;
  text-align: center;
  transform: translate(-50%, 120px);
  transition: transform 0.22s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .quick-actions,
  .action-grid,
  .period-card footer {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tab {
    font-size: 12px;
  }
}
