/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --blue: #007aff;
  --green: #34c759;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --muted: #8b93a7;
  --border: #e6e8f0;
}

.muted {
  color: var(--muted);
}

html,
body {
  height: 100%;
}

/* ---------- Doctor layout ---------- */
body.doctor {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: #1f2430;
  height: 100%;
}

body.doctor a {
  color: var(--blue);
  text-decoration: none;
}

body.doctor.doctor-dashboard {
  height: 100vh;
  overflow: hidden;
}

body.doctor .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  color: #fff;
}

body.doctor .topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.2px;
  color: #fff;
}

body.doctor .topbar-brand-link {
  color: inherit;
  text-decoration: none;
}

body.doctor .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

body.doctor .topbar-right .signed-in {
  color: #f1f5f9;
}

body.doctor .topbar-right .signed-in strong {
  color: #fff;
}

body.doctor .topbar-menu {
  position: relative;
}

body.doctor .topbar-menu summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
}

body.doctor .topbar-menu[open] summary {
  text-decoration: underline;
}

body.doctor .topbar-menu .dropdown {
  position: absolute;
  right: 0;
  top: 120%;
  background: #fff;
  color: #1f2430;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  padding: 8px 0;
  min-width: 180px;
  border: 1px solid #e6e8f0;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

body.doctor .topbar-menu .dropdown a {
  padding: 10px 14px;
  color: #1f2430;
  text-decoration: none;
  font-weight: 500;
}

body.doctor .topbar-menu .dropdown a:hover {
  background: #f4f6fb;
}

body.doctor .flash {
  margin: 12px auto;
  width: min(1100px, 92%);
}

body.doctor .flash > div {
  padding: 10px 12px;
  border-radius: 10px;
}

body.doctor .flash .notice {
  background: #e7f6ef;
  color: #1a7f4b;
}

body.doctor .flash .alert {
  background: #fdecec;
  color: #b42318;
}

body.doctor .flash-container {
  height: auto;
  overflow: visible;
  margin-bottom: 0;
}

body.doctor .btn {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

body.doctor .btn.secondary {
  background: #e9eef7;
  color: #1f2430;
}

body.doctor .badge {
  background: var(--green);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

body.doctor .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

body.doctor .container {
  width: min(1200px, 96%);
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  min-height: 0;
  overflow: hidden;
}

body.doctor.doctor-dashboard .container {
  overflow: hidden;
}

body.doctor .dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;
}

body.doctor .messages {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  box-sizing: border-box;
}

body.doctor .footer {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid #ddd;
  background: #fafafa;
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

body.doctor .input-area {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  align-items: center;
}

body.doctor .input-area input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

body.doctor .input-area input[type="submit"] {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

body.doctor .input-area input[type="submit"]:hover {
  background: #0060d1;
}

body.doctor .chat-container {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

body.doctor .chat-container .messages {
  overflow-y: auto;
  min-height: 0;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
}

body.doctor .chat-container .messages::after {
  content: "";
  display: block;
  height: 15px;
  flex-shrink: 0;
}

/* ---------- Patient chat layout ---------- */
body.chat-patient {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #f4f4f4;
  font-family: Arial, sans-serif;
}

body.chat-patient *,
body.chat-doctor * {
  box-sizing: border-box;
}

body.chat-patient input,
body.chat-patient select,
body.chat-patient textarea,
body.chat-patient button {
  font-size: 16px;
}

body.chat-patient .chat-outer {
  position: fixed;
  top: env(safe-area-inset-top);
  right: 0;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  display: grid;
  justify-items: center;
  align-items: stretch;
  overflow: hidden;
  background: #f4f4f4;
  padding: 0;
}

body.chat-patient .chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

body.chat-patient .patient-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  color: #fff;
}

body.chat-patient .patient-topbar__brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}

body.chat-patient .patient-topbar__menu {
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

body.chat-patient .patient-topbar__menu:hover {
  text-decoration: underline;
}

body.chat-patient.registration-page,
body.chat-patient.registration-page .chat-outer {
  position: relative;
  min-height: 100vh;
  padding: 1rem;
  overflow: auto;
  display: block;
  justify-items: center;
  align-items: start;
}

body.chat-patient.about-page {
  position: relative;
  min-height: 100vh;
  padding: 0;
  overflow: auto;
  display: block;
  justify-items: center;
  align-items: start;
}

body.chat-patient.about-page .chat-outer {
  position: relative;
  min-height: 100vh;
  padding: 0;
  overflow: visible;
  display: block;
  justify-items: center;
  align-items: start;
}

body.chat-patient.about-page .chat-container {
  max-width: none;
  width: 100%;
  height: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}

body.chat-patient.about-page .public-about__header {
  position: sticky;
  top: 0;
  z-index: 20;
  left: 0;
  right: 0;
}

body.chat-patient .chat-container.registration-container {
  height: auto;
  min-height: auto;
  max-width: 720px;
  margin: 0 auto;
  overflow: visible;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.chat-patient .messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

body.chat-patient .footer {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid #ddd;
  background: #fafafa;
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

body.chat-patient .input-area {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  align-items: center;
}

body.chat-patient .input-area input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

body.chat-patient .input-area input[type="submit"] {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

body.chat-patient .input-area input[type="submit"]:hover {
  background: #45a049;
}

body.chat-patient .input-area input[type="submit"]:disabled {
  background: #ccc;
  cursor: not-allowed;
}

body.chat-patient .chat-body-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0 0.75rem;
}

body.chat-patient .token-warning {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fff8e5;
  border: 1px solid #f0a000;
  color: #5a3a00;
  font-size: 0.9rem;
  line-height: 1.4;
}

body.chat-patient .token-warning--expired {
  background: #ffecec;
  border-color: #e06060;
  color: #7a1a1a;
}

body.chat-patient #token-countdown {
  display: inline-block;
  margin-left: 0.35rem;
  font-weight: bold;
}

@media (max-width: 768px) {
  body.chat-patient .chat-container {
    max-width: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  body.chat-doctor .chat-container {
    max-width: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---------- Physician chat (chat_doctor layout) ---------- */
body.chat-doctor {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #f4f4f4;
  font-family: Arial, sans-serif;
}

body.chat-doctor .chat-outer {
  position: fixed;
  top: env(safe-area-inset-top);
  right: 0;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  display: grid;
  justify-items: center;
  align-items: stretch;
}

body.chat-doctor .chat-container {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  max-width: 600px;
  height: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

body.chat-doctor .messages {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

body.chat-doctor .footer {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid #ddd;
  background: #fafafa;
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

body.chat-doctor .input-area {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  align-items: center;
}

body.chat-doctor .input-area input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

body.chat-doctor .input-area input[type="submit"] {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

body.chat-doctor .input-area input[type="submit"]:hover {
  background: #45a049;
}

/* ---------- Message bubbles (shared) ---------- */
body.doctor .message,
body.chat-patient .message,
body.chat-doctor .message {
  max-width: 70%;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  line-height: 1.4;
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
  display: flex;
  flex-direction: column;
}

body.doctor .message,
body.chat-patient .message {
  color: #fff;
}

body.chat-doctor .message {
  color: #1f2430;
}

body.doctor .message.patient {
  background: var(--green);
  align-self: flex-start;
}

body.doctor .message.doctor {
  background: var(--blue);
  align-self: flex-end;
}

body.chat-patient .message.patient {
  background: #34c759;
  align-self: flex-start;
}

body.chat-patient .message.doctor {
  background: #007aff;
  align-self: flex-end;
}

body.chat-doctor .message.patient {
  background: #e0f7fa;
  align-self: flex-start;
}

body.chat-doctor .message.doctor {
  background: #d1c4e9;
  align-self: flex-end;
}

body.chat-patient .message:last-of-type {
  margin-bottom: 0.5rem;
}

.message.alert {
  background: #b91c1c;
  color: #fff;
}

body.doctor .timestamp,
body.chat-patient .timestamp {
  display: block;
  font-size: 0.75rem;
  color: #e0e0e0;
  margin-top: 2px;
  white-space: nowrap;
  opacity: 0.9;
  align-self: flex-end;
}

body.chat-doctor .timestamp {
  display: block;
  font-size: 0.75rem;
  color: #666;
  margin-top: 2px;
  white-space: nowrap;
  opacity: 0.9;
}

/* ---------- Admin layout chrome ---------- */
.admin-panel .admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111827;
  color: #fff;
}

.admin-panel .admin-topbar__brand {
  font-weight: 700;
}

.admin-panel .admin-topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-panel .admin-topbar__link {
  color: #c7d2fe;
  text-decoration: none;
  font-weight: 600;
}

.admin-panel .admin-nav-wrapper {
  padding: 16px;
}

.admin-panel .admin-main {
  padding: 16px;
}

.admin-panel .admin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
}

.admin-panel .admin-nav__list {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.admin-icons-sprite {
  display: none;
}

/* ---------- Utilities ---------- */
.align-right { text-align: right; }
.align-center { text-align: center; }
.pr-8 { padding-right: 0.5rem; }
.pt-8 { padding-top: 0.5rem; }
.mt-8 { margin-top: 0.5rem; }
.mt-12 { margin-top: 0.75rem; }
.mt-16 { margin-top: 1rem; }
.mt-24 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 0.25rem; }
.text-xs { font-size: 12px; }
.text-md { font-size: 0.9rem; }

.is-hidden { display: none; }

/* ---------- Flash and form messages ---------- */
.error-message {
  color: red;
  font-size: 0.9rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  background: #fff;
  border-radius: 6px;
  max-height: 200px;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.notice-message {
  color: #1a7f4b;
  font-size: 0.9rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  background: #e7f6ef;
  border-radius: 6px;
}

.auto-dismiss {
  --ttl: 30s;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.auto-dismiss--fade {
  opacity: 0;
}

.error-message.auto-dismiss {
  animation: chatFadeOutCollapse 0.8s ease forwards;
  animation-delay: var(--ttl, 30s);
  will-change: opacity, max-height, margin, padding;
}

@keyframes chatFadeOutCollapse {
  0% { opacity: 1; max-height: 200px; }
  99% { opacity: 0; max-height: 200px; }
  100% { opacity: 0; max-height: 0; margin: 0; padding: 0; }
}

.scroll-anchor {
  height: 0;
  width: 100%;
}

.inline-form {
  margin: 0;
}

.auth-actions {
  margin-top: 1rem;
}

/* ---------- Auth cards ---------- */
body.doctor .auth-card,
.auth-card {
  max-width: 420px;
  margin: 32px auto;
  padding: 24px;
  border-radius: 14px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--border);
}

body.chat-patient .auth-card {
  width: calc(100% - 32px);
  max-width: none;
  margin: 16px auto;
}

.auth-card__title {
  margin: 0 0 8px 0;
}

.auth-card__subtitle {
  margin: 0 0 18px 0;
}

.auth-card__divider {
  margin: 18px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.auth-form {
  width: 100%;
  box-sizing: border-box;
}

.auth-form__field {
  margin-bottom: 12px;
}

.auth-form__field--lg {
  margin-bottom: 18px;
}

.auth-form__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.auth-form__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.auth-form__submit {
  width: 100%;
  padding: 10px 0;
  box-sizing: border-box;
}

.auth-form__provider {
  width: 100%;
}

.auth-form__provider-button {
  width: 100%;
  text-align: center;
  display: block;
  padding: 10px 0;
  border-radius: 10px;
  box-sizing: border-box;
}

.auth-form__provider-link {
  width: 100%;
  text-align: center;
  display: block;
}

.auth-form__flash {
  margin-bottom: 12px;
}

/* ---------- Doctor dashboard ---------- */
.dashboard-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

body.doctor .btn-primary {
  background: #0d6efd;
  color: #fff;
}

body.doctor .btn-danger {
  background: #b30000;
  color: #fff;
}

body.doctor .btn-danger-outline {
  background: #fff0f0;
  color: #b30000;
  border: 1px solid #b30000;
}

body.doctor .btn-sm {
  padding: 6px 10px;
}

.dashboard-panel {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.dashboard-panel__header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.dashboard-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.thread-list {
  overflow: auto;
  flex: 1 1 auto;
}

.thread-list__empty {
  padding: 16px;
}

.thread-row {
  display: block;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.thread-row--active {
  background: #f0f6ff;
}

.thread-row__layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

.chat-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.handoff-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.handoff-select {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.empty-chat {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  color: var(--muted);
}

.empty-chat__title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ---------- Doctor composer ---------- */
.doctor-composer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.25rem 0;
  width: 100%;
  box-sizing: border-box;
}

.doctor-composer__row {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.doctor-composer__input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.doctor-composer__submit {
  padding: 0.5rem 1rem;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  height: 2.5rem;
  box-sizing: border-box;
}

/* ---------- QR codes ---------- */
.qr-card {
  max-width: 560px;
  margin: 24px auto;
  padding: 20px;
  border-radius: 14px;
}

.qr-card__title {
  margin: 0 0 12px 0;
}

.qr-card__subtitle {
  margin: 0 0 16px 0;
}

.qr-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.qr-form__field {
  flex: 1 1 240px;
}

.qr-form__label {
  display: block;
  margin-bottom: 6px;
}

.qr-form__select {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.qr-form__actions {
  align-self: flex-end;
}

.qr-form__submit {
  padding: 10px 16px;
}

.qr-output {
  margin-top: 20px;
  text-align: center;
}

.qr-output__link {
  margin-bottom: 8px;
}

.qr-output__box {
  display: inline-block;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* ---------- Patient link box ---------- */
.patient-link-box {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #f9fafb;
}

.patient-link-box__desc {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.patient-link-box__link {
  font-size: 0.85rem;
  word-break: break-all;
  margin-top: 0.5rem;
}

/* ---------- Public chat landing pages ---------- */
.chat-landing {
  max-width: 720px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

.chat-landing--register {
  min-height: 80vh;
}

.chat-landing--success {
  min-height: 60vh;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.chat-landing__title {
  margin: 0 0 0.75rem 0;
  font-size: 1.5rem;
}

.chat-landing__intro {
  margin-bottom: 0.75rem;
}

.chat-landing__note {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: #555;
}

.chat-landing__note--spaced {
  margin-bottom: 1.25rem;
}

.chat-landing__alert {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #ffecec;
  border: 1px solid #e06060;
  color: #7a1a1a;
  border-radius: 6px;
}

.chat-landing__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  flex: 1 1 auto;
}

.chat-landing__label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.chat-landing__input {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.chat-landing__actions {
  margin-top: 0.75rem;
  flex: 0 0 auto;
  text-align: center;
}

.chat-landing__submit {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  background: #0ea5e9;
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.chat-landing__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.chat-landing__fineprint {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #999;
  text-align: center;
}

.chat-landing__success-text {
  color: #555;
  max-width: 480px;
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 1px;
  width: 1px;
  padding: 0;
  margin: 0;
  border: 0;
}

/* ---------- Public chat about + disclaimer ---------- */
.public-about__header,
.public-disclaimer__header {
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  color: #fff;
  padding: 22px 18px;
  text-align: center;
}

.public-about__title,
.public-disclaimer__title {
  font-size: 22px;
  font-weight: 700;
}

.public-about__wrap,
.public-disclaimer__wrap {
  max-width: 860px;
  margin: 26px auto;
  padding: 0 18px;
}

.public-about__card,
.public-disclaimer__card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

.public-about__card {
  text-align: center;
}

.public-about__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.public-about__media {
  width: 100%;
  display: flex;
  justify-content: center;
}

.public-about__video {
  width: min(720px, 100%);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.public-about__image {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.public-about__placeholder {
  width: 200px;
  height: 200px;
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #94a3b8;
  background: #f8fafc;
}

.public-about__name {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.public-about__section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: #1f2937;
}

.public-about__bio {
  font-size: 16px;
  line-height: 1.6;
  color: #334155;
  white-space: pre-line;
  max-width: 620px;
  margin: 0;
}

.public-about__bio-muted {
  color: #64748b;
}

.public-about__cta {
  margin-top: 22px;
  text-align: center;
}

.public-about__cta-link,
.public-disclaimer__cta-link {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 10px;
  background: #0ea5e9;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
}

.public-disclaimer__body {
  font-size: 16px;
  line-height: 1.6;
  color: #1f2937;
}

.public-disclaimer__cta {
  margin-top: 24px;
  text-align: center;
}

/* ---------- Profile page ---------- */
.profile-card {
  width: 820px;
  max-width: 100%;
  margin: 32px auto;
  padding: 18px 18px 22px;
  min-height: 720px;
}

.profile-title {
  margin: 0 0 6px 0;
}

.profile-subtitle {
  margin: 0 0 18px 0;
}

.profile-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.profile-errors__list {
  margin: 8px 0 0 18px;
  padding: 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.profile-avatar {
  text-align: center;
}

.profile-avatar__image {
  width: 216px;
  height: 216px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  display: block;
  margin: 0 auto 10px;
}

.profile-avatar__placeholder {
  width: 216px;
  height: 216px;
  border-radius: 16px;
  border: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #94a3b8;
  margin: 0 auto 10px;
  background: #f8fafc;
}

.profile-avatar__file {
  width: 100%;
  padding: 6px 0;
}

.profile-avatar__note {
  font-size: 12px;
  margin-top: 4px;
}

.profile-label {
  display: block;
  margin-bottom: 6px;
}

.profile-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-sizing: border-box;
}

.profile-input--spaced {
  margin-bottom: 12px;
}

.profile-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-sizing: border-box;
  resize: vertical;
}

.profile-field--spaced {
  margin-bottom: 16px;
}

.profile-field--tight {
  margin-bottom: 8px;
}

.profile-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.profile-section-title {
  margin: 0 0 8px 0;
}

.profile-section-note {
  font-size: 13px;
  margin-bottom: 12px;
}

.profile-mfa-fields {
  margin-bottom: 16px;
}

.profile-note {
  font-size: 13px;
  margin-top: 6px;
}

.profile-note--spaced {
  margin-bottom: 10px;
}

.profile-note--tight {
  margin-bottom: 8px;
}

.profile-secret-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.profile-secret {
  font-family: monospace;
  word-break: break-all;
}

.profile-secret-note {
  font-size: 12px;
  margin-top: 6px;
  word-break: break-all;
}

.profile-btn-inline {
  width: auto;
  white-space: nowrap;
}

.profile-actions {
  margin-top: 20px;
}

.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  display: flex;
}

.qr-overlay.is-hidden {
  display: none;
}

.qr-overlay__content {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

.qr-overlay__title {
  margin-bottom: 12px;
  font-weight: 700;
}

.qr-overlay__code {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.qr-overlay__close {
  width: 100%;
}

.qr-overlay__action {
  width: 100%;
}

.supplement-list {
  margin: 12px 0;
  padding: 8px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-align: left;
  background: #f8fafc;
}

.supplement-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
}

.supplement-option__input {
  margin-top: 2px;
}

/* ---------- Admin dashboard ---------- */
.admin-dashboard__intro {
  margin-bottom: 2rem;
  color: #666;
  font-size: 0.95rem;
}

.admin-dashboard__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.admin-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  background: #fff;
}

.admin-card__title {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.admin-card__subtitle {
  margin-top: 0;
  font-size: 0.95rem;
}

.admin-card__subtitle--spaced {
  margin-top: 1rem;
}

.admin-card--spaced {
  margin-bottom: 1.5rem;
}

.admin-table {
  width: 100%;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
}

.admin-note {
  font-size: 0.85rem;
}

.admin-line {
  margin: 0 0 0.25rem;
}

.admin-muted {
  font-size: 0.9rem;
  color: #555;
  margin: 0;
}

.status-ok {
  color: #0a7c20;
  font-weight: 600;
}

.status-failed {
  color: #b30000;
  font-weight: 600;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-toolbar__title {
  margin: 0;
}

.admin-toolbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-toolbar__link {
  text-decoration: none;
  font-weight: 600;
  color: #fff;
}

.admin-form-errors {
  color: #b00;
  margin-bottom: 1rem;
}

.admin-form-field {
  margin-bottom: 0.75rem;
}

.admin-safety-preview {
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid #f0a000;
  background: #fff8e5;
}

.admin-warning-text {
  color: #b00;
  font-weight: bold;
}

.admin-preview-note {
  font-size: 0.85rem;
  color: #555;
}

.admin-form-actions {
  margin-top: 1rem;
}

.admin-detail-table {
  width: 100%;
  max-width: 600px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.admin-detail-table th {
  text-align: left;
  padding-right: 0.5rem;
}

.admin-detail-actions {
  margin-bottom: 1rem;
}

.admin-detail-note {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid #f0a000;
  background: #fff8e5;
  font-size: 0.85rem;
}

.admin-audit-events__filters {
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.admin-audit-events__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.admin-audit-events__export {
  margin-bottom: 0.75rem;
}

.admin-audit-events__table {
  width: 100%;
  font-size: 0.9rem;
}

.admin-audit-events__empty {
  margin-top: 1rem;
}

.compliance-thread {
  margin-bottom: 1.5rem;
}

.compliance-thread__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.compliance-thread__meta {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.compliance-messages {
  width: 100%;
  border-collapse: collapse;
}

.compliance-messages th,
.compliance-messages td {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.compliance-message-body {
  max-height: 40vh;
  overflow: auto;
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 8px;
}

body.doctor.compliance {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
}

body.doctor.compliance .container {
  height: auto;
  min-height: calc(100vh - 70px);
  overflow: visible;
}

.compliance-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}

.compliance-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.compliance-title {
  margin: 0;
  font-size: 1.6rem;
}

.compliance-subtitle {
  margin: 4px 0 0;
}

.compliance-inline-form {
  margin: 0;
}

.compliance-alert {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fdecec;
  color: #b42318;
}

.compliance-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compliance-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.compliance-field--wide {
  grid-column: 1 / -1;
}

.compliance-actions {
  justify-content: flex-start;
  gap: 8px;
}

.compliance-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.compliance-results-title {
  margin: 0;
}

.compliance-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compliance-thread {
  padding: 12px 14px;
}

.compliance-thread__meta {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compliance-table-wrap {
  overflow-x: auto;
}

.compliance-note {
  font-size: 12px;
  margin-top: 6px;
}

.compliance-overlay-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.compliance-overlay-actions .btn {
  flex: 1 1 0;
}
