:root {
  color-scheme: dark;
  --page: #101010;
  --surface: #181818;
  --surface-raised: #232323;
  --surface-input: #131313;
  --surface-hover: #2a2a2a;
  --text: #f3f3f3;
  --text-soft: #bcbcbc;
  --text-faint: #929292;
  --border: #333333;
  --border-strong: #505050;
  --accent: #dedede;
  --accent-strong: #f4f4f4;
  --accent-ink: #171717;
  --positive: #ff747d;
  --negative: #42ce96;
  --limit-up-bg: var(--positive);
  --limit-up-ink: #26080d;
  --limit-down-bg: var(--negative);
  --limit-down-ink: #061a12;
  --danger-bg: #3a181c;
  --highlight: #303030;
  --highlight-strong: #494949;
  --reference: rgb(185 185 185 / 10%);
  --reference-border: #aaa;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--page);
}

html.dialog-scroll-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

@supports selector(html:has(dialog[open])) {
  html:has(dialog[open]) {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

html[data-low-saturation="true"] {
  filter: grayscale(1) saturate(0);
}

html[data-low-saturation="true"] dialog {
  filter: grayscale(1) saturate(0);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.dialog-scroll-lock {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.app-shell {
  position: relative;
  width: min(1300px, 100%);
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 64px) 36px;
}

.shell-resize-handle {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 12px;
  cursor: ew-resize;
  touch-action: none;
}

.shell-resize-handle--left {
  left: 0;
}

.shell-resize-handle--right {
  right: 0;
}

.shell-resize-handle::before,
.shell-resize-handle::after {
  content: "";
  position: absolute;
  left: 5px;
  border-radius: 2px;
  background: var(--border-strong);
}

.shell-resize-handle::before {
  top: 24px;
  bottom: 36px;
  width: 1px;
  opacity: 0;
}

.shell-resize-handle::after {
  top: 36px;
  width: 3px;
  height: 32px;
}

.shell-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@media (min-width: 721px) and (hover: hover) and (pointer: fine) {
  .shell-resize-handle {
    display: block;
  }

  .shell-resize-handle:hover::before,
  .shell-resize-handle:focus-visible::before,
  .shell-resizing .shell-resize-handle::before {
    opacity: 1;
  }

  .shell-resizing .shell-resize-handle::before,
  .shell-resizing .shell-resize-handle::after {
    background: var(--accent);
  }
}

html.shell-resizing,
html.shell-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}

.app-header__copy {
  min-width: 0;
}

.app-header__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.section-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

main {
  display: grid;
  gap: 24px;
  padding-top: 16px;
}

.market-chart-toggle {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.low-saturation-toggle {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.low-saturation-toggle[aria-checked="true"] {
  border-color: var(--accent);
  background: rgb(220 220 220 / 12%);
  color: var(--accent-strong);
}

.low-saturation-toggle__icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.low-saturation-toggle__half {
  fill: currentColor;
  stroke: none;
}

.low-saturation-toggle:active {
  transform: scale(0.97);
}

.market-chart-toggle[aria-checked="true"] {
  border-color: var(--accent);
  background: rgb(220 220 220 / 12%);
  color: var(--accent-strong);
}

.market-chart-toggle__icon,
.management-trigger svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.market-chart-toggle:active {
  transform: scale(0.97);
}

.view-panel {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.intraday-charts {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

#stock-chart-template {
  display: none;
}

.intraday-charts > .stock-chart[data-row-size="1"] {
  grid-column: span 6;
}

.intraday-charts > .stock-chart[data-row-size="2"] {
  grid-column: span 3;
}

.intraday-charts > .stock-chart[data-row-size="3"] {
  grid-column: span 2;
}

.panel,
.summary-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel {
  padding: clamp(18px, 3vw, 26px);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading--compact {
  margin-bottom: 11px;
}

.management-menu-wrap {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
}

.management-trigger {
  position: relative;
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 8px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease;
}

.management-trigger:active,
.management-menu__item:active {
  transform: scale(0.98);
}

.management-menu__icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.management-trigger svg {
  color: var(--accent);
}

.management-trigger__status {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
}

.management-trigger__status[data-state="ready"] {
  background: var(--negative);
}

.low-saturation-toggle:focus-visible,
.market-chart-toggle:focus-visible,
.management-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgb(220 220 220 / 24%);
}

.management-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 36px));
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: 0 16px 44px rgb(0 0 0 / 35%);
}

.management-menu__item {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 140ms ease;
}

.management-menu__icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
}

.management-menu__copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.management-menu__copy strong {
  font-size: 0.8rem;
}

.management-menu__copy > span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-meta {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  white-space: nowrap;
}

.supporting-text {
  max-width: 830px;
  margin-bottom: 17px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge--muted {
  color: var(--text-soft);
}

.badge--success {
  border-color: rgb(66 206 150 / 32%);
  background: rgb(66 206 150 / 8%);
  color: var(--negative);
}

.badge--warning {
  border-color: rgb(255 116 125 / 35%);
  background: var(--danger-bg);
  color: var(--positive);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.summary-card {
  min-width: 0;
  padding: 20px clamp(16px, 2.2vw, 28px) 19px;
}

.summary-card--interactive {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 140ms ease;
}

.summary-card + .summary-card {
  border-left: 1px solid var(--border);
}

.summary-card--interactive:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -3px;
}

.summary-card--interactive:active {
  transform: scale(0.98);
}

.summary-card__label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
}

.summary-card__label--with-icon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-card__label--with-icon svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.summary-card__value {
  display: block;
  min-height: 1.45em;
  font-family: var(--font-mono);
  font-size: clamp(1.08rem, 2.25vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.35;
  white-space: nowrap;
}

.summary-card__meta {
  display: block;
  min-height: 1.35em;
  margin-top: 5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stock-chart {
  min-width: 0;
  padding: clamp(18px, 2.8vw, 26px);
  overflow: hidden;
}

.stock-chart__header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.stock-chart__identity {
  min-width: 0;
}

.stock-chart__identity .section-kicker {
  margin-bottom: 4px;
}

.stock-chart__title-row,
.stock-chart__quote {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.stock-chart__title-row h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-chart__symbol {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.stock-chart__quote {
  align-items: stretch;
  margin-top: 9px;
  white-space: nowrap;
}

.stock-chart__price,
.stock-chart__change {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.stock-chart__price {
  display: flex;
  align-items: center;
  font-size: clamp(1.6rem, 2.8vw, 1.9rem);
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stock-chart__change {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1;
}

.stock-chart__change-value,
.stock-chart__change-percentage {
  display: block;
}

.stock-chart__candle {
  position: absolute;
  top: 22px;
  right: 56px;
  bottom: 0;
  display: grid;
  width: 28px;
  place-items: center;
  overflow: visible;
  color: var(--text-soft);
  pointer-events: none;
}

.stock-chart__candle[data-direction="positive"] {
  color: var(--positive);
}

.stock-chart__candle[data-direction="negative"] {
  color: var(--negative);
}

.stock-chart__candle-graphic {
  display: block;
  width: 28px;
  height: 56px;
  overflow: visible;
}

.stock-chart__candle-wick {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.stock-chart__candle-body {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.25;
}

.stock-chart__close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.stock-chart__close svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.stock-chart__close:active {
  transform: scale(0.97);
}

.stock-chart__stage {
  position: relative;
  display: grid;
  min-height: 300px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-input);
}

.stock-chart__canvas {
  display: block;
  width: 100%;
  height: 300px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-y;
}

.stock-chart__status {
  max-width: 440px;
  margin: 0;
  padding: 24px;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
}

.stock-chart__status:empty {
  display: none;
}

.stock-chart__status--error {
  color: var(--positive);
}

.stock-chart__loading {
  position: absolute;
  inset: 0;
  display: none;
  width: 28px;
  height: 28px;
  margin: auto;
  color: var(--text-soft);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
  pointer-events: none;
}

.stock-chart__stage[aria-busy="true"] .stock-chart__loading {
  display: block;
  animation: stock-chart-loading-spin 0.8s steps(12, end) infinite;
}

.stock-chart__stage[aria-busy="true"] .stock-chart__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes stock-chart-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.stock-chart__meta {
  margin: 9px 2px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.api-key-form {
  display: grid;
  grid-template-columns: minmax(260px, 560px) auto;
  align-items: start;
  gap: 14px;
}

.settings-dialog--api {
  position: relative;
}

.api-operation-progress {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  min-height: 100%;
  padding: 20px;
  place-items: center;
  border-radius: inherit;
  background: rgb(8 8 8 / 42%);
  cursor: wait;
  backdrop-filter: blur(2px);
}

.api-operation-progress__card {
  display: grid;
  width: min(320px, 100%);
  padding: 22px 24px;
  place-items: center;
  gap: 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-soft);
  box-shadow: 0 18px 48px rgb(0 0 0 / 48%);
  text-align: center;
}

.api-operation-progress__card strong {
  color: var(--text);
  font-size: 0.9rem;
}

.api-operation-progress__card > span:last-child {
  font-size: 0.74rem;
}

.api-operation-progress__spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 3px;
  border: 3px solid rgb(220 220 220 / 28%);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: button-busy-spin 600ms linear infinite;
}

.api-binding-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.custom-select {
  display: block;
  position: relative;
  min-width: 0;
}

.custom-select__control {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 38px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-input);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.custom-select__control:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.custom-select__icon {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  pointer-events: none;
}

.api-device-field {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 650;
}

.api-device-field .custom-select {
  width: fit-content;
  max-width: 100%;
}

.api-device-field .custom-select__control {
  width: fit-content;
  max-width: 100%;
}

.api-device-field[hidden] + #api-device-help {
  display: none;
}

.api-capacity {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.api-capacity strong {
  color: var(--text);
  font-size: 0.82rem;
}

.api-key-list {
  display: grid;
  max-height: min(38vh, 330px);
  margin-bottom: 18px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  scrollbar-color: var(--border-strong) var(--surface);
}

.api-key-item {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.api-key-item:last-child {
  border-bottom: 0;
}

.api-key-item--error {
  background: rgb(255 116 125 / 5%);
}

.api-key-item__identity {
  display: grid;
  min-width: 0;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.api-key-item__identity strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-assignment {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.api-key-selection-checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--accent-strong);
  cursor: pointer;
}

.api-key-selection-checkbox:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.api-key-usage-badge {
  max-width: min(160px, 42vw);
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-faint);
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-usage-badge[data-state="success"] {
  border-color: rgb(119 209 164 / 30%);
  background: rgb(119 209 164 / 9%);
  color: var(--negative);
}

.api-key-usage-badge[data-state="warning"] {
  border-color: rgb(220 220 220 / 34%);
  background: rgb(220 220 220 / 9%);
  color: var(--accent);
}

.api-key-usage-badge[data-state="error"] {
  border-color: rgb(255 116 125 / 30%);
  background: rgb(255 116 125 / 8%);
  color: var(--positive);
}

.api-key-item__meta {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.api-key-item--error .api-key-item__meta {
  color: var(--positive);
}

.api-key-item__actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.api-key-list__empty {
  margin: 0;
  padding: 20px 12px;
  color: var(--text-faint);
  font-size: 0.78rem;
  text-align: center;
}

.holding-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) repeat(3, minmax(145px, 1fr)) auto;
  align-items: start;
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 650;
}

.optional {
  color: var(--text-faint);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-input);
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input {
  min-height: 44px;
}

textarea {
  display: block;
  min-height: 190px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--positive);
  box-shadow: 0 0 0 3px rgb(255 116 125 / 10%);
}

.input-with-action {
  position: relative;
}

.input-with-action input {
  padding-right: 46px;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 5px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 140ms ease, background-color 140ms ease;
}

.icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.field-hint,
.field-error,
.form-error {
  min-height: 1.35em;
  margin: 6px 0 0;
  font-size: 0.72rem;
}

.field-hint {
  color: var(--text-faint);
}

.field-error,
.form-error {
  color: var(--positive);
}

.form-error {
  margin-top: 10px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 72px;
}

.holding-form > .form-actions {
  min-height: 44px;
  margin-top: 26px;
}

.form-actions--inline {
  align-items: center;
  gap: 8px;
  min-height: auto;
  margin-top: 26px;
}

.form-actions--inline > .button {
  min-height: 44px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 720;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.button:active:not(:disabled) {
  transform: scale(0.97);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button[aria-busy="true"]::before {
  width: 0.85em;
  height: 0.85em;
  flex: 0 0 auto;
  border: 2px solid currentcolor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: button-busy-spin 600ms linear infinite;
}

@keyframes button-busy-spin {
  to {
    transform: rotate(1turn);
  }
}

.button--primary {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.button--secondary {
  border-color: var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.button--quiet {
  border-color: var(--border);
  background: transparent;
  color: var(--text-soft);
}

.button--danger {
  border-color: rgb(255 116 125 / 35%);
  background: var(--danger-bg);
  color: var(--positive);
}

.button--small {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.72rem;
}

.button--compact {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.7rem;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.empty-state .button {
  flex-shrink: 0;
}

.table-panel {
  min-width: 0;
  padding-right: 0;
  padding-left: 0;
  overflow: hidden;
}

.table-panel > .section-heading,
.table-panel > .supporting-text {
  padding-right: clamp(18px, 3vw, 26px);
  padding-left: clamp(18px, 3vw, 26px);
}

.table-scroll {
  max-width: 100%;
  max-height: min(68vh, 640px);
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--border-strong) var(--surface);
}

.holdings-pagination {
  display: none;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  height: 56px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.data-table thead th {
  position: sticky;
  z-index: 4;
  top: 0;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.025em;
}

.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th {
  border-bottom: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  z-index: 3;
  left: 0;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.data-table thead th:first-child {
  z-index: 6;
  background: var(--surface-raised);
}

.number-cell {
  text-align: right !important;
}

.stock-identity {
  display: grid;
  min-width: 128px;
  gap: 2px;
}

.stock-symbol {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 780;
}

.stock-name,
.cell-subtext {
  max-width: 160px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 0.68rem;
  text-overflow: ellipsis;
}

.holdings-table {
  width: 100%;
  table-layout: auto;
  font-size: 0.74rem;
}

.holdings-table th,
.holdings-table td {
  height: 70px;
  padding: 9px 10px;
  vertical-align: middle;
}

.holdings-table th {
  height: 44px;
  font-size: 0.68rem;
  letter-spacing: 0;
}

.holdings-table tbody tr:last-child th,
.holdings-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.holding-identity-cell {
  position: relative;
}

.technical-state-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 2;
  max-width: calc(100% - 8px);
  min-height: 22px;
  padding: 2px 7px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  outline: none;
  background: rgb(35 35 35 / 94%);
  color: var(--text-soft);
  font-size: 0.62rem;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease;
}

.technical-state-badge:active:not(:disabled) {
  transform: scale(0.96);
}

.technical-state-badge:disabled {
  cursor: wait;
  opacity: 0.68;
}

.technical-state-badge--downtrend,
.technical-state-badge--selling_pressure {
  border-color: rgb(66 206 150 / 45%);
  color: #7eddb7;
}

.technical-state-badge--stabilizing,
.technical-state-badge--bottoming {
  border-color: rgb(220 220 220 / 50%);
  color: var(--accent-strong);
}

.technical-state-badge--rebounding,
.technical-state-badge--recovering {
  border-color: rgb(255 116 125 / 45%);
  color: #ff939a;
}

.technical-state-badge--loading::before {
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-right: 4px;
  border: 1px solid currentcolor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: button-busy-spin 650ms linear infinite;
}

.table-heading-stack,
.holding-metric,
.stock-identity--monitor {
  display: grid;
}

.table-heading-stack,
.holding-metric {
  justify-items: end;
  margin-left: auto;
}

.table-heading-stack {
  gap: 0;
  line-height: 1.25;
}

.stock-identity--monitor {
  width: auto;
  min-width: 0;
  gap: 0;
  line-height: 1.25;
}

.holding-price-button,
.holding-chart-button {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 3px 5px;
  border: 0;
  border-radius: 6px;
  outline: none;
  background: transparent;
  color: inherit;
  line-height: inherit;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 140ms ease;
}

.holding-price-button {
  overflow: visible;
  text-align: right;
}

.holding-chart-button {
  overflow: hidden;
  text-align: left;
}

.holding-price-button:active,
.holding-chart-button:active {
  transform: scale(0.98);
}

.holding-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(0.9rem, 1.4vw, 1rem);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-chart-button[aria-expanded="true"] .holding-name {
  color: var(--accent-strong);
}

.holding-symbol {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
}

.holding-metric {
  width: auto;
  min-width: 0;
  gap: 1px;
  line-height: 1.22;
}

.holding-metric__primary {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.5vw, 1.02rem);
  font-weight: 680;
  letter-spacing: -0.025em;
}

.holding-table-value {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 1.5vw, 1.02rem);
  font-variant-numeric: tabular-nums;
}

.watchlist-label {
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.holding-metric__secondary {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.holding-cost-cell .holding-metric__secondary,
.holding-shares-cell .holding-metric__secondary {
  color: var(--text-soft);
}

.holding-previous-close-cell .holding-metric__secondary {
  display: inline-flex;
  min-height: 17px;
  align-items: center;
  justify-self: end;
  padding: 1px 5px;
  border: 1px solid rgb(240 240 240 / 42%);
  border-radius: 999px;
  background: rgb(240 240 240 / 10%);
  color: var(--accent-strong);
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.1;
}

.profit-positive {
  color: var(--positive) !important;
}

.profit-negative {
  color: var(--negative) !important;
}

.profit-neutral {
  color: var(--text) !important;
}

.profit-unavailable {
  color: var(--text-faint) !important;
}

.price-limit-up,
.price-limit-down {
  border-radius: 3px;
}

.price-limit-up {
  background: var(--limit-up-bg);
  box-shadow: 0 0 0 4px var(--limit-up-bg);
  color: var(--limit-up-ink) !important;
}

.price-limit-down {
  background: var(--limit-down-bg);
  box-shadow: 0 0 0 4px var(--limit-down-bg);
  color: var(--limit-down-ink) !important;
}

.stock-chart__price.price-limit-up {
  box-shadow: 0 0 0 6px var(--limit-up-bg);
}

.stock-chart__price.price-limit-down {
  box-shadow: 0 0 0 6px var(--limit-down-bg);
}

.range-sort-button {
  min-width: 104px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.range-table {
  width: 100%;
}

.range-table th,
.range-table td {
  width: 50%;
  height: 43px;
  padding: 7px 15px;
  text-align: center;
}

.range-table th:first-child,
.range-table td:first-child {
  width: 50%;
}

.range-table .is-zero-range th,
.range-table .is-zero-range td {
  background: var(--reference);
  box-shadow: inset 0 1px 0 var(--reference-border), inset 0 -1px 0 var(--reference-border);
}

.range-table .is-zero-range th:first-child {
  box-shadow: inset 1px 0 0 var(--reference-border), inset 0 1px 0 var(--reference-border), inset 0 -1px 0 var(--reference-border);
}

.range-table .is-zero-range td:last-child {
  box-shadow: inset -1px 0 0 var(--reference-border), inset 0 1px 0 var(--reference-border), inset 0 -1px 0 var(--reference-border);
}

.app-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 28px;
  margin-top: 22px;
  padding: 18px 2px 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.7rem;
}

.app-footer p {
  margin: 0;
}

.app-footer__notes {
  display: grid;
  gap: 3px;
}

.app-version {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 560;
  letter-spacing: 0.09em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}

.toast-region {
  position: fixed;
  z-index: 40;
  inset: auto 0 18px;
  display: grid;
  justify-items: center;
  width: 100%;
  margin: 0;
  padding: 0 32px;
  gap: 8px;
  overflow: visible;
  border: 0;
  background: transparent;
  color: inherit;
  pointer-events: none;
}

.toast {
  justify-self: center;
  width: fit-content;
  max-width: min(390px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: 0 12px 34px rgb(0 0 0 / 38%);
  color: var(--text);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  opacity: 1;
  transition: opacity 160ms ease;
}

.toast--error {
  border-color: rgb(255 116 125 / 40%);
}

.toast.is-leaving {
  opacity: 0;
}

.settings-dialog,
.confirm-dialog,
.tab-session-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 65%);
  overscroll-behavior: contain;
}

.settings-dialog {
  width: min(760px, calc(100vw - 32px));
  min-width: 0;
  max-height: min(760px, calc(100dvh - 32px));
  padding: 24px;
  overflow: auto;
}

.settings-dialog--holding {
  width: min(980px, calc(100vw - 32px));
}

.market-value-dialog {
  width: min(560px, calc(100vw - 32px));
}

.technical-analysis-dialog {
  width: min(820px, calc(100vw - 32px));
}

.technical-analysis__status {
  min-height: 120px;
  margin: 0;
  padding: 42px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  text-align: center;
}

.technical-analysis__overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.technical-analysis__overview > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.technical-analysis__overview span,
.technical-analysis__metric dt {
  display: block;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 650;
}

.technical-analysis__overview strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(0.92rem, 2vw, 1.12rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-analysis__overview #technical-analysis-state[data-state="downtrend"],
.technical-analysis__overview #technical-analysis-state[data-state="selling_pressure"] {
  color: #7eddb7;
}

.technical-analysis__overview #technical-analysis-state[data-state="stabilizing"],
.technical-analysis__overview #technical-analysis-state[data-state="bottoming"] {
  color: var(--accent-strong);
}

.technical-analysis__overview #technical-analysis-state[data-state="rebounding"],
.technical-analysis__overview #technical-analysis-state[data-state="recovering"] {
  color: #ff939a;
}

.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="strong_buy"],
.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="buy"] {
  color: #ff939a;
}

.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="hold"] {
  color: var(--accent-strong);
}

.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="sell"],
.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="strong_sell"] {
  color: #7eddb7;
}

.technical-analysis__overview #technical-analysis-recommendation[data-recommendation="escape"] {
  color: #55e39e;
}

.technical-analysis__section {
  margin-top: 20px;
}

.technical-analysis__section h3 {
  margin-bottom: 9px;
}

.technical-analysis__history-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 9px;
}

.technical-analysis__history-heading h3 {
  margin-bottom: 0;
}

.technical-analysis__history-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.technical-analysis__history-periods {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.technical-analysis__history-period {
  appearance: none;
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
  cursor: pointer;
}

.technical-analysis__history-type {
  border-color: var(--border);
  background: var(--surface);
}

.technical-analysis__history-period[aria-pressed="true"] {
  border-color: var(--accent-strong);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

.technical-analysis__history-period:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.technical-analysis__history-chart {
  --history-ma5: #f28f8c;
  --history-ma10: #7bc8ec;
  --history-ma20: #b9a4ee;
  --history-ma60: #79d2a6;
  padding: 13px 16px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.technical-analysis__history-averages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 8px;
}

.technical-analysis__history-average {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.65;
  white-space: nowrap;
}

.technical-analysis__history-average[aria-pressed="true"] {
  background: var(--surface-hover);
  border-color: currentColor;
  opacity: 1;
}

.technical-analysis__history-average:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  opacity: 1;
}

.technical-analysis__history-average::before {
  width: 18px;
  border-top: 1px solid currentColor;
  content: "";
}

.technical-analysis__history-average strong {
  font-weight: 600;
}

.technical-analysis__history-average--ma5 {
  color: var(--history-ma5);
  stroke: var(--history-ma5);
}

.technical-analysis__history-average--ma10 {
  color: var(--history-ma10);
  stroke: var(--history-ma10);
}

.technical-analysis__history-average--ma20 {
  color: var(--history-ma20);
  stroke: var(--history-ma20);
}

.technical-analysis__history-average--ma60 {
  color: var(--history-ma60);
  stroke: var(--history-ma60);
}

.technical-analysis__history-plot {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 8px;
}

.technical-analysis__history-prices {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-align: right;
}

.technical-analysis__history-graph {
  position: relative;
  min-width: 0;
}

.technical-analysis__history-svg {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: pan-y;
  user-select: none;
}

.technical-analysis__history-svg:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.technical-analysis__history-grid {
  stroke: var(--border-strong);
  stroke-dasharray: 3 5;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.technical-analysis__history-average-line {
  fill: none;
  stroke-dasharray: none;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.technical-analysis__history-average-point {
  fill: currentColor;
  stroke: none;
  pointer-events: none;
}

.technical-analysis__history-selection {
  stroke: #f0cc76;
  stroke-dasharray: 5 5;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.technical-analysis__history-line {
  fill: none;
  stroke: var(--accent-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.technical-analysis__history-candle {
  color: var(--text-soft);
  pointer-events: none;
}

.technical-analysis__history-candle[data-direction="positive"] {
  color: var(--positive);
}

.technical-analysis__history-candle[data-direction="negative"] {
  color: var(--negative);
}

.technical-analysis__history-candle-wick,
.technical-analysis__history-candle-body {
  stroke: currentColor;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.technical-analysis__history-candle-body {
  fill: currentColor;
}

.technical-analysis__history-candle[data-live="true"] .technical-analysis__history-candle-body {
  fill: var(--surface);
  stroke-width: 1.5;
}

.technical-analysis__history-candle--selected .technical-analysis__history-candle-body {
  stroke: var(--accent-strong);
  stroke-width: 2;
}

.technical-analysis__history-chart[data-chart-type="candlestick"] .technical-analysis__history-tooltip {
  white-space: normal;
  overflow-wrap: anywhere;
}

.technical-analysis__history-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.technical-analysis__history-point {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--accent-strong);
  transform: translate(-50%, -50%);
}

.technical-analysis__history-point--latest {
  width: 9px;
  height: 9px;
}

.technical-analysis__history-point--live {
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 3px rgb(240 240 240 / 22%);
}

.technical-analysis__history-point--selected {
  width: 12px;
  height: 12px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgb(240 204 118 / 25%);
}

.technical-analysis__history-chart[data-history-period="60"] .technical-analysis__history-point:not(.technical-analysis__history-point--latest):not(.technical-analysis__history-point--selected) {
  width: 4px;
  height: 4px;
  border: 0;
}

.technical-analysis__history-tooltip {
  position: absolute;
  z-index: 1;
  max-width: calc(100% - 12px);
  padding: 5px 8px;
  border: 1px solid rgb(240 204 118 / 72%);
  border-radius: var(--radius-sm);
  background: rgb(24 24 24 / 96%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 32%);
  color: #f3d98f;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
}

.technical-analysis__history-dates {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-left: 68px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.technical-analysis__history-latest {
  margin: 9px 0 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  text-align: right;
}

.technical-analysis__history-empty {
  margin: 0;
  padding: 20px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 0.76rem;
  text-align: center;
}

.technical-analysis__metrics {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.technical-analysis__metric {
  min-width: 0;
  padding: 10px 11px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.technical-analysis__metric dd {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-analysis__metric dd.institutional-analysis__period-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 8px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.institutional-analysis__period-amount,
.institutional-analysis__period-ratio {
  white-space: nowrap;
}

.institutional-analysis__period-ratio {
  color: var(--text-soft);
  font-size: 0.7rem;
}

.institutional-analysis__summary {
  margin: 0 0 9px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 620;
}

.institutional-analysis__summary[data-state="positive"] {
  color: #ff939a;
}

.institutional-analysis__summary[data-state="negative"] {
  color: #7eddb7;
}

.institutional-analysis__summary[data-state="neutral"] {
  color: var(--accent-strong);
}

.institutional-analysis__groups {
  display: grid;
  gap: 12px;
}

.institutional-analysis__group h4 {
  margin: 0 0 6px;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 680;
  letter-spacing: 0.04em;
}

.institutional-analysis__group--totals .technical-analysis__metric:last-child {
  background: var(--surface-raised);
}

.technical-analysis__signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.technical-analysis__signals {
  min-height: 104px;
  margin: 0;
  padding: 12px 14px 12px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.76rem;
}

.technical-analysis__signals li + li {
  margin-top: 5px;
}

.technical-analysis__signals--positive li::marker {
  color: var(--positive);
}

.technical-analysis__signals--risk li::marker {
  color: var(--negative);
}

.technical-analysis__signal-empty {
  color: var(--text-faint);
}

.technical-analysis__disclaimer {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgb(220 220 220 / 7%);
  color: var(--text-soft);
  font-size: 0.72rem;
}

.technical-analysis__actions {
  margin-top: 16px;
}

.url-import-debug-dialog {
  width: min(680px, calc(100vw - 32px));
}

.url-import-debug-dialog .supporting-text {
  margin-bottom: 18px;
}

.url-import-debug-output {
  min-height: min(48dvh, 420px);
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  tab-size: 2;
}

.url-import-debug-status {
  min-height: 20px;
  margin: 8px 0 12px;
}

.return-calendar-dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: min(900px, calc(100dvh - 4px));
  overflow: hidden;
}

.return-calendar__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.return-calendar__select-wrap {
  min-width: 148px;
}

.return-calendar__select {
  min-width: 148px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.return-calendar__meta {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.74rem;
  text-align: right;
}

.return-calendar__summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.return-calendar__summary h3,
.return-calendar__summary-rate-wrap > span {
  display: block;
  margin: 0 0 6px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 650;
}

.return-calendar__summary-amount,
.return-calendar__summary-rate {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 4vw, 2.15rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.return-calendar__summary-rate-wrap {
  text-align: right;
}

.return-calendar__swipe-region {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  touch-action: pan-y;
}

.return-calendar__swipe-track {
  display: flex;
  align-items: flex-start;
  min-width: 100%;
  width: 100%;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.return-calendar__swipe-pane {
  min-width: 100%;
  flex: 0 0 100%;
}

.return-calendar__swipe-region.is-swiping {
  -webkit-user-select: none;
  user-select: none;
}

.return-calendar__scroll {
  overflow: visible;
  border-radius: var(--radius-md);
}

.return-calendar__table {
  width: 100%;
  table-layout: fixed;
  border-spacing: 5px;
}

.return-calendar__table th {
  height: 30px;
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
}

.return-calendar__day,
.return-calendar__week {
  position: relative;
  height: clamp(52px, 8dvh, 88px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  vertical-align: top;
}

.return-calendar__day--outside {
  opacity: 0.48;
}

.return-calendar__cell--positive {
  border-color: rgb(255 116 125 / 20%);
  background: rgb(255 116 125 / 12%);
}

.return-calendar__cell--negative {
  border-color: rgb(66 206 150 / 20%);
  background: rgb(66 206 150 / 12%);
}

.return-calendar__date,
.return-calendar__week-number {
  display: block;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.return-calendar__week-number {
  width: 26px;
  margin: -8px -8px 0 auto;
  padding: 6px 7px;
  border-radius: 0 var(--radius-md) 0 var(--radius-sm);
  background: var(--border-strong);
  color: var(--text);
}

.return-calendar__metric {
  display: grid;
  position: absolute;
  inset: auto 7px 8px;
  justify-items: end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.return-calendar__metric strong {
  font-size: clamp(0.72rem, 1.55vw, 0.96rem);
  white-space: nowrap;
}

.return-calendar__metric span {
  color: var(--text-soft);
  font-size: clamp(0.62rem, 1.25vw, 0.78rem);
  white-space: nowrap;
}

.market-value-dialog__meta {
  margin: -2px 0 18px;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.market-value-list {
  max-height: min(62dvh, 520px);
  margin: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.market-value-list__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.market-value-list__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.market-value-list__item:last-child {
  border-bottom: 0;
}

.market-value-list__rank {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.market-value-list__identity,
.market-value-list__value {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.market-value-list__identity strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-value-list__identity span,
.market-value-list__value span {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.market-value-list__value {
  justify-items: end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.market-value-list__value strong {
  font-size: 0.88rem;
}

.market-value-list--empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.market-value-list__empty {
  max-width: 330px;
  margin: 0;
  padding: 24px;
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
}

.range-dialog {
  width: min(480px, calc(100vw - 32px));
  overflow: hidden;
}

.range-dialog__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.range-dialog__meta {
  margin: 0;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.range-dialog__table-scroll {
  max-height: min(60dvh, 560px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.range-table--dialog tbody tr:last-child th,
.range-table--dialog tbody tr:last-child td {
  border-bottom: 0;
}

.settings-dialog::backdrop,
.confirm-dialog::backdrop,
.tab-session-dialog::backdrop {
  background: rgb(0 0 0 / 68%);
}

.settings-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.settings-dialog__header .section-kicker {
  margin-bottom: 4px;
}

.device-sync-card,
.device-sync-section {
  min-width: 0;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.device-sync-card {
  display: grid;
  gap: 6px;
}

.device-sync-id {
  color: var(--text-soft);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.device-sync-card > *,
.device-sync-section > * {
  min-width: 0;
}

.device-sync-section h3 {
  margin: 0 0 8px;
}

.device-pair-form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.device-pair-form input {
  width: 100%;
  letter-spacing: 0.18em;
  text-align: center;
}

.device-pairing-code {
  margin: 14px 0 6px;
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
}

.device-list {
  display: grid;
  gap: 8px;
}

.device-list__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.device-list__item:last-child {
  border-bottom: 0;
}

.device-list__item > .button {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.device-list__meta {
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.device-list__meta strong {
  display: block;
  overflow-wrap: anywhere;
}

.device-list__id {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.device-sync-section .holding-dialog__section-heading > div {
  min-width: 0;
}

.device-sync-section .holding-dialog__section-heading > .button {
  min-width: 0;
  flex: 0 1 auto;
  text-align: center;
}

.chatgpt-integration .field-hint {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chatgpt-integration .field-hint code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chatgpt-token-once .input-with-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.chatgpt-token-once .input-with-action input {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 12px;
}

.chatgpt-token-once .input-with-action .button {
  flex: 0 0 auto;
}

.holding-dialog__editor {
  padding: 4px 0 24px;
}

.holding-dialog__editor[data-collapsed="true"] {
  padding-bottom: 14px;
}

.holding-dialog__editor[data-collapsed="true"] .holding-dialog__section-heading {
  margin-bottom: 0;
}

.holding-dialog__section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.holding-dialog__section-heading .section-kicker {
  margin-bottom: 4px;
}

.holding-dialog__heading-actions,
.holding-manager__heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-holdings-button:disabled {
  cursor: not-allowed;
}

.holding-import-dialog {
  width: min(680px, calc(100vw - 32px));
}

.holding-import-preview {
  margin-top: 20px;
}

.holding-import-preview__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.holding-import-preview__table-wrap {
  max-height: min(34vh, 300px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  scrollbar-color: var(--border-strong) var(--surface);
}

.holding-import-preview__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.holding-import-preview__table th,
.holding-import-preview__table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.holding-import-preview__table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 0.7rem;
}

.holding-import-preview__table tr:last-child td {
  border-bottom: 0;
}

.holding-import-preview__identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.holding-import-preview__identity span {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.holding-import-actions {
  flex-wrap: wrap;
}

.holding-import-actions #holding-import-cancel {
  margin-right: auto;
}

.holding-manager {
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.holding-manager__empty {
  margin: 0;
  padding: 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
}

.holding-manager__sort-hint {
  margin: -4px 0 10px;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.holding-manager__table-wrap {
  max-height: min(38vh, 340px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  scrollbar-color: var(--border-strong) var(--surface);
}

.holding-manager__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.manager-position-heading__stack,
.manager-position-values {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.manager-position-heading__mobile,
.manager-position-value--average {
  display: none;
}

.holding-manager__table th,
.holding-manager__table td {
  height: 54px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.holding-manager__table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 720;
}

.holding-manager__table tbody tr:last-child td {
  border-bottom: 0;
}

.manager-stock-cell {
  display: flex;
  min-width: 180px;
  align-items: center;
  gap: 8px;
}

.manager-stock-cell[draggable="true"] {
  cursor: grab;
}

.is-dragging .manager-stock-cell {
  cursor: grabbing;
}

.holding-drag-handle {
  display: grid;
  width: 30px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  background: transparent;
  color: var(--text-faint);
  cursor: grab;
  touch-action: none;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.holding-drag-handle:active,
.is-dragging .holding-drag-handle {
  cursor: grabbing;
  transform: scale(0.95);
}

.holding-drag-handle:disabled {
  cursor: default;
  opacity: 0.35;
}

.holding-drag-handle__icon {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1;
}

.holding-manager__table tbody.is-sorting {
  user-select: none;
}

.holding-manager__table tbody.is-sorting tr:not(.is-dragging) td {
  transition: background-color 120ms ease;
}

.holding-manager__table tbody tr.is-dragging td {
  background: var(--highlight) !important;
}

.manager-actions-cell {
  text-align: right !important;
}

.manager-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.dialog-close:active {
  transform: scale(0.95);
}

.dialog-close svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.confirm-dialog form {
  padding: 24px;
}

.tab-session-dialog__content {
  padding: 24px;
}

.confirm-dialog h2,
.tab-session-dialog h2 {
  margin-bottom: 10px;
}

.confirm-dialog .supporting-text,
.tab-session-dialog .supporting-text {
  margin-bottom: 22px;
}

.tab-session-dialog[data-state="superseded"] .supporting-text {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.noscript-message {
  position: fixed;
  z-index: 100;
  inset: auto 16px 16px;
  padding: 14px;
  border: 1px solid var(--positive);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--text);
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .stock-chart__canvas {
    cursor: crosshair;
  }

  .technical-analysis__history-average:hover {
    opacity: 1;
  }

  .technical-analysis__history-period:hover {
    background: var(--surface-hover);
  }

  .low-saturation-toggle:hover,
  .market-chart-toggle:hover,
  .management-trigger:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
  }

  .low-saturation-toggle[aria-checked="true"]:hover,
  .market-chart-toggle[aria-checked="true"]:hover {
    border-color: var(--accent);
    background: rgb(220 220 220 / 16%);
    color: var(--accent-strong);
  }

  .button--primary:hover {
    background: var(--accent-strong);
  }

  .button--secondary:hover,
  .button--quiet:hover,
  .icon-button:hover,
  .dialog-close:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
  }

  .management-menu__item:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
  }

  .summary-card--interactive:hover {
    background: var(--surface-hover);
  }

  .holding-price-button:hover,
  .holding-chart-button:hover {
    background: var(--surface-hover);
  }

  .holding-drag-handle:not(:disabled):hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text-soft);
  }

  .data-table tbody tr:hover td,
  .data-table tbody tr:hover th,
  .holding-manager__table tbody tr:hover td {
    background-color: var(--surface-hover);
  }

}

@media (max-width: 1050px) {
  .holding-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .holding-form .form-actions {
    grid-column: 1 / -1;
    min-height: auto;
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-top: 14px;
  }

  .app-header {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding-bottom: 12px;
  }

  .app-header__copy {
    min-width: 0;
    flex: 1;
  }

  .app-header__actions {
    gap: 8px;
  }

  .intraday-charts {
    grid-template-columns: minmax(0, 1fr);
  }

  .intraday-charts > .stock-chart {
    grid-column: 1 / -1 !important;
  }

  .api-key-form,
  .holding-form {
    grid-template-columns: 1fr;
  }

  .holding-manager__table-wrap {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .holding-manager__table {
    width: 100%;
    table-layout: fixed;
  }

  .holding-manager__table th,
  .holding-manager__table td {
    height: 62px;
    padding: 7px 6px;
  }

  .holding-manager__table th {
    height: 44px;
  }

  .holding-manager__table th:first-child {
    width: auto;
  }

  .manager-position-heading {
    width: 72px;
  }

  .manager-actions-cell {
    width: 86px;
  }

  .manager-average-heading,
  .manager-average-cell {
    display: none;
  }

  .manager-position-heading__mobile,
  .manager-position-value--average {
    display: block;
  }

  .manager-position-heading__mobile,
  .manager-position-value--average {
    color: var(--text-faint);
  }

  .manager-stock-cell {
    min-width: 0;
    gap: 4px;
  }

  .manager-stock-cell .stock-identity {
    min-width: 0;
  }

  .manager-stock-cell .stock-name {
    max-width: 100%;
    white-space: nowrap;
  }

  .holding-drag-handle {
    width: 26px;
  }

  .manager-actions {
    align-items: center;
    flex-direction: row;
    gap: 4px;
  }

  .manager-actions .button--small {
    min-width: 0;
    min-height: 28px;
    flex: 1;
    padding: 5px;
    font-size: 0.68rem;
  }

  .form-actions,
  .form-actions--inline,
  .holding-form .form-actions {
    grid-column: auto;
    min-height: auto;
    margin-top: 0;
    padding-bottom: 0;
  }

  .form-actions--inline {
    flex-wrap: wrap;
  }

  .holding-import-actions .button {
    flex: 1 1 120px;
  }

  .holding-import-actions #holding-import-cancel {
    flex-basis: 100%;
    margin-right: 0;
  }

  .api-capacity,
  .api-key-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-key-item__actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .api-key-item__actions .button {
    flex: 1;
  }

  .api-key-assignment {
    flex-wrap: wrap;
  }

  .holdings-table {
    --holdings-mobile-min-column-width: 5.5rem;
    width: max-content;
    min-width: 100%;
  }

  .table-scroll[data-mobile-pager="true"] {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    scroll-padding-left: var(--holdings-fixed-column-width);
    touch-action: pan-x pan-y;
  }

  .table-scroll[data-mobile-pager="true"]::after {
    width: var(--holdings-page-end-gap);
    min-width: var(--holdings-page-end-gap);
    align-self: stretch;
    flex: 0 0 var(--holdings-page-end-gap);
    content: "";
  }

  .table-scroll[data-paged="true"] {
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .table-scroll[data-paged="true"]::-webkit-scrollbar {
    display: none;
  }

  .table-scroll[data-paged="false"] {
    overflow-x: hidden;
  }

  .table-scroll[data-mobile-pager="true"] .holdings-table {
    width: var(--holdings-table-width);
    min-width: 0;
    flex: 0 0 var(--holdings-table-width);
    table-layout: fixed;
  }

  .table-scroll[data-mobile-pager="true"] .holdings-table th:first-child,
  .table-scroll[data-mobile-pager="true"] .holdings-table td:first-child {
    width: var(--holdings-fixed-column-width);
    min-width: var(--holdings-fixed-column-width);
    max-width: var(--holdings-fixed-column-width);
  }

  .table-scroll[data-mobile-pager="true"] .holdings-table th:not(:first-child),
  .table-scroll[data-mobile-pager="true"] .holdings-table td:not(:first-child) {
    width: var(--holdings-page-column-width);
    min-width: 0;
    max-width: var(--holdings-page-column-width);
    overflow: hidden;
  }

  .table-scroll[data-columns-per-page="2"] .holdings-table th:nth-child(2n + 3),
  .table-scroll[data-columns-per-page="2"] .holdings-table td:nth-child(2n + 3),
  .table-scroll[data-columns-per-page="3"] .holdings-table th:nth-child(3n + 4),
  .table-scroll[data-columns-per-page="3"] .holdings-table td:nth-child(3n + 4),
  .table-scroll[data-columns-per-page="6"] .holdings-table th:last-child,
  .table-scroll[data-columns-per-page="6"] .holdings-table td:last-child {
    padding-right: 16px;
  }

  .table-scroll[data-paged="true"] .holdings-table th[data-page-start] {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .table-scroll[data-mobile-pager="true"] .holding-metric,
  .table-scroll[data-mobile-pager="true"] .holding-metric__primary,
  .table-scroll[data-mobile-pager="true"] .holding-metric__secondary {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .holdings-pagination:not([hidden]) {
    display: flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 18px 0;
  }

  .holdings-page-dot {
    position: relative;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    outline: none;
    background: transparent;
    cursor: pointer;
    transition: transform 140ms var(--ease-out);
  }

  .holdings-page-dot::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-strong);
    content: "";
    transition: transform 140ms var(--ease-out), background-color 140ms ease;
  }

  .holdings-page-dot.active::before {
    background: var(--accent-strong);
    transform: scale(1.3);
  }

  .holdings-page-dot:active {
    transform: scale(0.94);
  }

  .holdings-table th,
  .holdings-table td {
    padding-right: 5px;
    padding-left: 5px;
  }

  .holdings-table td {
    height: 60px;
  }

  .holdings-table th {
    height: 40px;
  }

  .holdings-table th:first-child,
  .holdings-table td:first-child {
    width: 8.25rem;
    min-width: 8.25rem;
    max-width: 8.25rem;
  }

  .holdings-table th:nth-child(2),
  .holdings-table td:nth-child(2),
  .holdings-table th:nth-child(4),
  .holdings-table td:nth-child(4) {
    min-width: 5.75rem;
  }

  .holdings-table th:nth-child(3),
  .holdings-table td:nth-child(3) {
    min-width: 5rem;
  }

  .holdings-table th:nth-child(5),
  .holdings-table td:nth-child(5) {
    min-width: 5.5rem;
  }

  .holdings-table th:nth-child(6),
  .holdings-table td:nth-child(6) {
    min-width: 5.25rem;
  }

  .holdings-table th:nth-child(7),
  .holdings-table td:nth-child(7) {
    min-width: 4.5rem;
  }

  .holding-price-button,
  .holding-chart-button {
    padding-right: 3px;
    padding-left: 3px;
  }

  .holding-name {
    font-size: 0.84rem;
  }

  .holding-symbol,
  .holding-metric__secondary {
    font-size: 0.66rem;
  }

  .holding-metric__primary,
  .holding-table-value {
    font-size: 0.86rem;
  }

  .summary-card {
    padding: 16px clamp(12px, 3vw, 20px);
  }

  .empty-state {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .stock-chart {
    padding: 16px 10px 12px;
  }

  .stock-chart__header {
    padding: 0 6px;
  }

  .stock-chart__stage {
    min-height: 255px;
  }

  .stock-chart__canvas {
    height: 255px;
  }

  .stock-chart__meta {
    margin-left: 6px;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .technical-analysis__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .technical-analysis__metric dd.institutional-analysis__period-value {
    display: block;
    line-height: 1.35;
  }

  .institutional-analysis__period-ratio {
    display: block;
    margin-top: 2px;
  }
}

@media (max-width: 460px) {
  .summary-card__value {
    font-size: clamp(0.78rem, 4vw, 1rem);
    letter-spacing: -0.055em;
  }

  .summary-card {
    padding: 13px 8px 12px;
  }

  .summary-card__label {
    margin-bottom: 7px;
    font-size: 0.68rem;
  }

  .summary-card__meta {
    margin-top: 3px;
    font-size: 0.65rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .settings-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 19px;
  }

  .chatgpt-integration .field-hint code {
    display: block;
    margin-top: 3px;
  }

  .technical-state-badge {
    bottom: 3px;
    right: 3px;
    max-width: calc(100% - 6px);
    min-height: 20px;
    padding: 2px 6px;
    font-size: 0.58rem;
  }

  .technical-analysis__overview {
    gap: 6px;
  }

  .technical-analysis__overview > div {
    padding: 10px 8px;
  }

  .technical-analysis__overview span {
    font-size: 0.59rem;
  }

  .technical-analysis__overview strong {
    font-size: 0.78rem;
  }

  .technical-analysis__history-chart {
    padding: 12px 10px 10px;
  }

  .technical-analysis__history-averages {
    flex-wrap: nowrap;
    gap: 3px;
  }

  .technical-analysis__history-average {
    flex: 1 1 0;
    display: grid;
    grid-template-columns: 8px max-content minmax(0, 1fr);
    grid-template-rows: auto;
    min-width: 0;
    column-gap: 2px;
    padding: 5px 1px;
    font-size: clamp(0.56rem, 2.55vw, 0.66rem);
    text-align: left;
  }

  .technical-analysis__history-average::before {
    align-self: center;
    flex: 0 0 8px;
    width: 8px;
  }

  .technical-analysis__history-average span,
  .technical-analysis__history-average strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .technical-analysis__history-plot {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 6px;
  }

  .technical-analysis__history-prices,
  .technical-analysis__history-dates {
    font-size: 0.62rem;
  }

  .technical-analysis__history-svg {
    height: 150px;
  }

  .technical-analysis__history-dates {
    margin-left: 56px;
  }

  .technical-analysis__signal-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .market-value-list {
    max-height: min(58dvh, 440px);
  }

  .url-import-debug-output {
    min-height: min(52dvh, 440px);
    font-size: 0.68rem;
  }

  .return-calendar-dialog {
    padding: 14px 10px;
  }

  .return-calendar__toolbar {
    align-items: center;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 8px;
  }

  .return-calendar__select {
    min-width: 0;
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .return-calendar__select-wrap {
    width: 118px;
    min-width: 118px;
  }

  .return-calendar__meta {
    font-size: 0.58rem;
    line-height: 1.35;
    text-align: right;
  }

  .return-calendar__summary {
    margin-bottom: 6px;
    padding: 9px 11px;
  }

  .return-calendar__summary-amount,
  .return-calendar__summary-rate {
    font-size: 1.22rem;
  }

  .return-calendar__table {
    border-spacing: 2px 4px;
  }

  .return-calendar__table th {
    height: 24px;
    padding: 0 1px;
    font-size: 0.62rem;
  }

  .return-calendar__day,
  .return-calendar__week {
    height: clamp(48px, 7.5dvh, 64px);
    padding: 5px 3px;
    border-radius: 7px;
  }

  .return-calendar__date,
  .return-calendar__week-number {
    font-size: 0.62rem;
  }

  .return-calendar__week-number {
    width: 21px;
    margin: -5px -3px 0 auto;
    padding: 4px 5px;
    border-radius: 0 7px 0 6px;
  }

  .return-calendar__metric {
    inset: auto 3px 5px;
  }

  .return-calendar__metric strong {
    font-size: clamp(0.55rem, 2.7vw, 0.68rem);
  }

  .return-calendar__metric span {
    font-size: clamp(0.5rem, 2.35vw, 0.6rem);
  }

  .range-dialog {
    overflow: hidden;
  }

  .range-dialog__toolbar {
    align-items: flex-start;
  }

  .range-dialog__table-scroll {
    max-height: calc(100dvh - 190px);
  }

  .stock-chart__title-row,
  .stock-chart__quote {
    gap: 7px;
  }

  .stock-chart__change {
    font-size: 0.76rem;
  }
}

@media (max-height: 620px) {
  .return-calendar-dialog {
    padding: 12px;
  }

  .return-calendar-dialog .settings-dialog__header {
    margin-bottom: 8px;
  }

  .return-calendar__toolbar {
    margin-bottom: 7px;
  }

  .return-calendar__summary {
    margin-bottom: 5px;
    padding: 7px 10px;
  }

  .return-calendar__summary h3,
  .return-calendar__summary-rate-wrap > span {
    margin-bottom: 2px;
  }

  .return-calendar__summary-amount,
  .return-calendar__summary-rate {
    font-size: 1.1rem;
  }

  .return-calendar__table th {
    height: 20px;
  }

  .return-calendar__day,
  .return-calendar__week {
    height: 44px;
    padding: 4px;
  }

  .return-calendar__week-number {
    margin: -4px -4px 0 auto;
  }

  .return-calendar__metric {
    inset: auto 4px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

}
