body {
  font-family: sans-serif;
  margin: 0;
  background: #f7f7f7;
  color: #222;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.panel {
  background: white;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hero-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%);
  padding: 18px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hero-kicker {
  font-size: 13px;
  font-weight: 700;
  color: #4d66a8;
  margin-bottom: 8px;
}

.hero-title {
  margin: 0 0 8px 0;
  font-size: 24px;
  line-height: 1.3;
}

.hero-desc {
  margin: 0;
  color: #555;
  font-size: 15px;
  line-height: 1.5;
}

.search-form {
  padding: 0;
  overflow: hidden;
}

.form-section {
  padding: 16px;
  border-bottom: 1px solid #ececec;
}

.form-section:last-child {
  border-bottom: 0;
}

.compact-top {
  padding-top: 8px;
}

.section-head {
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
}

.section-head p {
  margin: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.45;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}

input,
textarea,
button,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #d8d8d8;
  border-radius: 12px;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #8aa4e8;
  box-shadow: 0 0 0 3px rgba(138, 164, 232, 0.18);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

button {
  margin-top: 0;
  cursor: pointer;
  border: 0;
}

.cta-primary {
  background: #1f5eff;
  color: white;
  font-weight: 700;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 14px;
}

.cta-primary:active {
  transform: translateY(1px);
}

.quick-help {
  margin-top: 14px;
  padding: 12px;
  background: #f8faff;
  border: 1px solid #e4ebff;
  border-radius: 12px;
}

.quick-help-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.quick-help-list {
  margin: 0;
  padding-left: 18px;
  color: #555;
  font-size: 14px;
  line-height: 1.55;
}

.advanced-panel {
  margin: 0 16px 16px 16px;
  border: 1px solid #ececec;
  border-radius: 14px;
  background: #fafafa;
}

.advanced-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-note,
.textarea-help,
.cta-subtext {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.cta-panel {
  padding: 16px;
  background: #fff;
  position: sticky;
  bottom: 0;
  border-top: 1px solid #ececec;
}

.grid-2,
.grid-3,
.summary-grid,
.result-info-grid {
  display: grid;
  gap: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
}

.result-card {
  background: #ffffff;
  border: 1px solid #e7e7e7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #edf3ff;
  color: #21458a;
  font-size: 13px;
  font-weight: 700;
}

.score-pill strong {
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ok {
  background: #ebf8ef;
  color: #22653b;
  border: 1px solid #b9e0c4;
}

.badge-warn {
  background: #fff3df;
  color: #8a5a00;
  border: 1px solid #f0ca81;
}

.result-title {
  margin: 0 0 6px 0;
  font-size: 19px;
  line-height: 1.35;
}

.result-address {
  color: #555;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  word-break: break-word;
}

.info-box {
  background: #f8f9fb;
  border: 1px solid #eceef2;
  border-radius: 12px;
  padding: 10px;
}

.info-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.info-value {
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.facility-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.facility-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f2f4f8;
  color: #333;
  font-size: 13px;
  font-weight: 700;
}

.compare-note {
  margin-top: 10px;
  color: #666;
  font-size: 13px;
  line-height: 1.5;
}

.card-actions,
.actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1 1 160px;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 15px;
}

.action-primary {
  background: #1f5eff;
  color: #fff;
}

.action-secondary {
  background: #eef2fa;
  color: #24407c;
  border: 1px solid #d4dcef;
}

.summary-panel {
  padding: 14px 16px;
}

.summary-item {
  background: #f8f9fb;
  border: 1px solid #eceef2;
  border-radius: 12px;
  padding: 12px;
}

.summary-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-word;
}

.radius-panel {
  padding: 14px;
}

.radius-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.radius-kicker {
  font-size: 12px;
  color: #617194;
  font-weight: 700;
  margin-bottom: 4px;
}

.radius-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.radius-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: #f3f6fc;
  color: #42557d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.empty-state {
  color: #666;
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 2px;
}

.title-link {
  color: inherit;
  text-decoration: none;
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
}

.result-warning {
  margin-top: 12px;
}

.alert-warn {
  background: #fff4db;
  border: 1px solid #f0c36d;
}

.alert-error {
  background: #ffe4e4;
  border: 1px solid #dd7c7c;
}

.meta-line {
  margin-top: 8px;
  color: #555;
  font-size: 14px;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
}

/* stage 4 additions */
.baseline-panel .baseline-grid {
  display: grid;
  gap: 12px;
}

.baseline-wrap {
  word-break: break-word;
  line-height: 1.45;
}

.baseline-box {
  margin-top: 14px;
  padding: 12px;
  background: #f8f9fb;
  border: 1px solid #eceef2;
  border-radius: 12px;
}

.compact-head {
  margin-top: 16px;
}

.photo-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.photo-card {
  border: 1px solid #eceef2;
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
}

.photo-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.photo-meta {
  color: #555;
  font-size: 14px;
}

.visit-form .check-grid,
.visit-form .score-grid {
  display: grid;
  gap: 12px;
}

.check-card,
.score-card {
  border: 1px solid #eceef2;
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
}

.result-save-panel {
  border: 1px solid #dfe8ff;
  background: #fbfdff;
}

@media (min-width: 720px) {
  .container {
    padding: 20px;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .result-info-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .hero-title {
    font-size: 28px;
  }

  .baseline-panel .baseline-grid {
    grid-template-columns: 1fr 1fr;
  }

  .visit-form .check-grid {
    grid-template-columns: 1fr 1fr;
  }

  .visit-form .score-grid {
    grid-template-columns: 1fr 1fr;
  }

  .photo-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 719px) {
  .container {
    padding: 12px;
  }

  .panel,
  .hero-panel {
    border-radius: 14px;
  }

  .section-head h3 {
    font-size: 17px;
  }

  .cta-panel {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .radius-title {
    font-size: 20px;
  }

  .card-topline {
    align-items: stretch;
  }

  .score-pill,
  .badge {
    width: 100%;
    justify-content: center;
  }

  .action-btn {
    flex-basis: 100%;
  }

  .summary-grid,
  .result-info-grid,
  .visit-form .check-grid,
  .visit-form .score-grid,
  .baseline-panel .baseline-grid,
  .photo-list {
    grid-template-columns: 1fr;
  }
}

.compare-filter-form {
  padding: 0;
}

.compare-filter-form .card-actions {
  margin-top: 14px;
}

.compare-filter-form .cta-primary {
  width: 100%;
}

.rank-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.rank-chip {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef3ff;
  color: #2d4d91;
}

.rank-chip-top {
  background: #eaf8ef;
  color: #21643b;
  border: 1px solid #b9e0c4;
}

.rank-chip-good {
  background: #edf6ff;
  color: #22507b;
  border: 1px solid #c9ddf7;
}

.rank-chip-review {
  background: #fff4df;
  color: #8a5a00;
  border: 1px solid #f0ca81;
}

.rank-chip-low {
  background: #f3f3f3;
  color: #666;
  border: 1px solid #dddddd;
}

.compare-score-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.compare-score-card {
  border: 1px solid #eceef2;
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
}

.compare-score-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.compare-score-value {
  font-size: 18px;
  font-weight: 700;
  color: #222;
}

.compare-status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.compare-status-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f2f4f8;
  color: #333;
}

.compare-status-badge.visited {
  background: #ebf8ef;
  color: #22653b;
  border: 1px solid #b9e0c4;
}

.compare-status-badge.pending {
  background: #f3f3f3;
  color: #666;
  border: 1px solid #dddddd;
}

.compare-status-badge.warning {
  background: #fff4db;
  color: #8a5a00;
  border: 1px solid #f0c36d;
}

.compare-status-badge.mismatch {
  background: #ffe4e4;
  color: #8f2f2f;
  border: 1px solid #dd7c7c;
}

.compare-note-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8f9fb;
  border: 1px solid #eceef2;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}

.compare-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.compare-actions .action-btn {
  flex: 1 1 180px;
}

.compare-filter-bar {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .compare-score-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .compare-filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 719px) {
  .compare-score-grid,
  .compare-filter-bar {
    grid-template-columns: 1fr;
  }

  .compare-actions .action-btn {
    flex-basis: 100%;
  }
}

.alert-ok {
  background: #ebf8ef;
  border: 1px solid #b9e0c4;
  color: #22653b;
}
.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 247, 247, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e8e8e8;
}

.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.app-brand-wrap {
  min-width: 0;
}

.app-brand {
  display: inline-block;
  font-size: 18px;
  font-weight: 800;
  color: #1f2f57;
  text-decoration: none;
}

.app-subbrand {
  margin-top: 2px;
  font-size: 12px;
  color: #6a7590;
}

.app-topnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 999px;
  text-decoration: none;
  background: #eef3ff;
  color: #284a92;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #d6e0f7;
}

.app-main {
  padding-top: 16px;
  padding-bottom: 90px;
}

.app-progress {
  padding: 14px 16px;
}

.app-progress-title {
  font-size: 13px;
  font-weight: 700;
  color: #586786;
  margin-bottom: 10px;
}

.app-progress-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-progress-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f2f4f8;
  color: #42506a;
  font-size: 12px;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(247, 247, 247, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e6e6e6;
}

.bottom-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px;
  text-decoration: none;
  background: #eef2fa;
  color: #24407c;
  font-size: 15px;
  font-weight: 800;
  border: 1px solid #d4dcef;
}

.bottom-nav-link-primary {
  background: #1f5eff;
  color: #fff;
  border-color: #1f5eff;
}

.bottom-nav-label {
  line-height: 1;
}

@media (max-width: 719px) {
  .app-header-inner {
    padding: 10px 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .app-topnav {
    width: 100%;
  }

  .app-nav-link {
    flex: 1 1 auto;
  }

  .app-brand {
    font-size: 17px;
  }

  .app-subbrand {
    font-size: 11px;
  }
}

@media (min-width: 720px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 640px;
    bottom: 16px;
    border: 1px solid #e6e6e6;
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  }
}
.manual-rows {
  display: grid;
  gap: 14px;
}

.manual-row {
  background: #f8faff;
  border: 1px solid #dbe7ff;
  border-radius: 14px;
  padding: 14px;
}

.manual-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.manual-row-title {
  font-weight: 700;
  color: #20408a;
}

.manual-row-remove {
  border: 1px solid #f2b4b4;
  background: #fff5f5;
  color: #a11e1e;
  padding: 8px 10px;
  border-radius: 10px;
  width: auto;
}

.big-map {
  height: 560px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(31, 94, 255, 0.14);
}

.story-map {
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(24, 169, 87, 0.14);
  margin-top: 16px;
}

.candidate-number-icon-wrap {
  background: transparent;
  border: 0;
}

.candidate-number-icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 26px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.28));
}

.candidate-emoji {
  line-height: 1;
}

.candidate-number-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: #1f5eff;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  font-weight: 800;
  border: 2px solid #fff;
}

.candidate-card {
  scroll-margin-top: 90px;
}

.candidate-card-active {
  outline: 3px solid rgba(31, 94, 255, 0.28);
  box-shadow: 0 0 0 6px rgba(31, 94, 255, 0.12);
}

.map-popup-btn {
  width: auto;
  padding: 8px 10px;
  border-radius: 10px;
  background: #edf3ff;
  color: #20408a;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}

@media (max-width: 768px) {
  .big-map {
    height: 460px;
  }

  .story-map {
    height: 340px;
  }

  .manual-row-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
