:root {
  --theme: #2E6DB4;
  --theme-dark: #245a96;
  --bg: #f4f6f9;
  --text: #16202b;
  --muted: #5b6673;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --icon-bg: #e8f0f8;
  --chevron: #9aa3ad;
  --disabled-bg: #f3f5f7;
  --disabled-icon: #eef0f3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  width: min(480px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(28px + var(--safe-bottom))
    calc(20px + var(--safe-left));
  display: flex;
  flex-direction: column;
}

.screen[hidden] {
  display: none !important;
}

.screen-home:not([hidden]) {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 3vh;
}

.brand {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  display: block;
  height: 90px;
  width: auto;
  margin: 0 auto;
}

.brand h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 6px;
  color: var(--text);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.tiles,
.rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.rows {
  gap: 12px;
}

.tile,
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  border: 0;
  width: 100%;
  text-align: left;
}

.tile {
  padding: 22px 18px;
  min-height: 112px;
}

.row {
  padding: 16px;
  min-height: 76px;
}

.tile:active,
.row:active {
  transform: scale(0.985);
  background: #f8fafc;
}

.tile:focus-visible,
.row:focus-visible,
.back:focus-visible {
  outline: 3px solid var(--theme);
  outline-offset: 2px;
}

.icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--icon-bg);
  color: var(--theme);
  display: grid;
  place-items: center;
}

.icon svg {
  width: 26px;
  height: 26px;
  display: block;
}

.tile .icon {
  flex-basis: 56px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.tile .icon svg {
  width: 30px;
  height: 30px;
}

.meta {
  flex: 1;
  min-width: 0;
}

.tile-title,
.row-title {
  display: block;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
}

.tile-sub,
.row-sub {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-top: 3px;
}

.chevron {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--chevron);
}

.row--disabled {
  opacity: 0.72;
  background: var(--disabled-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  cursor: default;
  pointer-events: none;
}

.row--disabled .icon {
  background: var(--disabled-icon);
  color: #7a8490;
}

.row--disabled:active {
  transform: none;
  background: var(--disabled-bg);
}

.badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme);
  background: var(--icon-bg);
  border-radius: 999px;
  padding: 3px 8px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--theme);
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  min-height: 44px;
  margin: -8px 0 4px -8px;
  padding: 8px;
}

.back svg {
  width: 22px;
  height: 22px;
  display: block;
}

.screen-list h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}

.lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

@media (min-width: 700px) {
  .app {
    width: min(520px, 100%);
  }

  .logo {
    height: 110px;
  }

  .brand h1 {
    font-size: 30px;
  }
}

/* Forms-first home with floating results button */
.brand--compact { padding-top: 8px; margin-bottom: 18px; }
.brand--compact .logo { height: 70px; }
.screen-home { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.fab {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff5a5f 0%, #e5484d 55%, #c62f3a 100%);
  color: #fff; font-weight: 700; font-size: 17px; text-decoration: none;
  box-shadow: 0 8px 22px rgba(229,72,77,.45), 0 2px 6px rgba(0,0,0,.15);
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(.96); }
.fab svg { width: 22px; height: 22px; }

/* Two-across form buttons */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%; }
.gbtn {
  background: #fff; border-radius: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.08);
  aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 12px; text-align: center; text-decoration: none; color: #16202b;
  -webkit-tap-highlight-color: transparent;
}
.gbtn:active { transform: scale(.97); }
.gbtn .icon { width: 64px; height: 64px; border-radius: 16px; background: #e8f0fa; color: #2E6DB4; display: flex; align-items: center; justify-content: center; }
.gbtn .icon svg { width: 34px; height: 34px; }
.gbtn-title { font-size: 17px; font-weight: 700; line-height: 1.2; }
.gbtn--disabled { opacity: .55; }
.gbtn .badge { margin-top: -4px; }
