:root {
  --navy: #102a43;
  --navy-soft: #243f5a;
  --cream: #f6f2ea;
  --paper: #fffdf8;
  --orange: #f08a5d;
  --orange-dark: #cf6840;
  --blue: #2d6a8a;
  --text: #172333;
  --muted: #667788;
  --line: rgba(16, 42, 67, 0.12);
  --shadow: 0 16px 40px rgba(16, 42, 67, 0.1);
  --tg-bg-color: var(--cream);
  --tg-text-color: var(--text);
  --tg-button-color: var(--navy);
  font-family: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--tg-theme-text-color, var(--text));
  background: var(--tg-theme-bg-color, var(--cream));
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell { width: min(100%, 760px); margin: 0 auto; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: color-mix(in srgb, var(--tg-theme-bg-color, var(--cream)) 90%, transparent);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: white; background: var(--navy); font-size: 12px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: var(--orange); font-size: 20px; }

main { padding: 18px; }
.view { display: none; animation: appear .24s ease both; }
.view.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }
.eyebrow { margin: 0 0 10px; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(31px, 8vw, 52px); line-height: 1.03; letter-spacing: -.045em; }
h2 { margin: 0; font-size: clamp(25px, 6vw, 34px); line-height: 1.08; letter-spacing: -.035em; }
h3 { margin: 0; font-size: 18px; line-height: 1.2; }

.hero-card { position: relative; overflow: hidden; padding: 28px 22px; color: white; background: var(--navy); border-radius: 28px; box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; width: 220px; height: 220px; right: -95px; bottom: -100px; border: 36px solid rgba(255,255,255,.05); border-radius: 50%; }
.hero-card .eyebrow { color: #f8b796; }
.hero-copy { max-width: 520px; margin: 16px 0 24px; color: #dbe7f0; font-size: 15px; line-height: 1.6; }
.primary-button, .secondary-button { border: 0; border-radius: 14px; font-weight: 800; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; padding: 0 18px; color: white; background: var(--orange); box-shadow: 0 10px 22px rgba(240,138,93,.25); }
.primary-button:hover { background: var(--orange-dark); }
.microcopy { margin: 12px 0 0; color: #b9c9d6; font-size: 11px; text-align: center; }
.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 34px; }
.trust-row span { padding: 10px 5px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.38); font-size: 11px; font-weight: 700; text-align: center; }
.inbox-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: -16px 0 30px; padding: 15px 16px; border: 1px solid rgba(240,138,93,.35); border-radius: 16px; color: var(--navy); background: #fff6ef; text-align: left; }
.inbox-button[hidden] { display: none; }
.inbox-button span, .inbox-button small { display: block; }
.inbox-button small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }
.inbox-button strong { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; color: white; background: var(--orange); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 0 0 16px; }
.section-heading.standalone { margin-top: 8px; }
.text-button, .back-link { border: 0; padding: 8px 0; color: var(--blue); background: transparent; font-weight: 800; }
.section-copy { margin: 10px 0 22px; color: var(--muted); line-height: 1.65; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-card { min-height: 126px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; color: inherit; background: var(--paper); text-align: left; box-shadow: 0 8px 24px rgba(16,42,67,.05); }
.service-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 16px; border-radius: 12px; color: white; background: var(--blue); font-size: 13px; font-weight: 800; }
.quick-card strong { display: block; font-size: 14px; }

.subscribe-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; margin: 32px 0 16px; padding: 20px; color: white; background: linear-gradient(135deg, #2d6a8a, #102a43); border-radius: 22px; }
.subscribe-card p { margin: 8px 0 14px; color: #dbe7f0; font-size: 13px; line-height: 1.5; }
.subscribe-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgba(255,255,255,.14); }
.secondary-button { min-height: 42px; padding: 0 15px; color: var(--navy); background: white; font-size: 12px; }
.social-buttons { display: grid; grid-template-columns: 1fr; gap: 8px; }
.social-buttons .secondary-button { width: 100%; text-align: left; }
.link-list { border-top: 1px solid var(--line); }
.link-list a { display: flex; justify-content: space-between; padding: 17px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; font-size: 14px; font-weight: 700; }
.link-list b { color: var(--orange-dark); }

.quiz-header { display: flex; align-items: end; justify-content: space-between; margin: 20px 0 14px; }
.step-count { color: var(--muted); font-size: 12px; font-weight: 800; }
.progress { height: 6px; margin-bottom: 20px; overflow: hidden; border-radius: 99px; background: rgba(16,42,67,.1); }
.progress span { display: block; width: 25%; height: 100%; border-radius: inherit; background: var(--orange); transition: width .25s ease; }
.quiz-card, .result-card, .request-form { padding: 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.quiz-card h3 { font-size: 23px; }
.quiz-hint { margin: 8px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.option-list { display: grid; gap: 10px; }
.option-button { width: 100%; min-height: 54px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 14px; color: inherit; background: white; text-align: left; font-weight: 700; }
.option-button.selected { border-color: var(--orange); background: #fff4ed; box-shadow: 0 0 0 2px rgba(240,138,93,.12); }
.quiz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.quiz-actions button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; font-weight: 800; }
.quiz-actions .previous { color: var(--navy); background: #e8eef2; }
.quiz-actions .next { color: white; background: var(--navy); }
.quiz-actions button:disabled { opacity: .45; }

.result-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 7px 10px; border-radius: 99px; color: #24563b; background: #e8f4ec; font-size: 11px; font-weight: 800; }
.result-card h2 { margin-bottom: 12px; }
.result-reason { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.secondary-result { margin: 18px 0; padding: 15px; border-left: 3px solid var(--orange); border-radius: 0 12px 12px 0; background: #fff6ef; font-size: 13px; line-height: 1.55; }
.result-actions { display: grid; gap: 10px; }
.outline-button { min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--navy); background: white; font-weight: 800; }

.service-list { display: grid; gap: 12px; }
.service-card { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.service-card-head { display: flex; align-items: center; gap: 13px; }
.service-card-head .service-icon { margin: 0; flex: 0 0 auto; }
.service-card p { margin: 12px 0 15px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.service-links { display: flex; gap: 8px; }
.service-links button, .service-links a { flex: 1; min-height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px; text-decoration: none; font-size: 12px; font-weight: 800; }
.service-links button { color: white; background: var(--navy); }
.service-links a { color: var(--navy); background: #e8eef2; }

.request-form { display: grid; gap: 18px; }
.request-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 800; }
.request-form input, .request-form textarea, .request-form select { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 13px; color: var(--text); background: white; outline: none; }
.request-form input:focus, .request-form textarea:focus, .request-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45,106,138,.12); }
.request-form .consent { display: flex; grid-template-columns: auto 1fr; align-items: start; gap: 10px; color: var(--muted); font-weight: 500; line-height: 1.45; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; }
.consent a { color: var(--blue); }
.form-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.application-list { display: grid; gap: 12px; }
.application-card { padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(16,42,67,.05); }
.application-card header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.application-card header strong { color: var(--navy); font-size: 13px; }
.application-card time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.application-card h3 { margin-bottom: 5px; font-size: 16px; }
.application-card .application-service { color: var(--orange-dark); font-size: 11px; font-weight: 800; }
.application-card p { margin: 10px 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.application-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.application-card footer a { color: var(--blue); font-size: 12px; font-weight: 800; text-decoration: none; }
.application-status { padding: 5px 8px; border-radius: 99px; color: #24563b; background: #e8f4ec; font-size: 10px; font-weight: 800; }
.empty-inbox { padding: 28px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 760px); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); transform: translateX(-50%); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--tg-theme-bg-color, var(--cream)) 94%, transparent); backdrop-filter: blur(18px); }
.bottom-nav button { display: grid; gap: 3px; justify-items: center; border: 0; padding: 5px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.bottom-nav button span { font-size: 19px; line-height: 1; }
.bottom-nav button.active { color: var(--orange-dark); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); width: min(calc(100% - 36px), 520px); padding: 13px 16px; transform: translate(-50%, 18px); border-radius: 14px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 620px) {
  main { padding: 26px; }
  .hero-card { padding: 40px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .service-list { grid-template-columns: repeat(2, 1fr); }
  .social-buttons { grid-template-columns: repeat(2, 1fr); }
}

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