/* ================================================================
   Clynic Portal — Custom Styles
   Adapted from legacy Clynic design language
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────────── */
:root {
  /* Topbar height — used by non-workspace pages (auth, public) */
  --topbar-height: 60px;

  /* Clynic Color Palette (shared; auth pages, public surfaces) */
  --primary-blue: #2C99FF;
  --primary-blue-hover: #1a7fdd;
  --border-light: #E0E5EB;
  --text-primary: #333333;
  --text-muted: #6C757D;
  --neutral-gray: #6c757d;
  --background-light: #F8F9FA;

  /* Stats Cards — Pastel Palette */
  --stat-card-blue: #8FA8C7;
  --stat-card-teal: #8DB4B8;
  --stat-card-purple: #B5B0D1;
  --stat-card-orange: #E8A87C;
}


/* ── Global Reset / Base ───────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background-light);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-size: 13px;
}

/*
 * Bootstrap defaults: modal 1055, backdrop 1050. Tenant/platform primary rails use
 * z-index 1060, so dialogs were painted underneath and clicks never reached them.
 */
.modal {
  z-index: 12000;
}

.modal-backdrop {
  z-index: 11990;
}



/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}


.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* User menu */
.user-menu {
  position: relative;
}

.user-button {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 13px;
  color: var(--text-primary);
}

.user-button:hover {
  background-color: var(--background-light);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  z-index: 1050;
  display: none;
  margin-top: 0.25rem;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-info {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.user-dropdown-info small {
  color: var(--text-muted);
  font-size: 12px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.15s ease;
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background-color: var(--background-light);
  color: var(--text-primary);
  text-decoration: none;
}

.user-dropdown-item i {
  color: var(--text-muted);
  width: 16px;
  text-align: center;
}

.user-dropdown-divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 0.25rem 0;
}


/* ── Content Area ──────────────────────────────────────────────── */
.content {
  padding: 1.5rem 2rem;
}


/* ── Breadcrumb ────────────────────────────────────────────────── */
.breadcrumb-container {
  background-color: var(--background-light);
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 13px;
}

.breadcrumb-container a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb-container a:hover {
  color: var(--text-primary);
}

.breadcrumb-container .breadcrumb-active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-container .breadcrumb-sep {
  color: var(--text-muted);
  margin: 0 0.4rem;
  font-size: 0.75rem;
}

/* Breadcrumb action buttons — keep btn styling visible */
.breadcrumb-container .btn {
  font-size: 12px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}


/* ── Page Header (title row + action button) ───────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.page-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}


/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--background-light);
}

.card-header h6 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-header i {
  color: var(--text-muted);
}

.card-body {
  padding: 1.25rem;
}


/* ── KPI / Stats Cards ─────────────────────────────────────────── */

/* Single-row flex container — cards share width equally */
.stats-row {
  display: flex;
  gap: 1rem;
}

.stats-row > .stat-card {
  flex: 1 1 0;
  min-width: 0;
}

/* Grid fallback (legacy) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.stat-card-blue { border-left-color: var(--stat-card-blue); }
.stat-card-teal { border-left-color: var(--stat-card-teal); }
.stat-card-purple { border-left-color: var(--stat-card-purple); }
.stat-card-orange { border-left-color: var(--stat-card-orange); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background-color: var(--background-light);
}

.stat-card-blue .stat-icon { color: var(--stat-card-blue); }
.stat-card-teal .stat-icon { color: var(--stat-card-teal); }
.stat-card-purple .stat-icon { color: var(--stat-card-purple); }
.stat-card-orange .stat-icon { color: var(--stat-card-orange); }

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

/* Legacy KPI card support (Bootstrap grid approach) */
.kpi-card {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: box-shadow 0.2s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-icon {
  font-size: 1.5rem;
  opacity: 0.5;
}


/* ── Tables ────────────────────────────────────────────────────── */
.table-portal {
  font-size: 13px;
}

.table-portal th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background-color: #e9ecef;
  border-bottom-width: 2px;
}

.table-portal td {
  vertical-align: middle;
}

.table-portal .sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.table-portal .sort-link:hover {
  color: var(--primary-blue);
}

/* Sort icon — always visible on the right */
.table-portal .sort-link .sort-icon {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.35;
  flex-shrink: 0;
}

/* Active sort — full opacity */
.table-portal .sort-link.active .sort-icon {
  opacity: 1;
  color: var(--primary-blue);
}

/* Hover on inactive sort — raise opacity */
.table-portal .sort-link:hover .sort-icon {
  opacity: 0.7;
}

.table-hover tbody tr:hover {
  background-color: var(--background-light);
}

/* ── Resizable Table Columns ───────────────────────────────────── */
.table-resizable {
  table-layout: fixed;
  /* Allow the table to grow beyond its container */
  min-width: 100%;
  width: max-content;
}

.table-resizable th {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-resizable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Resize handle — invisible by default, appears on hover */
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

/* Visible indicator line on hover */
.col-resize-handle::after {
  content: '';
  position: absolute;
  top: 25%;
  right: 2px;
  width: 3px;
  height: 50%;
  border-radius: 2px;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

.col-resize-handle:hover::after {
  background-color: var(--primary-blue);
}

/* Active dragging state */
.col-resize-handle.resizing::after {
  background-color: var(--primary-blue);
  top: 0;
  height: 100%;
}

/* Full-page overlay during drag to keep cursor stable */
.col-resize-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  cursor: col-resize;
  z-index: 9999;
}

/* Guide line that shows across the full table height during drag */
.col-resize-guide {
  position: absolute;
  top: 0;
  width: 2px;
  background-color: var(--primary-blue);
  opacity: 0.5;
  pointer-events: none;
  z-index: 11;
}


/* ── Status Badges ─────────────────────────────────────────────── */
.badge-active { background-color: #198754 !important; }
.badge-suspended { background-color: #dc3545 !important; }
.badge-provisioning { background-color: #ffc107 !important; color: #000 !important; }
.badge-deactivated { background-color: var(--neutral-gray) !important; }

/* Billing status badges */
.badge-trialing { background-color: #0dcaf0 !important; color: #000 !important; }
.badge-past_due { background-color: #fd7e14 !important; }
.badge-canceled { background-color: #6c757d !important; }

/* Invoice status badges */
.badge-draft { background-color: #adb5bd !important; }
.badge-open { background-color: #0d6efd !important; }
.badge-paid { background-color: #198754 !important; }
.badge-void { background-color: #6c757d !important; }
.badge-uncollectible { background-color: #dc3545 !important; }


/* ── Buttons (Clynic Color Schema) ────────────────────────── */
/* Primary / "New" buttons: white text everywhere (shared by platform & tenant base) */
.btn.btn-primary,
a.btn-primary {
  background-color: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #ffffff !important;
  font-size: 13px;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus,
a.btn-primary:hover,
a.btn-primary:focus {
  background-color: var(--primary-blue-hover);
  border-color: var(--primary-blue-hover);
  color: #ffffff !important;
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  font-size: 13px;
}

.btn-secondary:hover {
  background-color: var(--background-light);
  border-color: var(--primary-blue);
  color: var(--text-primary);
}


/* ── Forms ──────────────────────────────────────────────────────── */
.portal-form {
  max-width: 640px;
}

.portal-form .form-label,
.form-label {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  font-size: 13px;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.2rem rgba(44, 153, 255, 0.2);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.portal-form .form-text,
.form-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Form actions — right-aligned with border-top */
.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

/* Validation */
.invalid-feedback {
  color: #dc3545;
  font-size: 12px;
  margin-top: 0.25rem;
}

.valid-feedback {
  color: #28a745;
  font-size: 12px;
  margin-top: 0.25rem;
}

.form-control.is-invalid {
  border-color: #dc3545;
}

.form-control.is-valid {
  border-color: #28a745;
}

/* Required field indicator */
.form-label .text-danger,
.required {
  color: #dc3545;
}


/* ── Action Buttons ────────────────────────────────────────────── */
.btn-action {
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}


/* ── Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
  background: #ffffff;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.filter-bar .form-control,
.filter-bar .form-select {
  font-size: 13px;
}


/* ── Detail Page ───────────────────────────────────────────────── */
.detail-header {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.detail-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detail-value {
  font-size: 13px;
}


/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state > i {
  font-size: 3rem;
  opacity: 0.3;
}

.empty-state .btn {
  font-size: 12px;
  padding: 0.25rem 0.6rem;
}


/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
  font-size: 13px;
}

.page-link {
  font-size: 13px;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.page-link:hover {
  background-color: var(--background-light);
  border-color: var(--primary-blue);
  color: var(--text-primary);
}

.page-item.active .page-link {
  background-color: var(--neutral-gray);
  border-color: var(--neutral-gray);
  color: #ffffff;
}


/* ── Flash Messages (toast-style, top-right) ───────────────────── */
.portal-messages {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  max-width: 400px;
}

.portal-messages .alert {
  font-size: 13px;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.5rem;
}


/* ── Links ─────────────────────────────────────────────────────── */
a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-blue);
}


/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .stats-row {
    flex-wrap: wrap;
  }

  .stats-row > .stat-card {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 140px;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 1rem;
  }

  .stats-row > .stat-card {
    flex: 1 1 calc(50% - 1rem);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-row > .stat-card {
    flex: 1 1 100%;
  }
}


/* ================================================================
   Login / Auth Pages
   ================================================================ */

/* ── Login Page ─────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, #e9e7e7 0%, #e9ecef 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #212529;
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.auth-card {
  background: #ffffff;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #dee2e6;
}

.auth-header {
  background: #ffffff;
  padding: 2rem 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid #dee2e6;
}

.auth-logo {
  margin-bottom: 1.5rem;
}

.auth-logo h1 {
  color: #212529;
  font-size: 2rem !important;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

/* Logo: explicit size, no transform/bitmap scaling — SVG scales via viewBox for crisp rendering at any DPI */
.auth-logo .auth-logo-img {
  width: 4rem;
  height: 4rem;
  display: block;
  margin: 0 auto 0.5rem;
}
img.auth-logo-img {
  object-fit: contain;
}

.auth-logo p {
  color: #212529;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  opacity: 0.8;
}

.auth-body {
  padding: 2rem;
  background: #ffffff;
}

/* Auth form — consistent spacing between groups */
.auth-form .auth-field {
  margin-bottom: 1.5rem;
}

.auth-form .auth-field:last-of-type {
  margin-bottom: 0;
}

/* Auth form labels with icons */
.auth-body .form-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.auth-body .form-label i {
  color: #6b7280;
  font-size: 0.8rem;
}

/* Auth form inputs — uniform width, larger, rounded */
.auth-body .form-control {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  color: #1f2937;
}

.auth-body .form-control:focus {
  background-color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  color: #1f2937;
}

.auth-body .form-control::placeholder {
  color: #9ca3af;
}

/* Password input wrapper for toggle */
.password-input-wrapper {
  position: relative;
  width: 100%;
}

.password-input-wrapper .form-control {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.2s ease;
  font-size: 1rem;
  line-height: 1;
}

.password-toggle:hover {
  color: #374151;
}

.password-toggle:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Auth actions — spacing above submit button */
.auth-actions {
  margin-top: 2rem;
}

/* Auth help link below the form */
.auth-help {
  text-align: center;
  margin-top: 1.25rem;
}

.auth-help p {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}

.auth-help a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.auth-help a:hover {
  text-decoration: underline;
  color: #2563eb;
}

/* Auth submit button */
.btn-auth-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background-color: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-auth-submit:hover {
  background-color: #2563eb;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.btn-auth-submit:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.btn-auth-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Auth alert styles */
.auth-body .alert-error,
.auth-body .alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.auth-body .alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fed7aa;
  color: #d97706;
}

.auth-body .alert-info {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

.auth-body .alert i {
  margin-top: 0.125rem;
  flex-shrink: 0;
}

/* Auth footer */
.auth-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
}

.auth-footer p {
  margin: 0;
  color: #212529;
  font-size: 0.85rem;
  opacity: 0.8;
}

.auth-footer a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
  color: #2563eb;
}

/* Reset password — invalid link icon */
.auth-body .invalid-link-icon {
  font-size: 3rem;
  color: #dc3545;
}

/* Auth responsive */
@media (max-width: 576px) {
  .auth-container {
    padding: 0;
  }

  .auth-header {
    padding: 1.5rem 1.5rem 1rem;
  }

  .auth-body {
    padding: 1.5rem;
  }

  .btn-auth-submit {
    padding: 0.75rem 1.25rem;
  }
}

/* ── Questionnaire response form ─────────────────────────────────── */
#questionnaire-form-container .questionnaire-question {
  overflow: visible;
  margin-bottom: 1rem;
}

#questionnaire-form-container .questionnaire-field-wrap ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 0.25rem 0;
}

#questionnaire-form-container .questionnaire-field-wrap ul li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 1.5rem;
}

#questionnaire-form-container .questionnaire-field-wrap ul li label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
}

#questionnaire-form-container .questionnaire-field-wrap ul li input.form-check-input {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  margin-top: 0;
}

.questionnaire-form-actions {
  clear: both;
}

/* Tenant workspace loads portal.css first; align legacy portal primary vars with canonical Charcoal Blue */
body.tenant-workspace {
  --primary-blue: #28536b;
  --primary-blue-hover: #22485d;
}

/* ── Patient portal shell — extends body.tenant-workspace ────────────────────
   All canonical design tokens come from tenant_workspace.css (body.tenant-workspace).
   Only portal-specific layout and component overrides belong here.
   ──────────────────────────────────────────────────────────────────────────── */
body.tenant-workspace.patient-portal {
  /* No icon rail: brand column spans subnav width only */
  --tenant-brand-width: var(--tenant-subnav-width);
  /* Slightly wider subnav than clinical shell for patient label readability */
  --tenant-subnav-width: 240px;
}

/* Brand link in the charcoal topbar */
.patient-portal-brand-link {
  color: var(--color-brand-primary-contrast-text, #ffffff);
}

.patient-portal-brand-link:hover {
  color: var(--color-brand-primary-contrast-text, #ffffff);
  text-decoration: none;
}

.patient-portal-brand-icon {
  font-size: 1.1rem;
  opacity: 0.85;
  color: var(--color-brand-primary-contrast-text, #ffffff);
}

/* ── Patient-specific page component styles ──────────────────────────────── */

.patient-empty-state__icon {
  font-size: 2.5rem;
  color: var(--color-text-muted);
  opacity: 0.45;
}

.patient-page-header h1 {
  color: var(--color-text-primary);
}

.patient-quick-card {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  border-color: var(--color-border-soft) !important;
}

.patient-quick-card:hover {
  box-shadow: 0 0.25rem 0.75rem rgba(36, 55, 70, 0.08);
}

.patient-dashboard-welcome {
  background: linear-gradient(135deg, rgba(40, 83, 107, 0.07) 0%, rgba(246, 240, 237, 0.9) 100%);
  border: 1px solid var(--color-border-soft);
  border-radius: 0.75rem;
}

/* Phase 4: evolution SVG sparklines (patient portal) */
.evolution-sparkline-wrap .evolution-sparkline {
  display: block;
  width: 100%;
  height: 8rem;
  color: var(--color-brand-primary, #28536b);
}
