/* questions: quiet rows that open into a small card (after Things) */
.modal-foot .q-delete {
  margin-right: auto;
}
.q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.q-head .card-title {
  margin: 0;
}
.q-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--btn-primary);
  color: var(--btn-primary-ink);
  font-size: 0.78rem;
  font-weight: 700;
}
.q-list {
  list-style: none;
  margin: 0 -8px;
  padding: 0;
}
.q-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  cursor: default;
  overflow: hidden;
}
.q-row:not(.open):not(.q-new):hover {
  background: var(--surface-2);
}
.q-circle {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  padding: 0;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: none;
  color: transparent;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.q-circle:hover {
  border-color: var(--accent);
}
.q-circle:active {
  transform: scale(0.9);
}
.q-circle[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}
.q-title {
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: default;
}
.q-row.checking .q-title,
.q-row.done .q-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}
.q-row.checking .q-title {
  transition: color 0.3s;
}
.q-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.q-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.q-preview {
  grid-column: 2 / 4;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}
@media (max-width: 520px) {
  /* On phones the visit goes under the question rather than beside it. */
  .q-tags {
    grid-column: 2 / 4;
    grid-row: 2;
  }
  .q-preview {
    grid-row: 3;
  }
}
.q-row.leaving {
  animation: q-leave 0.22s ease-in forwards;
}
@keyframes q-leave {
  from {
    opacity: 1;
    max-height: 120px;
  }
  to {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}
.q-row.open {
  display: block;
  padding: 4px 0;
  overflow: visible;
}
.q-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  animation: q-open 0.16s ease-out;
}
@keyframes q-open {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}
.q-card-title,
.q-card-notes {
  width: 100%;
  padding: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: none;
  overflow: hidden;
}
.q-card-title {
  font-size: 1rem;
  font-weight: 600;
}
.q-card-notes {
  min-height: 2.6em;
  color: var(--text-2);
  font-size: 0.9rem;
}
.q-card-title::placeholder,
.q-card-notes::placeholder {
  color: var(--muted);
  font-weight: 400;
}
.q-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.q-card-foot .spacer {
  flex: 1;
}
.q-card-delete {
  color: var(--muted);
}
.q-card-delete:hover {
  color: var(--danger);
}
.q-visit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font: 600 0.8rem var(--font);
  cursor: pointer;
}
.q-visit-none {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
}
.q-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.q-new-btn .icon {
  width: 20px;
  color: var(--accent);
}
.q-new-btn:hover {
  color: var(--text);
}
.q-row.q-new {
  grid-template-columns: 1fr;
}
.q-asked {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.q-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 8px;
}
.q-foot .hint {
  margin: 0;
}
.q-show-asked {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: 600 0.82rem var(--font);
  cursor: pointer;
}
.q-show-asked:hover {
  color: var(--text);
}
.appt-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}
/* Buttons sit at the bottom so they line up across a row. */
.appt-grid > .card {
  display: flex;
  flex-direction: column;
}
.appt-grid .card-foot {
  margin-top: auto;
  padding-top: 12px;
}
/* Regimen changes and lab results, tiled like appointments (newest first, under section titles). */
.tile-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}
.review-list {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.review-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.tile-list-wide {
  grid-template-columns: minmax(0, 1fr);
}
.tile-list .meds {
  margin-top: 8px;
}
/* Lab tiles side by side line up part by part: each card spans four rows of the
   grid (head, values, details, foot) and shares them, so dates, value boxes and
   what follows start at the same height across a row. */
.lab-tiles > .lab-card {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
  align-content: start;
}
/* Value boxes fill their part, so a card with fewer lines per box still matches,
   and stay two across, so each result keeps the same column from tile to tile. */
.lab-tiles .lab-values {
  height: 100%;
}
.lab-tiles .lab-values[data-n='3'],
.lab-tiles .lab-values[data-n='4'] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.appt-questions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.inline-notes {
  margin-top: 10px;
}
.appt-linked {
  margin-top: 10px;
}
.appt-linked .meds,
.appt-linked .extras {
  margin: 4px 0;
}
/* Pull left rather than drop the padding, so the text lines up with the card
   while the hover pill keeps even padding on both sides. */
.appt-linked .btn-text {
  margin-left: -10px;
}
.inline-notes-text {
  display: block;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 6px 8px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: text;
}
.inline-notes-text:hover {
  background: var(--surface-2);
}
.inline-notes-box {
  display: block;
  width: 100%;
  min-height: 2.6em;
  padding: 6px 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text-2);
  font: inherit;
  line-height: 1.45;
  resize: none;
  overflow: hidden;
}
.inline-notes-box::placeholder {
  color: var(--muted);
}
.q-subhead {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
@media (prefers-reduced-motion: reduce) {
  .q-card,
  .q-row.leaving {
    animation: none;
  }
}

