/* Shared utility and state classes replacing template inline styles. */

.ui-max-240 { max-width: 240px; }
.ui-max-420 { max-width: 420px; }
.ui-max-560 { max-width: 560px; }
.ui-max-860 { max-width: 860px; }
.ui-max-1040 { max-width: 1040px; }
.ui-min-280 { min-width: 280px; }
.ui-select-column { width: 36px; }
.ui-grid-gap-2 { display: grid; gap: 8px; }
.ui-initially-hidden { display: none; }

.psi-title--section { font-size: 20px; }

.student-access-shell { min-height: calc(100vh - 7rem); }
.student-access-card {
  max-width: 560px;
  border-radius: 24px;
}
.hero-pill--danger {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(254, 242, 242, 0.95);
  color: #b91c1c;
}
.hero-pill--success {
  border-color: rgba(22, 163, 74, 0.22);
  background: rgba(236, 253, 245, 0.95);
  color: #166534;
}

.bmi-mini-scale {
  position: relative;
  width: 100%;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee;
}
.bmi-mini-zone { position: absolute; top: 0; bottom: 0; }
.bmi-z1 { left: 0; width: 25%; background: #cfe2ff; }
.bmi-z2 { left: 25%; width: 25%; background: #e2efff; }
.bmi-z3 { left: 50%; width: 25%; background: #d1e7dd; }
.bmi-z4 { left: 75%; width: 25%; background: #fde2e1; }
.bmi-mini-pointer {
  position: absolute;
  top: -4px;
  left: 0;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #000;
  border-left: 6px solid transparent;
}
.bmi-scale {
  position: relative;
  display: flex;
  height: 20px;
}
.bmi-scale__low,
.bmi-scale__critical { flex: 1; background: #f44336; }
.bmi-scale__normal { flex: 2; background: #4caf50; }
.bmi-scale__high { flex: 1; background: #ffeb3b; }
.bmi-scale__pointer {
  position: absolute;
  top: -5px;
  width: 3px;
  height: 30px;
  background: #000;
}
.bmi-scale__legend { font-size: 0.75rem; }

.admin-brand { font-weight: 700; }

.app-footer {
  padding: 22px 16px 30px;
  color: var(--text-muted, #64746b);
}
.app-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: center;
  max-width: 1180px;
  margin: 0 auto;
  font-size: 0.9rem;
}
.app-footer a {
  color: var(--brand, #147a45);
  text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }

.consent-preview {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--border, #d8e7dc);
  border-radius: .75rem;
  background: var(--surface-muted, #f7fbf8);
}
.consent-preview__text {
  max-height: 22rem;
  overflow: auto;
  padding: .875rem;
  border-radius: .5rem;
  background: #fff;
  color: var(--text-strong, #173a27);
  font-size: .875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.legal-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}
.legal-page--narrow { width: min(720px, calc(100% - 32px)); }
.legal-hero {
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid rgba(20, 122, 69, 0.14);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(234, 252, 242, 0.95), rgba(247, 252, 249, 0.98));
  box-shadow: 0 18px 50px rgba(20, 83, 45, 0.07);
}
.legal-eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--brand, #147a45);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.legal-hero h1 {
  margin: 0 0 10px;
  color: var(--text-strong, #0f2f22);
  font-weight: 800;
}
.legal-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted, #64746b);
  font-size: 1.05rem;
}
.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.legal-card {
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid rgba(20, 122, 69, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 36px rgba(15, 47, 34, 0.05);
}
.legal-card--muted { background: rgba(247, 252, 249, 0.92); }
.legal-card h2 {
  margin-bottom: 14px;
  color: var(--text-strong, #0f2f22);
  font-size: 1.25rem;
  font-weight: 800;
}
.legal-card li { margin-bottom: 8px; }
.legal-card .table th,
.legal-card .table td {
  border-color: rgba(20, 122, 69, 0.14);
}

@media (max-width: 768px) {
  .legal-grid { grid-template-columns: 1fr; }
  .legal-page {
    width: min(100% - 20px, 720px);
    padding-top: 16px;
  }
  .legal-hero,
  .legal-card {
    padding: 18px;
    border-radius: 16px;
  }
}

.messages-page { max-width: 980px; }
.message-conversation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--app-border, #dbe7df);
}
.message-conversation-row:last-child { border-bottom: 0; }
.message-conversation-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}
.message-conversation-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  color: #167a45;
  background: #eaf7ef;
}
.message-conversation-row > form,
.message-bubble-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.message-thread-list {
  min-height: 360px;
  max-height: min(62vh, 700px);
  overflow-y: auto;
  padding: 16px;
  background: #f7faf8;
}
.message-bubble {
  width: min(78%, 620px);
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #dbe7df;
  border-radius: 8px;
  background: #fff;
}
.message-bubble.is-mine {
  margin-left: auto;
  border-color: #a8d5b8;
  background: #edf8f1;
}
.message-bubble-author {
  margin-bottom: 3px;
  color: #167a45;
  font-size: 12px;
  font-weight: 700;
}
.message-bubble-meta {
  justify-content: flex-end;
  margin-top: 5px;
  color: #6a776f;
  font-size: 11px;
}
.message-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #dbe7df;
  background: #fff;
}
@media (max-width: 640px) {
  .message-conversation-row {
    align-items: stretch;
    flex-direction: column;
  }
  .message-conversation-row > form { justify-content: flex-end; }
  .message-bubble { width: 90%; }
  .message-compose { grid-template-columns: 1fr; }
}
