:root {
  --accent: #126477;
  --accent-strong: #0f4c5c;
  --accent-soft: #e4f5f7;
  --info: #0369a1;
  --info-soft: #e0f2fe;
}

.brand::before {
  background: linear-gradient(135deg, #155e75, #16a34a);
}

.task-dynamic-fields {
  margin-top: 0.75rem;
  border: none;
  padding: 0;
}

.task-dynamic-fields legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.task-dynamic-fields-inner {
  display: grid;
  gap: 0.5rem;
}

.task-dynamic-field {
  display: grid;
  gap: 0.25rem;
}

.task-dynamic-field span {
  font-size: 0.85rem;
}

.task-dynamic-field small {
  color: var(--muted-color, #71717a);
  font-size: 0.78rem;
}

.task-dynamic-field input,
.task-dynamic-field select {
  width: 100%;
}

.task-price-control {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
}

.task-price-control .icon-button {
  height: 42px;
  min-width: 42px;
  padding: 0;
}

.task-dynamic-group {
  border: 1px solid var(--border-color, #d4d4d8);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.task-dynamic-group legend {
  font-size: 0.85rem;
  color: var(--muted-color, #71717a);
}

.task-amount-mode,
.task-price-mode,
.task-ratio-options {
  display: grid;
  gap: 0.35rem;
}

.task-amount-mode,
.task-price-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-ratio-options {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.task-segment,
.task-ratio-option {
  display: grid;
}

.task-segment input,
.task-ratio-option input {
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  position: absolute;
}

.task-segment span,
.task-ratio-option span {
  border: 1px solid var(--border-color, #d4d4d8);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0.45rem 0.6rem;
  text-align: center;
}

.task-segment input:checked + span,
.task-ratio-option input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.task-amount-panel.hidden,
.task-price-panel.hidden {
  display: none;
}

.stock-lookup-result {
  display: block;
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

.stock-lookup-result.hidden {
  display: none;
}

.stock-lookup-result.loading {
  color: var(--muted-color, #71717a);
}

.stock-lookup-result.valid {
  color: #15803d;
}

.stock-lookup-result.valid strong {
  color: #166534;
}

.stock-lookup-result.invalid {
  color: #dc2626;
}

.trade-chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  min-width: 56px;
  padding: 4px 10px;
  place-content: center;
}

.trade-chip-buy {
  background: #fef2f2;
  color: #b42318;
}

.trade-chip-hold {
  background: #f1f5f9;
  color: #475569;
}

.trade-chip-sell {
  background: #ecfdf3;
  color: #087443;
}

.account-relation {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
  white-space: nowrap;
}

.account-relation-leader {
  background: #eef6ff;
  color: #155e75;
}

.account-relation-follower {
  background: #f8fafc;
  color: #475569;
}

.role-chip {
  background: #f1f7f9;
  border: 1px solid #dce9ef;
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 4px 10px;
}

.metric-pill {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-width: 42px;
  padding: 5px 9px;
}

.account-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 16px;
}

.account-metric {
  background: linear-gradient(180deg, #fbfdff, #f8fafc);
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.account-metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.account-metric strong {
  color: #0f172a;
  font-size: 1.25rem;
  line-height: 1.1;
}

.account-position-list {
  display: grid;
  gap: 10px;
}

.account-position-card {
  align-items: center;
  background: #fbfdff;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(150px, 1fr) auto;
  padding: 13px 14px;
}

.account-position-card > div:first-child {
  display: grid;
  gap: 4px;
}

.account-position-card strong {
  color: #0f172a;
}

.account-position-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.account-position-metrics span,
.risk-parameter {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  color: var(--muted);
  display: grid;
  font-size: 0.8rem;
  font-weight: 800;
  gap: 3px;
  min-width: 108px;
  padding: 8px 10px;
}

.account-position-metrics strong,
.risk-parameter strong {
  color: #0f172a;
  font-size: 1rem;
}

.risk-parameter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.platform-grid {
  display: grid;
  gap: 16px;
}

.json-block {
  background: #f8fafc;
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 7px;
  color: #1f2937;
  font-size: 0.9rem;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.stock-chart-panel,
.stock-chart-preview {
  display: grid;
  gap: 12px;
}

.stock-chart-preview {
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 8px;
  padding: 12px;
}

.stock-chart-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stock-chart-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stock-chart-periods button {
  font-size: 0.86rem;
  padding: 6px 9px;
}

.stock-chart-periods button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.stock-chart {
  border: 1px solid var(--line, #d8e0ea);
  border-radius: 7px;
  min-height: 320px;
  overflow: hidden;
}

.stock-chart-status {
  color: var(--muted, #64748b);
  font-size: 0.9rem;
  margin: 0;
}

.stock-chart-status[data-state="ok"] {
  color: #15803d;
}

.stock-chart-status[data-state="error"] {
  color: #dc2626;
}

.stock-watch-market-list {
  background: transparent;
  border: 0;
  box-shadow: none;
  display: grid;
  overflow: hidden;
  padding: 0;
  width: min(100%, 820px);
}

.stock-watch-market-row {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(142px, 1.05fr) minmax(124px, 0.78fr) minmax(84px, 0.5fr) minmax(96px, 0.48fr);
  padding: 13px 12px;
}

.stock-watch-market-row {
  color: inherit;
  min-height: 82px;
  position: relative;
  text-decoration: none;
  transition: background-color 120ms ease, transform 120ms ease;
}

.stock-watch-market-row + .stock-watch-market-row {
  border-top: 1px solid #e7edf5;
}

.stock-watch-market-row:hover {
  background: #f8fbff;
}

.stock-watch-identity {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.stock-watch-identity strong {
  color: #1f2937;
  font-size: 1.2rem;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-watch-identity small {
  align-items: center;
  color: #8b96a7;
  display: flex;
  font-size: 0.98rem;
  gap: 6px;
  letter-spacing: 0;
}

.stock-watch-identity small span {
  background: #f59e0b;
  border-radius: 3px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  padding: 2px 4px;
}

.stock-watch-mini-chart {
  display: block;
  height: 54px;
  min-width: 0;
}

.stock-watch-mini-chart canvas {
  display: block;
  height: 54px;
  width: 100%;
}

.stock-watch-price {
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
  justify-self: end;
  letter-spacing: 0;
  white-space: nowrap;
}

.stock-watch-change {
  background: #e2e8f0;
  border-radius: 6px;
  color: #334155;
  font-size: 1.08rem;
  font-weight: 800;
  justify-self: end;
  line-height: 1;
  min-width: 92px;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}

.stock-watch-market-row[data-trend="up"] .stock-watch-change {
  background: #f04438;
  color: #fff;
}

.stock-watch-market-row[data-trend="down"] .stock-watch-change {
  background: #12a574;
  color: #fff;
}

.stock-watch-market-row[data-trend="up"] .stock-watch-identity strong,
.stock-watch-market-row[data-trend="up"] .stock-watch-price {
  color: #b42318;
}

.stock-watch-market-row[data-trend="down"] .stock-watch-identity strong,
.stock-watch-market-row[data-trend="down"] .stock-watch-price {
  color: #087443;
}

@media (max-width: 720px) {
  .stock-watch-market-list {
    margin-inline: -6px;
    width: auto;
  }

  .stock-watch-market-row {
    gap: 9px;
    grid-template-columns: minmax(104px, 1.1fr) minmax(82px, 0.85fr) minmax(58px, 0.55fr) minmax(70px, 0.6fr);
    min-height: 76px;
    padding: 11px 10px;
  }

  .stock-watch-identity strong {
    font-size: 1rem;
  }

  .stock-watch-identity small {
    font-size: 0.88rem;
  }

  .stock-watch-mini-chart,
  .stock-watch-mini-chart canvas {
    height: 44px;
  }

  .stock-watch-price {
    font-size: 1.08rem;
  }

  .stock-watch-change {
    font-size: 0.92rem;
    min-width: 68px;
    padding: 8px;
  }
}

.auth-shell-split {
  background: #fff;
  border: 1px solid #d7e2ee;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgb(15 23 42 / 0.14);
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1fr);
  margin: 28px auto 40px;
  max-width: 1040px;
  min-height: min(680px, calc(100vh - 170px));
  overflow: hidden;
  place-items: stretch;
  width: min(100%, calc(100vw - 44px));
}

.auth-brand {
  align-items: flex-start;
  background: #063b2e;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
  padding: 56px;
}

.auth-brand h2 {
  align-self: stretch;
  font-size: 2rem;
  line-height: 1.1;
  margin: 0;
  text-align: center;
}

.auth-brand .muted {
  align-self: stretch;
  color: rgb(255 255 255 / 0.72);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  max-width: none;
  text-align: center;
}

.auth-logo {
  display: grid;
  place-items: start;
}

.auth-logo img {
  height: 300px;
  object-fit: contain;
  width: auto;
}

.auth-form {
  align-items: center;
  background: #fff;
  display: flex;
  justify-content: center;
  padding: 64px;
}

.auth-form-inner {
  display: grid;
  gap: 24px;
  max-width: 360px;
  width: 100%;
}

.auth-form-inner h1 {
  font-size: 2.2rem;
  line-height: 1.1;
  margin: 0;
}

.auth-form-inner .muted {
  margin: 6px 0 0;
}

.auth-form .fields {
  width: 100%;
}

@media (max-width: 720px) {
  .auth-shell-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    margin: 16px auto 28px;
    min-height: auto;
    width: min(100%, calc(100vw - 28px));
  }

  .auth-brand {
    padding: 32px;
  }

  .auth-logo img {
    height: 160px;
  }

  .auth-form {
    padding: 32px;
  }
}
