:root {
  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-surface-soft: #f1f5f9;
  --app-text: #111827;
  --app-muted: #4b5563;
  --app-border: #e5e7eb;
  --app-accent: #2563eb;
  --app-accent-dark: #1d4ed8;
  --app-success: #0f766e;
  --app-danger: #dc2626;
  --app-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --app-radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--app-text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34rem),
    linear-gradient(135deg, #f8fafc 0%, #eef4ff 48%, #f8fafc 100%);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--app-text);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 430px);
  gap: 38px;
  align-items: center;
  padding: 32px 0;
}

.desktop-panel {
  position: relative;
  padding: 34px;
  border: 1px solid rgba(229, 231, 235, .82);
  border-radius: 28px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--app-shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.desktop-panel::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -52px;
  width: 180px;
  height: 180px;
  border-radius: 38px;
  background: linear-gradient(135deg, rgba(37, 99, 235, .2), rgba(20, 184, 166, .14));
  transform: rotate(18deg);
}
.desktop-panel h1 {
  margin: 10px 0 14px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: .94;
  letter-spacing: -0.06em;
}
.desktop-panel p {
  max-width: 620px;
  margin: 0 0 24px;
  color: var(--app-muted);
  font-size: 18px;
  line-height: 1.6;
}
.eyebrow, .label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--app-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.flow-card, .meta-grid > div, .hero-card, .status-card, .mini-card, .detail-card, .info-box, .empty-state {
  border: 1px solid var(--app-border);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 12px 36px rgba(15, 23, 42, .07);
}
.flow-card {
  position: relative;
  z-index: 1;
  padding: 20px;
  border-radius: 20px;
}
.flow-card strong { display: block; margin-bottom: 10px; }
.flow-card ol { margin: 0; padding-left: 20px; color: var(--app-muted); line-height: 1.8; }
.meta-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.meta-grid > div { padding: 14px; border-radius: 16px; }
.meta-grid span { display: block; color: var(--app-muted); font-size: 12px; margin-bottom: 4px; }
.meta-grid strong { font-size: 15px; }

.phone-frame {
  min-height: 760px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 34px;
  background: var(--app-bg);
  box-shadow: var(--app-shadow);
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--app-border);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
}
.app-topbar h2 { margin: 3px 0 0; font-size: 23px; letter-spacing: -0.03em; }
.icon-button, .ghost-button, .btn {
  min-height: 40px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.icon-button {
  width: 40px;
  background: #fff;
  color: var(--app-text);
}
.ghost-button { padding: 0 14px; background: #fff; color: var(--app-text); font-weight: 700; }
.icon-button:hover, .ghost-button:hover, .btn:hover, .module-card:hover, .list-item.interactive:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15,23,42,.1); }
.d-none { display: none !important; }

.toast-region {
  position: absolute;
  z-index: 20;
  top: 88px;
  left: 50%;
  width: min(360px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.app-toast {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, .2);
  border-radius: 14px;
  background: #ecfdf5;
  color: #065f46;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
  font-weight: 700;
}
.app-toast.error { border-color: rgba(220, 38, 38, .22); background: #fef2f2; color: #991b1b; }

.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  animation: fadeIn .18s ease;
}
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.hero-card {
  padding: 22px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, .16), transparent 11rem),
    #fff;
}
.hero-card h3 { margin: 14px 0 8px; font-size: 30px; line-height: 1.05; letter-spacing: -.05em; }
.hero-card p, .hint { color: var(--app-muted); line-height: 1.55; }
.pill, .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}
.stack { display: grid; gap: 14px; margin-top: 16px; }
.field { display: grid; gap: 7px; }
.field span, .field-title { color: var(--app-muted); font-size: 13px; font-weight: 800; }
.form-control {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: #fff;
  color: var(--app-text);
  outline: none;
}
textarea.form-control { resize: vertical; }
.form-control:focus { border-color: rgba(37, 99, 235, .72); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}
.btn-primary { border-color: var(--app-accent); background: var(--app-accent); color: #fff; box-shadow: 0 14px 26px rgba(37, 99, 235, .22); }
.btn-primary:hover { background: var(--app-accent-dark); }
.btn-secondary { background: #fff; color: var(--app-text); }
.w-100 { width: 100%; }

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
}
.status-card strong { display: block; margin-top: 4px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.module-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--app-border);
  border-radius: 20px;
  background: #fff;
  color: var(--app-text);
  text-align: left;
}
.module-card span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--app-surface-soft); color: var(--app-accent); font-weight: 900; }
.module-card strong { font-size: 15px; }
.module-card small { color: var(--app-muted); }
.module-card.featured { border-color: rgba(37, 99, 235, .32); background: linear-gradient(145deg, #fff, #eff6ff); }

.screen-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.list-stack { display: grid; gap: 10px; }
.list-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--app-border);
  border-radius: 18px;
  background: #fff;
  color: var(--app-text);
  text-align: left;
}
.list-item-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.list-item small { color: var(--app-muted); line-height: 1.45; }
.interactive { cursor: pointer; }
.empty-state { padding: 18px; border-radius: 18px; color: var(--app-muted); }
.empty-state strong { display: block; color: var(--app-text); margin-bottom: 6px; }
.empty-state p { margin: 0; line-height: 1.5; }
.info-box {
  padding: 13px;
  border-radius: 16px;
  color: var(--app-muted);
  line-height: 1.5;
}
.mini-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 18px;
  margin-bottom: 14px;
}
.mini-card small { color: var(--app-muted); }
.choice-stack { display: grid; gap: 9px; margin-top: 8px; }
.choice-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  background: #fff;
}
.choice-card input { margin-top: 3px; accent-color: var(--app-accent); }
.choice-card span { display: grid; gap: 3px; }
.choice-card small { color: var(--app-muted); line-height: 1.35; }
.detail-card { padding: 18px; border-radius: 22px; }
.detail-card h3 { margin: 8px 0 16px; font-size: 26px; letter-spacing: -.04em; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.detail-grid > div { padding: 12px; border: 1px solid var(--app-border); border-radius: 15px; background: #fff; }
.detail-grid span { display: block; color: var(--app-muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.detail-grid p { margin: 0; color: var(--app-text); line-height: 1.45; }
.detail-grid .wide { grid-column: 1 / -1; }
.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--app-border);
  color: var(--app-muted);
  background: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; align-items: start; padding-top: 16px; }
  .desktop-panel { display: none; }
  .phone-frame { width: min(430px, 100%); margin: 0 auto; min-height: calc(100vh - 32px); max-height: none; }
}
@media (max-width: 480px) {
  .app-shell { width: 100%; padding: 0; }
  .phone-frame { width: 100%; min-height: 100vh; border: 0; border-radius: 0; }
  .module-grid { grid-template-columns: 1fr; }
}
