/* ─── profile.css ───────────────────────────────────────── */

/* 1) Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* 2) Color palette */
:root {
  --color-bg-page:        #f3f4f6;
  --color-card-bg:        #ffffff;
  --color-border:         #e5e7eb;
  --color-text:           #111827;
  --color-subtext:        #6b7280;
  --color-primary:        #2563eb;
  --color-primary-hover:  #1e40af;
}

/* 3) Overlay & container (full-screen white) */
#client-profile-page {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;  height: 100vh;
  background: var(--color-card-bg);
  overflow: hidden; /* Changed from auto to hidden */
  display: flex;
  flex-direction: column;
  z-index: 10001;
  font-family: 'Inter', system-ui, sans-serif;
}
#client-profile-page.hidden {
  display: none !important;
}
/* inner wrapper now just flows full-width/height */
#client-profile-page .profile-container {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden; /* Changed from auto to hidden */
  display: flex;
  flex-direction: column;
  background: var(--color-bg-page);
}

/* 4) Header */
#client-profile-page .client-page-header {
  --profile-header-open-shift: 0px;
  background: var(--color-card-bg);
  border-bottom: 1px solid var(--color-border);
  min-height: 82px;
  padding: 1rem 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--color-text);
  flex-shrink: 0; /* Prevent header from shrinking */
}

#client-profile-page .client-page-header .close-button {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 92px;
  height: 42px;
  padding: 0 1rem;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#client-profile-page .client-page-header .close-button:hover {
  transform: translateY(calc(-50% - 1px));
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  border-color: rgba(37, 99, 235, 0.24);
}

#client-profile-page #profile-name {
  margin: 0;
  position: relative;
  z-index: 1;
  max-width: min(520px, calc(100% - 300px));
  padding: 0 1.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  transform: translateX(var(--profile-header-open-shift));
  transition: transform 0.28s ease, max-width 0.28s ease;
}

#client-profile-page #profile-name .profile-name-text {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.22em;
  max-width: 100%;
}

#client-profile-page #profile-name .profile-last-name-wrap {
  position: relative;
  display: inline-block;
  padding-right: 0.68em;
  max-width: 100%;
}

#client-profile-page #profile-name .profile-last-name-text {
  display: inline-block;
}

#client-profile-page #profile-name .profile-family-link-indicator-btn {
  position: absolute;
  top: -2px;
  right: -1px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  border-radius: 999px;
  line-height: 1;
  font-size: 18px;
}

#client-profile-page #profile-name .profile-family-link-indicator-btn:hover {
  color: #1d4ed8;
}

#client-profile-page #profile-name .profile-family-link-indicator-btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

#client-profile-page #profile-name .profile-family-link-indicator-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

#client-profile-page .client-page-header.profile-menu-open {
  --profile-header-open-shift: -58px;
}

#client-profile-page .client-page-header.profile-menu-open #profile-name {
  max-width: min(460px, calc(100% - 520px));
}

#client-profile-page .client-page-header .profile-header-actions {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  max-width: calc(100% - 170px);
  z-index: 2;
}

#client-profile-page .profile-action-rail {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateX(12px);
  white-space: nowrap;
  transition:
    max-width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease,
    transform 0.28s ease;
}

#client-profile-page .client-page-header.profile-menu-open .profile-action-rail {
  max-width: 720px;
  opacity: 1;
  transform: translateX(0);
}

/* 5) Details card */
#profile-details {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.95rem 1rem;
  margin: 1rem 1.5rem;
  color: var(--color-text);
  flex-shrink: 0;
}

.profile-banner-pills {
  display: block;
}

.profile-banner-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.profile-banner-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  flex: 0 0 auto;
  max-width: none;
  padding: 0.34rem 0.68rem;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  font-size: var(--profile-banner-pill-font-size, 0.96rem);
  line-height: 1.18;
  color: #475569;
  white-space: nowrap;
  overflow: visible;
}

.profile-banner-label {
  font-weight: 800;
  color: #64748b;
  white-space: nowrap;
  flex: 0 0 auto;
}

.profile-banner-value {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: 0;
}

@media (max-width: 900px) {
  .profile-banner-row {
    flex-wrap: wrap;
  }

  .profile-banner-pill {
    flex: 0 1 auto;
    font-size: 0.78rem;
  }
}

/* 5b) Edit-mode inputs (match the Address field styling)
   Apply the same look to DOB / Phone / Email / Most Recent Plan inputs
   when the profile is in edit mode. */
#profile-details input {
  width: auto;
  min-width: 120px;
  max-width: 100%;
  padding: 0.32rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-sizing: border-box;
  font-size: 0.84rem;
  color: var(--color-text);
  background: #fff;
}

#profile-details input::placeholder {
  color: var(--color-subtext);
}

#profile-details input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 6) Interactions & Notes panels container - UPDATED FOR FIXED HEIGHT */
.profile-container > div:last-child {
  display: grid;
  grid-template-columns: 1fr 2fr; /* Changed from 1fr 1fr to 1fr 2fr for 1/3 and 2/3 split */
  gap: 2rem;
  margin: 0 1.5rem 1.5rem;
  flex: 1; /* Take up remaining space */
  min-height: 0; /* Allow flex item to shrink */
}
@media (max-width: 768px) {
  .profile-container > div:last-child {
    grid-template-columns: 1fr; /* Keep single column on mobile */
  }
}

/* 7) Panel common styles - UPDATED FOR FIXED HEIGHT */
#client-profile-page .panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  height: 100%; /* Fill the grid cell */
  overflow: hidden; /* Prevent panel from growing */
}
#client-profile-page .panel h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  flex-shrink: 0; /* Keep header at top */
}

/* 8) Interactions list - UPDATED FOR SCROLLING */
#profile-interactions {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1; /* Take remaining space */
  overflow-y: auto; /* Scroll when content overflows */
  min-height: 0; /* Allow flex item to shrink */
}
#profile-interactions li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-subtext);
}
#profile-interactions li:last-child {
  border-bottom: none;
}

/* 9) Notes panel - UPDATED FOR FIXED HEIGHT */
#profile-notes-search {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 1rem;
  flex-shrink: 0; /* Keep search at top */
}
#profile-notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1; /* Take remaining space */
  overflow-y: auto; /* Scroll when content overflows */
  min-height: 0; /* Allow flex item to shrink */
}
#profile-notes-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: relative;    /* for absolutely-positioned menu */
}

/* style the timestamp on its own first line */
#profile-notes-list li time {
  font-size: 0.875rem;
  color: var(--color-subtext);
  margin-bottom: 0.25rem;
}

/* clamp the note content to two lines */
#profile-notes-list li p {
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: calc(1em * 1.2 * 2); /* approx. 2 lines at 1.2 line-height */
  line-height: 1.2;
}

#profile-notes-list li:last-child {
  border-bottom: none;
}
#profile-notes-pagination {
  margin-top: 1rem;
  flex-shrink: 0; /* Keep pagination at bottom */
}
#profile-notes-pagination button {
  background: none;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  margin: 0 0.5rem;
  cursor: pointer;
}
#profile-notes-pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* 10) Profile-only button styling */
#client-profile-page .profile-rail-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.62rem;
  height: 46px;
  padding: 0 1rem 0 0.9rem;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%);
  box-shadow: none;
  color: #0f172a;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

#client-profile-page .profile-rail-action:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(219,234,254,0.94) 100%);
}

#client-profile-page .profile-rail-action:focus-visible,
#client-profile-page .profile-header-menu-toggle:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.22);
  outline-offset: 2px;
}

#client-profile-page .profile-rail-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
}

#client-profile-page .profile-rail-action-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

#client-profile-page .profile-rail-action .label {
  font-size: 0.92rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #0f172a;
}

#client-profile-page .profile-header-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%);
  box-shadow: none;
  color: #0f172a;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

#client-profile-page .profile-header-menu-toggle:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(219,234,254,0.94) 100%);
}

#client-profile-page .profile-header-menu-toggle-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

#client-profile-page .profile-header-menu-toggle-chevron {
  width: 9px;
  height: 9px;
  border-top: 2px solid #2563eb;
  border-left: 2px solid #2563eb;
  transform: rotate(-45deg);
  transition: transform 0.28s ease;
}

#client-profile-page .profile-header-menu-toggle-bars {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

#client-profile-page .profile-header-menu-toggle-bars span {
  display: block;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #2563eb;
}

#client-profile-page .client-page-header.profile-menu-open .profile-header-menu-toggle {
  background: linear-gradient(180deg, rgba(239,246,255,1) 0%, rgba(219,234,254,0.96) 100%);
}

#client-profile-page .client-page-header.profile-menu-open .profile-header-menu-toggle-chevron {
  transform: rotate(135deg);
}

/* ─── Add Note button (icon‐only) ─────────────────────────── */
#add-profile-note {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
#add-profile-note .label {
  display: none;
}
#add-profile-note .plus {
  font-size: 1.875rem;
  line-height: 1;
  color: var(--color-primary);
  transition: opacity .2s ease;
}
#add-profile-note:hover .plus {
  opacity: 0.7;
}
/* ─── note info button & menu ───────────────────────────────── */
.note-info-btn {
  background: none;
  border: none;
  color: var(--color-subtext);
  font-size: 1rem;
  margin-left: 0.5rem;
  cursor: pointer;
}
.note-info-btn:hover {
  color: var(--color-primary);
}

/* ─── NOTE ACTIONS MODAL: NEW, SINGLE SOURCE OF TRUTH ────────── */
#note-actions-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}
#note-actions-modal.hidden {
  display: none !important;
}
#note-actions-modal .modal-content {
  width: 960px !important;
  min-height: 720px !important;
  max-width: 98vw;
  max-height: 90vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
  padding: 1.35rem 1.8rem 1.6rem 1.8rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#note-actions-modal .note-actions-modal-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex: 0 0 auto;
}

#note-actions-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 800;
  color: #111827;
  text-align: center;
  letter-spacing: -0.02em;
}

#delete-note-icon-btn,
#close-note-actions {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  box-shadow: none;
  transition: color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

#delete-note-icon-btn {
  color: #dc2626;
  font-size: 1.45rem;
}

#delete-note-icon-btn:hover {
  color: #b91c1c;
  transform: translateY(-1px);
}

#close-note-actions {
  color: #64748b;
  font-size: 1.85rem;
  font-weight: 700;
}

#close-note-actions:hover {
  color: #334155;
  transform: translateY(-1px);
}

#note-actions-body {
  flex: 1 1 auto;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#note-actions-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid #e5e7eb;
  font-size: 1rem;
  flex: 0 0 auto;
}

.modal-note-block {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
  padding: 1rem 1rem 0.95rem;
}

.modal-note-block-current {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.modal-note-header {
  font-size: 1rem;
  color: var(--color-subtext, #888);
  margin-bottom: 0.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.modal-note-timestamp {
  font-size: 0.95rem;
  color: #6b7280;
  margin-right: 0.25rem;
}

.modal-note-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.modal-note-chip-current {
  background: #dbeafe;
  color: #1d4ed8;
}

.modal-note-content {
  font-size: 1.05rem;
  margin-bottom: 0;
  color: #232323;
  word-break: break-word;
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-actions-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #f5d0fe;
  background: #faf5ff;
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
}

.note-actions-alert-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b21a8;
}

.note-actions-jump-latest-btn,
.note-actions-inline-btn,
.timeline-card-open-latest-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.note-actions-jump-latest-btn:hover,
.note-actions-inline-btn:hover,
.timeline-card-open-latest-btn:hover {
  color: #1d4ed8;
}

.note-actions-story-composer {
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 16px;
  padding: 1rem;
}

.note-actions-story-composer-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #1d4ed8;
  margin-bottom: 0.6rem;
}

.note-actions-story-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.note-actions-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-actions-editor-textarea {
  width: 100%;
  resize: vertical;
  min-height: 160px;
  font-size: 1.02rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
  background: #ffffff;
  color: #111827;
  line-height: 1.45;
}

.note-actions-upload-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  padding: 0.75rem 0.85rem;
}

.note-actions-upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.note-actions-upload-hint,
.note-actions-upload-empty,
.note-actions-selected-file-size,
.note-actions-doc-empty {
  font-size: 0.84rem;
  color: #64748b;
}

.note-actions-selected-files {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.note-actions-selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  padding: 0.6rem 0.75rem;
}

.note-actions-selected-file-meta {
  min-width: 0;
}

.note-actions-selected-file-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.note-actions-selected-file-remove {
  border: none;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.note-actions-selected-file-remove:hover {
  background: rgba(15, 23, 42, 0.1);
}

.note-actions-doc-center {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.note-actions-doc-center-title {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.note-actions-doc-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.note-actions-doc-group-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #64748b;
}

.note-actions-doc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.note-actions-doc-link {
  min-width: 180px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
}

.note-actions-doc-link:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.note-actions-doc-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  word-break: break-word;
}

.note-actions-doc-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

.modal textarea,
#note-actions-body textarea {
  width: 100%;
  resize: vertical;
  font-size: 1.05rem;
  margin-bottom: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
  background: #f8fafc;
}

#note-actions-modal .action-button {
  background: var(--color-primary, #2563eb);
  color: #fff;
  border: none;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  font-size: 0.98rem;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.18s ease, opacity 0.18s ease;
}

#note-actions-modal .action-button:hover:not(:disabled) {
  background: #1459b9;
  transform: translateY(-1px);
}

#note-actions-modal .action-button:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  transform: none;
}

.note-actions-footer-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#note-actions-modal .note-actions-footer-btn {
  min-width: 118px;
}

#note-actions-modal .note-actions-footer-btn.is-active {
  background: #1d4ed8;
}

#note-actions-modal .note-actions-save-btn:disabled {
  background: #cbd5e1;
  color: #64748b;
}

#note-actions-modal .note-actions-print-btn {
  background: #e2e8f0;
  color: #334155;
}

#note-actions-modal .note-actions-print-btn:hover:not(:disabled) {
  background: #cbd5e1;
}

/* ---------- Misc ---------- */
@media (max-width: 1000px) {
  #note-actions-modal .modal-content {
    width: 98vw !important;
    min-height: 80vh !important;
    padding: 1rem;
  }
}
/* ─── PROFILE PAGE OVERRIDES ────────────────────────────────── */
/* Ensure profile page styles take precedence over generic .panel styles */
#client-profile-page * {
  box-sizing: border-box;
}

/* Override any conflicting panel styles for profile page */
#client-profile-page .panel {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 1.25rem !important;
  color: #111827 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
  cursor: default !important;
}

/* Ensure profile container layout works */
#client-profile-page .profile-container > div:last-child {
  display: grid !important;
  grid-template-columns: 1fr 2fr !important;
  gap: 2rem !important;
  margin: 0 1.5rem 1.5rem !important;
  flex: 1 !important;
  min-height: 0 !important;
}

/* Override any conflicting flex/grid properties */
#client-profile-page .profile-container {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  background: #f3f4f6 !important;
}


/* Add Profile Note modal tweaks */
#add-profile-note-text { resize: vertical; }


/* Add Profile Note Modal overlay */
#add-profile-note-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
}

#add-profile-note-modal.hidden {
  display: none !important;
}

/* Keep textarea usable */
#add-profile-note-text {
  resize: vertical;
}

/* Saved note document attachments */
#profile-notes-list .note-documents-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#profile-notes-list .note-document-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

#profile-notes-list .note-document-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

#profile-notes-list .note-document-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #eef2f7;
  border: 1px solid #d5dde8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#profile-notes-list .note-document-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#profile-notes-list .note-document-thumb.note-document-thumb-pdf {
  background: #fff;
  padding: 0;
  overflow: hidden;
  position: relative;   /* REQUIRED for cropping */
}

#profile-notes-list .note-document-pdf-frame {
  position: absolute;
  top: -8px;       /* pushes viewer up to hide top UI */
  left: -8px;      /* pushes left to hide scrollbar gutter */

  width: calc(100% + 20px);
  height: calc(100% + 20px);

  border: none;
  pointer-events: none;

  transform: scale(0.9);
  transform-origin: top left;
}

#profile-notes-list .note-document-thumb-placeholder {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 700;
}

#profile-notes-list .note-document-meta {
  min-width: 0;
}

#profile-notes-list .note-document-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

#profile-notes-list .note-document-size {
  margin-top: 4px;
  font-size: 0.84rem;
  color: #6b7280;
}

/* ─── FAMILY LINK MODAL ───────────────────────────────────────── */
#family-link-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12550;
}

#family-link-modal.hidden {
  display: none !important;
}

#family-link-modal .family-link-modal-content {
  position: relative;
  width: 860px;
  max-width: 94vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  padding: 24px;
}

#family-link-title {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

#family-link-modal .family-link-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#family-link-modal .family-link-close:hover {
  color: #a80f0f;
}

#family-link-modal .family-link-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.family-link-kicker {
  margin-top: 8px;
  margin-bottom: 18px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
}

.family-link-body {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.family-link-panel {
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
}

.family-link-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}

.family-link-current-name {
  font-size: 1.08rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 8px;
}

.family-link-current-sub {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
}

/* ─── Family Tree ─────────────────────────────────────────────── */
.family-link-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.family-link-tree-empty {
  font-size: 0.95rem;
  color: #64748b;
}

.family-link-tree-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.family-link-tree-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px 14px;
}

.family-link-tree-person {
  min-width: 0;
}

.family-link-tree-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.family-link-tree-relationship {
  margin-top: 4px;
  font-size: 0.87rem;
  color: #475569;
}

.family-link-tree-action {
  border: none;
  border-radius: 10px;
  padding: 0.58rem 0.85rem;
  background: rgba(0,0,0,0.08);
  color: #111;
  font-size: 0.9rem;
  cursor: pointer;
}

.family-link-tree-action:hover {
  background: rgba(0,0,0,0.12);
}

.family-link-search-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.family-link-search-controls {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.family-link-relationship-label {
  display: block;
  grid-column: 1 / 2;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
}

.family-link-relationship-select {
  grid-column: 1 / 3;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.96rem;
  background: #fff;
  color: #111827;
}

.family-link-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.96rem;
  background: #fff;
  color: #111827;
}

.family-link-search-input:focus,
.family-link-relationship-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.family-link-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 250px));
  gap: 12px;
  align-content: start;
  justify-content: start;
  max-height: 240px;
  overflow-y: auto;
}

.family-link-search-empty {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  color: #64748b;
}

.family-link-search-result-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 250px;
  max-width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px 14px;
}

.family-link-search-result-person {
  min-width: 0;
}

.family-link-search-result-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.family-link-search-result-sub {
  margin-top: 4px;
  font-size: 0.87rem;
  color: #475569;
}

.family-link-search-result-action {
  border: none;
  border-radius: 10px;
  padding: 0.58rem 0.85rem;
  background: #2563eb;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.family-link-search-result-action:hover {
  background: #1d4ed8;
}

.family-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.family-link-btn {
  border: none;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.family-link-btn-secondary {
  background: rgba(0,0,0,0.08);
  color: #111;
}

.family-link-btn-secondary:hover {
  background: rgba(0,0,0,0.12);
}

/* ─── FAMILY LINK SEARCH RESULT SPACING TUNE ─────────────────── */
.family-link-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 238px));
  gap: 14px;
  align-content: start;
  justify-content: start;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}

.family-link-search-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  padding: 10px 12px;
}

@media (max-width: 760px) {
  .family-link-search-controls {
    grid-template-columns: 1fr;
  }

  .family-link-relationship-label,
  .family-link-relationship-select {
    grid-column: auto;
  }

  .family-link-search-results {
    grid-template-columns: 1fr;
  }

  .family-link-search-result-card {
    width: 100%;
  }
}

/* ─── MERGE PROFILE SELECTOR MODAL ────────────────────────────── */
#merge-profile-selector-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12560;
}

#merge-profile-selector-modal.hidden {
  display: none !important;
}

#merge-profile-selector-modal .merge-profile-selector-modal-content {
  position: relative;
  width: 760px;
  max-width: 94vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  padding: 24px;
}

#merge-profile-selector-title {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

#merge-profile-selector-modal .merge-profile-selector-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#merge-profile-selector-modal .merge-profile-selector-close:hover {
  color: #a80f0f;
}

#merge-profile-selector-modal .merge-profile-selector-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.merge-profile-selector-kicker {
  margin-top: 8px;
  margin-bottom: 18px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
}

.merge-profile-selector-body {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.merge-profile-selector-panel {
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
  min-height: 0;
}

.merge-profile-selector-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}

.merge-profile-selector-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.merge-profile-selector-empty {
  font-size: 0.95rem;
  color: #64748b;
}

.merge-profile-selector-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px 14px;
}

.merge-profile-selector-checkbox {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.merge-profile-selector-person {
  min-width: 0;
}

.merge-profile-selector-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.merge-profile-selector-relationship {
  margin-top: 4px;
  font-size: 0.87rem;
  color: #475569;
}

.merge-profile-selector-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.merge-profile-selector-btn {
  border: none;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.merge-profile-selector-btn-primary {
  background: #2563eb;
  color: #fff;
}

.merge-profile-selector-btn-primary:hover {
  background: #1d4ed8;
}

/* ─── NOTE ENTRY MODAL (Add Note) ─────────────────────────────── */
#note-entry-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000; /* above note-actions modal */
}

#note-entry-modal.hidden {
  display: none !important;
}

#note-entry-modal .note-entry-modal-content {
  position: relative;
  width: 640px;
  max-width: 92vw;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 18px 60px rgba(0,0,0,0.25);
}

/* Close (X) */
#note-entry-modal .note-entry-close {
  position: absolute;
  top: 12px;
  right: 12px;

  background: transparent;
  border: none;
  padding: 6px;

  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#note-entry-modal .note-entry-close:hover {
  color: #a80f0f;
}

#note-entry-modal .note-entry-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Title */
#note-entry-modal #note-entry-title {
  margin: 0 0 18px 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Label + upload area + textarea */
#note-entry-modal .note-entry-label {
  display: block;
  margin: 0 0 8px 0;
  font-weight: 600;
}

#note-entry-modal .note-entry-upload-wrap {
  margin-bottom: 18px;
}

#note-entry-modal .note-entry-dropzone {
  width: 100%;
  min-height: 100px;
  border: 2px dashed #c7d2e0;
  border-radius: 14px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#note-entry-modal .note-entry-dropzone:hover,
#note-entry-modal .note-entry-dropzone:focus {
  border-color: var(--color-primary);
  background: #f3f8ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
  outline: none;
}

#note-entry-modal .note-entry-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#note-entry-modal .note-entry-drop-icon {
  font-size: 2rem;
  line-height: 1;
}

#note-entry-modal .note-entry-drop-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

#note-entry-modal .note-entry-drop-sub {
  font-size: 0.92rem;
  color: #6b7280;
}

#note-entry-modal .note-entry-files-preview {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#note-entry-modal .note-entry-files-preview.hidden {
  display: none !important;
}

#note-entry-modal .note-entry-file-preview-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #ffffff;
}

#note-entry-modal .note-entry-file-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #eef2f7;
  border: 1px solid #d5dde8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#note-entry-modal .note-entry-file-thumb-placeholder {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 600;
}

#note-entry-modal .note-entry-file-meta {
  min-width: 0;
}

#note-entry-modal .note-entry-file-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

#note-entry-modal .note-entry-file-size {
  margin-top: 4px;
  font-size: 0.86rem;
  color: #6b7280;
}

#note-entry-modal .note-entry-file-remove {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  background: rgba(0,0,0,0.08);
  color: #111;
  cursor: pointer;
  font-size: 0.92rem;
}

#note-entry-modal .note-entry-file-remove:hover {
  background: rgba(0,0,0,0.12);
}

#note-entry-modal #note-entry-text {
  width: 100%;
  box-sizing: border-box;

  min-height: 180px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.25);

  font-size: 1rem;
  line-height: 1.35;

  resize: vertical;
}

/* Actions row */
#note-entry-modal .note-entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.note-entry-btn {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

#note-entry-save {
  background: var(--color-primary);
  color: #fff;
}

#note-entry-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#note-entry-cancel {
  background: rgba(0,0,0,0.08);
  color: #111;
}

#note-entry-cancel:hover {
  background: rgba(0,0,0,0.12);
}

/* ─── EMAIL REPORT MODAL ─────────────────────────────────────── */
#email-report-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12500;
}

#email-report-modal.hidden {
  display: none !important;
}

#email-report-modal .email-report-modal-content {
  position: relative;
  width: 1100px;
  max-width: 94vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  padding: 24px;
}

#email-report-title {
  margin: 0 0 18px 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

#email-report-modal .email-report-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#email-report-modal .email-report-close:hover {
  color: #a80f0f;
}

#email-report-modal .email-report-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.email-report-section {
  margin-bottom: 16px;
}

.email-report-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #111827;
}

#email-report-referral,
#email-report-extra-notes {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  background: #fff;
  color: #111827;
}

#email-report-extra-notes {
  resize: vertical;
}

.email-report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 16px;
  min-height: 0;
}

.email-report-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.email-report-panel-title {
  padding: 12px 14px;
  font-size: 0.98rem;
  font-weight: 700;
  color: #111827;
  border-bottom: 1px solid #dbe3ee;
  background: #f1f5f9;
}

.email-report-list {
  flex: 1;
  min-height: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
}

.email-report-empty {
  color: #6b7280;
  font-size: 0.94rem;
}

.email-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

.email-report-btn {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.email-report-btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.email-report-btn-primary:hover {
  background: var(--color-primary-hover);
}

.email-report-btn-secondary {
  background: rgba(0,0,0,0.08);
  color: #111;
}

.email-report-btn-secondary:hover {
  background: rgba(0,0,0,0.12);
}

@media (max-width: 900px) {
  .email-report-grid {
    grid-template-columns: 1fr;
  }

  #email-report-modal .email-report-modal-content {
    width: 94vw;
    max-height: 92vh;
    padding: 18px;
  }
}
/* ─── DOCUMENT REVIEW MODAL ───────────────────────────────────── */
#document-review-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12600;
}

#document-review-modal.hidden {
  display: none !important;
}

#document-review-modal .document-review-modal-content {
  position: relative;
  width: 1320px;
  max-width: 98vw;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  padding: 24px;
}

#document-review-title {
  margin: 0 0 10px 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

#document-review-modal .document-review-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#document-review-modal .document-review-close:hover {
  color: #a80f0f;
}

#document-review-modal .document-review-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.document-review-progress {
  margin-bottom: 14px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
}

.document-review-body {
  display: grid;
  grid-template-columns: 1.9fr 0.85fr;
  gap: 20px;
  min-height: 0;
}

.document-review-preview-wrap {
  min-height: 0;
}

.document-review-preview {
  height: 720px;
  max-height: 74vh;
  overflow: auto;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.document-review-preview-empty {
  font-size: 0.95rem;
  color: #6b7280;
  text-align: center;
}

.document-review-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.document-review-label {
  display: block;
  margin-bottom: -2px;
  font-weight: 600;
  color: #111827;
}

#document-review-ai-name,
#document-review-final-name {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  background: #fff;
  color: #111827;
}

.document-review-original-wrap {
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
}

.document-review-original-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 6px;
}

.document-review-original-name {
  font-size: 0.96rem;
  color: #111827;
  word-break: break-word;
}

.document-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.document-review-btn {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.document-review-btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.document-review-btn-primary:hover {
  background: var(--color-primary-hover);
}

/* ─── DOCUMENT DECIPHER REVIEW MODAL ───────────────────────────── */
#document-decipher-review-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12610;
}

#document-decipher-review-modal.hidden {
  display: none !important;
}

#document-decipher-review-modal .document-decipher-review-modal-content {
  position: relative;
  width: 1320px;
  max-width: 98vw;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.14);
  box-shadow: 0 18px 60px rgba(0,0,0,0.24);
  padding: 24px;
}

#document-decipher-review-title {
  margin: 0 0 8px 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

#document-decipher-review-modal .document-decipher-review-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  padding: 6px;
  color: #d11a1a;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

#document-decipher-review-modal .document-decipher-review-close:hover {
  color: #a80f0f;
}

#document-decipher-review-modal .document-decipher-review-close:focus {
  outline: 2px solid rgba(209, 26, 26, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.document-decipher-review-subtitle {
  margin-bottom: 16px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
}

.document-decipher-review-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.document-decipher-review-empty {
  padding: 18px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  color: #6b7280;
  font-size: 0.95rem;
}

.document-decipher-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.document-review-btn-secondary {
  background: rgba(0,0,0,0.08);
  color: #111;
}

.document-review-btn-secondary:hover {
  background: rgba(0,0,0,0.12);
}

@media (max-width: 900px) {
  .document-review-body {
    grid-template-columns: 1fr;
  }

  .document-review-preview {
    height: 320px;
    max-height: 40vh;
  }

  #document-review-modal .document-review-modal-content {
    width: 94vw;
    max-height: 92vh;
    padding: 18px;
  }
}

@media (max-width: 1100px) {
  #client-profile-page .client-page-header.profile-menu-open {
    --profile-header-open-shift: -36px;
  }

  #client-profile-page .client-page-header.profile-menu-open #profile-name {
    max-width: min(420px, calc(100% - 470px));
  }

  #client-profile-page .client-page-header.profile-menu-open .profile-action-rail {
    max-width: 620px;
  }
}
/* ─── FAMILY LINK SEARCH RESULTS: HARD OVERRIDE FIX ─────────── */
#family-link-modal .family-link-search-results {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  align-items: start !important;
  justify-items: stretch !important;
  max-height: 240px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 2px !important;
}

#family-link-modal .family-link-search-result-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 12px 14px !important;
}

#family-link-modal .family-link-search-result-person {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#family-link-modal .family-link-search-result-name,
#family-link-modal .family-link-search-result-sub {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#family-link-modal .family-link-search-result-action {
  flex: 0 0 auto !important;
}

@media (max-width: 900px) {
  #family-link-modal .family-link-search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  #family-link-modal .family-link-search-results {
    grid-template-columns: 1fr !important;
  }
}
/* ─── FAMILY LINK MODAL: PREVENT FOOTER OVERLAP ───────────────── */
#family-link-modal .family-link-modal-content {
  display: flex !important;
  flex-direction: column !important;
  max-height: 90vh !important;
}

#family-link-modal .family-link-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

#family-link-modal .family-link-actions {
  flex: 0 0 auto !important;
  position: relative !important;
  z-index: 1 !important;
  margin-top: 18px !important;
  padding-top: 6px !important;
  background: #fff !important;
}

#family-link-modal .family-link-search-results {
  margin-bottom: 8px !important;
}
/* ─── PROFILE TIMELINE + DOCUMENT CENTER LAYOUT ───────────────── */
#client-profile-page .profile-container > #profile-activity-shell {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  margin: 0 1.5rem 0 !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

#client-profile-page #profile-timeline-panel {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  padding: 1rem 1rem 0.9rem !important;
  overflow: hidden !important;
}

#client-profile-page #profile-timeline-toolbar {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.8rem !important;
  margin-bottom: 1rem !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  margin-bottom: 0 !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-title-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-title-wrap h3 {
  margin: 0 !important;
  font-size: 2rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
}

#client-profile-page #profile-timeline-header-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.75rem !important;
  flex-wrap: nowrap !important;
  flex: 1 1 auto !important;
}

#client-profile-page #profile-timeline-filters-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-filters {
  display: flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  flex-wrap: wrap !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#client-profile-page #profile-notes-search {
  width: 520px !important;
  min-width: 520px !important;
  height: 42px !important;
  margin-bottom: 0 !important;
  margin-left: auto !important;
  border: 1px solid #d6deeb !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #111827 !important;
  font-size: 0.95rem !important;
  box-sizing: border-box !important;
}

#client-profile-page #profile-timeline-title-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

#client-profile-page #profile-timeline-menu-shell {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-action-rail {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.6rem !important;
  max-width: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transform: translateX(-8px) !important;
  white-space: nowrap !important;
  transition:
    max-width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease,
    transform 0.28s ease !important;
}

#client-profile-page #profile-timeline-panel.timeline-menu-open #profile-timeline-action-rail {
  max-width: 220px !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
}

#client-profile-page .profile-timeline-rail-action {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.62rem !important;
  height: 38px !important;
  padding: 0 0.9rem !important;
  border: none !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%) !important;
  box-shadow: none !important;
  color: #0f172a !important;
  cursor: pointer !important;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease !important;
}

#client-profile-page .profile-timeline-rail-action:hover {
  transform: translateY(-1px) !important;
  background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(219,234,254,0.94) 100%) !important;
}

#client-profile-page .profile-timeline-rail-action .label {
  font-size: 0.9rem !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: #0f172a !important;
}

#client-profile-page #profile-timeline-menu-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 37px !important;
  height: 37px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%) !important;
  box-shadow: none !important;
  color: #0f172a !important;
  cursor: pointer !important;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease !important;
  flex: 0 0 auto !important;
}

#client-profile-page #profile-timeline-menu-toggle:hover {
  transform: translateY(-1px) !important;
  background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(219,234,254,0.94) 100%) !important;
}

#client-profile-page #profile-timeline-menu-toggle:focus-visible,
#client-profile-page .profile-timeline-rail-action:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.22) !important;
  outline-offset: 2px !important;
}

#client-profile-page .profile-timeline-menu-toggle-inner {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
}

#client-profile-page .profile-timeline-menu-toggle-chevron {
  width: 8px !important;
  height: 8px !important;
  border-top: 2px solid #2563eb !important;
  border-right: 2px solid #2563eb !important;
  transform: rotate(45deg) !important;
  transition: transform 0.28s ease !important;
}

#client-profile-page .profile-timeline-menu-toggle-bars {
  display: inline-flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

#client-profile-page .profile-timeline-menu-toggle-bars span {
  display: block !important;
  width: 10px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: #2563eb !important;
}

#client-profile-page #profile-timeline-panel.timeline-menu-open #profile-timeline-menu-toggle {
  background: linear-gradient(180deg, rgba(239,246,255,1) 0%, rgba(219,234,254,0.96) 100%) !important;
}

#client-profile-page #profile-timeline-panel.timeline-menu-open .profile-timeline-menu-toggle-chevron {
  transform: rotate(225deg) !important;
}

#client-profile-page .timeline-filter-btn {
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
  border-radius: 999px !important;
  padding: 0.45rem 0.9rem !important;
  font-size: 0.86rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease !important;
}

#client-profile-page .timeline-filter-btn.is-active {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

#client-profile-page #profile-notes-viewport {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#client-profile-page #profile-notes-list {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 0.85rem !important;
  align-items: stretch !important;
  padding: 0 !important;
  margin: 0 !important;
  list-style: none !important;
  min-height: 0 !important;
}

#client-profile-page #profile-notes-list .timeline-card-item,
#client-profile-page #profile-notes-list .timeline-empty-card {
  list-style: none !important;
  min-width: 0 !important;
}

#client-profile-page #profile-notes-list .timeline-card-item,
#client-profile-page #profile-notes-list .timeline-empty-card {
  padding: 0 !important;
  border-bottom: none !important;
}

#client-profile-page .timeline-card {
  display: flex !important;
  flex-direction: column !important;
  height: 310px !important;
  min-height: 310px !important;
  border-left: 4px solid var(--timeline-card-border) !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 4px !important;
  border-radius: 16px !important;
  background: var(--timeline-card-bg) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  padding: 12px 12px 10px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#client-profile-page .timeline-card-meta-row {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  margin-bottom: 0.45rem !important;
  min-height: 28px !important;
}

#client-profile-page .timeline-card-time {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: #64748b !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

#client-profile-page .timeline-card-meta-spacer {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#client-profile-page .timeline-card-info-btn {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  border: 1px solid #d6deeb !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.88) !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-size: 0.84rem !important;
  line-height: 1 !important;
  padding: 0 !important;
}

#client-profile-page .timeline-card-topline {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  flex-wrap: wrap !important;
  margin-bottom: 0.45rem !important;
}

#client-profile-page .timeline-type-pill {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  background: var(--timeline-pill-bg) !important;
  color: var(--timeline-pill-text) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

#client-profile-page .timeline-card-tag {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 22px !important;
  padding: 0 8px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,0.72) !important;
  color: #475569 !important;
  font-size: 0.73rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

#client-profile-page .timeline-card-main {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.3rem !important;
}

#client-profile-page .timeline-card-title {
  font-size: 0.94rem !important;
  font-weight: 700 !important;
  line-height: 1.22 !important;
  color: #111827 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

#client-profile-page .timeline-card-body-text {
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
  color: #374151 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 7 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-break: break-word !important;
}

#client-profile-page .timeline-card-body-text-note {
  -webkit-line-clamp: 9 !important;
}

#client-profile-page .timeline-story-preview {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.55rem !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#client-profile-page .timeline-story-preview-entry {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.16rem !important;
  padding-bottom: 0.45rem !important;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.3) !important;
}

#client-profile-page .timeline-story-preview-entry:last-child {
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

#client-profile-page .timeline-story-preview-label {
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.03em !important;
  text-transform: uppercase !important;
  color: #64748b !important;
}

#client-profile-page .timeline-story-preview-text {
  font-size: 0.88rem !important;
  line-height: 1.38 !important;
  color: #374151 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-break: break-word !important;
}

#client-profile-page .timeline-card-story-outdated-label {
  color: #7c3aed !important;
  font-weight: 700 !important;
}

#client-profile-page .timeline-card-open-latest-btn {
  align-self: flex-start !important;
  margin-top: 0.12rem !important;
}

#client-profile-page .timeline-card-footer {
  flex: 0 0 auto !important;
  margin-top: 0.55rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid rgba(148, 163, 184, 0.24) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.14rem !important;
}

#client-profile-page .timeline-card-footer-line,
#client-profile-page .timeline-card-attachment-more {
  font-size: 0.76rem !important;
  color: #6b7280 !important;
  line-height: 1.3 !important;
}

#client-profile-page .timeline-card-attachment-wrap {
  flex: 0 0 auto !important;
  margin-top: 0.55rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid rgba(148, 163, 184, 0.24) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.28rem !important;
}

#client-profile-page .timeline-card-attachment {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.12rem !important;
  padding: 0.45rem 0.55rem !important;
  border: 1px solid #dbe3ee !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.72) !important;
  color: inherit !important;
  text-decoration: none !important;
  min-width: 0 !important;
}

#client-profile-page .timeline-card-attachment-name {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  line-height: 1.25 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 1 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  word-break: break-word !important;
}

#client-profile-page .timeline-card-attachment-meta {
  font-size: 0.74rem !important;
  color: #6b7280 !important;
  line-height: 1.2 !important;
}

#client-profile-page .timeline-empty-card {
  grid-column: 1 / -1 !important;
}

#client-profile-page .timeline-empty-card-inner {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 310px !important;
  border: 1px dashed #cbd5e1 !important;
  border-radius: 16px !important;
  background: #f8fafc !important;
  color: #64748b !important;
  text-align: center !important;
  padding: 1.25rem !important;
}

#client-profile-page .timeline-empty-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #334155 !important;
  margin-bottom: 0.35rem !important;
}

#client-profile-page .timeline-empty-subtitle {
  font-size: 0.88rem !important;
  color: #64748b !important;
}

#client-profile-page #profile-timeline-pagination {
  flex: 0 0 auto !important;
  margin-top: auto !important;
  padding-top: 0.45rem !important;
  padding-bottom: 0.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  min-height: 38px !important;
}

#client-profile-page #profile-timeline-pagination button {
  min-width: 68px !important;
  height: 34px !important;
  border: 1px solid #d6deeb !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #334155 !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 0.8rem !important;
}

#client-profile-page #profile-timeline-pagination button:disabled {
  opacity: 0.45 !important;
  cursor: default !important;
}

#client-profile-page #notes-page {
  min-width: 64px !important;
  text-align: center !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  color: #334155 !important;
}

@media (max-width: 1600px) {
  #client-profile-page #profile-notes-list {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1200px) {
  #client-profile-page #profile-notes-list {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  #client-profile-page #profile-timeline-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #client-profile-page #profile-timeline-header-actions {
    justify-content: stretch !important;
    flex-wrap: wrap !important;
  }

  #client-profile-page #profile-notes-search {
    width: 100% !important;
    min-width: 0 !important;
  }

  #client-profile-page #profile-notes-list {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
#client-profile-page #profile-document-center-shell {
  flex: 0 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  width: calc(100% + 3rem) !important;
  margin-left: -1.5rem !important;
  margin-right: -1.5rem !important;
  margin-top: auto !important;
  margin-bottom: 0 !important;
}

#client-profile-page #document-center-separator {
  position: relative !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.95rem 1.25rem 0.7rem !important;
  background: transparent !important;
}

#client-profile-page #document-center-separator::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 50% !important;
  height: 1px !important;
  background: #d6deeb !important;
  transform: translateY(-50%) !important;
}

#client-profile-page #document-center-header {
  position: relative !important;
  z-index: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 0.85rem !important;
  background: #f3f4f6 !important;
  color: #475569 !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em !important;
  line-height: 1 !important;
  text-transform: none !important;
  border: none !important;
  box-shadow: none !important;
}

#client-profile-page #document-center-drawer {
  width: 100% !important;
  margin-top: 0 !important;
}

#client-profile-page #document-center-drawer.hidden {
  display: none !important;
}

#client-profile-page #document-center-drawer .panel {
  min-height: 110px !important;
  max-height: 180px !important;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  border-top: 1px solid #d6deeb !important;
  margin: 0 !important;
  padding: 0.75rem 1.25rem !important;
}

#client-profile-page #document-center-content {
  position: relative !important;
  min-height: 110px !important;
  padding: 0 44px !important;
}

#client-profile-page #document-center-years {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  scroll-behavior: smooth !important;
}

#client-profile-page #document-center-years::-webkit-scrollbar {
  display: none !important;
}

#client-profile-page .document-center-scroll-btn {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 3 !important;
  width: 22px !important;
  height: 92px !important;
  border: 1px solid #d8e1ec !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.82) !important;
  color: #64748b !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease !important;
}

#client-profile-page .document-center-scroll-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.94) !important;
  border-color: #b8c7da !important;
  color: #334155 !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
}

#client-profile-page .document-center-scroll-btn:disabled {
  opacity: 0.24 !important;
  cursor: default !important;
  box-shadow: none !important;
}

#client-profile-page .document-center-scroll-btn.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

#client-profile-page #document-center-scroll-left {
  left: 6px !important;
}

#client-profile-page #document-center-scroll-right {
  right: 6px !important;
}

@media (max-width: 900px) {
  #client-profile-page #profile-timeline-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #client-profile-page #profile-timeline-header-actions {
    justify-content: space-between !important;
  }

  #client-profile-page #profile-notes-search {
    width: 100% !important;
    min-width: 0 !important;
  }
}
