/* macOS visual system: neutral material, native type, clear hierarchy. */
:root {
  --bg: #f5f5f7;
  --canvas: #fff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #76767c;
  --line: #e5e5e8;
  --line-strong: #d2d2d7;
  --blue: #0071e3;
  --green: #24834b;
  --red: #c93532;
  --radius: 18px;
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    "PingFang SC", sans-serif;
}
body {
  background: var(--bg);
  font-family: var(--font);
  letter-spacing: -0.015em;
}
button {
  transition:
    background 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
}
button:active {
  transform: scale(0.98);
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #0071e366;
  outline-offset: 3px;
}
html:has(.dashboard),
body:has(.dashboard) {
  height: auto;
  overflow: auto;
}
body.is-window-fitted .app-shell,
.app-shell {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  min-height: 100dvh;
  transform: none;
  padding: 0 32px 40px;
}
.dashboard {
  display: grid;
  max-width: 1480px;
  height: auto;
  margin: auto;
  padding: 0;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas: "header header" "sidebar results";
  gap: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.dashboard::before,
.results::before {
  display: none;
}
.app-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 92px;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.brand-group {
  gap: 12px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  background: #0071e3;
  border-radius: 12px;
  box-shadow: 0 2px 5px #0071e31a;
}
.brand-copy {
  display: block;
}
.brand-group .eyebrow {
  display: none;
}
.app-header h1 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.04em;
}
.brand-group .lead {
  display: block;
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.header-disclaimer {
  order: 3;
  flex: 1 0 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  border: 0;
  border-radius: 0;
}
.header-actions .local-badge {
  display: none;
}
.header-actions :is(.header-tool-button, .reset-button) {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}
.header-actions .new-measurement-button {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.theme-toggle,
.support-toggle {
  background: transparent !important;
  border: 0 !important;
  color: var(--muted);
  font-size: 11px;
}
.sidebar-column,
.results,
.result-column {
  height: auto;
  min-height: 0;
  overflow: visible;
}
.controls {
  display: grid;
  height: auto;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  gap: 20px;
  padding: 22px;
  border: 0;
  border-radius: 20px;
  background: #fff;
  overflow: visible;
  box-shadow: 0 2px 12px #1d1d1f04;
}
.controls-header {
  display: block;
  min-height: 0;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.controls-header > div:first-child {
  display: block;
}
.controls-header h2 {
  font-size: 19px;
  font-weight: 600;
}
.controls-header .panel-kicker {
  display: none !important;
}
.controls-header-tools {
  display: flex;
  flex-wrap: wrap;
  margin-top: 14px;
  gap: 6px;
}
.save-holding-button,
.fee-mode-button,
.clear-plan-button {
  min-height: 30px;
  height: auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f5f5f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}
.live-chip {
  font-size: 11px;
  color: var(--muted);
  background: transparent;
}
.control-section {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 0 0 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.control-section:last-child {
  border: 0;
  padding-bottom: 0;
}
.control-section::after {
  display: none;
}
.control-section legend {
  float: none;
  width: 100%;
  min-height: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.legend-heading {
  display: grid;
  gap: 4px;
}
.legend-heading > span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.legend-heading small,
.legend-note {
  font-size: 12px;
  color: var(--muted);
}
.legend-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.market-switch {
  background: #ededf0;
  border: 0;
  border-radius: 8px;
  padding: 3px;
}
.market-switch button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}
.market-switch button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px #00000014;
}
.field > span:first-child,
.field-title,
.slider-heading label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.field-title b {
  display: none;
}
.input-wrap,
.primary-market-field .input-wrap {
  height: 42px;
  border: 1px solid #dedee3;
  border-radius: 9px;
  background: #fafafa;
  box-shadow: none;
}
.input-wrap input,
.primary-market-field .input-wrap input {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.input-wrap small {
  font-size: 11px;
  color: var(--muted);
}
.input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #0071e31a;
}
.stock-identity-grid,
.position-input-grid,
.basis-field-grid {
  gap: 10px;
}
.stock-identity-grid {
  margin-bottom: 14px;
}
.basis-field-grid {
  margin-top: 12px;
}
.order-price-block {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.slider-heading {
  margin-bottom: 8px;
}
.range-scale {
  font-size: 11px;
  color: var(--muted);
}
input[type="range"] {
  accent-color: var(--blue);
}
.trade-input-grid {
  margin-top: 12px;
}
.results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.result-column {
  display: grid;
  grid-column: auto;
  grid-row: auto;
  gap: 20px;
  grid-template-rows: auto;
  align-content: start;
}
.result-main-column {
  grid-template-columns: minmax(0, 1fr);
}
.results .panel {
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 2px 12px #1d1d1f04;
}
.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 218px;
  padding: 30px 32px;
  background: #fff;
  overflow: visible;
}
.hero-label-row {
  flex-wrap: wrap;
  gap: 8px;
}
.hero-label-row p {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.calculation-badge {
  padding: 4px 7px;
  color: var(--muted);
  background: #f5f5f7;
  font-size: 11px;
  font-weight: 500;
}
.hero-number {
  margin-top: 19px;
  gap: 10px;
}
.hero-number span {
  font-size: clamp(52px, 5.5vw, 78px);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.065em;
}
.hero-number small {
  font-size: 11px;
  color: var(--muted);
  padding-bottom: 6px;
}
.cost-change {
  margin-top: 18px;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
}
.cashflow-card {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0 12px 22px;
  background: transparent;
}
.cashflow-card > span {
  font-size: 11px;
  color: var(--muted);
}
.cashflow-card strong {
  font-size: 18px;
  font-weight: 600;
  margin-block: 9px;
}
.cashflow-card small {
  font-size: 11px;
  color: var(--muted);
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  padding: 18px 20px;
  min-height: 88px;
}
.metric-icon {
  display: none;
}
.metric div > span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.metric div > strong {
  display: block;
  margin-top: 9px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.stage-section,
.chart-section,
.target-plan,
.comparison-section,
.price-position,
.breakdown {
  padding: 24px;
  overflow: visible;
}
.panel-kicker {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 6px;
}
.section-title-row h2,
.target-plan .section-title-row h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.section-title-row > span {
  font-size: 12px;
  color: var(--muted);
}
.stage-grid {
  margin-top: 22px;
  height: auto;
  gap: 8px;
}
.stage-card {
  padding: 14px 12px;
  border: 0;
  border-radius: 12px;
  background: #f5f5f7;
}
.stage-card strong {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.stage-step,
.stage-card small {
  font-size: 12px;
  color: var(--muted);
}
.stage-connector b {
  font-size: 11px;
  color: var(--muted);
}
.chart-section #costChart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 200px;
  margin-top: 16px;
}
.formula {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 14px;
}
.result-side-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.target-plan,
.comparison-section {
  grid-column: 1/-1;
}
.result-side-column .target-plan-body {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 2fr) auto;
  grid-template-areas: "field details action";
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}
.target-plan-copy > p {
  font-size: 11px;
  line-height: 1.6;
}
.target-plan-stats {
  gap: 8px;
}
.result-side-column .target-plan-stats span {
  padding: 8px;
  background: #f5f5f7;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
.target-plan-stats strong {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink);
}
.target-badge {
  background: #f5f5f7;
  color: var(--muted);
  font-size: 12px !important;
  font-weight: 500;
}
.target-inline-field > span:first-child {
  font-size: 11px;
}
.apply-button {
  height: auto;
  min-height: 38px;
  padding: 9px 12px;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  color: white;
  font-size: 11px;
  font-weight: 500;
}
.target-plan-accent {
  display: none;
}
.comparison-section .table-scroll {
  height: auto;
  margin-top: 16px;
  overflow-x: auto;
}
.comparison-table th {
  padding: 12px 10px;
  font-size: 12px;
  background: #f5f5f7;
  font-weight: 500 !important;
}
.comparison-table td {
  padding: 14px 10px;
  font-size: 12px;
  font-weight: 400 !important;
}
.table-action {
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: #eef5fd;
  font-size: 12px;
  font-weight: 500;
}
.current-badge {
  font-size: 11px;
}
.position-visual {
  margin-top: 24px;
}
.position-labels {
  font-size: 12px;
}
.breakdown dl {
  margin: 16px 0 0;
}
.breakdown dl > div {
  padding: 8px 0;
}
.breakdown dt {
  font-size: 12px;
  color: var(--muted);
}
.breakdown dd {
  font-size: 12px;
  font-weight: 500;
}
.app-dialog {
  border: 1px solid #ffffff66;
  border-radius: 20px;
  background: var(--canvas);
  box-shadow: 0 30px 90px #00000026;
}
.app-dialog::backdrop {
  background: #1d1d1f33;
  backdrop-filter: blur(7px);
}
.dialog-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
  font-weight: 600;
}
.dialog-primary {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
}
.dialog-secondary {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--bg);
}
@media (min-width: 821px) and (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
  }
  .app-shell {
    padding-inline: 20px;
  }
  .controls {
    padding: 18px;
  }
  .result-hero {
    grid-template-columns: 1fr;
    padding: 26px;
  }
  .cashflow-card {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
  }
  .result-side-column .target-plan-body {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "field action" "details details";
  }
  .result-side-column {
    grid-template-columns: 1fr;
  }
  .metric div > strong {
    font-size: 18px;
  }
}
@media (max-width: 820px) {
  .app-shell,
  body.is-window-fitted .app-shell {
    padding: 0 16px 24px;
  }
  .dashboard {
    display: block;
  }
  .app-header {
    gap: 14px;
    padding-block: 18px;
    min-height: 0;
  }
  .app-header h1 {
    font-size: 20px;
  }
  .header-actions {
    width: 100%;
    gap: 6px;
  }
  .header-actions :is(.header-tool-button, .reset-button) {
    min-height: 36px;
    font-size: 11px;
  }
  .header-disclaimer {
    font-size: 12px;
  }
  .mobile-page-switcher {
    margin: 18px 0;
    padding: 4px;
    border: 0;
    background: #e7e7eb;
    border-radius: 11px;
  }
  .mobile-page-switcher button {
    min-height: 40px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
  }
  .mobile-page-switcher button.is-active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 2px 5px #0000000d;
  }
  .mobile-page-switcher button span {
    display: none;
  }
  .controls {
    padding: 22px;
    border-radius: 18px;
    gap: 24px;
  }
  .controls-header-tools {
    display: flex;
  }
  .save-holding-button,
  .fee-mode-button {
    width: auto;
    min-height: 34px;
    font-size: 11px;
  }
  .control-section {
    padding: 0 0 24px;
  }
  .control-section legend {
    margin-bottom: 16px;
  }
  .input-wrap,
  .primary-market-field .input-wrap {
    height: 48px;
  }
  .input-wrap input {
    font-size: 17px;
  }
  .field > span:first-child,
  .slider-heading label {
    font-size: 12px;
  }
  .legend-heading > span {
    font-size: 16px;
  }
  .legend-heading small {
    font-size: 11px;
  }
  .mobile-results-cta {
    margin-top: 16px;
    border: 0;
    border-radius: 14px;
    background: var(--blue);
    min-height: 68px;
  }
  .results {
    display: grid;
    gap: 18px;
  }
  .result-column,
  .result-side-column {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 16px;
  }
  .result-hero {
    grid-template-columns: 1fr;
    padding: 26px;
    gap: 20px;
  }
  .hero-number span {
    font-size: 66px;
  }
  .cashflow-card {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px 0 0;
  }
  .metric {
    padding: 16px;
    min-height: 90px;
  }
  .metric div > span {
    font-size: 12px;
  }
  .metric div > strong {
    font-size: 18px;
  }
  .stage-section,
  .chart-section,
  .target-plan,
  .comparison-section,
  .price-position,
  .breakdown {
    padding: 20px;
  }
  .result-side-column .target-plan-body {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "field action" "details details";
    gap: 16px;
  }
  .stage-card {
    padding: 12px 6px;
  }
  .stage-card strong {
    font-size: 13px;
  }
  .result-main-column .stage-grid {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(
        0,
        1fr
      );
    gap: 4px;
  }
  .stage-connector b {
    font-size: 8px;
  }
  .stage-step,
  .stage-card small {
    font-size: 11px;
  }
  .comparison-table :is(th, td) {
    padding: 12px 6px;
    font-size: 12px;
  }
  .section-title-row h2 {
    font-size: 16px;
  }
  .chart-section #costChart {
    min-height: 0;
  }
  .breakdown dt {
    font-size: 12px;
  }
  .breakdown dd {
    font-size: 14px;
  }
}
html[data-theme="dark"] {
  --bg: #1c1c1e;
  --canvas: #2c2c2e;
  --ink: #f5f5f7;
  --muted: #aeaeb2;
  --faint: #98989d;
  --line: #424245;
  --line-strong: #545458;
  --blue: #409cff;
  --green: #63ce83;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .dashboard {
  background: var(--bg);
}
html[data-theme="dark"] :is(.controls, .results .panel, .app-dialog) {
  background: var(--canvas);
  color: var(--ink);
}
html[data-theme="dark"]
  :is(.app-header, .control-section, .order-price-block, .cashflow-card) {
  background: transparent;
  border-color: var(--line);
}
html[data-theme="dark"]
  :is(
    .input-wrap,
    .primary-market-field .input-wrap,
    .stage-card,
    .target-plan-stats span,
    .comparison-table th,
    .calculation-badge,
    .target-badge,
    .header-tool-button,
    .reset-button
  ) {
  background: #363638 !important;
  border-color: var(--line);
  color: var(--ink);
}
html[data-theme="dark"]
  :is(
    .hero-number span,
    .input-wrap input,
    .primary-market-field .input-wrap input,
    .legend-heading > span,
    .field-title,
    .stage-card strong,
    .target-plan-stats strong
  ) {
  color: var(--ink);
}
html[data-theme="dark"]
  :is(
    .header-disclaimer,
    .legend-heading small,
    .field > span:first-child,
    .input-wrap small,
    .cashflow-card > span,
    .cashflow-card small,
    .position-labels,
    .breakdown dt
  ) {
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
/* Welcome page */
body.apple-welcome {
  --paper: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --line: #dedee3;
  --highlight: #eaf3ff;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
}
.apple-welcome .site-header {
  height: 80px;
  border-bottom: 1px solid var(--line);
}
.apple-welcome .brand > span {
  font-weight: 600;
}
.apple-welcome .brand small {
  color: var(--muted);
  font-size: 12px;
}
.apple-welcome .button {
  border-radius: 980px;
  background: var(--accent);
  box-shadow: none;
  font-weight: 500;
}
.apple-welcome .button:hover {
  background: #0077ed;
  transform: translateY(-1px);
}
.apple-welcome .button.small {
  min-height: 36px;
  font-size: 12px;
}
.apple-welcome .hero {
  gap: 80px;
  padding-block: 92px 80px;
}
.apple-welcome .hero h1 {
  font-size: clamp(40px, 4.8vw, 66px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.055em;
}
.apple-welcome .accent-word {
  color: var(--accent);
}
.apple-welcome .accent-word::after {
  display: none;
}
.apple-welcome .title-dot {
  color: var(--ink);
}
.apple-welcome .hero-description {
  font-size: 15px;
  line-height: 1.9;
  margin-top: 28px;
}
.apple-welcome .hero .eyebrow {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.apple-welcome .demo-card {
  border: 1px solid #e5e5e8;
  border-radius: 24px;
  box-shadow: 0 24px 65px #1d1d1f0c;
  transform: none;
}
.apple-welcome .demo-heading {
  padding: 24px;
}
.apple-welcome .demo-heading .eyebrow {
  color: var(--muted);
}
.apple-welcome .sample-badge {
  background: #f5f5f7;
  color: var(--muted);
  border-radius: 5px;
}
.apple-welcome .scenario-tabs {
  background: #ededf0;
  border-radius: 9px;
  padding: 3px;
}
.apple-welcome .scenario-tabs button[aria-selected="true"] {
  color: var(--ink);
  box-shadow: 0 1px 5px #00000012;
}
.apple-welcome .stock-icon {
  background: #f0f0f2;
  color: var(--muted);
}
.apple-welcome .result-block {
  padding: 22px 18px;
  background: #f5f5f7;
  border: 0;
  border-radius: 15px;
}
.apple-welcome .result-number {
  color: var(--ink);
  font-size: 68px;
  font-weight: 600;
  letter-spacing: -0.05em;
}
.apple-welcome .demo-footer {
  background: #fff;
  color: var(--accent);
  padding-block: 20px;
}
.apple-welcome .trade-line {
  border-block-style: solid;
}
.apple-welcome .bar {
  border-radius: 4px;
}
.apple-welcome .before {
  background: #dedee3;
}
.apple-welcome .demo-caption {
  letter-spacing: 0;
}
.apple-welcome .principles {
  padding-block: 36px;
}
.apple-welcome h2 {
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.35;
}
.apple-welcome .section {
  padding-block: 100px;
}
.apple-welcome .scenario-grid {
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border: 0;
}
.apple-welcome .scenario-grid article,
.apple-welcome .scenario-grid article + article {
  padding: 30px;
  border: 0;
  background: #fff;
  border-radius: 22px;
}
.apple-welcome .scenario-grid article:last-child {
  grid-column: 1/-1;
}
.apple-welcome .line-symbol {
  background: #f5f5f7;
  color: var(--accent);
  border-radius: 14px;
}
.apple-welcome .scenario-grid h3 {
  font-weight: 600;
}
.apple-welcome .scenario-grid a {
  color: var(--accent);
}
.apple-welcome .workspace-section {
  background: #ebebee;
  padding-block: 80px;
}
.apple-welcome .workspace-frame {
  border-color: #d2d2d7;
  border-radius: 16px;
  box-shadow: 0 20px 60px #1d1d1f12;
}
.apple-welcome .window-bar {
  background: #f5f5f7;
}
.apple-welcome .window-bar > span:first-child {
  color: #a1a1a6;
}
.apple-welcome .closing {
  background: #fff;
  color: var(--ink);
  border: 0;
  border-radius: 24px;
  padding: 54px;
}
.apple-welcome .closing .eyebrow,
.apple-welcome .closing > div:last-child > p {
  color: var(--muted);
}
.apple-welcome .button.light {
  color: white;
  background: var(--accent);
}
@media (max-width: 760px) {
  .apple-welcome .hero {
    padding-block: 44px;
    gap: 36px;
  }
  .apple-welcome .hero h1 {
    font-size: clamp(38px, 9vw, 56px);
  }
  .apple-welcome .hero-description {
    font-size: 14px;
  }
  .apple-welcome .demo-card {
    border-radius: 20px;
  }
  .apple-welcome .section {
    padding-block: 60px;
  }
  .apple-welcome .scenario-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .apple-welcome .scenario-grid article,
  .apple-welcome .scenario-grid article + article {
    padding: 26px;
  }
  .apple-welcome .line-symbol {
    position: static;
    margin: 20px 0;
  }
  .apple-welcome .workspace-section {
    padding-block: 48px;
  }
  .apple-welcome .closing {
    padding: 30px 26px;
  }
  .apple-welcome .hero-actions {
    gap: 18px;
  }
  .apple-welcome .hero-actions .button {
    font-size: 13px;
    padding-inline: 20px;
    gap: 14px;
  }
  .apple-welcome .hero-actions .text-link {
    font-size: 12px;
  }
}
/* Remove legacy compact-mode constraints from the input rail. */
.controls .controls-header-tools {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}
.controls .controls-header-tools > * {
  width: auto;
  flex: 0 1 auto;
}
.controls .controls-header-tools .save-holding-button,
.controls .controls-header-tools .fee-mode-button {
  width: auto;
}
.controls-header::after,
.legend-heading::before,
.slider-heading::before {
  display: none;
}
.position-input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.position-input-grid .basis-field-grid,
body[data-market="hk"] .position-input-grid .basis-field-grid,
body[data-market="us"] .position-input-grid .basis-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}
.position-input-grid .compact-field .input-wrap input {
  font-size: 15px;
  padding-left: 9px;
}
.position-input-grid .primary-market-field .input-wrap input {
  font-size: 22px;
}
.controls .input-wrap {
  min-width: 0;
}
.controls .input-wrap input {
  width: 100%;
  min-width: 0;
}
.controls .input-wrap small {
  flex-shrink: 0;
}
.metric {
  justify-content: flex-start;
  text-align: left;
}
.controls .live-chip {
  margin-left: 0;
}
.controls .clear-plan-button {
  width: auto;
  flex-basis: auto;
  padding: 6px 9px;
}
.controls .clear-plan-button > span {
  display: inline;
}
.controls .clear-plan-chevron {
  display: none;
}
/* Final responsive and dark-mode corrections. */
html[data-theme="dark"]
  .controls
  :is(.save-holding-button, .fee-mode-button, .clear-plan-button),
html[data-theme="dark"] .market-switch {
  background: #363638 !important;
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .market-switch button.is-active {
  background: #555558;
  color: #fff;
}
html[data-theme="dark"] .market-switch button {
  color: var(--muted);
}
html[data-theme="dark"] .header-actions .new-measurement-button {
  background: var(--blue) !important;
  color: #101014;
}
.metric-grid {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.metric div {
  width: 100%;
  text-align: left;
}
@media (max-width: 820px) {
  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .header-actions :is(.header-tool-button, .reset-button) {
    width: 100%;
    padding-inline: 4px;
    font-size: 12px;
  }
  .header-actions .local-badge {
    display: none;
  }
  .controls .market-switch {
    width: auto;
    flex: 0 0 auto;
  }
  .controls .market-switch button {
    width: auto;
  }
  .position-input-grid .basis-field-grid,
  body[data-market="hk"] .position-input-grid .basis-field-grid,
  body[data-market="us"] .position-input-grid .basis-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .controls .compact-field {
    grid-column: auto;
  }
  .controls .input-wrap input {
    font-size: 16px;
  }
  .controls-header-tools {
    gap: 6px;
  }
  .header-disclaimer {
    text-align: left;
  }
  .app-header {
    margin-bottom: 0;
  }
}

html[data-theme="dark"] .comparison-section .table-action {
  background: #244466;
  color: #b9ddff !important;
}
html[data-theme="dark"] .negative,
html[data-theme="dark"] .cashflow-card .negative {
  color: #ff817b !important;
}

/* Voluntary support: preserve the supplied QR image without filters or cropping. */
.support-dialog .support-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: start;
}
.support-dialog .support-qr-link {
  display: block;
  align-self: center;
  width: min(100%, 250px);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.support-dialog .support-qr-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: none;
}
.support-dialog .reward-card .support-card-icon {
  color: var(--blue);
}
.support-dialog .reward-copy,
.support-dialog .support-privacy {
  font-size: 12px;
  line-height: 1.75;
  margin: 0;
  color: var(--muted);
}
.support-dialog .alipay-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.support-dialog .support-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  text-decoration: none;
  color: white;
  background: #0071e3;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
}
.support-dialog .support-original-link {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.support-dialog .support-original-link:hover {
  text-decoration: underline;
}
@media (max-width: 820px) {
  .support-dialog .support-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .support-dialog .alipay-reward-card {
    grid-row: 1;
  }
  .support-dialog .support-qr-link {
    width: min(100%, 260px);
  }
}
.market-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cn-market-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 14px;
}
.cn-market-note[hidden] {
  display: none;
}

/* Readable controls and flexible content sizing. */
.dashboard > *,
.result-column > *,
.target-plan-body > *,
.field {
  min-width: 0;
}
.hero-number,
.metric div > strong,
.cashflow-card strong,
.stage-card strong {
  font-variant-numeric: tabular-nums;
}
.hero-number {
  flex-wrap: wrap;
}
.hero-number span {
  overflow-wrap: anywhere;
}
.controls .field > span:first-child,
.controls .slider-heading label {
  font-size: 12px;
  line-height: 1.5;
}
.formula,
.target-plan-copy > p,
.cashflow-card small {
  line-height: 1.7;
}
.controls .market-switch {
  max-width: 100%;
}
.header-actions :is(.header-tool-button, .reset-button),
.save-holding-button,
.fee-mode-button,
.clear-plan-button {
  min-height: 36px;
}
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #0071e366;
  outline-offset: 3px;
}
@media (hover: hover) {
  .header-actions :is(.header-tool-button, .reset-button):hover,
  .save-holding-button:hover,
  .fee-mode-button:hover,
  .clear-plan-button:hover {
    border-color: var(--line-strong);
    box-shadow: 0 2px 6px #0000000a;
  }
  .apply-button:hover,
  .dialog-primary:hover,
  .support-download:hover {
    filter: brightness(1.08);
  }
}
/* Narrow phones: give fields and actions room to wrap. */
@media (max-width: 480px) {
  .app-shell,
  body.is-window-fitted .app-shell {
    padding-inline: 12px;
  }
  .brand-group {
    flex-wrap: wrap;
    gap: 10px;
  }
  .controls {
    padding: 18px;
  }
  .controls .stock-identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .position-input-grid .basis-field-grid,
  body[data-market] .position-input-grid .basis-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .controls .control-section legend {
    row-gap: 12px;
  }
  .controls .market-switch {
    width: 100%;
    flex-basis: 100%;
  }
  .controls .market-switch button {
    min-height: 40px;
  }
  .result-side-column .target-plan-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "field" "details" "action";
  }
  .result-hero {
    padding: 22px 18px;
  }
  .hero-number span {
    font-size: clamp(40px, 14vw, 60px);
  }
  .metric {
    padding: 16px 12px;
  }
  .metric div > strong {
    font-size: 17px;
    overflow-wrap: anywhere;
  }
  .section-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .comparison-section .table-scroll {
    max-width: 100%;
  }
  .header-actions :is(.header-tool-button, .reset-button) {
    min-height: 40px;
  }
}

/* Unified editable fields: macOS-inspired, with separate unit accessories. */
:root { --field-surface:#fff; --field-border:#c9cbd1; --field-accessory:#f5f5f7; --field-placeholder:#858994; }
html[data-theme=dark] { --field-surface:#29292c; --field-border:#59595f; --field-accessory:#343438; --field-placeholder:#97979f; }
body .input-wrap, body .primary-market-field .input-wrap, body .dialog-input {
 display:flex; align-items:center; height:46px; min-height:46px; padding:0; gap:0;
 border:1px solid var(--field-border); border-radius:10px; background:var(--field-surface)!important;
 box-shadow:0 1px 2px #00000005; overflow:hidden; transition:border-color .15s,box-shadow .15s;
}
body .input-wrap input, body .controls .compact-field .input-wrap input, body .primary-market-field .input-wrap input, body .dialog-input input {
 flex:1 1 0%; width:100%; min-width:0; height:44px; padding:0 12px; margin:0;
 border:0; border-radius:0; outline:0; box-shadow:none; background:transparent; color:var(--ink);
 font-family:inherit; font-size:16px; font-weight:500; line-height:normal; font-variant-numeric:tabular-nums; text-align:left;
}
body .input-wrap input::placeholder, body .dialog-input input::placeholder { color:var(--field-placeholder); opacity:1; font-weight:400; }
body .input-wrap small, body .primary-market-field .input-wrap small, body .price-input small, body .dialog-input small {
 display:flex; align-items:center; justify-content:center; align-self:stretch; flex:0 0 auto;
 min-width:34px; padding:0 9px; border-left:1px solid var(--line); background:var(--field-accessory);
 color:var(--muted); font-size:11px; font-weight:500; white-space:nowrap;
}
body .primary-market-field .input-wrap::before { font-size:13px; font-weight:500; padding-left:12px; color:var(--muted); }
body .price-input::before { display:none; }
body .field, body .target-inline-field { gap:7px; }
body .field > span:first-child, body .slider-heading label, body .target-inline-field > span:first-child, body .fee-setting-grid label > span:first-child { font-size:12px; font-weight:500; color:var(--ink); line-height:1.5; }
body .input-wrap:focus-within, body .primary-market-field .input-wrap:focus-within, body .dialog-input:focus-within { border-color:var(--blue); box-shadow:0 0 0 3px #007aff26; }
body .input-wrap.is-auto-fee { border-style:dashed; background:var(--field-accessory)!important; box-shadow:none; }
body .input-wrap.is-auto-fee input { color:var(--muted); cursor:default; }
body .input-wrap:has(input:disabled), body .dialog-input:has(input:disabled) { opacity:.6; }
body .input-wrap:has(input[aria-invalid=true]), body .dialog-input:has(input[aria-invalid=true]) { border-color:#d14545; box-shadow:0 0 0 3px #d145451a; }
@media(hover:hover) { body .input-wrap:hover:not(:focus-within), body .dialog-input:hover:not(:focus-within) { border-color:#9398a2; } }
@media(max-width:480px) { body .input-wrap small, body .dialog-input small { padding-inline:7px; font-size:10px; } body .input-wrap input, body .controls .compact-field .input-wrap input { padding-inline:10px; } }
@media(prefers-reduced-motion:reduce) { body .input-wrap, body .dialog-input { transition:none; } }

/* Consistent section headings and a flat, shadow-free surface. */
html body .section-title-row { align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
html body .section-title-row > div { display:flex; flex-direction:column; align-items:flex-start; gap:4px; min-width:0; }
html body .section-title-row h2 { margin:0; color:var(--ink); font-size:16px; font-weight:600; line-height:1.5; letter-spacing:0; }
html body .section-title-row .panel-kicker { margin:0; color:var(--muted); font-size:10px; font-weight:500; line-height:1.5; letter-spacing:.08em; }
html body .section-title-row > span { font-size:11px!important; font-weight:400; line-height:1.5; color:var(--muted); }
html body *, html body *::before, html body *::after { box-shadow:none!important; text-shadow:none!important; }
html body .input-wrap:focus-within, html body .dialog-input:focus-within { border-color:var(--blue); outline:2px solid var(--blue); outline-offset:2px; }

/* Override legacy responsive heading rules consistently. */
html body .section-title-row h2 { font-size:16px!important; font-weight:600!important; line-height:1.5!important; letter-spacing:0!important; margin:0!important; }
html body .section-title-row .panel-kicker { color:var(--muted)!important; font-size:10px!important; font-weight:500!important; line-height:1.5!important; letter-spacing:.08em!important; }

/* Compact cost evolution: three values on one uninterrupted surface. */
html body .stage-section { height:auto!important; min-height:0!important; padding:22px 24px!important; overflow:hidden; }
html body .stage-section .section-title-row { margin-bottom:20px!important; }
html body .stage-section .panel-kicker { display:none!important; }
html body .stage-section .stage-grid { display:grid!important; grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr) 24px minmax(0,1fr)!important; align-items:center; gap:12px!important; height:auto!important; min-height:0!important; margin:0!important; padding:0!important; border:0!important; border-radius:0!important; background:transparent!important; overflow:visible; }
html body .stage-section .stage-card { display:flex!important; flex-direction:column; align-items:flex-start; justify-content:center; gap:6px; height:auto!important; min-height:0!important; padding:8px 0!important; border:0!important; border-radius:0!important; background:transparent!important; text-align:left; }
html body .stage-section .stage-card::before, html body .stage-section .stage-card::after { display:none!important; }
html body .stage-section .stage-step { font-size:12px!important; line-height:1.5; color:var(--muted); }
html body .stage-section .stage-card strong { font-size:20px!important; font-weight:600!important; line-height:1.3; letter-spacing:-.4px; white-space:nowrap; color:var(--ink); }
html body .stage-section .stage-buy strong { color:var(--blue)!important; }
html body .stage-section .stage-card small { font-size:12px!important; line-height:1.5; color:var(--muted); }
html body .stage-section .stage-connector { display:flex!important; align-items:center; justify-content:center; width:24px; height:auto!important; min-height:0!important; padding:0!important; border:0!important; background:transparent!important; }
html body .stage-section .stage-connector > *, html body .stage-section .stage-connector::before { display:none!important; }
html body .stage-section .stage-connector::after { content:'→'; display:block!important; position:static!important; width:auto!important; height:auto!important; border:0!important; background:none!important; font-size:20px; font-weight:400; color:var(--muted); transform:none!important; }
@media(max-width:480px) { html body .stage-section { padding:18px!important; } html body .stage-section .stage-grid { gap:5px!important; grid-template-columns:minmax(0,1fr) 14px minmax(0,1fr) 14px minmax(0,1fr)!important; } html body .stage-section .stage-card strong { font-size:15px!important; letter-spacing:-.5px; } html body .stage-section .stage-connector { width:14px; } html body .stage-section .stage-connector::after { font-size:16px; } }

/* Align bilingual section headings; status badges keep their intrinsic width. */
html body .results .section-title-row > div { align-items:flex-start!important; text-align:left; padding:0; margin:0; }
html body .results .section-title-row .panel-kicker { padding:0!important; margin:0!important; align-self:flex-start; }
html body .results .section-title-row > span { flex:0 0 auto!important; width:auto!important; max-width:100%; margin-left:auto; }
html body .results .target-title-row { align-items:flex-start!important; }
html body .results .target-title-row .target-badge { padding:4px 10px; border-radius:6px; line-height:1.5; }

/* Align target controls and remove the inset summary surface. */
html body .results .target-plan-body { align-items:end!important; }
html body .results .target-inline-field { align-self:end; margin:0; }
html body .results .target-plan-copy { align-self:end; }
html body .results .target-plan-copy > p { margin:0 0 10px; white-space:normal; line-height:1.5; }
html body .results .target-plan-stats { min-height:46px; margin:0; padding:0!important; border:0!important; border-radius:0!important; background:transparent!important; box-shadow:none!important; gap:16px; }
html body .results .target-plan-stats > span { display:flex; flex-direction:column; justify-content:space-between; min-height:46px; padding:0!important; border:0!important; border-radius:0!important; background:transparent!important; box-shadow:none!important; line-height:1.5; }
html body .results .target-plan-stats strong { margin:4px 0 0; line-height:1.5; }
html body .results #applyTargetPlan { align-self:end!important; height:46px!important; min-height:46px; margin:0!important; box-shadow:none!important; }

/* Stable desktop composition across browser zoom levels. */
html body .dashboard { max-width:1380px; }
html body .results { grid-template-columns:minmax(0,1fr); }
html body .results .target-plan { padding:24px; }
html body .results .target-title-row { margin-bottom:20px; align-items:center!important; }
html body .results .target-title-row .target-badge { background:transparent; border:0; padding:0; }
html body .results .target-plan-body { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"field action" "details details"; gap:20px 16px; margin-top:0; }
html body .results .target-inline-field { max-width:320px; width:100%; }
html body .results .target-plan-copy { width:100%; }
html body .results .target-plan-copy > p { font-size:12px; line-height:1.65; margin:0 0 16px; overflow:visible; }
html body .results .target-plan-stats { gap:20px; }
html body .results .target-plan-stats > span { justify-content:flex-start; font-size:12px; }
html body .results .target-plan-stats strong { font-size:20px; font-weight:600; font-variant-numeric:tabular-nums; letter-spacing:-.3px; white-space:normal; overflow-wrap:anywhere; overflow:visible; }
html body .results #targetPlanActualCost { color:var(--blue); }
html body .results #applyTargetPlan { padding-inline:20px; border-radius:10px; font-size:13px; }
@media(max-width:480px) {
 html body .results .target-plan { padding:18px; }
 html body .results .target-plan-body { grid-template-columns:minmax(0,1fr); grid-template-areas:"field" "details" "action"; gap:18px; }
 html body .results .target-inline-field { max-width:none; }
 html body .results .target-plan-stats { gap:10px; }
 html body .results .target-plan-stats strong { font-size:16px; }
 html body .results #applyTargetPlan { width:100%; }
}

/* Three-column desktop workspace. */
@media (min-width:1180px) {
 html body .dashboard { max-width:1640px; grid-template-columns:300px minmax(0,1fr); gap:20px; }
 html body .app-shell { padding-inline:24px; }
 html body .results { grid-template-columns:minmax(0,1.12fr) minmax(340px,1fr); gap:20px; align-items:start; }
 html body .result-side-column { grid-template-columns:minmax(0,1fr); }
 html body .controls { padding:18px; }
 html body .result-hero { grid-template-columns:minmax(0,1fr); padding:24px; gap:16px; }
 html body .cashflow-card { border-left:0; border-top:1px solid var(--line); padding:14px 0 0; }
 html body .results .target-plan { padding:20px; }
 html body .results .target-plan-body { grid-template-columns:minmax(0,1fr) auto; gap:18px 12px; }
 html body .results .target-inline-field { max-width:none; }
 html body .results #applyTargetPlan { padding-inline:12px; }
 html body .results .target-plan-stats { gap:12px; }
 html body .results .target-plan-stats strong { font-size:17px; }
 html body .stage-section { padding:20px!important; }
 html body .stage-section .stage-grid { gap:6px!important; grid-template-columns:minmax(0,1fr) 14px minmax(0,1fr) 14px minmax(0,1fr)!important; }
 html body .stage-section .stage-card strong { font-size:17px!important; }
 html body .stage-section .stage-connector { width:14px; }
}

/* Calm, consistent typography for the parameter form. */
html body .controls .input-wrap input,
html body .controls .position-input-grid .primary-market-field .input-wrap input {
 font-size:16px!important; font-weight:400!important; letter-spacing:0!important; line-height:normal;
}
html body .controls-header h2 { font-size:16px!important; font-weight:600!important; line-height:1.5; }
html body .controls .legend-heading > span { font-size:14px!important; font-weight:600!important; line-height:1.5; }
html body .controls .legend-heading small { font-size:12px!important; font-weight:400!important; line-height:1.5; color:var(--muted); }
html body .controls .field > span:first-child,
html body .controls .field-title,
html body .controls .slider-heading label { font-size:12px!important; font-weight:400!important; line-height:1.5; }
html body .controls .field > span:first-child b { font-size:11px!important; font-weight:400!important; color:var(--muted); }
html body .controls .input-wrap small,
html body .controls .primary-market-field .input-wrap::before { font-size:11px!important; font-weight:400!important; }
html body .controls :is(.save-holding-button,.fee-mode-button,.clear-plan-button),
html body .controls :is(.save-holding-button,.fee-mode-button,.clear-plan-button) :is(span,strong,b) { font-size:12px!important; font-weight:400!important; }
html body .controls .market-switch button,
html body .controls .market-switch button :is(b,span) { font-size:11px!important; font-weight:500!important; letter-spacing:0; }
html body .controls .market-switch button:not(.is-active),
html body .controls .market-switch button:not(.is-active) :is(b,span) { font-weight:400!important; }

/* Smaller desktop input text; retain touch-friendly mobile sizing. */
@media (min-width:821px) {
 html body .controls .input-wrap input,
 html body .controls .position-input-grid .primary-market-field .input-wrap input,
 html body .results .target-input-wrap input,
 html body .dialog-input input { font-size:14px!important; font-weight:400!important; }
}

/* Compact chart and fully readable calculation. */
html body .results .chart-section { padding:22px 20px; min-height:0; height:auto; }
html body .results .chart-section .section-title-row { margin-bottom:14px; gap:8px; }
html body .results .chart-section .panel-kicker { display:none; }
html body .results .chart-section #costChart { width:100%; height:auto!important; min-height:0!important; aspect-ratio:620/240; margin:0; overflow:visible; }
html body .results .chart-section .chart-area { opacity:.35; }
html body .results .chart-calculation { border-top:1px solid var(--line); padding-top:14px; margin-top:16px; }
html body .results .chart-calculation-label { display:block; font-size:12px; font-weight:500; color:var(--ink); line-height:1.5; margin-bottom:8px; }
html body .results .chart-section .formula { display:block!important; width:100%; max-width:100%; height:auto!important; max-height:none!important; margin:0!important; padding:0; font-family:var(--font); font-size:12px!important; font-weight:400; line-height:1.8; letter-spacing:0; white-space:normal!important; overflow:visible!important; text-overflow:clip!important; overflow-wrap:anywhere; -webkit-line-clamp:unset; color:var(--muted); font-variant-numeric:tabular-nums; }

/* Compact desktop workspace without browser zoom or clipped content. */
@media(min-width:1180px) {
 html body .app-shell { padding:0 20px 20px; }
 html body .dashboard, html body .results, html body .result-column { gap:14px; }
 html body .app-header { min-height:0; padding:12px 0; gap:8px; }
 html body .controls { padding:16px; gap:12px; }
 html body .controls-header { padding-bottom:12px; }
 html body .controls-header-tools { margin-top:8px; }
 html body .control-section { padding-bottom:12px; }
 html body .control-section legend { margin-bottom:10px; }
 html body .controls .input-wrap, html body .results .target-input-wrap { height:36px!important; min-height:36px!important; border-radius:8px; }
 html body .controls .input-wrap input, html body .results .target-input-wrap input { height:34px!important; font-size:14px!important; }
 html body .controls .field { gap:5px; }
 html body .trade-input-grid { margin-top:8px; }
 html body .result-hero { min-height:0; padding:18px; gap:10px; }
 html body .hero-number { margin-top:10px; }
 html body .hero-number span { font-size:48px; }
 html body .cashflow-card { padding-top:10px; }
 html body .metric-grid { gap:8px; }
 html body .metric { min-height:0; padding:12px 14px; }
 html body .metric div > strong { margin-top:5px; font-size:18px; }
 html body .results :is(.target-plan,.comparison-section,.price-position,.breakdown,.chart-section) { padding:16px; }
 html body .stage-section { padding:16px!important; }
 html body .results .section-title-row, html body .stage-section .section-title-row { margin-bottom:12px!important; }
 html body .results .target-plan-body { gap:12px; }
 html body .results #applyTargetPlan { height:36px!important; min-height:36px; padding-block:0; }
 html body .results .target-plan-copy > p { margin-bottom:10px; }
 html body .results .target-plan-stats, html body .results .target-plan-stats > span { min-height:40px; }
 html body .comparison-section .table-scroll { margin-top:8px; }
 html body .comparison-table th { padding:8px; }
 html body .comparison-table td { padding:7px 8px; }
 html body .position-visual { margin-top:14px; }
 html body .breakdown dl { margin-top:8px; }
 html body .breakdown dl > div { padding-block:8px; }
 html body .results .chart-section #costChart { max-height:180px; }
 html body .results .chart-calculation { margin-top:10px; padding-top:10px; }
}

/* Keep the desktop overview within a typical laptop viewport. */
@media (min-width:1180px) {
 html body .results .section-title-row .panel-kicker { display:none!important; }
 html body .results :is(.target-plan,.comparison-section,.price-position,.breakdown,.chart-section) { padding:14px; }
 html body .results .section-title-row { margin-bottom:8px!important; }
 html body .results .section-title-row > div { gap:0; }
 html body .result-hero { padding:16px; gap:8px; }
 html body .cost-change { margin-top:8px; }
 html body .cashflow-card { display:grid; grid-template-columns:1fr auto; align-items:baseline; gap:4px 8px; }
 html body .cashflow-card strong, html body .cashflow-card small { margin:0; }
 html body .cashflow-card small { grid-column:1 / -1; }
 html body .stage-section { padding:14px!important; }
 html body .stage-section .stage-card { padding:0!important; gap:4px; }
 html body .stage-section .stage-card strong { margin:0; }
 html body .results .chart-section #costChart { max-height:150px; }
 html body .comparison-table td { padding:3px 8px; }
 html body .comparison-table .table-action { min-height:26px; height:26px; padding:3px 8px; }
 html body .breakdown dl > div { padding-block:5px; }
 html body .position-visual { margin-top:8px; }
 html body .controls { gap:10px; padding:14px; }
 html body .control-section { padding-bottom:8px; }
 html body .controls .position-input-grid { gap:8px; }
 html body .controls .stock-identity-grid { margin-bottom:10px; }
 html body .controls-header { padding-bottom:8px; }
}

html body #workspaceToolbar[hidden] { display:none!important; }
html body .workspace-toggle { border:1px solid var(--line); border-radius:8px; background:var(--panel, #fff); color:var(--ink); padding:8px 10px; font:inherit; font-size:12px; cursor:pointer; white-space:nowrap; }
html body .workspace-toggle:focus-visible { outline:2px solid #007aff; outline-offset:3px; }
html body .announcement-dialog { width:min(520px, calc(100vw - 32px)); }
html body .announcement-dialog h3 { font-size:15px; margin:0 0 12px; }
html body .announcement-dialog .dialog-body p { font-size:14px; line-height:1.7; margin:0 0 12px; color:var(--muted); }
html body .announcement-actions { justify-content:space-between; gap:16px; flex-wrap:wrap; }
html body .announcement-actions label { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); cursor:pointer; }
html body #announcementDismiss { width:16px; height:16px; accent-color:#007aff; }

/* Align the three desktop columns at their lower edge. */
@media (min-width:1180px) {
  html body .dashboard { align-items:stretch; }
  html body .sidebar-column { display:flex; align-self:stretch; }
  html body .sidebar-column > .controls { flex:1; }
  html body .results { align-items:stretch; align-self:stretch; }
  html body .results .result-column { align-self:stretch; }
  html body .result-main-column > .chart-section,
  html body .result-side-column > .breakdown { flex-grow:1; }
}


/* Let parameter actions share the rail width and wrap before squeezing. */
html body .controls .controls-header-tools {
  display:flex; flex-wrap:wrap; align-items:stretch; gap:8px; width:100%; margin-top:12px;
}
html body .controls .controls-header-tools > .save-holding-button { flex:1.15 0 88px; }
html body .controls .controls-header-tools > .fee-mode-button { flex:1.15 0 92px; }
html body .controls .controls-header-tools > .clear-plan-control { flex:.8 0 64px; min-width:64px; }
html body .controls .controls-header-tools :is(.save-holding-button,.fee-mode-button,.clear-plan-button) {
  display:inline-flex; align-items:center; justify-content:center; gap:4px; min-height:36px; padding:8px; white-space:nowrap; line-height:1.4;
}
html body .controls .controls-header-tools .clear-plan-button { width:100%; height:100%; }
html body .controls .controls-header-tools button svg { flex-shrink:0; }

/* Keep both product names visible at every screen width. */
html body .app-header .brand-copy h1 { display:flex; flex-wrap:wrap; gap:2px 8px; white-space:normal; }
html body .app-header .brand-copy h1 > span { white-space:nowrap; }

#manualFeeSettings { margin-top:20px; }
#manualFeeSettings[hidden] { display:none!important; }
#manualFeeError { color:#c0392b; font-size:13px; margin-top:12px; }

/* Keep the current quote label and input on one balanced row. */
html body .controls .primary-market-field { display:grid; grid-template-columns:minmax(70px,1fr) minmax(0,1.5fr); align-items:center; gap:12px; }
html body .controls .primary-market-field .input-wrap { width:100%; min-width:0; }
#cnAnnouncementNote { margin-bottom:18px; }
#announcementDialog #cnMarketNote { margin:0; padding:0; background:none; border:0; }

/* Merge related result panels into two calm surfaces. */
html body .result-main-column > .result-summary { padding:0 16px 12px; overflow:visible; }
html body .result-summary .result-hero { min-height:0; padding:16px 0 12px; border-radius:0; background:transparent; }
html body .result-summary .metric-grid { gap:0; border-top:1px solid var(--line)!important; }
html body .result-summary .metric { min-height:0; padding:12px 10px; border:0; border-radius:0; background:transparent; }
html body .result-summary .metric:nth-child(odd) { border-right:1px solid var(--line); }
html body .result-summary .metric:nth-child(-n+2) { border-bottom:1px solid var(--line); }
html body .result-main-column > .cost-analysis { display:flex; flex-direction:column; min-height:0; padding:14px 16px; overflow:visible; }
html body .cost-analysis :is(.stage-section,.chart-section) { border:0; border-radius:0; background:transparent; padding:0!important; }
html body .cost-analysis .stage-section { padding-bottom:14px!important; border-bottom:1px solid var(--line); overflow:visible; }
html body .cost-analysis .chart-section { flex:1; padding-top:14px!important; overflow:visible; }
@media (min-width:1180px) {
 html body .results .result-main-column { grid-template-rows:auto minmax(min-content,1fr); align-content:stretch; }
 html body .result-main-column > .cost-analysis { align-self:stretch; }
 html body .result-summary .metric { padding:9px 10px; }
}
@media (max-width:820px) {
 html body .result-main-column > :is(.result-summary,.cost-analysis) { padding:16px; }
 html body .result-summary .metric { padding:12px 8px; }
}

/* Remove the old hero accent now that the hero sits inside one result card. */
html body .result-summary .result-hero { border:0!important; box-shadow:none!important; }
html body .result-summary .result-hero::before,html body .result-summary .result-hero::after { display:none!important; }
html body .cost-analysis .chart-section #costChart { height:auto!important; min-height:0!important; }
html body .chart-cost-legend { display:flex; flex-wrap:wrap; gap:8px 20px; margin-top:12px; font-size:12px; line-height:1.5; color:var(--muted); }
html body .chart-cost-legend span { display:inline-flex; align-items:baseline; gap:5px; }
html body .chart-cost-legend strong { font-size:13px; font-weight:600; color:var(--ink); font-variant-numeric:tabular-nums; }
html body .chart-cost-legend span:last-child strong { color:var(--blue); }

/* Header: brand, calculator actions, then quiet utilities. */
html body .app-header { display:flex; align-items:center; justify-content:flex-start; flex-wrap:wrap; column-gap:20px; row-gap:10px; }
html body .app-header .brand-group { flex:0 0 auto; min-width:0; gap:10px; }
html body .app-header .brand-mark { box-shadow:none; }
html body .app-header .header-actions { display:flex; flex:0 1 auto; flex-wrap:wrap; width:auto; min-width:0; align-items:center; justify-content:flex-start; gap:10px; margin:0; }
html body .app-header .header-primary-actions,
html body .app-header .header-secondary-actions,
html body .app-header .header-utilities { display:flex; align-items:center; flex-wrap:wrap; gap:6px; min-width:0; }
html body .app-header .header-secondary-actions { padding-left:10px; border-left:1px solid var(--line); }
html body .app-header .header-utilities { flex:0 0 auto; padding-left:10px; border-left:1px solid var(--line); }
html body .app-header :is(.header-tool-button,.reset-button,.workspace-toggle,.theme-toggle,.support-toggle) { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:34px; white-space:nowrap; text-overflow:clip; box-shadow:none!important; }
html body .app-header .header-actions :is(.header-tool-button,.reset-button) { width:auto; padding:0 10px; }
html body .app-header .header-secondary-actions :is(.header-tool-button,.reset-button),
html body .app-header .header-utilities :is(.workspace-toggle,.theme-toggle,.support-toggle) { background:transparent!important; border:0!important; color:var(--muted); }
html body .app-header .header-utilities :is(.theme-toggle,.support-toggle) { padding:0 7px; font-size:12px; }
html body .app-header .header-utilities :is(.theme-toggle,.support-toggle) span { display:inline; }
html body .app-header .header-utilities .workspace-toggle { padding:0 7px; font-weight:600; }
html body .app-header .header-actions .new-measurement-button { background:var(--blue)!important; border-color:var(--blue)!important; color:#fff!important; }
html body .app-header #workspaceToolbar[hidden] { display:none!important; }
@media (max-width:1350px) {
  html body .app-header .brand-group { order:0; margin-right:0; }
  html body .app-header .header-actions { display:contents; }
  html body .app-header .header-primary-actions { order:1; }
  html body .app-header .header-utilities { order:3; margin-left:0; }
  html body .app-header .header-secondary-actions { order:2; margin-left:0; }
}
@media (max-width:820px) {
  html body .app-header .header-actions { display:contents; }
  html body .app-header .header-secondary-actions { flex-wrap:wrap; }
}
@media (max-width:560px) {
  html body .app-header .brand-group { flex:1 1 100%; margin-right:0; }
  html body .app-header .header-primary-actions { flex:1 1 100%; }
  html body .app-header .header-utilities { flex-wrap:wrap; margin-left:0; padding-left:0; border-left:0; }
  html body .app-header .header-secondary-actions { flex:1 1 100%; margin-left:0; padding-left:0; border-left:0; }
}
@media (min-width:1180px) {
  html body .results .result-side-column {
    grid-template-rows:auto auto auto minmax(min-content,1fr);
    align-content:stretch;
  }
}

/* Keep the target label, value and action on one desktop baseline. */
@media (min-width: 621px) {
  html body .results .target-plan-body {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "field action" "details details";
    align-items: center!important;
  }
  html body .results .target-inline-field {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  html body .results .target-inline-field > span:first-child { white-space: nowrap; }
  html body .results .target-input-wrap { min-width: 0; width: 100%; }
  html body .results #applyTargetPlan { align-self: center!important; white-space: nowrap; }
}

/* Share one outer alignment and give the trading inputs more room. */
@media (min-width:1180px) {
 html body .app-shell { padding-inline:16px; }
 html body .dashboard { grid-template-columns:clamp(320px,25vw,380px) minmax(0,1fr); column-gap:20px; }
 html body .sidebar-column { margin-left:0; min-width:0; }
 html body .controls { padding-inline:16px; }
}
/* Keep the calculation available beside the chart title without consuming chart space. */
/* Remove the old decorative marker column from form section headings. */
html body .controls .control-section legend .legend-heading { grid-template-columns:minmax(0,1fr); column-gap:0; margin-left:0; padding-left:0; }
html body .controls .legend-heading > span,
html body .controls .legend-heading small { grid-column:1; margin-left:0; padding-left:0; }
html body .results .chart-section .section-title-row > div:first-child { overflow:visible; }
html body .results .chart-section .chart-heading { position:relative; display:flex; flex-direction:row; align-items:center; gap:7px; min-width:0; overflow:visible; }
html body .results .chart-section .chart-heading h2 { flex:0 1 auto; }
html body .results .chart-help { position:static; display:inline-flex; flex:none; align-items:center; margin:0; width:auto; color:var(--muted); }
html body .results .chart-help-trigger { display:inline-flex; align-items:center; justify-content:center; width:19px; height:19px; min-width:19px; padding:0; border:1px solid var(--line); border-radius:50%; background:transparent; box-shadow:none; color:var(--muted); font-size:12px; font-weight:600; line-height:1; cursor:help; }
html body .results .chart-help-trigger:hover, html body .results .chart-help-trigger:focus-visible { border-color:var(--blue); color:var(--blue); outline:none; }
html body .results .chart-help-trigger:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
html body .results .chart-help .chart-calculation { position:absolute; z-index:20; top:calc(100% + 10px); left:0; display:block; box-sizing:border-box; width:min(340px, calc(100vw - 64px)); max-width:none; margin:0; padding:15px 16px; border:1px solid var(--line); border-radius:10px; background:var(--panel, #fff); box-shadow:none; color:var(--muted); white-space:normal; visibility:hidden; opacity:0; pointer-events:none; }
html body .results .chart-help:hover .chart-calculation, html body .results .chart-help-trigger:focus-visible + .chart-calculation, html body .results .chart-help.is-open .chart-calculation { visibility:visible; opacity:1; pointer-events:auto; }
html[data-theme="dark"] body .results .chart-help .chart-calculation { background:var(--canvas); }
html body .results .chart-help .chart-calculation::before { position:absolute; top:-10px; left:0; width:100%; height:10px; content:""; }
html body .results .chart-help .chart-calculation-label { margin-bottom:7px; }
html body .results .chart-help .chart-cost-legend { border-top:1px solid var(--line); padding-top:10px; }

/* Scenario chart: a quiet readout, full plot, and an inspectable curve. */
.chart-snapshot[hidden] { display:none!important; }
html body .unsaved-dialog .unsaved-save-error { margin:12px 0 0; color:var(--ink); font-size:12px; line-height:1.7; }
html body .trail-toolbar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin:12px 0 8px; }
html body .trail-toolbar p { font-size:11px; line-height:1.6; color:var(--muted); margin:0; flex:1 1 170px; }
html body .trail-toolbar > div { display:flex; flex-wrap:wrap; gap:7px; }
html body .trail-toolbar button { font:inherit; font-size:11px; padding:7px 10px; border-radius:7px; border:1px solid var(--line); background:transparent; color:var(--ink); cursor:pointer; }
html body .trail-toolbar .trail-confirm { background:var(--blue); color:white; border-color:var(--blue); }
html body .trail-toolbar button:disabled { opacity:.4; cursor:default; }
html body .trail-toolbar [hidden] { display:none; }
html body #costChart .trail-preview-line { fill:none; stroke:var(--blue); stroke-width:2; stroke-dasharray:5 6; opacity:.55; }
html body #costChart .trail-hit { fill:transparent; stroke:none; }
html body #costChart .trail-dot { fill:var(--blue); stroke:white; stroke-width:3; }
html body #costChart .is-preview .trail-dot { fill:white; stroke:var(--blue); stroke-width:2; stroke-dasharray:3 2; }
html body #costChart .trail-node { cursor:pointer; outline:none; }
html body #costChart .trail-node.is-selected .trail-dot, html body #costChart .trail-node:focus-visible .trail-dot { stroke:var(--blue); stroke-width:3; fill:white; r:8px; }
html body .trail-detail { border-top:1px solid var(--line); padding-top:12px; display:grid; gap:6px; min-height:52px; }
html body .trail-detail strong { font-size:13px; color:var(--ink); font-weight:500; font-variant-numeric:tabular-nums; }
html body .trail-detail span { font-size:11px; line-height:1.7; color:var(--muted); }
html body .chart-footer em { width:12px; height:0; border-top:2px dashed var(--blue); margin-left:6px; opacity:.6; }
html body .results .cost-analysis .chart-section #costChart { aspect-ratio:620/290; cursor:default; }
html[data-theme="dark"] body #costChart .trail-dot { stroke:var(--canvas); }
html body .result-main-column > .cost-analysis { padding:18px 20px 16px; }
html body .cost-analysis .chart-section { display:flex; flex-direction:column; min-height:0; }
html body .chart-snapshot { display:flex; align-items:center; gap:18px; margin:10px 0 6px; padding:0 0 14px; border-bottom:1px solid var(--line); }
html body .chart-snapshot > div { display:grid; gap:5px; min-width:0; }
html body .chart-snapshot span { font-size:11px; color:var(--muted); }
html body .chart-snapshot strong { font-size:21px; line-height:1.3; font-weight:600; letter-spacing:-.025em; color:var(--ink); font-variant-numeric:tabular-nums; }
html body .chart-snapshot > div:nth-of-type(2) strong { color:var(--blue); }
html body .chart-snapshot .chart-snapshot-arrow { font-size:20px; color:var(--faint); padding-top:15px; }
html body .chart-snapshot .chart-snapshot-reference { margin-left:auto; text-align:right; }
html body .chart-snapshot-reference strong { font-size:13px; color:var(--muted); font-weight:500; letter-spacing:0; }
html body .chart-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 16px; margin-top:auto; padding-top:10px; color:var(--muted); font-size:10px; }
html body .chart-footer > span:first-child { display:flex; align-items:center; gap:6px; }
html body .chart-footer i { width:12px; height:2px; border-radius:1px; background:var(--blue); }
html body #costChart .chart-inspect-guide { stroke:var(--blue); stroke-width:1; stroke-dasharray:3 5; opacity:.6; }
html body #costChart .chart-inspect-point { fill:var(--blue); stroke:var(--canvas,#fff); stroke-width:3; }
html body #costChart .chart-inspect-card { fill:#fff; stroke:var(--line); stroke-width:1; }
html body #costChart .chart-inspect-label { font-family:var(--font); fill:var(--muted); font-size:12px; }
html body #costChart .chart-inspect-value { font-family:var(--font); fill:var(--blue); font-weight:600; font-size:13px; }
html[data-theme="dark"] body #costChart .chart-inspect-card { fill:var(--canvas); }
html body #costChart:focus-visible { outline:2px solid var(--blue); outline-offset:4px; border-radius:6px; }
@media(max-width:620px) {
 html body .chart-snapshot { gap:10px; flex-wrap:wrap; }
 html body .chart-snapshot strong { font-size:18px; }
 html body .chart-snapshot .chart-snapshot-reference strong { font-size:12px; }
}

/* Use the full chart width and explain the two marked costs directly. */
html body .results .cost-analysis .chart-section #costChart { display:block; width:100%; height:auto!important; max-height:none; aspect-ratio:620/300; margin:8px 0 0; cursor:crosshair; touch-action:pan-y; }
html body #costChart .chart-axis-label { font-size:11px; fill:var(--muted); font-weight:400; }
html body #costChart .chart-axis-title { font-family:var(--font); font-size:11px; fill:var(--muted); }
html body #costChart .chart-direct-label { font-family:var(--font); font-size:12px; font-weight:600; paint-order:stroke; stroke:#fff; stroke-width:5px; stroke-linejoin:round; }
html body #costChart .chart-original-label { fill:var(--muted); }
html body #costChart .chart-current-label, html body #costChart .chart-current-price { fill:var(--blue); }
html body #costChart .chart-current-price { font-family:var(--font); font-size:11px; font-weight:600; }
html body #costChart .chart-line { stroke:var(--blue); stroke-width:2.5; }
html body #costChart .chart-point { stroke:var(--blue); stroke-width:2.5; fill:#fff; }
html body #costChart .chart-basis-point { stroke:var(--muted); stroke-width:2; fill:#fff; }
html body #costChart .chart-grid-line { stroke:var(--line); opacity:.6; }
html body .results #costChart .chart-area { fill:url(#chartAreaGradient); opacity:1; }
html[data-theme="dark"] body #costChart .chart-direct-label { stroke:var(--canvas); }
html[data-theme="dark"] body #costChart :is(.chart-point,.chart-basis-point) { fill:var(--canvas); }

/* Keep the cost flow with the main result explanation. */
html body .basis-dialog { width:min(680px,calc(100vw - 32px)); }
html body .basis-dialog .stage-section { padding:0 0 20px!important; margin:0 0 20px; border:0; border-bottom:1px solid var(--line); background:transparent; border-radius:0; }
html body .basis-dialog .stage-section .panel-kicker { display:none; }
html body .basis-dialog .stage-section .section-title-row { margin-bottom:16px!important; }
html body .basis-dialog .stage-section .stage-grid { gap:8px!important; }
html body .basis-dialog .stage-section .stage-card { padding:0!important; }
html body .basis-dialog .stage-section .stage-card strong { font-size:17px!important; }
html body .cost-analysis .chart-section { padding-top:0!important; }

/* Give the result one clear headline and quieter supporting figures. */
/* A single compact row for target-cost entry and its action. */
html body .results .target-plan { display:grid; grid-template-columns:max-content minmax(90px,1fr) auto; align-items:center; gap:10px; }
html body .results .target-plan .target-title-row,
html body .results .target-plan .target-title-row > div,
html body .results .target-plan .target-plan-body { display:contents; }
html body .results .target-plan .target-title-row .panel-kicker,
html body .results .target-plan #targetPlanBadge,
html body .results .target-plan .target-inline-field > span:first-child,
html body .results .target-plan .target-plan-stats { display:none; }
html body .results .target-plan #targetPlanTitle { font-size:14px!important; white-space:nowrap; grid-column:1; grid-row:1; }
html body .results .target-plan .target-inline-field { display:block; grid-column:2; grid-row:1; min-width:0; width:100%; max-width:none; margin:0; }
html body .results .target-plan .target-input-wrap { width:100%; min-width:0; }
html body .results .target-plan #applyTargetPlan { grid-column:3; grid-row:1; align-self:center!important; width:auto; white-space:nowrap; padding-inline:10px; font-size:12px; }
html body .results .target-plan .target-plan-copy { display:contents; }
html body .results .target-plan #targetPlanMessage { grid-column:1 / -1; margin:0; font-size:11px; line-height:1.6; }
html body .results .target-plan .target-plan-needed #targetPlanMessage { display:none; }
@media(max-width:620px) {
 html body .results .target-plan { grid-template-columns:minmax(0,1fr) auto; gap:12px; }
 html body .results .target-plan #targetPlanTitle { grid-column:1 / -1; grid-row:1; }
 html body .results .target-plan .target-inline-field { grid-column:1; grid-row:2; }
 html body .results .target-plan #applyTargetPlan { grid-column:2; grid-row:2; }
}
html body .result-main-column > .result-summary { padding:20px 20px 8px; }
html body .result-summary .result-hero { padding:0 0 16px; gap:16px; }
html body .result-summary .hero-copy { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:baseline; column-gap:20px; row-gap:10px; }
html body .result-summary .hero-label-row { grid-column:1 / -1; gap:8px; }
html body .result-summary .hero-label-row p { margin:0; color:var(--ink); font-size:13px; font-weight:600; }
html body .result-summary .calculation-badge { border:0; background:var(--bg); border-radius:5px; padding:3px 6px; font-size:10px; font-weight:400; }
html body .result-summary .hero-number { margin:0; gap:8px; align-items:baseline; }
html body .result-summary .hero-number span { font-size:44px; line-height:1.15; letter-spacing:-.045em; font-weight:600; }
html body .result-summary .hero-number small { padding:0; font-size:11px; }
html body .result-summary .cost-change { margin:0; font-size:11px; line-height:1.6; font-weight:400; justify-self:end; text-align:right; }
html body .result-summary .result-insight { grid-column:1 / -1; margin:0; }
html body .result-summary .cashflow-card { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:baseline; gap:3px 12px; padding:12px 0 0; border:0; border-top:1px solid var(--line); }
html body .result-summary .cashflow-card > span { font-size:11px; font-weight:500; }
html body .result-summary .cashflow-card strong { font-size:16px; font-weight:500; line-height:1.5; margin:0; }
html body .result-summary .cashflow-card small { grid-column:1 / -1; font-size:10px; margin:0; }
html body .result-summary .metric-grid { border-radius:0; overflow:visible; }
html body .result-summary .metric { padding:12px 0; box-shadow:none!important; }
html body .result-summary .metric:nth-child(odd) { padding-right:16px; border-right:0; }
html body .result-summary .metric:nth-child(even) { padding-left:16px; }
html body .result-summary .metric div > span { font-size:11px; line-height:1.5; font-weight:400; }
html body .result-summary .metric div > strong { margin-top:5px; font-size:17px; line-height:1.4; font-weight:500; letter-spacing:0; }
@media(max-width:620px) {
 html body .result-main-column > .result-summary { padding:16px 16px 4px; }
 html body .result-summary .hero-copy { grid-template-columns:minmax(0,1fr); row-gap:8px; }
 html body .result-summary .cost-change { justify-self:start; text-align:left; }
 html body .result-summary .hero-number span { font-size:40px; }
 html body .result-summary .cashflow-card { grid-template-columns:minmax(0,1fr); }
 html body .result-summary .cashflow-card strong { grid-row:2; }
 html body .result-summary .metric div > strong { font-size:16px; overflow-wrap:anywhere; }
}
@media(max-width:480px) {
 html body .basis-dialog .stage-section .stage-card strong { font-size:13px!important; overflow-wrap:anywhere; }
 html body .basis-dialog .stage-section .stage-grid { gap:4px!important; }
 html body .basis-dialog .stage-section .stage-card small { font-size:11px; }
}

/* Holding book: searchable records with progressive disclosure. */
.holding-book-dialog { width: min(1000px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.holding-book-dialog .dialog-body { overflow-y: auto; }
.holding-tools { display: grid; grid-template-columns: minmax(180px, 1fr) 130px 140px; gap: 12px; margin: 18px 0 12px; }
.holding-tools label, .holding-detail-actions label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.holding-tools input, .holding-tools select, .holding-detail-actions input { box-sizing: border-box; width: 100%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--canvas); font: inherit; font-size: 13px; box-shadow: none; }
.holding-book-dialog .holding-list { max-height: min(560px, calc(100dvh - 340px)); align-items: start; gap: 14px; }
.holding-book-dialog .holding-card { padding: 16px; box-shadow: none; }
.holding-book-dialog .holding-card.is-current { border-color: var(--blue); box-shadow: none; }
.holding-book-dialog .holding-card-title span { white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
.holding-book-dialog .holding-card-title strong { font-size: 14px; }
.holding-book-dialog .holding-card-status, .holding-book-dialog .holding-card-metrics span, .holding-book-dialog .holding-card-footer time { font-size: 11px; }
.holding-book-dialog .holding-card-metrics { gap: 12px; padding: 14px 0; }
.holding-book-dialog .holding-card-metrics strong { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.holding-book-dialog .holding-card-actions button { height: 32px; font-size: 12px; }
.holding-plan-note { margin: 12px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.holding-details { border-top: 1px solid var(--line); padding-top: 12px; }
.holding-details summary { color: var(--blue); cursor: pointer; font-size: 12px; line-height: 1.6; }
.holding-details dl { display: grid; grid-template-columns: minmax(80px, .7fr) minmax(0, 1.3fr); gap: 10px 14px; margin: 16px 0; font-size: 12px; line-height: 1.6; }
.holding-details dt { color: var(--muted); }
.holding-details dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.holding-details h4 { margin: 18px 0 12px; font-size: 12px; }
.holding-timeline { list-style: none; padding: 0 0 0 12px; margin: 0; border-left: 2px solid var(--line); }
.holding-timeline li { position: relative; padding: 0 0 16px 6px; font-size: 12px; line-height: 1.6; }
.holding-timeline li::before { content: ''; position: absolute; left: -17px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.holding-timeline strong, .holding-timeline span { display: block; }
.holding-timeline strong { font-weight: 600; }
.holding-timeline span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.holding-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; border-top: 1px solid var(--line); padding-top: 14px; }
.holding-detail-actions label { flex: 1 1 150px; }
.holding-detail-actions button, .holding-recovery button { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--canvas); color: var(--blue); font-size: 12px; cursor: pointer; }
.holding-recovery { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.holding-error { color: var(--red); font-size: 12px; line-height: 1.6; }
.holding-book-dialog #holdingNoMatch { padding: 30px 0; text-align: center; color: var(--muted); font-size: 13px; }
@media(max-width: 680px) {
  .holding-tools { grid-template-columns: 1fr 1fr; }
  .holding-tools label:first-child { grid-column: 1 / -1; }
  .holding-book-dialog .holding-list { grid-template-columns: 1fr; max-height: none; overflow: visible; }
  .holding-book-dialog .holding-card-footer { flex-wrap: wrap; }
  .holding-book-dialog .dialog-body { max-height: calc(100dvh - 210px); }
  .holding-book-summary { align-items: start; flex-direction: column; }
}
@media(max-width: 680px) {
  .holding-book-dialog .holding-book-summary-actions { display: flex; width: 100%; flex-wrap: wrap; gap: 6px; }
  .holding-book-dialog .holding-book-summary-actions button { flex: 1 1 85px; width: auto; min-height: 34px; padding: 7px; font-size: 11px; }
  .holding-book-dialog .dialog-actions-split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .holding-book-dialog .dialog-actions-split > button { width: auto; min-width: 90px; }
  .holding-book-dialog #holdingBookFooter { white-space: nowrap; font-size: 10px; }
}
@media(max-width: 680px) {
  .holding-book-dialog .holding-book-summary-actions { flex-direction: row; }
  .holding-book-dialog .holding-book-summary-actions button { flex: 1 1 85px; height: 36px; }
}

/* Compact application toolbar. */
html body .app-header { flex-wrap: nowrap; gap: 20px; min-height: 64px; padding: 12px 0; position: relative; z-index: 20; }
html body .app-header .brand-group { flex: 1 1 auto; gap: 9px; margin: 0; }
html body .app-header .brand-mark { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; }
html body .app-header .brand-copy h1 { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 7px; margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.035em; }
html body .app-header .brand-copy h1 > span:last-child { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
html body .app-header .brand-copy .lead { margin: 3px 0 0; font-size: 10px; font-weight: 400; color: var(--muted); }
html body .app-header .header-actions { display: flex; flex: 0 0 auto; margin: 0; width: auto; }
html body .app-header .header-primary-actions { display: flex; flex: 0 0 auto; flex-wrap: nowrap; gap: 5px; }
html body .app-header .header-primary-actions .header-tool-button { height: 34px; min-height: 34px; padding: 0 11px; border: 1px solid transparent; background: transparent; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--ink); }
html body .app-header .header-primary-actions .header-tool-button:hover { background: var(--line); }
html body .app-header #newMeasurementButton { order: 3; margin-left: 7px; background: var(--blue)!important; color: #fff!important; }
html body .app-header :is(#holdingCount,#scenarioCount) { color: var(--muted); font-size: 10px; font-weight: 500; background: var(--bg); padding: 2px 5px; border-radius: 5px; line-height: 1.2; }
html body .app-header .header-tool-button svg { width: 14px; height: 14px; }
html body .app-header .header-more { position: relative; flex: 0 0 auto; margin-left: -12px; align-self: center; }
.header-more > summary { display: flex; align-items: center; gap: 5px; list-style: none; cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 8px 9px; color: var(--muted); font-size: 12px; user-select: none; }
.header-more > summary::-webkit-details-marker { display: none; }
.header-more > summary:hover, .header-more[open] > summary { color: var(--ink); background: var(--line); }
.header-more > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.header-more > summary svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.header-more-panel { position: absolute; top: calc(100% + 10px); right: 0; width: 210px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--canvas); box-shadow: none; z-index: 100; }
html body .app-header .header-more :is(.header-secondary-actions,.header-utilities) { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 2px; padding: 0; margin: 0; border: 0; }
html body .app-header .header-more :is(button.header-tool-button,.reset-button,.workspace-toggle,.theme-toggle,.support-toggle) { display: flex; width: 100%; height: 34px; min-height: 34px; padding: 0 10px; justify-content: flex-start; gap: 9px; border: 0!important; border-radius: 6px; background: transparent!important; color: var(--ink); font-size: 12px; font-weight: 400; }
html body .app-header .header-more button:hover { background: var(--bg)!important; }
html body .app-header .header-more .theme-toggle span, html body .app-header .header-more .support-toggle span { display: inline; }
.header-menu-label { margin: 5px 10px 7px; color: var(--muted); font-size: 10px; letter-spacing: .02em; }
.header-more-panel .header-secondary-actions + .header-menu-label { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
@media(max-width: 680px) {
 html body .app-header { flex-wrap: wrap; gap: 10px; padding: 12px 0; }
 html body .app-header .brand-group { flex: 1 1 auto; order: 0; }
 html body .app-header .header-actions { flex: 1 0 100%; order: 2; }
 html body .app-header .header-primary-actions { width: 100%; }
 html body .app-header #newMeasurementButton { margin-left: auto; }
 html body .app-header .header-more { order: 1; margin-left: 0; }
 html body .app-header .brand-copy .lead { display: none; }
}

/* Transaction ticket: consistent two-column entry rhythm. */
html body .controls .controls-header { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding-bottom:0; }
html body .controls .controls-header > div:first-child { flex:1 0 auto; }
html body .controls .controls-header-tools { display:flex; align-items:center; flex-wrap:nowrap; gap:6px; width:auto; margin:0; }
html body .controls .controls-header-tools > :is(.save-holding-button,.fee-mode-button,.clear-plan-control) { flex:0 0 auto; min-width:0; }
html body .controls .controls-header-tools :is(.save-holding-button,.fee-mode-button,.clear-plan-button) { min-height:28px; height:28px; padding:0 6px; background:transparent; border:0; border-radius:6px; box-shadow:none; font-size:11px!important; }
html body .controls .controls-header-tools .save-holding-button { color:var(--blue); }
html body .controls .controls-header-tools button:hover { background:var(--bg); }
html body .controls .controls-header-tools .live-chip { display:none; }
html body .controls .control-section { margin:0; padding:16px 0; border:0; border-top:1px solid var(--line); min-width:0; }
html body .controls .control-section:last-child { padding-bottom:0; }
html body .controls .control-section legend { float:left; display:flex; align-items:center; justify-content:space-between; width:100%; margin:0 0 14px; padding:0; gap:8px; }
html body .controls .control-section legend + * { clear:both; }
html body .controls .legend-heading small { font-size:10px!important; margin-top:2px; }
html body .controls .market-switch { flex:0 0 auto; padding:3px; gap:1px; border-radius:8px; }
html body .controls .market-switch button { min-width:0; padding:5px 7px; height:28px; border-radius:6px; }
html body .controls .market-switch button b { display:none; }
html body .controls .ticket-position-grid, html body .controls .ticket-trade-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
html body .controls .ticket-position-grid .field, html body .controls .ticket-trade-grid .field { display:flex; flex-direction:column; align-items:stretch; gap:6px; min-width:0; margin:0; padding:0; width:auto; grid-column:auto; }
html body .controls .ticket-position-grid .field-title b { display:none; }
html body .controls .ticket-position-grid .input-wrap, html body .controls .ticket-trade-grid .input-wrap { width:100%; min-width:0; box-sizing:border-box; height:38px; min-height:38px; border-radius:8px; box-shadow:none; }
html body .controls .ticket-position-grid .input-wrap input, html body .controls .ticket-trade-grid .input-wrap input { height:36px; padding:0 9px; font-size:14px!important; }
html body .controls .input-wrap small { min-width:24px; padding:0 6px; font-size:10px!important; }
html body .controls .primary-market-field .input-wrap::before { display:none; }
html body .controls .legend-value { font-size:11px; font-weight:500; border:0; background:transparent; padding:0; color:var(--muted); }
html body .controls .buy-section .legend-heading > span::before, html body .controls .sell-section .legend-heading > span::before { content:''; display:inline-block; width:5px; height:5px; margin:0 7px 3px 0; border-radius:50%; background:var(--blue); }
html body .controls .sell-section .legend-heading > span::before { background:#dd8b2d; }
html body .controls .sell-trail-continuation { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:14px; padding:12px; border:1px solid #f0d6b5; border-radius:8px; background:color-mix(in srgb, #dd8b2d 7%, transparent); }
html body .controls .sell-trail-continuation[hidden] { display:none; }
html body .controls .sell-trail-continuation > div { display:grid; gap:4px; min-width:0; }
html body .controls .sell-trail-continuation strong { font-size:12px; }
html body .controls .sell-trail-continuation span { color:var(--muted); font-size:11px; }
html body .controls .sell-trail-continuation button { flex:none; min-height:34px; padding:0 10px; border:0; border-radius:7px; background:#dd8b2d; color:#fff; font-size:11px; font-weight:600; cursor:pointer; }
html body .controls .ticket-price-adjust { align-self:end; display:flex; flex-direction:column; justify-content:center; gap:8px; height:38px; min-width:0; padding:0 2px; }
html body .controls .ticket-price-adjust label { color:var(--muted); font-size:10px; }
html body .controls .ticket-price-adjust input[type=range] { width:100%; margin:0; height:4px; }
html body .controls .input-wrap:focus-within { border-color:var(--blue); outline:2px solid #0071e326; outline-offset:1px; }
@media(max-width:820px) {
 html body .controls .ticket-position-grid .input-wrap, html body .controls .ticket-trade-grid .input-wrap { height:44px; min-height:44px; }
 html body .controls .ticket-position-grid .input-wrap input, html body .controls .ticket-trade-grid .input-wrap input { font-size:16px!important; height:42px; }
 html body .controls .ticket-price-adjust { height:44px; }
}
html body .controls .ticket-position-grid #lotSizeField { grid-column:auto; }
html body .controls .controls-header { border-bottom:0; }
html body .controls .holding-section legend { flex-wrap:nowrap; }
html body .controls .holding-section legend .market-switch { width:auto; margin:0; }
html body .controls .ticket-position-grid [hidden] { display:none!important; }

/* Two coherent result surfaces: planning and funds overview. */
html body .results .result-side-column { display:flex; flex-direction:column; gap:16px; align-content:start; justify-content:flex-start; }
html body .results .merged-result-card { padding:0 16px; min-width:0; flex:0 0 auto; overflow:visible; border:0; border-radius:18px; background:var(--canvas); box-shadow:none; }
html body .results .merged-result-card > section { margin:0; padding:16px 0; min-height:0; border:0; border-radius:0; background:transparent; box-shadow:none; flex:none; }
html body .results .merged-result-card > section + section { border-top:1px solid var(--line); }
html body .results .merged-result-card .breakdown { flex-grow:0; }
html body .results .merged-result-card .breakdown dl { margin:12px 0 0; }
html body .results .merged-result-card .breakdown dl > div { padding:9px 0; }
html body .results .merged-result-card .breakdown dl > div:last-child { padding-bottom:0; }
html body .results .merged-result-card .comparison-section .table-scroll { margin-top:10px; }
html body .results .merged-result-card .comparison-section .section-title-row { margin:0; }
html body .results .merged-result-card .price-position .position-visual { margin-top:14px; }
@media(max-width:620px) {
 html body .results .merged-result-card { padding:0 16px; }
 html body .results .merged-result-card > section { padding:16px 0; }
}
/* Show only stages for trades actually present in the plan. */
html body .basis-dialog .stage-grid > [hidden] { display:none!important; }
html body .basis-dialog .stage-grid[data-steps="2"] { grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr)!important; }
html body .basis-dialog .stage-grid[data-steps="1"] { grid-template-columns:minmax(0,1fr)!important; }

/* A single scroll container keeps expanded holding histories reachable. */
html body .holding-book-dialog[open] { display:flex; flex-direction:column; max-height:calc(100dvh - 32px); overflow:hidden; }
html body .holding-book-dialog > .dialog-header, html body .holding-book-dialog > .dialog-actions { flex:0 0 auto; }
html body .holding-book-dialog > .holding-book-dialog-body { flex:1 1 auto; min-height:0; max-height:none; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding-bottom:24px; }
html body .holding-book-dialog .holding-list { max-height:none; overflow:visible; }
html body .holding-book-dialog .holding-details { overflow:visible; }

/* Price dragging is the primary interaction, with a full-width track. */
html body .controls .ticket-trade-grid .ticket-price-field { grid-column:1 / -1; grid-row:1; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:12px; }
html body .controls .ticket-trade-grid .ticket-price-adjust { grid-column:1 / -1; grid-row:2; display:grid; grid-template-columns:minmax(0,1fr); gap:7px; height:auto; padding:0; align-self:stretch; }
html body .controls .ticket-price-adjust label { font-size:11px; }
html body .controls .ticket-price-adjust input[type=range] { display:block; width:100%; height:28px; margin:0; cursor:ew-resize; touch-action:pan-y; }
html body .controls .ticket-price-adjust .range-scale { display:flex; justify-content:space-between; margin:0; font-size:10px; line-height:1.3; color:var(--muted); }
html body .controls .ticket-trade-grid .ticket-fee-field { grid-column:2; grid-row:3; }
html body .controls .ticket-trade-grid > .field:not(.ticket-price-field):not(.ticket-fee-field) { grid-column:1; grid-row:3; }
html body .controls .ticket-price-adjust input[type=range]::-webkit-slider-thumb { width:18px; height:18px; margin-top:-6px; }
html body .controls .ticket-price-adjust input[type=range]::-webkit-slider-runnable-track { height:6px; border-radius:3px; }
html body .controls .ticket-price-adjust.sell-slider input[type=range]::-webkit-slider-runnable-track { background:linear-gradient(90deg,#dd8b2d var(--fill,0%),#dfe3e8 var(--fill,0%)); }
html body .controls .ticket-price-adjust.sell-slider input[type=range]::-webkit-slider-thumb { background:#dd8b2d; }
html body .controls .ticket-price-adjust > label, html body .controls .ticket-price-adjust > input[type=range], html body .controls .ticket-price-adjust > .range-scale { grid-area:auto; grid-column:1; width:100%; max-width:none; box-sizing:border-box; }
html body .controls .ticket-price-adjust > label { grid-row:1; }
html body .controls .ticket-price-adjust > input[type=range] { grid-row:2; }
html body .controls .ticket-price-adjust > .range-scale { grid-row:3; }
html body .controls .ticket-trade-grid .ticket-price-field > span:first-child { grid-area:auto; grid-column:1; grid-row:1; white-space:nowrap; width:auto; }
html body .controls .ticket-trade-grid .ticket-price-field > .input-wrap { grid-area:auto; grid-column:2; grid-row:1; }

/* Holding book shares one inset and stable card rows. */
html body .holding-book-dialog { --holding-inset:20px; }
html body .holding-book-dialog > .dialog-header, html body .holding-book-dialog > .dialog-actions { padding-inline:var(--holding-inset); }
html body .holding-book-dialog > .holding-book-dialog-body { padding-inline:var(--holding-inset); scrollbar-gutter:stable both-edges; }
html body .holding-book-dialog > .dialog-header, html body .holding-book-dialog > .dialog-actions { margin-inline:0; padding-left:calc(var(--holding-inset) + 15px); padding-right:calc(var(--holding-inset) + 15px); }
html body .holding-book-dialog .holding-recovery { align-items:center; }
html body .holding-book-dialog #holdingRecoveryStatus:empty { display:none; }
html body .holding-book-dialog .holding-card-header { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; min-height:30px; gap:12px; }
html body .holding-book-dialog .holding-card-title { display:grid; grid-template-columns:28px 64px minmax(0,1fr); align-items:center; gap:7px; }
html body .holding-book-dialog .holding-card-title span { line-height:1.5; }
html body .holding-book-dialog .holding-card-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; }
html body .holding-book-dialog .holding-card-metrics > div { display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px; align-items:baseline; min-height:20px; }
html body .holding-book-dialog .holding-card-metrics strong { text-align:right; font-variant-numeric:tabular-nums; }
html body .holding-book-dialog .holding-card-footer { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; min-height:32px; gap:8px; }
html body .holding-book-dialog .holding-plan-note { min-height:36px; margin:12px 0; display:flex; align-items:center; }
@media(max-width:680px) {
 html body .holding-book-dialog { --holding-inset:16px; }
 html body .holding-book-dialog .holding-card-title { grid-template-columns:26px 54px minmax(0,1fr); gap:5px; }
 html body .holding-book-dialog .holding-card-metrics { gap:10px; }
 html body .holding-book-dialog .holding-card-metrics > div { grid-template-columns:minmax(0,1fr); gap:3px; }
 html body .holding-book-dialog .holding-card-metrics strong { text-align:left; }
}
html body .holding-book-dialog > .dialog-header, html body .holding-book-dialog > .dialog-actions { padding-inline:var(--holding-inset); }

.share-card-dialog { width:min(790px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); }
.share-card-body { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(180px,1fr); gap:24px; padding:20px; overflow:auto; max-height:calc(100dvh - 200px); }
.share-card-body canvas { display:block; width:100%; height:auto; min-width:0; border:1px solid var(--line); border-radius:14px; }
.share-card-options { display:flex; flex-direction:column; gap:16px; padding-top:8px; font-size:13px; }
.share-card-options label { display:flex; align-items:center; gap:9px; color:var(--ink); cursor:pointer; }
.share-card-options input { width:16px; height:16px; accent-color:var(--blue); }
.share-card-options p { margin:0; color:var(--muted); font-size:12px; line-height:1.7; }
.share-save-preview { width:100%; height:auto; border-radius:8px; }
@media(max-width:560px){.share-card-body {grid-template-columns:minmax(0,1fr);gap:16px;padding:16px;}.share-card-body canvas {max-width:340px;justify-self:center;width:100%;}.share-card-options {padding:0;gap:12px;}.share-card-dialog .dialog-actions {display:flex;gap:8px;}.share-card-dialog .dialog-actions button {flex:1;width:auto;}}

/* Direct announcement entry. */
html body .app-header .announcement-entry { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; gap:6px; height:34px; min-height:34px; padding:0 9px; margin-left:-12px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--muted); font-size:12px; font-weight:500; box-shadow:none; white-space:nowrap; }
html body .app-header .announcement-entry svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
html body .app-header .announcement-entry:hover { color:var(--blue); background:var(--line); }
html body .app-header .announcement-entry:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
@media(max-width:680px) { html body .app-header .announcement-entry { order:1; margin-left:0; } }
@media(max-width:680px) {
 html body .app-header .announcement-entry { position:absolute; top:12px; right:54px; margin:0; padding-inline:6px; }
 html body .app-header .header-more { position:absolute; top:12px; right:0; margin:0; }
 html body .app-header .brand-group { padding-right:110px; }
}
@media(max-width:680px) {
 html body .app-header { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:10px 4px; }
 html body .app-header .brand-group { grid-column:1; grid-row:1; padding:0; min-width:0; }
 html body .app-header .announcement-entry { position:static; grid-column:2; grid-row:1; margin:0; padding-inline:6px; }
 html body .app-header .header-more { position:relative; top:auto; right:auto; grid-column:3; grid-row:1; margin:0; }
 html body .app-header .header-actions { grid-column:1 / -1; grid-row:2; width:100%; }
 html body .app-header .brand-copy h1 { font-size:16px; gap:4px; }
 html body .app-header .brand-copy h1 > span:last-child { font-size:11px; }
}

/* On phones, keep More as a compact anchored popover with a dismissible backdrop. */
@media(max-width:680px) {
  html body:has(.app-header #headerMore[open])::before {
    position:fixed;
    z-index:25;
    inset:0;
    content:"";
    background:rgba(20, 27, 39, .16);
    -webkit-backdrop-filter:blur(1px);
    backdrop-filter:blur(1px);
  }
  html body .app-header #headerMore { z-index:31; }
  html body .app-header .header-more-panel {
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    width:min(280px, calc(100vw - 24px));
    box-sizing:border-box;
    max-height:calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y:auto;
    overscroll-behavior:contain;
    border-color:rgba(178, 185, 198, .78);
    border-radius:16px;
    background:var(--canvas);
    box-shadow:0 14px 38px rgba(20, 27, 39, .18), 0 2px 8px rgba(20, 27, 39, .08);
    z-index:32;
  }
  html body .app-header #headerMore > summary { position:relative; z-index:1; }
}

/* Compact local price scenarios. */
html body .price-simulation { padding:18px 16px; border:1px solid var(--line); border-radius:18px; background:var(--canvas); box-shadow:none; }
html body .simulation-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
html body .simulation-heading h2 { margin:0; font-size:15px; font-weight:600; }
html body .simulation-heading button, html body .result-share-row button { padding:0; border:0; background:transparent; color:var(--blue); font-size:12px; cursor:pointer; }
html body .simulation-price { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:18px 0 10px; font-size:12px; color:var(--muted); }
html body .simulation-price strong { display:block; margin-top:5px; font-size:22px; font-weight:600; font-variant-numeric:tabular-nums; }
html body .simulation-track { padding:0 4px; }
html body #simulationRange { display:block; width:100%; height:28px; margin:0; padding:0; appearance:none; -webkit-appearance:none; background:transparent; cursor:ew-resize; }
html body #simulationRange::-webkit-slider-runnable-track { height:5px; border-radius:6px; background:linear-gradient(to right,var(--blue) var(--simulation-fill,0%),var(--line) var(--simulation-fill,0%)); }
html body #simulationRange::-webkit-slider-thumb { appearance:none; -webkit-appearance:none; width:18px; height:18px; border:2px solid var(--blue); border-radius:50%; background:var(--canvas); margin-top:-6.5px; box-shadow:none; }
html body #simulationRange::-moz-range-track { height:5px; background:var(--line); border-radius:6px; }
html body #simulationRange::-moz-range-thumb { width:15px; height:15px; border:2px solid var(--blue); border-radius:50%; background:var(--canvas); }
html body .simulation-markers { position:relative; height:39px; margin:0 9px; font-size:10px; color:var(--muted); }
html body .simulation-markers span { position:absolute; white-space:nowrap; transform:translateX(-50%); top:0; }
html body .simulation-markers span::before { content:''; display:block; width:1px; height:5px; margin:0 auto 3px; background:var(--line); }
html body #simulationBasisMarker { top:19px; color:var(--blue); }
html body .simulation-presets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; margin:6px 0 16px; }
html body .simulation-presets button { min-height:29px; border:1px solid var(--line); border-radius:6px; background:transparent; color:var(--muted); font-size:12px; cursor:pointer; }
html body .simulation-presets button:hover { color:var(--blue); border-color:var(--blue); }
html body .simulation-results { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:0; padding-top:14px; border-top:1px solid var(--line); }
html body .simulation-results dt { font-size:11px; color:var(--muted); }
html body .simulation-results dd { margin:6px 0 0; font-size:16px; font-weight:600; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
html body .simulation-note { margin:13px 0 0; font-size:10px; line-height:1.6; color:var(--muted); }
html body .result-share-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:0 4px 4px; font-size:11px; color:var(--muted); }
html body .price-simulation button:disabled,html body .result-share-row button:disabled { opacity:.4; cursor:default; }
html body .price-simulation :is(button,input):focus-visible { outline:2px solid var(--blue); outline-offset:3px; }

/* Scroll confirmed purchases within the chart card. */
html body .trail-history { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; min-height:0; }
html body .trail-history-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
html body .trail-history-heading h3 { margin:0; font-size:12px; font-weight:600; color:var(--ink); }
html body .trail-history-heading > span { font-size:10px; color:var(--muted); }
html body .trail-history-list { max-height:224px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; padding:2px; }
html body .trail-history-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 12px; width:100%; box-sizing:border-box; margin:0; padding:12px 10px; border:0; border-bottom:1px solid var(--line); border-radius:6px; background:transparent; color:var(--ink); text-align:left; font:inherit; cursor:pointer; box-shadow:none; }
html body .trail-history-row strong { font-size:11px; font-weight:600; font-variant-numeric:tabular-nums; }
html body .trail-history-row span { font-size:10px; color:var(--muted); line-height:1.6; }
html body .trail-history-row .trail-history-cost, html body .trail-history-row .trail-history-fee { text-align:right; }
html body .trail-history-row .trail-history-total { grid-column:1 / -1; }
html body .trail-history-row:hover { background:var(--bg); }
html body .trail-history-row.is-selected { background:color-mix(in srgb,var(--blue) 7%,transparent); }
html body .trail-history-row.is-selected .trail-history-cost { color:var(--blue); }
html body .trail-history-row:focus-visible, html body .trail-history-list:focus-visible { outline:2px solid var(--blue); outline-offset:-2px; }
html body .trail-history-empty { margin:8px 0; color:var(--muted); font-size:11px; line-height:1.7; }
html body .results .result-main-column { display:flex; flex-direction:column; justify-content:flex-start; }
html body .result-main-column > .cost-analysis { flex:0 0 auto; align-self:stretch; }
html body .cost-analysis .chart-section { flex:0 0 auto; }
html body .cost-analysis .chart-footer { margin-top:12px; }
html body .simulation-price strong { color:var(--ink); }

/* Fit the entire share card in the available preview area. */
html body .share-card-dialog[open] { display:flex; flex-direction:column; height:min(850px,calc(100dvh - 24px)); max-height:calc(100dvh - 24px); overflow:hidden; }
html body .share-card-dialog > .dialog-header,html body .share-card-dialog > .dialog-actions { flex:0 0 auto; }
html body .share-card-dialog .share-card-body { flex:1 1 0; min-height:0; max-height:none; grid-template-rows:minmax(0,1fr); align-items:stretch; overflow:auto; }
html body .share-card-body canvas { width:100%; height:100%; min-height:0; max-height:100%; max-width:100%; object-fit:contain; border:0; border-radius:0; }
html body .share-card-options { min-height:0; overflow:auto; }
@media(max-width:560px) {
 html body .share-card-dialog .share-card-body { grid-template-rows:minmax(0,1fr) auto; gap:12px; padding:12px 16px; }
 html body .share-card-options { gap:8px; font-size:12px; }
 html body .share-card-options p { font-size:11px; line-height:1.5; }
 html body .share-card-options #shareCardStatus:empty { display:none; }
}

/* Keep trade groups compact as the result columns grow. */
html body .sidebar-column { align-self:start; }
html body .sidebar-column > .controls { flex:0 0 auto; width:100%; box-sizing:border-box; height:auto; align-content:start; grid-template-rows:repeat(4,max-content); gap:12px; }
html body .controls .control-section { padding-block:14px; }
html body .controls .control-section:last-child { padding-bottom:0; }
html body .controls .control-section legend { margin-bottom:12px; }
/* Align desktop card bottoms without stretching trade fields. */
html body .trail-history-list { max-height:88px; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scroll-snap-type:y mandatory; }
html body .trail-history-row { min-height:84px; scroll-snap-align:start; }
html body .result-summary .result-share-row { justify-content:flex-end; padding:0 0 8px; margin:0; }
html body .result-summary .result-share-row button { font-size:11px; }
@media (min-width:1180px) {
  html body .dashboard { align-items:stretch; }
  html body .sidebar-column { align-self:stretch; }
  html body .sidebar-column > .controls { flex:1 1 auto; align-content:start; grid-template-rows:repeat(4,max-content); }
  html body .results { align-self:stretch; align-items:stretch; }
  html body .results .result-column { align-self:stretch; }
  html body .result-main-column > .cost-analysis { flex:1 0 auto; }
  html body .cost-analysis .chart-section { flex:1 1 auto; }
  html body .results .cost-analysis .chart-section #costChart { flex:1 1 0; min-height:180px!important; aspect-ratio:auto; }
  html body .cost-analysis .chart-section > :not(#costChart) { flex-shrink:0; }
  html body .cost-analysis .chart-footer { margin-top:12px; padding-top:0; }
  html body .result-side-column > .price-simulation { flex:1 0 auto; }
  /* Share desktop rows so adjacent cards keep matching edges. */
  html body .results { grid-template-rows:auto auto auto; align-content:start; gap:16px; }
  html body .results .result-column.result-main-column,
  html body .results .result-column.result-side-column { display:contents; }
  html body .results .result-summary { grid-column:1; grid-row:1; align-self:stretch; }
  html body .results .buy-planning-card { grid-column:2; grid-row:1; align-self:stretch; }
  html body .results .cost-analysis { grid-column:1; grid-row:2 / 4; align-self:stretch; }
  html body .results .funds-overview-card { grid-column:2; grid-row:2; align-self:stretch; }
  html body .results .price-simulation { grid-column:2; grid-row:3; align-self:stretch; }
}
html body .share-card-options .share-save-preview { display:block; width:100%; max-height:180px; object-fit:contain; }
@media(max-width:560px) {
 html body .share-card-dialog .share-card-body { grid-template-rows:minmax(0,1fr) minmax(100px,190px); }
 html body .share-card-options .share-save-preview { max-height:100px; }
}

/* Support: balanced QR and feedback columns, shared explanatory footer. */
html body .support-dialog[open] { display:flex; flex-direction:column; width:min(760px,calc(100vw - 24px)); max-width:760px; max-height:calc(100dvh - 24px); overflow:hidden; box-shadow:none; }
html body .support-dialog > .dialog-header,html body .support-dialog > .dialog-actions { flex:0 0 auto; padding:16px 22px; }
html body .support-dialog-body { flex:1 1 auto; min-height:0; max-height:none; overflow-y:auto; padding:22px; }
html body .support-dialog .support-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; align-items:start; }
html body .support-dialog .support-card { border:0; border-radius:0; padding:0; gap:14px; box-shadow:none; }
html body .support-dialog .reward-card { grid-column:1; grid-row:1; padding-right:24px; border-right:1px solid var(--line); }
html body .support-dialog .feedback-card { grid-column:2; grid-row:1; }
html body .support-dialog .support-card-heading strong { font-size:15px; font-weight:600; }
html body .support-dialog .support-card-heading small { font-size:11px; font-weight:400; letter-spacing:0; }
html body .support-dialog .support-card-icon { width:30px; height:30px; background:transparent; border:0; }
html body .support-dialog .support-card-icon svg { width:20px; height:20px; }
html body .support-dialog .support-qr-link { width:min(100%,180px); align-self:center; border-radius:10px; }
html body .support-dialog .support-email-contact { display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:8px 0 14px; border-bottom:1px solid var(--line); }
html body .support-dialog .support-email-actions { display:flex; flex-wrap:wrap; justify-content:flex-start; gap:10px; }
html body .support-dialog .support-email-link { font-size:15px; font-weight:500; }
html body .support-dialog .support-copy-button { font-weight:500; }
html body .support-dialog .support-actions { justify-content:center; gap:12px; }
html body .support-dialog .support-download { min-height:34px; padding:8px 12px; }
html body .support-dialog .reward-copy,html body .support-dialog .support-privacy { font-size:11px; line-height:1.7; }
html body .support-dialog-body > .support-privacy { margin:22px 0 8px; padding-top:16px; border-top:1px solid var(--line); }
html body .support-dialog-body > .support-intro { margin:0; font-size:11px; }
html body .support-dialog-footer > span { font-size:11px; color:var(--muted); }
@media(max-width:560px) {
 html body .support-dialog-body { padding:16px; }
 html body .support-dialog .support-grid { grid-template-columns:minmax(0,1fr); gap:22px; }
 html body .support-dialog .reward-card { grid-column:1; grid-row:1; padding:0 0 20px; border-right:0; border-bottom:1px solid var(--line); }
 html body .support-dialog .feedback-card { grid-column:1; grid-row:2; }
 html body .support-dialog .support-qr-link { width:160px; }
 html body .support-dialog > .dialog-header,html body .support-dialog > .dialog-actions { padding:14px 16px; }
}
html body .support-dialog .support-voluntary-note { margin-top:12px; padding-top:16px; border-top:1px solid var(--line); }
html body .support-dialog .support-voluntary-note > strong { display:block; margin-bottom:8px; font-size:12px; font-weight:500; }
html body .support-dialog .feedback-direct-note { flex:0 0 auto; }
html body .announcement-update { margin-bottom:22px; padding-bottom:18px; border-bottom:1px solid var(--line); }
html body .announcement-update-heading { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
html body .announcement-update-heading h3 { margin:0; }
html body .announcement-update time { font-size:11px; color:var(--muted); }
html body .announcement-update ul { margin:0; padding-left:18px; color:var(--muted); font-size:12px; line-height:1.8; }
html body .announcement-update li + li { margin-top:6px; }
html body .announcement-dialog[open] { display:flex; flex-direction:column; max-height:calc(100dvh - 24px); overflow:hidden; }
html body .announcement-dialog > .dialog-body { flex:1 1 auto; min-height:0; overflow-y:auto; }
html body .announcement-dialog > .dialog-header,html body .announcement-dialog > .dialog-actions { flex:0 0 auto; }
html body .cn-note-heading { display:flex; align-items:center; gap:7px; margin-bottom:12px; }
html body .announcement-dialog .cn-note-heading h3 { margin:0; }
html body #cnAnnouncementNote #cnMarketNote { display:none; }
html body #cnAnnouncementNote.is-open #cnMarketNote { display:block; padding:12px 14px; margin:0 0 14px; border:1px solid var(--line); border-radius:10px; background:var(--canvas); font-size:12px; line-height:1.7; box-shadow:none; }
html body #cnNoteTrigger { flex:0 0 auto; }

/* Brief feedback motion, with immediate slider updates. */
html body .app-header .product-overview-link { display:inline-block; font-size:10px; color:var(--blue); margin-top:3px; }
@media(prefers-reduced-motion:no-preference) {
 html body dialog[open] { animation:cb-dialog-enter .18s ease-out; }
 html body .trail-node .trail-dot { transition:r .15s ease,stroke-width .15s ease; }
 html body .simulation-presets button,html body .apply-button,html body .trail-confirm { transition:background-color .15s ease,border-color .15s ease; }
 @keyframes cb-dialog-enter { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
}
html body .app-header .header-more a.product-overview-link { display:flex; align-items:center; width:100%; min-height:34px; padding:0 10px; margin:0; border-radius:6px; color:var(--ink); font-size:12px; font-weight:400; text-decoration:none; }
html body .app-header .header-more a.product-overview-link:hover { background:var(--bg); }
html body .app-header .header-more a.product-overview-link:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
html body .result-summary .hero-label-row { display:flex; align-items:center; flex-wrap:nowrap; width:100%; gap:8px; }
html body .result-summary .hero-label-row > p,html body .result-summary .hero-label-row > .calculation-badge,html body .result-summary .hero-label-row > .info-button { flex:0 0 auto; }
html body .result-summary .summary-share-button { margin-left:auto; padding:4px 0 4px 8px; border:0; background:transparent; color:var(--blue); font:inherit; font-size:11px; line-height:1.5; white-space:nowrap; cursor:pointer; align-self:center; }
html body .result-summary .summary-share-button:disabled { opacity:.4; cursor:default; }
html body .result-summary .summary-share-button:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
@media(max-width:400px){html body .result-summary .hero-label-row {gap:5px;}html body .result-summary .hero-label-row p {font-size:12px;}html body .result-summary .calculation-badge {font-size:9px;padding:3px 4px;}html body .result-summary .summary-share-button {font-size:10px;padding-left:3px;}}

/* Quiet interaction feedback for the calculator workspace. */
@media(prefers-reduced-motion:no-preference) {
  html body .trail-history-row,
  html body .trail-confirm,
  html body .trail-undo,
  html body .apply-button,
  html body .header-tool-button { transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .12s ease; }
  html body .trail-history-row:active,
  html body .trail-confirm:active,
  html body .trail-undo:active,
  html body .apply-button:active,
  html body .header-tool-button:active { transform:scale(.985); }
  html body #chartAnnotations .trail-node .trail-dot { transition:r .18s ease,stroke-width .18s ease,fill .18s ease; }
  html body #chartAnnotations .trail-node.is-new .trail-dot { animation:cb-trail-node-in .42s cubic-bezier(.2,.75,.25,1) both; }
  @keyframes cb-trail-node-in {
    0% { opacity:.35; r:3px; }
    65% { opacity:1; r:10px; }
    100% { opacity:1; r:6px; }
  }
}

/* Cost trail workspace: chart on the left, confirmed purchases on the right. */
html body .results .result-column { display:contents; }
html body .results { grid-template-rows:auto auto; align-content:start; }
html body .results .result-summary { grid-column:1; grid-row:1; }
html body .results .buy-planning-card { grid-column:2; grid-row:1; }
html body .results .cost-analysis { grid-column:1; grid-row:2; }
html body .results .trail-history { grid-column:2; grid-row:2; margin:0; padding:18px 20px; min-width:0; display:flex; flex-direction:column; align-self:stretch; }
html body .trail-history-heading h2 { margin:0; font-size:16px; font-weight:600; }
html body .trail-history-hint { margin:0 0 14px; color:var(--muted); font-size:11px; line-height:1.7; }
html body .trail-history-list { max-height:400px; min-height:160px; overflow-y:auto; scroll-snap-type:none; flex:1 1 auto; }
html body .trail-history-row { min-height:100px; padding:14px 10px; gap:8px 10px; scroll-snap-align:none; }
html body .trail-history-row strong { font-size:12px; }
html body .trail-history-row span { font-size:11px; }
html body .trail-history-row .trail-history-cost { font-weight:500; }
html body .trail-history-empty { padding:24px 10px; }
html body .results .chart-help .chart-calculation { max-height:min(520px,70dvh); overflow-y:auto; width:min(380px,calc(100vw - 64px)); font-weight:400; }
html body .chart-ledger { margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
html body .chart-ledger .section-title-row { margin-bottom:10px; }
html body .chart-ledger h3 { margin:0; font-size:12px; font-weight:600; color:var(--ink); }
html body .chart-ledger dl { display:grid; gap:10px; margin:0; }
html body .chart-ledger dl > div { display:flex; justify-content:space-between; gap:12px; font-size:11px; line-height:1.6; }
html body .chart-ledger dt { color:var(--muted); }
html body .chart-ledger dd { margin:0; color:var(--ink); font-variant-numeric:tabular-nums; text-align:right; }
@media(min-width:1180px) {
 html body .results .cost-analysis .chart-section #costChart { flex:0 0 auto; min-height:0!important; aspect-ratio:620/290; }
}
@media(max-width:1179px) {
 html body .results { grid-template-columns:minmax(0,1fr); grid-template-rows:repeat(4,auto); }
 html body .results .result-summary { grid-column:1; grid-row:1; }
 html body .results .buy-planning-card { grid-column:1; grid-row:2; }
 html body .results .cost-analysis { grid-column:1; grid-row:3; }
 html body .results .trail-history { grid-column:1; grid-row:4; }
 html body .trail-history-list { max-height:none; min-height:0; overflow-y:visible; }
}
@media(max-width:480px) {
 html body .results .trail-history { padding:16px; }
 html body .trail-history-row { grid-template-columns:minmax(0,1fr); gap:5px; }
 html body .trail-history-row .trail-history-cost, html body .trail-history-row .trail-history-fee { text-align:left; }
}

/* Desktop columns share one bottom edge; give the cost trail more room. */
@media (min-width: 1180px) {
  html body .dashboard { align-items: stretch; }
  html body .sidebar-column { display: flex; flex-direction: column; align-self: stretch; }
  html body .sidebar-column > .controls { flex: 1 1 auto; height: auto; }
  html body .results { align-self: stretch; align-content: stretch; grid-template-rows: auto minmax(min-content, 1fr); }
  html body .results .cost-analysis { display: flex; flex-direction: column; align-self: stretch; min-height: 0; }
  html body .results .cost-analysis .chart-section { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  html body .results .cost-analysis .chart-section #costChart { display: block; width: 100%; height: auto; flex: 1 1 auto; min-height: 340px !important; max-height: none; aspect-ratio: 620 / 460 !important; }
  html body .cost-analysis .chart-section > :not(#costChart) { flex-shrink: 0; }
  html body .results .trail-history { align-self: stretch; min-height: 0; }
  html body .results .trail-history-list { flex: 1 1 0; height: 0; min-height: 280px; max-height: none; overflow-y: auto; }
}

/* Keep chart labels readable in the enlarged plot. */
html body #costChart .chart-axis-label,
html body #costChart .chart-axis-title { font-size: 12px; }
/* Keep the mobile More menu above the sticky page switcher (z-index: 20). */
@media (max-width: 820px), (max-height: 520px) and (pointer: coarse) {
  html body .app-header {
    z-index: 30;
  }
}

/* Match the two cost-help controls to the approved motion preview. */
@media (prefers-reduced-motion: no-preference) {
  html body #basisInfoButton,
  html body .chart-help-trigger {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 130ms cubic-bezier(.2,.8,.2,1);
  }
  html body #basisInfoButton:not(:disabled):active,
  html body .chart-help-trigger:not(:disabled):active { transform: scale(.94); }
  html body #basisDialog[open] { animation: cb-cost-help-enter 220ms cubic-bezier(.16,1,.3,1); }
  html body #basisDialog[open]::backdrop { animation: cb-cost-help-backdrop 220ms ease-out; }
  html body .chart-help .chart-calculation {
    transform: translateY(8px) scale(.99);
    transition: opacity 220ms cubic-bezier(.16,1,.3,1), transform 220ms cubic-bezier(.16,1,.3,1), visibility 0s linear 220ms;
  }
  html body .chart-help:hover .chart-calculation,
  html body .chart-help-trigger:focus-visible + .chart-calculation,
  html body .chart-help.is-open .chart-calculation {
    transform: none;
    transition: opacity 220ms cubic-bezier(.16,1,.3,1), transform 220ms cubic-bezier(.16,1,.3,1), visibility 0s;
  }
  @keyframes cb-cost-help-enter {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: none; }
  }
  @keyframes cb-cost-help-backdrop {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}
