:root {
  --bg-color: #f2f7ff;
  --text-color: #1e2a3a;
  --hint-color: #6c7a94;
  --card-color: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.4);
  --button-color: #4b8dff;
  --button-text: #ffffff;
  --accent: #9fd0ff;
  --gold: #f5c84c;
  --shadow: 0 16px 32px rgba(30, 42, 58, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "SF Pro Display", Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, #eaf2ff 100%);
  color: var(--text-color);
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.logout-btn {
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.95);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.lang-btn.active {
  background: var(--button-color);
  color: var(--button-text);
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.score-badge i {
  color: var(--gold);
}

.glass-card {
  background: var(--card-color);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.guide-content video {
  width: 100%;
  border-radius: 16px;
  max-height: 240px;
  object-fit: cover;
  margin-bottom: 10px;
}

.guide-content p {
  margin: 0;
}

.helio-slot-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}

.helio-slot {
  border: 1px solid rgba(148, 180, 230, 0.4);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.helio-slot-title {
  font-weight: 700;
  font-size: 0.82rem;
}

.helio-slot-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--hint-color);
}

.helio-slot--done {
  border-color: rgba(90, 160, 110, 0.55);
  background: rgba(232, 246, 236, 0.95);
}

.helio-slot--open {
  border-color: rgba(70, 130, 210, 0.55);
  background: rgba(232, 242, 255, 0.95);
}

.helio-slot--missed {
  border-color: rgba(210, 120, 90, 0.5);
  background: rgba(255, 240, 232, 0.95);
}

.helio-challenge-panel {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 248, 230, 0.95), rgba(232, 242, 255, 0.9));
  border: 1px solid rgba(200, 170, 90, 0.35);
  text-align: center;
}

.helio-challenge-hint {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--hint-color);
}

.helio-challenge-code {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.1;
  color: #1a3a5c;
}

.helio-challenge-media-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
}

.helio-challenge-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 236, 179, 0.95);
  color: #5a4500;
}

.monitoring-advanced {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.monitoring-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  list-style-position: outside;
}

.monitoring-advanced-grid {
  margin-top: 12px;
}

.helio-upload-forms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.care-plan-block {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.care-plan-block h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.care-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.care-plan-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.care-plan-field input[type="time"],
.care-plan-field .session-select {
  width: 100%;
}

.care-plan-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.care-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.helio-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.helio-evidence-item {
  border: 1px solid rgba(148, 180, 230, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.helio-evidence-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.helio-evidence-meta {
  font-size: 0.8rem;
  color: var(--hint-color);
  margin-bottom: 6px;
}

.helio-evidence-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.helio-evidence-media img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.helio-evidence-missing {
  font-size: 0.85rem;
  color: var(--hint-color);
}

.permission-box {
  background: rgba(255, 255, 255, 0.8);
  border: 1px dashed rgba(148, 180, 230, 0.6);
  padding: 12px;
  border-radius: 16px;
  display: grid;
  gap: 8px;
}

.hidden-input {
  display: none;
}

.carousel-placeholder {
  height: 100%;
  min-height: 140px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--hint-color);
}

.carousel-card {
  padding: 8px;
  overflow: hidden;
}

#doctorCarousel {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 180px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(15, 26, 42, 0.06);
}

#doctorCarousel .carousel-inner,
#doctorCarousel .carousel-item {
  height: 100%;
}

.carousel-item video,
.carousel-item img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  max-height: none;
  object-fit: cover;
  display: block;
}

#doctorCarousel .carousel-indicators {
  margin-bottom: 0.35rem;
}

#doctorCarousel .carousel-indicators [data-bs-target] {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.7);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
  width: 1.4rem;
  height: 1.4rem;
}

.today-summary {
  gap: 10px;
  padding: 14px 16px;
}

.today-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.today-summary-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.today-summary-meta {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--hint-color);
  font-weight: 600;
}

.today-next-btn {
  border: none;
  background: var(--button-color);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}

.today-next-btn.hidden {
  display: none;
}

.today-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 180, 230, 0.25);
  overflow: hidden;
}

.today-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5aa86a, #4b8dff);
  transition: width 0.35s ease;
}

.today-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.today-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.today-check-label {
  font-size: 0.88rem;
  font-weight: 650;
}

.today-check-meta {
  font-size: 0.75rem;
  color: var(--hint-color);
  font-weight: 600;
  white-space: nowrap;
}

.today-check-item--done {
  border-color: rgba(56, 161, 105, 0.4);
  background: rgba(226, 250, 236, 0.9);
}

.today-check-item--done .today-check-meta {
  color: #1f7a4d;
}

.today-check-item--partial {
  border-color: rgba(75, 141, 255, 0.4);
  background: rgba(232, 242, 255, 0.95);
}

.today-check-item--pending {
  border-color: rgba(200, 170, 90, 0.4);
  background: rgba(255, 248, 230, 0.9);
}

.today-check-item--idle {
  opacity: 0.72;
}

.checkin-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkin-card {
  background: var(--card-color);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.checkin-summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 56px;
}

.checkin-summary::-webkit-details-marker {
  display: none;
}

.checkin-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(75, 141, 255, 0.12);
  color: var(--button-color);
  flex-shrink: 0;
}

.checkin-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.checkin-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.checkin-hint {
  font-size: 0.78rem;
  color: var(--hint-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkin-state {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(241, 246, 255, 0.95);
  color: var(--hint-color);
  white-space: nowrap;
}

.checkin-state[data-state="done"] {
  background: rgba(226, 250, 236, 0.95);
  color: #1f7a4d;
}

.checkin-state[data-state="partial"],
.checkin-state[data-state="pending"] {
  background: rgba(255, 248, 230, 0.95);
  color: #9a6b00;
}

.checkin-state[data-state="idle"] {
  background: rgba(241, 246, 255, 0.9);
  color: var(--hint-color);
}

.checkin-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(148, 180, 230, 0.2);
  padding-top: 12px;
}

.checkin-card:not([open]) .checkin-body {
  display: none;
}

#heliotherapy-section:not(.checkin-card--helio-active) .permission-box,
#heliotherapy-section:not(.checkin-card--helio-active) #heliotherapyGpsBtn,
#heliotherapy-section:not(.checkin-card--helio-active) .helio-action-row,
#heliotherapy-section:not(.checkin-card--helio-active) #heliotherapyGpsStatus {
  display: none;
}

.helio-desktop-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #9a6b00;
}

.helio-desktop-hint.hidden {
  display: none;
}

.diet-preview-wrap {
  display: grid;
  gap: 8px;
}

.diet-preview-wrap.hidden {
  display: none;
}

.diet-preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(15, 26, 42, 0.08);
}

.live-capture-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(10, 18, 32, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.live-capture-sheet {
  width: min(480px, 100%);
  background: #f7f9fc;
  border-radius: 20px 20px 16px 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
}

.live-capture-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.live-capture-title {
  margin: 0;
  font-size: 1.05rem;
}

.live-capture-hint {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--hint-color);
}

.live-capture-close {
  border: none;
  background: rgba(148, 180, 230, 0.25);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.live-capture-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: min(58vh, 420px);
  border-radius: 16px;
  overflow: hidden;
  background: #0f1a2a;
}

.live-capture-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
}

.live-capture-code {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 248, 230, 0.95);
  color: #1a3a5c;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.live-capture-timer {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.live-capture-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--hint-color);
}

.live-capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-capture-actions > button {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
}

.live-capture-actions > button.hidden {
  display: none;
}

.upload-label--compact span {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.88rem;
  justify-content: flex-start;
  gap: 8px;
}

.secondary-panel {
  padding: 0;
  gap: 0;
}

.secondary-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  margin: 0;
}

.secondary-summary::-webkit-details-marker {
  display: none;
}

.secondary-panel[open] .secondary-summary {
  border-bottom: 1px solid rgba(148, 180, 230, 0.25);
}

.secondary-panel > *:not(summary) {
  margin: 12px 16px;
}

.secondary-panel > .care-note-block,
.secondary-panel > .faq-accordion-block,
.secondary-panel > .message-compose,
.secondary-panel > .message-sent-block,
.secondary-panel > .private-note-details,
.secondary-panel > .guide-content,
.secondary-panel > #doctorNoteText {
  margin: 12px 16px;
}

.secondary-panel > .private-note-details {
  margin-bottom: 16px;
}

.patient-stage-wrap {
  margin-top: 4px;
}

@media (max-width: 420px) {
  .today-checklist {
    grid-template-columns: 1fr;
  }

  .checkin-hint {
    display: none;
  }
}

.primary-btn {
  background: var(--button-color);
  color: var(--button-text);
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 18px rgba(75, 141, 255, 0.25);
  transition: transform 0.05s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 8px rgba(75, 141, 255, 0.25);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 48px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type="text"],
input[type="file"] {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.4);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-color);
}

.status {
  color: var(--hint-color);
  font-size: 14px;
  margin: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  text-align: center;
}

.stats-visual {
  display: grid;
  gap: 14px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 180, 230, 0.35);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 141, 255, 0.15);
  color: var(--button-color);
  font-size: 18px;
}

.progress {
  height: 8px;
  background: rgba(148, 180, 230, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--button-color);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--hint-color);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.upload-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.upload-label span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 180, 230, 0.9);
  background: rgba(255, 255, 255, 0.8);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(75, 141, 255, 0.2);
  border-top-color: var(--button-color);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.success-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(55, 200, 122, 0.15);
  color: #197a46;
  font-weight: 600;
}

.checkmark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #37c87a;
  position: relative;
}

.checkmark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.hidden {
  display: none;
}

.identity-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.alert-banner {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.webview-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}

.webview-banner.hidden {
  display: none;
}

.webview-banner-copy {
  flex: 1 1 200px;
  min-width: 0;
}

.webview-banner-copy p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  font-weight: 500;
}

.webview-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.webview-banner-actions .secondary-btn {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.webview-banner-dismiss {
  border: none;
  background: rgba(146, 64, 14, 0.12);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

.webview-banner-status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 1.1em;
}

.webview-banner-status:empty {
  display: none;
}

.risk-list,
.leaderboard-list,
.report-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-item,
.leaderboard-item,
.report-item {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow);
}

.risk-name {
  font-weight: 600;
}

.risk-meta {
  color: var(--hint-color);
  font-size: 13px;
}

.report-media img,
.report-media video {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
}

.report-placeholder {
  height: 140px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint-color);
}

.report-item--compact {
  padding: 12px 14px;
  box-shadow: none;
}

.report-item--compact .report-info {
  gap: 4px;
}

.report-info {
  display: grid;
  gap: 6px;
}

.pill {
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill-green {
  background: rgba(45, 187, 94, 0.15);
  color: #1b7d3d;
}

.pill-yellow {
  background: rgba(255, 176, 32, 0.2);
  color: #8a5a00;
}

.pill-red {
  background: rgba(255, 88, 88, 0.2);
  color: #b62121;
}

.disabled-btn {
  opacity: 0.6;
  pointer-events: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.85);
  border-top: 1px solid rgba(148, 180, 230, 0.4);
  padding: 10px 12px max(16px, env(safe-area-inset-bottom));
  gap: 8px;
  backdrop-filter: blur(12px);
}

.doctor-bottom-nav {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.doctor-bottom-nav .nav-item {
  font-size: 0.72rem;
  min-height: 52px;
  padding: 4px 2px;
}

.doctor-bottom-nav .nav-item span {
  line-height: 1.1;
}

.nav-item {
  background: transparent;
  border: none;
  display: grid;
  gap: 4px;
  color: var(--hint-color);
  font-weight: 600;
  min-height: 48px;
  align-content: center;
}

.nav-item.active {
  color: var(--button-color);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 58, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-card {
  width: min(90%, 360px);
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leaderboard-table th,
.leaderboard-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(31, 42, 68, 0.08);
}

.leaderboard-table th {
  color: var(--hint-color);
  font-weight: 600;
}

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

@media (min-width: 768px) {
  .app {
    max-width: 560px;
    margin: 0 auto;
  }

  .app.doctor-app {
    max-width: 720px;
  }
}

@media (min-width: 1024px) {
  .app.doctor-app {
    max-width: 1100px;
  }
}

.home-body,
.page-sky {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 80% -10%, rgba(159, 208, 255, 0.55) 0%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #d7e8ff 100%);
}

.home {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  max-width: 480px;
  margin: 0 auto;
}

.home-brand {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2.1rem, 9vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: #1e4fad;
  animation: home-rise 0.7s ease both;
}

.home-title {
  margin: 18px 0 0;
  font-size: 1.35rem;
  font-weight: 600;
  animation: home-rise 0.7s ease 0.08s both;
}

.home-lead {
  margin: 10px 0 0;
  max-width: 22rem;
  color: var(--hint-color);
  animation: home-rise 0.7s ease 0.16s both;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
  animation: home-rise 0.7s ease 0.24s both;
}

.home-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--hint-color);
}

.home-hint a {
  color: #1e4fad;
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(148, 180, 230, 0.18);
}

.auth-mode-tab {
  min-height: 40px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--hint-color);
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.auth-mode-tab.active {
  background: #fff;
  color: var(--text-color, #1a1a1a);
  box-shadow: 0 1px 2px rgba(30, 79, 173, 0.12);
}

.auth-form {
  width: 100%;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
}

.auth-field input {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.9);
  background: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-weight: 500;
}

.auth-field input[aria-invalid="true"] {
  border-color: rgba(182, 33, 33, 0.75);
  background: rgba(255, 245, 245, 0.95);
}

.auth-alert {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #8b1a1a;
  background: rgba(182, 33, 33, 0.08);
  border: 1px solid rgba(182, 33, 33, 0.25);
}

.auth-alert[hidden] {
  display: none;
}

.auth-alert--busy {
  color: #1e4fad;
  background: rgba(75, 141, 255, 0.1);
  border-color: rgba(75, 141, 255, 0.35);
}

@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.doctor-panel.hidden {
  display: none;
}

.doctor-header .header-top {
  align-items: center;
}

.doctor-brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1e4fad;
  line-height: 1.15;
}

.menu-btn {
  position: relative;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.doctor-menu {
  position: relative;
}

.doctor-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 200px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 180, 230, 0.45);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doctor-menu-panel.hidden {
  display: none;
}

.doctor-menu-lang {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 4px;
  background: rgba(242, 247, 255, 0.9);
  border-radius: 999px;
}

.doctor-menu-lang .lang-btn {
  flex: 1;
}

.doctor-menu-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
}

.doctor-menu-item:hover,
.doctor-menu-item:focus-visible {
  background: rgba(75, 141, 255, 0.12);
}

.doctor-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.doctor-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  min-height: 64px;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 180, 230, 0.35);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.doctor-kpi:focus-visible {
  outline: 2px solid rgba(75, 141, 255, 0.55);
  outline-offset: 2px;
}

button.doctor-kpi:active {
  transform: scale(0.98);
}

.doctor-kpi--warn {
  border-color: rgba(224, 180, 74, 0.55);
  background: rgba(255, 250, 235, 0.9);
}

.doctor-kpi .stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hint-color);
}

.doctor-kpi .stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-color);
}

.kpi-context {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hint-color);
  line-height: 1.2;
}

.kpi-context[hidden] {
  display: none;
}

.dash-summary {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
  min-height: 1.35em;
}

.status-breakdown {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 180, 230, 0.25);
  margin-top: 4px;
}

.status-breakdown[hidden] {
  display: none;
}

.status-seg {
  display: block;
  min-width: 0;
}

.status-seg-red {
  background: #e35d5d;
}

.status-seg-yellow {
  background: #e0b44a;
}

.status-seg-green {
  background: #3da86b;
}

.status-breakdown-label {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--hint-color);
  font-weight: 600;
}

.status-breakdown-label[hidden] {
  display: none;
}

.status-success {
  color: #1f7a3f;
  font-weight: 600;
}

.doctor-skeleton {
  position: relative;
  color: transparent !important;
  background: linear-gradient(
    90deg,
    rgba(148, 180, 230, 0.22),
    rgba(148, 180, 230, 0.4),
    rgba(148, 180, 230, 0.22)
  );
  background-size: 200% 100%;
  animation: doctor-skeleton-pulse 1.2s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes doctor-skeleton-pulse {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.dash-stats,
.dash-destinations {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
}

.dash-stats-grid--single {
  grid-template-columns: 1fr;
}

.dash-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 180, 230, 0.35);
}

button.dash-stat-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.dash-stat-card:focus-visible {
  outline: 2px solid rgba(75, 141, 255, 0.55);
  outline-offset: 2px;
}

.dash-stat-card--primary.dash-stat-card--warn {
  border-color: rgba(224, 180, 74, 0.55);
  background: rgba(255, 250, 235, 0.9);
}

.dash-stat-card--spark {
  min-height: 110px;
}

.dash-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--hint-color);
}

.dash-stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.dash-stat-context {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hint-color);
}

.dash-stat-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.dash-stat-caption {
  margin: 0;
  font-size: 0.75rem;
  color: var(--hint-color);
  font-weight: 500;
}

.dash-stat-caption--empty {
  color: #9a6b00;
}

.dash-stats-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--hint-color);
  line-height: 1.35;
}

.dash-stat-delta {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.dash-stat-delta.delta-up {
  color: #1f7a3f;
  background: rgba(61, 168, 107, 0.14);
}

.dash-stat-delta.delta-down {
  color: #8b1a1a;
  background: rgba(182, 33, 33, 0.1);
}

.dash-stat-delta.delta-warn {
  color: #9a6b00;
  background: rgba(224, 180, 74, 0.2);
}

.dash-stat-delta.delta-flat {
  color: var(--hint-color);
  background: rgba(148, 180, 230, 0.2);
}

.dash-stat-delta[hidden] {
  display: none;
}

.dash-sparkline {
  flex-shrink: 0;
  overflow: visible;
}

.dash-sparkline.hidden {
  display: none;
}

.dash-dest {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 180, 230, 0.35);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dash-dest:focus-visible {
  outline: 2px solid rgba(75, 141, 255, 0.55);
  outline-offset: 2px;
}

.dash-dest:active {
  transform: scale(0.99);
}

.dash-dest-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(75, 141, 255, 0.12);
  color: #1e4fad;
  flex-shrink: 0;
}

.dash-dest-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-dest-title {
  font-weight: 650;
  font-size: 1rem;
}

.dash-dest-meta {
  font-size: 0.85rem;
  color: var(--hint-color);
  font-weight: 500;
}

.dash-dest-count {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1e4fad;
  min-width: 1.5ch;
  text-align: right;
}

.dash-dest-count:empty,
.dash-dest-count[hidden] {
  display: none;
}

.dash-dest-chevron {
  color: var(--hint-color);
  font-size: 0.85rem;
}

.doctor-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.doctor-section-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 650;
}

.doctor-section-hint {
  margin: 0;
  color: var(--hint-color);
  font-size: 0.9rem;
  line-height: 1.35;
}

.worklist-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.worklist-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.worklist-filters::-webkit-scrollbar {
  display: none;
}

.worklist-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(148, 180, 230, 0.5);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-color);
  border-radius: 999px;
  padding: 7px 11px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.worklist-chip.is-active {
  border-color: rgba(75, 141, 255, 0.65);
  background: rgba(75, 141, 255, 0.14);
  color: #1e4fad;
}

.worklist-chip-count {
  min-width: 1.25rem;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  background: rgba(30, 79, 173, 0.1);
  color: inherit;
}

.worklist-chip.is-active .worklist-chip-count {
  background: rgba(75, 141, 255, 0.22);
}

.worklist-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.worklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.worklist-item:active {
  transform: scale(0.99);
}

.worklist-item-body {
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.worklist-item-name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
}

.worklist-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.worklist-reason-chip {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  background: rgba(255, 243, 220, 0.95);
  color: #9a6b00;
  border: 1px solid rgba(224, 180, 74, 0.45);
}

.worklist-item-note {
  display: none;
}

.worklist-more {
  width: 100%;
  min-height: 40px;
  border: 1px dashed rgba(148, 180, 230, 0.55);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  color: #1e4fad;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
}

.worklist-more.hidden {
  display: none;
}

.patients-load-more {
  width: 100%;
  margin-top: 0.75rem;
}

.patients-load-more.hidden {
  display: none;
}

.content-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.content-field textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.9);
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-weight: 500;
  resize: vertical;
}

.content-publisher {
  gap: 14px;
}

.content-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 180, 230, 0.35);
}

.content-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.content-block-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 650;
}

.content-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  color: #1f7a3f;
  background: rgba(61, 168, 107, 0.14);
  white-space: nowrap;
}

.content-chip--dirty {
  color: #9a6b00;
  background: rgba(224, 180, 74, 0.22);
}

.content-char-count {
  align-self: flex-end;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hint-color);
}

.carousel-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.carousel-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 112px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1a2a;
  border: 1px solid rgba(148, 180, 230, 0.35);
}

.carousel-thumb video,
.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-thumb-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.content-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(75, 141, 255, 0.45);
  background: rgba(75, 141, 255, 0.06);
}

.content-preview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.content-preview-note,
.content-preview-guide,
.content-preview-meta {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-color);
}

.content-preview-meta {
  color: var(--hint-color);
  font-weight: 600;
}

.guide-video-preview {
  width: 100%;
  max-height: 220px;
  border-radius: 12px;
  background: #0f1a2a;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px dashed rgba(75, 141, 255, 0.55);
  color: #1e4fad;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
}

.content-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hint-color);
}

.content-status--ok {
  color: #1f7a3f;
}

.content-status--error {
  color: #b62121;
}

.content-status--busy {
  color: #1e4fad;
}

.doctor-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.doctor-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

.attention-list,
.patient-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attention-card,
.patient-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 180, 230, 0.35);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.attention-card-body,
.patient-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.attention-card-name,
.patient-card-name {
  font-weight: 650;
}

.attention-card-meta,
.patient-card-score {
  color: var(--hint-color);
  font-size: 0.92rem;
}

.patient-card-reason {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--hint-color);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.patient-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.patient-card-rank {
  font-weight: 700;
  color: var(--button-color);
  min-width: 2rem;
}

.report-item-tappable {
  cursor: pointer;
}

.report-item-tappable:hover {
  border-color: rgba(75, 141, 255, 0.45);
}

.doctor-bottom-nav .nav-item i {
  font-size: 1.05rem;
}

.inbox-btn {
  position: relative;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-color);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}

.inbox-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.inbox-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.inbox-sheet.hidden {
  display: none;
}

.inbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 42, 58, 0.35);
}

.inbox-panel {
  position: relative;
  max-height: 70dvh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -8px 32px rgba(30, 42, 58, 0.12);
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inbox-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.inbox-close {
  border: none;
  background: rgba(148, 180, 230, 0.2);
  color: var(--text-color);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(70dvh - 80px);
}

.inbox-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.inbox-item-unread {
  border-color: rgba(75, 141, 255, 0.45);
  background: rgba(234, 242, 255, 0.95);
}

.inbox-item-title {
  font-weight: 650;
}

.inbox-item-body {
  color: var(--hint-color);
  font-size: 0.92rem;
}

.inbox-item-time {
  color: var(--hint-color);
  font-size: 0.82rem;
}

.inbox-empty.hidden {
  display: none;
}

.patient-card-highlight {
  animation: patient-highlight 2s ease-out;
  border-color: var(--button-color);
  box-shadow: 0 0 0 2px rgba(75, 141, 255, 0.35);
}

@keyframes patient-highlight {
  0% {
    background: rgba(75, 141, 255, 0.25);
  }
  100% {
    background: rgba(255, 255, 255, 0.65);
  }
}

.doctor-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(75, 141, 255, 0.35);
  box-shadow: var(--shadow);
  font-weight: 600;
  color: var(--text-color);
}

.doctor-toast.hidden {
  display: none;
}

/* ========================
   Patient Detail Overlay
   ======================== */
.patient-detail {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.patient-detail.hidden {
  display: none;
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px 10px;
}

.detail-session-line {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--hint-color);
  line-height: 1.35;
}

.access-help {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(148, 180, 230, 0.14);
  border: 1px solid rgba(148, 180, 230, 0.28);
}

.access-help-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.access-help-login {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.access-help-label {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--hint-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.access-help-phone {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color, #1a1a1a);
  background: transparent;
  padding: 0;
}

.access-help-copy {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.access-help-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--hint-color);
}

.access-recovery-modal-card {
  max-width: 22rem;
  text-align: center;
}

.access-recovery-hint {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--hint-color);
  line-height: 1.4;
}

.access-recovery-code {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  font-variant-numeric: tabular-nums;
}

.access-recovery-expiry {
  margin: 8px 0 14px;
  font-size: 0.85rem;
  color: var(--hint-color);
}

.access-recovery-qr {
  display: block;
  margin: 0 auto 16px;
  width: 240px;
  height: 240px;
  border-radius: 12px;
  background: #fff;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(148, 180, 230, 0.18);
}

.detail-tab {
  min-height: 40px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--hint-color);
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  padding: 6px 2px;
}

.detail-tab.active {
  background: #fff;
  color: var(--text-color);
  box-shadow: 0 1px 3px rgba(30, 60, 90, 0.12);
}

.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin: 10px 0 8px;
}

.archive-toolbar .care-plan-field {
  flex: 1 1 140px;
  min-width: 140px;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.archive-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 180, 230, 0.25);
}

.archive-item-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(148, 180, 230, 0.2);
}

.archive-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.archive-item-kind {
  font-size: 0.86rem;
  font-weight: 650;
}

.archive-item-time {
  font-size: 0.78rem;
  color: var(--hint-color);
}

.archive-item-badge {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--hint-color);
  white-space: nowrap;
}

.archive-purge-btn {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}

.detail-tab-panels {
  padding: 0 12px 8px;
}

.detail-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

.detail-tab-panel[hidden] {
  display: none;
}

.detail-panel-section.detail-reason,
.detail-panel-section.detail-section,
.detail-panel-section.detail-today,
.detail-panel-section.detail-diet,
.detail-panel-section.care-plan-block,
.detail-panel-section.session-tile,
.detail-panel-section.monitoring-advanced {
  margin-left: 0;
  margin-right: 0;
}

.detail-tab-panel--suhbat {
  min-height: min(60vh, 520px);
}

.detail-suhbat-block {
  display: flex;
  flex-direction: column;
  min-height: min(55vh, 480px);
}

.detail-suhbat-block .message-thread {
  flex: 1;
  max-height: none;
  min-height: 220px;
}

.detail-suhbat-block .detail-message-compose {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 10px;
  background: linear-gradient(180deg, transparent, var(--bg-color) 28%);
}

.detail-progress-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.detail-today-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.detail-progress-label {
  font-size: 0.82rem;
  font-weight: 650;
}

.detail-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 180, 230, 0.25);
  overflow: hidden;
}

.detail-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-color, #3a7bd5);
  min-width: 0;
  transition: width 0.2s ease;
}

.detail-progress-meta {
  font-size: 0.75rem;
  color: var(--hint-color);
  white-space: nowrap;
}

.helio-slot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.helio-slot-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 650;
  border: 1px solid rgba(148, 180, 230, 0.4);
  background: rgba(255, 255, 255, 0.75);
}

.helio-slot-chip--done {
  border-color: rgba(90, 160, 110, 0.5);
  background: rgba(232, 246, 236, 0.95);
  color: #2d6a3e;
}

.helio-slot-chip--missing {
  border-color: rgba(210, 140, 90, 0.45);
  background: rgba(255, 244, 232, 0.95);
  color: #8a4b1a;
}

.message-thread .message-item {
  max-width: 92%;
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.message-thread .message-item--patient {
  align-self: flex-start;
  margin-right: auto;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 180, 230, 0.35);
}

.message-thread .message-item--doctor {
  align-self: flex-end;
  margin-left: auto;
  background: rgba(232, 242, 255, 0.95);
  border: 1px solid rgba(100, 150, 210, 0.35);
}

.message-list.message-thread {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-faq-link {
  border: none;
  background: none;
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-stage-strip {
  margin-top: 8px;
  gap: 4px;
}

.detail-stage-strip .stage {
  font-size: 0.68rem;
  padding: 3px 7px;
}

.detail-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-color);
  font-size: 1rem;
  font-weight: 600;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.detail-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.stage-strip,
.detail-stage-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.stage-strip::-webkit-scrollbar,
.detail-stage-strip::-webkit-scrollbar {
  display: none;
}

.stage,
.detail-stage {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  border: 1px solid rgba(148, 180, 230, 0.45);
  background: rgba(255, 255, 255, 0.7);
  color: var(--hint-color);
  white-space: nowrap;
  font: inherit;
}

button.stage {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage--ok,
.detail-stage--ok {
  border-color: rgba(56, 161, 105, 0.45);
  background: rgba(226, 250, 236, 0.95);
  color: #1f7a4d;
}

.stage--pending,
.detail-stage--pending {
  border-color: rgba(148, 180, 230, 0.4);
  background: rgba(241, 246, 255, 0.9);
  color: var(--hint-color);
}

.stage--warn,
.detail-stage--warn {
  border-color: rgba(224, 180, 74, 0.55);
  background: rgba(255, 248, 230, 0.95);
  color: #9a6b00;
}

.stage--current {
  box-shadow: inset 0 0 0 1px rgba(30, 79, 173, 0.55);
  border-color: rgba(75, 141, 255, 0.65);
  color: #1e4fad;
  font-weight: 700;
}

.patient-stage-wrap {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.patient-stage-wrap .stage-strip {
  margin-top: 0;
}

#patientStageNext {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text-color);
  min-height: 1.2em;
}

#patientStageNext:empty {
  display: none;
}

.detail-today {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.72);
}

.detail-today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.detail-today h3,
.detail-diet h3,
.detail-section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 650;
}

.detail-today-head h3 {
  margin: 0;
}

.detail-progress-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 10px;
}

.progress-day-date-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 0;
}

.progress-date-label {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--hint-color);
}

.progress-date-sep {
  padding-bottom: 6px;
  color: var(--hint-color);
  font-weight: 650;
}

.progress-day-date {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid rgba(148, 180, 230, 0.45);
  border-radius: 8px;
  background: #fff;
  color: var(--text-color);
  font-size: 0.78rem;
}

.detail-rules-details {
  font-size: 0.78rem;
}

.detail-rules-details summary {
  cursor: pointer;
  color: var(--hint-color);
  font-weight: 600;
  list-style: none;
}

.detail-rules-details summary::-webkit-details-marker {
  display: none;
}

.detail-today-summary {
  margin: 0 0 8px;
  font-weight: 650;
  font-size: 0.95rem;
}

.detail-today-missed {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 650;
  color: #9a6b00;
}

.detail-today-missed.hidden {
  display: none;
}

.care-note-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 180, 230, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.care-note-block--top {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.care-note-block h3,
.message-sent-block h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.care-note-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.4;
}

.care-note-text.hidden,
.care-note-empty.hidden,
.message-list-empty.hidden {
  display: none;
}

.message-compose,
.message-sent-block,
.private-note-details {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-compose {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 180, 230, 0.35);
}

.private-note-details {
  padding-top: 10px;
  border-top: 1px solid rgba(148, 180, 230, 0.35);
}

.private-note-details summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--hint-color);
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-thread {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 2px;
}

.message-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.72);
  max-width: 92%;
}

.message-item--patient {
  align-self: flex-start;
  border-color: rgba(148, 180, 230, 0.4);
  background: rgba(236, 244, 255, 0.9);
}

.message-item--doctor {
  align-self: flex-end;
  border-color: rgba(120, 170, 140, 0.45);
  background: rgba(232, 246, 236, 0.92);
}

.message-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-item-role {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--hint-color);
  text-transform: uppercase;
}

.message-item-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hint-color);
}

.message-item-body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.35;
}

.message-item-actions {
  margin-top: 8px;
}

.message-item-actions .secondary-btn,
.message-item-actions .ghost-btn {
  font-size: 0.8rem;
  padding: 4px 10px;
}

.detail-message-compose {
  margin-top: 10px;
}

.faq-accordion-block {
  margin: 12px 0 16px;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-accordion details {
  border: 1px solid rgba(148, 180, 230, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
}

.faq-accordion summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.92rem;
}

.faq-accordion-answer {
  margin: 8px 0 4px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  color: var(--text-color, inherit);
}

.faq-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.faq-manage-item {
  border: 1px solid rgba(148, 180, 230, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.faq-manage-item-q {
  font-weight: 650;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.faq-manage-item-a {
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: pre-wrap;
  color: var(--hint-color);
  margin-bottom: 8px;
}

.faq-manage-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.faq-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 180, 230, 0.45);
}

.faq-status-badge--draft {
  background: rgba(255, 244, 220, 0.9);
}

.faq-status-badge--published {
  background: rgba(232, 246, 236, 0.95);
}

.faq-modal-card {
  max-width: min(480px, 94vw);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-status-field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 180, 230, 0.45);
  background: #fff;
}

.modal-backdrop.hidden {
  display: none;
}

#treatment-section .primary-btn,
#treatment-section .secondary-btn {
  margin-top: 4px;
  width: fit-content;
}

.detail-today-list {
  margin: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  list-style: none;
}

.detail-score-rules {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--hint-color);
  line-height: 1.35;
}

.detail-diet {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.72);
}

.detail-diet.hidden {
  display: none;
}

.detail-diet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.detail-diet-thumb {
  border: none;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #0f1a2a;
  cursor: pointer;
}

.detail-diet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-diet-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--hint-color);
}

.detail-section {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.35);
  background: rgba(255, 255, 255, 0.72);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.session-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.4);
  background: rgba(255, 255, 255, 0.9);
}

.session-tile--active {
  border-color: rgba(61, 168, 107, 0.55);
  background: rgba(61, 168, 107, 0.1);
}

.session-tile-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.session-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(75, 141, 255, 0.12);
  color: #1a4f9c;
  flex: 0 0 auto;
}

.session-tile--active .session-tile-icon {
  background: rgba(61, 168, 107, 0.18);
  color: #1f7a3f;
}

.session-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-tile-title {
  font-weight: 650;
  font-size: 0.98rem;
}

.session-tile-meta {
  margin: 0;
  min-height: 1.1em;
  font-size: 0.85rem;
  color: var(--hint-color);
  font-weight: 600;
}

.session-tile--active .session-tile-meta {
  color: #1f7a3f;
}

.session-tile-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-tile-controls[hidden] {
  display: none !important;
}

.session-select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(148, 180, 230, 0.5);
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text-color);
}

.session-cta {
  flex: 0 0 auto;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 40px;
  font-size: 0.9rem;
  font-weight: 650;
  background: var(--button-color, #4b8dff);
  color: #fff;
  cursor: pointer;
}

.session-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-reason {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 180, 230, 0.4);
  background: rgba(255, 255, 255, 0.72);
}

.detail-reason h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.detail-reason-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.detail-reason-empty {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #9a6b00;
}

.detail-reason--empty {
  border-color: rgba(224, 180, 74, 0.55);
  background: rgba(224, 180, 74, 0.12);
}

.detail-reason-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 180, 230, 0.5);
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  min-height: 72px;
  box-sizing: border-box;
}

.detail-reason-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-action-row {
  display: none;
}

.detail-action-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
}

.detail-select {
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text-color);
  width: 100%;
}

.detail-action-status {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  min-height: 1.2em;
}

.primary-btn {
  background: var(--accent-color, #4b8dff);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  width: 100%;
}

.primary-btn:active {
  opacity: 0.85;
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hide bottom nav when detail is open — mobile only */
@media (max-width: 1023px) {
  .doctor-app.detail-open .doctor-bottom-nav {
    display: none;
  }

  .doctor-app.detail-open .doctor-panel {
    display: none;
  }
}

.doctor-app.detail-open #inboxSheet {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.patient-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-color);
}

.patient-search:focus {
  outline: 2px solid rgba(75, 141, 255, 0.45);
  outline-offset: 1px;
}

/* Desktop master–detail */
@media (min-width: 1024px) {
  .doctor-app {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "banner"
      "header"
      "main"
      "nav";
    column-gap: 16px;
    align-items: start;
  }

  .doctor-app > #identityBanner {
    grid-area: banner;
  }

  .doctor-app > .header {
    grid-area: header;
  }

  .doctor-app > .doctor-panel {
    grid-area: main;
    min-width: 0;
  }

  .doctor-app > .doctor-bottom-nav {
    grid-area: nav;
  }

  .doctor-app > .patient-detail {
    grid-area: detail;
  }

  .doctor-app.detail-open {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "banner banner"
      "header header"
      "main detail"
      "nav nav";
  }

  .doctor-app.detail-open .doctor-panel:not(.hidden) {
    display: block;
  }

  .doctor-app.detail-open .doctor-bottom-nav {
    display: flex;
  }

  .doctor-app.detail-open .patient-detail {
    position: relative;
    inset: auto;
    z-index: 1;
    max-height: calc(100vh - 160px);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    background: var(--card-bg, #fff);
  }

  .doctor-app.detail-open .patient-detail:not(.hidden) {
    display: flex;
  }
}

.reason-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.reason-sheet.hidden {
  display: none;
}

.reason-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 42, 58, 0.35);
}

.reason-sheet-panel {
  position: relative;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -8px 32px rgba(30, 42, 58, 0.12);
}

.reason-sheet-panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.reason-sheet-hint {
  margin: 0;
  color: var(--hint-color);
  font-size: 0.92rem;
  line-height: 1.35;
}

.reason-sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reason-chip {
  border: 1px solid rgba(148, 180, 230, 0.5);
  background: rgba(75, 141, 255, 0.08);
  color: var(--text-color);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.reason-chip.is-selected,
.reason-chip[aria-pressed="true"] {
  border-color: rgba(75, 141, 255, 0.85);
  background: rgba(75, 141, 255, 0.22);
  color: #1a4f9c;
}

.detail-reason-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-region-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  background: rgba(75, 141, 255, 0.14);
  color: #1a4f9c;
}

.detail-reason-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--hint-color);
  line-height: 1.35;
}

.vitiligo-photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vitiligo-photo-gallery[hidden] {
  display: none;
}

.vitiligo-photo-thumb {
  position: relative;
  width: 72px;
}

.vitiligo-photo-thumb-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.vitiligo-photo-thumb-btn img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(148, 180, 230, 0.45);
  background: #eef3fb;
}

.vitiligo-photo-caption {
  font-size: 0.7rem;
  line-height: 1.2;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vitiligo-photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.vitiligo-photo-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vitiligo-photo-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--hint-color);
}

.vitiligo-photo-region-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vitiligo-photo-region-label {
  min-width: 7rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.vitiligo-photo-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.vitiligo-photo-add-btn {
  font-size: 0.85rem;
  padding: 6px 10px;
}

.detail-reason-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-reason-edit.hidden {
  display: none;
}

.reason-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reason-sheet-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.88rem;
}

