/* ── PAGE PATIENTS ──────────────────────────────────────────────────────────── */

/* Color tokens — scoped to patients module, no purple */
/* Primary action: #1B2B40 (deep navy — clinical authority) */
/* Focus ring:     rgba(27,43,64,.28) (dark slate, calm) */
/* Row hover:      #F7F9FB (barely perceptible, refined)  */

.pts-page {
  max-width: 860px;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.pts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.pts-title-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.pts-title {
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.04em;
}
.pts-count {
  font-size: 11px;
  font-weight: 500;
  color: #6B7685;
  background: rgba(0,0,0,.054);
  border-radius: 20px;
  padding: 2px 9px;
  letter-spacing: .01em;
}
.pts-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #1B2B40;
  border: 1px solid rgba(27,43,64,.12);
  border-radius: 10px;
  padding: 7px 15px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity .14s;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.pts-new-btn:hover { opacity: .84; }

/* ── Search ──────────────────────────────────────────────────────────────────── */
.pts-search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.pts-search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #9AA3AD;
  pointer-events: none;
}
.pts-search {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;
  padding: 10px 14px 10px 38px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color .13s;
}
.pts-search::placeholder { color: #9AA3AD; }
.pts-search:hover { border-color: rgba(0,0,0,.17); }
.pts-search:focus { border-color: rgba(27,43,64,.3); background: #fff; }

/* ── List container ──────────────────────────────────────────────────────────── */
.pts-list {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.pts-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}
.pts-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(27,43,64,.1);
  border-top-color: #3E5573;
  border-radius: 50%;
  animation: ptsSpinAnim .65s linear infinite;
}
@keyframes ptsSpinAnim { to { transform: rotate(360deg); } }

/* ── Row ─────────────────────────────────────────────────────────────────────── */
.pts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background .11s;
  border-bottom: 1px solid rgba(0,0,0,.048);
  min-height: 58px;
  text-decoration: none;
  color: inherit;
}
.pts-row:last-child { border-bottom: none; }
.pts-row:hover  { background: #F7F9FB; }
.pts-row:active { background: #F0F3F7; }

/* ── Avatar ──────────────────────────────────────────────────────────────────── */
.pts-av {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}

/* ── Patient info ────────────────────────────────────────────────────────────── */
.pts-info { flex: 1; min-width: 0; }
.pts-name {
  font-size: 14px;
  font-weight: 600;
  color: #1A2435;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.015em;
  line-height: 1.3;
}
.pts-meta {
  font-size: 12px;
  color: #7B8794;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  letter-spacing: .005em;
}

/* ── Right side ──────────────────────────────────────────────────────────────── */
.pts-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pts-badge-today {
  font-size: 10.5px;
  font-weight: 600;
  color: #0C7A52;
  background: rgba(12,122,82,.09);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  letter-spacing: .01em;
}
.pts-chevron { color: rgba(0,0,0,.15); flex-shrink: 0; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.pts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 24px;
  text-align: center;
}
.pts-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #F4F6F9;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  color: #9AA3AD;
}
.pts-empty-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #1A2435;
  letter-spacing: -.015em;
  margin-bottom: 8px;
  line-height: 1.3;
}
.pts-empty-sub {
  font-size: 12.5px;
  color: #7B8794;
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 300px;
}
.pts-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #1B2B40;
  background: transparent;
  border: 1px solid rgba(27,43,64,.18);
  border-radius: 10px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .13s, border-color .13s;
  letter-spacing: -.01em;
}
.pts-empty-cta:hover {
  background: rgba(27,43,64,.05);
  border-color: rgba(27,43,64,.26);
}

/* ── No results ──────────────────────────────────────────────────────────────── */
.pts-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  color: #9AA3AD;
  font-size: 13px;
  text-align: center;
}

/* ── Overlay ─────────────────────────────────────────────────────────────────── */
.pts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.15);
  z-index: 310;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s;
}
.pts-overlay.open { opacity: 1; pointer-events: all; }

/* ── Create panel ────────────────────────────────────────────────────────────── */
.pts-create {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 348px;
  max-width: 100vw;
  background: #ffffff;
  z-index: 320;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .16s ease-out;
  border-left: 1px solid rgba(0,0,0,.08);
  box-shadow: -4px 0 20px rgba(0,0,0,.07);
}
.pts-create.open { transform: translateX(0); }

.pts-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  flex-shrink: 0;
}
.pts-create-title {
  font-size: 15px;
  font-weight: 700;
  color: #1A2435;
  letter-spacing: -.025em;
}
.pts-create-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #F4F6F9;
  border: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #7B8794;
  font-size: 17px;
  line-height: 1;
  font-family: 'Inter', sans-serif;
  transition: background .11s, color .11s;
}
.pts-create-close:hover { background: #E9ECF1; color: #1A2435; }

.pts-create-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.pts-field label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: #7B8794;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 7px;
}
.pts-req { color: var(--red); font-weight: 400; }
.pts-field-optional {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: .6;
}
.pts-field input,
.pts-field textarea {
  width: 100%;
  background: #F7F9FB;
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 14px;
  color: #1A2435;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color .13s, background .13s;
  box-sizing: border-box;
}
.pts-field input:focus,
.pts-field textarea:focus {
  border-color: rgba(27,43,64,.32);
  background: #ffffff;
}
.pts-field input::placeholder,
.pts-field textarea::placeholder { color: #9AA3AD; }
.pts-field textarea { resize: vertical; min-height: 76px; }

.pts-create-foot {
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(0,0,0,.07);
  flex-shrink: 0;
}
.pts-create-submit {
  width: 100%;
  background: #1B2B40;
  color: #ffffff;
  border: none;
  border-radius: 11px;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity .13s;
  letter-spacing: -.01em;
}
.pts-create-submit:hover { opacity: .84; }
.pts-create-submit:disabled { opacity: .42; cursor: not-allowed; }

/* ── Header right — view toggle + new button ─────────────────────────────────── */
.pts-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── View toggle — segmented control ─────────────────────────────────────────── */
.pts-view-toggle {
  display: flex;
  background: rgba(0,0,0,.052);
  border-radius: 9px;
  padding: 2px;
  gap: 1px;
}
.pts-vt-btn {
  font-size: 12px;
  font-weight: 500;
  color: #9AA3AD;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  letter-spacing: -.01em;
  line-height: 1.4;
}
.pts-vt-btn.active {
  background: #ffffff;
  color: #1A2435;
  box-shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
}
.pts-vt-btn:hover:not(.active) { color: #6B7685; }

/* ── Context bar ──────────────────────────────────────────────────────────────── */
.pts-ctx-bar {
  font-size: 12px;
  color: #9AA3AD;
  padding: 0 2px 10px;
  display: none;
  letter-spacing: -.01em;
  line-height: 1.4;
}
.pts-ctx-bar.visible { display: block; }
.pts-ctx-bar b { color: #6B7685; font-weight: 600; }

/* ── Status chips ─────────────────────────────────────────────────────────────── */
.pts-chip {
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  letter-spacing: .01em;
  flex-shrink: 0;
  line-height: 1.5;
}
.pts-chip-today {
  color: #0C7A52;
  background: rgba(12,122,82,.09);
}
.pts-chip-new {
  color: #6D28D9;
  background: rgba(109,40,217,.08);
}

/* ── Quick action button (⋯) ─────────────────────────────────────────────────── */
.pts-act-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(0,0,0,.32);
  transition: background .1s, color .1s, opacity .1s;
  flex-shrink: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

/* Desktop: show ⋯ on row hover only */
@media (hover: hover) {
  .pts-row:hover .pts-act-btn {
    opacity: 1;
    pointer-events: auto;
  }
  .pts-act-btn:hover {
    background: rgba(0,0,0,.052);
    color: #6B7685;
  }
}

/* Touch: always visible, larger target */
@media (hover: none) {
  .pts-act-btn {
    opacity: 1;
    pointer-events: auto;
    width: 36px;
    height: 36px;
  }
}

/* ── Action dropdown menu ─────────────────────────────────────────────────────── */
.pts-act-menu {
  position: fixed;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.07);
  padding: 5px;
  width: 172px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease;
}
.pts-act-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.pts-act-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 450;
  color: #1A2435;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  transition: background .1s;
  letter-spacing: -.01em;
  line-height: 1.3;
  width: 100%;
  box-sizing: border-box;
}
.pts-act-item svg { color: #9AA3AD; flex-shrink: 0; }
.pts-act-item:hover { background: rgba(0,0,0,.042); }
.pts-act-item:hover svg { color: #6B7685; }
.pts-act-item-btn {
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

/* ── Responsive: hide view toggle on very small screens ──────────────────────── */
@media (max-width: 400px) {
  .pts-view-toggle { display: none; }
}
