/**
 * Patient-facing palette — warm, soft, reassuring (not clinical/cold).
 * Inspired by calming care environments: sage, cream, gentle peach accents.
 */

.hospai-patient {
  --pc-bg: #faf7f2;
  --pc-bg-soft: #f3f9f6;
  --pc-surface: #ffffff;
  --pc-surface-warm: #fffefb;
  --pc-border: #e8e2d8;
  --pc-border-soft: #f0ebe3;

  --pc-primary: #6b9e8f;
  --pc-primary-hover: #5a8d7e;
  --pc-primary-light: #e8f4ef;

  --pc-accent: #d4a574;
  --pc-accent-light: #faf3eb;

  --pc-text: #4a4540;
  --pc-muted: #8a8278;
  --pc-heading: #4d7268;

  --pc-safe: #eef8f3;
  --pc-safe-border: #b8ddc8;
  --pc-safe-text: #3d6656;

  --pc-warm: #fff8f0;
  --pc-warm-border: #f0dcc4;

  --pc-lavender: #f6f3fa;
  --pc-lavender-border: #e4dce8;

  --pc-shadow: rgba(107, 158, 143, 0.08);
  --pc-shadow-card: 0 4px 24px rgba(74, 69, 64, 0.06);
}

.hospai-patient,
.hospai-patient * {
  color-scheme: light only;
}

body.hospai-patient {
  background: linear-gradient(165deg, var(--pc-bg-soft) 0%, var(--pc-bg) 45%, #fdf9f5 100%) !important;
  background-attachment: fixed;
  color: var(--pc-text) !important;
}

.hospai-patient nav {
  background: var(--pc-surface-warm) !important;
  border-color: var(--pc-border) !important;
  box-shadow: 0 2px 16px var(--pc-shadow);
}

.hospai-patient nav .text-xl {
  color: var(--pc-heading) !important;
}

.hospai-patient footer {
  background: var(--pc-surface-warm) !important;
  border-color: var(--pc-border) !important;
  color: var(--pc-muted) !important;
}

/* Cards */
.hospai-patient .intake-card {
  background: var(--pc-surface) !important;
  border: 1px solid var(--pc-border) !important;
  border-radius: 1.25rem;
  box-shadow: var(--pc-shadow-card);
}

.hospai-patient .intake-toolbar {
  background: var(--pc-primary-light) !important;
  border-color: var(--pc-border-soft) !important;
  border-radius: 0 0 1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.hospai-patient .intake-toolbar .voice-status {
  color: var(--pc-primary-dark, #4a7c6f);
  font-weight: 500;
}

.hospai-patient .intake-toolbar .voice-status.listening,
.hospai-patient .mic-btn.listening + .voice-status {
  color: #0e7490;
}

.hospai-patient .intake-textarea,
.hospai-patient input[type="text"],
.hospai-patient input[type="password"],
.hospai-patient input[type="email"],
.hospai-patient input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.hospai-patient textarea,
.hospai-patient select {
  background: var(--pc-surface-warm) !important;
  color: var(--pc-text) !important;
  border: 1px solid var(--pc-border) !important;
  border-radius: 0.75rem;
  font-size: 1.0625rem;
}

.hospai-patient .intake-textarea:focus,
.hospai-patient input:focus,
.hospai-patient textarea:focus,
.hospai-patient select:focus {
  outline: none;
  border-color: var(--pc-primary) !important;
  box-shadow: 0 0 0 3px rgba(107, 158, 143, 0.2);
}

/* Safety — soft mint, not harsh green */
.hospai-patient .safety-banner {
  background: linear-gradient(135deg, var(--pc-safe) 0%, #f5fbf8 100%);
  border: 1px solid var(--pc-safe-border);
  border-radius: 1.25rem;
  padding: 1.15rem 1.35rem;
  color: var(--pc-safe-text);
  font-size: 0.975rem;
  line-height: 1.65;
}

.hospai-patient .safety-banner strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--pc-heading);
}

/* Typography */
.hospai-patient .step-heading {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--pc-heading);
  letter-spacing: -0.02em;
}

.hospai-patient .step-sub {
  color: var(--pc-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.hospai-patient .btn-primary {
  display: block;
  width: 100%;
  padding: 1.05rem 1.35rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #7aab9c 0%, var(--pc-primary) 100%);
  border-radius: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(107, 158, 143, 0.35);
}

.hospai-patient .btn-primary:hover {
  background: linear-gradient(180deg, var(--pc-primary) 0%, var(--pc-primary-hover) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(107, 158, 143, 0.4);
}

.hospai-patient .btn-secondary {
  display: block;
  width: 100%;
  padding: 0.85rem;
  font-size: 0.95rem;
  color: var(--pc-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--pc-border);
}

.hospai-patient .btn-secondary:hover {
  color: var(--pc-heading);
}

/* Secretary */
.hospai-patient .secretary-helper {
  background: linear-gradient(135deg, var(--pc-surface) 0%, var(--pc-lavender) 100%);
  border: 1px solid var(--pc-lavender-border);
  border-radius: 1.25rem;
  box-shadow: var(--pc-shadow-card);
}

.hospai-patient .secretary-bubble {
  background: var(--pc-surface-warm) !important;
  border: 1px solid var(--pc-border-soft) !important;
  border-radius: 1rem 1.25rem 1.25rem 0.5rem;
}

.hospai-patient .secretary-avatar-wrap {
  gap: 0.4rem;
}

.hospai-patient .secretary-avatar,
.hospai-patient .secretary-avatar-img {
  border-color: var(--pc-primary) !important;
  box-shadow: 0 4px 16px rgba(107, 158, 143, 0.25);
}

.hospai-patient .secretary-avatar-wrap.secretary-speaking .secretary-avatar-img {
  box-shadow: 0 0 0 4px rgba(107, 158, 143, 0.3), 0 4px 20px rgba(107, 158, 143, 0.35);
}

.hospai-patient .secretary-speak-btn {
  border-color: var(--pc-border);
  background: var(--pc-surface);
}

.hospai-patient .secretary-speak-btn:hover {
  border-color: var(--pc-primary);
  background: var(--pc-lavender);
}

.hospai-patient .secretary-speak-btn.secretary-speak-active {
  background: var(--pc-primary);
  border-color: var(--pc-primary);
  color: #fff;
}

/* Workflow steps */
.hospai-patient .workflow-steps .text-slate-500,
.hospai-patient .workflow-steps .text-slate-600 {
  color: var(--pc-muted) !important;
}

.hospai-patient .workflow-step-circle.active {
  background: var(--pc-primary) !important;
  --tw-ring-color: rgba(107, 158, 143, 0.35) !important;
}

.hospai-patient .workflow-steps .workflow-step-circle.active {
  ring-color: rgba(107, 158, 143, 0.35);
}

.hospai-patient .workflow-steps .ring-sky-200 {
  --tw-ring-color: rgba(107, 158, 143, 0.25) !important;
}

.hospai-patient .workflow-steps .bg-emerald-500 {
  background: #8fbc8f !important;
}

.hospai-patient .workflow-steps .bg-emerald-400 {
  background: #c5ddc5 !important;
}

.hospai-patient .workflow-steps .bg-slate-200 {
  background: var(--pc-border) !important;
}

/* Language pills */
.hospai-patient .lang-pill {
  border-color: var(--pc-border);
  background: var(--pc-surface);
  color: var(--pc-muted);
}

.hospai-patient .lang-pill.active {
  background: var(--pc-primary);
  border-color: var(--pc-primary);
  color: #fff;
}

.hospai-patient .lang-pill:hover:not(.active) {
  background: var(--pc-primary-light);
  border-color: var(--pc-safe-border);
}

/* Mic — soft sage, not harsh cyan/red */
.hospai-patient .mic-btn {
  background: var(--pc-primary) !important;
  box-shadow: 0 4px 12px rgba(107, 158, 143, 0.35);
}

.hospai-patient .mic-btn:hover {
  background: var(--pc-primary-hover) !important;
}

.hospai-patient .mic-btn.listening {
  background: #c9a87c !important;
  box-shadow: 0 0 0 0 rgba(201, 168, 124, 0.45);
}

.hospai-patient .answer-mic {
  background: var(--pc-primary-light) !important;
  border-color: var(--pc-safe-border) !important;
}

.hospai-patient .answer-mic:hover {
  background: var(--pc-primary) !important;
  border-color: var(--pc-primary) !important;
}

.hospai-patient .answer-mic.listening {
  background: var(--pc-accent) !important;
  border-color: var(--pc-accent) !important;
}

/* Read-aloud & voice buttons */
.hospai-patient #btn-read-questions {
  background: var(--pc-primary) !important;
}

.hospai-patient #btn-read-questions:hover {
  background: var(--pc-primary-hover) !important;
}

.hospai-patient #read-aloud-status {
  color: var(--pc-heading) !important;
}

/* Welcome step list */
.hospai-patient .text-sky-700,
.hospai-patient .text-sky-800 {
  color: var(--pc-heading) !important;
}

.hospai-patient .bg-sky-50 {
  background: var(--pc-primary-light) !important;
}

.hospai-patient .border-sky-100,
.hospai-patient .border-sky-200 {
  border-color: var(--pc-safe-border) !important;
}

.hospai-patient label.bg-sky-50 {
  background: var(--pc-accent-light) !important;
  border-color: var(--pc-warm-border) !important;
}

/* Upload zone */
.hospai-patient .border-sky-200.bg-sky-50,
.hospai-patient label .bg-sky-50 {
  background: var(--pc-accent-light) !important;
  border-color: var(--pc-warm-border) !important;
  color: var(--pc-heading) !important;
}

.hospai-patient .bg-slate-700,
.hospai-patient #btn-camera {
  background: var(--pc-heading) !important;
}

.hospai-patient #btn-capture {
  background: var(--pc-primary) !important;
}

/* Complete screen */
.hospai-patient .complete-icon {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pc-safe) 0%, #dff0e8 100%);
  color: var(--pc-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  border: 2px solid var(--pc-safe-border);
}

/* Question highlight when reading */
.hospai-patient [data-question-text].question-reading {
  padding: 0.75rem;
  margin: -0.75rem;
  border-radius: 1rem;
  background: var(--pc-accent-light);
  outline: 2px solid var(--pc-warm-border);
}

/* Nav links & CTA */
.hospai-patient nav a.text-sky-800,
.hospai-patient nav a.hover\:text-sky-600 {
  color: var(--pc-heading) !important;
}

.hospai-patient nav a.bg-sky-700,
.hospai-patient nav .bg-sky-700 {
  background: var(--pc-primary) !important;
}

.hospai-patient nav a.bg-sky-700:hover {
  background: var(--pc-primary-hover) !important;
}

.hospai-patient .bg-emerald-50 {
  background: var(--pc-safe) !important;
}

.hospai-patient .text-emerald-800,
.hospai-patient .border-emerald-200 {
  color: var(--pc-safe-text) !important;
  border-color: var(--pc-safe-border) !important;
}

/* Dashboard cards in patient theme */
.hospai-patient .bg-white {
  background: var(--pc-surface) !important;
}

.hospai-patient .border-slate-200 {
  border-color: var(--pc-border) !important;
}

.hospai-patient .text-slate-800 {
  color: var(--pc-text) !important;
}

.hospai-patient .hover\:bg-sky-50:hover {
  background: var(--pc-primary-light) !important;
}

/* Emergency — still visible but softer container */
.hospai-patient .bg-red-50 {
  background: #fef5f3 !important;
}

.hospai-patient .border-red-300 {
  border-color: #f0c4bc !important;
}

.hospai-patient .text-red-900 {
  color: #9b4d42 !important;
}

.hospai-patient .bg-red-600 {
  background: #c97064 !important;
}

/* Consent checkbox */
.hospai-patient input[type="checkbox"] {
  accent-color: var(--pc-primary);
}

.hospai-patient .welcome-step-num {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pc-accent-light);
  color: var(--pc-heading);
  font-weight: 700;
  font-size: 0.75rem;
}

.hospai-patient .consent-box {
  background: var(--pc-accent-light) !important;
  border: 1px solid var(--pc-warm-border) !important;
}

.hospai-patient .welcome-steps {
  color: var(--pc-text);
}

/* Patient portal header (kiosk) */
.patient-portal-body {
  background: linear-gradient(165deg, var(--pc-bg-soft) 0%, var(--pc-bg) 50%, #fdf9f5 100%) !important;
}

.patient-portal-header {
  background: var(--pc-surface-warm);
  border-bottom: 1px solid var(--pc-border);
  box-shadow: 0 2px 12px var(--pc-shadow);
}

.patient-portal-header .patient-logo {
  color: var(--pc-heading);
}

.patient-portal-header .patient-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--pc-primary-light);
  color: var(--pc-heading);
  border: 1px solid var(--pc-safe-border);
}

.patient-portal-header .patient-logout {
  color: var(--pc-muted);
  text-decoration: none;
}

.patient-portal-header .patient-logout:hover {
  color: var(--pc-heading);
}

.patient-portal-footer {
  background: var(--pc-surface-warm);
  border-top: 1px solid var(--pc-border);
  color: var(--pc-muted);
}

/* Login page — high contrast fields */
.login-page {
  min-height: 100vh;
}

.login-topbar {
  background: var(--pc-surface);
  border-bottom: 2px solid var(--pc-border);
  box-shadow: 0 2px 12px var(--pc-shadow);
}

.login-topbar .login-logo {
  color: var(--pc-heading);
}

.login-card {
  background: var(--pc-surface);
  border: 2px solid var(--pc-border);
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px rgba(74, 69, 64, 0.12);
  padding: 1.75rem 1.5rem 1.5rem;
}

@media (min-width: 480px) {
  .login-card {
    padding: 2rem 2rem 1.75rem;
  }
}

.login-card-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pc-border-soft);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pc-heading);
  line-height: 1.3;
}

.login-lead {
  font-size: 0.95rem;
  color: var(--pc-text);
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--pc-heading);
  letter-spacing: 0.01em;
}

.login-input {
  width: 100%;
  padding: 0.9rem 1rem !important;
  font-size: 1.125rem !important;
  line-height: 1.4;
  color: #2d2926 !important;
  background: #f0f5f2 !important;
  border: 2px solid #9bb8ad !important;
  border-radius: 0.75rem !important;
  min-height: 3.25rem;
  box-shadow: inset 0 1px 2px rgba(74, 69, 64, 0.06);
}

.login-input::placeholder {
  color: #7a8f86 !important;
  opacity: 1;
}

.login-input:focus {
  outline: none;
  border-color: var(--pc-primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 4px rgba(107, 158, 143, 0.25);
}

.login-submit {
  margin-top: 0.35rem;
}

.login-alert {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-alert-success {
  background: #ecfdf3;
  border: 1px solid #86efac;
  color: #166534;
  text-align: center;
}

.login-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  text-align: center;
}

.login-kiosk-box {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 0.85rem;
  background: var(--pc-accent-light);
  border: 2px dashed var(--pc-accent);
}

.login-kiosk-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8b6914;
  margin-bottom: 0.35rem;
}

.login-kiosk-lead {
  font-size: 0.9rem;
  color: var(--pc-text);
  line-height: 1.45;
}

.login-kiosk-btn {
  text-decoration: none !important;
}

.login-kiosk-creds strong {
  color: #2d2926;
  font-weight: 700;
}

.login-kiosk-sep {
  margin: 0 0.35rem;
  color: var(--pc-muted);
}

.login-setup-link {
  margin-top: 1.25rem;
  font-size: 0.85rem;
}

.login-setup-link a {
  color: var(--pc-primary-hover);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-setup-link a:hover {
  color: var(--pc-heading);
}

[dir="rtl"] .login-kiosk-creds {
  text-align: right;
}

[dir="ltr"] .login-kiosk-creds {
  text-align: left;
}

/* Questionnaire cards */
.questionnaire-progress {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pc-heading);
  background: var(--pc-accent-light);
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 999px;
}

.question-card {
  border: none !important;
  margin: 0;
}

.question-card legend {
  padding: 0;
  margin-bottom: 0;
  width: 100%;
}

.question-legend {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  text-align: start;
}

.question-number {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pc-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.question-text {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--pc-text);
  line-height: 1.5;
  padding-top: 0.15rem;
}

.question-input {
  padding: 0.85rem 1rem !important;
  font-size: 1.125rem !important;
  border-radius: 0.75rem !important;
  min-height: 3rem;
}

.question-card-active {
  outline: 2px solid var(--pc-primary);
  outline-offset: 2px;
  background: var(--pc-surface-warm) !important;
}

.question-skip-hint {
  color: var(--pc-muted);
}

.question-read-one {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--pc-border);
  background: var(--pc-primary-light);
  cursor: pointer;
  font-size: 1.1rem;
}

.questionnaire-voice-btn {
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--pc-primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.questionnaire-voice-stop {
  background: var(--pc-muted);
}

.hospai-patient [data-question-text].question-reading {
  outline-color: var(--pc-primary) !important;
  background: var(--pc-primary-light) !important;
}

/* Identity verification after document scan */
.verify-safety-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.verify-field-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--pc-text);
}

.verify-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--pc-border);
  background: var(--pc-surface-warm);
  cursor: pointer;
  font-weight: 600;
}

.verify-choice:has(input:checked) {
  border-color: var(--pc-primary);
  background: var(--pc-primary-light);
}

/* Multi-document upload list */
.paper-doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.paper-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--pc-border);
  background: var(--pc-surface);
}

.paper-doc-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.paper-doc-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: var(--pc-primary-light);
  color: var(--pc-primary);
  white-space: nowrap;
}

.paper-doc-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--pc-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-doc-meta {
  font-size: 0.75rem;
  color: var(--pc-muted);
}

.paper-doc-remove {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 1px solid var(--pc-border);
  background: var(--pc-surface-warm);
  color: var(--pc-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.paper-doc-remove:hover {
  background: #fde8e6;
  border-color: #e8b4b0;
  color: #9b443c;
}
