#appointment-history-stack-modal {
  position: fixed;
  inset: 0;
  z-index: 20140;
}

#appointment-history-stack-modal.hidden {
  display: none !important;
}

#appointment-history-stack-modal .appointment-history-stack-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
}

#appointment-history-stack-modal .appointment-history-stack-shell {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

#appointment-history-stack-modal .appointment-history-stack-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

#appointment-history-stack-modal .appointment-history-stack-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 4px;
}

#appointment-history-stack-modal .appointment-history-stack-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
}

#appointment-history-stack-modal .appointment-history-stack-subtitle {
  margin-top: 4px;
  font-size: 0.84rem;
  color: #64748b;
}

#appointment-history-stack-modal .appointment-history-stack-close {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

#appointment-history-stack-modal .appointment-history-stack-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

#appointment-history-stack-modal .appointment-history-stack-nav,
#appointment-history-stack-modal .appointment-history-stack-open {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

#appointment-history-stack-modal .appointment-history-stack-nav {
  width: 40px;
  height: 36px;
  font-size: 1.25rem;
}

#appointment-history-stack-modal .appointment-history-stack-nav:disabled {
  opacity: 0.45;
  cursor: default;
}

#appointment-history-stack-modal .appointment-history-stack-counter {
  min-width: 72px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

#appointment-history-stack-modal .appointment-history-stack-open {
  margin-left: auto;
  height: 38px;
  padding: 0 14px;
}

#appointment-history-stack-modal .appointment-history-stack-body {
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
}

#appointment-history-stack-modal .appointment-history-stack-card {
  border: 1px solid #dbe3ee;
  border-top-width: 4px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  padding: 14px 16px 16px;
}

#appointment-history-stack-modal .appointment-history-stack-card--call { border-top-color: #16a34a; }
#appointment-history-stack-modal .appointment-history-stack-card--note { border-top-color: #2563eb; }
#appointment-history-stack-modal .appointment-history-stack-card--appointment { border-top-color: #7c3aed; }
#appointment-history-stack-modal .appointment-history-stack-card--task { border-top-color: #ea580c; }

#appointment-history-stack-modal .appointment-history-stack-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

#appointment-history-stack-modal .appointment-history-stack-card-summary {
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #334155;
}

#appointment-history-stack-modal .appointment-history-stack-card-section-title {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

#appointment-history-stack-modal .appointment-history-stack-card-copy {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}
