/* =========================================================
   GENEPRINT PORTAL — layout & components
   Calmer, more functional than the marketing site.
   ========================================================= */

.portal-shell{
  display:grid;
  grid-template-columns: 264px 1fr;
  min-height:100vh;
}
@media (max-width: 980px){
  .portal-shell{ grid-template-columns: 1fr; }
}

/* ---------- Sidebar ---------- */
.portal-sidebar{
  background: var(--navy-deep);
  color: rgba(251,249,243,0.78);
  padding: 28px 20px;
  display:flex;
  flex-direction:column;
  position: sticky;
  top:0;
  height:100vh;
}
@media (max-width: 980px){
  .portal-sidebar{
    position:fixed; inset:0 20% 0 0; z-index:200; height:100vh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .portal-sidebar.open{ transform: translateX(0); }
}
.portal-sidebar .brand{ color: var(--ivory); padding: 8px 12px 28px; font-size:18px; }
.portal-nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.portal-nav a{
  display:flex; align-items:center; gap:12px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(251,249,243,0.65);
  transition: background .15s ease, color .15s ease;
}
.portal-nav a svg{ width:18px; height:18px; opacity:.85; flex-shrink:0; }
.portal-nav a:hover{ background: rgba(251,249,243,0.06); color: var(--ivory); }
.portal-nav a.active{ background: rgba(251,249,243,0.1); color: var(--ivory); }
.portal-nav-group{ margin-top:22px; }
.portal-nav-label{ font-size:11px; text-transform:uppercase; letter-spacing:.08em; color: rgba(251,249,243,0.35); padding: 0 12px 8px; font-weight:600; }

.portal-hospital-chip{
  margin-top:auto;
  padding: 16px 14px;
  border-radius: 12px;
  background: rgba(251,249,243,0.06);
  font-size:12.5px;
}
.portal-hospital-chip .hosp-name{ color: var(--ivory); font-weight:600; font-size:13.5px; margin-bottom:4px; }
.portal-hospital-chip a{ color: var(--sage); font-weight:600; }

.sidebar-close{ display:none; }
@media (max-width: 980px){
  .sidebar-close{ display:flex; align-items:center; justify-content:center; margin-left:auto; background:none; border:none; color: var(--ivory); width:32px; height:32px; }
  .portal-sidebar .brand{ display:flex; align-items:center; }
}
.sidebar-overlay{ display:none; }
@media (max-width: 980px){
  .sidebar-overlay{ display:none; position:fixed; inset:0; background:rgba(8,25,37,0.5); z-index:190; }
  .sidebar-overlay.show{ display:block; }
}

/* ---------- Main column ---------- */
.portal-main{ min-width:0; }
.portal-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 20px 40px;
  border-bottom:1px solid var(--border-soft);
  background: var(--surface);
  position:sticky; top:0; z-index:50;
}
.portal-topbar-left{ display:flex; align-items:center; gap:16px; }
.portal-menu-toggle{ display:none; background:none; border:none; padding:6px; }
.portal-menu-toggle svg{ width:22px; height:22px; color: var(--navy); }
@media (max-width: 980px){ .portal-menu-toggle{ display:block; } }
.portal-title{ font-weight:700; font-size:16.5px; color: var(--navy); }
.portal-user{ display:flex; align-items:center; gap:12px; }
.avatar{
  width:36px; height:36px; border-radius:50%;
  background: var(--sage-mist); color: var(--sage-deep);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px;
}
.portal-content{ padding: 40px; max-width: 1120px; margin:0 auto; }
@media (max-width: 640px){ .portal-content{ padding: 24px 20px; } .portal-topbar{ padding:16px 20px; } }

/* ---------- Welcome header ---------- */
.welcome-head{
  display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:20px;
  margin-bottom: 36px;
}
.welcome-meta{ display:flex; gap:28px; flex-wrap:wrap; margin-top:14px; }
.welcome-meta div{ font-size:13px; color: var(--ink-soft); }
.welcome-meta strong{ display:block; color: var(--navy); font-size:14.5px; font-weight:600; margin-top:2px; }

/* ---------- Panel (portal card variant) ---------- */
.panel{
  background: var(--surface);
  border:1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 24px;
}
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; gap:16px; flex-wrap:wrap; }
.panel-head h3{ font-size:16px; }
.panel-head .link-arrow{ font-size:13px; }

/* ---------- Priority action rows ---------- */
.action-row{
  display:flex; align-items:center; gap:18px;
  padding: 16px 4px;
  border-top: 1px solid var(--border-soft);
}
.action-row:first-child{ border-top:none; }
.action-priority{
  width:34px; height:34px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px; flex-shrink:0;
}
.action-priority.p1{ background: var(--red-mist); color: var(--red); }
.action-priority.p2{ background: var(--amber-mist); color: var(--amber); }
.action-priority.p3{ background: var(--navy-mist); color: var(--navy); }
.action-body{ flex:1; min-width:0; }
.action-body h4{ font-size:14.5px; font-weight:600; color: var(--navy); margin-bottom:3px; }
.action-body p{ font-size:13px; color: var(--ink-soft); }
.action-due{ font-size:12px; font-weight:600; color: var(--ink-faint); white-space:nowrap; }

/* ---------- Risk cards (compact, portal) ---------- */
.risk-card{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding: 18px 20px;
  border:1px solid var(--border-soft); border-radius: var(--radius-sm);
  margin-bottom:10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.risk-card:hover{ border-color: var(--border); box-shadow: var(--shadow-sm); }
.risk-card-left{ display:flex; align-items:center; gap:14px; }
.risk-card-left h4{ font-size:14.5px; font-weight:600; color: var(--navy); }
.risk-card-left p{ font-size:12.5px; color: var(--ink-soft); margin-top:2px; }

/* ---------- Timeline ---------- */
.timeline{ position:relative; padding-left: 28px; }
.timeline::before{ content:''; position:absolute; left:6px; top:6px; bottom:6px; width:1px; background: var(--border); }
.timeline-item{ position:relative; padding-bottom: 28px; }
.timeline-item:last-child{ padding-bottom:0; }
.timeline-dot{
  position:absolute; left:-28px; top:2px;
  width:13px; height:13px; border-radius:50%;
  border:2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline-dot.done{ background: var(--sage); box-shadow:none; }
.timeline-dot.due{ background: var(--amber); box-shadow:none; }
.timeline-dot.overdue{ background: var(--red); box-shadow:none; }
.timeline-dot.planned{ background: var(--surface); }
.timeline-item h4{ font-size:14.5px; font-weight:600; color: var(--navy); }
.timeline-item p{ font-size:13px; color: var(--ink-soft); margin-top:3px; }
.timeline-item .flex{ margin-top:8px; }

/* ---------- Progress bar ---------- */
.progress-bar{ height:6px; border-radius:99px; background: var(--stone-mist); overflow:hidden; }
.progress-bar > span{ display:block; height:100%; background: var(--sage); border-radius:99px; }

/* ---------- Info tag (data provenance labels for AI assistant) ---------- */
.info-tag{
  display:inline-flex; align-items:center; gap:6px;
  font-size:11.5px; font-weight:600; letter-spacing:.02em;
  padding:4px 10px; border-radius: var(--radius-full);
  margin-bottom:8px;
}
.info-tag.report{ background: var(--navy-mist); color: var(--navy); }
.info-tag.general{ background: var(--stone-mist); color: var(--ink-soft); }
.info-tag.clinician{ background: var(--amber-mist); color: var(--amber); }
.info-tag.contact{ background: var(--red-mist); color: var(--red); }

/* ---------- Chat (Ask Geneprint) ---------- */
.chat-shell{
  display:flex; flex-direction:column;
  height: calc(100vh - 160px);
  min-height: 480px;
  background: var(--surface);
  border:1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow:hidden;
}
.chat-messages{ flex:1; overflow-y:auto; padding: 28px 32px; display:flex; flex-direction:column; gap:22px; }
.chat-msg{ display:flex; gap:14px; max-width:640px; }
.chat-msg.user{ align-self:flex-end; flex-direction:row-reverse; }
.chat-avatar{
  width:32px; height:32px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700;
}
.chat-msg.assistant .chat-avatar{ background: var(--navy); color: var(--ivory); }
.chat-msg.user .chat-avatar{ background: var(--sage-mist); color: var(--sage-deep); }
.chat-bubble{
  padding: 14px 18px; border-radius: 16px;
  font-size:14.5px; line-height:1.6;
}
.chat-msg.assistant .chat-bubble{ background: var(--ivory-deep); color: var(--ink); border-top-left-radius:4px; }
.chat-msg.user .chat-bubble{ background: var(--navy); color: var(--ivory); border-top-right-radius:4px; }
.chat-bubble p + p{ margin-top:10px; }
.chat-bubble .info-tag{ margin-bottom:10px; }
.chat-source{
  margin-top:10px; padding-top:10px; border-top:1px solid var(--border-soft);
  font-size:12px; color: var(--ink-faint);
}
.chat-suggestions{ padding: 0 32px 18px; display:flex; gap:10px; flex-wrap:wrap; }
.chat-suggestion{
  font-size:12.5px; font-weight:500; padding:8px 14px;
  border:1px solid var(--border); border-radius: var(--radius-full);
  background: var(--surface); color: var(--ink-soft);
  transition: all .15s ease;
}
.chat-suggestion:hover{ border-color: var(--navy); color: var(--navy); }
.chat-input-row{
  display:flex; gap:12px; padding: 18px 24px; border-top:1px solid var(--border-soft);
  background: var(--surface);
}
.chat-input-row input{
  flex:1; border:1px solid var(--border); border-radius: var(--radius-full);
  padding: 13px 20px; font-size:14.5px; font-family:inherit; background: var(--ivory);
  color: var(--ink);
}
.chat-input-row input:focus{ outline:none; border-color: var(--navy); }
.chat-disclaimer{ font-size:11.5px; color: var(--ink-faint); text-align:center; padding: 0 24px 14px; }
.chat-typing span{ display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--ink-faint); margin-right:3px; animation: typingBounce 1.1s infinite ease-in-out; }
.chat-typing span:nth-child(2){ animation-delay:.15s; }
.chat-typing span:nth-child(3){ animation-delay:.3s; }
@keyframes typingBounce{ 0%,60%,100%{ transform: translateY(0); opacity:.4; } 30%{ transform: translateY(-4px); opacity:1; } }

/* ---------- Tag pills for status ---------- */
.status-tag{ font-size:12px; font-weight:600; padding:4px 10px; border-radius:var(--radius-full); }

/* ---------- Anchor-jump targets (e.g. risk map "at a glance" chips) ---------- */
.portal-content [id]{ scroll-margin-top: 92px; }
a.badge{ cursor:pointer; transition: filter .15s ease, transform .15s ease; }
a.badge:hover{ filter: brightness(0.96); transform: translateY(-1px); }

/* ---------- Expand/collapse detail (technical detail, previous versions, etc.) ---------- */
.detail-panel{ display:none; margin-top:14px; padding:16px 18px; background:var(--ivory-deep); border-radius:var(--radius-sm); font-size:13.5px; color:var(--ink-soft); line-height:1.6; }
.detail-panel.open{ display:block; }
.accordion-link{ display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--navy); background:none; border:none; padding:0; margin-top:10px; }
.accordion-link svg{ width:14px; height:14px; transition: transform .2s ease; }
.accordion-link[aria-expanded="true"] svg{ transform: rotate(45deg); }

/* ---------- Section tabs (e.g. Plan page: Screening / Prevention) ---------- */
.tab-row{ display:inline-flex; gap:4px; padding:4px; background:var(--ivory-deep); border-radius: var(--radius-full); margin-bottom:28px; }
.tab-btn{ border:none; background:none; padding:10px 20px; border-radius: var(--radius-full); font-size:14px; font-weight:600; color: var(--ink-soft); transition: all .15s ease; }
.tab-btn.active{ background: var(--surface); color: var(--navy); box-shadow: var(--shadow-sm); }
.plan-section{ scroll-margin-top: 92px; }
