/* ==========================================================================
   DailyStock Investment Tools — Proposal 1 (추천 1안) High-Density Workspace
   Scoped to .ds-td-shell (average-price, split-buy, leveraged-rebalance)
   ========================================================================== */

.sd-tool-detail .ds-td-shell {
  --td-card-bg: #ffffff;
  --td-surface: #f8fafc;
  --td-surface-alt: #f1f5f9;
  --td-border: #dbe4f0;
  --td-border-strong: #cbd5e1;
  --td-line: #edf2f7;
  --td-text: #0f172a;
  --td-body: #1e293b;
  --td-sub: #334155;
  --td-muted: #64748b;
  --td-navy: #0b3d91;
  --td-navy-deep: #082a66;
  --td-blue: #1d4ed8;
  --td-blue-soft: #eff4ff;
  --td-up: #b91c1c;
  --td-up-bg: #fef2f2;
  --td-up-border: #fecaca;
  --td-down: #1d4ed8;
  --td-down-bg: #eff6ff;
  --td-down-border: #bfdbfe;
  --td-r-sm: 8px;
  --td-r-md: 10px;
  --td-r-lg: 12px;

  container-type: inline-size;
  container-name: ds-td-shell;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  color: var(--td-text);
}

.sd-tool-detail .ds-td-shell *,
.sd-tool-detail .ds-td-shell *::before,
.sd-tool-detail .ds-td-shell *::after {
  box-sizing: border-box;
}

.sd-tool-detail .ds-td-shell [hidden] {
  display: none !important;
}

.sd-tool-detail .ds-td-shell .ds-td-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Color & Status Pills (Korean Financial Standard: Up = Red, Down = Blue) */
.sd-tool-detail .ds-td-shell .ds-td-up { color: var(--td-up); }
.sd-tool-detail .ds-td-shell .ds-td-down { color: var(--td-down); }
.sd-tool-detail .ds-td-shell .ds-td-navy { color: var(--td-navy); }
.sd-tool-detail .ds-td-shell .ds-td-muted { color: var(--td-muted); font-weight: 500; }

.sd-tool-detail .ds-td-shell .ds-td-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-mini-pill {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-pill--up {
  background: var(--td-up-bg);
  color: var(--td-up);
  border: 1px solid var(--td-up-border);
}
.sd-tool-detail .ds-td-shell .ds-td-pill--down {
  background: var(--td-down-bg);
  color: var(--td-down);
  border: 1px solid var(--td-down-border);
}
.sd-tool-detail .ds-td-shell .ds-td-pill--navy {
  background: var(--td-blue-soft);
  color: var(--td-navy);
  border: 1px solid #bfdbfe;
}
.sd-tool-detail .ds-td-shell .ds-td-pill--flat {
  background: var(--td-surface-alt);
  color: var(--td-sub);
  border: 1px solid var(--td-border);
}

/* ==========================================================================
   Unified Top Calculator Switcher & Header Card
   ========================================================================== */
.sd-tool-detail .ds-td-shell .ds-td-topbar {
  background: var(--td-card-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sd-tool-detail .ds-td-shell .ds-td-topbar__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--td-line);
}

.sd-tool-detail .ds-td-shell .ds-td-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.sd-tool-detail .ds-td-shell .ds-td-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  background: #fff;
  color: var(--td-body);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.sd-tool-detail .ds-td-shell .ds-td-tab.is-secondary {
  color: var(--td-muted);
}
.sd-tool-detail .ds-td-shell .ds-td-tab:hover {
  background: var(--td-surface);
  border-color: var(--td-border-strong);
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-tab.is-active {
  background: var(--td-navy);
  border-color: var(--td-navy);
  color: #fff;
}

.sd-tool-detail .ds-td-shell .ds-td-topbar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.sd-tool-detail .ds-td-shell .ds-td-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 320px;
}

.sd-tool-detail .ds-td-shell .ds-td-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.sd-tool-detail .ds-td-shell .ds-td-title-row h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 850;
  letter-spacing: -0.025em;
  color: var(--td-text);
}

.sd-tool-detail .ds-td-shell .ds-td-state-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--td-blue-soft);
  border: 1px solid #bfdbfe;
  color: var(--td-navy);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-state-tag.is-holding {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.sd-tool-detail .ds-td-shell .ds-td-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--td-sub);
  word-break: keep-all;
}

.sd-tool-detail .ds-td-shell .ds-td-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.sd-tool-detail .ds-td-shell .ds-td-btn-util {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  background: #fff;
  color: var(--td-body);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.sd-tool-detail .ds-td-shell .ds-td-btn-util:hover {
  background: var(--td-blue-soft);
  border-color: #93c5fd;
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-btn-util--primary {
  background: var(--td-blue-soft);
  border-color: #bfdbfe;
  color: var(--td-navy);
}

/* ==========================================================================
   Left-Right Workspace Grid & Cards
   ========================================================================== */
.sd-tool-detail .ds-td-shell .ds-td-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@container ds-td-shell (min-width: 820px) {
  .sd-tool-detail .ds-td-shell .ds-td-workspace {
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  }
  .sd-tool-detail .ds-td-shell .ds-td-card--sticky {
    position: sticky;
    top: calc(var(--ds-header-h, 60px) + 14px);
  }
}

.sd-tool-detail .ds-td-shell .ds-td-card {
  background: var(--td-card-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.sd-tool-detail .ds-td-shell [data-td-result-body] {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.sd-tool-detail .ds-td-shell .ds-td-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.sd-tool-detail .ds-td-shell .ds-td-sec-head--divider {
  padding-top: 10px;
  border-top: 1px solid var(--td-line);
}
.sd-tool-detail .ds-td-shell .ds-td-sec-head h2,
.sd-tool-detail .ds-td-shell .ds-td-sec-head h3 {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.4;
  font-weight: 800;
  color: var(--td-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sd-tool-detail .ds-td-shell .ds-td-sec-head h2 i,
.sd-tool-detail .ds-td-shell .ds-td-sec-head h3 i {
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-sec-sub {
  font-size: 12px;
  color: var(--td-muted);
  font-weight: 600;
}

/* Segmented Controls */
.sd-tool-detail .ds-td-shell .ds-td-seg-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.sd-tool-detail .ds-td-shell .ds-td-seg {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 8px;
  background: var(--td-surface-alt);
  border: 1px solid var(--td-border);
  gap: 2px;
}
.sd-tool-detail .ds-td-shell .ds-td-seg--wide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.sd-tool-detail .ds-td-shell .ds-td-seg__btn {
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--td-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-seg__btn:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--td-text);
}
.sd-tool-detail .ds-td-shell .ds-td-seg__btn.is-active {
  background: #fff;
  color: var(--td-navy);
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Compact Input Fields */
.sd-tool-detail .ds-td-shell .ds-td-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.sd-tool-detail .ds-td-shell .ds-td-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sd-tool-detail .ds-td-shell .ds-td-inp-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-inp-box > span:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--td-sub);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  white-space: nowrap;
}

.sd-tool-detail .ds-td-shell .ds-td-inp-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-inp-wrap input,
.sd-tool-detail .ds-td-shell .ds-td-inp-wrap select {
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  background: var(--td-surface);
  color: var(--td-text);
  font-size: 13.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-inp-wrap select.ds-td-select {
  padding-right: 26px;
}
.sd-tool-detail .ds-td-shell .ds-td-inp-wrap input:focus,
.sd-tool-detail .ds-td-shell .ds-td-inp-wrap select:focus {
  outline: 2px solid var(--td-blue);
  outline-offset: 0;
  border-color: var(--td-blue);
  background: #fff;
}
.sd-tool-detail .ds-td-shell .ds-td-inp-unit {
  position: absolute;
  right: 9px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--td-muted);
  pointer-events: none;
  white-space: nowrap;
}

/* Quick Preset / Step Chips */
.sd-tool-detail .ds-td-shell .ds-td-chip-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.sd-tool-detail .ds-td-shell .ds-td-qchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--td-border);
  border-radius: 6px;
  background: #fff;
  color: var(--td-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-qchip:hover {
  border-color: #93c5fd;
  background: var(--td-blue-soft);
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-qchip.is-active {
  background: var(--td-navy);
  border-color: var(--td-navy);
  color: #fff;
}

/* Inline Buy Stage Spreadsheet Rows */
.sd-tool-detail .ds-td-shell .ds-td-sheet {
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-md);
  overflow: hidden;
  background: #fff;
}
.sd-tool-detail .ds-td-shell .ds-td-sheet__head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) 114px 30px;
  gap: 8px;
  padding: 8px 10px;
  background: var(--td-surface);
  border-bottom: 1px solid var(--td-border);
  font-size: 11.5px;
  font-weight: 750;
  color: var(--td-muted);
}
.sd-tool-detail .ds-td-shell .ds-td-sheet__head--split {
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 0.92fr) 128px 30px;
}
.sd-tool-detail .ds-td-shell .ds-td-sheet__head .is-right {
  text-align: right;
}

.sd-tool-detail .ds-td-shell .ds-td-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) 114px 30px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--td-line);
}
.sd-tool-detail .ds-td-shell .ds-td-row--split {
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 0.92fr) 128px 30px;
}
.sd-tool-detail .ds-td-shell .ds-td-row:last-child {
  border-bottom: 0;
}

.sd-tool-detail .ds-td-shell .ds-td-row-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--td-blue-soft);
  color: var(--td-navy);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.sd-tool-detail .ds-td-shell .ds-td-row-sub {
  text-align: right;
  font-size: 12px;
  font-weight: 750;
  color: var(--td-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-row-sub small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--td-muted);
}

.sd-tool-detail .ds-td-shell .ds-td-btn-del {
  min-height: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--td-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.sd-tool-detail .ds-td-shell .ds-td-btn-del:hover:not(:disabled) {
  background: var(--td-up-bg);
  color: var(--td-up);
  border-color: var(--td-up-border);
}
.sd-tool-detail .ds-td-shell .ds-td-btn-del:disabled {
  opacity: 0.28;
  cursor: default;
}

.sd-tool-detail .ds-td-shell .ds-td-btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  border: 1px dashed var(--td-border-strong);
  border-radius: var(--td-r-sm);
  background: var(--td-surface);
  color: var(--td-navy);
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  width: 100%;
}
.sd-tool-detail .ds-td-shell .ds-td-btn-add:hover {
  background: var(--td-blue-soft);
  border-color: #93c5fd;
}

.sd-tool-detail .ds-td-shell .ds-td-split-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.sd-tool-detail .ds-td-shell .ds-td-split-foot .ds-td-btn-add {
  flex: 1 1 200px;
}
.sd-tool-detail .ds-td-shell .ds-td-alloc-status {
  font-size: 12px;
  font-weight: 750;
  color: var(--td-sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-alloc-status.is-warn {
  color: var(--td-up);
}

.sd-tool-detail .ds-td-shell .ds-td-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--td-sub);
  cursor: pointer;
}
.sd-tool-detail .ds-td-shell .ds-td-inline-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--td-navy);
  margin: 0;
}

/* ETF Preset Chips & Slider (Leveraged Rebalance) */
.sd-tool-detail .ds-td-shell .ds-td-etf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip {
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  background: var(--td-surface);
  color: var(--td-text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip.is-active {
  border-color: var(--td-blue);
  background: var(--td-blue-soft);
  box-shadow: inset 0 0 0 1px var(--td-blue);
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip strong {
  font-size: 13px;
  font-weight: 850;
  color: var(--td-text);
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip.is-active strong {
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-etf-chip > span:last-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--td-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-tool-detail .ds-td-shell .ds-td-slider-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sd-tool-detail .ds-td-shell .ds-td-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 750;
  color: var(--td-sub);
}
.sd-tool-detail .ds-td-shell .ds-td-slider-head input[type="range"] {
  width: min(200px, 48%);
  accent-color: var(--td-navy);
  cursor: pointer;
}

.sd-tool-detail .ds-td-shell .ds-td-principle-box {
  padding: 10px 12px;
  border-radius: var(--td-r-sm);
  background: var(--td-surface);
  border: 1px solid var(--td-border);
  font-size: 12.5px;
  color: var(--td-sub);
  line-height: 1.55;
  word-break: keep-all;
}
.sd-tool-detail .ds-td-shell .ds-td-principle-box > strong:first-child {
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-principle-box code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
}

.sd-tool-detail .ds-td-shell .ds-td-form-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--td-r-sm);
  background: var(--td-up-bg);
  border: 1px solid var(--td-up-border);
  color: var(--td-up);
  font-size: 12.5px;
  font-weight: 700;
}

/* ==========================================================================
   Right Output Card: Hero Banner + Gauge + 4-KPI Grid + Step Table
   ========================================================================== */
.sd-tool-detail .ds-td-shell .ds-td-hero {
  padding: 14px 16px;
  border-radius: var(--td-r-md);
  background: linear-gradient(135deg, #eff5ff 0%, #f8fbff 100%);
  border: 1px solid #bfdbfe;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sd-tool-detail .ds-td-shell .ds-td-hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.sd-tool-detail .ds-td-shell .ds-td-hero__label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--td-navy);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sd-tool-detail .ds-td-shell .ds-td-hero__main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.sd-tool-detail .ds-td-shell .ds-td-hero__val {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--td-text);
  font-variant-numeric: tabular-nums;
}
.sd-tool-detail .ds-td-shell .ds-td-hero__sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--td-sub);
  word-break: keep-all;
}

.sd-tool-detail .ds-td-shell .ds-td-ladder {
  padding: 10px 12px;
  border-radius: var(--td-r-sm);
  background: #fff;
  border: 1px solid var(--td-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sd-tool-detail .ds-td-shell .ds-td-ladder__labels {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--td-sub);
  font-variant-numeric: tabular-nums;
}
.sd-tool-detail .ds-td-shell .ds-td-ladder__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.sd-tool-detail .ds-td-shell .ds-td-ladder__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #0b3d91 100%);
  transition: width 0.2s ease;
}
.sd-tool-detail .ds-td-shell .ds-td-ladder__fill--buy {
  background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
}
.sd-tool-detail .ds-td-shell .ds-td-ladder__fill--sell {
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
}

.sd-tool-detail .ds-td-shell .ds-td-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sd-tool-detail .ds-td-shell .ds-td-kpi {
  padding: 10px 12px;
  border-radius: var(--td-r-sm);
  background: var(--td-surface);
  border: 1px solid var(--td-border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-kpi > span {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--td-muted);
}
.sd-tool-detail .ds-td-shell .ds-td-kpi > strong {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--td-text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.sd-tool-detail .ds-td-shell .ds-td-kpi > small {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--td-sub);
  word-break: keep-all;
}

.sd-tool-detail .ds-td-shell .ds-td-table-sec {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-table-wrap {
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.sd-tool-detail .ds-td-shell .ds-td-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.sd-tool-detail .ds-td-shell .ds-td-table th,
.sd-tool-detail .ds-td-shell .ds-td-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--td-line);
  text-align: right;
  white-space: nowrap;
}
.sd-tool-detail .ds-td-shell .ds-td-table th {
  background: var(--td-surface);
  color: var(--td-sub);
  font-weight: 750;
}
.sd-tool-detail .ds-td-shell .ds-td-table th:first-child,
.sd-tool-detail .ds-td-shell .ds-td-table td:first-child {
  text-align: left;
  font-weight: 700;
}
.sd-tool-detail .ds-td-shell .ds-td-table tr:last-child td {
  border-bottom: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-table tr.is-highlight {
  background: #eff6ff;
  font-weight: 800;
}

.sd-tool-detail .ds-td-shell .ds-td-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 220px;
  padding: 20px 16px;
  border-radius: var(--td-r-md);
  border: 1px dashed var(--td-border-strong);
  background: var(--td-surface);
  text-align: center;
}
.sd-tool-detail .ds-td-shell .ds-td-empty i {
  font-size: 24px;
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-empty strong {
  font-size: 14.5px;
  color: var(--td-text);
}
.sd-tool-detail .ds-td-shell .ds-td-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--td-sub);
  max-width: 34em;
  word-break: keep-all;
}

/* Footer Action Bar + More Save Options */
.sd-tool-detail .ds-td-shell .ds-td-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-top: 10px;
  border-top: 1px solid var(--td-line);
}
.sd-tool-detail .ds-td-shell .ds-td-actions__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.sd-tool-detail .ds-td-shell .ds-td-more {
  position: relative;
  margin: 0;
}
.sd-tool-detail .ds-td-shell .ds-td-more > summary {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-sm);
  background: #fff;
  color: var(--td-body);
  cursor: pointer;
  list-style: none;
}
.sd-tool-detail .ds-td-shell .ds-td-more > summary::-webkit-details-marker {
  display: none;
}
.sd-tool-detail .ds-td-shell .ds-td-more > summary:hover {
  background: var(--td-blue-soft);
  border-color: #93c5fd;
  color: var(--td-navy);
}
.sd-tool-detail .ds-td-shell .ds-td-more__menu {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 6px);
  right: 0;
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 12px;
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-md);
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sd-tool-detail .ds-td-shell .ds-td-local-save {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--td-line);
}
.sd-tool-detail .ds-td-shell .ds-td-local-save small {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--td-muted);
  word-break: keep-all;
}

/* Comparisons Table Wrapper */
.sd-tool-detail .ds-td-shell .ds-td-comparisons {
  background: var(--td-card-bg);
  border: 1px solid var(--td-border);
  border-radius: var(--td-r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   Compact Laptop Two-Column Density (820px ~ 1020px container width)
   ========================================================================== */
@container ds-td-shell (min-width: 820px) and (max-width: 1020px) {
  .sd-tool-detail .ds-td-shell .ds-td-card {
    padding: 14px;
    gap: 12px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-etf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sd-tool-detail .ds-td-shell .ds-td-sheet__head,
  .sd-tool-detail .ds-td-shell .ds-td-row {
    grid-template-columns: 48px minmax(0, 1fr) minmax(0, 1fr) 96px 26px;
    gap: 6px;
    padding: 7px 8px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-sheet__head--split,
  .sd-tool-detail .ds-td-shell .ds-td-row--split {
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 0.88fr) 104px 26px;
    gap: 6px;
    padding: 7px 8px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-inp-wrap input {
    padding: 0 28px 0 8px;
    font-size: 13px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-inp-unit {
    right: 6px;
    font-size: 11px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-table th,
  .sd-tool-detail .ds-td-shell .ds-td-table td {
    padding: 7px 6px;
    font-size: 11.5px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-hero__val {
    font-size: 23px;
  }
}

/* ==========================================================================
   Narrow & Mobile Container Responsiveness
   ========================================================================== */
@container ds-td-shell (max-width: 580px) {
  .sd-tool-detail .ds-td-shell .ds-td-topbar {
    padding: 12px 14px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .sd-tool-detail .ds-td-shell .ds-td-tabs::-webkit-scrollbar {
    display: none;
  }
  .sd-tool-detail .ds-td-shell .ds-td-card {
    padding: 14px;
    gap: 12px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .sd-tool-detail .ds-td-shell .ds-td-etf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sd-tool-detail .ds-td-shell .ds-td-sheet__head {
    display: none;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row,
  .sd-tool-detail .ds-td-shell .ds-td-row--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px;
    gap: 6px;
    padding: 10px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row .ds-td-row-badge {
    grid-column: 1 / 2;
    grid-row: 1;
    justify-self: start;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row .ds-td-row-sub {
    grid-column: 2 / 3;
    grid-row: 1;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 5px;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row .ds-td-btn-del {
    grid-column: 3 / 4;
    grid-row: 1;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row > :nth-child(2) {
    grid-column: 1 / 2;
    grid-row: 2;
  }
  .sd-tool-detail .ds-td-shell .ds-td-row > :nth-child(3) {
    grid-column: 2 / 4;
    grid-row: 2;
  }
  .sd-tool-detail .ds-td-shell .ds-td-more__menu {
    right: auto;
    left: 0;
  }
}

@media (max-width: 640px) {
  .sd-tool-detail .ds-td-shell .ds-td-inp-wrap input,
  .sd-tool-detail .ds-td-shell .ds-td-inp-wrap select {
    font-size: 16px;
  }
}
