/* Fresh Start portal — layout only. Brand tokens in theme.css */

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.csPortalBody {
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(48px, env(safe-area-inset-bottom));
  animation: theme-content-enter 0.45s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
}

.topBar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

/* Stack logo → community → location → form title.
   theme.css .brand is inline-flex row for the site nav; override here. */
.csPortalBody .brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  max-width: 100%;
}

.csPortalBody .brand .productLockup {
  margin: 0 0 10px;
}

.csPortalBody .brand .productLogo {
  height: 48px;
  max-width: min(280px, 80vw);
}

.brandLogo {
  display: block;
  max-height: 88px;
  width: auto;
  margin: 0 0 10px;
}

.csPortalBody .stackTight { margin: 0 0 8px; }
.csPortalBody .stackAfter { margin: 8px 0 0; }

.csPortalBody .brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--primary);
}

.csPortalBody .brand .loc {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 2px;
  line-height: 1.35;
}

.csPortalBody .brand .sub {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.topBarActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card,
.sectionCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.sectionCard h2,
.card h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.ctaCard {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.recoveryKey {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.instructionLead {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  margin: 0 0 16px;
}

.muted { color: var(--muted); font-size: 0.95rem; }
.fieldHelp { margin: 0 0 12px; color: var(--muted); font-size: 0.98rem; line-height: 1.4; }
.error { color: var(--danger); font-weight: 500; }

.field {
  flex: 1 1 220px;
  min-width: 0;
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a3566;
  margin-bottom: 5px;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  font-size: 16px;
  font-family: inherit;
  padding: 10px 12px;
  border: 1px solid rgba(11, 31, 68, 0.16);
  border-radius: var(--radius-sm);
  height: var(--touch-min);
  min-height: var(--touch-min);
  background: #fff;
  color: var(--text);
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  max-width: none;
  margin: 0 0.4rem 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--navy);
  vertical-align: middle;
  flex-shrink: 0;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 95, 176, 0.15);
}

.field textarea {
  height: auto;
  min-height: 88px;
  resize: vertical;
}

.field.readonly div {
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.fieldGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btnRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.btnRow.tight { margin-top: 0; margin-bottom: 10px; }
.btnRow.between { justify-content: space-between; }
.btnRow.end { justify-content: flex-end; }
.btnRow.ctaRow { margin-top: 20px; }
.btnRow.center { justify-content: center; }

button,
.primaryAction,
.secondary {
  appearance: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  min-height: var(--touch-min);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none;
}

button:hover,
.primaryAction:hover {
  background: var(--primary-hover);
}

button:focus-visible,
.primaryAction:focus-visible,
.secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 95, 176, 0.14);
}

button.primaryAction,
.primaryAction {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primaryAction:hover,
.primaryAction:hover {
  background: var(--primary-hover);
  box-shadow: none;
}

button.secondary,
.secondary {
  background: var(--mist);
  color: var(--primary);
  border-color: var(--border);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  filter: none;
}

button.secondary:hover,
.secondary:hover {
  background: #e4ebf5;
  border-color: rgba(47, 95, 176, 0.35);
  filter: none;
  transform: none;
}

.sectionHeader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sectionHeader h2 { margin: 0; }

.residentCard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  background: #fafbfc;
}

.residentCardHeader,
.vehicleBlockHeader,
.credRowHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.residentCardHeader strong {
  font-size: 0.95rem;
  color: var(--text);
}

.vehicleSection {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e8eaed;
}

.vehicleSection h3,
.credSection h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.credSection {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e8eaed;
}

.preorderQtyPanel {
  margin-top: 4px;
}

.preorderQtyPanel input[type="number"] {
  max-width: 7rem;
}

.vehicleBlock,
.credBlock {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.credBlockHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.credBlock .credRow {
  margin-bottom: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.credRow {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.credRow.noFc {
  grid-template-columns: 1.6fr 1.2fr auto;
}

.credRemove {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-weight: 700;
  min-width: var(--touch-min);
  padding: 10px 12px;
}

.credRemove:hover {
  background: #fff5f5;
}

.submitBar {
  margin-top: 8px;
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.submitBar button {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 12px 28px;
}

.successBanner,
.infoBanner,
.dangerBanner,
.warningBanner {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.successBanner {
  background: var(--banner);
  border: 1px solid #a5d6a7;
  color: var(--success);
  font-weight: 600;
}

.infoBanner {
  background: #e8f1fb;
  border: 1px solid #90caf9;
  color: #0d47a1;
}

.warningBanner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: var(--text);
}

.dangerBanner {
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #7a1f1a;
}

.csPortalFooter {
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 0 16px 24px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.3;
}
.csPortalFooter a {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.csPortalFooter a:hover { color: var(--ink); }

.submittedView {
  max-width: 640px;
  margin: 28px auto 16px;
}

.submittedCard {
  background: #fff;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  text-align: center;
}

.submittedCard h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.submittedCard p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.45;
}

.submittedCard .btnRow {
  margin-top: 20px;
  flex-direction: column;
  align-items: stretch;
}

.submittedCard .btnRow .primaryAction,
.submittedCard .btnRow .secondary,
.submittedCard .btnRow a {
  white-space: normal;
  line-height: 1.35;
  max-width: 100%;
  width: 100%;
  justify-content: center;
  text-decoration: none;
}

.adminLoginCard {
  max-width: 520px;
  margin: 0 auto;
}

.adminLoginCard h2 {
  text-align: center;
  color: var(--text);
}

.adminLoginCard .btnRow {
  justify-content: center;
}

.adminLoginCard button {
  min-width: 180px;
}

.hidden { display: none !important; }

/* Unidentified / unreadable credentials */
.unidentifiedSection .unidentifiedToggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 12px;
  font-weight: 500;
  cursor: pointer;
}
.unidentifiedSection .unidentifiedToggle input {
  margin-top: 3px;
}
.unidentifiedCountsPanel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.unidentifiedCountList {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}
.typeTestBlock {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.typeTestBlock:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}
.sameLocationToggle {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0 12px;
  font-size: 0.95rem;
}
.testRow {
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .credRow,
  .credRow.noFc {
    grid-template-columns: 1fr;
  }
  .credRemove { width: 100%; }
}

@media (max-width: 640px) {
  .page { padding-top: 12px; padding-bottom: 32px; }
  .fieldGrid { grid-template-columns: 1fr; }
  .csPortalBody .brand h1 { font-size: 1.15rem; }
  .card, .sectionCard { padding: 14px; }
  .submitBar button,
  .adminLoginCard button,
  .btnRow.stackMobile > button,
  .btnRow.stackMobile > .primaryAction,
  .btnRow.stackMobile > .secondary,
  .btnRow.stackMobile > a {
    width: 100%;
  }
  .topBar {
    flex-direction: column;
    align-items: stretch;
  }
}

.photoSlot {
  margin-top: 12px;
}
.photoSlotStatus,
.photoSlotName {
  margin: 6px 0 0;
}
