.zsChartAlertLevels {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.zsChartAlertLevel {
  position: absolute;
  left: 10px;
  right: 72px;
  height: 0;
}

.zsChartAlertLevelLine {
  display: block;
  border-top: 1px dashed #6b7280;
  opacity: 0.65;
}

.zsChartAlertLevelTag {
  position: absolute;
  top: 0;
  right: 0;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
}

.zsChartAlertLevelTag bdi {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.zsChartAlertBar {
  position: absolute;
  top: 5px;
  inset-inline-start: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  font-family: var(--zs-font-institutional);
  font-synthesis: none;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
}

.zsChartAlertOk {
  font-size: 12px;
  font-weight: 500;
  line-height: 28px;
  color: #111;
}

.zsChartAlertBar button {
  box-sizing: border-box;
  height: 28px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.zsChartAlertBarAction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.zsChartAlertBarAction svg {
  flex-shrink: 0;
  color: currentColor;
  opacity: 1;
}

.zsChartAlertOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(17, 17, 17, 0.28);
  display: grid;
  place-items: center;
  padding: 16px;
}

.zsChartAlertDialog {
  width: min(460px, 100%);
  background: #fff;
  color: #111;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 16px 14px;
  font-family: var(--zs-font-institutional);
  font-synthesis: none;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
}

.zsChartAlertHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.zsChartAlertHead h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.zsChartAlertHead button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.zsChartAlertAsset {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.zsChartAlertAsset strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.zsChartAlertAsset span {
  font-size: 12.5px;
  color: #6b7280;
}

.zsChartAlertPicker {
  position: relative;
  margin-bottom: 12px;
}

.zsChartAlertAssetBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.zsChartAlertAssetBtn:disabled {
  cursor: default;
  opacity: 0.65;
}

.zsChartAlertAssetBtn:focus {
  outline: none;
}

.zsChartAlertAssetBtn:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.zsChartAlertAssetIdentity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.zsChartAlertAssetIdentity > span:last-child {
  min-width: 0;
}

.zsChartAlertAssetBtn strong {
  display: block;
  width: fit-content;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  unicode-bidi: isolate;
}

.zsChartAlertAssetIdentity > span:last-child > span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.2;
}

.zsChartAlertChevron {
  margin-inline-start: auto;
  opacity: 0.55;
  flex-shrink: 0;
}

.zsChartAlertPickerPanel {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  max-height: 268px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.zsChartAlertPickerPanel--above {
  top: auto;
  bottom: calc(100% + 6px);
}

.zsChartAlertPickerSearch {
  flex-shrink: 0;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  color: #111;
  background: #fff;
}

.zsChartAlertPickerList {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  min-height: 0;
  max-height: 228px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(75, 85, 99, 0.22) transparent;
}

.zsChartAlertPickerList::-webkit-scrollbar {
  width: 5px;
}

.zsChartAlertPickerList::-webkit-scrollbar-track {
  background: transparent;
}

.zsChartAlertPickerList::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.22);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.zsChartAlertPickerList::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.zsChartAlertPickerEmpty {
  padding: 10px;
  font-size: 12px;
  color: #6b7280;
}

.zsChartAlertPickerOption {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.zsChartAlertPickerOption--active,
.zsChartAlertPickerOption:hover {
  background: #f4f4f5;
}

.zsChartAlertPickerOption strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  unicode-bidi: isolate;
}

.zsChartAlertPickerOption em {
  display: block;
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.2;
}

.zsChartAlertPrice {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 2px;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: #6b7280;
}

.zsChartAlertPrice strong {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  font-variant-numeric: tabular-nums;
}

.zsChartAlertHint,
.zsChartAlertError {
  margin: 0 0 10px;
  font-size: 12.5px;
}

.zsChartAlertHint {
  text-align: start;
}

.zsChartAlertNumber {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

.zsChartAlertError {
  color: #111;
}

.zsChartAlertField {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: #6b7280;
}

.zsChartAlertField input {
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.zsChartAlertField input:focus,
.zsChartAlertField input:focus-visible {
  outline: none;
  border-color: #111;
}

.zsChartAlertField input,
.zsChartAlertField select,
.zsChartAlertField span {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #111;
  background: #fff;
}

.zsChartAlertField span {
  display: flex;
  align-items: center;
}

.zsChartAlertActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.zsChartAlertActions button {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.zsChartAlertActions button:first-child {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111;
}

.zsChartAlertActions button:last-child {
  border: 0;
  background: #111;
  color: #fff;
  font-weight: 600;
}

/* Guests: honest login state instead of a form the alert API would refuse */
.zsChartAlertLogin p {
  margin: 4px 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: inherit;
}

.zsChartAlertLoginLink {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

/* ---- Dark site theme (the chart terminal follows the site theme) ----
   Selectors mirror the global dark form-control rule so the dialog keeps one coherent surface. */
html:not(.light) .zsChartAlertBar button,
html:not(.light) .zsChartAlertLevelTag {
  background: #1a1d24;
  color: #e6e8ee;
  border-color: #2e323d;
}

html:not(.light) .zsChartAlertOk {
  color: #e6e8ee;
}

html:not(.light) .zsChartAlertOverlay {
  background: rgba(0, 0, 0, 0.55);
}

html:not(.light) .zsChartAlertDialog,
html:not(.light) .zsChartAlertPickerPanel,
html:not(.light) .zsChartAlertAssetBtn {
  background: #15181f;
  color: #e6e8ee;
  border-color: #2e323d;
}

html:not(.light) .zsChartAlertDialog .zsChartAlertField :is(input, select):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html:not(.light) .zsChartAlertDialog .zsChartAlertField span,
html:not(.light) .zsChartAlertPickerPanel .zsChartAlertPickerSearch:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
  background-color: #0f1115;
  color: #e6e8ee;
  border-color: #2e323d;
}

html:not(.light) .zsChartAlertField input:focus,
html:not(.light) .zsChartAlertField input:focus-visible {
  border-color: #8a8f9a;
}

html:not(.light) .zsChartAlertHint,
html:not(.light) .zsChartAlertAssetIdentity > span:last-child > span {
  color: #8a8f9a;
}

html:not(.light) .zsChartAlertActions button:first-child {
  background: transparent;
  color: #e6e8ee;
  border-color: #2e323d;
}

html:not(.light) .zsChartAlertActions button:last-child,
html:not(.light) .zsChartAlertLoginLink {
  background: #e6e8ee;
  color: #0f1115;
}

/* touch: the close button is at least 44 x 44 CSS px */
@media (pointer: coarse), (max-width: 760px) {
  .zsChartAlertHead button {
    width: 44px;
    height: 44px;
  }
}

/* alerts status next to the create button: none / count / could not load (+ retry) / sign in */
.zsChartAlertStatus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #4b5563;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.zsChartAlertStatus.is-error { color: #c42330; }
.zsChartAlertBar .zsChartAlertRetry {
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  line-height: 20px;
}
html:not(.light) .zsChartAlertStatus { background: rgba(26, 29, 36, 0.9); color: #b2b5be; }
html:not(.light) .zsChartAlertStatus.is-error { color: #ff6b75; }
@media (max-width: 767px) {
  /* phones: only a problem is worth the space (load failure), the count lives in the alerts page */
  .zsChartAlertStatus:not(.is-error) { display: none; }
  .zsChartAlertBar .zsChartAlertRetry { height: 32px; min-width: 44px; }
}

