.settings-grid {
  grid-template-columns: minmax(0, 1.26fr) minmax(420px, 1.04fr);
}

.aside-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compose-section {
  border-color: #d5e0ea;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.section-head .note {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.section-head .goal-settings-note {
  color: var(--danger);
  font-weight: 700;
}

.positions-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.position-funding-summary {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--soft);
}

.position-funding-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 0 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.position-funding-summary.collapsed {
  margin-bottom: 12px;
}

.position-funding-summary.collapsed .position-funding-summary-head {
  padding-bottom: 12px;
}

.position-funding-summary-heading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.position-funding-summary-heading > span {
  color: var(--muted);
  font-size: 13px;
}

.position-funding-summary-heading > strong {
  font-size: 15px;
}

.position-funding-summary-formula,
.position-funding-summary-legs {
  color: var(--muted);
  font-size: 12px;
}

.position-funding-summary-table {
  min-width: 760px;
}

.position-funding-summary-table th,
.position-funding-summary-table td {
  padding: 10px;
}

.position-funding-summary-table td > strong,
.position-funding-summary-legs {
  display: block;
}

.position-funding-summary-legs {
  margin-top: 3px;
}

.position-funding-summary-table td.ok,
.position-funding-summary-metrics .ok {
  color: var(--accent);
}

.position-funding-summary-table td.error,
.position-funding-summary-metrics .error {
  color: var(--danger);
}

.position-funding-summary-list {
  border-top: 1px solid var(--soft);
}

.position-funding-summary-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--soft);
}

.position-funding-summary-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.position-funding-summary-title > div {
  min-width: 0;
}

.position-funding-summary-title > div > strong,
.position-funding-summary-title > div > span {
  display: block;
}

.position-funding-summary-title > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.position-funding-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.position-funding-summary-metrics > div {
  min-width: 0;
}

.position-funding-summary-metrics span,
.position-funding-summary-metrics strong {
  display: block;
}

.position-funding-summary-metrics span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.position-funding-summary-metrics strong {
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.positions-search-field {
  min-width: 220px;
}

.section-body {
  padding: 16px;
}

.section-body + .section-body {
  border-top: 1px solid var(--soft);
}

.compose-form {
  display: grid;
  gap: 0;
}

.compose-form .field label {
  font-size: 12px;
  font-weight: 600;
  color: #627487;
}

.compose-form .field input,
.compose-form .field select {
  min-height: 42px;
  border: 1px solid #d6e0ea;
  border-radius: 12px;
  background: #fcfdff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.compose-form .field input::placeholder {
  color: #94a3b4;
}

.compose-form .field-row {
  gap: 14px;
}

.compose-form .field-row.with-top-gap {
  margin-top: 14px;
}

.asset-side-actions {
  align-content: start;
}

.data-management-section .section-head {
  align-items: flex-start;
}

.data-management-section .section-head .note {
  max-width: 360px;
  line-height: 1.55;
}

.data-management-section .field-row {
  align-items: start;
}

.data-management-section .data-action-row {
  grid-template-columns: minmax(0, 1.18fr) minmax(190px, 0.82fr);
}

.data-management-section .data-status-field {
  grid-column: 1 / -1;
}

.data-management-section .data-import-row {
  grid-template-columns: minmax(150px, 0.88fr) minmax(0, 1.06fr) minmax(190px, 0.82fr);
}

.data-management-section .data-import-row .field:nth-child(3) {
  grid-column: 1 / span 2;
}

.data-management-section .data-import-row .field:nth-child(4) {
  grid-column: 3;
}

.data-management-section .btn {
  width: 100%;
  min-height: 44px;
}

.data-management-section .mini-help {
  line-height: 1.55;
}

.asset-side-actions .checkbox {
  min-height: 20px;
}

.sync-price-btn {
  margin-top: 10px;
  min-height: 38px;
  justify-content: center;
  border-radius: 12px;
  border-color: #d6e0ea;
  background: #f7fbfe;
}

.compose-form .form-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef3f7;
}

.compose-form .form-foot .btn.primary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
}

.form-foot-actions {
  justify-content: flex-end;
}

.compose-form .status-line {
  color: #5f7488;
}

.asset-list-section {
  border-color: #d5e0ea;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.list {
  display: grid;
  gap: 12px;
}

.list-stack {
  display: grid;
  gap: 12px;
}

.asset-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.asset-list-toolbar .field {
  flex: 1;
  gap: 0;
}

.asset-list-toolbar input {
  min-height: 40px;
  border: 1px solid #d6e0ea;
  border-radius: 12px;
  background: #fcfdff;
  padding: 0 12px;
}

.list-item {
  border: 1px solid #dbe5ee;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.035);
}

.list-item main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.list-title {
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.list-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.record-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d5e0ea;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 22px rgba(16, 32, 51, 0.035);
}

.record-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2f7;
}

.record-group-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.record-group-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.record-group-meta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #d9e3ec;
  border-radius: 999px;
  background: #f7fbfe;
  color: #5f7488;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-refresh-status {
  margin-bottom: 12px;
  font-size: 12px;
  color: #607487;
}

.history-refresh-status.running {
  color: #8a5d00;
}

.record-group-list {
  display: grid;
  gap: 12px;
}

.list-load-more {
  display: flex;
  justify-content: center;
}

.list-load-more .btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border-color: #d6e0ea;
  background: #f7fbfe;
  color: #4f6478;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid rgba(215, 226, 236, 0.8);
}

.tag.green {
  background: var(--accent-soft);
  color: #0b6a43;
}

.tag.blue {
  background: var(--blue-soft);
  color: #154ea8;
}

.tag.amber {
  background: var(--amber-soft);
  color: #8a5d00;
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.exchange-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcfe 0%, #f7fafc 100%);
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
  box-shadow: var(--shadow);
}

.exchange-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.exchange-card-title-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.exchange-card-kicker {
  color: var(--muted);
  font-size: 12px;
}

.exchange-card-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.exchange-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.exchange-card-value-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.exchange-card-label {
  color: var(--muted);
  font-size: 12px;
}

.exchange-card-value {
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.exchange-card-value-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin-left: 6px;
}

.exchange-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, auto));
  gap: 10px;
}

.exchange-card-metric {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

.exchange-card-metric-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}

.exchange-card-metric-value {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.exchange-card-metric-value.ok {
  color: #0b6a43;
}

.exchange-card-metric-value.pending {
  color: #8a5d00;
}

.exchange-card-metric-value.error {
  color: var(--danger);
}

.exchange-card-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.exchange-card-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.exchange-card-status.ok {
  background: var(--accent-soft);
  color: #0b6a43;
}

.exchange-card-status.pending {
  background: var(--amber-soft);
  color: #8a5d00;
}

.exchange-card-status.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.exchange-card-detail-text {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.exchange-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #dfe7ef;
  border-radius: 999px;
  background: #fbfdff;
  color: #647688;
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.exchange-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
}

.positions-table th,
.positions-table td {
  white-space: nowrap;
}

.positions-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: inherit;
  font-weight: inherit;
  text-align: left;
}

.positions-sort-button:hover,
.positions-sort-button.active {
  color: var(--text);
}

.positions-sort-arrow {
  color: var(--line-strong);
  font-size: 12px;
}

.positions-sort-button.active .positions-sort-arrow {
  color: var(--accent-strong);
}

.positions-table td.ok {
  color: #0b6a43;
}

.positions-table td.error,
.positions-table td.danger {
  color: var(--danger);
}

.positions-capital-control {
  min-width: 78px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 6px 8px;
  outline: none;
}

.positions-capital-leverage {
  width: 82px;
}

@media (min-width: 1200px) {
  .positions-table th,
  .positions-table td {
    padding: 8px 6px;
    line-height: 1.2;
  }

  .positions-table th {
    white-space: normal;
  }

  .positions-table td {
    white-space: nowrap;
  }

  .positions-sort-button {
    gap: 4px;
  }

  .positions-capital-control {
    min-width: 62px;
    padding: 4px 6px;
    border-radius: 8px;
  }

  .positions-capital-leverage {
    width: 64px;
  }
}

.positions-card-list {
  display: grid;
  gap: 12px;
}

.positions-card {
  padding: 14px;
  border: 1px solid #d7e2ec;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.positions-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.positions-card-title-wrap {
  min-width: 0;
}

.positions-card-title {
  font-size: 16px;
  font-weight: 700;
}

.positions-card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.positions-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 12px;
}

.positions-card-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--soft);
  border-radius: 12px;
  background: #fbfdff;
}

.positions-card-item-full {
  grid-column: 1 / -1;
}

.positions-card-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.positions-card-value {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.positions-card-value.ok {
  color: #0b6a43;
}

.positions-card-value.error,
.positions-card-value.danger {
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--soft);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  min-width: 0;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfe;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  overflow-wrap: anywhere;
}

.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #ebeff3;
  overflow: hidden;
  margin-top: 6px;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #58b98f);
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 18px 16px;
  text-align: center;
  background: #fbfcfe;
}

.form-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.mini-help {
  color: var(--muted);
  font-size: 12px;
}

.sync-price-btn {
  margin-top: 16px;
}

.asset-side-actions .mini-help {
  margin-top: -2px;
}

.asset-price-inline-status {
  min-height: 0;
  max-width: 220px;
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.history-controls-panel {
  border: 1px solid #d7e2ec;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  overflow: hidden;
}

.history-controls-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #16324c;
}

.history-controls-panel summary::-webkit-details-marker {
  display: none;
}

.history-controls-body {
  padding: 0 16px 16px;
}

.stats-label {
  font-weight: 600;
}

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

.stats-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #d9e3ec;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 10px 14px;
  box-shadow: 0 6px 16px rgba(16, 32, 51, 0.03);
}

.stats-card.top-rank {
  border-width: 1px;
  box-shadow: 0 16px 28px rgba(16, 32, 51, 0.06);
}

.stats-card.top-rank-1 {
  border-color: #d9c37d;
  background: linear-gradient(180deg, #fffdf7 0%, #fbf5de 100%);
}

.stats-card.top-rank-2 {
  border-color: #cfd8e4;
  background: linear-gradient(180deg, #fbfcfe 0%, #eef3f8 100%);
}

.stats-card.top-rank-3 {
  border-color: #dbc8b6;
  background: linear-gradient(180deg, #fffaf7 0%, #f8ede4 100%);
}

.stats-rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef5fc 0%, #e5eef8 100%);
  color: #5f7387;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stats-card.top-rank-1 .stats-rank {
  background: linear-gradient(180deg, #fff4c9 0%, #efd482 100%);
  color: #6c4d00;
}

.stats-card.top-rank-2 .stats-rank {
  background: linear-gradient(180deg, #f3f6fa 0%, #dce5ef 100%);
  color: #526476;
}

.stats-card.top-rank-3 .stats-rank {
  background: linear-gradient(180deg, #f8e7d8 0%, #e3b892 100%);
  color: #734521;
}

.stats-card-main {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(120px, auto) minmax(180px, 0.85fr) minmax(220px, 1.2fr) auto;
  gap: 14px;
  align-items: center;
}

.stats-card-main .stats-label {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.stats-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.stats-card-value-wrap {
  min-width: 0;
}

.stats-card-value {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: -0.02em;
  text-align: right;
  overflow-wrap: anywhere;
}

.stats-card-unit {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.stats-card-share {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.stats-card-share-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-card-share-label {
  color: #6a7b8d;
  font-size: 11px;
  font-weight: 600;
}

.stats-card-share-value {
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.stats-card-foot {
  justify-self: end;
  white-space: nowrap;
}
