/* ---------------------------------------------------------------------------
   Application, status and review pages. Built on the site's tokens in
   styles.css; nothing here changes any other page.
--------------------------------------------------------------------------- */

.ap-body { background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
.ap-body main { flex: 1; }

/* ---- slim header: no menu to wander off into mid-application ---- */
.ap-top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.ap-top-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.ap-top .logo { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; flex: none; }
/* On a phone the signed-in address crowds the brand; Sign out alone is enough there. */
@media (max-width: 520px) { .rv-who-email { display: none; } }
.ap-secure {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap;
}
.ap-secure svg { width: 15px; height: 15px; flex: none; }
.ap-top-right { display: flex; align-items: center; gap: 12px; }
.ap-top-right .lang-toggle { margin-left: 0; }
/* Phones: the padlock alone says "secure"; the words make room for the language toggle. */
@media (max-width: 420px) { .ap-secure-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

.ap-wrap {
  max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px;
  display: grid; gap: 28px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) {
  .ap-wrap { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; padding-top: 40px; }
  .ap-aside { position: sticky; top: 24px; order: 2; }
}

/* ---- package card ---- */
.ap-pkg {
  background: var(--charcoal-dark); color: #fff;
  border-radius: var(--radius); padding: 22px 22px 20px;
  box-shadow: var(--shadow);
}
.ap-pkg-eyebrow {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: #d9c29a; margin: 0 0 6px; font-weight: 600;
}
.ap-pkg-name { font-family: var(--serif); font-size: 1.5rem; color: #fff; margin: 0; line-height: 1.2; }
.ap-pkg-price { margin: 10px 0 2px; color: #fff; font-size: 1.05rem; }
.ap-pkg-price strong { font-family: var(--serif); font-size: 2rem; font-weight: 600; margin-right: 4px; }
.ap-pkg-term { margin: 0 0 14px; font-size: 0.85rem; color: #c9c4ba; }
.ap-pkg ul { margin: 0 0 16px; padding: 0; list-style: none; }
.ap-pkg li {
  position: relative; padding: 5px 0 5px 22px;
  font-size: 0.9rem; color: #e8e4dc; line-height: 1.45;
}
.ap-pkg li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 9px; height: 5px; border-left: 2px solid #d9c29a; border-bottom: 2px solid #d9c29a;
  transform: rotate(-45deg);
}
.ap-pkg-change {
  appearance: none; background: transparent; border: 1px solid rgba(255,255,255,0.35);
  color: #fff; border-radius: 999px; padding: 9px 18px; font: inherit; font-size: 0.85rem;
  font-weight: 600; cursor: pointer; min-height: 44px;
}
.ap-pkg-change:hover { border-color: #fff; }
.ap-pkg-note { margin: 14px 0 0; font-size: 0.8rem; color: #b7b1a6; line-height: 1.5; }

.ap-picker { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.ap-picker[hidden] { display: none; }
.ap-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; color: #fff; min-height: 48px;
}
.ap-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ap-pick:has(input:checked) { border-color: #d9c29a; background: rgba(217,194,154,0.12); }
.ap-pick:has(input:focus-visible) { outline: 2px solid #d9c29a; outline-offset: 2px; }
.ap-pick span:last-child { font-weight: 600; }

/* ---- main card ---- */
.ap-main {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 20px 28px; box-shadow: 0 10px 30px -22px rgba(20,24,26,0.35);
}
@media (min-width: 640px) { .ap-main { padding: 34px 38px 36px; } }

.ap-intro-title { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-bottom: 8px; }
.ap-intro-lead { margin-bottom: 22px; font-size: 1rem; }

.ap-banner {
  border-radius: 12px; padding: 13px 16px; margin: 0 0 20px;
  font-size: 0.93rem; line-height: 1.5;
}
.ap-banner[hidden] { display: none; }
.ap-banner-info { background: var(--sage-tint); color: #2f3d2d; border: 1px solid #c9d4c6; }
.ap-banner-warn { background: var(--clay-tint); color: #6b2b14; border: 1px solid #ebc4b5; }

/* ---- progress ---- */
.ap-progress { margin: 0 0 26px; }
.ap-progress-label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 8px;
}
.ap-progress-label strong { color: var(--charcoal-dark); font-weight: 600; }
.ap-bar { height: 6px; background: var(--paper-alt); border-radius: 99px; overflow: hidden; }
.ap-bar-fill { height: 100%; width: 0; background: var(--clay); border-radius: 99px; transition: width 0.35s ease; }

/* ---- steps ---- */
.ap-step[hidden] { display: none; }
.ap-step-title { font-size: clamp(1.45rem, 3.2vw, 1.85rem); margin-bottom: 6px; outline: none; }
.ap-step-lead { margin: 0 0 24px; font-size: 0.97rem; }

.ap-q { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.ap-q:last-child { margin-bottom: 8px; }
.ap-label, .ap-q > legend {
  display: block; font-weight: 600; color: var(--charcoal-dark);
  font-size: 0.98rem; margin-bottom: 8px; padding: 0; line-height: 1.4;
}
.ap-opt-mark { font-weight: 400; color: var(--ink-soft); font-size: 0.85rem; }
.ap-help { display: block; margin: -2px 0 9px; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.45; }

.ap-input, .ap-textarea, .ap-select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid #d6ccb6; border-radius: 12px;
  padding: 12px 14px; min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ap-textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.ap-input:focus, .ap-textarea:focus, .ap-select:focus {
  outline: none; border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(176,141,87,0.25);
}
.ap-input[aria-invalid="true"], .ap-textarea[aria-invalid="true"] { border-color: var(--clay); }

.ap-row2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.ap-unit { position: relative; }
.ap-unit .ap-input { padding-right: 46px; }
.ap-unit-tag {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 0.88rem; color: var(--ink-soft); pointer-events: none;
}

/* Option cards (radio and checkbox) */
.ap-options { display: grid; gap: 9px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .ap-options-2 { grid-template-columns: 1fr 1fr; } }
.ap-options-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-opt { position: relative; display: block; cursor: pointer; }
.ap-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ap-opt span {
  display: flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 12px 15px;
  border: 1.5px solid #ddd3bf; border-radius: 12px; background: #fff;
  font-size: 0.96rem; color: var(--ink); line-height: 1.35;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ap-opt span::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid #b9ad94; background: #fff;
}
.ap-opt input[type="checkbox"] + span::before { border-radius: 5px; }
.ap-opt:hover span { border-color: var(--gold); }
.ap-opt input:checked + span { border-color: var(--clay); background: #fdf5f1; font-weight: 600; }
.ap-opt input:checked + span::before {
  border-color: var(--clay); background: var(--clay);
  box-shadow: inset 0 0 0 3px #fff;
}
.ap-opt input[type="checkbox"]:checked + span::before { box-shadow: inset 0 0 0 2.5px #fff; }
.ap-opt input:focus-visible + span { outline: 3px solid var(--gold-dark); outline-offset: 2px; }
.ap-options-inline .ap-opt span { min-height: 46px; padding: 10px 16px; }
.ap-options-inline .ap-opt span::before { display: none; }

/* Segmented control (units, yes/no) */
.ap-seg { display: inline-flex; border: 1.5px solid #d6ccb6; border-radius: 999px; padding: 3px; background: #fff; }
.ap-seg .ap-opt span {
  min-height: 42px; border: 0; border-radius: 999px; padding: 8px 18px; background: transparent;
}
.ap-seg .ap-opt span::before { display: none; }
.ap-seg .ap-opt input:checked + span { background: var(--charcoal-dark); color: #fff; }

.ap-yn { display: grid; grid-template-columns: repeat(3, minmax(0, max-content)); gap: 8px; }
.ap-yn .ap-opt span { min-width: 92px; justify-content: center; }
.ap-yn .ap-opt span::before { display: none; }
/* Compact choices have no radio dot, so the selection must be unmistakable. */
.ap-yn .ap-opt input:checked + span,
.ap-options-inline .ap-opt input:checked + span {
  background: var(--charcoal-dark); border-color: var(--charcoal-dark); color: #fff;
}

.ap-reveal { margin-top: 12px; }
.ap-reveal[hidden] { display: none; }

.ap-check { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 14px; cursor: pointer; }
.ap-check input {
  flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--clay); cursor: pointer;
}
.ap-check span { font-size: 0.95rem; color: var(--ink); line-height: 1.5; }
.ap-check a { color: var(--clay); text-decoration: underline; }

.ap-err { margin: 7px 0 0; font-size: 0.86rem; color: #a3401f; font-weight: 600; }
.ap-err:empty { display: none; }
.ap-err::before { content: "! "; }

.ap-note {
  display: flex; gap: 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 24px;
  font-size: 0.9rem; color: var(--ink-soft); line-height: 1.55;
}
.ap-note svg { flex: none; width: 20px; height: 20px; color: var(--gold-dark); margin-top: 1px; }

/* Error summary */
.ap-summary {
  border: 2px solid var(--clay); border-radius: 12px; padding: 14px 18px; margin: 0 0 22px;
  background: #fffaf7;
}
.ap-summary[hidden] { display: none; }
.ap-summary h3 { font-family: var(--sans); font-size: 1rem; margin: 0 0 6px; color: #8a3517; }
.ap-summary ul { margin: 0; padding-left: 18px; list-style: disc; }
.ap-summary a { color: #8a3517; text-decoration: underline; font-size: 0.92rem; }
.ap-summary:focus { outline: 3px solid var(--gold-dark); outline-offset: 3px; }

/* ---- navigation ---- */
.ap-nav {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line);
}
.ap-nav .btn { min-height: 50px; padding-left: 26px; padding-right: 26px; }
.ap-nav .btn-primary { margin-left: auto; }
.ap-nav .btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.ap-saved { font-size: 0.8rem; color: var(--ink-soft); margin: 12px 0 0; text-align: right; }
.ap-saved button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft);
  text-decoration: underline; cursor: pointer;
}

/* ---- review screen ---- */
.ap-review { margin: 0 0 26px; }
.ap-review-sec { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 12px; overflow: hidden; }
.ap-review-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--paper);
}
.ap-review-head h3 { margin: 0; font-family: var(--sans); font-size: 0.98rem; font-weight: 700; }
.ap-edit {
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--clay); cursor: pointer; min-height: 36px;
}
.ap-edit:hover { border-color: var(--clay); }
.ap-review dl { margin: 0; padding: 6px 16px 10px; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .ap-review dl { grid-template-columns: minmax(150px, 38%) minmax(0, 1fr); } }
.ap-review dt { font-size: 0.85rem; color: var(--ink-soft); padding: 8px 12px 0 0; }
.ap-review dd { margin: 0; font-size: 0.93rem; color: var(--ink); padding: 2px 0 8px; border-bottom: 1px solid #f1ebdf; overflow-wrap: anywhere; white-space: pre-line; }
@media (min-width: 560px) { .ap-review dt, .ap-review dd { padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid #f1ebdf; } }

.ap-next { background: var(--paper); border-radius: 14px; padding: 18px 20px; margin: 0 0 24px; }
.ap-next h3 { font-family: var(--sans); font-size: 1rem; margin: 0 0 10px; }
.ap-next ol { margin: 0; padding-left: 20px; list-style: decimal; }
.ap-next li { font-size: 0.92rem; color: var(--ink); margin-bottom: 6px; line-height: 1.5; }

.ap-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ap-foot {
  text-align: center; padding: 22px 20px 30px; font-size: 0.82rem; color: var(--ink-soft);
}
.ap-foot a { text-decoration: underline; }

/* ---- status page ---- */
.st-wrap { max-width: 640px; margin: 0 auto; padding: 40px 20px 64px; }
.st-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px 24px; box-shadow: 0 10px 30px -22px rgba(20,24,26,0.35); text-align: center;
}
@media (min-width: 640px) { .st-card { padding: 42px 46px; } }
.st-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; background: var(--sage-tint); color: var(--sage);
}
.st-icon svg { width: 30px; height: 30px; }
.st-icon.is-wait { background: var(--gold-tint); color: var(--gold-dark); }
.st-icon.is-warn { background: var(--clay-tint); color: var(--clay); }
.st-card h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 10px; }
.st-lead { font-size: 1rem; margin: 0 auto 22px; max-width: 30em; }
.st-facts { text-align: left; background: var(--paper); border-radius: 12px; padding: 6px 18px; margin: 0 0 22px; }
.st-facts div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.st-facts div:last-child { border-bottom: 0; }
.st-facts dt { color: var(--ink-soft); }
.st-facts dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.st-steps { text-align: left; margin: 0 0 24px; padding: 0; list-style: none; }
.st-steps li { display: flex; gap: 12px; padding: 8px 0; font-size: 0.94rem; color: var(--ink); line-height: 1.5; }
.st-steps li b {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.8rem; background: var(--charcoal-dark); color: #fff;
}
.st-small { font-size: 0.86rem; color: var(--ink-soft); margin: 18px 0 0; }
.st-small a { text-decoration: underline; }
.st-spin {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--gold-tint);
  border-top-color: var(--gold-dark); animation: st-spin 0.9s linear infinite; margin: 0 auto;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

/* ---- review page (Alma) ---- */
.rv-wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 64px; }
.rv-login { max-width: 420px; margin: 40px auto; }
.rv-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .rv-grid { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } }
.rv-list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.rv-list-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rv-list-head h2 { margin: 0; font-family: var(--sans); font-size: 1rem; }
.rv-item {
  display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid #f1ebdf;
  padding: 13px 16px; font: inherit; cursor: pointer; color: var(--ink);
}
.rv-item:hover { background: var(--paper); }
.rv-item[aria-current="true"] { background: var(--gold-tint); box-shadow: inset 4px 0 0 var(--gold-dark); }
.rv-item:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: -3px; }
.rv-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.rv-item-name { font-weight: 700; font-size: 0.95rem; }
.rv-item-meta { font-size: 0.82rem; color: var(--ink-soft); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.rv-empty { padding: 22px 16px; color: var(--ink-soft); font-size: 0.92rem; }
.rv-pill {
  display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.02em; white-space: nowrap;
}
.rv-pill-wait { background: #fff2d6; color: #6b4a0e; }
.rv-pill-ok { background: var(--sage-tint); color: #2f4a2c; }
.rv-pill-no { background: #ece8e1; color: #4a4339; }
.rv-pill-bad { background: #fbdcd1; color: #7d2a0f; }
.rv-flag { background: #fbdcd1; color: #7d2a0f; }
.rv-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; }
@media (min-width: 640px) { .rv-panel { padding: 28px 32px; } }
.rv-panel h2 { margin: 0 0 4px; font-size: 1.6rem; }
.rv-sub { margin: 0 0 18px; font-size: 0.9rem; }
.rv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; padding: 16px; background: var(--paper); border-radius: 12px; }
.rv-actions .btn { min-height: 46px; }
.rv-actions p { width: 100%; margin: 0 0 4px; font-size: 0.9rem; color: var(--ink); }
.btn-danger { background: #fff; color: #8a3517; border: 1.5px solid #d58a6f; }
.btn-danger:hover { background: #fbeee8; }
.rv-sec { margin: 0 0 18px; }
.rv-sec h3 { font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-dark); margin: 0 0 6px; }
.rv-sec dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .rv-sec dl { grid-template-columns: minmax(170px, 36%) minmax(0, 1fr); } }
.rv-sec dt { font-size: 0.86rem; color: var(--ink-soft); padding: 7px 10px 0 0; }
.rv-sec dd { margin: 0; padding: 2px 0 8px; border-bottom: 1px solid #f1ebdf; font-size: 0.94rem; white-space: pre-line; overflow-wrap: anywhere; }
@media (min-width: 640px) { .rv-sec dt, .rv-sec dd { padding: 8px 10px 8px 0; border-bottom: 1px solid #f1ebdf; } }
.rv-sec dd.is-flag { color: #7d2a0f; font-weight: 700; }
.rv-log { font-size: 0.82rem; color: var(--ink-soft); margin: 0; padding-left: 18px; list-style: disc; }
.rv-log li { margin-bottom: 3px; }
.rv-result { border-radius: 12px; padding: 13px 16px; margin: 0 0 18px; font-size: 0.93rem; }
.rv-result[hidden] { display: none; }

/* Dialog */
.rv-dialog { border: 0; border-radius: 18px; padding: 0; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5); }
.rv-dialog::backdrop { background: rgba(20, 24, 26, 0.55); }
.rv-dialog form { padding: 24px 22px; }
@media (min-width: 560px) { .rv-dialog form { padding: 30px 32px; } }
.rv-dialog h2 { font-size: 1.45rem; margin: 0 0 8px; }
.rv-dialog .ap-nav { margin-top: 20px; padding-top: 18px; }
.rv-warn { background: var(--clay-tint); color: #6b2b14; border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; margin: 0 0 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  .ap-bar-fill, .ap-input, .ap-textarea, .ap-opt span { transition: none; }
  .st-spin { animation-duration: 3s; }
}
