/* Belcanto Lab V37: Fach guidance and derivation */
.fach-derivation-card{border-top:3px solid var(--blue,#1d73b7)}
.fach-derivation-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:14px 0 16px}
.fach-derivation-summary>div,.fach-derivation-grid>article{border:1px solid var(--line,rgba(130,145,165,.35));border-radius:14px;padding:14px;background:rgba(255,255,255,.035)}
.fach-derivation-summary small,.fach-derivation-grid small{display:block;font-size:.72rem;letter-spacing:.08em;font-weight:800;opacity:.75}
.fach-derivation-summary strong{display:block;font-size:1.08rem;margin:5px 0}
.fach-derivation-summary p,.fach-derivation-grid p{margin:6px 0 0;line-height:1.55}
.fach-derivation-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-bottom:14px}
.fach-derivation-grid article strong{display:block;min-height:2.6em;margin:5px 0}
.fach-derivation-grid article>b{display:block;font-size:1.35rem;color:var(--blue,#4aa3df)}
.fach-candidate em{display:block;font-style:normal;margin-top:6px;line-height:1.45;opacity:.9}
.fach-candidate-blocks{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;margin-top:10px}
.fach-candidate-blocks i{font-style:normal;border:1px solid var(--line,rgba(130,145,165,.35));border-radius:9px;padding:7px;display:grid;gap:2px}
.fach-candidate-blocks i span{font-size:.68rem;line-height:1.2}
.fach-candidate-blocks i b{font-size:.96rem}
.fach-candidate-blocks i small{font-size:.62rem;opacity:.7}
html[data-theme="light"] .fach-derivation-card{background:#fff!important;border-color:#d6d6d6!important;border-top-color:#0078d4!important}
html[data-theme="light"] .fach-derivation-summary>div,html[data-theme="light"] .fach-derivation-grid>article,html[data-theme="light"] .fach-candidate-blocks i{background:#f7f7f7!important;border-color:#d6d6d6!important;color:#1a1a1a!important}
html[data-theme="light"] .fach-derivation-card :where(p,small,span,em){color:#4b4b4b!important;-webkit-text-fill-color:#4b4b4b!important;opacity:1!important}
html[data-theme="light"] .fach-derivation-card :where(h4,strong,b){color:#1a1a1a!important;-webkit-text-fill-color:#1a1a1a!important}
html[data-theme="light"] .fach-derivation-grid article>b{color:#003e75!important;-webkit-text-fill-color:#003e75!important}
@media(max-width:1050px){.fach-derivation-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.fach-candidate-blocks{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.fach-derivation-summary,.fach-derivation-grid,.fach-candidate-blocks{grid-template-columns:1fr}.fach-derivation-grid article strong{min-height:auto}}
@media(forced-colors:active){.fach-derivation-summary>div,.fach-derivation-grid>article,.fach-candidate-blocks i{forced-color-adjust:auto;border:1px solid CanvasText}}

/* Belcanto Lab V37.2: compact, stable Fach layout */
#fachProfile .fach-layout{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-auto-flow:row!important;
  gap:14px!important;
  align-items:start!important;
  margin-top:14px!important;
}
#fachProfile .fach-layout>.card{
  grid-column:1!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  align-self:start!important;
  box-sizing:border-box!important;
}
#fachProfile .fach-primary-card{order:10!important}
#fachProfile .fach-description-card{order:20!important}
#fachProfile .fach-derivation-card{order:30!important}
#fachProfile .fach-evidence-card{order:40!important}
#fachProfile .fach-suggestion-card{order:50!important}
#fachProfile .fach-formula-card{order:60!important}
#fachProfile .fach-protocol-card{order:70!important}
#fachProfile :where(.fach-primary-card,.fach-description-card,.fach-derivation-card,.fach-evidence-card,.fach-suggestion-card,.fach-formula-card,.fach-protocol-card){padding:18px!important}
#fachProfile .fach-card-head{margin-bottom:14px!important;align-items:flex-start!important}
#fachProfile .fach-card-head>div{min-width:0;max-width:1040px}
#fachProfile .fach-card-head h4{line-height:1.28}
#fachProfile .fach-card-head p{max-width:980px}
#fachProfile .fach-primary-score{padding:15px!important;gap:14px!important}
#fachProfile .fach-candidate-list{gap:8px!important;margin:12px 0!important}
#fachProfile .fach-candidate{grid-template-columns:30px minmax(0,1fr) auto!important;gap:10px!important;padding:11px 12px!important;align-items:start!important}
#fachProfile .fach-candidate>span{width:28px!important;height:28px!important}
#fachProfile .fach-candidate>div{min-width:0}
#fachProfile .fach-candidate>div>strong{line-height:1.3}
#fachProfile .fach-candidate>div>small,#fachProfile .fach-candidate em{overflow-wrap:anywhere}
#fachProfile .fach-candidate-blocks{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:6px!important;margin-top:8px!important}
#fachProfile .fach-candidate-blocks i{min-width:0;padding:6px!important}
#fachProfile .fach-candidate-blocks i span{min-height:2.4em}
#fachProfile .fach-description-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important}
#fachProfile .fach-description-item{height:100%;padding:13px!important;box-sizing:border-box}
#fachProfile .fach-description-item p{line-height:1.48!important}
#fachProfile .fach-derivation-summary{gap:10px!important;margin:10px 0 12px!important}
#fachProfile .fach-derivation-summary>div,#fachProfile .fach-derivation-grid>article{padding:12px!important}
#fachProfile .fach-derivation-grid{gap:8px!important;margin-bottom:12px!important}
#fachProfile .fach-derivation-grid article strong{min-height:2.45em!important;line-height:1.25}
#fachProfile .fach-derivation-grid p{line-height:1.48!important;font-size:.9rem}
#fachProfile .fach-evidence-columns{gap:14px!important}
#fachProfile .fach-evidence-columns>div{min-width:0}
#fachProfile .fach-practice-grid{gap:10px!important;margin-top:12px!important}
#fachProfile .fach-practice-card{height:100%;padding:13px!important;box-sizing:border-box}
#fachProfile .fach-formula-layout{gap:16px!important}
#fachProfile .fach-protocol-grid{gap:10px!important}
#fachProfile .fach-protocol-step{padding:13px!important}
#fachProfile .source-box,#fachProfile .report-disclaimer{margin-top:12px}
#fachProfile .card,#fachProfile .fach-candidate,#fachProfile .fach-description-item,#fachProfile .fach-practice-card,#fachProfile .fach-protocol-step{animation:none!important;transition:none!important}
@media(max-width:1100px){
  #fachProfile .fach-description-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #fachProfile .fach-derivation-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  #fachProfile .fach-derivation-grid>article:nth-last-child(-n+2){grid-column:auto}
  #fachProfile .fach-protocol-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  #fachProfile .fach-protocol-step:last-child{grid-column:auto!important}
}
@media(max-width:760px){
  #fachProfile .fach-layout{gap:10px!important;margin-top:10px!important}
  #fachProfile :where(.fach-primary-card,.fach-description-card,.fach-derivation-card,.fach-evidence-card,.fach-suggestion-card,.fach-formula-card,.fach-protocol-card){padding:14px!important}
  #fachProfile .fach-description-grid,#fachProfile .fach-derivation-summary,#fachProfile .fach-derivation-grid,#fachProfile .fach-evidence-columns,#fachProfile .fach-practice-grid,#fachProfile .fach-formula-layout,#fachProfile .fach-protocol-grid{grid-template-columns:1fr!important}
  #fachProfile .fach-candidate{grid-template-columns:28px minmax(0,1fr)!important}
  #fachProfile .fach-candidate>b{grid-column:2;justify-self:start}
  #fachProfile .fach-candidate-blocks{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #fachProfile .fach-candidate-blocks i span{min-height:auto}
  #fachProfile .fach-card-head{gap:10px!important}
}
@media(forced-colors:active){
  #fachProfile .fach-layout>.card{forced-color-adjust:auto}
}


/* Belcanto Lab V37.4: suggestion card redesign */
#fachProfile .fach-suggestion-card{position:relative;overflow:hidden}
#fachProfile .fach-suggestion-card .fach-card-head{margin-bottom:10px!important}
#fachProfile #fachRecommendation{margin-top:2px}
#fachProfile .fach-recommendation-banner{display:grid;gap:8px;padding:14px 16px;border:1px solid rgba(130,145,165,.34);border-left:4px solid var(--gold,#e8ba5a);border-radius:14px;background:linear-gradient(135deg,rgba(255,255,255,.06),rgba(255,255,255,.025));box-shadow:0 8px 24px rgba(0,0,0,.12)}
#fachProfile .fach-recommendation-banner small{display:block;font-size:.72rem;letter-spacing:.08em;font-weight:800;opacity:.8}
#fachProfile .fach-recommendation-banner strong{display:block;font-size:1rem;line-height:1.35}
#fachProfile .fach-recommendation-banner p{margin:0;line-height:1.58;max-width:78ch}
#fachProfile .fach-practice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important;margin-top:14px!important;align-items:stretch}
#fachProfile .fach-practice-card{display:grid;gap:10px;height:100%;padding:16px!important;border:1px solid rgba(130,145,165,.32);border-radius:16px;background:rgba(255,255,255,.04);box-shadow:0 6px 18px rgba(0,0,0,.12);align-content:start}
#fachProfile .fach-practice-card:hover{transform:translateY(-1px)}
#fachProfile .fach-practice-header{display:grid;gap:5px;padding-bottom:10px;border-bottom:1px solid rgba(130,145,165,.22)}
#fachProfile .fach-practice-header small{display:block;font-size:.72rem;letter-spacing:.08em;font-weight:800;opacity:.78}
#fachProfile .fach-practice-header strong{display:block;line-height:1.28;font-size:1.02rem}
#fachProfile .fach-practice-card p{margin:0;line-height:1.6}
#fachProfile .fach-practice-card em{margin-top:auto;display:block;font-style:normal;font-size:.88rem;line-height:1.5;opacity:.86;color:inherit}
#fachProfile .fach-suggestion-note{margin-top:12px;padding:12px 14px;border-radius:12px;border:1px solid rgba(130,145,165,.28);background:rgba(255,255,255,.03);font-size:.9rem;line-height:1.55}
#fachProfile .fach-suggestion-card .report-disclaimer{color:rgba(235,240,246,.9)!important;-webkit-text-fill-color:rgba(235,240,246,.9)!important}
html[data-theme="light"] #fachProfile .fach-recommendation-banner{background:linear-gradient(135deg,#fff9eb,#fff);border-color:#e4d7b0!important;border-left-color:#b07a00!important;box-shadow:none}
html[data-theme="light"] #fachProfile .fach-recommendation-banner :where(p,small){color:#4b4b4b!important;-webkit-text-fill-color:#4b4b4b!important}
html[data-theme="light"] #fachProfile .fach-recommendation-banner strong{color:#1a1a1a!important;-webkit-text-fill-color:#1a1a1a!important}
html[data-theme="light"] #fachProfile .fach-practice-card{background:#f8fbff!important;border-color:#d6d6d6!important;box-shadow:none}
html[data-theme="light"] #fachProfile .fach-practice-header{border-bottom-color:#dfe7f0!important}
html[data-theme="light"] #fachProfile .fach-practice-card :where(p,small,em){color:#4b4b4b!important;-webkit-text-fill-color:#4b4b4b!important;opacity:1!important}
html[data-theme="light"] #fachProfile .fach-practice-card strong{color:#1a1a1a!important;-webkit-text-fill-color:#1a1a1a!important}
html[data-theme="light"] #fachProfile .fach-suggestion-note{background:#f7f7f7!important;border-color:#d6d6d6!important;color:#4b4b4b!important;-webkit-text-fill-color:#4b4b4b!important}
@media(max-width:1100px){#fachProfile .fach-practice-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:760px){#fachProfile .fach-recommendation-banner{padding:12px 13px!important}#fachProfile .fach-practice-grid{grid-template-columns:1fr!important;gap:10px!important}#fachProfile .fach-practice-card{padding:14px!important}#fachProfile .fach-suggestion-note{padding:11px 12px!important}}
@media(forced-colors:active){#fachProfile .fach-recommendation-banner,#fachProfile .fach-practice-card,#fachProfile .fach-suggestion-note{forced-color-adjust:auto;border:1px solid CanvasText;background:Canvas;color:CanvasText;box-shadow:none}}
