/* ── Top Banner ── */
.top-banner {
  background: linear-gradient(135deg, var(--red) 0%, #d4154a 100%);
  padding: 10px 16px;
  text-align: center;
  flex-shrink: 0;
}
.top-banner p {
  margin: 0;
  font-size: 13px;
  color: white;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ── Header ── */
.header {
  background: var(--blue);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -5%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(200,16,46,0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.header img {
  height: 52px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.header-title-group { flex: 1; min-width: 0; text-align: right; }
.header-title {
  font-size: 14px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.72);
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-text {
  color: white;
  font-size: 16px;
  font-weight: 700;
}
.header-accent { height: 4px; background: var(--red); flex-shrink: 0; }

/* ── Progress bar ── */
.progress-wrap {
  background: white;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 76px;
  z-index: 99;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.progress-track {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #1a5fd4);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}
.step-dots {
  display: flex;
  gap: 5px;
  margin-top: 7px;
  justify-content: center;
  flex-wrap: wrap;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.dot.done    { background: var(--blue); }
.dot.current { background: var(--red); transform: scale(1.4); }

/* ── Completion tracker row ── */
.completion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.completion-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  padding: 2px 8px;
  border-radius: 99px;
  transition: background 0.3s, color 0.3s;
}
.completion-pct.complete { color: var(--green); background: var(--green-bg); }

/* ── Late submission banner (amber — had valid draft, submitting after deadline) ── */
#lateBanner {
  display: none;
  background: var(--amber-bg);
  border-bottom: 2px solid var(--amber);
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: #92400e;
}
#lateBanner strong {
  color: #b45309;
  font-weight: 700;
}
/* ── Super-late banner (red — no prior draft, form opened after window expired) ── */
#superLateBanner {
  display: none;
  background: #fff1f2;
  border-bottom: 2px solid #ba0c2f;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  color: #9f1239;
}
#superLateBanner strong {
  color: #ba0c2f;
  font-weight: 700;
}

/* ── Main content ── */
.main {
  flex: 1;
  padding: 16px 14px 120px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* ── Branch banner ── */
.branch-banner {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 0;
}
.branch-item {
  flex: 1;
  padding: 0 8px;
  border-right: 1px solid var(--border);
}
.branch-item:first-child { padding-left: 0; }
.branch-item:last-child  { border-right: none; }
.branch-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  display: block;
  margin-bottom: 1px;
}
.branch-value { font-size: 13px; font-weight: 700; color: var(--text); }

/* ── App body (sidebar + content) ── */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.app-body-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Fixed bottom nav bar ── */
/* padding-bottom: env(safe-area-inset-bottom) prevents the nav from sitting
   behind the home indicator on iPhone X/12/13/14/15 and iPad bottom bar. */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  background: white;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.nav-bar-inner {
  display: flex;
  gap: 8px;
  width: 100%;
}
.btn {
  flex: 1;
  padding: 14px 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  font-family: var(--font);
  min-height: 48px;
}
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-prev {
  flex: 0 0 auto;
  padding: 14px 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
}
.btn-prev:hover:not(:disabled) { background: #dde3ed; }
.btn-next   { background: var(--red);  color: white; }
.btn-next:hover:not(:disabled) { background: var(--red-dark); }
.btn-submit { background: var(--blue); color: white; }
.btn-submit:hover:not(:disabled) { background: var(--blue-dark); }

/* ── Footer ── */
/* bottom padding = 80px (nav-bar clearance) + safe-area-inset-bottom for notch devices */
.app-footer {
  background: var(--blue);
  color: white;
  padding: 32px 20px;
  padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
  margin-top: 40px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.app-footer::before {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -8%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(200,16,46,0.10) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.footer-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}
.footer-logo {
  height: 56px;
  margin-bottom: 18px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.app-footer p {
  margin: 0;
  font-size: 13px;
  opacity: 0.92;
  line-height: 1.9;
}
.footer-credit {
  margin-top: 14px;
  font-size: 12px;
}
.app-footer a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.35);
  transition: border-color 0.2s;
}
.app-footer a:hover { border-color: white; }
