:root {
  --navy: #0d1b2a;
  --ink: #17212b;
  --muted: #6b7785;
  --line: #e6ebef;
  --surface: #ffffff;
  --canvas: #f5f7f8;
  --blue: #1976d2;
  --blue-soft: #e9f2fc;
  --green: #2d9d78;
  --green-soft: #e5f5ee;
  --yellow: #e2a72e;
  --yellow-soft: #fff5dc;
  --red: #d65b57;
  --red-soft: #fcebea;
  --shadow: 0 10px 28px rgba(13, 27, 42, 0.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.app-shell { min-height: 100vh; }
.topbar { align-items: center; background: var(--navy); color: #fff; display: flex; justify-content: space-between; padding: 18px clamp(20px, 5vw, 72px); }
.brand, .house-status, .toolbar, .card-header, .footer-actions, .report-header { align-items: center; display: flex; }
.brand { cursor: pointer; gap: 12px; user-select: none; }
.brand-logo {
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: block;
  flex-shrink: 0;
  height: 42px;
  object-fit: cover;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  width: 42px;
}
.brand:hover .brand-logo {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transform: scale(1.05);
}
.brand-mark { align-items: center; background: #e9b949; border-radius: 12px; color: var(--navy); display: flex; font-size: 15px; font-weight: 850; height: 42px; justify-content: center; letter-spacing: -.05em; width: 42px; }
.eyebrow { color: #9fb3c8; font-size: 10px; font-weight: 800; letter-spacing: .13em; margin: 0 0 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 20px; letter-spacing: -.03em; margin-bottom: 0; }
.house-status { color: #c9d5df; font-size: 12px; gap: 8px; }
.status-dot { background: #53d39d; border-radius: 50%; display: inline-block; height: 8px; width: 8px; }
.divider { background: #b4bec6; display: inline-block; height: 15px; margin: 0 5px; opacity: .6; vertical-align: middle; width: 1px; }
.topbar .divider { background: #405366; height: 18px; }
main { margin: 0 auto; max-width: 1260px; padding: 38px 24px 70px; }
.page-heading { margin-bottom: 28px; }
.page-heading h2 { font-size: clamp(26px, 3vw, 36px); letter-spacing: -.045em; margin-bottom: 8px; }
.page-heading p { color: var(--muted); margin-bottom: 0; }
.toolbar { gap: 10px; justify-content: flex-end; margin-bottom: 25px; }
.button { background: var(--surface); border: 1px solid #d5dde4; border-radius: 9px; color: var(--ink); font-size: 13px; font-weight: 750; padding: 11px 15px; transition: .18s ease; }
.button:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-1px); }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: #125da9; color: #fff; }
.button.subtle { background: transparent; border-color: transparent; color: var(--muted); }
.roster-grid { display: grid; gap: 15px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.resident-card, .panel, .domain-card, .report-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.resident-card { padding: 21px; }
.card-header { gap: 13px; justify-content: space-between; }
.resident-info { align-items: center; display: flex; gap: 12px; }
.avatar { align-items: center; background: var(--blue-soft); border-radius: 50%; color: var(--blue); display: flex; flex: 0 0 auto; font-size: 14px; font-weight: 850; height: 44px; justify-content: center; width: 44px; }
.resident-name { font-size: 16px; font-weight: 800; margin: 0 0 3px; }
.resident-meta { color: var(--muted); font-size: 12px; margin: 0; }
.checkin-state { background: var(--yellow-soft); border-radius: 100px; color: #956c10; font-size: 11px; font-weight: 800; padding: 6px 9px; white-space: nowrap; }
.checkin-state.done { background: var(--green-soft); color: #197251; }
.dot-strip { display: flex; gap: 7px; margin: 21px 0 16px; }
.grade-dot { border-radius: 50%; height: 10px; width: 10px; }
.grade-dot.green { background: var(--green); }
.grade-dot.yellow { background: var(--yellow); }
.grade-dot.red { background: var(--red); }
.card-footer { align-items: center; border-top: 1px solid var(--line); display: flex; justify-content: space-between; padding-top: 15px; }
.small-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.link-button { background: none; border: 0; color: var(--blue); font-size: 12px; font-weight: 800; padding: 0; }
.checkin-shell { margin: 0 auto; max-width: 1060px; }
.checkin-nav { align-items: center; display: flex; justify-content: space-between; margin-bottom: 20px; }
.back-link { color: var(--muted); font-size: 13px; font-weight: 750; }
.checkin-title { text-align: center; }
.checkin-title h2 { font-size: 21px; margin-bottom: 4px; }
.checkin-title p { color: var(--muted); font-size: 12px; margin: 0; }
.jump-rail { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; display: flex; gap: 8px; margin-bottom: 17px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px; }
.jump-button { background: #f7f9fa; border: 1px solid transparent; border-radius: 8px; color: var(--muted); flex: 1 0 82px; font-size: 11px; font-weight: 800; padding: 9px 7px; }
.jump-button.active { background: var(--blue-soft); border-color: #b7d5f3; color: var(--blue); }
.jump-grade { border-radius: 50%; display: inline-block; height: 7px; margin-left: 5px; width: 7px; }
.jump-grade.green { background: var(--green); }
.jump-grade.yellow { background: var(--yellow); }
.jump-grade.red { background: var(--red); }
.context-strip { background: #fffaf0; border: 1px solid #f1dfaa; border-radius: 13px; color: #6b5b32; margin-bottom: 18px; padding: 15px 18px; }
.context-strip strong { color: #4a3d1c; display: block; font-size: 12px; margin-bottom: 5px; }
.context-strip p { font-size: 12px; margin: 0; }
.domain-card { padding: clamp(20px, 4vw, 35px); }
.domain-kicker { color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .1em; margin-bottom: 7px; text-transform: uppercase; }
.domain-card h2 { font-size: clamp(24px, 4vw, 34px); letter-spacing: -.045em; margin-bottom: 27px; }
.question-list { border-top: 1px solid var(--line); }
.question-row { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 18px; grid-template-columns: minmax(170px, 1fr) minmax(240px, 1.2fr); padding: 18px 0; }
.question-label { font-size: 14px; font-weight: 720; line-height: 1.35; }
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.choice { background: #fff; border: 1px solid #d5dde4; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 800; min-width: 63px; padding: 10px 12px; }
.choice.selected { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice.negative.selected { background: var(--red); border-color: var(--red); }
.choice.neutral.selected { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.counter { align-items: center; display: flex; gap: 12px; justify-content: flex-end; }
.counter button { background: var(--blue-soft); border: 0; border-radius: 8px; color: var(--blue); font-size: 20px; height: 36px; width: 36px; }
.counter-value { font-size: 19px; font-weight: 850; min-width: 25px; text-align: center; }
.target { color: var(--muted); font-size: 11px; margin-left: 2px; }
.grade-section { align-items: center; display: flex; gap: 16px; justify-content: space-between; padding: 22px 0 15px; }
.grade-section p { color: var(--muted); font-size: 12px; margin: 0; }
.grade-section strong { color: var(--ink); display: block; font-size: 12px; margin-bottom: 4px; }
.grade-options { display: flex; gap: 7px; }
.grade-button { border: 1px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 850; padding: 10px 14px; }
.grade-button.green { background: var(--green-soft); color: #197251; }
.grade-button.yellow { background: var(--yellow-soft); color: #956c10; }
.grade-button.red { background: var(--red-soft); color: #a63e3a; }
.grade-button.selected { box-shadow: 0 0 0 2px var(--ink); }
.notes-label { color: var(--muted); font-size: 11px; font-weight: 800; }
textarea { border: 1px solid #d5dde4; border-radius: 9px; display: block; min-height: 86px; padding: 12px; resize: vertical; width: 100%; }
.pin-row { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 8px; margin-top: 12px; }
.footer-actions { justify-content: space-between; margin-top: 18px; }
.save-note { color: var(--muted); font-size: 11px; }
.review-grid { display: grid; gap: 12px; }
.review-row { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; display: grid; gap: 10px; grid-template-columns: 1fr 90px 25px 90px; padding: 14px 17px; }
.review-row strong { font-size: 13px; }
.review-grade { border-radius: 100px; font-size: 11px; font-weight: 850; padding: 7px 8px; text-align: center; }
.review-grade.green { background: var(--green-soft); color: #197251; }
.review-grade.yellow { background: var(--yellow-soft); color: #956c10; }
.review-grade.red { background: var(--red-soft); color: #a63e3a; }
.arrow { color: #a1adb7; text-align: center; }
.report-card { padding: 28px; }
.report-header { justify-content: space-between; margin-bottom: 22px; }
.report-brand { align-items: center; display: flex; gap: 16px; }
.report-logo {
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  height: 52px;
  object-fit: cover;
  width: 52px;
}
.report-header h2 { font-size: 25px; letter-spacing: -.04em; margin-bottom: 5px; }
.report-header p { color: var(--muted); font-size: 12px; margin: 0; }
.report-actions { display: flex; gap: 8px; }
.metric-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); margin-bottom: 28px; }
.metric { background: #f7f9fa; border-radius: 10px; padding: 15px; }
.metric strong { display: block; font-size: 23px; letter-spacing: -.05em; }
.metric span { color: var(--muted); font-size: 11px; }
.distribution { border-top: 1px solid var(--line); padding-top: 20px; }
.distribution h3 { font-size: 13px; margin-bottom: 16px; }
.distribution-row { align-items: center; display: grid; gap: 12px; grid-template-columns: 160px 1fr 105px; margin: 12px 0; }
.distribution-row label { font-size: 12px; font-weight: 750; }
.bar { background: #edf0f2; border-radius: 100px; display: flex; height: 12px; overflow: hidden; }
.bar span { display: block; }
.bar .green { background: var(--green); }
.bar .yellow { background: var(--yellow); }
.bar .red { background: var(--red); }
.distribution-values { color: var(--muted); font-size: 10px; text-align: right; }

/* Topbar Settings Button */
.topbar-settings-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  padding: 4px 10px;
  transition: all 0.15s ease;
}
.topbar-settings-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Universal Question Types */
.question-text-input {
  border: 1px solid #d5dde4;
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--ink);
  font-size: 13px;
  padding: 9px 12px;
  width: 100%;
}
.question-text-input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 2px var(--blue-soft);
}

.slider-container {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  width: 100%;
}
.slider-input {
  accent-color: var(--blue);
  cursor: pointer;
  flex: 1;
  max-width: 220px;
}
.slider-badge {
  background: var(--blue-soft);
  border-radius: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  min-width: 52px;
  padding: 4px 8px;
  text-align: center;
}

.multiselect-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}
.multiselect-chip {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  padding: 8px 12px;
  transition: all 0.15s ease;
}
.multiselect-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.multiselect-chip.selected {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 850;
}

/* Tags and Badges */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.tag-badge {
  background: #edf2f7;
  border-radius: 4px;
  color: #4a5568;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
}
.tag-badge.dog { background: #e6fffa; color: #234e52; }
.tag-badge.iop { background: #ebf8ff; color: #2a4365; }

.badge {
  border-radius: 100px;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  padding: 3px 8px;
  text-transform: uppercase;
}
.badge.active { background: var(--green-soft); color: #197251; }
.badge.archived { background: #e2e8f0; color: #64748b; }
.badge.type { background: #f0f4f8; color: #334e68; }

/* Settings View */
.settings-shell {
  margin: 0 auto;
  max-width: 1080px;
}
.settings-nav-bar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}
.tab-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  padding: 6px;
}
.tab-btn {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  flex: 1;
  font-size: 13px;
  font-weight: 750;
  padding: 10px 16px;
  text-align: center;
  transition: all 0.15s ease;
}
.tab-btn:hover {
  color: var(--ink);
}
.tab-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 850;
}

.settings-header-action {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}
.settings-header-action h3 {
  font-size: 18px;
  margin: 0;
}
.filter-group {
  display: flex;
  gap: 6px;
}
.filter-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  padding: 6px 11px;
}
.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* Settings Resident Table / Cards */
.settings-table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 20px;
  transition: background 0.12s ease;
}
.settings-row:last-child {
  border-bottom: 0;
}
.settings-row:hover {
  background: #fafbfc;
}
.row-main {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 14px;
}
.row-actions {
  display: flex;
  gap: 8px;
}
.button.sm {
  font-size: 11px;
  font-weight: 750;
  padding: 6px 11px;
}
.button.danger {
  background: var(--red-soft);
  border-color: #f7d4d3;
  color: #a63e3a;
}
.button.danger:hover {
  background: #f8c1bf;
  border-color: var(--red);
  color: #8c2420;
}

/* Sections / Domains Customizer */
.section-item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.section-item-header {
  align-items: center;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 18px;
}
.section-item-header.archived {
  opacity: 0.65;
  background: #f1f4f7;
}
.section-order-controls {
  align-items: center;
  display: flex;
  gap: 4px;
}
.reorder-btn {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  height: 28px;
  line-height: 1;
  width: 28px;
}
.reorder-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.section-meta-info {
  flex: 1;
}
.section-meta-info h4 {
  font-size: 15px;
  margin: 0 0 2px;
}
.section-meta-info p {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}
.section-header-actions {
  align-items: center;
  display: flex;
  gap: 6px;
}

.questions-container {
  padding: 12px 18px;
}
.question-item-row {
  align-items: center;
  border-bottom: 1px dashed var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 0;
}
.question-item-row:last-child {
  border-bottom: 0;
}
.question-item-info {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 10px;
}
.question-item-title {
  font-size: 13px;
  font-weight: 650;
}
.question-item-extra {
  color: var(--muted);
  font-size: 11px;
}

/* Vault Management Tab */
.vault-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}
.vault-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}
.vault-card h4 {
  font-size: 16px;
  margin: 0 0 8px;
}
.vault-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0 0 16px;
}

/* Modal Dialog System */
.modal-backdrop {
  align-items: center;
  background: rgba(13, 27, 42, 0.6);
  backdrop-filter: blur(3px);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 9999;
}
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(13, 27, 42, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-width: 540px;
  overflow: hidden;
  width: 100%;
}
.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px 22px;
}
.modal-header h3 {
  font-size: 17px;
  margin: 0;
}
.modal-close-btn {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  padding: 4px;
}
.modal-body {
  overflow-y: auto;
  padding: 22px;
}
.modal-footer {
  align-items: center;
  background: #fbfcfd;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group:last-child {
  margin-bottom: 0;
}
.form-label {
  color: var(--ink);
  display: block;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 6px;
}
.form-control {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--ink);
  font-size: 13px;
  padding: 10px 12px;
  width: 100%;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
  outline: none;
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group {
  flex: 1;
}
.form-help {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 4px;
}
.checkbox-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.checkbox-row label {
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .house-status { font-size: 11px; flex-wrap: wrap; }
  main { padding: 27px 15px 50px; }
  .toolbar { flex-wrap: wrap; justify-content: stretch; }
  .toolbar .button { flex: 1 1 140px; padding-inline: 8px; }
  .question-row { grid-template-columns: 1fr; gap: 11px; }
  .choice-group, .counter, .slider-container, .multiselect-group { justify-content: flex-start; }
  .grade-section { align-items: flex-start; flex-direction: column; }
  .review-row { grid-template-columns: 1fr 78px 18px 78px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .report-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .distribution-row { grid-template-columns: 115px 1fr; }
  .distribution-values { grid-column: 2; text-align: left; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .row-actions { width: 100%; justify-content: flex-end; }
  .section-item-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-header-actions { width: 100%; justify-content: flex-end; }
  .tab-btn { font-size: 11px; padding: 8px 10px; }
  .matrix-table { font-size: 11px; }
  .matrix-table th, .matrix-table td { padding: 8px 6px; }
}

/* Individual Resident Summary Overview */
.summary-shell {
  margin: 0 auto;
  max-width: 1120px;
}
.summary-top-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}
.summary-top-actions {
  display: flex;
  gap: 10px;
}

.summary-profile-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 24px 28px;
}
.summary-profile-left {
  align-items: center;
  display: flex;
  gap: 18px;
}
.summary-avatar {
  align-items: center;
  background: var(--blue-soft);
  border-radius: 50%;
  color: var(--blue);
  display: flex;
  font-size: 18px;
  font-weight: 850;
  height: 56px;
  justify-content: center;
  width: 56px;
}
.summary-profile-details h2 {
  font-size: 22px;
  letter-spacing: -.03em;
  margin: 0 0 4px;
}
.summary-profile-details p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.summary-kpi-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 26px;
}
.summary-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.summary-kpi-card strong {
  display: block;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -.04em;
  margin-bottom: 4px;
}
.summary-kpi-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.summary-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 26px;
  overflow: hidden;
}
.summary-panel-header {
  align-items: center;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 16px 22px;
}
.summary-panel-header h3 {
  font-size: 16px;
  margin: 0;
}
.summary-panel-header p {
  color: var(--muted);
  font-size: 11px;
  margin: 2px 0 0;
}
.summary-panel-body {
  padding: 22px;
}

/* History Matrix Table */
.matrix-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.matrix-table {
  border-collapse: collapse;
  width: 100%;
}
.matrix-table th {
  background: #f4f6f8;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  padding: 11px 14px;
  text-align: center;
}
.matrix-table th:first-child {
  min-width: 180px;
  text-align: left;
}
.matrix-table td {
  border: 1px solid var(--line);
  font-size: 12px;
  padding: 10px 12px;
  text-align: center;
}
.matrix-table td:first-child {
  font-weight: 700;
  text-align: left;
}
.matrix-grade-pill {
  border-radius: 6px;
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  text-transform: uppercase;
}
.matrix-grade-pill.green { background: var(--green-soft); color: #197251; }
.matrix-grade-pill.yellow { background: var(--yellow-soft); color: #956c10; }
.matrix-grade-pill.red { background: var(--red-soft); color: #a63e3a; }
.matrix-grade-pill.none { background: #f0f3f6; color: var(--muted); }

/* Pinned Items Cards */
.pinned-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.pinned-card {
  background: #fffdf5;
  border: 1px solid #fae6b2;
  border-left: 4px solid var(--yellow);
  border-radius: 10px;
  padding: 14px 16px;
}
.pinned-card h5 {
  color: #7d5b12;
  font-size: 12px;
  margin: 0 0 5px;
  text-transform: uppercase;
}
.pinned-card p {
  color: #4a3e1f;
  font-size: 13px;
  margin: 0;
}

/* Latest Check-in Breakdown */
.latest-domain-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}
.latest-domain-card {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 16px;
}
.latest-domain-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.latest-domain-head strong {
  font-size: 13px;
}
.latest-qa-row {
  border-bottom: 1px dashed #e2e8f0;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 6px 0;
}
.latest-qa-row:last-child {
  border-bottom: 0;
}
.latest-qa-label {
  color: var(--muted);
}
.latest-qa-val {
  font-weight: 750;
}

/* Case Notes Feed */
.case-note-composer {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 22px;
  padding: 16px;
}
.case-note-composer textarea {
  border: 1px solid #d5dde4;
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 72px;
  padding: 10px;
  width: 100%;
}
.case-note-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.case-note-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.12s ease;
}
.case-note-item:hover {
  border-color: #cbd5e1;
}
.case-note-meta {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.case-note-author {
  background: var(--blue-soft);
  border-radius: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  text-transform: uppercase;
}
.case-note-time {
  color: var(--muted);
  font-size: 11px;
}
.case-note-text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

/* Vault Brand Header */
.vault-brand-header {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}
.vault-brand-header h4 {
  margin: 0 0 3px;
}
.vault-subtext {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.vault-logo {
  border-radius: 9px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  height: 48px;
  object-fit: cover;
  width: 48px;
}

/* Resident Summary Print Brand */
.summary-print-brand {
  align-items: center;
  display: none;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--navy);
}
.summary-print-brand h3 {
  font-size: 19px;
  margin: 0 0 2px;
  color: var(--navy);
}
.summary-print-brand p {
  color: #555;
  font-size: 12px;
  margin: 0;
}
.print-logo {
  border-radius: 6px;
  height: 44px;
  object-fit: cover;
  width: 44px;
}

/* Review & Demographics Header Card */
.review-meta-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 16px 20px;
}
.review-meta-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.meta-field label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  text-transform: uppercase;
}
.meta-field input {
  background: #f8fafc;
  border: 1px solid #d5dde4;
  border-radius: 7px;
  font-size: 13px;
  padding: 8px 11px;
  width: 100%;
}
.meta-field input:focus {
  border-color: var(--blue);
  outline: none;
}
.review-eval-row {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
}
.eval-block {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.eval-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.eval-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.eval-pill {
  background: #f0f4f8;
  border: 1px solid #d0dbe5;
  border-radius: 20px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  padding: 5px 12px;
  transition: all 0.15s ease;
}
.eval-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.eval-pill.selected {
  background: var(--blue-soft);
  border-color: #b7d5f3;
  color: var(--blue);
  font-weight: 850;
}

/* Domain Objective */
.domain-objective {
  background: #f0f7ff;
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  color: #1a4971;
  font-size: 13px;
  line-height: 1.45;
  margin: -15px 0 22px;
  padding: 10px 14px;
}

/* Specialized Section Panel (Volunteer, AA, Sponsorship) */
.special-section-panel {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-bottom: 22px;
  padding: 16px 18px;
}
.special-section-panel h4 {
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
  text-transform: uppercase;
}
.special-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.counter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: 12px;
}
.counter-card {
  background: #fff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 10px 14px;
}

/* Meetings Log Table */
.meeting-log-section {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}
.meeting-log-table-wrapper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
}
.meeting-log-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}
.meeting-log-table th {
  background: #f5f8fa;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  padding: 8px 12px;
  text-align: left;
}
.meeting-log-table td {
  border-bottom: 1px solid #f0f4f8;
  padding: 8px 12px;
}
.meeting-log-table tr:last-child td {
  border-bottom: none;
}
.meeting-add-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 140px 1.5fr 1fr auto;
}
.meeting-add-form input {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  font-size: 12px;
  padding: 7px 10px;
}

/* Tracking Table Header & Item Notes */
.tracking-table-header {
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.08em;
  padding: 10px 0 6px;
}
.question-action-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.item-note-input {
  background: #fbfcfd;
  border: 1px dashed #ced8e0;
  border-radius: 6px;
  font-size: 12px;
  padding: 6px 10px;
  transition: all 0.15s ease;
  width: 100%;
}
.item-note-input:focus {
  background: #fff;
  border-color: var(--blue);
  border-style: solid;
  outline: none;
}

/* Choice Button Status Styles */
.choice.positive {
  color: var(--green);
}
.choice.positive.selected {
  background: var(--green-soft);
  border-color: var(--green);
  color: #197251;
}
.choice.in-progress {
  color: #8f650e;
}
.choice.in-progress.selected {
  background: var(--yellow-soft);
  border-color: var(--yellow);
  color: #8f650e;
}

/* Section Notes Blocks */
.section-notes-block {
  margin-top: 18px;
}
.section-notes-block .notes-label {
  display: block;
  margin-bottom: 6px;
}

/* Review Screen & Sections 8–11 */
.review-page-shell {
  max-width: 1080px;
}
.review-summary-header {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  padding: 16px 20px;
}
.summary-meta-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.summary-meta-grid .label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.summary-meta-grid strong {
  font-size: 14px;
}

.report-section-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
}
.report-section-header {
  background: #f9fbfd;
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
}
.report-section-header h3 {
  color: var(--navy);
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 3px;
}
.report-section-header p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.report-section-body {
  padding: 20px 22px;
}

/* Accountability Rating Table */
.accountability-table {
  border-collapse: collapse;
  width: 100%;
}
.accountability-table th {
  background: #f3f6f9;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 9px 12px;
}
.accountability-table td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 12px;
}
.rating-pill {
  background: #f1f4f7;
  border: 1px solid #d7e0e7;
  border-radius: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  padding: 5px 10px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.rating-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.rating-pill.selected {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 850;
}

/* Goals & Action Table */
.goals-action-table {
  border-collapse: collapse;
  width: 100%;
}
.goals-action-table th {
  background: #f3f6f9;
  border-bottom: 2px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  text-align: left;
}
.goals-action-table td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 8px 12px;
}
.goal-input {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  font-size: 13px;
  padding: 7px 11px;
  width: 100%;
}
.goal-input:focus, .target-date-input:focus {
  border-color: var(--blue);
  outline: none;
}
.target-date-input {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  font-size: 12px;
  padding: 7px 10px;
  width: 100%;
}

/* Narrative Fields */
.narrative-field {
  margin-top: 16px;
}
.narrative-field textarea {
  border: 1px solid #d5dde4;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 5px;
  min-height: 70px;
  padding: 10px 12px;
  width: 100%;
}
.narrative-field textarea:focus {
  border-color: var(--blue);
  outline: none;
}

/* Independence Eval Box */
.independence-eval-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 14px 16px;
}
.independence-eval-box .question-text {
  color: var(--navy);
  font-size: 13px;
  font-weight: 750;
}

/* Next Steps Checklist */
.next-steps-checklist {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.next-step-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5eaf0;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 10px;
  padding: 9px 12px;
  transition: all 0.15s ease;
}
.next-step-row:hover {
  background: #f0f4f9;
}
.next-step-row input[type="checkbox"] {
  height: 16px;
  width: 16px;
}

/* Legal Notice & Signatures */
.legal-notice-block {
  background: #fdfaf2;
  border-left: 3px solid #e0c173;
  color: #55441d;
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  margin: 0 0 18px;
  padding: 12px 16px;
}
.signatures-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.sig-block {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 16px;
}
.sig-block input {
  background: #fff;
  border: 1px solid #d5dde4;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 4px;
  padding: 8px 11px;
  width: 100%;
}
.program-retention-notice {
  background: #f4f6f8;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 18px;
  padding: 9px 13px;
}

/* Resident Summary Progress Report Breakdown */
.report-clinical-header {
  margin-bottom: 15px;
}
.special-summary-line {
  background: #f3f6f9;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 10px;
}
.report-summary-block {
  border-bottom: 1px solid var(--line);
  margin-top: 22px;
  padding-bottom: 20px;
}
.report-block-heading {
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px;
}
.narrative-display p {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 6px;
}
.sig-display-block {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.sig-label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 750;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.sig-line {
  border-bottom: 1px solid #777;
  font-family: Georgia, serif;
  font-size: 15px;
  font-style: italic;
  padding: 4px 0 6px;
}
.sig-date {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 6px;
}

/* Print Optimization */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .summary-top-nav, .case-note-composer, .button, .link-button, .reorder-btn { display: none !important; }
  .summary-shell { max-width: 100%; padding: 0; margin: 0; }
  .summary-print-brand { display: flex !important; }
  .summary-panel, .summary-profile-card, .summary-kpi-card, .report-section-card { box-shadow: none !important; border: 1px solid #bbb; break-inside: avoid; }
  .matrix-table th, .matrix-table td, .accountability-table th, .accountability-table td, .goals-action-table th, .goals-action-table td { border: 1px solid #777; }
  .report-card { border: 1px solid #bbb; box-shadow: none !important; padding: 20px 0; }
  .latest-domain-card { break-inside: avoid; border: 1px solid #ccc; margin-bottom: 12px; }
  .report-summary-block { break-inside: avoid; }
  .signatures-grid { break-inside: avoid; }
}
