/* TradingView-class chart chrome: toolbar menus, drawing rail, legends, bottom timeline bar. */
.chartPane {
  grid-template-rows: auto auto 1fr auto;
}
.grow {
  flex: 1;
}
.vsep {
  width: 1px;
  height: 20px;
  background: var(--line2);
  margin: 0 2px;
}
.toolbar {
  gap: 6px;
  flex-wrap: nowrap;
}
.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.tbtn:hover {
  background: #151c2a;
  color: var(--text);
}
.tbtn.icon {
  padding: 0 8px;
}
.tbtn:disabled {
  opacity: 0.3;
  cursor: default;
}
.dd {
  position: relative;
}
.ddBtn {
  height: 30px;
  padding: 0 6px;
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
}
.ddBtn.wide {
  padding: 0 10px;
}
.ddBtn:hover {
  background: #151c2a;
  color: var(--text);
}
.ddMenu {
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 30;
  min-width: 190px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: none;
}
.dd.open .ddMenu {
  display: block;
}
.ddMenu .mh {
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  padding: 8px 10px 4px;
}
.ddMenu .mi {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.ddMenu .mi:hover {
  background: #1a2232;
}
.ddMenu .mi.on {
  color: var(--accent);
}
.ddMenu .mi:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ddMenu .mi .star {
  color: var(--dim);
  font-size: 13px;
  padding: 0 2px;
}
.ddMenu .mi .star.fav {
  color: #f5b942;
}

.chartArea {
  display: grid;
  grid-template-columns: 44px 1fr;
  min-height: 0;
}
.drawTools {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  background: var(--panel);
  overflow-y: auto;
}
.drawTools button {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.drawTools button:hover {
  background: #151c2a;
  color: var(--text);
}
.drawTools button.on {
  background: rgba(59, 130, 246, 0.16);
  color: #7fb0ff;
}
.tsep {
  width: 22px;
  height: 1px;
  background: var(--line2);
  margin: 6px 0;
  flex: none;
}
#draw {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 3;
}
.legend {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 4;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.legend .l1 {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.legend .l1 .ttl {
  font-family: "Inter", sans-serif;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.legend b {
  color: var(--text);
  font-weight: 500;
}
.li {
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: auto;
  padding: 1px 6px 1px 0;
  border-radius: 5px;
  width: max-content;
  font-family: var(--mono);
  font-size: 12px;
}
.li .nm {
  color: var(--muted);
}
.li .vals {
  display: flex;
  gap: 8px;
}
.li .ctl {
  display: none;
  gap: 2px;
}
.li:hover {
  background: rgba(17, 22, 34, 0.85);
}
.li:hover .ctl {
  display: flex;
}
.li .ctl button {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.li .ctl button:hover {
  background: #1f2838;
  color: var(--text);
}
.li.off .vals,
.li.off .nm {
  opacity: 0.35;
}
.paneLegend {
  position: absolute;
  left: 10px;
  z-index: 4;
}
.countdown {
  position: absolute;
  right: 0;
  z-index: 4;
  font-family: var(--mono);
  font-size: 11px;
  color: #fff;
  padding: 1px 0;
  pointer-events: none;
  display: none;
  text-align: center;
}
.drawEdit {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.drawEdit.on {
  display: flex;
}
.drawEdit .sw {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid transparent;
}
.drawEdit .sw.on {
  border-color: #fff;
}
.drawEdit .w {
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.drawEdit .w.on {
  background: #1f2838;
  color: var(--text);
}
.drawEdit .del {
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  color: var(--down);
}
.drawEdit .del:hover {
  background: rgba(234, 57, 67, 0.15);
}
.tfBuffer {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  z-index: 9;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(17, 22, 34, 0.95);
  border: 1px solid var(--accent);
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  display: none;
  min-width: 120px;
  text-align: center;
}
.tfBuffer.on {
  display: block;
}
.tfBuffer small {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 4px;
}

.bottomBar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 54px;
  border-top: 1px solid var(--line);
}
.ranges {
  display: flex;
  gap: 2px;
}
.ranges button {
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.ranges button:hover {
  background: #151c2a;
  color: var(--text);
}
.ranges button.on {
  color: var(--accent);
}
.goto {
  position: relative;
}
.gotoPop {
  position: absolute;
  bottom: 38px;
  left: 0;
  z-index: 30;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.gotoPop.on {
  display: flex;
}
.gotoPop label {
  color: var(--muted);
  font-size: 12px;
}
.gotoPop input {
  background: var(--panel);
  border: 1px solid var(--line2);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  color-scheme: dark;
}
.gotoPop button,
.popover .apply {
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
}
#tzSel {
  background: transparent;
  color: var(--muted);
  border: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  outline: 0;
}
#tzSel:hover {
  background: #151c2a;
  color: var(--text);
}
#tzSel option {
  background: var(--panel2);
  color: var(--text);
}
.sbtn {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}
.sbtn:hover {
  background: #151c2a;
  color: var(--text);
}
.sbtn.on {
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 5, 8, 0.6);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.modal.on {
  display: flex;
}
.modalBox {
  width: min(520px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.modalHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
}
.modalHead button {
  color: var(--muted);
  font-size: 15px;
}
#indSearch {
  margin: 0 16px 10px;
  background: var(--panel);
  border: 1px solid var(--line2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  outline: 0;
}
#indSearch:focus {
  border-color: var(--accent);
}
.indList {
  overflow-y: auto;
  padding: 0 8px 10px;
}
.indList .ii {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  text-align: left;
}
.indList .ii:hover {
  background: #1a2232;
}
.indList .ii b {
  font-weight: 600;
}
.indList .ii span {
  color: var(--muted);
  font-size: 12px;
}
.popover {
  position: fixed;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  min-width: 220px;
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.popover.on {
  display: flex;
}
.popover h4 {
  font-size: 13px;
  font-weight: 600;
}
.popover .fr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}
.popover input[type="number"] {
  width: 80px;
  background: var(--panel);
  border: 1px solid var(--line2);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
}
.popover input[type="color"] {
  width: 40px;
  height: 26px;
  border: 0;
  background: none;
  padding: 0;
}
.chartPane:fullscreen {
  background: var(--bg);
}
@media (max-width: 900px) {
  .chartPane {
    grid-template-rows: auto auto 62vh auto;
  }
  .toolbar {
    overflow-x: auto;
  }
  .chartArea {
    grid-template-columns: 1fr;
  }
  .drawTools {
    display: none;
  }
  .bottomBar {
    padding: 0 10px;
    overflow-x: auto;
  }
}
