/*!
 * 咚咚看盘 · 手机端布局层 (mobile layout layer)
 * 只覆盖布局与密度，不改动配色、图标与组件风格。
 * 生效条件：视口宽度 <= 768px。
 */
@media (max-width: 768px) {
  :root {
    --ot-mq-nav-h: 50px;
    --ot-mq-safe-b: env(safe-area-inset-bottom, 0px);
    --ot-mq-panel: var(--ot-chart-bg, #131722);
    --ot-mq-border: var(--color-widget-border, #2a2e39);
    --ot-mq-text: var(--color-content-primary-neutral-bold, #d1d4dc);
    --ot-mq-up: #f23645;
    --ot-mq-down: #089981;
  }

  html,
  body,
  #root {
    height: 100%;
  }

  /* ---------- 顶部：一排紧凑状态栏 ---------- */
  .tab-bar {
    height: 34px;
    flex: 0 0 34px;
    border-bottom-width: 2px;
  }
  .tab-panel-actions {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 4px;
    gap: 5px;
    overflow: hidden;
  }
  .tab-panel-actions .data-delay-badge {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 150px;
    height: 22px;
    margin: 0;
    padding: 0 6px;
    overflow: hidden;
    font-size: 11px;
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tab-panel-actions > span:not(.data-delay-badge),
  .tab-panel-actions > a {
    display: none;
  }
  .tab-panel-actions select {
    flex: 0 0 auto;
    height: 22px;
    padding: 0 2px;
    font-size: 11px;
  }
  .tab-panel-actions .main-menu-button {
    flex: 0 0 36px;
    width: 36px;
    height: 30px;
    margin-left: auto;
    padding: 0;
    position: static;
    background: transparent !important;
    box-shadow: none !important;
  }
  .tab-panel-actions .main-menu-button:hover {
    background: rgba(0, 0, 0, 0.06) !important;
  }

  /* ---------- 图表工具条：一行、可横滑 ---------- */
  .header-toolbar {
    height: 34px;
    flex: 0 0 34px;
    font-size: 12px;
  }
  .header-toolbar-row {
    height: 34px;
  }
  .header-toolbar-profile {
    display: none;
  }
  .header-toolbar-section {
    height: 34px;
  }
  .header-toolbar-btn {
    padding-inline: 4px;
  }
  .header-toolbar-btn .header-toolbar-label {
    font-size: 12px;
  }
  #header-toolbar-symbol-search.header-toolbar-widget.is-symbol {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-toolbar-scroll .ot-scroll-strip-view {
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .header-toolbar-scroll .ot-scroll-strip-view::-webkit-scrollbar {
    display: none;
  }

  /* ---------- 主区域：让出底部导航 ---------- */
  .tab-bar + .ot-panel-row {
    padding-bottom: calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b));
  }

  /* 左右两条桌面工具栏退出布局，图表占满宽度 */
  aside.drawing-toolbar {
    display: none !important;
  }
  .right-rail-container {
    display: none !important;
  }
  .ot-panel-row .rail-width-handle {
    display: none !important;
  }

  /* ---------- 画线工具：从底部滑出的横向工具栏 ---------- */
  body.ot-mq-tools-open aside.drawing-toolbar {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b));
    z-index: 70;
    width: auto !important;
    height: 50px;
    flex-direction: row;
    background: var(--ot-mq-panel);
    border-top: 1px solid var(--ot-mq-border);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.35);
  }
  body.ot-mq-tools-open .drawing-toolbar-scroll {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
  }
  body.ot-mq-tools-open .drawing-toolbar-scroll .ot-scroll-strip-view {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  body.ot-mq-tools-open .drawing-toolbar-scroll .ot-scroll-strip-view::-webkit-scrollbar {
    display: none;
  }
  body.ot-mq-tools-open .drawing-toolbar-scroll .ot-scroll-strip-content {
    flex-direction: row;
    align-items: center;
    width: max-content;
    height: 100%;
  }
  body.ot-mq-tools-open .drawing-toolbar-scroll .ot-scroll-strip-arrow,
  body.ot-mq-tools-open .drawing-toolbar-spacer {
    display: none;
  }
  body.ot-mq-tools-open .drawing-toolbar-section {
    flex-direction: row;
    padding: 0 2px;
  }
  body.ot-mq-tools-open .drawing-toolbar-section + .drawing-toolbar-section {
    padding-top: 0;
  }
  body.ot-mq-tools-open .drawing-toolbar-section + .drawing-toolbar-section::before {
    width: 1px;
    height: 26px;
    margin: 0 5px;
  }
  body.ot-mq-tools-open .drawing-tool-group {
    flex-direction: row;
  }
  body.ot-mq-tools-open .drawing-tool-btn {
    width: 42px;
    height: 42px;
  }
  body.ot-mq-tools-open .ot-mq-only-close {
    display: flex;
  }

  /* ---------- 自选/对象树：右侧抽屉 ---------- */
  body.ot-mq-rail-open .right-rail-container {
    display: flex !important;
    position: fixed;
    top: 0;
    right: 0;
    bottom: calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b));
    z-index: 80;
    width: min(88vw, 340px) !important;
    --ot-rail-width: min(78vw, 295px) !important;
    background: var(--ot-mq-panel);
    border-left: 1px solid var(--ot-mq-border);
    box-shadow: -12px 0 28px rgba(0, 0, 0, 0.5);
    animation: ot-mq-slide-in 0.18s ease-out;
  }
  body.ot-mq-rail-open .right-rail-container .rail-width-handle {
    display: none;
  }
  body.ot-mq-rail-open .right-rail-container .ot-scroll-strip-view {
    -webkit-overflow-scrolling: touch;
  }
  @keyframes ot-mq-slide-in {
    from {
      transform: translateX(16px);
      opacity: 0.6;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
  #ot-mq-backdrop {
    position: fixed;
    inset: 0 0 calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b)) 0;
    z-index: 75;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  body.ot-mq-rail-open #ot-mq-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* ---------- 行情图例：默认收起，点“行情”展开 ---------- */
  .ot-legend-stack:has(.ot-legend-source) {
    display: none !important;
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) {
    display: block !important;
    position: absolute !important;
    top: 36px !important;
    left: 6px !important;
    z-index: 9;
    width: min(calc(100% - 12px), 336px) !important;
    padding: 6px 8px;
    background: rgba(19, 23, 34, 0.94);
    border: 1px solid var(--ot-mq-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) * {
    background-color: transparent !important;
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) .ot-ind-legend,
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) .ot-legend-toggler-wrap {
    display: none !important;
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) .ot-legend {
    width: 100%;
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) .ot-legend-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    height: auto;
    font-size: 11px;
  }
  body.ot-mq-legend-open .ot-legend-stack:has(.ot-legend-source) .ot-legend-value-item {
    flex: 0 0 auto;
  }

  /* ---------- 底部日期/复权栏：紧凑、可横滑 ---------- */
  .chart-controls-bar.bottom-bar {
    flex: 0 0 28px;
    height: 28px;
    margin-top: 1px;
    border-radius: 0;
    contain: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chart-controls-bar.bottom-bar::-webkit-scrollbar {
    display: none;
  }
  .bottom-bar-toolbar {
    width: max-content;
    min-width: 100%;
    height: 28px;
    font-size: 11px;
  }
  .bottom-bar-item,
  .bottom-bar-inline,
  .bottom-bar-tab,
  .bottom-bar-icon-button {
    height: 28px;
    font-size: 11px;
  }
  .bottom-bar-date-range-wrapper {
    position: static;
    display: inline-flex;
    height: 28px;
  }
  .bottom-bar-series-control-wrapper {
    position: static;
    display: inline-flex;
    height: 28px;
  }

  /* ---------- 新增：紧凑行情胶囊 ---------- */
  #ot-mq-quote {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 76px);
    height: 26px;
    padding: 0 8px;
    overflow: hidden;
    color: var(--ot-mq-text);
    font: 500 12px/26px -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    white-space: nowrap;
    background: rgba(19, 23, 34, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(6px);
  }
  #ot-mq-quote .sym {
    flex: 0 0 auto;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  #ot-mq-quote .px {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
  }
  #ot-mq-quote .chg {
    flex: 0 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
  }
  #ot-mq-quote .chg.is-up {
    color: var(--ot-mq-up);
  }
  #ot-mq-quote .chg.is-down {
    color: var(--ot-mq-down);
  }
  #ot-mq-quote .legend-toggle {
    flex: 0 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 1px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 5px;
  }
  #ot-mq-quote .legend-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.18s ease;
  }
  body.ot-mq-legend-open #ot-mq-quote .legend-toggle svg {
    transform: rotate(180deg);
  }

  /* 画线工具展开时给图表让出高度，避免遮挡底部信息 */
  body.ot-mq-tools-open .tab-bar + .ot-panel-row {
    padding-bottom: calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b) + 50px);
  }

  /* ---------- 底部：以大号“切换标的”为主操作 ---------- */
  #ot-mq-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    display: flex;
    align-items: center;
    gap: 8px;
    height: calc(var(--ot-mq-nav-h) + var(--ot-mq-safe-b));
    padding: 0 8px var(--ot-mq-safe-b);
    background: var(--color-pane-bg, #f7f8fa);
    border-top: 1px solid var(--color-widget-border, #e0e3eb);
    box-shadow: none;
  }
  #ot-mq-nav[hidden],
  #ot-mq-actions[hidden] {
    display: none !important;
  }
  .mq-symbol-btn {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    color: var(--color-toolbar-button-text, #2a2e39);
    background: var(--color-container-fill-primary-neutral-light, #f2f2f2);
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    text-align: left;
  }
  .mq-symbol-btn:active {
    background: var(--color-container-fill-primary-neutral-normal, #e8eaed);
  }
  .mq-symbol-logo {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
  }
  .mq-symbol-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  .mq-symbol-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
  }
  .mq-symbol-text .sym {
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mq-symbol-text .sub {
    display: flex;
    gap: 6px;
    overflow: hidden;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .mq-symbol-text .chg.is-up {
    color: var(--ot-mq-up);
  }
  .mq-symbol-text .chg.is-down {
    color: var(--ot-mq-down);
  }
  .mq-symbol-search {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
  }
  .mq-symbol-search svg {
    width: 18px;
    height: 18px;
  }
  .mq-more-btn {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--color-toolbar-button-text, #2a2e39);
    background: transparent;
    border: 0;
    border-radius: 8px;
  }
  .mq-more-btn:hover,
  .mq-more-btn:active {
    background: var(--color-container-fill-primary-neutral-light, #e8eaed);
  }
  .mq-more-btn svg {
    width: 22px;
    height: 22px;
  }

  /* 更多工具：沿用原站浅色菜单结构 */
  #ot-mq-actions {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: none;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.36);
  }
  #ot-mq-actions.is-open {
    display: flex;
  }
  .mq-actions-panel {
    width: 100%;
    padding: 8px 10px calc(10px + var(--ot-mq-safe-b));
    color: var(--color-text-primary, #1a1a1a);
    background: var(--color-bg-primary, #fff);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
    animation: ot-mq-actions-up 0.16s ease-out;
  }
  @keyframes ot-mq-actions-up {
    from {
      transform: translateY(12px);
      opacity: 0.7;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
  .mq-actions-title {
    padding: 6px 10px 8px;
    color: var(--color-cold-gray-500, #8b8f97);
    font-size: 11px;
  }
  .mq-action-row {
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    text-align: left;
  }
  .mq-action-row:hover,
  .mq-action-row:active {
    background: var(--color-container-fill-primary-neutral-extra-light, #f2f2f2);
  }
  .mq-action-icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-content-primary-neutral-semi-bold, #4a4f57);
  }
  .mq-action-icon svg {
    width: 22px;
    height: 22px;
  }

  /* ---------- 自选/搜索弹窗：单列、名称优先 ---------- */
  .symbol-search-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .symbol-search-tabs::-webkit-scrollbar {
    display: none;
  }
  /* ---------- 指标弹窗：手机端纵向布局 ---------- */
  .indicators-dialog {
    width: calc(100vw - 16px);
    max-width: 460px;
    height: min(86dvh, 700px);
  }
  .indicators-header {
    height: 52px;
    padding: 0 14px;
  }
  .indicators-title {
    font-size: 17px;
  }
  .indicators-close {
    width: 32px;
    height: 32px;
  }
  .indicators-search-wrap {
    height: 36px;
    margin: 0 12px;
  }
  .indicators-content {
    flex-direction: column;
  }
  .indicators-sidebar {
    flex: 0 0 46px;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    gap: 6px;
    padding: 2px 12px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .indicators-sidebar::-webkit-scrollbar {
    display: none;
  }
  .indicators-sidebar-group {
    flex-direction: row;
    gap: 6px;
  }
  .indicators-sidebar-title {
    display: none;
  }
  .indicators-sidebar-item {
    flex: 0 0 auto;
    height: 32px;
    gap: 6px;
    padding: 0 10px;
    border-radius: 16px;
    background: var(--color-container-fill-primary-neutral-extra-light);
    font-size: 12px;
  }
  .indicators-sidebar-icon {
    width: 16px;
    height: 16px;
  }
  .indicators-list-pane {
    flex: 1;
    min-height: 0;
    width: 100%;
  }
  .indicators-type-tabs {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px 10px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .indicators-type-tabs::-webkit-scrollbar {
    display: none;
  }
  .indicators-list-head {
    display: none;
  }
  .indicators-list-scroll {
    padding: 0 6px;
  }
  .indicators-row,
  .indicators-row.is-metric {
    grid-template-columns: minmax(0, 1fr) auto !important;
    height: 34px;
    padding: 0 10px;
  }
  .indicators-section-title {
    padding-inline: 10px;
  }
}

/* ==========================================================================
   全端（手机 + 电脑）：主界面只保留看盘内容，
   行情数据源 / 更新状态 / 备份恢复 / 开源说明 收进“设置”面板。
   ========================================================================== */
.tab-panel-actions > .data-delay-badge,
.tab-panel-actions > select,
.tab-panel-actions > span:not(.data-delay-badge),
.tab-panel-actions > a {
  display: none !important;
}
.tab-panel-actions #ot-top-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
}
.tab-panel-actions #ot-top-settings-btn:hover {
  background: rgba(127, 127, 127, 0.14);
}
.tab-panel-actions #ot-top-settings-btn svg {
  width: 19px;
  height: 19px;
}
.tab-panel-actions .main-menu-button {
  margin-left: 4px;
}
body.ot-mq .tab-panel-actions #ot-top-settings-btn {
  display: none;
}

#ot-settings-sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.46);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#ot-settings-sheet.is-open {
  display: flex;
}
#ot-settings-panel {
  width: min(92vw, 410px);
  max-height: min(86dvh, 620px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px 18px 16px;
  color: var(--color-text-primary, #1a1a1a);
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary-neutral-light, rgba(127, 127, 127, 0.25));
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
#ot-settings-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
#ot-settings-panel h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
#ot-settings-close {
  width: 30px;
  height: 30px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 22px;
  line-height: 26px;
}
#ot-settings-close:hover {
  background: rgba(127, 127, 127, 0.14);
}
.ot-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  border-top: 1px solid var(--color-border-primary-neutral-light, rgba(127, 127, 127, 0.18));
  font-size: 13px;
}
.ot-settings-row:first-of-type {
  border-top: 0;
}
.ot-settings-row select {
  min-width: 132px;
  height: 32px;
  padding: 0 6px;
  color: inherit;
  background: var(--color-container-fill-primary-neutral-extra-light, rgba(127, 127, 127, 0.1));
  border: 1px solid var(--color-border-primary-neutral-light, rgba(127, 127, 127, 0.3));
  border-radius: 6px;
  font: inherit;
}
#ot-settings-status {
  max-width: 210px;
  overflow: hidden;
  color: var(--color-cold-gray-500, #8b8f97);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ot-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.ot-settings-actions button,
.ot-settings-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  color: inherit;
  background: var(--color-container-fill-primary-neutral-extra-light, rgba(127, 127, 127, 0.1));
  border: 1px solid var(--color-border-primary-neutral-light, rgba(127, 127, 127, 0.28));
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.ot-settings-actions button:hover,
.ot-settings-actions a:hover {
  background: var(--color-container-fill-primary-neutral-light, rgba(127, 127, 127, 0.18));
}
.ot-settings-hint {
  margin: 14px 0 0;
  color: var(--color-cold-gray-500, #8b8f97);
  font-size: 11px;
  line-height: 1.5;
}

/* 手机端隐藏整条桌面窗口栏（数据源已收进设置，底部导航接管操作） */
@media (max-width: 768px) {
  body.ot-mq .tab-bar {
    display: none !important;
  }
  body.ot-mq .tab-bar + .ot-panel-row {
    padding-top: 0;
  }
}

/* 图表空白区域水印：参考 TradingView，用当前标的+周期填充空白，避免大片纯白 */
.ot-mq-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(127, 127, 127, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 46px;
  font-weight: 400;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 768px) {
  .ot-mq-watermark {
    font-size: 30px;
    color: rgba(200, 205, 215, 0.09);
  }
}

/*! 咚咚看盘 × KD Watch 联动（仅管理员）· 注入样式 v1
   风格对齐应用：白底、#0f0f0f 文字、6px 圆角、14px 字号、同一套字体栈。 */

#kd-pill {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #d0d3d8;
  border-radius: 15px;
  background: #fff;
  color: #0f0f0f;
  font: 500 13px/1 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  box-shadow: none;
  transform: translateZ(0);
  cursor: pointer;
}
#kd-pill:hover { background: #f2f3f5; }
#kd-pill .kd-pill__dot {
  width: 7px; height: 7px; border-radius: 50%; background: #089981;
}
#kd-pill.is-locked .kd-pill__dot { background: #b0b4bb; }

.kd-panel {
  position: fixed;
  left: 12px;
  bottom: 52px;
  z-index: 9001;
  display: none;
  flex-direction: column;
  width: 348px;
  max-height: min(70vh, 620px);
  border: 1px solid #dfe1e6;
  border-radius: 8px;
  background: #fff;
  color: #0f0f0f;
  font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: translateZ(0);
  overflow: hidden;
}
.kd-panel.is-open { display: flex; }
.kd-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 10px 9px 12px; border-bottom: 1px solid #eceef1;
}
.kd-panel__title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kd-panel__title strong { font-size: 13px; font-weight: 600; }
.kd-chip {
  padding: 1px 7px; border-radius: 9px; background: #eef7f3; color: #0b7a5f;
  font-size: 11px; white-space: nowrap;
}
.kd-panel__tools { display: flex; gap: 2px; }
.kd-panel__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; border-top: 1px solid #eceef1; background: #fafbfc;
}
.kd-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 9px 12px; border-bottom: 1px solid #eceef1;
}
.kd-section { display: flex; flex-direction: column; min-height: 0; }
.kd-section + .kd-section { border-top: 1px solid #eceef1; }
.kd-section__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; color: #5a5f66; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
}
.kd-list { overflow: auto; max-height: 190px; }
.kd-list--fires { max-height: 150px; }
.kd-pad { padding: 6px 12px 12px; }
.kd-dim { color: #7c828a; }
.kd-bad { color: #d1493f; }
.kd-ok { color: #0b7a5f; }

.kd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-top: 1px solid #f3f4f6;
}
.kd-row:first-child { border-top: 0; }
.kd-row__main { min-width: 0; }
.kd-row__title { display: flex; align-items: baseline; gap: 7px; }
.kd-row__title strong { font-size: 13px; font-weight: 600; }
.kd-row__price { font-variant-numeric: tabular-nums; font-size: 13px; }
.kd-row__meta { display: flex; gap: 6px; align-items: center; color: #7c828a; font-size: 11px; }
.kd-tag { padding: 0 5px; border-radius: 3px; background: #f0f1f3; color: #5a5f66; }
.kd-row__ops { display: flex; gap: 2px; flex: 0 0 auto; }

.kd-fire {
  padding: 5px 12px; border-top: 1px solid #f3f4f6;
  color: #4a4f57; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.kd-btn {
  height: 26px; padding: 0 10px;
  border: 1px solid #d0d3d8; border-radius: 4px; background: #fff; color: #0f0f0f;
  font: 500 12px/1 inherit; cursor: pointer;
}
.kd-btn:hover { background: #f2f3f5; }
.kd-btn.kd-primary { border-color: #2962ff; background: #2962ff; color: #fff; }
.kd-btn.kd-primary:hover { background: #1e53e5; }
.kd-btn:disabled { opacity: 0.6; cursor: default; }
.kd-link-btn {
  border: 0; background: none; padding: 2px 5px; border-radius: 3px;
  color: #2962ff; font: 500 12px/1 inherit; cursor: pointer;
}
.kd-link-btn:hover { background: #eef2ff; }
.kd-link-btn.kd-danger { color: #d1493f; }
.kd-icon-btn {
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 4px; background: none; color: #5a5f66;
  font: 400 16px/1 inherit; cursor: pointer;
}
.kd-icon-btn:hover { background: #f2f3f5; color: #0f0f0f; }

.kd-check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.kd-check input { margin: 0; }
.kd-actions__hint { font-size: 11px; }

/* 「更多选项」折叠区（默认收起，弹窗主界面只有标的 + 触发价） */
.kd-more { border-top: 1px solid #eceef1; padding-top: 8px; }
.kd-more > summary {
  cursor: pointer; list-style: none; color: #5a5f66; font-size: 12px;
  padding: 2px 0; user-select: none;
}
.kd-more > summary::-webkit-details-marker { display: none; }
.kd-more > summary::before { content: '▸ '; color: #7c828a; }
.kd-more[open] > summary::before { content: '▾ '; }
.kd-more__body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }

/* ---- 弹层 ---- */
.kd-backdrop {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.22);
}
.kd-modal {
  width: 400px; max-width: calc(100vw - 32px); max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  border-radius: 8px; background: #fff; color: #0f0f0f;
  font: 400 13px/1.5 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.18);
  transform: translateZ(0);
  overflow: hidden;
}
.kd-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid #eceef1;
}
.kd-modal__head strong { font-size: 14px; font-weight: 600; }
.kd-modal__body { padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.kd-modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 10px 14px; border-top: 1px solid #eceef1; background: #fafbfc;
}
.kd-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kd-field__label { color: #5a5f66; font-size: 12px; }
.kd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kd-input {
  height: 30px; padding: 0 8px;
  border: 1px solid #d0d3d8; border-radius: 4px; background: #fff; color: #0f0f0f;
  font: 400 13px/1 inherit; outline: none;
}
.kd-input:focus { border-color: #2962ff; box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.16); }
.kd-hint { margin: 0; color: #5a5f66; font-size: 12px; line-height: 1.55; }
.kd-hint.kd-bad { color: #d1493f; }
.kd-hint.kd-ok { color: #0b7a5f; }

/* 原生「创建警报」对话框里那一行 */
.kd-native-check {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: #0f0f0f;
}
.kd-native-check input { margin: 0; }

.kd-toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2147483001; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.kd-toast {
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px; border-radius: 6px;
  background: #1f2226; color: #fff;
  font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  box-shadow: none;
  transition: opacity 0.4s, transform 0.4s;
}
.kd-toast--ok { background: #0b7a5f; }
.kd-toast--error { background: #b3362c; }
.kd-toast.is-out { opacity: 0; transform: translateY(6px); }

@media (max-width: 768px) {
  #kd-pill {
    left: 8px;
    bottom: calc(var(--ot-mq-nav-h, 50px) + env(safe-area-inset-bottom, 0px) + 8px);
    height: 28px; padding: 0 10px;
  }
  .kd-panel {
    left: 8px; right: 8px; width: auto;
    bottom: calc(var(--ot-mq-nav-h, 50px) + env(safe-area-inset-bottom, 0px) + 44px);
    max-height: 62vh;
  }
  .kd-modal { width: calc(100vw - 20px); }
  .kd-toasts { bottom: calc(var(--ot-mq-nav-h, 50px) + env(safe-area-inset-bottom, 0px) + 12px); }
}

/*! 咚咚看盘 · 识图添加股票 — 弹窗入口与识图面板样式 */

.ot-img-lock {
  overflow: hidden !important;
}

/* “添加交易品种”弹窗右上角的识图入口 */
#ot-img-add-btn {
  position: absolute;
  top: 16px;
  right: 54px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #c9d8ff;
  border-radius: 6px;
  background: #f0f5ff;
  color: #2962ff;
  font: 500 13px/1 -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

#ot-img-add-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

#ot-img-add-btn:hover {
  background: #e4edff;
  border-color: #9fbaff;
  box-shadow: 0 1px 3px rgba(41, 98, 255, .14);
}

#ot-img-add-btn:active {
  background: #d8e5ff;
}

#ot-img-add-btn:focus-visible {
  outline: 2px solid #2962ff;
  outline-offset: 2px;
}

/* 识图面板 */
.ot-img-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(19, 23, 34, .45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
}

.ot-img-overlay.is-open {
  display: flex;
  animation: ot-img-fade .16s ease-out;
}

.ot-img-panel {
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 24px));
  max-height: min(88vh, 720px);
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  color: #131722;
  box-shadow: 0 18px 48px rgba(10, 16, 30, .32);
  animation: ot-img-rise .2s cubic-bezier(.2, .8, .3, 1);
}

.ot-img-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #eef0f4;
}

.ot-img-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: #131722;
}

.ot-img-head p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 17px;
  color: #7a7e89;
}

.ot-img-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: -2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5d606b;
  cursor: pointer;
}

.ot-img-close:hover {
  background: #f0f2f6;
  color: #131722;
}

.ot-img-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 10px;
  overscroll-behavior: contain;
}

.ot-img-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 164px;
  padding: 20px 16px;
  border: 1.5px dashed #cfd4de;
  border-radius: 10px;
  background: #f8f9fb;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.ot-img-drop:hover,
.ot-img-drop:focus-visible,
.ot-img-drop.is-drag {
  border-color: #2962ff;
  background: #f2f6ff;
  outline: none;
}

.ot-img-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e9f0ff;
  color: #2962ff;
}

.ot-img-drop-icon svg {
  width: 21px;
  height: 21px;
}

.ot-img-drop strong {
  font-size: 14px;
  font-weight: 600;
  color: #2a2e39;
}

.ot-img-drop span {
  max-width: 360px;
  font-size: 12px;
  line-height: 17px;
  color: #7a7e89;
}

/* 预览 */
.ot-img-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ot-img-preview[hidden] {
  display: none;
}

.ot-img-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 196px;
  overflow: hidden;
  border: 1px solid #e0e3eb;
  border-radius: 8px;
  background: #f5f6f8;
}

.ot-img-preview img {
  display: block;
  max-width: 100%;
  max-height: 194px;
  object-fit: contain;
}

.ot-img-repick {
  padding: 5px 10px;
  border: 1px solid #e0e3eb;
  border-radius: 5px;
  background: #fff;
  color: #4a4f57;
  font: 12px/18px inherit;
  cursor: pointer;
}

.ot-img-repick:hover {
  border-color: #c1c7d2;
  color: #131722;
}

/* 状态 */
.ot-img-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f6f8fb;
  color: #4a4f57;
  font-size: 12.5px;
  line-height: 18px;
  word-break: break-word;
}

.ot-img-status[hidden] {
  display: none;
}

.ot-img-status.is-done {
  background: #effaf6;
  color: #067a67;
}

.ot-img-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid #c9d8ff;
  border-top-color: #2962ff;
  border-radius: 50%;
  animation: ot-img-spin .8s linear infinite;
}

.ot-img-status:not(.is-busy) .ot-img-spinner {
  display: none;
}

/* 识别结果 */
.ot-img-results {
  margin-top: 12px;
}

.ot-img-results[hidden] {
  display: none;
}

.ot-img-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 6px;
  font-size: 12px;
  color: #6a6f7a;
}

.ot-img-check-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #30343f;
  font-weight: 500;
}

.ot-img-results-head input,
.ot-img-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #2962ff;
  cursor: pointer;
}

.ot-img-list {
  max-height: 264px;
  overflow-y: auto;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  overscroll-behavior: contain;
}

.ot-img-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 11px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
}

.ot-img-row:last-child {
  border-bottom: 0;
}

.ot-img-row:hover {
  background: #f8f9fb;
}

.ot-img-row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

.ot-img-ticker {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 18px;
  color: #131722;
}

.ot-img-name {
  overflow: hidden;
  font-size: 11.5px;
  line-height: 16px;
  color: #7a7e89;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ot-img-row-state {
  flex: none;
  min-width: 48px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f3f7;
  color: #6a6f7a;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}

.ot-img-row-state.is-busy {
  background: #eef3ff;
  color: #2962ff;
}

.ot-img-row-state.is-ok {
  background: #e8f7f1;
  color: #067a67;
}

.ot-img-row-state.is-warn {
  background: #fff6e5;
  color: #a56a00;
}

.ot-img-note {
  margin: 8px 2px 0;
  font-size: 11px;
  line-height: 16px;
  color: #9a9ea8;
}

/* 底部操作 */
.ot-img-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
  padding: 12px 18px;
  border-top: 1px solid #eef0f4;
  background: #fff;
}

.ot-img-foot button {
  min-width: 84px;
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  font: 500 13px/1 inherit;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}

.ot-img-cancel {
  border: 1px solid #e0e3eb;
  background: #fff;
  color: #4a4f57;
}

.ot-img-cancel:hover {
  background: #f6f7f9;
  color: #131722;
}

.ot-img-submit {
  border: 1px solid #2962ff;
  background: #2962ff;
  color: #fff;
}

.ot-img-submit:hover:not(:disabled) {
  background: #1e53e5;
  border-color: #1e53e5;
}

.ot-img-submit:disabled {
  opacity: .5;
  cursor: default;
}

.ot-img-foot button:disabled {
  opacity: .5;
  cursor: default;
}

.ot-img-foot button:focus-visible,
.ot-img-close:focus-visible,
.ot-img-repick:focus-visible {
  outline: 2px solid #2962ff;
  outline-offset: 2px;
}

@keyframes ot-img-spin {
  to { transform: rotate(360deg); }
}

@keyframes ot-img-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ot-img-rise {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* 手机端 */
@media (max-width: 560px) {
  #ot-img-add-btn {
    top: 14px;
    right: 44px;
    height: 32px;
    padding: 0 9px;
    font-size: 12px;
  }

  .ot-img-overlay {
    padding: 8px;
  }

  .ot-img-panel {
    width: calc(100vw - 12px);
    max-height: 94vh;
    border-radius: 12px;
  }

  .ot-img-head {
    padding: 13px 14px 10px;
  }

  .ot-img-head h3 {
    font-size: 15px;
  }

  .ot-img-body {
    padding: 12px 14px 8px;
  }

  .ot-img-drop {
    min-height: 138px;
    padding: 16px 12px;
  }

  .ot-img-preview-frame {
    max-height: 164px;
  }

  .ot-img-preview img {
    max-height: 162px;
  }

  .ot-img-list {
    max-height: 34vh;
  }

  .ot-img-row {
    min-height: 42px;
    padding: 6px 10px;
  }

  .ot-img-foot {
    padding: 10px 14px;
  }

  .ot-img-foot button {
    flex: 1 1 0;
    height: 38px;
  }
}

/* 已在自选的标的：整行弱化，复选框禁用，避免重复添加 */
.ot-img-row.is-existing {
  opacity: 0.72;
}
.ot-img-row.is-existing .ot-img-row-info {
  color: var(--ot-img-muted, #8b8f98);
}

/* 咚咚看盘 · 自选分组删除/撤销增量层样式
 * 尽量复用站点已有的 CSS 变量与按钮类，浅色/深色主题下都保持一致。
 */

.dg-undo-btn[hidden] {
  display: none !important;
}

.dg-undo-btn {
  color: var(--color-default-gray, #787b86);
}

.dg-undo-btn:hover {
  color: var(--color-main-text, #131722);
}

.dg-group-delete {
  /* 复用应用原生 .watchlist-group-delete 的尺寸/定位，这里只保证点击事件可用 */
  pointer-events: auto;
}

.dg-undo-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid var(--color-border, rgba(128, 128, 128, 0.25));
  border-radius: 8px;
  background: var(--ot-chart-bg, #fff);
  color: var(--color-main-text, #131722);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.dg-undo-toast--show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dg-undo-toast__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dg-undo-toast__undo {
  flex: 0 0 auto;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--color-link, #2962ff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dg-undo-toast__undo:hover {
  text-decoration: underline;
}

.dg-undo-toast__close {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--color-default-gray, #787b86);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.dg-undo-toast__close:hover {
  background: var(--color-list-item-bg-hover, rgba(128, 128, 128, 0.12));
  color: var(--color-main-text, #131722);
}

#ot-settings-panel :focus-visible,
#ot-mq-actions :focus-visible,
#ot-mq-nav :focus-visible,
#ot-top-settings-btn:focus-visible {
  outline: 2px solid var(--color-brand, #2962ff);
  outline-offset: 2px;
}
#ot-settings-panel :is(:disabled, [aria-disabled="true"]) { opacity: .6; cursor: default; }
#ot-settings-panel .ot-settings-hint:empty { display: none; }
#ot-settings-status { white-space: normal; overflow-wrap: anywhere; }
#ot-mq-actions .mq-actions-title { display: flex; align-items: center; justify-content: space-between; }
#ot-mq-actions .mq-actions-close {
  min-width: 32px; min-height: 32px; color: inherit; background: transparent;
  border: 0; border-radius: 5px; font-size: 20px; cursor: pointer;
}
#ot-mq-actions .mq-actions-panel { max-height: 90dvh; overflow-y: auto; box-sizing: border-box; }

#dd-market-clock {
  box-sizing: border-box; position: fixed; inset: 0; margin: auto; height: fit-content; width: min(27rem, calc(100vw - 24px)); max-height: calc(100dvh - 28px); overflow: auto;
  padding: 20px; border: 1px solid var(--color-border, #b7c3cf); border-radius: 12px;
  background: var(--color-popup-background, var(--color-bg, Canvas)); color: var(--color-main-text, CanvasText);
  box-shadow: 0 12px 44px #14233338; font: 14px/1.5 -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
#dd-market-clock::backdrop { background: rgb(18 31 43 / .38); }
#dd-market-clock header, #dd-market-clock .dd-clock-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#dd-market-clock h2 { margin: 0; font-size: 19px; font-weight: 650; }
#dd-market-clock h3 { margin: 12px 0 0; font-size: 13px; }
#dd-market-clock .dd-clock-inputs { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin: 20px 0 8px; }
#dd-market-clock label { display: grid; gap: 4px; min-width: 0; }
#dd-market-clock :is(input, select, button) { box-sizing: border-box; min-width: 0; max-width: 100%; min-height: 36px; font: inherit; color: inherit; background: transparent; border: 1px solid var(--color-border, #aab6c3); border-radius: 5px; padding: 3px 8px; }
#dd-market-clock select option { background: Canvas; color: CanvasText; }
#dd-market-clock button { cursor: pointer; } #dd-market-clock button:disabled { opacity: .55; cursor: default; }
#dd-market-clock :focus-visible { outline: 2px solid var(--color-brand, #2962c5); outline-offset: 2px; }
#dd-market-clock [data-mode] { font-size: 12px; }
#dd-market-clock [data-error]:not(:empty) { margin-top: 12px; }
#dd-market-clock dl { display: grid; grid-template-columns: max-content 1fr; margin: 12px 0 0; }
#dd-market-clock :is(dd,dt) { margin: 0; padding: 8px 0; border-top: 1px solid var(--color-border, #b7c3cf); }
#dd-market-clock dd { font: 500 14px/1.5 ui-monospace, Consolas, monospace; text-align: end; font-variant-numeric: tabular-nums; white-space: pre-wrap; }
@media(max-width: 380px) { #dd-market-clock .dd-clock-inputs { grid-template-columns: 1fr; } }
[data-dd-clock-load-error] { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 14px; z-index: 2147483200; color: #fff; background: #263444; border-radius: 6px; font: 14px/1.5 system-ui,sans-serif; }
#dd-market-clock [hidden] { display: none; }
#dd-market-clock .dd-clock-controls { flex-wrap: wrap; }
#dd-market-clock :is(.dd-clock-actions, .dd-clock-presets, .dd-clock-copy) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#dd-market-clock :is(.dd-clock-presets, .dd-clock-copy, [data-fold]) { margin-top: 12px; }
#dd-market-clock :is(#dd-clock-preset-title, [data-copy-status], dd small) { font-size: 12px; }
#dd-market-clock dd small { display: block; font-family: inherit; }
#dd-market-clock [data-manual-copy] { display: block; box-sizing: border-box; width: 100%; margin-top: 8px; padding: 6px; color: inherit; background: transparent; font: inherit; }
#dd-market-clock [data-manual-copy][hidden] { display: none; }

/*!
 * 咚咚看盘 · 设计审计 v5.2（dd-audit-v5）
 * 目标：对齐 TradingView 的克制规则 —— 单一强调色、颜色只表达涨跌、每列一个值、靠留白而非线条分组、多图图例精简、KD 套件风格统一。
 * 只做表现层覆盖：不改 K 线引擎、不改数据、不改用户图表设置；删除本文件即可完全回滚。
 */

:root {
  --dd5-ink: #131722;
  --dd5-ink-2: #3b3f4a;
  --dd5-muted: #6a6d78;
  --dd5-faint: #a3a6af;
  --dd5-line: #eef0f3;
  --dd5-hover: #f4f5f7;
  --dd5-sel: color-mix(in srgb, var(--dd-ui-brand, #4f46e5) 8%, #ffffff);
  --dd5-up: var(--color-symbol-change-positive, #089981);
  --dd5-down: var(--color-falling, #f23645);
  --dd5-track: #e6e8ec;
  --dd5-frost: rgba(255, 255, 255, .86);
  --dd5-radius: 6px;
}
:root.theme-dark,
:root[data-theme="dark"],
:root[data-dd-mode="dark"] {
  --dd5-ink: #e3e5ea;
  --dd5-ink-2: #c4c7cf;
  --dd5-muted: #8b8f9b;
  --dd5-faint: #5d616d;
  --dd5-line: #20242f;
  --dd5-hover: #1b1f2a;
  --dd5-sel: color-mix(in srgb, var(--dd-ui-brand, #6366f1) 16%, #131722);
  --dd5-track: #2a2f3c;
  --dd5-frost: rgba(19, 23, 34, .84);
}

/* ============ 1. 强调色纪律与顶栏瘦身 ============ */
/* 周期按钮 & 左侧绘图工具：选中态改为浅品牌底 + 品牌色文字，告别实心大色块 */
html #root .header-toolbar-btn[data-name^="interval-"].active {
  color: var(--dd-ui-brand) !important;
  font-weight: 650;
}
html #root .header-toolbar-btn[data-name^="interval-"].active::before {
  background-color: var(--dd5-sel) !important;
  box-shadow: none !important;
  border-radius: 6px !important;
}
html #root .header-toolbar-btn[data-name^="interval-"]:not(.active) {
  background-color: transparent !important;
}
html #root .drawing-tool-btn:is(.active, .selected, [aria-pressed="true"]) {
  color: var(--dd-ui-brand) !important;
}
html #root .drawing-tool-btn:is(.active, .selected, [aria-pressed="true"])::before {
  background-color: var(--dd5-sel) !important;
  box-shadow: none !important;
  border-radius: 7px !important;
}

/* 顶栏两层整体瘦身：标签栏 32px + 工具栏 34px（比原版省出 12px 垂直看盘空间） */
:root {
  --dd-tab-active-bg: var(--dd-ui-panel, #ffffff);
  --dd-tab-active-ink: var(--dd5-ink);
  --dd-tab-active-sub: var(--dd5-muted);
  --dd-tab-active-up: var(--dd5-up);
  --dd-tab-active-down: var(--dd5-down);
  --dd-tab-active-shadow: inset 0 -2px 0 var(--dd-ui-brand), 0 1px 2px rgba(15, 23, 42, .06);
}
:root.theme-dark, :root[data-theme="dark"], :root[data-dd-mode="dark"] {
  --dd-tab-active-bg: #1a202e;
  --dd-tab-active-shadow: inset 0 -2px 0 var(--dd-ui-brand);
}
html #root .tab-bar {
  height: 32px !important;
  box-shadow: inset 0 -1px var(--dd5-line) !important;
}
html #root .tabs .tab {
  height: 24px !important;
  border-radius: 6px !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px;
}
html #root .tabs .tab:not(.active):hover {
  background: var(--dd5-hover) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html #root .tabs .tab.active {
  background: var(--dd-tab-active-bg) !important;
  border: 1px solid var(--dd5-line) !important;
  box-shadow: var(--dd-tab-active-shadow) !important;
}
html #root .tabs .tab.active .tab-close-btn { color: var(--dd5-muted) !important; }
html #root .tabs .tab.active .tab-close-btn:hover { background: var(--dd5-hover) !important; color: var(--dd5-ink) !important; }
html #root .tab-bar .create-new-tab-button {
  flex: 0 0 24px !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 6px !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}
html #root .tab-bar .create-new-tab-button:hover {
  background: var(--dd5-hover) !important;
  border-color: transparent !important;
  color: var(--dd5-ink) !important;
}

/* 桌面端：左侧已有品牌主菜单（.header-toolbar-profile），隐藏顶栏右侧重复的 ... 主菜单 */
@media (min-width: 769px) {
  html #root:has(.header-toolbar-profile) .tab-bar .main-menu-button {
    display: none !important;
  }
}

/* 顶部「浅色/暗色」主题按钮：中性、低调 */
html .dd-top-theme-btn {
  height: 24px !important;
  padding: 0 8px 0 6px !important;
  border-radius: 6px !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--dd5-muted) !important;
  font-weight: 500 !important;
}
html .dd-top-theme-btn:hover { background: var(--dd5-hover) !important; color: var(--dd5-ink) !important; }
html .dd-top-theme-ico { color: currentColor !important; }
html #root .tab-bar #ot-top-settings-btn {
  width: 26px !important;
  height: 24px !important;
  border-radius: 6px !important;
}

/* 图表工具栏：34px 紧凑清爽，符号搜索框去重影 */
html #root .header-toolbar {
  height: 34px !important;
  font-size: 13px !important;
}
html #root .header-toolbar-btn,
html #root .header-toolbar-profile {
  height: 34px !important;
}
html #root .header-toolbar-widget.is-symbol {
  height: 26px !important;
  border-radius: 7px !important;
  box-shadow: inset 0 0 0 1px var(--dd5-line) !important;
}
html #root .header-toolbar-widget.is-symbol:hover {
  box-shadow: inset 0 0 0 1px var(--dd-ui-keyline, #d4d4d8) !important;
}

/* 修复布局按钮（原 flex-direction: column 导致「布局」和「保存」上下错位）→ 改为清爽单行 */
html #root [data-name="all-changes-saved"].header-toolbar-save-status {
  flex-direction: row !important;
  align-items: center !important;
  gap: 5px !important;
  max-width: 220px !important;
  padding: 0 7px !important;
  line-height: 1 !important;
}
html #root [data-name="all-changes-saved"] .header-toolbar-save-name {
  white-space: nowrap !important;
  font-size: 12.5px !important;
  font-weight: 500;
  color: var(--dd5-ink-2);
}
html #root [data-name="all-changes-saved"] .header-toolbar-save-name::before {
  content: "布局 ";
  color: var(--dd5-faint);
  font-weight: 400;
  margin-right: 1px;
}
html #root [data-name="all-changes-saved"] .header-toolbar-save-action {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--dd5-sel);
  color: var(--dd-ui-brand) !important;
  font-size: 11px !important;
  font-weight: 600;
  white-space: nowrap;
}

/* 多图布局的活动图框：1px 安静描边 */
html #root .chart-grid:not([data-layout="s"]) .chart-grid-cell.is-active::after {
  border-width: 1px !important;
}

/* ============ 2. 图表图例：标的标题、行情和主图指标 ============ */
html #root .ot-legend-stack {
  gap: 2px;
}
html #root .ot-legend-titles,
html #root .ot-legend-values,
html #root .ot-ind-legend-row {
  background: var(--dd5-frost) !important;
  border-radius: 4px !important;
}
html #root .ot-legend-item {
  min-height: 20px !important;
  column-gap: 4px !important;
  row-gap: 1px !important;
}
html #root .ot-legend-titles {
  min-height: 26px !important;
  padding: 1px 4px 1px 2px !important;
  line-height: 24px !important;
}
html #root .ot-legend-logo img {
  width: 16px !important;
  height: 16px !important;
}
html #root .ot-legend-symbol {
  font-size: 20px !important;
  font-weight: 700 !important;
  line-height: 24px;
  letter-spacing: 0 !important;
}
html #root .ot-legend-title-piece {
  font-size: 12px !important;
}
html #root .ot-legend-action[data-action="flag"] {
  width: 15px !important;
  height: 18px !important;
  opacity: .72;
}
html #root .ot-legend-action[data-action="flag"] svg {
  width: 10px !important;
  height: 10px !important;
}
html #root .ot-legend-action[data-action="flag"]:hover {
  opacity: 1;
}
/* 时段小图标默认降噪，悬停图例时还原 */
html #root .ot-legend-status-pill {
  filter: grayscale(1);
  opacity: .55;
  transform: scale(.86);
}
html #root .ot-legend-stack:hover .ot-legend-status-pill {
  filter: none;
  opacity: 1;
}
html #root .ot-legend-values {
  width: fit-content !important;
  max-width: 100%;
  padding: 1px 4px !important;
  font-size: 11px !important;
  line-height: 17px !important;
  column-gap: 4px !important;
  white-space: nowrap;
}
html #root .ot-legend-change {
  font-size: 11px !important;
}
html #root :is(.ot-ind-legend-title, .ot-ind-legend-val) {
  font-size: 11px !important;
}
html #root .ot-ind-legend-row {
  min-height: 18px !important;
  padding: 0 5px !important;
  line-height: 17px !important;
}

/* 多图布局使用标的代码，窗格悬停时原位显示完整 OHLC。 */
html #root .chart-grid:not([data-layout="s"]) .ot-legend-item {
  flex-direction: column !important;
  align-items: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 1px !important;
}
html #root .chart-grid:not([data-layout="s"]) .ot-legend-symbol[data-dd5-tk] { font-size: 0 !important; }
html #root .chart-grid:not([data-layout="s"]) .ot-legend-symbol[data-dd5-tk]::before {
  content: attr(data-dd5-tk);
  font-size: 20px;
}
html #root .chart-grid:not([data-layout="s"]) .ot-legend-title-piece.ot-legend-dot:not(.ot-legend-with-action) {
  display: none !important;
}
html #root .chart-grid:not([data-layout="s"]) .ot-legend-stack:not(:hover) .ot-legend-status-pill {
  display: none !important;
}
/* OHLC 固定单行高度（18px），静息态与悬停态高度完全一致，0px 跳动 */
html #root .chart-grid:not([data-layout="s"]) .ot-legend-values {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  height: 18px !important;
  line-height: 18px !important;
  font-size: 10.5px !important;
  column-gap: 3px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
}
html #root .chart-grid:not([data-layout="s"]) .ot-legend-change {
  font-size: 10.5px !important;
}
/* 静息态隐藏 O / H / L，只保留收盘价与涨跌幅 */
html #root .chart-grid:not([data-layout="s"]) .chart-grid-cell:not(:hover) .ot-legend-values .ot-legend-value-item:nth-child(-n+3),
html #root .chart-grid:not([data-layout="s"]) .chart-grid-cell:not(:hover) .ot-legend-values .ot-legend-value-item:nth-child(4) .ot-legend-value-title {
  display: none !important;
}
/* 浮动常用绘图工具条：对齐 v5 边框质感 */
html #root .favorites-toolbar {
  border-radius: 7px !important;
  border: 1px solid var(--dd5-line) !important;
}
/* 主图指标使用各自的名称、数值和下方的图例箭头。 */
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-row {
  background: color-mix(in srgb, var(--ot-chart-bg) 78%, transparent) !important;
  border-radius: 2px !important;
  padding-inline: 3px !important;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend :is(.ot-ind-legend-title, .ot-ind-legend-val) {
  font-size: 12px !important;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-values {
  column-gap: 5px;
  font-variant-numeric: tabular-nums;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-toggler-wrap {
  padding: 2px 3px;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-toggler {
  border-color: var(--dd5-line);
  border-radius: 3px !important;
  color: var(--dd-ui-muted);
  cursor: pointer;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-toggler:focus-visible {
  outline: 2px solid var(--dd-ui-focus);
  outline-offset: 1px;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-toggler-arrow {
  width: 23px;
}
html #root .ot-legend-stack:has(> .ot-legend) > .ot-ind-legend .ot-ind-legend-toggler-count {
  display: none;
}

/* ============ 3. 自选列表：对标 TradingView 清晰度与对齐 ============ */
/* 标题栏与筛选行融为一体，去掉多余横线 */
html #root .watchlist .ot-panel-header {
  box-shadow: none !important;
  min-height: 36px;
}
html #root .watchlist .dg-fav-bar {
  gap: 4px !important;
  padding: 2px 10px 6px !important;
  border-bottom-color: var(--dd5-line) !important;
}
html #root .watchlist .dg-fav-chip {
  min-height: 24px !important;
  padding: 0 7px !important;
  background: transparent !important;
  border-color: transparent !important;
  border-radius: 5px !important;
  color: var(--dd5-muted) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
html #root .watchlist .dg-fav-chip:hover { background: var(--dd5-hover) !important; color: var(--dd5-ink) !important; }
html #root .watchlist .dg-fav-chip.is-active,
html #root .watchlist .dg-fav-chip[aria-pressed="true"] {
  background: var(--dd5-hover) !important;
  color: var(--dd5-ink) !important;
  font-weight: 600 !important;
}
html #root .watchlist .dg-fav-search-shell .dg-fav-search {
  height: 24px !important;
  min-height: 24px !important;
  background: var(--dd5-hover) !important;
  border-color: transparent !important;
  border-radius: 6px !important;
  font-size: 12px !important;
}
html #root .watchlist .dg-fav-search-shell .dg-fav-search:focus {
  background: var(--dd-ui-panel, #ffffff) !important;
  border-color: var(--dd-ui-brand) !important;
}
html #root .watchlist .dg-fav-hint { display: none !important; }

/* 涨跌色切换：克制的双色小圆点（悬停有说明） */
html #root .watchlist .dd-color-chip {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0 !important;
  border-color: transparent !important;
  font-size: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html #root .watchlist .dd-color-chip i { display: none; }
html #root .watchlist .dd-color-chip::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dd5-up) 0 50%, var(--dd5-down) 50% 100%);
  opacity: .85;
}
html.dd-cn-colors #root .watchlist .dd-color-chip::before {
  background: linear-gradient(135deg, var(--dd5-down) 0 50%, var(--dd5-up) 50% 100%);
}

/* 表头：小号灰字，极细底线 */
html #root .watchlist .watchlist-column-headers {
  background: transparent !important;
  box-shadow: inset 0 -1px var(--dd5-line);
}
html #root .watchlist .watchlist-column-label {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--dd5-muted) !important;
}
html #root .watchlist .watchlist-column-flag-btn,
html #root .watchlist .watchlist-column-flag { color: var(--dd5-faint) !important; opacity: .7; }

/* 分组头：同色不透明背景（防止 sticky 滚动透字穿帮），靠留白节奏而非线条区分 */
html #root .watchlist .watchlist-group {
  background-color: var(--dd-ui-rail, #f8f9fb) !important;
  box-shadow: none !important;
  border: 0 !important;
  color: var(--dd5-muted) !important;
  height: 36px !important;
  padding-top: 12px !important;
  padding-bottom: 2px !important;
}
html #root .watchlist .watchlist-group:first-child {
  height: 28px !important;
  padding-top: 4px !important;
}
html #root .watchlist .watchlist-group:hover {
  background-color: var(--dd5-hover) !important;
}
html #root .watchlist .watchlist-group-label {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  letter-spacing: .01em;
}
html #root .watchlist .watchlist-group-expand { color: var(--dd5-faint) !important; }

/* 列表行：去行线、等宽数字、左对齐 Logo、把星标移到代码右侧避免左侧空白错位 */
html #root .watchlist .watchlist-row {
  border-bottom-color: transparent !important;
  font-size: 13px !important;
}
html #root .watchlist .watchlist-row:not(.selected):hover { background-color: var(--dd5-hover) !important; }
html #root .watchlist .watchlist-row:is(.selected, .is-selected, [aria-selected="true"]) {
  outline: none !important;
  box-shadow: none !important;
  background-color: var(--dd5-sel) !important;
  color: inherit !important;
}
html #root .watchlist .watchlist-symbol {
  padding-inline-start: 16px !important;
  gap: 6px !important;
}
html #root .watchlist .watchlist-symbol .dg-fav-star {
  order: 10 !important;
  margin-inline-start: auto !important;
  width: 14px !important;
  min-width: 14px !important;
  font-size: 11.5px !important;
}
html #root .watchlist .watchlist-row:not(.dg-fav):not(:hover):not(.selected) .dg-fav-star:not(:focus-visible) {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden;
  opacity: 0 !important;
}
html #root .watchlist .watchlist-logo {
  width: 18px !important;
  height: 18px !important;
}
html #root .watchlist .watchlist-ticker {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--dd5-ink) !important;
}
html #root .watchlist .watchlist-status-dot { transform: scale(.78); }

html #root .watchlist .watchlist-row .watchlist-cell:not(.watchlist-symbol) {
  font-size: 13px !important;
  font-variant-numeric: tabular-nums;
}
html #root .watchlist .watchlist-row .watchlist-cell:not(.watchlist-symbol):not(.up):not(.down) { color: var(--dd5-ink) !important; }
html #root .watchlist .watchlist-row .watchlist-cell:is(.up, .down) { font-weight: 500; }

/* 盘前/盘后列：单行只显示涨跌幅（价格放悬停提示与详情面板） */
html #root .watchlist .watchlist-row .watchlist-cell.dd-two { display: block !important; }
html #root .watchlist .watchlist-row .watchlist-cell.dd-two > .ot-value { display: none !important; }
html #root .watchlist .watchlist-row .watchlist-cell.dd-two > .dd-sub {
  font-size: 13px !important;
  line-height: inherit !important;
  opacity: 1 !important;
}
html #root .watchlist .watchlist-row .watchlist-cell .ot-value:empty::before { color: var(--dd5-faint) !important; }
html #root .watchlist .watchlist-row .watchlist-cell.dd5-ext .ot-value:empty::before { content: "" !important; }

/* ============ 4. 详情面板：完整露出两条区间条 + 克制盘前状态 ============ */
html #root .watchlist-detail-body {
  gap: 4px !important;
  padding: 6px 14px 10px !important;
}
html #root .watchlist-detail-price-row {
  margin-top: 2px !important;
}
html #root .watchlist-detail-price {
  font-size: 25px !important;
  line-height: 30px !important;
}
html #root .watchlist-detail-ext-price {
  font-size: 15px !important;
}
html #root .watchlist-detail-state.is-extended,
html #root .watchlist-detail-state.is-extended .watchlist-detail-state-icon {
  color: var(--dd5-muted) !important;
}
html #root .watchlist-detail-state.is-extended { font-weight: 500; }
html #root .watchlist-detail-state-icon svg { width: 12px; height: 12px; }
html #root .watchlist-detail-regular-update.dd5-has-rel { display: none !important; }
html #root .dd5-upd { color: var(--dd5-faint); font-size: 12px; margin-left: 6px; cursor: default; }
html #root :is(.watchlist-detail-price, .watchlist-detail-ext-price, .watchlist-detail-change, .watchlist-detail-stat-value, .watchlist-detail-range span) {
  font-variant-numeric: tabular-nums;
}
html #root .watchlist-detail-currency { color: var(--dd5-faint) !important; font-size: 11px !important; }

/* 区间条：当日波幅 & 52周范围 */
html #root .watchlist-detail-range.dd5-range {
  display: grid !important;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 3px;
  padding-block: 2px 4px;
}
html #root .watchlist-detail-range.dd5-range .watchlist-detail-range-low { grid-column: 1; grid-row: 1; }
html #root .watchlist-detail-range.dd5-range .watchlist-detail-range-label {
  grid-column: 2; grid-row: 1;
  text-align: center;
  font-size: 11px !important;
  color: var(--dd5-muted) !important;
}
html #root .watchlist-detail-range.dd5-range .watchlist-detail-range-high { grid-column: 3; grid-row: 1; text-align: right; }
html #root .watchlist-detail-range.dd5-range :is(.watchlist-detail-range-low, .watchlist-detail-range-high) {
  font-size: 12px !important;
  color: var(--dd5-ink-2) !important;
}
html #root .dd5-range-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--dd5-track);
}
html #root .dd5-range-bar > i {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--dd5-ink);
  box-shadow: 0 0 0 2px var(--dd-ui-rail, #ffffff);
}
html #root .dd5-range-bar > b {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--dd5-ink) 28%, transparent);
}

/* ============ 5. 底部栏：等宽数字与轻边界 ============ */
html #root .chart-controls-bar.bottom-bar {
  font-size: 12px !important;
  box-shadow: inset 0 1px var(--dd5-line) !important;
}

/* ============ 6. KD 套件深度风格统一（跟随咚咚 v5 色彩、圆角、密度与右侧锚点） ============ */
:root {
  --kd-up: var(--dd5-up) !important;
  --kd-down: var(--dd5-down) !important;
  --kd-gold: var(--dd5-up) !important;
  --kd-death: var(--dd5-down) !important;
  --kd-radius: 8px !important;
}
html.dd-cn-colors {
  --kd-up: var(--dd5-down) !important;
  --kd-down: var(--dd5-up) !important;
}

/* KD 入口收进右侧边栏，1.5px 线框风格对齐原生按钮 */
html.dd5-kd-railed #kd-dock { display: none !important; }
.dd5-rail-kd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 6px;
}
.dd5-rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dd5-muted);
  font: 600 10.5px/1 var(--dd-ui-font, system-ui);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: background-color .12s ease, color .12s ease;
}
.dd5-rail-btn[hidden] { display: none; }
.dd5-rail-btn:hover { background: var(--dd5-hover); color: var(--dd5-ink); }
.dd5-rail-btn.is-active { background: var(--dd5-sel); color: var(--dd-ui-brand); }
.dd5-rail-btn small { font: 500 10px/1 var(--dd-ui-font, system-ui); letter-spacing: 0; }
.dd5-rail-btn .dd5-dot {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dd5-up);
}
.dd5-rail-btn.is-locked .dd5-dot { background: var(--dd5-faint); }
.dd5-rail-btn.is-offline .dd5-dot { background: var(--dd5-down); }
.dd5-rail-btn svg { width: 17px; height: 17px; }

/* KD 工作台抽屉：从右侧边栏旁就近展开，不再从远端左侧弹出 */
@media (min-width: 769px) {
  html.dd5-kd-railed #kd-workbench {
    left: auto !important;
    right: 50px !important;
    top: 38px !important;
    bottom: 10px !important;
    border-radius: 10px !important;
    border-color: var(--dd5-line) !important;
  }
}

/* KD 抽屉 / 选股器 / 弹窗：统一克制圆角、浅底选中态与自选级信息密度 */
html .kd-modal,
html .kd-scr-shell {
  border-radius: 10px !important;
  border-color: var(--dd5-line) !important;
}
html .kd-card,
html .kd-kpi,
html .kd-scr-cond-pill,
html .dd-kd-gap-row {
  border-radius: 6px !important;
  border-color: var(--dd5-line) !important;
}
html .kd-btn,
html .kd-input,
html .kd-select,
html .kd-textarea {
  border-radius: 6px !important;
}
html .kd-wb-tab {
  border-radius: 6px !important;
  font-weight: 500 !important;
}
html .kd-wb-tab.is-active,
html .kd-seg button.is-on {
  background: var(--dd5-sel) !important;
  color: var(--dd-ui-brand) !important;
  font-weight: 600 !important;
}
html .kd-seg {
  border-radius: 6px !important;
  border-color: var(--dd5-line) !important;
}
html .kd-seg button {
  border-radius: 4px !important;
}
html .kd-chip {
  border-radius: 4px !important;
  font-weight: 500 !important;
}
html .kd-scr-table th {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  border-bottom-color: var(--dd5-line) !important;
}
html .kd-scr-table td {
  border-bottom-color: var(--dd5-line) !important;
  font-size: 12.5px !important;
}
html .kd-scr-table tbody tr:hover,
html .kd-row-item.is-clickable:hover {
  background: var(--dd5-hover) !important;
}
html .dd-kd-detail-box {
  margin-top: 6px !important;
  padding-top: 8px !important;
  border-top-color: var(--dd5-line) !important;
}
html .dd-kd-detail-title {
  font-size: 11px !important;
  font-weight: 600 !important;
}
