/* Year-long Care Manager Panel — overlay system
   Mounted by panel.js into #cm-panel-root (above all course UI). */

body.cmp-locked { overflow: hidden; }

#cm-panel-root {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--bg);
  overflow-y: auto;
}

.cmp-eyebrow {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 6px;
}

.cmp-shell {
  max-width: 1280px; margin: 0 auto; padding: 32px 40px 48px;
}

.cmp-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 32px;
  padding-bottom: 28px; border-bottom: 0.5px solid var(--line); margin-bottom: 32px;
}
.cmp-title {
  font-family: 'Newsreader', Georgia, serif; font-weight: 400;
  font-size: 38px; line-height: 1.05; letter-spacing: -0.025em;
  color: var(--text); margin-bottom: 8px;
}
.cmp-sub { color: var(--text-soft); font-size: 14px; line-height: 1.6; max-width: 60ch; }

.cmp-progress { text-align: right; min-width: 180px; }
.cmp-progress__num {
  font-family: 'Newsreader', serif; font-size: 44px; font-weight: 400;
  color: var(--gold-bright); letter-spacing: -0.03em; line-height: 1;
}
.cmp-progress__label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); margin-top: 4px; }
.cmp-close-btn {
  margin-top: 16px; background: rgba(255,255,255,0.06); color: var(--text-soft);
  border: 0.5px solid var(--line); padding: 8px 14px; border-radius: var(--radius);
  font-size: 12px; cursor: pointer; transition: all 0.2s var(--easing);
}
.cmp-close-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.cmp-tiles { display: flex; flex-direction: column; gap: 32px; }
.cmp-phase__label {
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 14px;
}
.cmp-phase__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px;
}

.cmp-tile {
  display: flex; align-items: stretch; gap: 14px; text-align: left;
  background: var(--surface); border: 0.5px solid var(--line);
  padding: 16px 18px; border-radius: var(--radius-lg);
  cursor: pointer; transition: all 0.25s var(--easing);
  font-family: inherit; color: inherit;
}
.cmp-tile:hover { border-color: rgba(196,163,95,0.4); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cmp-tile.is-done { opacity: 0.55; border-color: rgba(74,222,128,0.4); }
.cmp-tile__avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
}
.cmp-tile__body { flex: 1; min-width: 0; }
.cmp-tile__head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.cmp-tile__name { font-size: 15px; font-weight: 600; color: var(--text); }
.cmp-tile__flag {
  width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 8px rgba(217,119,87,0.7);
}
.cmp-tile__meta { font-size: 11px; color: var(--text-mute); margin-bottom: 6px; }
.cmp-tile__milestone { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.cmp-tile__objective { font-size: 13px; color: var(--text-soft); line-height: 1.45; }
.cmp-tile__status { font-size: 18px; color: var(--gold); align-self: center; }
.cmp-tile.is-done .cmp-tile__status { color: #4ade80; }

.cmp-footer {
  margin-top: 40px; padding-top: 24px; border-top: 0.5px solid var(--line);
  display: flex; gap: 12px; justify-content: flex-end;
}
.cmp-audit-btn {
  background: var(--surface); color: var(--text); border: 0.5px solid var(--line);
  padding: 12px 18px; border-radius: var(--radius); font-size: 13px;
  cursor: pointer; transition: all 0.2s var(--easing); font-family: inherit;
}
.cmp-audit-btn:hover { border-color: var(--gold); color: var(--gold-bright); }

/* Eligibility check */
.cmp-elig { min-height: 100vh; display: grid; place-items: center; padding: 40px; }
.cmp-elig__shell {
  max-width: 640px; width: 100%; background: var(--surface);
  padding: 36px 40px; border-radius: var(--radius-lg); border: 0.5px solid var(--line);
}
.cmp-elig__title {
  font-family: 'Newsreader', serif; font-weight: 400; font-size: 28px;
  letter-spacing: -0.02em; margin-bottom: 12px;
}
.cmp-elig__intro { color: var(--text-soft); font-size: 14px; line-height: 1.6; margin-bottom: 24px; }
.cmp-elig__card {
  background: var(--bg-soft); border: 0.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 20px;
}
.cmp-elig__row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 0.5px solid var(--line); font-size: 13px;
}
.cmp-elig__row:last-child { border-bottom: 0; }
.cmp-elig__row span { color: var(--text-mute); }
.cmp-elig__row strong { color: var(--text); font-weight: 600; }

.cmp-elig__statusbox {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 20px; border-radius: var(--radius); margin-bottom: 24px;
  border: 0.5px solid var(--line);
}
.cmp-elig__statusbox--active { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.4); }
.cmp-elig__statusbox--pending { background: rgba(217,119,87,0.1); border-color: rgba(217,119,87,0.4); }
.cmp-elig__statusicon { font-size: 24px; line-height: 1; }
.cmp-elig__statusbox--active .cmp-elig__statusicon { color: #4ade80; }
.cmp-elig__statusbox--pending .cmp-elig__statusicon { color: var(--warn); }
.cmp-elig__statushead { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; margin-bottom: 4px; }
.cmp-elig__statusdetail { font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.cmp-elig__flag { margin-top: 8px; font-size: 12px; color: var(--warn); }
.cmp-elig__warn { color: var(--warn); font-weight: 600; }

.cmp-elig__actions { display: flex; gap: 12px; justify-content: flex-end; }

.cmp-btn {
  font-family: inherit; font-size: 13px; padding: 10px 18px;
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s var(--easing);
  border: 0.5px solid var(--line);
}
.cmp-btn--primary { background: var(--gold); color: #1a1a1a; font-weight: 700; border-color: var(--gold); }
.cmp-btn--primary:hover { background: var(--gold-bright); }
.cmp-btn--ghost { background: rgba(255,255,255,0.06); color: var(--text-soft); }
.cmp-btn--ghost:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* Touchpoint (360 + side panel) */
.ts-root {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 360px;
  height: 100vh;
}
.ts-header {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 0.5px solid var(--line);
  background: var(--bg-soft);
}
.ts-title { font-family: 'Newsreader', serif; font-weight: 400; font-size: 22px; letter-spacing: -0.02em; }
.ts-stage { position: relative; background: #000; }
.ts-pano { width: 100%; height: 100%; min-height: 400px; }

/* Pannellum hotspot marker — gold pulsing dot */
.ts-hotspot-marker { position: absolute; pointer-events: auto; }
.ts-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(196,163,95,0.25), 0 0 16px rgba(196,163,95,0.6);
  cursor: pointer;
  animation: ts-pulse 2.4s var(--easing) infinite;
  transition: background 0.3s var(--easing);
  border: 2px solid rgba(255,255,255,0.6);
}
.ts-dot.is-visited { background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,0.25); animation: none; }
.ts-hotspot-marker.is-visited .ts-dot { background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,0.25); animation: none; }
@keyframes ts-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
/* Pannellum default tooltip — hide their span text, we provide our own */
.ts-hotspot-marker > span { display: none; }

.ts-side {
  background: var(--surface); border-left: 0.5px solid var(--line);
  padding: 20px 22px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.ts-objective p:not(.cmp-eyebrow) { font-size: 13px; color: var(--text-soft); line-height: 1.55; }
.ts-history ul { list-style: none; padding: 0; margin: 0; font-size: 12px; color: var(--text-soft); }
.ts-history li { padding: 6px 0; border-bottom: 0.5px solid var(--line); line-height: 1.5; }
.ts-history li span { display: block; color: var(--text-mute); font-size: 11px; margin-bottom: 2px; }

#ts-progress-bar {
  background: var(--bg-soft); height: 6px; border-radius: 3px; overflow: hidden;
  border: 0.5px solid var(--line);
}
#ts-progress-bar span { display: block; height: 100%; background: var(--gold); transition: width 0.3s var(--easing); }

.ts-chart textarea {
  width: 100%; min-height: 130px; box-sizing: border-box;
  background: var(--bg-soft); color: var(--text);
  border: 0.5px solid var(--line); border-radius: var(--radius);
  padding: 12px; font-family: inherit; font-size: 13px; line-height: 1.5;
  margin-bottom: 12px; resize: vertical;
}
.ts-chart textarea:focus { outline: none; border-color: var(--gold); }
#ts-save:disabled { opacity: 0.4; cursor: not-allowed; }

.ts-popover {
  position: absolute; right: 380px; bottom: 24px;
  width: 320px; background: rgba(15,15,26,0.96); backdrop-filter: blur(12px);
  border: 0.5px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; z-index: 5;
}
.ts-popover__meta { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.ts-popover__title { font-family: 'Newsreader', serif; font-weight: 400; font-size: 18px; letter-spacing: -0.01em; margin-bottom: 8px; }
.ts-popover__body { font-size: 13px; color: var(--text-soft); line-height: 1.6; margin-bottom: 10px; }
.ts-popover__cite { font-size: 11px; color: var(--text-mute); margin-bottom: 12px; font-style: italic; }

@media (max-width: 1024px) {
  .ts-root { grid-template-columns: 1fr; grid-template-rows: auto 50vh auto; }
  .ts-side { border-left: 0; border-top: 0.5px solid var(--line); }
  .ts-popover { position: fixed; right: 16px; left: 16px; bottom: 16px; width: auto; }
}

/* Audit screens */
.audit-shell { max-width: 1280px; margin: 0 auto; padding: 32px 40px 48px; }
.audit-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 32px;
  padding-bottom: 24px; border-bottom: 0.5px solid var(--line); margin-bottom: 28px;
}
.audit-title {
  font-family: 'Newsreader', serif; font-weight: 400; font-size: 32px;
  letter-spacing: -0.025em; margin-bottom: 6px;
}
.audit-sub { color: var(--text-soft); font-size: 13px; }

.audit-grid { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.audit-entries h3, .audit-rubric h3 {
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-mute); font-weight: 600; margin-bottom: 14px;
}
.audit-entry {
  background: var(--surface); border: 0.5px solid var(--line);
  padding: 16px 18px; border-radius: var(--radius); margin-bottom: 12px;
}
.audit-entry header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; font-size: 12px; }
.audit-entry header strong { color: var(--text); font-size: 14px; }
.audit-entry header span { color: var(--text-mute); }
.audit-cite { color: var(--gold) !important; font-style: italic; }
.audit-text { font-size: 13px; color: var(--text-soft); line-height: 1.55; }

.audit-rubric ul { list-style: none; padding: 0; margin: 0 0 20px; }
.audit-rubric li { margin-bottom: 12px; }
.audit-rubric label { display: flex; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.audit-rubric input[type=checkbox] { margin-top: 3px; accent-color: var(--gold); }

.audit-empty {
  background: var(--surface); border: 0.5px solid var(--line);
  padding: 32px; border-radius: var(--radius); text-align: center;
  color: var(--text-mute); font-size: 14px;
}

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