/* Tendeg Gain Calculator (scoped) */
.tendeg-gain-calc{
  --tgc-border: rgba(0,0,0,0.12);
  --tgc-muted: rgba(0,0,0,0.60);
  --tgc-bg: rgba(255,255,255,0.92);
  font-family: inherit;
}

.tendeg-gain-calc .tgc-card{
  border: 1px solid var(--tgc-border);
  background: var(--tgc-bg);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.tendeg-gain-calc .tgc-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 860px){
  .tendeg-gain-calc .tgc-grid{ grid-template-columns: 1fr; }
}

.tendeg-gain-calc .tgc-h2{
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.tendeg-gain-calc .tgc-sub{
  font-size: 13px;
  color: var(--tgc-muted);
  margin-bottom: 12px;
}

.tendeg-gain-calc label{
  display:block;
  font-size: 12px;
  color: var(--tgc-muted);
  margin-bottom: 6px;
}

.tendeg-gain-calc input,
.tendeg-gain-calc select{
  width: 100%;
  border: 1px solid var(--tgc-border);
  border-radius: 8px;
  padding: 10px 10px;
  background: rgba(255,255,255,0.95);
  font-size: 14px;
}

.tendeg-gain-calc .tgc-row{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.tendeg-gain-calc .tgc-row.three{
  grid-template-columns: 2fr 1fr 0.6fr;
}

@media (max-width: 520px){
  .tendeg-gain-calc .tgc-row,
  .tendeg-gain-calc .tgc-row.three{
    grid-template-columns: 1fr;
  }
}

.tendeg-gain-calc .tgc-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 1px solid var(--tgc-border);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--tgc-muted);
  height: 40px;
  background: rgba(255,255,255,0.65);
}

.tendeg-gain-calc .tgc-out{
  border-left: 1px solid rgba(0,0,0,0.08);
  padding-left: 18px;
}

@media (max-width: 860px){
  .tendeg-gain-calc .tgc-out{
    border-left: none;
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-left: 0;
    padding-top: 12px;
  }
}

.tendeg-gain-calc .tgc-kv{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.10);
}

.tendeg-gain-calc .tgc-key{
  font-size: 13px;
  color: var(--tgc-muted);
}

.tendeg-gain-calc .tgc-val{
  font-size: 14px;
  font-weight: 600;
}
.tendeg-gain-calc .tgc-val{
  color: rgba(0,0,0,0.85);
  opacity: 1;
  -webkit-text-fill-color: rgba(0,0,0,0.85);
}

.tendeg-gain-calc .tgc-warn{
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(240, 173, 78, 0.45);
  background: rgba(240, 173, 78, 0.12);
  border-radius: 10px;
  font-size: 13px;
  color: rgba(0,0,0,0.75);
}

.tendeg-gain-calc .tgc-foot{
  margin-top: 12px;
  font-size: 11px;
  color: var(--tgc-muted);
}

/* Mode toggle */
.tendeg-gain-calc .tgc-togglebar{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}

.tendeg-gain-calc .tgc-toggle{
  display:flex;
  align-items:center;
  gap:10px;
}

.tendeg-gain-calc .tgc-switch{
  position:relative;
  width:44px;
  height:24px;
  border-radius:999px;
  border:1px solid var(--tgc-border);
  background: rgba(0,0,0,0.06);
  cursor:pointer;
  flex:0 0 auto;
}
.tendeg-gain-calc .tgc-switch::after{
  content:'';
  position:absolute;
  top:2px; left:2px;
  width:20px; height:20px;
  border-radius:999px;
  background: rgba(255,255,255,0.95);
  border:1px solid rgba(0,0,0,0.10);
  transition: transform .18s ease;
}
.tendeg-gain-calc .tgc-switch.on::after{
  transform: translateX(20px);
}
.tendeg-gain-calc .tgc-switchlabel{
  font-size:13px;
  color: var(--tgc-muted);
}

.tendeg-gain-calc .tgc-adv{
  margin-top:18px;
  padding-top:18px;
  border-top: 1px solid rgba(0,0,0,0.10);
}

.tendeg-gain-calc .tgc-advtitle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:0 0 12px 0;
  font-size:13px;
  color: var(--tgc-muted);
}

.tendeg-gain-calc .tgc-pill{
  display:inline-block;
  padding:2px 10px;
  border-radius:999px;
  border:1px solid var(--tgc-border);
  font-size:12px;
  color: var(--tgc-muted);
  background: rgba(255,255,255,0.65);
}

/* Copy Results button */
.tendeg-gain-calc .tgc-copybtn{
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--tgc-border);
  background: rgba(255,255,255,0.95);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  text-align: center;
}
.tendeg-gain-calc .tgc-copybtn:hover{ background: rgba(0,0,0,0.03); }
.tendeg-gain-calc .tgc-copybtn:active{ transform: translateY(1px); }

/* Inline note */
.tendeg-gain-calc .tgc-note{
  font-size: 12px;
  color: var(--tgc-muted);
  margin-top: 6px;
  line-height: 1.35;
}

/* Output actions row */
.tendeg-gain-calc .tgc-outactions{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 14px;
}

.tendeg-gain-calc .tgc-outactions .tgc-copybtn{
  width:auto;
  flex: 1 1 auto;
  margin-top: 0;
}

.tendeg-gain-calc .tgc-plotbtn{
  flex: 1 1 auto;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--tgc-border);
  background: rgba(255,255,255,0.95);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align:center;
  display:none;
}
.tendeg-gain-calc .tgc-plotbtn:hover{ background: rgba(0,0,0,0.03); }
.tendeg-gain-calc .tgc-plotbtn:active{ transform: translateY(1px); }

/* Plot UI */
.tendeg-gain-calc .tgc-plotwrap{
  margin-top: 12px;
  border-top: 1px solid var(--tgc-border);
  padding-top: 12px;
}

.tendeg-gain-calc .tgc-plotframe{
  margin-top: 10px;
  border: 1px solid var(--tgc-border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.60);
}

.tendeg-gain-calc .tgc-plotcanvas{
  display:block;
  width: 100%;
  height: 340px;
}

.tendeg-gain-calc .tgc-plotcontrols .tgc-row{
  margin-top: 8px;
}

.tendeg-gain-calc .tgc-checks{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px 10px;
  padding: 10px;
  border: 1px solid var(--tgc-border);
  border-radius: 12px;
  background: rgba(255,255,255,0.60);
  max-height: 160px;
  overflow:auto;
}

.tendeg-gain-calc .tgc-check{
  display:flex;
  gap:8px;
  align-items:center;
}
.tendeg-gain-calc .tgc-check label{
  font-size: 12px;
  color: var(--tgc-muted);
}


/* Active mode pill styling */
.tendeg-gain-calc .tgc-switchlabel{
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  color: rgba(0,0,0,0.65);
}
.tendeg-gain-calc .tgc-switchlabel.is-active{
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.92);
  font-weight: 800;
}

/* Analysis (Frequency Sweep) disclosure */
.tendeg-gain-calc .tgc-disclosure{
  margin-top: 18px;
  border: 1px solid var(--tgc-border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.9);
}
.tendeg-gain-calc .tgc-disclosure-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.tendeg-gain-calc .tgc-disclosure-title{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 750;
}
.tendeg-gain-calc .tgc-chevron{
  transition: transform 180ms ease;
  opacity: 0.75;
}
.tendeg-gain-calc .tgc-disclosure.is-open .tgc-chevron{
  transform: rotate(90deg);
}
.tendeg-gain-calc .tgc-disclosure-sub{
  font-size: 12px;
  color: var(--tgc-muted);
  padding: 0 14px 10px 14px;
}

/* Diameter chips */
.tendeg-gain-calc .tgc-chips{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.tendeg-gain-calc .tgc-chip{
  border: 1px solid var(--tgc-border);
  background: rgba(255,255,255,0.85);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.tendeg-gain-calc .tgc-chip:hover{ background: rgba(0,0,0,0.03); }
.tendeg-gain-calc .tgc-chip.is-on{
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.18);
  font-weight: 800;
}

/* Replace old plot button visuals if still present */
.tendeg-gain-calc .tgc-plotbtn{ display:none !important; }


/* Helper text (matches footnote tier) */
.tendeg-gain-calc .tgc-muted{
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--tgc-muted);
}

.tendeg-gain-calc .tgc-advblock .tgc-subhead{
  padding: 14px 0 10px 0;
}


/* --- Tendeg Gain Calc: v1.2.17 display fixes --- */
.tgc-val, .tgc-output .tgc-val, .tgc-out .tgc-val, .tgc-result .tgc-val {
  color: #222 !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #222 !important;
}

.tgc-helper, .tgc-note, .tgc-footnote, .tgc-smallnote {
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.tgc-adv-header, .tgc-adv-title, .tgc-advanced-title, .tgc-adv-label {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  display: block;
}
