/* Professional consultant layer: saved profiles, personalised synthesis and PDF export. */

/* Calm entry flow: choose the calculation, enter data, then reveal the report. */
#mode-select {
  align-items:stretch;
  padding:6px;
  border:1px solid rgba(176,136,240,.16);
  border-radius:14px;
  background:linear-gradient(135deg,rgba(176,136,240,.045),rgba(92,222,200,.018));
}
.mode-choice { display:grid; grid-template-columns:1fr 1fr; gap:5px; min-width:min(430px,70%); }
.mode-choice .mnav-btn {
  min-height:42px;
  border-color:transparent;
  border-radius:9px;
  background:transparent;
  color:rgba(201,184,240,.72);
  font-size:10px;
  letter-spacing:.045em;
}
.mode-choice .mnav-btn.active {
  border-color:rgba(176,136,240,.55);
  background:linear-gradient(135deg,rgba(176,136,240,.21),rgba(176,136,240,.09));
  color:#eee6ff;
  box-shadow:inset 0 1px rgba(255,255,255,.04),0 8px 24px rgba(3,1,20,.16);
}
.mode-choice .mnav-btn:focus-visible,
.result-action:focus-visible,
.result-more summary:focus-visible { outline:2px solid var(--teal); outline-offset:2px; }

#module-nav {
  order:7;
  display:none;
  flex-wrap:nowrap;
  gap:14px;
  align-items:center;
  margin:12px 0 0;
  padding:13px 14px;
  border:1px solid rgba(92,222,200,.20);
  border-radius:14px;
  background:
    radial-gradient(circle at 7% 50%,rgba(92,222,200,.075),transparent 24%),
    linear-gradient(135deg,rgba(15,9,48,.92),rgba(8,5,31,.90));
}
body.has-calculation #module-nav { display:flex; }
.result-actions-intro { flex:0 0 auto; min-width:126px; padding-right:13px; border-right:1px solid rgba(176,136,240,.16); }
.result-actions-intro span { display:block; color:var(--teal); font-size:7px; letter-spacing:.16em; text-transform:uppercase; }
.result-actions-intro b { display:block; margin-top:4px; color:#eee8ff; font:600 11px Cinzel,serif; }
.result-actions-primary { display:flex; flex:1 1 auto; gap:7px; }
.result-action,
.result-more summary,
.result-more button {
  min-height:36px;
  padding:8px 12px;
  border:1px solid rgba(176,136,240,.22);
  border-radius:9px;
  color:var(--lav);
  background:rgba(176,136,240,.055);
  font:600 9px Raleway,sans-serif;
  letter-spacing:.035em;
  cursor:pointer;
  transition:border-color .15s,background .15s,color .15s,transform .15s;
}
.result-action:hover,.result-more summary:hover,.result-more button:hover { transform:translateY(-1px); border-color:rgba(176,136,240,.5); background:rgba(176,136,240,.12); }
.result-action-primary { border-color:rgba(92,222,200,.38); color:var(--teal); background:rgba(92,222,200,.055); }
#export-btn.result-action-gold { border-color:rgba(212,175,110,.34); color:var(--goldb); background:rgba(212,175,110,.07); }
.result-more { position:relative; flex:0 0 auto; }
.result-more summary { display:grid; place-items:center; min-width:56px; list-style:none; user-select:none; }
.result-more summary::-webkit-details-marker { display:none; }
.result-more[open] summary { border-color:rgba(212,175,110,.34); color:var(--goldb); }
.result-more > div {
  position:absolute; right:0; top:calc(100% + 7px); z-index:35; min-width:168px; padding:6px;
  border:1px solid rgba(176,136,240,.24); border-radius:10px;
  background:#100a31; box-shadow:0 18px 42px rgba(0,0,0,.36);
}
.result-more button { width:100%; text-align:left; }

body:not(.has-calculation) #annual-forecast-control,
body:not(.has-calculation) #full-reading,
body:not(.has-calculation) #matrix-wrap,
body:not(.has-calculation) #legend,
body:not(.has-calculation) #forecast-banner,
body:not(.has-calculation) #derived { display:none !important; }
.consultant-mode #status-info-btn,
.consultant-mode .interp-source-note,
.consultant-mode .export-note,
.consultant-mode .money-source-note,
.consultant-mode .edit-btn { display:none !important; }
#annual-forecast-control { order:8; }
#full-reading { order:9; }
#matrix-wrap { order:10; }
#legend { order:11; }
#forecast-banner { order:12; }
#derived { order:13; }

.fi select {
  width: 100%;
  min-height: 38px;
  padding: 8px 30px 8px 11px;
  border: 1px solid rgba(212,175,110,.2);
  border-radius: 7px;
  outline: none;
  appearance: none;
  color: var(--goldb);
  background:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%) calc(100% - 15px) 16px/5px 5px no-repeat,
    linear-gradient(135deg, var(--gold) 50%, transparent 50%) calc(100% - 10px) 16px/5px 5px no-repeat,
    rgba(255,255,255,.05);
  font: 500 11px Raleway, sans-serif;
}
.fi select:focus { border-color: var(--gold); }

#input-bar-single {
  grid-template-columns:minmax(180px,2fr) minmax(112px,1.15fr) repeat(3,minmax(74px,1fr)) auto;
}
.compat-input-row {
  display:grid;
  grid-template-columns:minmax(180px,2fr) minmax(112px,1.15fr) repeat(3,minmax(74px,1fr));
  gap:10px;
  align-items:end;
  width:100%;
}
.compat-input-row.with-action { grid-template-columns:minmax(180px,2fr) minmax(112px,1.15fr) repeat(3,minmax(74px,1fr)) auto; }

.saved-calculations-trigger { margin-left:auto; border-color:rgba(92,222,200,.35); color:var(--teal); }
.saved-calculations-trigger span {
  display:inline-grid; place-items:center; min-width:18px; height:18px; margin-left:5px;
  border-radius:20px; color:#071a1a; background:var(--teal); font-size:8px;
}

/* PDF constellation chooser: every selected chapter becomes a lit star. */
#pdf-sections-modal {
  position:fixed; inset:0; z-index:145; display:none; place-items:center; padding:20px;
  background:rgba(2,1,12,.76); backdrop-filter:blur(8px);
}
#pdf-sections-modal.open { display:grid; }
.pdf-sections-shell {
  width:min(760px,100%); max-height:min(88dvh,820px); overflow:auto;
  border:1px solid rgba(92,222,200,.27); border-radius:18px;
  background:
    radial-gradient(circle at 88% 3%,rgba(92,222,200,.10),transparent 27%),
    radial-gradient(circle at 5% 92%,rgba(176,136,240,.13),transparent 30%),
    linear-gradient(155deg,#130c38,#07041f 72%);
  box-shadow:0 30px 100px rgba(0,0,0,.55); color:var(--lav);
}
.pdf-sections-head { position:static; display:flex; justify-content:space-between; gap:18px; padding:22px 22px 17px; border-bottom:1px solid rgba(212,175,110,.16); background:none; text-align:left; }
.pdf-sections-eyebrow { color:var(--teal); font-size:8px; letter-spacing:.17em; text-transform:uppercase; }
.pdf-sections-head h2 { margin-top:5px; color:var(--goldb); font:600 23px Cinzel,serif; }
.pdf-sections-head p { max-width:570px; margin-top:6px; color:var(--muted); font-size:10px; line-height:1.5; }
#pdf-sections-close { display:grid; place-items:center; flex:0 0 auto; width:35px; height:35px; border:1px solid rgba(176,136,240,.28); border-radius:50%; color:var(--lav); background:transparent; font-size:19px; cursor:pointer; }
.pdf-presets { display:flex; flex-wrap:wrap; gap:7px; padding:16px 22px 0; }
.pdf-presets button { min-height:33px; padding:7px 11px; border:1px solid rgba(176,136,240,.22); border-radius:20px; color:var(--lav); background:rgba(176,136,240,.05); font:600 9px Raleway,sans-serif; cursor:pointer; }
.pdf-presets button:hover,.pdf-presets button.active { border-color:rgba(92,222,200,.45); color:var(--teal); background:rgba(92,222,200,.07); }
.pdf-catalog-note { margin:12px 22px 0; padding:10px 12px; border-left:2px solid rgba(212,175,110,.58); background:rgba(212,175,110,.04); color:rgba(201,184,240,.72); font-size:9px; line-height:1.55; }
#pdf-sections-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; padding:15px 22px 20px; border:0; }
.pdf-section-option { position:relative; display:grid; grid-template-columns:29px minmax(0,1fr); gap:9px; align-items:center; min-height:58px; padding:10px 11px; border:1px solid rgba(176,136,240,.15); border-radius:11px; background:rgba(255,255,255,.022); cursor:pointer; transition:border-color .15s,background .15s,transform .15s; }
.pdf-section-option:hover { transform:translateY(-1px); border-color:rgba(176,136,240,.4); }
#pdf-sections-list.full-mode .pdf-section-option { cursor:default; }
#pdf-sections-list.full-mode .pdf-section-option:hover { transform:none; border-color:rgba(92,222,200,.34); }
.pdf-section-option:has(input:checked) { border-color:rgba(92,222,200,.34); background:linear-gradient(135deg,rgba(92,222,200,.06),rgba(176,136,240,.035)); }
.pdf-section-option input { position:absolute; opacity:0; pointer-events:none; }
.pdf-section-star { display:grid; place-items:center; width:29px; height:29px; border:1px solid rgba(176,136,240,.3); border-radius:50%; color:rgba(201,184,240,.35); background:rgba(7,4,28,.62); font-size:11px; transition:all .15s; }
.pdf-section-option input:checked + .pdf-section-star { border-color:var(--teal); color:#071a1a; background:var(--teal); box-shadow:0 0 20px rgba(92,222,200,.22); }
.pdf-section-option input:focus-visible + .pdf-section-star { outline:2px solid var(--goldb); outline-offset:2px; }
.pdf-section-copy { min-width:0; }
.pdf-section-copy b { display:block; color:#f1ebff; font:600 10px Cinzel,serif; line-height:1.3; }
.pdf-section-copy small { display:block; margin-top:4px; color:var(--muted); font-size:8px; line-height:1.35; }
.pdf-sections-footer { position:sticky; bottom:0; display:flex; justify-content:space-between; align-items:center; gap:15px; padding:14px 22px; border-top:1px solid rgba(212,175,110,.16); background:rgba(8,4,31,.96); backdrop-filter:blur(8px); }
#pdf-selected-count { color:var(--teal); font-size:9px; }
.pdf-sections-actions { display:flex; gap:8px; }
.pdf-sections-actions button { min-height:36px; padding:8px 14px; border:1px solid rgba(176,136,240,.24); border-radius:9px; color:var(--lav); background:transparent; font:600 9px Raleway,sans-serif; cursor:pointer; }
#pdf-sections-download { border-color:transparent; color:#08041f; background:linear-gradient(135deg,#b98535,#e0bd77); }
#pdf-sections-download:disabled { opacity:.4; cursor:not-allowed; }

#saved-calculations-modal {
  position:fixed; inset:0; z-index:115; display:none; justify-content:flex-end;
  background:rgba(2,1,12,.67); backdrop-filter:blur(6px);
}
#saved-calculations-modal.open { display:flex; }
.saved-calculations-shell {
  width:min(560px,100%); height:100dvh; overflow-y:auto; padding:24px;
  border-left:1px solid rgba(92,222,200,.28);
  background:
    radial-gradient(circle at 82% 8%,rgba(92,222,200,.11),transparent 28%),
    radial-gradient(circle at 8% 74%,rgba(176,136,240,.13),transparent 35%),
    linear-gradient(160deg,#110b32,#06031c 72%);
  box-shadow:-24px 0 70px rgba(0,0,0,.42);
}
.saved-calculations-head { position:static; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:0 0 18px; border-bottom:1px solid rgba(212,175,110,.18); background:none; text-align:left; }
.saved-calculations-eyebrow { color:var(--teal); font-size:8px; letter-spacing:.17em; text-transform:uppercase; }
.saved-calculations-head h2 { margin-top:5px; color:var(--goldb); font:600 23px Cinzel,serif; letter-spacing:.05em; }
.saved-calculations-head p { margin-top:6px; color:var(--muted); font-size:10px; }
#saved-calculations-close { display:grid; place-items:center; flex:0 0 auto; width:34px; height:34px; border:1px solid rgba(176,136,240,.26); border-radius:50%; color:var(--lav); background:transparent; font-size:19px; cursor:pointer; }
#saved-calculations-list { display:grid; gap:10px; margin-top:18px; }
#saved-calculations-empty { display:none; margin:22px 0; padding:26px 18px; border:1px dashed rgba(176,136,240,.22); border-radius:12px; color:var(--muted); text-align:center; font-size:11px; line-height:1.6; }
#saved-calculations-empty.visible { display:block; }
#saved-calculations-empty strong { display:block; margin-bottom:5px; color:var(--goldb); font:600 15px Cinzel,serif; }
.saved-profile {
  display:grid; grid-template-columns:45px minmax(0,1fr) auto; gap:12px; align-items:center;
  padding:13px; border:1px solid rgba(176,136,240,.17); border-radius:12px;
  background:linear-gradient(135deg,rgba(176,136,240,.06),rgba(255,255,255,.018));
}
.saved-profile.active { border-color:rgba(212,175,110,.44); box-shadow:inset 3px 0 var(--gold); }
.saved-profile-orbit { display:grid; place-items:center; width:45px; height:45px; border:1px solid rgba(92,222,200,.45); border-radius:50%; color:var(--teal); background:rgba(92,222,200,.06); font:700 16px Cinzel,serif; }
.saved-profile-main { min-width:0; }
.saved-profile-main b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#f2ebff; font:600 12px Cinzel,serif; }
.saved-profile-main span { display:block; margin-top:4px; color:var(--muted); font-size:9px; }
.saved-profile-actions { display:flex; gap:5px; }
.saved-profile-actions button { min-height:30px; padding:6px 9px; border:1px solid rgba(176,136,240,.2); border-radius:7px; color:var(--lav); background:transparent; font:600 8px Raleway,sans-serif; cursor:pointer; }
.saved-profile-actions .saved-open { border-color:rgba(92,222,200,.35); color:var(--teal); }
.saved-profile-actions .saved-remove:hover { border-color:rgba(255,111,134,.4); color:#ff9caf; }

/* Constellation synthesis: the memorable connective layer of the report. */
.synthesis-block {
  position:relative; overflow:hidden; margin-top:14px; padding:15px;
  border:1px solid rgba(92,222,200,.21); border-radius:12px;
  background:linear-gradient(145deg,rgba(92,222,200,.055),rgba(176,136,240,.035));
}
.synthesis-block::after {
  content:""; position:absolute; width:130px; height:130px; right:-70px; top:-72px;
  border:1px solid rgba(212,175,110,.13); border-radius:50%; box-shadow:0 0 0 18px rgba(176,136,240,.022),0 0 0 38px rgba(92,222,200,.018);
}
.synthesis-label { position:relative; z-index:1; color:var(--teal); font-size:8px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; }
.synthesis-title { position:relative; z-index:1; margin-top:5px; color:#f4edff; font:600 14px Cinzel,serif; }
.synthesis-constellation { position:relative; z-index:1; display:flex; align-items:flex-start; gap:0; overflow-x:auto; margin:13px 0; padding:3px 0 5px; }
.synthesis-node { position:relative; flex:0 0 92px; text-align:center; }
.synthesis-node:not(:last-child)::after { content:""; position:absolute; left:calc(50% + 25px); top:21px; width:42px; height:1px; background:linear-gradient(90deg,rgba(212,175,110,.75),rgba(92,222,200,.42)); }
.synthesis-number { display:grid; place-items:center; width:44px; height:44px; margin:0 auto 6px; border:1px solid rgba(212,175,110,.55); border-radius:50%; color:var(--goldb); background:radial-gradient(circle at 35% 30%,rgba(255,217,125,.20),rgba(13,8,46,.9) 65%); box-shadow:0 0 20px rgba(212,175,110,.12); font:700 16px Cinzel,serif; }
.synthesis-node:nth-child(even) .synthesis-number { border-color:rgba(92,222,200,.55); color:var(--teal); }
.synthesis-node b { display:block; color:rgba(242,235,255,.85); font-size:8px; line-height:1.25; }
.synthesis-node small { display:block; margin-top:3px; color:var(--muted); font-size:7px; line-height:1.3; }
.synthesis-copy { position:relative; z-index:1; color:var(--lav); font-size:10.5px; line-height:1.65; white-space:pre-wrap; }
.synthesis-points { position:relative; z-index:1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin-top:12px; }
.synthesis-point { padding:9px; border-radius:8px; background:rgba(6,3,28,.48); color:var(--muted); font-size:8.5px; line-height:1.5; }
.synthesis-point b { display:block; margin-bottom:3px; color:var(--gold); font-size:8px; letter-spacing:.07em; text-transform:uppercase; }
.reading-card.synthesis-featured { grid-column:1/-1; border-color:rgba(92,222,200,.26); background:linear-gradient(135deg,rgba(92,222,200,.055),rgba(176,136,240,.04)); }
.personal-address { margin:-2px 0 12px; color:rgba(212,175,110,.82); font-size:10px; line-height:1.55; }

.pdf-exporting { opacity:.65; cursor:wait !important; }
.pdf-export-status { position:fixed; left:50%; bottom:26px; z-index:140; transform:translateX(-50%); padding:10px 15px; border:1px solid rgba(92,222,200,.35); border-radius:30px; color:var(--teal); background:rgba(7,4,28,.96); box-shadow:0 10px 35px rgba(0,0,0,.35); font:600 9px Raleway,sans-serif; letter-spacing:.05em; }

@media (max-width:820px) {
  #module-nav { flex-wrap:wrap; }
  .result-actions-intro { width:100%; padding:0 0 10px; border-right:0; border-bottom:1px solid rgba(176,136,240,.16); }
  .result-actions-primary { flex:1 1 calc(100% - 70px); flex-wrap:wrap; }
  .result-action { flex:1 1 135px; }
  #input-bar-single { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #input-bar-single #go-btn { grid-column:1/-1; }
  .compat-input-row,.compat-input-row.with-action { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .compat-input-row.with-action #go-compat-btn { grid-column:1/-1; }
  .synthesis-points { grid-template-columns:1fr; }
}
@media (max-width:560px) {
  #mode-select { flex-wrap:wrap; padding:6px; }
  .mode-choice { width:100%; min-width:0; }
  .saved-calculations-trigger { width:100%; margin-left:0; }
  #module-nav { padding:12px; }
  .result-actions-primary { width:100%; flex-basis:100%; }
  .result-action { width:100%; flex-basis:100%; }
  .result-more { width:100%; }
  .result-more summary { width:100%; }
  .result-more > div { left:0; right:0; }
  .saved-calculations-shell { padding:18px 14px; }
  .saved-profile { grid-template-columns:42px minmax(0,1fr); }
  .saved-profile-actions { grid-column:1/-1; justify-content:flex-end; }
  #pdf-sections-modal { padding:8px; }
  .pdf-sections-shell { max-height:94dvh; border-radius:14px; }
  .pdf-sections-head { padding:18px 14px 14px; }
  .pdf-presets { padding:13px 14px 0; }
  .pdf-catalog-note { margin:10px 14px 0; }
  #pdf-sections-list { grid-template-columns:1fr; padding:13px 14px 16px; }
  .pdf-sections-footer { align-items:flex-start; flex-direction:column; padding:12px 14px; }
  .pdf-sections-actions { width:100%; }
  .pdf-sections-actions button { flex:1; }
  .synthesis-node { flex-basis:82px; }
}

@media (prefers-reduced-motion:reduce) {
  #saved-calculations-modal { backdrop-filter:none; }
}
