:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --border: #e5e7eb;
  --border-strong: #d7dce3;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --accent: #111827;
  --accent-soft: #eef2f7;
  --success-soft: #eefaf1;
  --message-ring: 0 0 0 2px rgba(100, 116, 139, 0.28);
  --message-internal-stripe: #64748b;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100%;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, #eef1f5 100%);
}

.app-shell {
  width: 100%;
  min-height: 100dvh;
  padding: 0 2px;
  display: grid;
  place-items: center;
}

.panel {
  width: min(1400px, 100%);
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.startup-panel {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: transparent;
}

.startup-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #dbeafe;
  border-top-color: #0280ff;
  animation: spin 0.72s linear infinite;
}

.auth-panel {
  max-width: 560px;
  padding: 26px;
  border-radius: 20px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(2, 128, 255, 0.12) 0%, rgba(2, 128, 255, 0) 48%),
    #ffffff;
}

.auth-branding {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-logo {
  width: min(320px, 74%);
  height: auto;
  object-fit: contain;
}

.auth-eyebrow {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0280ff;
  font-weight: 700;
}

.auth-card {
  border: 1px solid #dce8fb;
  border-radius: 16px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(2, 128, 255, 0.08);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.35rem;
  color: #0f2f66;
}

.auth-card .subtitle {
  margin-bottom: 12px;
}

.auth-card button[type='submit'] {
  margin-top: 4px;
  background: #0280ff;
}

.auth-card button[type='submit']:hover {
  background: #066ed7;
}

.auth-submit-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-submit-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 0.7s linear infinite;
}

button:disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: #eef1f5;
  color: var(--text);
}

.hidden {
  display: none !important;
}

.chat-panel {
  width: calc(100% - 100px);
  margin-top: 50px;
  height: calc(100dvh - 110px);
  min-height: calc(100dvh - 110px);
  max-height: calc(100dvh - 110px);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  height: 100%;
  min-height: 100%;
}

.admin-sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #0d67cf 0%, #0a55ae 52%, #094a99 100%);
  color: #f8fafc;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-drawer-backdrop {
  display: none;
}

.admin-brand h2 {
  margin: 0;
  font-size: 1.2rem;
}

.admin-brand p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: #dbeafe;
}

.admin-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.admin-menu-section {
  display: grid;
  gap: 13px;
}

.admin-menu-heading {
  margin: 0 2px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dbeafe;
  font-weight: 700;
}

.admin-menu-bottom {
  margin-top: auto;
  display: grid;
  gap: 13px;
  border-top: 1px solid rgba(191, 219, 254, 0.25);
  padding-top: 10px;
}

.admin-menu-btn {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(191, 219, 254, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #eff6ff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-menu-link {
  display: block;
  text-decoration: none;
}

.admin-menu-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e53935;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: 0 0 auto;
}

.admin-menu-btn.active {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.44);
  color: #ffffff;
}

.admin-menu-btn.logout {
  margin-top: 0;
}

.admin-workspace {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-page {
  height: 100%;
  min-height: 100%;
}

.workspace-placeholder {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  color: #4b5563;
}

.workspace-placeholder h3 {
  margin: 0;
  color: #111827;
  font-size: 1.15rem;
}

.workspace-content {
  height: 100%;
  min-height: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.lookup-workspace-content {
  grid-template-rows: auto auto 1fr;
}

.locations-workspace-content {
  grid-template-rows: auto auto auto 1fr;
}

.careteam-workspace-content {
  grid-template-rows: auto auto 1fr;
}

.appointments-workspace-content {
  grid-template-rows: auto auto 1fr;
}

/* Calendar + status are three rows; keep the calendar block at the top of the flexible row. */
.appointments-workspace-content > .appointments-calendar-layout {
  align-self: start;
  min-height: 0;
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.careteam-search-input {
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid #d7dfe9;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #ffffff;
}

.workspace-heading h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #111827;
}

.workspace-count {
  font-size: 0.8rem;
  color: #334155;
  background: #e8edf5;
  border: 1px solid #d7dfe9;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.workspace-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.workspace-table th,
.workspace-table td {
  text-align: left;
  border-bottom: 1px solid #edf1f6;
  padding: 10px 12px;
  font-size: 0.84rem;
}

.workspace-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: #334155;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.workspace-table td {
  color: #111827;
}

.workspace-table td .table-action {
  border: 1px solid #d6dce6;
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  margin-right: 6px;
}

.workspace-table td .table-action:hover {
  background: #f3f6fb;
}

.table-action.delete-btn,
button.delete-btn {
  background: #dc2626;
  color: #fff;
  border-color: #b91c1c;
}

.table-action.delete-btn:hover,
button.delete-btn:hover {
  background: #b91c1c;
  color: #fff;
}

.workspace-table tbody tr:last-child td {
  border-bottom: 0;
}

.workspace-table tbody tr[data-patient-id] {
  cursor: pointer;
}

.workspace-table tbody tr[data-patient-id]:hover {
  background: #f8fbff;
}

.workspace-table tbody tr[data-provider-uid] {
  cursor: pointer;
}

.workspace-table tbody tr[data-provider-uid]:hover {
  background: #f8fbff;
}

.billing-table {
  min-width: 1380px;
}

.billing-members {
  display: grid;
  gap: 8px;
}

.billing-member {
  display: grid;
  gap: 2px;
  padding: 2px 0;
}

.billing-member-name {
  font-weight: 700;
  color: #0f172a;
}

.billing-member-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.billing-amount {
  font-weight: 700;
  color: #0f172a;
}

.billing-summary {
  display: grid;
  gap: 4px;
}

.billing-summary-strong {
  font-weight: 700;
  color: #0f172a;
}

.billing-line-items {
  display: grid;
  gap: 8px;
}

.billing-line-item {
  display: grid;
  gap: 2px;
}

.billing-line-item-label {
  font-weight: 600;
  color: #0f172a;
}

.billing-line-item-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.workspace-empty {
  color: #6b7280;
}

.workspace-status {
  min-height: 1.25rem;
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.workspace-status.error {
  color: #b42318;
}

.workspace-status.success {
  color: #067647;
}

.patient-popover > .workspace-status {
  margin: 0 12px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.patient-popover > .workspace-status:empty {
  display: none;
}

.patient-popover > .workspace-status.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.patient-popover > .workspace-status.success {
  color: #166534;
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.appointments-calendar-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.appointments-calendar-panel,
.appointments-day-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.appointments-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.appointments-calendar-header h4,
.appointments-day-panel h4 {
  margin: 0;
}

.appointments-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.appointments-weekday {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
  padding: 4px 0;
}

.appointments-day-cell {
  display: flex;
  min-height: 74px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
  text-align: left;
}

.appointments-day-cell.outside-month {
  opacity: 0.45;
}

.appointments-day-cell.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.appointments-day-number {
  font-weight: 700;
  color: #0f172a;
}

.appointments-day-count {
  font-size: 0.74rem;
  color: #475569;
}

.appointments-day-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.appointments-day-card {
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.appointments-day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.appointments-day-meta {
  color: #475569;
  font-size: 0.9rem;
  margin-top: 4px;
}

.appointments-type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.74rem;
  font-weight: 700;
}

.appointments-type-badge.telehealth {
  background: #fff4d6;
  color: #a15c07;
}

.appointments-type-badge.house-call {
  background: #e8f7ee;
  color: #067647;
}

.patient-popover-dialog {
  width: min(980px, 94vw);
  min-height: min(420px, 70vh);
  max-height: 90vh;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
}

.patient-popover {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: min(380px, 60vh);
}

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

.patient-popover-header h3 {
  margin: 0;
  font-size: 1rem;
}

.popover-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.patient-popover-content {
  padding: 14px;
  overflow: auto;
  min-height: min(280px, 45vh);
  max-height: calc(90vh - 56px);
  display: grid;
  gap: 12px;
  background: #fbfcfe;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.patient-popover-content::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.patient-section {
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  background: #ffffff;
}

.patient-section h4 {
  margin: 0;
  padding: 9px 11px;
  border-bottom: 1px solid #edf1f6;
  font-size: 0.84rem;
  color: #334155;
}

.patient-section-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 11px 11px;
}

.patient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  padding: 11px;
}

.patient-field {
  min-width: 0;
}

.patient-field-label {
  display: block;
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 2px;
}

.patient-field-value {
  font-size: 0.82rem;
  color: #0f172a;
  word-break: break-word;
}

.patient-field-link {
  color: #1d4ed8;
  text-decoration: none;
}

.patient-field-link:hover {
  text-decoration: underline;
}

.signed-contract-copy {
  display: grid;
  gap: 12px;
}

.signed-contract-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.signed-contract-body {
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 12px;
  color: #0f172a;
  line-height: 1.55;
}

.signed-contract-body h3,
.signed-contract-body h4,
.signed-contract-body p,
.signed-contract-body ol,
.signed-contract-body ul {
  margin: 0;
}

.signed-contract-body ol,
.signed-contract-body ul {
  padding-left: 20px;
}

.careteam-input {
  width: 100%;
  font-size: 0.82rem;
  padding: 8px 10px;
  border-radius: 8px;
}

.careteam-input[multiple] {
  min-height: 120px;
  padding: 8px;
}

.location-checkbox-grid {
  display: grid;
  gap: 0.55rem;
}

.location-checkbox {
  display: block;
  cursor: pointer;
}

.location-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.location-checkbox-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.7rem 0.8rem;
  border: 1px solid #d7dcea;
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.location-checkbox-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.location-checkbox-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
}

.location-checkbox-address {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.35;
}

.location-checkbox-check {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
}

.location-checkbox input:focus-visible + .location-checkbox-body {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.location-checkbox input:checked + .location-checkbox-body {
  border-color: #7aa7f7;
  background: #edf4ff;
}

.location-checkbox input:checked + .location-checkbox-body .location-checkbox-check {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
}

.careteam-input[readonly] {
  background: #f8fafc;
  color: #64748b;
}

.role-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.role-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #d7dcea;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 0.82rem;
  color: #0f172a;
}

.careteam-photo-preview-wrap {
  width: 100%;
  min-height: 140px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.careteam-photo-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.careteam-photo-placeholder {
  color: #64748b;
  font-size: 0.82rem;
}

.careteam-photo-actions {
  display: grid;
  gap: 8px;
}

.careteam-photo-actions #careteam-photo-upload-btn.upload-ready {
  background: #0280ff;
  color: #ffffff;
}

.careteam-photo-actions #careteam-photo-upload-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.careteam-photo-actions input[type="file"] {
  padding: 0.55rem;
  background: #ffffff;
}

.careteam-photo-actions .success {
  color: #047857;
}

.careteam-photo-actions .error {
  color: #b42318;
}

.patient-list {
  margin: 0;
  padding: 11px 11px 11px 28px;
  display: grid;
  gap: 6px;
}

.patient-list li {
  font-size: 0.82rem;
  color: #0f172a;
}

@media (max-width: 720px) {
  .patient-grid {
    grid-template-columns: 1fr;
  }
}

.communications-page {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  min-height: 100%;
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  font-size: 0.95rem;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.chat-action-status {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e2f7eb;
  color: #166534;
}

.chat-action-status.error {
  background: #fee2e2;
  color: #991b1b;
}

.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-toast.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.mobile-nav-toggle {
  display: none;
}

.mobile-nav-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

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

.mention-tray-count {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  display: inline-grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
}

.admin-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 45;
}

.chat-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 300px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.conversation-drawer {
  border-right: 1px solid var(--border);
  background: var(--panel-soft);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.drawer-filters {
  display: grid;
  gap: 8px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.toggle.compact {
  font-size: 0.8rem;
}

.drawer-filter-row {
  display: grid;
  gap: 4px;
}

.drawer-filter-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.drawer-filter-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 7px 9px;
  font-size: 0.82rem;
  color: #111827;
}

.drawer-filter-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 7px 9px;
  font-size: 0.82rem;
  color: #111827;
}

.conversation-drawer h3 {
  margin: 0;
  font-size: 0.95rem;
}

.drawer-count {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e8ecf2;
  color: #4b5563;
  font-size: 0.74rem;
  display: grid;
  place-items: center;
  font-weight: 700;
}

#conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.channel-section-title {
  margin-top: 10px;
  padding: 8px 10px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#conversation-list > li:first-child.channel-section-title {
  margin-top: 0;
}

.channel-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef3f8;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: normal;
}

.channel-section-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.channel-section-unread,
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.2;
}

.channel-empty {
  padding: 6px 10px 8px;
  font-size: 0.8rem;
  color: #9ca3af;
}

.doctor-directory-item {
  padding: 8px 10px;
  margin: 0 0 2px;
  border-radius: 8px;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 550;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-item-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.list-item-copy {
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
}

.list-item-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-subtext {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.list-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  flex: 0 0 24px;
  background: #dce4ef;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.list-avatar-image {
  background: #e5e7eb;
}

.list-avatar-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.patient-directory-item {
  cursor: pointer;
}

.patient-directory-item:hover {
  background: #eceff4;
}

.clickable-doctor-item {
  cursor: pointer;
}

.clickable-doctor-item:hover {
  background: #eceff4;
}

.doctor-directory-item.active {
  background: #e5eaf2;
  color: #111827;
}

.doctor-directory-item.has-unread {
  font-weight: 650;
}


#conversation-list button {
  width: 100%;
  text-align: left;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #374151;
  padding: 10px 10px;
  font-weight: 550;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#conversation-list button.has-unread {
  font-weight: 650;
}

#conversation-list button .list-item-label {
  overflow: hidden;
}

.channel-trailing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.channel-timestamp {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

#conversation-list button:hover {
  background: #eceff4;
}

#conversation-list button.active {
  background: #e5eaf2;
  color: #111827;
}

.unread-badge {
  min-width: 18px;
  padding: 2px 5px;
  flex: 0 0 auto;
}

.thread-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  position: relative;
  background: #ffffff;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.thread-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 600;
}

.thread-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #cfd7e3;
  border-top-color: #111827;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 10px;
  align-content: start;
  background: #f8fafc;
}

.message-list::-webkit-scrollbar {
  display: none;
}

.message {
  max-width: min(78%, 780px);
  border-radius: 14px;
  padding: 10px 12px;
  background: #eef2f6;
  border: 1px solid var(--border);
  position: relative;
  min-width: 0;
  overflow-wrap: anywhere;
}

.message.scheduled-message {
  border-style: dashed;
}

.message.scheduled-failed {
  border-color: #dc2626;
}

.message.scheduled-canceled {
  opacity: 0.72;
}

.message.me {
  margin-left: auto;
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  padding-bottom: 18px;
}

.message.internal:not(.me) {
  background: #eef2f6;
  color: var(--text);
  border: 1px solid var(--border);
}

.message.me.internal {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

.message .meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 0.73rem;
  opacity: 0.85;
}

.message .body {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-selection-toggle {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--muted);
  padding: 0;
  font-size: 0.7rem;
}

.message-selection-toggle.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.message-receipt {
  font-size: 0.68rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
}

.message-receipt-indicator {
  display: none;
}

.message.me .message-receipt {
  display: none;
}

.message.me .message-receipt-indicator {
  display: inline-flex;
  position: absolute;
  right: 10px;
  bottom: 6px;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: -0.08em;
  color: rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.message.me .message-receipt-indicator.received {
  color: #d6eeff;
}

.scheduled-status {
  text-transform: capitalize;
}

.message-mention {
  display: inline-block;
  padding: 0 3px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88em;
  line-height: 1.1;
}

.message.me .message-mention {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.message-mention.current-user {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.message.me .message-mention.current-user {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.message-delete-btn {
  margin-left: auto;
  border: 1px solid #d6dce6;
  background: #ffffff;
  color: #6b7280;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
}

.message-delete-btn:hover {
  background: #f3f6fa;
}

.message-copy-btn {
  border: 1px solid #d6dce6;
  background: #ffffff;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.message-copy-btn:hover {
  background: #f3f6fa;
}

.message-action-btn {
  border: 1px solid #d6dce6;
  background: #ffffff;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.message-action-btn:hover {
  background: #f3f6fa;
}

.message-pin-btn {
  border: 1px solid #d6dce6;
  background: #ffffff;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.message-pin-btn:hover {
  background: #f3f6fa;
}

.message-pin-btn.pinned {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .message-copy-btn,
  .message-pin-btn,
  .message-delete-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
  }

  .message:hover .message-copy-btn,
  .message:hover .message-pin-btn,
  .message:hover .message-delete-btn,
  .message:focus-within .message-copy-btn,
  .message:focus-within .message-pin-btn,
  .message:focus-within .message-delete-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.message-highlight {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

.composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 12px;
  background: #ffffff;
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#message-input {
  flex: 1;
  resize: none;
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 42px;
  max-height: 42px;
}

.controls-row {
  margin-top: 8px;
  justify-content: flex-start;
}

.composer-row > button[type='submit'] {
  height: 42px;
  min-width: 84px;
  white-space: nowrap;
}

.composer-schedule-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #f8fbff;
}

.composer-schedule-panel label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  color: #334155;
}

.composer-schedule-panel input[type='datetime-local'] {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.composer-schedule-actions {
  display: flex;
  gap: 8px;
}

.image-upload-btn {
  height: 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
  white-space: nowrap;
  display: grid;
  place-items: center;
}

.image-upload-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.image-upload-btn.uploading {
  opacity: 0.72;
  pointer-events: none;
}

.attachment-transfer-status {
  min-width: min(280px, 72vw);
  display: grid;
  gap: 8px;
}

.attachment-transfer-progress {
  width: min(320px, 72vw);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.attachment-transfer-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ce0c1 0%, #ffffff 100%);
  transition: width 180ms ease;
}

.attachment-transfer-progress.is-indeterminate .attachment-transfer-progress-bar {
  width: 42%;
  animation: attachment-transfer-indeterminate 1.2s ease-in-out infinite;
}

@keyframes attachment-transfer-indeterminate {
  0% {
    transform: translateX(-90%);
  }
  100% {
    transform: translateX(260%);
  }
}

.message-image-wrap {
  margin-bottom: 8px;
}

.message-image {
  display: block;
  max-width: min(280px, 100%);
  width: auto;
  max-height: 280px;
  border-radius: 10px;
  border: 1px solid #d9e1ec;
  object-fit: cover;
  background: #f3f6fa;
}

.message-file-wrap {
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
}

.message-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-video {
  display: block;
  width: min(320px, 100%);
  max-height: 320px;
  border-radius: 10px;
  border: 1px solid #d9e1ec;
  background: #f3f6fa;
}

.message-file-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.message-file-link.secondary-action {
  background: #f8fafc;
  color: #475569;
}

.message-file-icon-btn {
  color: #475569;
  background: #ffffff;
  border: 1px solid #d9e1ec;
}

.message-file-icon-btn.secondary-action {
  background: #f8fafc;
}

.message-action-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.mention-suggestions {
  position: absolute;
  left: 14px;
  bottom: 102px;
  z-index: 14;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 380px;
  width: calc(100% - 28px);
  max-height: 220px;
  overflow-y: auto;
}

.mention-suggestions button {
  width: 100%;
  text-align: left;
  border-radius: 0;
  border-bottom: 1px solid #eff3f8;
  background: #ffffff;
  color: var(--text);
  font-weight: 500;
  display: grid;
  gap: 4px;
}

.mention-suggestions button:last-child {
  border-bottom: 0;
}

.suggestion-preview {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-panel {
  background: #fbfcfd;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.info-pane {
  display: grid;
  gap: 14px;
}

.info-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  background: #ffffff;
  color: #374151;
  font-size: 0.78rem;
}

.tab.active {
  background: #ecf1f8;
  border-color: #d9e1ec;
  color: #111827;
}

.tab:disabled {
  opacity: 0.55;
  cursor: default;
}

.info-section h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.info-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.info-section-heading h4 {
  margin-bottom: 0;
}

.secondary.small {
  padding: 5px 10px;
  font-size: 0.74rem;
}

.shortcode-list {
  display: grid;
  gap: 10px;
}

.shortcode-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 0;
}

.shortcode-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text);
}

.shortcode-form input,
.shortcode-form textarea {
  width: 100%;
}

.shortcode-form-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.html-editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.html-editor-surface {
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  overflow: auto;
}

.html-editor-surface:focus {
  outline: 2px solid rgba(2, 128, 255, 0.22);
  outline-offset: 0;
  border-color: #74b5ff;
}

.html-editor-surface[contenteditable="false"] {
  background: #f8fafc;
  color: var(--muted);
}

.shortcode-empty {
  margin: 0;
}

.shortcode-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.shortcode-card-main {
  display: grid;
  gap: 6px;
}

.shortcode-card-code {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f2f66;
}

.shortcode-card-body {
  font-size: 0.86rem;
  color: var(--text);
  white-space: pre-wrap;
}

.shortcode-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mention-tray-list {
  display: grid;
  gap: 10px;
}

.mention-tray-empty {
  margin: 0;
}

.mention-tray-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
}

.mention-tray-item:hover {
  background: #f8fafc;
}

.mention-tray-preview {
  color: var(--muted);
  font-size: 0.82rem;
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.meta-list div {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.meta-list dt {
  font-size: 0.75rem;
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
  font-size: 0.82rem;
  color: #111827;
  word-break: break-all;
}

.patient-summary-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.patient-summary-grid {
  display: grid;
  gap: 8px;
}

.patient-summary-row {
  display: grid;
  gap: 2px;
}

.patient-summary-label {
  font-size: 0.74rem;
  color: var(--muted);
}

.patient-summary-value {
  margin: 0;
  font-size: 0.84rem;
  color: #111827;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.patient-summary-value a {
  color: #1d4ed8;
  text-decoration: none;
}

.patient-summary-value a:hover {
  text-decoration: underline;
}

.patient-copy-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.patient-summary-row:hover .patient-copy-btn,
.patient-summary-row:focus-within .patient-copy-btn {
  opacity: 1;
  pointer-events: auto;
}

.patient-family-card {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.patient-family-value {
  width: 100%;
}

.patient-family-list {
  width: 100%;
  display: grid;
  gap: 6px;
}

.patient-family-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #111827;
}

.patient-family-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.member-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.member-list li.member-clickable {
  cursor: pointer;
}

.member-list li.member-clickable:hover {
  background: #f3f6fb;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e9eef6;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.member-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.member-meta strong {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-meta span {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embedded .member-meta span {
  display: none;
}

.member-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #ccefd7;
}

.info-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.info-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.info-item-actions {
  display: flex;
  gap: 8px;
  padding: 0 9px 9px;
  flex-wrap: nowrap;
}

.info-item-action,
.info-item-link,
.info-item-action-link {
  width: 100%;
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 9px;
  text-decoration: none;
  color: #1f2937;
  background: transparent;
}

.info-item-action {
  border: 0;
  border-radius: 8px;
}

.info-item-action:hover,
.info-item-link:hover,
.info-item-action-link:hover {
  background: #f4f7fb;
}

.info-item-static:hover {
  background: transparent;
}

.info-item-action-link {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  color: #334155;
  flex: 0 0 auto;
}

.info-item-action-icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
}

.info-item-action-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.info-item strong {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-item span {
  font-size: 0.74rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-item-note {
  font-size: 0.76rem;
  color: #1f2937;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.info-empty {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 2px;
}

.verify-output {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  font-size: 0.8rem;
  color: #1f2937;
  display: grid;
  gap: 6px;
}

.verify-output .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.verify-output .key {
  color: var(--muted);
}

.verify-output .value.pass {
  color: #166534;
  font-weight: 600;
}

.verify-output .value.fail {
  color: #b91c1c;
  font-weight: 600;
}

dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(540px, 95vw);
}

menu {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1180px) {
  .admin-shell {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 100dvh;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    z-index: 40;
    border-right: 1px solid rgba(148, 163, 184, 0.3);
    border-bottom: 0;
    padding: 14px 10px;
    gap: 14px;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .admin-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-menu {
    gap: 10px;
    overflow: visible;
  }

  .admin-nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #edf1f6;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
  }

  .chat-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .info-panel {
    display: none;
  }

  .thread-area {
    border-right: 0;
  }
}

@media (max-width: 960px) {
  .app-shell {
    padding: 0;
    min-height: 100dvh;
    place-items: stretch;
  }

  .chat-panel {
    width: 100%;
    margin-top: 0;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .workspace-page,
  .communications-page {
    min-height: 0;
  }

  .lookup-form {
    grid-template-columns: 1fr;
  }

  .appointments-calendar-layout {
    grid-template-columns: 1fr;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #edf1f6;
    color: var(--text);
  }

  .conversation-drawer {
    position: absolute;
    z-index: 20;
    width: min(320px, 88vw);
    height: 100%;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .conversation-drawer.open {
    transform: translateX(0);
  }

  .message {
    max-width: 92%;
  }

  .auth-panel {
    margin: 16px;
    max-width: none;
  }

  .auth-logo {
    width: min(280px, 88%);
  }
}
