/* ─── medical.css (v10.32) ────────────────────────────────────────── */
/* Encrypted health records module. Matches the broader Midnight theme
   used throughout the House. Color tokens (--accent, --accent2, --fg,
   --dim, --bg) come from the global stylesheet. */

/* ─── full-screen "screen" containers (setup / lock / recovery) ───── */
.med-screen {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 14px;
  overflow-y: auto;
}
.med-screen-content {
  max-width: 540px;
  width: 100%;
}
.med-screen-content h3 {
  margin: 0 0 12px 0;
  color: var(--accent);
}
.med-lock-screen {
  text-align: center;
}
.med-lock-icon {
  font-size: 3em;
  margin-bottom: 8px;
}

/* ─── recovery code printable card preview ─────────────────────────── */
.med-recovery-card {
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 20px;
  margin: 14px 0;
  background: rgba(176,230,176,0.05);
  text-align: center;
}
.med-recovery-title {
  color: var(--accent);
  font-size: 0.9em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.med-recovery-code {
  font-size: 1.7em;
  font-weight: bold;
  letter-spacing: 3px;
  padding: 14px 0;
  font-family: var(--mono, ui-monospace, monospace);
  word-break: break-all;
}
.med-recovery-meta {
  font-size: 0.8em;
  margin-top: 8px;
}

/* ─── header (unlocked) ───────────────────────────────────────────── */
.med-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--accent2);
  flex-shrink: 0;
  gap: 10px;
}
.med-header-title {
  flex: 1;
  min-width: 0;
}
.med-header-title h3 {
  margin: 0;
  font-size: 1.05em;
  color: var(--accent);
}
.med-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.med-lock-countdown {
  font-size: 0.85em;
  font-family: var(--mono, monospace);
}

/* ─── tabs strip ─────────────────────────────────────────────────── */
.med-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--accent2);
  overflow-x: auto;
  flex-shrink: 0;
}
.med-tab {
  padding: 6px 10px;
  font-size: 0.85em;
  white-space: nowrap;
  color: var(--dim);
  text-decoration: none;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
}
.med-tab:hover {
  color: var(--fg);
}
.med-tab.active {
  color: var(--accent);
  border-color: var(--accent2);
  background: rgba(176,230,176,0.08);
}

/* ─── main content scroll area ───────────────────────────────────── */
.med-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* ─── people grid (unlocked, top-level) ──────────────────────────── */
.med-people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}
.med-person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px;
  border: 1px solid var(--accent2);
  border-radius: 4px;
  background: rgba(176,230,176,0.03);
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
}
.med-person-card:hover {
  border-color: var(--accent);
  background: rgba(176,230,176,0.1);
}
.med-person-icon {
  font-size: 2.2em;
  margin-bottom: 4px;
}
.med-person-name {
  font-size: 1em;
  color: var(--fg);
  margin-bottom: 2px;
}
.med-person-rel {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.med-person-stats {
  font-size: 0.78em;
  margin-top: 4px;
}

/* ─── sections within person detail ──────────────────────────────── */
.med-section {
  margin-top: 18px;
  border-top: 1px solid var(--accent2);
  padding-top: 12px;
}
.med-section-h {
  color: var(--accent);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ─── essentials section grids + rows ────────────────────────────── */
.med-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}
@media (max-width: 600px) {
  .med-grid-2 { grid-template-columns: 1fr; }
}
.med-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.med-row input[type="text"] {
  font-size: 0.9em;
  padding: 4px 6px;
}
.med-row-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  text-decoration: none;
  color: var(--dim);
  font-size: 1.1em;
  cursor: pointer;
  border-radius: 2px;
}
.med-row-del:hover {
  color: #e07a7a;
  background: rgba(224,122,122,0.1);
}
@media (max-width: 600px) {
  .med-row { grid-template-columns: 1fr auto; gap: 4px; }
  .med-row input[type="text"] { grid-column: 1; }
  .med-row-del { grid-row: 1; }
}

/* ─── action rows (buttons) ──────────────────────────────────────── */
.med-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.med-btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--accent2);
  border-radius: 3px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.med-btn:hover {
  border-color: var(--accent);
  background: rgba(176,230,176,0.08);
}
.med-btn.primary {
  border-color: var(--accent);
  background: rgba(176,230,176,0.12);
  color: var(--accent);
}
.med-btn.primary:hover {
  background: rgba(176,230,176,0.2);
}
.med-btn.small {
  padding: 4px 8px;
  font-size: 0.85em;
}

/* ─── inline links inside sections ───────────────────────────────── */
.med-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9em;
}
.med-link:hover {
  text-decoration: underline;
}
.med-back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85em;
  cursor: pointer;
  margin-right: 8px;
}
.med-back:hover {
  text-decoration: underline;
}

/* ─── files grid (insurance cards, lab results, etc.) ───────────── */
.med-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 8px 0;
}
.med-file-card {
  border: 1px solid var(--accent2);
  border-radius: 4px;
  padding: 10px;
  background: rgba(176,230,176,0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.med-file-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 2px;
  background: rgba(176,230,176,0.05);
}
.med-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  font-size: 3em;
  color: var(--dim);
  background: rgba(176,230,176,0.05);
  border-radius: 2px;
}
.med-file-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.med-file-label {
  font-size: 0.92em;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.med-file-kind {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.med-file-actions {
  display: flex;
  gap: 10px;
  font-size: 0.85em;
}

/* ─── audit log list ─────────────────────────────────────────────── */
.med-audit-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  font-family: var(--mono, monospace);
  font-size: 0.85em;
  max-height: 400px;
  overflow-y: auto;
}
.med-audit-list li {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(176,230,176,0.08);
}
.med-audit-list li:last-child {
  border-bottom: none;
}

/* ─── mobile tweaks ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .med-content { padding: 10px; }
  .med-people-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .med-person-icon { font-size: 1.8em; }
  .med-recovery-code { font-size: 1.3em; letter-spacing: 2px; }
  .med-header-actions { gap: 4px; }
  .med-lock-countdown { font-size: 0.75em; }
}

/* ─── v10.33: section item list + items + status badges ──────────── */

/* group headers inside a section (e.g. "active (3)" / "historical (1)") */
.med-group-h {
  color: var(--accent);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent2);
}

/* empty state placeholder */
.med-empty {
  font-style: italic;
  padding: 10px 0;
}

/* list of items inside a section */
.med-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

/* a single item card */
.med-item {
  border: 1px solid var(--accent2);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(176,230,176,0.03);
}
.med-item:hover {
  border-color: rgba(176,230,176,0.4);
}
.med-item-h {
  margin-bottom: 6px;
}
.med-item-title {
  font-size: 1em;
  color: var(--fg);
  font-weight: 500;
}
.med-item-sub {
  font-size: 0.85em;
  margin-top: 2px;
}
.med-item-body {
  font-size: 0.9em;
  margin: 4px 0;
}
.med-item-actions {
  display: flex;
  gap: 12px;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(176,230,176,0.1);
  font-size: 0.85em;
}

/* key:value detail row inside an item */
.med-detail-row {
  margin: 2px 0;
  line-height: 1.5;
}
.med-detail-label {
  color: var(--dim);
  font-size: 0.85em;
  margin-right: 4px;
}
.med-detail-value {
  color: var(--fg);
}
.med-detail-value.med-multiline {
  display: block;
  white-space: pre-wrap;
  margin-top: 2px;
  padding-left: 8px;
  border-left: 2px solid var(--accent2);
}
.med-notes {
  white-space: pre-wrap;
  padding: 6px 8px;
  margin-top: 6px;
  background: rgba(176,230,176,0.04);
  border-radius: 2px;
  font-size: 0.88em;
}

/* sensitive (masked) field */
.med-sensitive {
  font-family: var(--mono, ui-monospace, monospace);
  letter-spacing: 1px;
}
.med-sens-toggle {
  margin-left: 6px;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* status / due / overdue badges */
.med-badge {
  display: inline-block;
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: middle;
}
.med-badge-chronic    { background: rgba(160,200,255,0.15); color: #a0c8ff; border: 1px solid rgba(160,200,255,0.3); }
.med-badge-monitoring { background: rgba(240,200,120,0.15); color: #f0c878; border: 1px solid rgba(240,200,120,0.3); }
.med-badge-resolved   { background: rgba(176,230,176,0.15); color: var(--accent); border: 1px solid var(--accent2); }
.med-badge-soon       { background: rgba(240,200,120,0.18); color: #f0c878; border: 1px solid rgba(240,200,120,0.35); }
.med-badge-overdue    { background: rgba(224,122,122,0.2); color: #e07a7a; border: 1px solid rgba(224,122,122,0.4); }

/* insurance card photo previews */
.med-card-photos {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.med-card-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--fg);
}
.med-card-photo img {
  width: 160px;
  height: 100px;
  object-fit: cover;
  border: 1px solid var(--accent2);
  border-radius: 3px;
  background: rgba(176,230,176,0.05);
}
.med-card-photo:hover img {
  border-color: var(--accent);
}
.med-card-photo span {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* small helper */
.med-fh-item .med-item-body { font-size: 0.88em; }
.dim.small { font-size: 0.8em; }

/* ─── v10.33: mobile tweaks for new sections ─────────────────────── */
@media (max-width: 700px) {
  .med-item { padding: 8px 10px; }
  .med-item-title { font-size: 0.95em; }
  .med-item-sub { font-size: 0.8em; }
  .med-item-body { font-size: 0.85em; }
  .med-detail-label { display: block; }
  .med-detail-value.med-multiline { margin-left: 0; }
  .med-card-photo img { width: 130px; height: 80px; }
}
