/* ═══════════════════════════════════════════════════════════
   48 CHART TEMPLATES — the Templates menu under Indicators
   (static/js/chart/chart-templates.js). Namespace: .ctpl-
   Spec: chart-scope research Option A (optionA_{dark,light}.png).
   Filled backgrounds only for hover/active/on, never a stripe or an
   underline; one family, two sizes (13px rows, 11px grey labels).
═══════════════════════════════════════════════════════════ */

/* Indicators + its caret read as one split control. */
.ctpl-split{display:inline-flex;align-items:center;gap:2px;}
.main.no-header-mode .ctpl-split{display:none!important;}
.ctpl-split #gtb-modify-btn{border-top-right-radius:0;border-bottom-right-radius:0;}
.hdr-graphs-btn.ctpl-caret{
  padding:0 0.5rem;
  border-top-left-radius:0;border-bottom-left-radius:0;
}
.hdr-graphs-btn.ctpl-caret svg{display:block;}
.hdr-graphs-btn.ctpl-caret.active{background:var(--champagne);color:var(--bg-primary);}

.ctpl-menu{
  position:fixed;z-index:10000;
  width:280px;max-width:calc(100vw - 16px);  /* rows are 13px text, so px, not the fluid rem */
  max-height:calc(100vh - 6rem);overflow-y:auto;
  padding:6px;
  background:var(--bg-elevated);
  border-radius:8px;
  box-shadow:inset 0 0 0 1px var(--border-default), var(--shadow-menu);
  font-family:var(--font-sans);font-size:13px;line-height:1.2;
  color:var(--text-primary);
}
.ctpl-menu[hidden]{display:none;}
.ctpl-lbl{font-size:11px;color:var(--text-muted);padding:8px 10px 4px;}
.ctpl-gap{height:6px;}

.ctpl-row{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  min-height:30px;padding:7px 10px;border-radius:6px;
  cursor:pointer;user-select:none;outline:none;
}
.ctpl-row:hover,.ctpl-row:focus-visible{background:var(--bg-row-hover);}
.ctpl-row.on{background:var(--accent-dim);}
/* Nothing on the chart: the save row is greyed and inert. */
.ctpl-row.off{color:var(--text-muted);cursor:default;}
.ctpl-row.off:hover{background:none;}
/* The name wins the width; the grey summary takes what is left. */
.ctpl-name{flex:0 1 auto;min-width:0;max-width:70%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ctpl-act .ctpl-name{max-width:none;}
.ctpl-k{
  flex:0 100 auto;min-width:0;
  font-size:11px;color:var(--text-muted);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

/* Remove: takes the summary's place while the row is hovered/focused. */
.ctpl-x{
  display:none;flex:0 0 auto;
  align-items:center;justify-content:center;
  width:20px;height:20px;margin:-3px -4px -3px 0;padding:0;
  border:none;border-radius:4px;background:none;
  color:var(--text-muted);cursor:pointer;
}
.ctpl-tpl:hover .ctpl-k,.ctpl-tpl:focus-within .ctpl-k{display:none;}
.ctpl-tpl:hover .ctpl-x,.ctpl-tpl:focus-within .ctpl-x{display:inline-flex;}
.ctpl-x:hover{color:var(--text-primary);background:var(--bg-tertiary);}
@media (hover:none){
  .ctpl-tpl .ctpl-k{display:none;}
  .ctpl-tpl .ctpl-x{display:inline-flex;}
}

/* Inline name field for Save indicators as template (no prompt() dialog). */
.ctpl-namer{cursor:default;padding:3px 4px 3px 4px;background:var(--bg-hover);}
.ctpl-input{
  flex:1 1 auto;min-width:0;height:24px;padding:0 6px;
  border:none;border-radius:4px;outline:none;
  background:transparent;color:var(--text-primary);
  font:inherit;font-size:13px;
}
.ctpl-input::placeholder{color:var(--text-muted);}
.ctpl-save{
  flex:0 0 auto;border:none;background:none;cursor:pointer;
  padding:4px 6px;border-radius:4px;font-family:inherit;
}
.ctpl-save:hover{color:var(--text-primary);background:var(--bg-tertiary);}
