:root {
  --teal: #0f6e6a;
  --teal-dark: #0a4f4c;
  --teal-light: #e6f2f1;
  --bg: #f7f8f8;
  --text: #1c2625;
  --muted: #5b6967;
  --border: #dfe5e4;
  --green: #1f8a4c;
  --green-bg: #e7f6ec;
  --amber: #a16207;
  --amber-bg: #fef3d6;
  --red: #b3261e;
  --red-bg: #fbe6e4;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

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

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Calm healthcare-themed backdrop: a soft teal-tinted vertical wash with a
     faint repeating medical-cross motif. Kept very low-contrast so it reads as
     subtle texture rather than visual noise. */
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, var(--teal-light) 0%, var(--bg) 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M24 12h8v10h10v8H32v10h-8V30H14v-8h10z' fill='%230f6e6a' fill-opacity='0.17'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-attachment: fixed, fixed;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--teal);
  color: white;
  padding-top: calc(10px + var(--safe-top));
  padding-bottom: 10px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.brand-mark { font-size: 1.2rem; }

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.15); }
.icon-btn-spacer { width: 36px; height: 36px; display: inline-block; }

.view {
  flex: 1;
  padding: 16px 16px 24px;
}

.tagline { color: var(--muted); margin-top: 0; }

.card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
}
.card-btn.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.card-btn-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.card-btn-sub { font-size: 0.88rem; opacity: 0.85; }

.disclaimer-box {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--teal-light);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.4;
}

.sources-note {
  margin-top: 12px;
  font-size: 0.74rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.45;
}
.sources-note strong { color: var(--text); }

.support-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  text-decoration: none;
  color: var(--text);
}
.support-link:active { background: var(--teal-light); }
.support-icon {
  font-size: 1.25rem;
  color: var(--teal);
  flex-shrink: 0;
}
.support-text { display: flex; flex-direction: column; gap: 2px; }
.support-title { font-weight: 700; font-size: 0.92rem; color: var(--teal-dark); }
.support-sub { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress-fill { height: 100%; background: var(--teal); transition: width 0.2s; }

.step-title { font-size: 1.2rem; margin: 0 0 14px; }

/* First-launch acknowledgment */
.ack-body {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.ack-body p { margin: 0 0 12px; }
.ack-body p:last-child { margin-bottom: 0; }
.ack-btn { width: 100%; margin: 18px 0 0; }

/* Recurring institutional-policy reminder on results screens */
.policy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--teal-light);
  border: 1px solid #bfdedb;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--teal-dark);
}
.policy-note-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }

/* Compare Line Types table */
.compare-hint { font-size: 0.82rem; color: var(--muted); margin: -6px 0 14px; line-height: 1.4; }

.flow-note {
  font-size: 0.83rem;
  color: var(--teal-dark);
  background: var(--teal-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0 0 16px;
  line-height: 1.45;
}
.flow-note strong { color: var(--text); }
.compare-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
.compare-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.82rem;
}
.compare-table th, .compare-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.4;
}
.compare-table thead th {
  background: var(--teal);
  color: white;
  font-weight: 600;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td { border-bottom: none; }
/* Sticky first column so the line name stays visible while scrolling */
.compare-table th[scope="col"]:first-child,
.compare-name {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--teal-light);
  font-weight: 700;
  color: var(--text);
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  white-space: normal;
  box-shadow: 1px 0 0 var(--border);
}
.compare-table thead th:first-child { background: var(--teal-dark); color: white; z-index: 2; }
.compare-table td:nth-child(3) { min-width: 200px; }
.compare-table td:nth-child(5) { min-width: 210px; }

.access-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.access-badge.is-peripheral { background: var(--green-bg); color: var(--green); }
.access-badge.is-central { background: var(--teal-light); color: var(--teal-dark); }

.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
  text-align: left;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.35;
}
.option-btn.selected {
  border-color: var(--teal);
  background: var(--teal-light);
  font-weight: 600;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 10px;
}

.btn-primary {
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-text {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
}

.advisory-box {
  background: var(--amber-bg);
  border: 1px solid #f3d98b;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.advisory-box strong { display: block; margin-bottom: 6px; color: var(--amber); }
.advisory-box ul { margin: 0; padding-left: 18px; line-height: 1.45; }

.results-list { display: flex; flex-direction: column; gap: 12px; }

.result-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.result-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}
.result-name { font-weight: 700; }

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-appropriate { background: var(--green-bg); color: var(--green); }
.tag-neutral { background: var(--amber-bg); color: var(--amber); }
.tag-inappropriate { background: var(--red-bg); color: var(--red); }

.result-reasons { margin: 0; padding-left: 18px; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }

.device-list { display: flex; flex-direction: column; gap: 12px; }
.device-card {
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
}
.device-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.device-name { font-weight: 700; }
.device-category { font-size: 0.75rem; color: var(--teal-dark); background: var(--teal-light); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.device-blurb { margin: 6px 0 0; font-size: 0.86rem; color: var(--muted); }

.device-blurb-large { color: var(--muted); margin-top: -6px; }

.detail-section { margin-top: 18px; }
.detail-section h3 { font-size: 0.95rem; margin-bottom: 8px; color: var(--teal-dark); }
.detail-section ul { margin: 0; padding-left: 18px; line-height: 1.5; font-size: 0.92rem; }
.detail-section p { font-size: 0.92rem; line-height: 1.5; margin: 0; }

.app-footer {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  padding: 14px 20px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
}
