:root {
  --bg: #edf3f8;
  --bg-soft: #f7fbff;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --panel-muted: #f2f7fb;
  --ink: #17324b;
  --ink-soft: #3d556d;
  --muted: #647a8f;
  --line: rgba(23, 50, 75, 0.1);
  --line-strong: rgba(23, 50, 75, 0.16);
  --blue: #2f68d6;
  --teal: #11879b;
  --violet: #775ed9;
  --danger: #cf5168;
  --danger-soft: #fdecef;
  --warning: #c68a29;
  --warning-soft: #fff5e2;
  --success: #2d8f6a;
  --success-soft: #e6f7ef;
  --info-soft: #e9f2ff;
  --shadow-xs: 0 10px 24px rgba(31, 59, 91, 0.06);
  --shadow-md: 0 18px 44px rgba(27, 53, 84, 0.1);
  --shadow-lg: 0 28px 64px rgba(27, 53, 84, 0.15);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --scrollbar-thumb: rgba(112, 135, 156, 0.34);
  --scrollbar-thumb-hover: rgba(112, 135, 156, 0.48);
  --scrollbar-track: rgba(255, 255, 255, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(17, 135, 155, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(119, 94, 217, 0.14), transparent 28%),
    linear-gradient(180deg, #f9fbfe 0%, #f0f5fb 45%, #eaf1f7 100%);
}

body,
.sidebar,
.followup-modal-dialog {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.followup-modal-dialog::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.followup-modal-dialog::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.followup-modal-dialog::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.followup-modal-dialog::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 308px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 20px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  background:
    linear-gradient(180deg, rgba(246, 250, 253, 0.95), rgba(240, 247, 252, 0.92)),
    rgba(244, 249, 252, 0.8);
  backdrop-filter: blur(22px);
  overflow-y: auto;
}

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

.sidebar-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.sidebar-brand {
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-brand-copy {
  min-width: 0;
}

.session-widget {
  position: relative;
  margin-top: 12px;
}

.session-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(23, 50, 75, 0.08);
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 247, 251, 0.92));
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.session-trigger:hover,
.session-widget.is-open .session-trigger {
  transform: translateY(-1px);
  border-color: rgba(47, 104, 214, 0.18);
  box-shadow: var(--shadow-md);
}

.session-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.session-copy strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.session-status,
.session-role {
  color: var(--muted);
  font-size: 0.74rem;
}

.session-status {
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.session-trigger-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: var(--teal);
  background: rgba(17, 135, 155, 0.1);
}

.session-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 8;
  min-width: 210px;
  padding: 10px;
  border: 1px solid rgba(23, 50, 75, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-md);
}

.session-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  color: var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}

.session-menu-item:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  padding: 8px;
  border: 1px solid rgba(23, 50, 75, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(234, 239, 244, 0.96));
  box-shadow: 0 12px 28px rgba(31, 59, 91, 0.12);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.sidebar-intro {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 249, 252, 0.84));
  box-shadow: var(--shadow-xs);
}

.sidebar-intro .eyebrow {
  margin-bottom: 10px;
}

.sidebar-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--ink-soft);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(47, 104, 214, 0.12);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-xs);
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-link-copy {
  min-width: 0;
}

.nav-link-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-link-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.79rem;
}

.nav-link-icon,
.icon-chip,
.avatar-badge,
.metric-icon,
.action-icon,
.section-icon,
.tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-link-icon,
.metric-icon,
.icon-chip,
.tab-icon {
  width: 34px;
  height: 34px;
  border-radius: 14px;
  background: rgba(17, 135, 155, 0.1);
  color: var(--teal);
}

.sidebar-context {
  margin-top: auto;
}

.sidebar-context-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 247, 251, 0.9));
  box-shadow: var(--shadow-xs);
}

.sidebar-context-media {
  position: relative;
  height: 144px;
}

.sidebar-context-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.02), rgba(17, 24, 39, 0.34)),
    linear-gradient(135deg, rgba(17, 135, 155, 0.12), rgba(119, 94, 217, 0.12));
}

.sidebar-context-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.84);
}

.sidebar-context-copy {
  padding: 14px 16px 16px;
}

.sidebar-context-copy p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.nav-link.active .nav-link-icon {
  background: linear-gradient(135deg, rgba(17, 135, 155, 0.18), rgba(119, 94, 217, 0.16));
  color: var(--blue);
}

.main-shell {
  padding: 28px;
}

.page-frame {
  display: block;
}

.page-frame.page-frame-reverse {
  display: block;
}

.page-frame.page-frame-reverse .page-context {
  order: 0;
}

.page-main {
  min-width: 0;
}

.page-main > * + * {
  margin-top: 24px;
}

.page-context {
  display: none;
}

.context-panel {
  position: sticky;
  top: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 247, 251, 0.9));
  box-shadow: var(--shadow-md);
}

.context-media {
  position: relative;
  min-height: 320px;
}

.context-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.02), rgba(17, 24, 39, 0.48)),
    linear-gradient(135deg, rgba(17, 135, 155, 0.18), rgba(119, 94, 217, 0.12));
}

.context-media img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
  filter: saturate(0.86) contrast(1.02);
}

.context-copy {
  padding: 22px;
}

.context-copy p {
  margin-top: 10px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.glass-card,
.panel-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
}

.panel-card {
  background: var(--panel-strong);
}

.page-hero {
  padding: 30px;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: auto -54px -54px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(17, 135, 155, 0.18), rgba(119, 94, 217, 0.03) 70%, transparent 72%);
}

.hero-topline,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-copy {
  max-width: 840px;
}

.hero-copy p {
  margin-top: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.hero-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.hero-metric {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.64);
}

.hero-metric strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
}

.hero-metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.metric-card {
  padding: 22px;
  min-height: 164px;
}

.metric-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.metric-value {
  margin-top: 18px;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 800;
}

.metric-helper {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.muted {
  color: var(--muted);
}

.badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.badge {
  padding: 8px 12px;
}

.badge.low,
.badge.success {
  color: var(--success);
  background: var(--success-soft);
}

.badge.medium,
.badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.high,
.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.info {
  color: var(--blue);
  background: var(--info-soft);
}

.chip {
  padding: 9px 13px;
  color: var(--teal);
  background: rgba(17, 135, 155, 0.1);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.section-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
}

.list-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid rgba(23, 50, 75, 0.12);
  background: white;
  border-radius: 16px;
  padding: 13px 15px;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(17, 135, 155, 0.42);
  box-shadow: 0 0 0 4px rgba(17, 135, 155, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--blue) 55%, var(--violet));
  box-shadow: 0 18px 28px rgba(47, 104, 214, 0.2);
}

.btn-secondary {
  color: var(--ink);
  border-color: rgba(23, 50, 75, 0.1);
  background: rgba(255, 255, 255, 0.94);
}

.btn-ghost {
  color: var(--teal);
  background: rgba(17, 135, 155, 0.1);
}

.tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(246, 249, 252, 0.92);
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--ink);
  border-color: rgba(17, 135, 155, 0.18);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-xs);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(290px, 1fr));
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-shell {
  position: relative;
}

.kanban-scroll-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 32px rgba(23, 50, 75, 0.14);
  backdrop-filter: blur(12px);
  transform: translateY(-50%);
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, visibility 0.2s ease;
  cursor: pointer;
}

.kanban-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-50%) scale(1.03);
}

.kanban-scroll-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

.kanban-scroll-btn.is-outside {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.kanban-scroll-btn-left {
  left: -12px;
}

.kanban-scroll-btn-right {
  right: -12px;
}

.kanban-column {
  min-height: 520px;
  padding: 18px;
  border: 1px solid rgba(23, 50, 75, 0.08);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 247, 251, 0.78));
  box-shadow: var(--shadow-xs);
}

.kanban-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.kanban-card {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(23, 50, 75, 0.08);
  border-radius: 22px;
  background: white;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kanban-card:hover,
.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.kanban-card:last-child {
  margin-bottom: 0;
}

.card-topline,
.info-strip,
.split-stat,
.table-row-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: var(--blue);
  background: linear-gradient(135deg, rgba(47, 104, 214, 0.12), rgba(119, 94, 217, 0.12));
  font-size: 0.88rem;
  font-weight: 800;
}

.info-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-muted);
}

.timeline {
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 15px;
  width: 2px;
  background: rgba(17, 135, 155, 0.18);
}

.timeline-item {
  position: relative;
  padding-left: 44px;
  padding-bottom: 22px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 8px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: white;
  border: 4px solid var(--teal);
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(225, 234, 241, 0.7), rgba(239, 245, 248, 0.95), rgba(225, 234, 241, 0.7));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  max-width: 360px;
  padding: 15px 16px;
  border-radius: 18px;
  color: white;
  box-shadow: var(--shadow-lg);
}

.toast.info { background: linear-gradient(135deg, var(--blue), var(--teal)); }
.toast.success { background: linear-gradient(135deg, #278560, #46a86e); }
.toast.warning { background: linear-gradient(135deg, #cb8b29, #e4b34d); }
.toast.danger { background: linear-gradient(135deg, #c54365, #df7081); }

.map {
  height: 360px;
  border-radius: 22px;
}

.sidebar-summary {
  position: sticky;
  top: 24px;
}

.patient-aside {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.patient-photo-frame {
  position: relative;
  width: 100%;
  display: block;
  line-height: 0;
  min-height: 300px;
  padding: 0;
  border: 0;
  cursor: zoom-in;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(17, 135, 155, 0.22), transparent 34%),
    linear-gradient(160deg, rgba(23, 50, 75, 0.12), rgba(23, 50, 75, 0.02));
}

.patient-photo-frame:focus-visible {
  outline: 3px solid rgba(47, 104, 214, 0.32);
  outline-offset: 3px;
}

.patient-photo-frame img {
  width: 100%;
  height: 300px;
  display: block;
  object-fit: cover;
  object-position: center top;
  filter: saturate(0.9) contrast(1.02);
}

.patient-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.04), rgba(17, 24, 39, 0.44)),
    linear-gradient(135deg, rgba(17, 135, 155, 0.08), rgba(47, 104, 214, 0.02));
}

.patient-photo-overlay {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 1;
}

.patient-photo-overlay .chip {
  color: white;
  background: rgba(23, 50, 75, 0.6);
  backdrop-filter: blur(10px);
}

.patient-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.patient-photo-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.patient-photo-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 24, 40, 0.34);
  backdrop-filter: blur(16px);
  cursor: pointer;
}

.patient-photo-modal-dialog {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: min(92vw, 1200px);
  max-height: min(calc(100dvh - 48px), 920px);
  display: inline-flex;
  line-height: 0;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 32px;
  background: rgba(11, 20, 33, 0.3);
  box-shadow: 0 30px 80px rgba(5, 12, 24, 0.28);
}

.patient-photo-modal-dialog::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(7, 12, 22, 0) 48%, rgba(7, 12, 22, 0.58) 100%),
    linear-gradient(90deg, rgba(7, 12, 22, 0.5) 0%, rgba(7, 12, 22, 0.18) 38%, rgba(7, 12, 22, 0) 62%);
  pointer-events: none;
}

.patient-photo-modal-dialog img {
  max-width: 100%;
  max-height: calc(100dvh - 76px);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(5, 12, 24, 0.28);
}

.patient-photo-modal-caption {
  position: absolute;
  left: 34px;
  bottom: 32px;
  z-index: 1;
  display: grid;
  gap: 4px;
  max-width: min(44ch, calc(100% - 116px));
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(9, 18, 31, 0.26);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 32px rgba(5, 12, 24, 0.2);
  color: white;
  line-height: 1.2;
}

.patient-photo-modal-caption strong {
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.patient-photo-modal-caption span {
  font-size: clamp(0.88rem, 0.8rem + 0.32vw, 1.02rem);
  color: rgba(232, 240, 248, 0.82);
}

.patient-photo-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
}

.patient-hero-card {
  padding: 28px 30px;
  background:
    radial-gradient(circle at right top, rgba(17, 135, 155, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 252, 0.94));
}

.patient-detail-flow > * + * {
  margin-top: 24px;
}

.patient-hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: end;
}

.patient-hero-copy p {
  max-width: 720px;
  line-height: 1.7;
}

.patient-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.detail-pill-grid {
  display: grid;
  gap: 12px;
}

.detail-pill {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 252, 0.84));
}

.detail-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.detail-pill strong {
  display: block;
  margin-top: 8px;
  font-size: 0.98rem;
  line-height: 1.45;
}

.task-stack,
.alert-stack,
.note-list {
  display: grid;
  gap: 14px;
}

.task-card,
.alert-card,
.prompt-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 252, 0.9));
}

.task-card.danger,
.alert-card.danger {
  border-color: rgba(207, 81, 104, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(253, 236, 239, 0.72));
}

.task-card.warning,
.alert-card.warning {
  border-color: rgba(198, 138, 41, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 226, 0.78));
}

.task-card.success,
.alert-card.success {
  border-color: rgba(45, 143, 106, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(230, 247, 239, 0.82));
}

.task-card.info {
  border-color: rgba(47, 104, 214, 0.12);
}

.task-card-top,
.task-card-footer,
.timeline-card-top,
.profile-image-spec {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.task-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.task-card-footer {
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(23, 50, 75, 0.08);
}

.task-meta,
.note-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.note-row {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(243, 247, 251, 0.88);
}

.timeline-rich::before {
  left: 19px;
  background: linear-gradient(180deg, rgba(17, 135, 155, 0.12), rgba(47, 104, 214, 0.22));
}

.timeline-item-rich {
  padding-left: 58px;
  padding-bottom: 18px;
}

.timeline-item-rich::before {
  content: none;
}

.timeline-pin {
  position: absolute;
  top: 4px;
  left: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid transparent;
  background: white;
  box-shadow: var(--shadow-xs);
}

.timeline-pin.info {
  color: var(--blue);
  border-color: rgba(47, 104, 214, 0.14);
}

.timeline-pin.warning {
  color: var(--warning);
  border-color: rgba(198, 138, 41, 0.18);
}

.timeline-pin.success {
  color: var(--success);
  border-color: rgba(45, 143, 106, 0.18);
}

.timeline-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
}

.profile-image-spec {
  align-items: center;
}

.profile-image-spec-copy {
  min-width: 0;
}

.prompt-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(233, 242, 255, 0.74));
}

.prompt-text {
  color: var(--ink-soft);
  line-height: 1.8;
}

.prompt-card code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(23, 50, 75, 0.08);
}

.detail-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.report-bar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.report-bar div {
  flex: 1;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(17, 135, 155, 0.92), rgba(47, 104, 214, 0.92));
}

.soft-grid {
  display: grid;
  gap: 18px;
}

.soft-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.soft-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.soft-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-lite {
  width: 100%;
  border-collapse: collapse;
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
}

.table-lite th,
.table-lite td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

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

.table-lite th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.empty-state {
  padding: 38px 24px;
  text-align: center;
  border: 1px dashed rgba(23, 50, 75, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
}

.empty-state .icon-chip {
  margin: 0 auto 12px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-muted);
}

.mini-stat strong {
  display: block;
  font-size: 1.15rem;
}

.mini-stat span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.range-group {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.range-group input[type="range"] {
  padding: 0;
  border: 0;
  box-shadow: none;
}

.followup-hero {
  background:
    radial-gradient(circle at right top, rgba(17, 135, 155, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(242, 247, 251, 0.92));
}

.followup-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.followup-patient-select {
  min-width: min(100%, 320px);
}

.followup-summary-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(47, 104, 214, 0.09), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.9));
}

.followup-summary-top,
.triage-panel-top,
.followup-field-head,
.followup-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.followup-tag-row,
.followup-cta-row,
.triage-trigger-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-signal {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.9));
}

.metric-signal strong {
  display: block;
  margin-top: 18px;
  font-size: 2rem;
  line-height: 1;
}

.metric-signal-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.metric-signal.success {
  border-color: rgba(45, 143, 106, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(230, 247, 239, 0.84));
}

.metric-signal.warning {
  border-color: rgba(198, 138, 41, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 226, 0.8));
}

.metric-signal.danger,
.triage-panel.triage-danger {
  border-color: rgba(207, 81, 104, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(253, 236, 239, 0.82));
}

.triage-panel.triage-warning {
  border-color: rgba(198, 138, 41, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 245, 226, 0.84));
}

.triage-panel.triage-success {
  border-color: rgba(45, 143, 106, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(230, 247, 239, 0.84));
}

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

.reason-row,
.followup-history-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.reason-row {
  color: var(--ink-soft);
}

.followup-history-row {
  padding: 16px 0;
}

.triage-trigger {
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--blue);
  background: var(--info-soft);
}

.score-pill[data-tone="warning"] {
  color: var(--warning);
  background: var(--warning-soft);
}

.score-pill[data-tone="danger"] {
  color: var(--danger);
  background: var(--danger-soft);
}

.score-pill[data-tone="success"] {
  color: var(--success);
  background: var(--success-soft);
}

.followup-field {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-muted);
}

.followup-field input[type="range"] {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.followup-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.followup-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.followup-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.34);
  backdrop-filter: blur(12px);
}

.followup-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100dvh - 48px);
  padding: 26px;
  overflow: auto;
  border-radius: 30px;
}

.modal-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.followup-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.is-blurred {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.24s ease;
}

body.modal-open {
  overflow: hidden;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-shell {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 22px;
}

.login-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.login-panel-story {
  padding: 34px;
  color: #f8fbff;
  background:
    linear-gradient(160deg, rgba(10, 33, 57, 0.94), rgba(18, 94, 117, 0.88) 55%, rgba(46, 104, 214, 0.82)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 30%);
}

.login-panel-story::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-panel-story .eyebrow,
.login-panel-story .muted {
  color: rgba(240, 249, 255, 0.8);
}

.login-panel-story h1 {
  max-width: 10ch;
  margin-top: 18px;
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  line-height: 0.98;
}

.login-panel-story p {
  position: relative;
  z-index: 1;
  max-width: 58ch;
  margin-top: 22px;
  color: rgba(239, 248, 255, 0.88);
  font-size: 1rem;
  line-height: 1.75;
}

.login-story-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.login-story-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.login-story-card strong,
.login-story-card span {
  display: block;
}

.login-story-card span {
  margin-top: 8px;
  color: rgba(239, 248, 255, 0.78);
  font-size: 0.88rem;
  line-height: 1.6;
}

.login-panel-form {
  padding: 34px;
  background: rgba(255, 255, 255, 0.88);
}

.login-panel-form h2 {
  margin-top: 18px;
  font-size: 2rem;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.login-field {
  display: grid;
  gap: 10px;
  font-weight: 700;
  color: var(--ink);
}

.login-field span {
  font-size: 0.92rem;
}

.login-submit {
  width: 100%;
  margin-top: 6px;
}

.section-stack > * + * {
  margin-top: 18px;
}

.list-separated > * + * {
  border-top: 1px solid var(--line);
}

.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.lucide.icon-xs {
  width: 14px;
  height: 14px;
}

.lucide.icon-lg {
  width: 20px;
  height: 20px;
}

.lucide.icon-xl {
  width: 22px;
  height: 22px;
}

@media (max-width: 1240px) {
  .page-frame,
  .page-frame.page-frame-reverse,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .page-frame.page-frame-reverse .page-context {
    order: 0;
  }

  .page-context {
    display: none;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-summary,
  .context-panel,
  .patient-aside {
    position: static;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-story-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 95;
    width: min(320px, calc(100vw - 28px));
    max-width: 100%;
    height: 100dvh;
    gap: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom: 0;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(10, 20, 34, 0.2);
    transform: translateX(calc(-100% - 18px));
    transition: transform 0.24s ease;
  }

  .mobile-nav-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 96;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(23, 50, 75, 0.1);
    border-radius: 18px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    cursor: pointer;
  }

  .mobile-nav-toggle span {
    font-weight: 700;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 94;
    display: block;
    border: 0;
    background: rgba(16, 24, 40, 0.22);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

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

  body.sidebar-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open:not(.modal-open) {
    overflow: hidden;
  }

  .hero-metrics,
  .soft-grid.cols-4,
  .soft-grid.cols-3,
  .soft-grid.cols-2,
  .mini-stats,
  .followup-workspace {
    grid-template-columns: 1fr;
  }

  .main-shell {
    padding: 74px 20px 20px;
  }

  .patient-hero-main,
  .patient-hero-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .login-body {
    padding: 14px;
  }

  .login-panel,
  .page-hero,
  .panel-card,
  .glass-card,
  .kanban-column,
  .kanban-card {
    border-radius: 20px;
  }

  .page-hero {
    padding: 22px;
  }

  .login-panel-story,
  .login-panel-form {
    padding: 24px;
  }

  .login-panel-story h1 {
    max-width: none;
    font-size: clamp(2.2rem, 12vw, 3.2rem);
  }

  .main-shell {
    padding: 74px 14px 14px;
  }

  .patient-photo-frame,
  .patient-photo-frame img {
    height: 260px;
    min-height: 260px;
  }

  .task-card-top,
  .task-card-footer,
  .timeline-card-top,
  .profile-image-spec,
  .followup-summary-top,
  .triage-panel-top,
  .followup-field-head,
  .followup-modal-head,
  .followup-history-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .followup-modal {
    padding: 12px;
    align-items: flex-start;
  }

  .followup-modal-dialog {
    width: 100%;
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    padding: 18px;
    border-radius: 24px;
  }

  .patient-photo-modal {
    padding: 12px;
    align-items: flex-start;
  }

  .patient-photo-modal-dialog {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    margin: 0 auto;
    padding: 10px;
    border-radius: 24px;
  }

  .patient-photo-modal-dialog img {
    max-height: calc(100dvh - 44px);
    border-radius: 18px;
  }

  .patient-photo-modal-dialog::after {
    inset: 10px;
    border-radius: 18px;
  }

  .patient-photo-modal-caption {
    left: 22px;
    right: 72px;
    bottom: 22px;
    max-width: none;
    padding: 14px 16px;
    border-radius: 18px;
  }

  .kanban-scroll-btn {
    width: 46px;
    height: 46px;
  }

  .kanban-scroll-btn-left {
    left: -6px;
  }

  .kanban-scroll-btn-right {
    right: -6px;
  }
}
