/* ---------- Mother profile, trends, charts, timeline ---------- */
.seg {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
}
.seg button {
  flex: none;
  white-space: nowrap;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-weight: 650;
  color: var(--muted);
}
.seg button[aria-selected='true'] {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-raised);
}
.woman-row .grow small + small.woman-why {
  color: var(--review);
  font-weight: 600;
}
.sev {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.sev-urgent {
  background: var(--review);
  color: #fff;
}
.sev-review {
  background: var(--reviewbg);
  color: var(--review);
}
.sev-watch {
  background: #fff6df;
  color: var(--amber);
}
.sev-ok {
  background: var(--greenbg);
  color: var(--green);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.back-link svg {
  transform: rotate(180deg);
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}
.facts span {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  font-size: 13px;
}
.profile-actions {
  margin: 0 0 16px;
}
.preg-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.preg-week {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 750;
}
.preg-bar {
  position: relative;
  height: 14px;
  margin: 16px 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  overflow: hidden;
}
.preg-bar b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--r-pill);
  background: var(--grad-primary, var(--rose-600));
  opacity: 0.85;
}
.anc-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  border-inline: 2px solid var(--surface-solid);
}
.anc-mark.done {
  box-shadow: inset 0 -4px 0 var(--green);
}
.anc-mark.missed {
  box-shadow: inset 0 -4px 0 var(--review);
}
.anc-mark.due {
  box-shadow: inset 0 -4px 0 var(--amber);
}
.preg-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.findings {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.finding {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  border-inline-start: 4px solid var(--line-strong);
}
.finding.lvl-urgent {
  background: var(--reviewbg);
  color: inherit;
  border-color: var(--review);
}
.finding.lvl-review {
  border-color: var(--review);
  color: inherit;
}
.finding.lvl-watch {
  border-color: var(--amber);
  background: var(--surface-sunk);
  color: inherit;
}
.finding p {
  margin: 4px 0;
  line-height: 1.45;
}
.finding small {
  display: block;
  color: var(--muted);
}
.finding strong {
  display: block;
}
.sub-head {
  margin: 18px 0 8px;
  font-size: 15px;
}
.source {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.anc-steps.hbnc-steps {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
}
.anc-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.anc-step {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
}
.anc-step small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.anc-step em {
  font-style: normal;
  font-size: 13px;
  font-weight: 650;
}
.anc-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid var(--line-strong);
  font-weight: 700;
}
.anc-dot svg {
  width: 16px;
  height: 16px;
}
.anc-step.done .anc-dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.anc-step.done em {
  color: var(--green);
}
.anc-step.missed .anc-dot {
  border-color: var(--review);
  color: var(--review);
}
.anc-step.missed em {
  color: var(--review);
}
.anc-step.due .anc-dot {
  border-color: var(--amber);
  color: var(--amber);
}
.anc-step.due em {
  color: var(--amber);
}
.trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.trend-chart {
  margin: 0;
  min-width: 0;
}
.trend-chart figcaption {
  font-weight: 650;
  margin-bottom: 6px;
}
.line-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}
.line-chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.line-chart .axis {
  fill: var(--muted);
  font-size: 10px;
}
.line-chart .axis-title {
  font-size: 10px;
}
.line-chart .limit {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.line-chart .limit-label {
  fill: var(--muted);
  font-size: 10px;
}
.line-chart .series {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.line-chart .dot {
  stroke: var(--surface-solid);
  stroke-width: 2;
}
.line-chart .hit {
  fill: transparent;
}
.line-chart .pt {
  cursor: pointer;
  outline: none;
}
.line-chart .pt:focus-visible .dot,
.line-chart .pt:hover .dot {
  r: 6;
}
.line-chart .value-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}
.legend {
  display: flex;
  gap: 14px;
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.chart-table summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.chart-table table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.chart-table th,
.chart-table td {
  text-align: start;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.chart-tip {
  position: absolute;
  z-index: 50;
  transform: translate(-50%, -100%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  inset: 8px auto 8px 17px;
  width: 2px;
  background: var(--line);
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
}
.tl-icon {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 2px solid var(--line-strong);
}
.tl-icon svg {
  width: 16px;
  height: 16px;
}
.timeline li.lvl-urgent .tl-icon,
.timeline li.lvl-review .tl-icon {
  border-color: var(--review);
  color: var(--review);
  background: var(--reviewbg);
}
.tl-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  text-align: start;
  min-height: 0;
}
.tl-title time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.timeline p {
  margin: 4px 0 0;
}
.tl-tag {
  color: var(--review);
  font-weight: 600;
  font-size: 13px;
}
.timeline small {
  color: var(--muted);
}
@media (max-width: 900px) {
  .trend-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 660px) {
  .anc-steps,
  .anc-steps.hbnc-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preg-week {
    font-size: 1.35rem;
  }
}

/* ---------- Block analytics ---------- */
.an-filters {
  margin-bottom: 12px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  text-align: start;
  min-height: 0;
}
.kpi strong {
  font-size: 1.8rem;
  line-height: 1.1;
}
.kpi span {
  font-weight: 600;
  font-size: 0.9rem;
}
.kpi small {
  color: var(--muted);
  font-size: 0.8rem;
}
.kpi.alert strong {
  color: var(--review);
}
button.kpi:hover {
  border-color: var(--rose-300);
}
.an-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.hbar-row {
  display: grid;
  grid-template-columns: minmax(80px, 34%) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.hbar-label {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.hbar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0;
}
.hbar {
  flex: 1;
  display: flex;
  gap: 2px;
  height: 14px;
}
.hbar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  min-width: 0;
}
.hbar i[style*='width:0%'] {
  display: none;
}
.hbar-btn b {
  min-width: 2ch;
  font-size: 0.9rem;
}
.seg-urgent {
  background: var(--review);
}
.seg-review {
  background: #e3a24b;
}
.seg-one {
  background: var(--rose-600);
}
.legend i.seg-urgent,
.legend i.seg-review {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.cols {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  height: 180px;
  padding-top: 10px;
}
.col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  outline: none;
}
.col-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 70%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--rose-300);
  overflow: hidden;
}
.col-bar i {
  display: block;
  width: 100%;
  background: var(--rose-700);
}
.col b {
  font-size: 0.8rem;
}
.col small {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.col:focus-visible .col-bar {
  outline: 3px solid #a36102;
}
.table-wrap {
  overflow-x: auto;
}
.perf {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.perf th,
.perf td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: end;
  white-space: nowrap;
}
.perf thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}
.perf th:first-child {
  text-align: start;
}
.perf td.alert {
  color: var(--review);
  font-weight: 700;
}
.drill.link {
  color: var(--rose-700);
  font-weight: 650;
  min-height: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.drill-panel {
  border: 2px solid var(--rose-200);
}
@media (max-width: 760px) {
  .an-grid {
    grid-template-columns: 1fr;
  }
  .cols {
    gap: 4px;
  }
  .col small {
    font-size: 0.6rem;
  }
}

/* ---------- Guided interview ---------- */
.iv-progress {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.iv-bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  overflow: hidden;
}
.iv-bar b {
  display: block;
  height: 100%;
  background: var(--grad-primary, var(--rose-600));
  transition: width 0.3s;
}
.iv-question {
  margin: 22px 0 8px;
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.3;
}
.iv-yesno {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 6px;
}
.iv-yesno button {
  min-height: 64px;
  font-size: 1.15rem;
  justify-content: center;
}
.iv-typed {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 16px 0 6px;
}
.iv-typed label {
  display: grid;
  gap: 6px;
  flex: 1 1 12rem;
}
.iv-controls {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------- Counselling ---------- */
.counsel-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.counsel-item {
  padding: 14px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  border-inline-start: 4px solid var(--rose-300);
}
.counsel-item p {
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.55;
}
.counsel-item.reading-field {
  outline: 3px solid var(--sky-500);
  background: var(--sky-100);
}
.counsel-foot {
  display: flex;
  align-items: center;
  gap: 12px;
}
.counsel-foot small {
  color: var(--green);
  font-weight: 600;
}

/* ---------- Ask Saathi ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
}
.chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  font-size: 0.92rem;
  text-align: start;
}
.ask-answer {
  margin: 16px 0;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--sky-100);
  border-inline-start: 4px solid var(--sky-500);
}
.ask-answer.unknown {
  background: var(--surface-sunk);
  border-color: var(--line-strong);
}
.ask-answer p {
  margin: 8px 0;
  font-size: 1.1rem;
  line-height: 1.55;
}
.ask-answer small {
  color: var(--muted);
}
.quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* ---------- Medicine stock ---------- */
.stock-rows {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}
.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
}
.stock-row.low {
  background: var(--reviewbg);
}
.stock-row small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.stock-row b {
  font-size: 1.3rem;
  text-align: end;
}
.stock-row b small {
  display: inline;
  font-size: 0.75rem;
  font-weight: 500;
}
.stock-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.stock-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.stock-form select,
.stock-form input {
  width: 100%;
  min-width: 0;
}
.fp-history {
  margin: 0 0 10px;
  padding-inline-start: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.line-chart .series.reference {
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.child-card {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.child-card:first-of-type {
  border-top: 0;
}
.weigh-form {
  margin-top: 10px;
}
.weigh-form button svg {
  width: 16px;
  height: 16px;
  margin-inline-end: 6px;
}

.member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.member-row small {
  flex-basis: 100%;
  color: var(--muted);
}
