/* ==========================================================================
   QRMSC — live case panels and My notes (loaded after site.css)
   ========================================================================== */

.app-header { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 1px solid var(--line); }
.app-header .header-inner { min-height: 64px; gap: 1rem; }
.app-header .brand img { width: 38px; height: 38px; }
.app-header .brand-word b { font-size: 1.08rem; }
.app-nav { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.app-nav a { font-family: var(--sans); font-weight: 600; font-size: .95rem; text-decoration: none; padding: .5rem .8rem; border-radius: 999px; }
.app-nav a:hover { background: var(--paper-2); }
.app-nav a { white-space: nowrap; }
.me-menu .me-links { display: none; gap: .25rem; margin-bottom: .9rem; }
.me-menu .me-links a { display: block; padding: .55rem .2rem; border-bottom: 1px solid var(--line); font-weight: 600; text-decoration: none; }
@media (max-width: 560px) {
  .app-nav a { display: none; }
  .app-nav a.keep { display: block; }
  .me-menu .me-links { display: grid; }
}
.me-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--disc); color: var(--deep); font-family: var(--sans); font-weight: 700; font-size: .9rem;
}
.me-menu {
  position: absolute; right: var(--gutter); top: calc(100% + .4rem); z-index: 60; width: min(300px, calc(100vw - 2rem));
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: 1rem;
  font-family: var(--sans);
}
.me-menu p { margin: 0; }
.me-menu .who { font-weight: 700; color: var(--deep); }
.me-menu .email { font-size: .9rem; color: var(--slate-soft); word-break: break-all; margin-bottom: .9rem; }
.me-menu .btn { width: 100%; }
.app-header .header-inner { position: relative; }

.app-main { padding: clamp(1.5rem, 4vw, 3rem) 0 5rem; min-height: calc(100vh - 64px); }
.loading { padding: 4rem 0; text-align: center; font-family: var(--sans); color: var(--slate-soft); }

/* ---------- Join ---------- */
.join { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: stretch; }
.join-intro {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-start;
  background: var(--deep); color: var(--paper); border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 3rem); min-height: 520px;
}
.join-intro h1 { color: var(--paper); font-size: clamp(2.2rem, 4vw, 3.4rem); }
.join-intro p { margin-top: 1rem; color: rgba(244, 243, 234, .8); max-width: 38ch; }
.join-intro ul { list-style: none; margin-top: 1.5rem; display: grid; gap: .7rem; font-family: var(--sans); position: relative; z-index: 1; }
.join-intro li { display: flex; gap: .7rem; align-items: baseline; }
.join-intro li::before { content: ""; width: .6rem; height: .6rem; flex: none; background: var(--wheat-soft); border-radius: 0 70% 0 70%; }
.join-intro img { position: absolute; left: -6%; bottom: -2%; width: 112%; max-width: none; opacity: .42; mix-blend-mode: luminosity; pointer-events: none; }
.join-form { background: var(--card); border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 3rem); box-shadow: var(--shadow); align-self: start; }
.join-form h2 { font-size: 1.7rem; margin-bottom: .4rem; }
.join-form > p { color: var(--slate-soft); margin-bottom: 1.5rem; }
.join-form .btn { margin-top: 1.5rem; }
.privacy-note { margin-top: 1rem; font-family: var(--sans); font-size: .85rem; color: var(--slate-soft); }
@media (max-width: 860px) {
  .join { grid-template-columns: 1fr; }
  .join-intro { min-height: 0; padding-bottom: 7rem; }
  .join-intro ul { display: none; }
}

/* ---------- Panel list ---------- */
.greeting { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; margin-bottom: 2rem; }
.greeting h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); }
.greeting p { margin: .5rem 0 0; color: var(--slate-soft); }
.announcement {
  display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 2rem; padding: 1rem 1.2rem;
  background: var(--wheat-soft); border-radius: var(--radius); font-family: var(--sans); color: var(--deep);
}
.announcement svg { width: 1.4rem; height: 1.4rem; flex: none; margin-top: .1rem; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.panel-tile {
  position: relative; display: flex; flex-direction: column; gap: .6rem;
  padding: clamp(1.25rem, 3vw, 2rem); border-radius: var(--radius-lg);
  background: var(--card); box-shadow: 0 0 0 1px var(--line);
  text-decoration: none; color: inherit;
  transition: box-shadow .3s var(--ease), transform .3s var(--ease);
}
.panel-tile:hover { box-shadow: 0 0 0 1.5px var(--olive), var(--shadow); transform: translateY(-2px); }
.panel-tile .tile-top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.panel-tile .when { font-family: var(--sans); font-size: .92rem; color: var(--slate-soft); }
.panel-tile h2 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); line-height: 1.1; margin-top: .3rem; }
.panel-tile .specialty { font-family: var(--sans); font-weight: 500; color: var(--olive-ink); font-size: .98rem; }
.panel-tile .summary { color: var(--slate-soft); margin: .2rem 0 0; }
.panel-tile .tile-foot { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: auto; padding-top: 1rem; font-family: var(--sans); font-size: .88rem; color: var(--slate-soft); }
.panel-tile .tile-foot span { display: inline-flex; gap: .4rem; align-items: center; }
.panel-tile .tile-foot svg { width: 1rem; height: 1rem; }
.panel-tile .open { margin-left: auto; font-weight: 600; color: var(--deep); }
.panel-tile--live { grid-column: 1 / -1; background: var(--deep); color: var(--paper); box-shadow: none; }
.panel-tile--live h2 { color: var(--paper); font-size: clamp(1.8rem, 3.4vw, 2.6rem); max-width: 22ch; }
.panel-tile--live .when, .panel-tile--live .summary, .panel-tile--live .tile-foot { color: rgba(244, 243, 234, .75); }
.panel-tile--live .specialty { color: var(--wheat-soft); }
.panel-tile--live .open { color: var(--wheat-soft); }
.panel-tile--live .summary { max-width: 62ch; }
.panel-tile--live:hover { box-shadow: 0 0 0 1.5px var(--wheat), var(--shadow); }
.panel-tile--closed { background: transparent; }
@media (max-width: 760px) { .panel-grid { grid-template-columns: 1fr; } }
.empty { padding: 3rem 1.5rem; text-align: center; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); font-family: var(--sans); color: var(--slate-soft); }
.empty h2 { font-size: 1.5rem; margin-bottom: .5rem; }

/* ---------- Panel page ---------- */
.back { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--sans); font-weight: 600; font-size: .95rem; text-decoration: none; color: var(--olive-ink); margin-bottom: 1.25rem; }
.back svg { width: 1.1rem; height: 1.1rem; }
.panel-head { display: grid; gap: .6rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.panel-head .tile-top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-family: var(--sans); font-size: .92rem; color: var(--slate-soft); }
.panel-head h1 { font-size: clamp(2rem, 4.2vw, 3.3rem); max-width: 24ch; }
.panel-head .specialty { font-family: var(--sans); font-weight: 500; font-size: 1.05rem; color: var(--olive-ink); }
.panelists { margin-top: .4rem; font-family: var(--sans); font-size: .92rem; }
.panelists summary { cursor: pointer; font-weight: 600; color: var(--deep); width: fit-content; }
.panelists ul { list-style: none; margin-top: .75rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.panelists li { padding: .6rem .8rem; background: var(--paper-2); border-radius: 10px; line-height: 1.35; }
.panelists li b { display: block; color: var(--deep); }
.panelists li span { color: var(--slate-soft); }

.panel-layout { display: grid; grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr); gap: clamp(1.5rem, 3.5vw, 3.5rem); align-items: start; }
.tabs { display: flex; gap: .3rem; padding: .3rem; background: var(--paper-2); border-radius: 999px; margin-bottom: 1rem; }
.tabs button {
  flex: 1; min-height: 42px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: .95rem; color: var(--slate-soft);
  display: inline-flex; justify-content: center; align-items: center; gap: .4rem;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--deep); box-shadow: 0 1px 3px rgba(54, 59, 40, .18); }
.tabs .count { min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: var(--deep); color: var(--paper); font-size: .75rem; display: inline-grid; place-items: center; }
.tab-case { display: none; }
.side { position: sticky; top: 84px; }
.side-card { background: var(--card); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.5rem); box-shadow: 0 0 0 1px var(--line); }

@media (max-width: 960px) {
  .panel-layout { grid-template-columns: 1fr; }
  .tab-case { display: inline-flex; }
  .mobile-tabs { position: sticky; top: 64px; z-index: 20; background: var(--paper); padding: .5rem 0; margin: 0 0 .5rem; }
  .side { position: static; }
  .panel-layout[data-tab="case"] .side-card { display: none; }
  .panel-layout:not([data-tab="case"]) .case { display: none; }
  .side-card { box-shadow: none; background: transparent; padding: 0; }
}
@media (min-width: 961px) { .mobile-tabs { display: none; } }
@media (max-width: 960px) { .desktop-tabs { display: none; } }

/* Case */
.case-title { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 1.5rem; }
.case-note { font-family: var(--sans); font-size: .85rem; color: var(--slate-soft); margin: -1rem 0 1.5rem; }
.case-section { padding: 1.4rem 0; border-top: 1px solid var(--line); }
.case-section h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: .6rem; color: var(--olive-ink); }
.case-section p, .case-section li { font-size: 1.1rem; line-height: 1.7; max-width: 68ch; }
.case-section ul { padding-left: 1.2rem; display: grid; gap: .2rem; }
.case-section li::marker { color: var(--olive); }
.case-section strong { font-weight: 650; color: var(--deep); }
.case-section.is-new { animation: reveal 2.4s var(--ease); border-radius: 12px; }
@keyframes reveal {
  0% { background: var(--wheat-soft); box-shadow: 0 0 0 12px var(--wheat-soft); }
  100% { background: transparent; box-shadow: 0 0 0 12px transparent; }
}
.case-pending {
  display: flex; gap: .8rem; align-items: center; margin-top: .5rem; padding: 1rem 1.2rem;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  font-family: var(--sans); font-size: .95rem; color: var(--slate-soft);
}
.case-pending i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--olive); animation: breathe 2s infinite; flex: none; }
@keyframes breathe { 50% { opacity: .25; } }

/* Notes */
.note-area { min-height: 46vh; font-size: 1.08rem; background: var(--paper); }
.save-state { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .6rem; font-family: var(--sans); font-size: .85rem; color: var(--slate-soft); }
.save-state .bad { color: var(--alert); }
.save-state a { color: var(--olive-ink); font-weight: 600; }

/* Questions */
.ask-form .textarea { min-height: 120px; background: var(--paper); }
.ask-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; margin-top: .9rem; }
.ask-help { font-family: var(--sans); font-size: .82rem; color: var(--slate-soft); margin-top: .6rem; }
.closed-note { padding: 1rem; border-radius: var(--radius); background: var(--paper-2); font-family: var(--sans); color: var(--slate-soft); }
.my-questions { margin-top: 1.5rem; }
.my-questions h3 { font-size: 1.05rem; margin-bottom: .6rem; }
.my-questions ul { list-style: none; display: grid; gap: .6rem; }
.my-questions li { padding: .85rem 1rem; border-radius: 12px; background: var(--paper-2); }
.my-questions li p { margin: 0 0 .5rem; }
.my-questions .q-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-family: var(--sans); font-size: .82rem; color: var(--slate-soft); }

/* ---------- My notes ---------- */
.notes-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.25rem 2rem; padding-bottom: 1.5rem; border-bottom: 2px solid var(--deep); margin-bottom: 2rem; }
.notes-head h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); }
.notes-head .who { margin-top: .5rem; font-family: var(--sans); color: var(--slate-soft); }
.notes-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.print-brand { display: none; }
.note-block { padding: 1.75rem 0; border-bottom: 1px solid var(--line); break-inside: avoid-page; }
.note-block h2 { font-size: 1.55rem; }
.note-block .sub { font-family: var(--sans); font-size: .92rem; color: var(--slate-soft); margin: .3rem 0 1rem; }
.note-body { white-space: pre-wrap; font-size: 1.08rem; line-height: 1.7; max-width: 72ch; }
.note-block .asked { margin-top: 1rem; padding-left: 1rem; border-left: 3px solid var(--disc); }
.note-block .asked h3 { font-size: .95rem; margin-bottom: .3rem; }
.note-block .asked p { margin: 0 0 .3rem; font-style: italic; color: var(--slate-soft); }
.note-edit { font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--olive-ink); }
.general-notes .textarea { min-height: 180px; }

@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  body::after { display: none; }
  .app-header, .notes-actions, .no-print, .toast-stack, .save-state { display: none !important; }
  .app-main { padding: 0; min-height: 0; }
  .wrap { padding: 0; max-width: none; }
  .print-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-family: var(--sans); color: var(--olive-ink); font-size: 10pt; }
  .print-brand img { width: 46px; height: 46px; }
  .notes-head { border-bottom-width: 1.5pt; }
  .general-notes .textarea { display: none; }
  .general-notes .print-only { display: block !important; }
  a { text-decoration: none; }
}
