/* ============================================
   Reasoning GP — Medical Calculator Tool styles
   ============================================ */

.cc{
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin: 14px 0 18px;
  min-height: 620px;
}
@media (max-width: 920px){
  .cc{ grid-template-columns: 1fr; }
}

/* ----- SIDEBAR ----- */
.cc-side{
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  max-height: 82vh;
}
@media (max-width: 920px){
  .cc-side{ border-right: none; border-bottom: 1px solid var(--line); max-height: none; }
}
.cc-side-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.cc-search-wrap{
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px;
  transition: border-color .15s ease;
}
.cc-search-wrap:focus-within{ border-color: var(--teal-3); }
.cc-search-wrap svg{ width: 14px; height: 14px; color: var(--muted-2); }
.cc-search{
  flex: 1; font-family: inherit; font-size: 13px; color: var(--ink);
  background: transparent; border: none; outline: none;
}
.cc-search::placeholder{ color: var(--muted-2); }

.cc-list{
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
}

/* ----- ACCORDION ----- */
.cc-acc{ border-bottom: 1px solid var(--line); }
.cc-acc:last-child{ border-bottom: none; }
.cc-acc-h{
  display: flex; align-items: center; gap: 8px; width: 100%;
  font-family: inherit; text-align: left; cursor: pointer;
  background: transparent; border: none;
  padding: 11px 10px; color: var(--ink); border-radius: 7px;
  transition: background .12s ease;
}
.cc-acc-h:hover{ background: var(--surface); }
.cc-acc-h--static{ cursor: default; }
.cc-acc-chev{ display: inline-flex; color: var(--muted-2); transition: transform .18s ease; }
.cc-acc-chev svg{ width: 14px; height: 14px; }
.cc-acc.is-open > .cc-acc-h .cc-acc-chev{ transform: rotate(90deg); color: var(--rust); }
.cc-acc-t{
  flex: 1; font-size: 13px; font-weight: 700; letter-spacing: .01em; line-height: 1.2;
}
.cc-acc.is-open > .cc-acc-h .cc-acc-t{ color: var(--rust); }
.cc-acc-n{
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.cc-acc.is-open > .cc-acc-h .cc-acc-n{ background: var(--rust); color: #fff; border-color: var(--rust); }
.cc-acc-body{ display: none; padding: 2px 6px 10px 14px; }
.cc-acc.is-open > .cc-acc-body{ display: block; animation: ccFade .18s ease; }
@keyframes ccFade{ from{ opacity: 0; transform: translateY(-3px); } to{ opacity: 1; transform: none; } }

.cc-list-item{
  display: block; width: 100%; text-align: left;
  font-family: inherit; background: transparent; border: none;
  padding: 7px 10px; border-radius: 7px;
  cursor: pointer; color: var(--ink-2);
  border-left: 2px solid transparent;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.cc-list-item:hover{ background: var(--surface); color: var(--ink); border-left-color: var(--line-2); }
.cc-list-item.is-active{
  background: var(--teal-soft); color: var(--teal); font-weight: 600; border-left-color: var(--teal);
}
.cc-li-title{ display: block; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.cc-li-meta{
  display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4;
}
.cc-list-item.is-active .cc-li-meta{ color: var(--teal-3); }
.cc-list-empty{
  padding: 20px; text-align: center; color: var(--muted); font-size: 12.5px; font-style: italic;
}

/* ----- PANEL ----- */
.cc-panel{
  padding: 22px 26px 28px;
  overflow-y: auto;
  max-height: 82vh;
}
@media (max-width: 920px){
  .cc-panel{ max-height: none; padding: 18px; }
}
.cc-empty{
  padding: 60px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.55;
}
.cc-empty-ic{ font-size: 38px; display: block; margin-bottom: 12px; opacity: .5; }

.cc-head{ margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cc-head-cat{
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--rust); margin-bottom: 5px;
}
.cc-title{
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 24px; line-height: 1.2; color: var(--ink); margin: 0 0 6px 0;
}
.cc-desc{ font-size: 13.5px; color: var(--ink-2); line-height: 1.55; max-width: 60ch; }
.cc-useful{
  margin-top: 8px; font-size: 12.5px; color: var(--ink-2);
  background: var(--bg-soft); padding: 6px 11px; border-radius: 6px;
  border-left: 3px solid var(--teal-3);
}
.cc-useful b{ color: var(--teal); font-weight: 700; }

.cc-external{
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #fef4f2 0%, #fff7ed 100%);
  border: 1px solid #f5b7b0; border-radius: var(--r-md);
  padding: 12px 16px; margin-bottom: 18px;
}
.cc-external-ic{ font-size: 22px; flex-shrink: 0; }
.cc-external b{ color: #7f1d1d; }
.cc-external a{
  display: inline-block; margin-top: 4px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: #7f1d1d; padding: 5px 12px; border-radius: 6px; text-decoration: none;
}
.cc-external a:hover{ background: #b91c1c; }

/* Inputs */
.cc-inputs{ margin-bottom: 20px; }
.cc-inputs-head{
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.cc-inputs-head h4{
  font-size: 11.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 0;
}
.cc-reset{
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--rust);
  background: transparent; border: 1px solid var(--rust-soft); border-radius: 99px;
  padding: 2px 10px; cursor: pointer;
}
.cc-reset:hover{ background: var(--rust); color: #fff; }

.cc-igroup-t{
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--teal);
  margin: 12px 0 6px; padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.cc-igroup{ display: flex; flex-direction: column; gap: 2px; }

.cc-iopt{
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.4;
  transition: background .12s ease;
}
.cc-iopt:hover{ background: var(--bg-soft); }
.cc-iopt input{ margin-top: 2px; accent-color: var(--teal); flex-shrink: 0; }
.cc-iopt-lbl{ flex: 1; }
.cc-iopt-lbl small{ display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cc-iopt:has(input:checked){ background: var(--teal-soft); color: var(--teal); font-weight: 500; }
.cc-iopt:has(input:checked) .cc-iopt-lbl small{ color: var(--teal-3); }

.cc-pts{
  font-size: 11px; font-weight: 700; color: var(--rust);
  background: var(--rust-soft); padding: 2px 6px; border-radius: 99px;
  flex-shrink: 0;
}
.cc-iopt:has(input:checked) .cc-pts{ background: var(--teal); color: #f6f2e9; }

.cc-inum{ display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; }
.cc-inum-lbl{ font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.cc-inum-lbl small{ display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.cc-inum-row{ display: flex; align-items: center; gap: 8px; }
.cc-inum input{
  font-family: inherit; font-size: 14px;
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); outline: none;
  width: 110px;
}
.cc-inum input:focus{ border-color: var(--teal-3); }
.cc-inum-unit{ font-size: 12px; color: var(--muted); }

.cc-iselect{ display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; }
.cc-iselect-lbl{ font-size: 13px; color: var(--ink-2); }
.cc-iselect-lbl small{ display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.cc-iselect select{
  font-family: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); outline: none;
  max-width: 360px;
}
.cc-iselect select:focus{ border-color: var(--teal-3); }

/* Likert (PHQ-9, GAD-7) */
.cc-likert{ padding: 10px; border-bottom: 1px solid var(--line); }
.cc-likert:last-child{ border-bottom: none; }
.cc-likert-lbl{ font-size: 13.5px; color: var(--ink-2); margin-bottom: 8px; line-height: 1.5; }
.cc-likert-opts{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
@media (max-width: 580px){ .cc-likert-opts{ grid-template-columns: 1fr 1fr; } }
.cc-likert-opt{
  font-family: inherit; font-size: 11.5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2);
  cursor: pointer; transition: .15s ease;
}
.cc-likert-opt:hover{ border-color: var(--teal-3); }
.cc-likert-opt.is-active{
  background: var(--teal); color: #f6f2e9; border-color: var(--teal);
}
.cc-likert-n{ font-family: 'Source Serif 4', serif; font-style: italic; font-weight: 500; font-size: 14px; }
.cc-likert-t{ font-size: 10.5px; text-align: center; line-height: 1.2; }

/* ----- RESULT ----- */
.cc-result-empty{
  padding: 24px; text-align: center; color: var(--muted);
  font-size: 13px; font-style: italic;
  border: 2px dashed var(--line); border-radius: var(--r-md);
}

.cc-result{
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); margin-bottom: 16px;
  overflow: hidden;
}
.cc-result-head{
  padding: 14px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.cc-result-l{ flex: 1; }
.cc-result-lbl{
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 2px;
}
.cc-result-num{
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 38px; line-height: 1; color: var(--teal);
}
.cc-result-unit{ font-size: 16px; color: var(--muted); margin-left: 4px; }
.cc-result-r{ text-align: right; }
.cc-result-tag{
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .05em;
  padding: 5px 11px; border-radius: 99px; margin-bottom: 5px;
  text-transform: uppercase;
}
.cc-result-action{ font-size: 13px; color: var(--ink-2); max-width: 38ch; }
.cc-result-detail{
  padding: 12px 18px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); line-height: 1.55;
  background: var(--surface-2);
}

.cc-result-bar{
  height: 8px; background: var(--bg-soft);
}
.cc-result-bar-fill{
  height: 100%; transition: width .3s ease;
}

/* Severity colours */
.cc-sev-low,    .cc-result-low    .cc-result-num    { color: #15803d; }
.cc-sev-med,    .cc-result-med    .cc-result-num    { color: #b45309; }
.cc-sev-high,   .cc-result-high   .cc-result-num    { color: #c2410c; }
.cc-sev-severe, .cc-result-severe .cc-result-num    { color: #b91c1c; }
.cc-sev-neutral { color: var(--ink); }

.cc-result-low    .cc-result-tag.cc-sev-low    { background: #dcfce7; color: #15803d; }
.cc-result-med    .cc-result-tag.cc-sev-med    { background: #fffbeb; color: #b45309; }
.cc-result-high   .cc-result-tag.cc-sev-high   { background: #fff7ed; color: #c2410c; }
.cc-result-severe .cc-result-tag.cc-sev-severe { background: #fef4f2; color: #b91c1c; }
.cc-result-neutral .cc-result-tag.cc-sev-neutral { background: var(--teal-soft); color: var(--teal); }

.cc-result-low    { border-color: #bbf7d0; }
.cc-result-med    { border-color: #fde68a; }
.cc-result-high   { border-color: #fed7aa; }
.cc-result-severe { border-color: #fecaca; }

.cc-result-low    .cc-result-bar-fill.cc-sev-low    { background: linear-gradient(90deg, #22c55e, #15803d); }
.cc-result-med    .cc-result-bar-fill.cc-sev-med    { background: linear-gradient(90deg, #fbbf24, #b45309); }
.cc-result-high   .cc-result-bar-fill.cc-sev-high   { background: linear-gradient(90deg, #f97316, #c2410c); }
.cc-result-severe .cc-result-bar-fill.cc-sev-severe { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.cc-result-neutral .cc-result-bar-fill.cc-sev-neutral { background: linear-gradient(90deg, var(--teal-3), var(--teal)); }

/* Formula / refs */
.cc-formula{
  background: var(--bg-soft); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px;
  font-size: 12px; color: var(--ink-2); line-height: 1.55;
}
.cc-formula b{ color: var(--teal); font-weight: 700; }
.cc-formula code{
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  background: var(--surface); padding: 2px 6px; border-radius: 4px;
  font-size: 11.5px; color: var(--ink);
}
.cc-refs{
  border-top: 1px solid var(--line); padding-top: 12px;
}
.cc-refs h5{
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 6px 0;
}
.cc-refs a{
  display: block; font-size: 12px; color: var(--teal-2);
  text-decoration: none; padding: 2px 0; font-weight: 600;
}
.cc-refs a:hover{ color: var(--rust); text-decoration: underline; }

/* ============================================
   EXPANDABLE CALCULATOR CARDS (right side)
   ============================================ */
/* single-column stacked rows so the inline panel gets full width */
#calcGroups .alg-grid,
#calcGroups .dir-flat{ display: flex; flex-direction: column; gap: 9px; }

.alg-card.calc-item{
  display: block; padding: 0; overflow: hidden;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.alg-card.calc-item:hover{ border-color: var(--line-2); }
.alg-card.calc-item.is-open{ border-color: var(--teal); box-shadow: var(--shadow-2); }

.calc-item-head{
  display: flex; align-items: center; gap: 14px; width: 100%;
  font-family: inherit; text-align: left; cursor: pointer;
  background: transparent; border: none;
  padding: 13px 15px;
  transition: background .12s ease;
}
.calc-item-head:hover{ background: var(--bg-soft); }
.calc-item.is-open .calc-item-head{ background: var(--teal-soft); }

.ci-icon{
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 19px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px;
}
.calc-item.is-open .ci-icon{ background: #fff; border-color: var(--teal-3); }
.ci-text{ flex: 1; min-width: 0; }
.ci-text b{ display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.ci-text small{ display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.calc-item.is-open .ci-text b{ color: var(--teal); }

.ci-chev{
  flex-shrink: 0; width: 30px; height: 30px;
  display: grid; place-items: center; color: var(--muted-2);
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.calc-item-head:hover .ci-chev{ color: var(--teal); background: rgba(0,0,0,.03); }
.calc-item.is-open .ci-chev{ color: var(--teal); }
.ci-chev svg{ width: 18px; height: 18px; transition: transform .22s ease; }
.calc-item.is-open .ci-chev svg{ transform: rotate(180deg); }

.calc-item-body{
  padding: 16px 18px 20px;
  border-top: 1px solid var(--line);
  animation: ccFade .2s ease;
}
.calc-item-body .cc-useful{ margin-top: 0; margin-bottom: 14px; }
.calc-item-body .cc-inputs{ margin-bottom: 16px; }
.calc-item-body .cc-refs{ margin-top: 4px; }

/* ----- BACK BUTTON ----- */
.cc-back{
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  color: var(--muted); background: transparent; border: none;
  cursor: pointer; padding: 4px 8px 4px 4px; margin-bottom: 14px;
  border-radius: 6px; transition: color .12s ease, background .12s ease;
}
.cc-back:hover{ color: var(--rust); background: var(--surface-2); }
.cc-back svg{ width: 15px; height: 15px; }
.cc-back--calc{ color: var(--rust); }

/* ----- OVERVIEW (default panel) ----- */
.cc-ov-head{ margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cc-ov-title{
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 26px; line-height: 1.15; color: var(--ink); margin: 0 0 7px 0;
}
.cc-ov-sub{ font-size: 13.5px; color: var(--ink-2); line-height: 1.55; max-width: 64ch; margin: 0; }
.cc-ov-grid{
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px;
}
.cc-ov-card{
  display: block; text-align: left; font-family: inherit; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 15px;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease, background .14s ease;
}
.cc-ov-card:hover{
  border-color: var(--rust); box-shadow: var(--shadow-1);
  transform: translateY(-1px); background: var(--surface);
}
.cc-ov-card-h{ display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cc-ov-card-t{
  flex: 1; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.2;
}
.cc-ov-card:hover .cc-ov-card-t{ color: var(--rust); }
.cc-ov-card-n{
  font-size: 11px; font-weight: 700; color: #fff; background: var(--teal);
  border-radius: 99px; padding: 1px 9px; min-width: 22px; text-align: center;
}
.cc-ov-card-list{ font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ----- CATEGORY LANDING ----- */
.cc-landing-head{
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.cc-landing-title{
  font-family: 'Source Serif 4', serif; font-weight: 500;
  font-size: 24px; line-height: 1.15; color: var(--ink); margin: 0;
}
.cc-landing-count{ font-size: 12px; font-weight: 600; color: var(--muted); }
.cc-landing-grid{
  display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 11px;
}
.cc-landing-card{
  display: block; text-align: left; font-family: inherit; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 15px;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease, background .14s ease;
}
.cc-landing-card:hover{
  border-color: var(--teal); box-shadow: var(--shadow-1);
  transform: translateY(-1px); background: var(--surface);
}
.cc-lc-t{ display: block; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.25; margin-bottom: 3px; }
.cc-landing-card:hover .cc-lc-t{ color: var(--teal); }
.cc-lc-d{ display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
