/* Reports, drawn from the approved admin reports frames. */
#akashic-health-records-patient-portal-root .ak-reports {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#akashic-health-records-patient-portal-root .ak-reports .ak-report-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#akashic-health-records-patient-portal-root .ak-reports .ak-report-head > div:first-child {
  flex: 1;
  min-width: 0;
}

#akashic-health-records-patient-portal-root .ak-reports .ak-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

#akashic-health-records-patient-portal-root .report-filters {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0;
}

#akashic-health-records-patient-portal-root .report-filters .report-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* The deck draws Update reports as tall as the fields it sits beside. */
#akashic-health-records-patient-portal-root .report-filters .btn {
  height: var(--ak-field-height);
}

#akashic-health-records-patient-portal-root .report-row {
  display: grid;
  grid-template-columns: 38px minmax(180px, 1.1fr) repeat(3, minmax(92px, 0.65fr)) 18px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 17px 18px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* A phone row says its three figures in one line under the name, as the phone frame draws it. */
#akashic-health-records-patient-portal-root .report-line {
  display: none;
}

#akashic-health-records-patient-portal-root .report-row:last-child {
  border-bottom: 0;
}

#akashic-health-records-patient-portal-root .report-row:hover {
  background: var(--sunken);
}

#akashic-health-records-patient-portal-root .report-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sunken);
  color: var(--primary);
}

#akashic-health-records-patient-portal-root .report-name b,
#akashic-health-records-patient-portal-root .report-row .metric b,
#akashic-health-records-patient-portal-root .report-row .metric span {
  display: block;
}

#akashic-health-records-patient-portal-root .report-row .metric b {
  font-weight: 500;
  color: var(--ink-strong);
}

#akashic-health-records-patient-portal-root .report-row .metric b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

#akashic-health-records-patient-portal-root .ak-reports .good b,
#akashic-health-records-patient-portal-root .ak-reports .delta.good {
  color: var(--success);
}

#akashic-health-records-patient-portal-root .ak-reports .warn b {
  color: var(--warning);
}

#akashic-health-records-patient-portal-root .ak-reports .bad b,
#akashic-health-records-patient-portal-root .ak-reports .delta.bad {
  color: var(--danger);
}

#akashic-health-records-patient-portal-root .report-toolbar {
  margin: 14px 0;
}

/* The shared back link pushes what follows to the far end; here the range sits beside it instead. */
#akashic-health-records-patient-portal-root .report-toolbar .back-link {
  margin-right: 0;
}

#akashic-health-records-patient-portal-root .report-toolbar .range {
  margin-right: auto;
  font-size: 13px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .report-toolbar label,
#akashic-health-records-patient-portal-root .report-toolbar .report-field {
  display: flex;
  align-items: center;
  gap: 7px;
}

#akashic-health-records-patient-portal-root .report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

#akashic-health-records-patient-portal-root .report-stat .delta {
  display: block;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
}

#akashic-health-records-patient-portal-root .report-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

#akashic-health-records-patient-portal-root .report-chart-head b {
  display: block;
}

#akashic-health-records-patient-portal-root .report-chart-head .report-legend span {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

#akashic-health-records-patient-portal-root .report-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--primary);
}

#akashic-health-records-patient-portal-root .chart-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(64px, 1fr);
  align-items: end;
  gap: 18px;
  height: 112px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

#akashic-health-records-patient-portal-root .chart-period {
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 6px;
  text-align: center;
}

#akashic-health-records-patient-portal-root .chart-stack {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 78px;
  gap: 3px;
}

#akashic-health-records-patient-portal-root .chart-stack i {
  display: block;
  width: 13px;
  height: calc(var(--bar, 0) * 78px);
  min-height: 3px;
  background: var(--primary);
}

#akashic-health-records-patient-portal-root .chart-lines {
  display: grid;
  gap: 9px;
}

#akashic-health-records-patient-portal-root .chart-line {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

#akashic-health-records-patient-portal-root .chart-track {
  height: 9px;
  background: var(--sunken);
  overflow: hidden;
}

#akashic-health-records-patient-portal-root .chart-track i {
  display: block;
  width: calc(var(--bar, 0) * 100%);
  height: 100%;
  background: var(--primary);
}

#akashic-health-records-patient-portal-root .chart-line strong {
  text-align: right;
  font-weight: 500;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

#akashic-health-records-patient-portal-root .chart-period small {
  font-size: 10.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

#akashic-health-records-patient-portal-root .ak-reports i.good {
  background: var(--success);
}

#akashic-health-records-patient-portal-root .ak-reports i.warn {
  background: var(--warning);
}

#akashic-health-records-patient-portal-root .ak-reports i.bad {
  background: var(--danger);
}

#akashic-health-records-patient-portal-root .report-table td b {
  font-weight: 500;
}

#akashic-health-records-patient-portal-root .report-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#akashic-health-records-patient-portal-root .report-bar {
  display: flex;
  height: 7px;
  margin-top: 5px;
  overflow: hidden;
  background: var(--sunken);
}

#akashic-health-records-patient-portal-root .report-bar i {
  display: block;
  height: 100%;
}

#akashic-health-records-patient-portal-root .report-source {
  margin-top: 14px;
  align-items: center;
}

#akashic-health-records-patient-portal-root .ak-reports .ak-report-print-filters {
  display: none;
}

@media (max-width: 639px) {
  #akashic-health-records-patient-portal-root .report-filters {
    grid-template-columns: 1fr 1fr;
  }

  #akashic-health-records-patient-portal-root .report-filters .period,
  #akashic-health-records-patient-portal-root .report-filters .location,
  #akashic-health-records-patient-portal-root .report-filters .btn {
    grid-column: 1 / -1;
  }

  #akashic-health-records-patient-portal-root .report-row {
    grid-template-columns: 34px minmax(0, 1fr) 14px;
    padding: 14px 12px;
  }

  #akashic-health-records-patient-portal-root .report-row .metric,
  #akashic-health-records-patient-portal-root .report-about {
    display: none;
  }

  #akashic-health-records-patient-portal-root .report-line {
    display: block;
  }

  #akashic-health-records-patient-portal-root .report-summary {
    grid-template-columns: 1fr 1fr;
  }

  #akashic-health-records-patient-portal-root .ak-reports .ak-report-head {
    flex-wrap: wrap;
  }

  #akashic-health-records-patient-portal-root .report-toolbar .range {
    flex-basis: 100%;
  }

  /* The title takes its own row on a phone; the actions follow beneath it. */
  #akashic-health-records-patient-portal-root .ak-reports .ak-report-head > div:first-child {
    flex-basis: 100%;
  }
}

@media print {
  #akashic-health-records-patient-portal-root .ak-reports .ak-report-print-filters {
    display: block;
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ink-muted);
  }

  #akashic-health-records-patient-portal-root .report-chart,
  #akashic-health-records-patient-portal-root .report-table tr {
    break-inside: avoid;
  }

  #akashic-health-records-patient-portal-root .ak-reports i.good,
  #akashic-health-records-patient-portal-root .ak-reports i.warn,
  #akashic-health-records-patient-portal-root .ak-reports i.bad {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
