* { box-sizing: border-box; }
html { overflow-x: hidden; }
body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #15202b;
  background: #f4f7fb;
  overflow-x: hidden;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(380px, calc(100% - 32px));
}
.login-panel h1 {
  margin-bottom: 14px;
}
.layout {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
  max-width: 100%;
  overflow-x: clip;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.toolbar-actions button {
  margin-top: 0;
}
h1, h2, p { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; margin-bottom: 14px; }
p { color: #617081; margin-top: 4px; }
.grid {
  display: grid;
  grid-template-columns: 520px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.operation-section,
.trade-page-grid {
  align-items: stretch;
}
.account-selector-dock {
  position: sticky;
  top: 0;
  z-index: 70;
  margin-bottom: 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 32, 0.10);
}
.account-selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.account-selector-row h2 {
  margin-bottom: 0;
  white-space: nowrap;
}
.refresh-all-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 7px 12px;
  white-space: nowrap;
}
.operation-dock {
  position: sticky;
  top: 66px;
  z-index: 50;
  margin-bottom: 16px;
  max-height: calc(100vh - 8px);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15, 23, 32, 0.12);
}
.operation-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.operation-dock-head h2,
.dock-head h2 {
  margin-bottom: 0;
}
.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.operation-dock-head:focus-visible,
.dock-head:focus-visible {
  outline: 2px solid #9dc2f4;
  outline-offset: 4px;
  border-radius: 6px;
}
.toggle-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef5ff;
  color: #1f5fbf;
  border: 1px solid #c8daf3;
  font-size: 12px;
  font-weight: 700;
}
.operation-dock-body {
  display: grid;
  grid-template-columns: 520px minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
  max-height: calc(100vh - 144px);
  min-height: 0;
  overflow: auto;
}
.operation-dock:not(.is-open) {
  box-shadow: 0 8px 18px rgba(15, 23, 32, 0.10);
}
.operation-dock:not(.is-open) .operation-dock-body {
  display: none;
}
.aggregate-dock {
  margin-bottom: 16px;
}
.aggregate-dock-body {
  margin-top: 14px;
}
.aggregate-dock:not(.is-open) .aggregate-dock-body {
  display: none;
}
.aggregate-snapshot {
  display: grid;
  gap: 12px;
}
.operation-pane {
  min-height: 0;
}
.operation-result-pane {
  display: flex;
  flex-direction: column;
}
.operation-result-pane h2 {
  flex: 0 0 auto;
}
.operation-result-pane pre {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}
.operation-section > .panel,
.trade-page-grid > .panel {
  min-height: 0;
}
.operation-section > .panel:last-child,
.trade-page-grid > .panel:last-child {
  display: flex;
  flex-direction: column;
}
.operation-section > .panel:last-child pre,
.trade-page-grid > .panel:last-child pre {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}
.mobile-only {
  display: none;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: #fff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: 12px;
}
.stat span {
  display: block;
  color: #617081;
  font-size: 12px;
  margin-bottom: 6px;
}
.stat strong {
  display: block;
  font-size: 20px;
}
.panel {
  background: #fff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.panel-title-row h2 {
  margin-bottom: 0;
  white-space: nowrap;
}
.account-groups {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #617081;
  font-size: 12px;
  font-weight: 700;
}
.inline-filter select {
  width: auto;
  min-width: 96px;
  padding: 5px 28px 5px 8px;
  border-radius: 999px;
  background-color: #eef5ff;
  border-color: #c8daf3;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 700;
}
.compact-account-filter select {
  min-width: 118px;
  max-width: 156px;
  padding: 4px 24px 4px 8px;
}
.inline-filter input {
  width: auto;
  min-width: 132px;
  padding: 5px 8px;
  border-radius: 999px;
  background-color: #eef5ff;
  border-color: #c8daf3;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 700;
}
.snapshot-selector-stack {
  display: grid;
  gap: 8px;
}
.snapshot-filter-row,
.snapshot-button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.snapshot-filter-row {
  flex-wrap: wrap;
  overflow-x: visible;
}
.snapshot-button-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.snapshot-filter-row .account-groups {
  display: contents;
}
.snapshot-filter-row .inline-filter {
  flex: 0 1 auto;
  min-width: 0;
}
.snapshot-filter-row .inline-filter select {
  min-width: 82px;
  max-width: 126px;
}
.snapshot-filter-row .inline-filter input {
  min-width: 118px;
  max-width: 132px;
}
.snapshot-filter-row #snapshotAccount {
  min-width: 118px;
  max-width: 148px;
}
.snapshot-account-picker {
  position: static;
}
.account-picker-toggle {
  width: auto;
  min-width: 112px;
  max-width: 156px;
  margin: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background-color: #eef5ff;
  border-color: #c8daf3;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 700;
}
.account-picker-menu {
  position: fixed;
  z-index: 2000;
  display: none;
  width: min(280px, calc(100vw - 16px));
  max-height: 360px;
  overflow: auto;
  border: 1px solid #d5dee9;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 32, 0.18);
}
.account-picker-menu.show {
  display: grid;
  gap: 8px;
}
.account-picker-actions {
  display: flex;
  gap: 6px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 6px;
}
.account-picker-list {
  display: grid;
  gap: 5px;
}
.account-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #243447;
  font-size: 13px;
}
.account-check input {
  width: auto;
  min-width: auto;
  max-width: none;
}
.snapshot-filter-row .selected-count {
  display: none;
}
.snapshot-button-row .refresh-all-button {
  min-width: 74px;
  flex: 0 1 auto;
}
.selected-count {
  color: #35465a;
  font-size: 12px;
  font-weight: 700;
}
.reminder-conditions {
  display: grid;
  gap: 12px;
}
.reminder-form-panel {
  margin-bottom: 16px;
}
.reminder-form-grid {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(120px, 160px) minmax(120px, 160px) minmax(150px, 1fr) minmax(110px, 140px) auto auto;
  gap: 12px;
  align-items: end;
}
.reminder-form-grid button {
  min-height: 38px;
}
.reminder-condition-card {
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdff;
}
.reminder-condition-card.stopped-card {
  opacity: 0.72;
}
.reminder-condition-card.error-card {
  border-color: #f2b8b5;
  background: #fff8f7;
}
.reminder-condition-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.reminder-channel {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e6f4ea;
  color: #137333;
  font-size: 12px;
  font-weight: 700;
}
.reminder-channel.danger {
  background: #fce8e6;
  color: #b42318;
}
.reminder-condition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}
.reminder-condition-grid div {
  padding: 10px;
  border: 1px solid #e4ebf3;
  border-radius: 7px;
  background: #fff;
}
.reminder-condition-grid span {
  display: block;
  color: #617081;
  font-size: 12px;
  margin-bottom: 5px;
}
.reminder-condition-grid strong {
  display: block;
  font-size: 17px;
}
.compact-reminder-card {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.reminder-line-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.reminder-line-title strong {
  white-space: nowrap;
}
.reminder-line-body {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow-x: auto;
  color: #617081;
  font-size: 13px;
}
.reminder-line-body span {
  flex: 0 0 auto;
}
.reminder-line-body strong {
  color: #15202b;
  font-size: 14px;
}
.reminder-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 0;
}
.danger-button {
  background: #fce8e6;
  color: #b42318;
  border-color: #f2b8b5;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #35465a;
  margin: 12px 0 6px;
}
input, select, textarea, button {
  width: 100%;
  font: inherit;
}
input, select, textarea {
  border: 1px solid #c7d2df;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}
textarea {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.info-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: #eef5ff;
  border: 1px solid #c8daf3;
  border-radius: 6px;
  color: #263b55;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}
.endpoint-hints {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.endpoint-hints button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: center;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #d9e4f1;
  border-radius: 6px;
  background: #fbfdff;
  color: #1f2f43;
  text-align: left;
  font-weight: 600;
}
.endpoint-hints button:hover {
  background: #f1f7ff;
}
.endpoint-hints small {
  grid-column: 2;
  color: #617081;
  font-weight: 400;
}
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e6f4ea;
  color: #137333;
  font-size: 12px;
}
.tag.danger {
  background: #fce8e6;
  color: #b42318;
}
.section-title {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e4ebf3;
  font-size: 14px;
  font-weight: 700;
  color: #263b55;
}
.param-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.param-row {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e0e8f2;
  border-radius: 8px;
  background: #fbfdff;
}
.param-required {
  border-color: #9dc2f4;
  background: #f5f9ff;
}
.param-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #172638;
  overflow-wrap: anywhere;
}
.param-desc {
  margin-top: 4px;
  color: #617081;
  font-size: 12px;
  line-height: 1.35;
}
.param-control textarea {
  min-height: 78px;
}
.param-error {
  border-color: #d92d20;
  background: #fff8f7;
}
.required {
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f6e7bc;
  color: #6c4b00;
  font-size: 11px;
  vertical-align: middle;
}
.muted-badge {
  background: #eef1f5;
  color: #617081;
}
.advanced-block {
  margin-top: 14px;
  border-top: 1px solid #e4ebf3;
  padding-top: 12px;
}
.advanced-block summary {
  cursor: pointer;
  color: #263b55;
  font-weight: 700;
  font-size: 14px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.transfer-query-grid,
.order-query-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(140px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
}
.order-query-grid {
  grid-template-columns: minmax(170px, 1.1fr) minmax(150px, 1fr) minmax(130px, .9fr) repeat(2, minmax(130px, .9fr)) minmax(86px, .6fr) auto;
}
.transfer-query-grid button,
.order-query-grid button {
  width: auto;
  min-width: 88px;
}
.transfer-results,
.order-results {
  overflow-x: auto;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pager button {
  width: auto;
  min-width: 80px;
}
.hint-text {
  margin-top: 8px;
  color: #617081;
  font-size: 13px;
  line-height: 1.5;
}
.transfer-total-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #d9e4f1;
  border-radius: 6px;
  background: #fbfdff;
}
.transfer-total-bar span,
.transfer-total-bar strong {
  white-space: nowrap;
}
.hash-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cancelled-row td {
  color: #8a97a8;
  text-decoration: line-through;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.check input { width: auto; }
button {
  margin-top: 14px;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: #1f6feb;
  color: white;
  cursor: pointer;
  font-weight: 700;
}
button:hover { background: #195fc9; }
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #eef5ff;
  color: #1f5fbf;
  border: 1px solid #c8daf3;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}
.link-button:hover {
  background: #dfeeff;
}
pre {
  min-height: 468px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  background: #0f1720;
  color: #d6e2f0;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.card {
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
  min-width: 0;
  max-width: 100%;
}
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-title h3 { margin: 0; }
.card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.small-button {
  width: auto;
  min-height: 24px;
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #1f5fbf;
  border: 1px solid #c8daf3;
  font-size: 12px;
}
.small-button:hover {
  background: #dfeeff;
}
.loading-card {
  opacity: 0.62;
}
.permission {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef1f5;
  color: #4b5b6d;
  font-size: 12px;
  font-weight: 700;
}
.permission.write {
  background: #fce8e6;
  color: #b42318;
}
.account-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.account-metrics div {
  border: 1px solid #e4ebf3;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}
.account-metrics span {
  display: block;
  color: #617081;
  font-size: 12px;
  margin-bottom: 4px;
}
.account-metrics strong {
  font-size: 15px;
}
.subhead {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #35465a;
}
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-scroll > .mini-table {
  min-width: max-content;
}
.mini-table th,
.mini-table td {
  padding: 6px 7px;
  border-bottom: 1px solid #e8eef6;
  text-align: right;
  white-space: nowrap;
}
.mini-table tbody tr:nth-child(even) td {
  background: #f7f9fc;
}
.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
}
.mini-table th {
  color: #617081;
  font-weight: 700;
  background: #f6f9fc;
}
.borrow-row td {
  background: #fff8f7;
  font-size: 12px;
}
.mini-table tbody tr.borrow-row td {
  background: #fff8f7;
}
.borrow-row td:first-child {
  padding-left: 18px;
  color: #b42318;
}
.interest-row td {
  background: #fff4e5;
  font-size: 12px;
}
.mini-table tbody tr.interest-row td {
  background: #fff4e5;
}
.interest-row td:first-child {
  padding-left: 18px;
  color: #9a5b00;
}
.free-borrow-row td {
  background: #f0fff4;
  font-size: 12px;
}
.mini-table tbody tr.free-borrow-row td {
  background: #f0fff4;
}
.free-borrow-row td:first-child {
  padding-left: 18px;
  color: #137333;
}
.source-row td {
  background: #f6f9fc;
  font-size: 12px;
}
.mini-table tbody tr.source-row td {
  background: #f6f9fc;
}
.source-row td:first-child {
  padding-left: 18px;
  color: #35465a;
}
.total-card {
  border-color: #9dc2f4;
  background: #f8fbff;
}
.master-account-card {
  grid-column: 1 / -1;
  border-color: #aac7ec;
  background: #fff;
}
.market-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 6px 0 10px;
}
.market-total {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  border: 1px solid #d9e4f1;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
}
.market-total span {
  color: #35465a;
  font-weight: 700;
}
.market-total strong {
  white-space: nowrap;
}
.count-button {
  width: auto;
  min-width: 30px;
  margin: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef5ff;
  color: #1f5fbf;
  border: 1px solid #c8daf3;
  font-size: 12px;
}
.count-button:hover {
  background: #dfeeff;
}
.funding-rate-button {
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.funding-rate-button:hover {
  background: transparent;
  text-decoration-thickness: 2px;
}
.danger-button {
  background: #fff1f0;
  border-color: #f3b5ad;
  color: #b42318;
}
.danger-button:hover {
  background: #ffe1de;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 32, 0.38);
  z-index: 1000;
}
.modal-backdrop.show {
  display: flex;
}
.modal {
  width: min(420px, 100%);
  max-height: min(520px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dce4ee;
  padding: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 32, 0.22);
  max-width: calc(100vw - 20px);
  overflow-x: hidden;
}
.modal-wide {
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 40px));
}
.funding-history-modal {
  width: min(760px, 100%);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
}
.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.modal-close {
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: #eef1f5;
  color: #35465a;
  font-size: 18px;
  line-height: 1;
}
.funding-history-title {
  color: #35465a;
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0 10px;
}
.funding-history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.funding-stat-card {
  border: 1px solid #e1e7ef;
  border-radius: 7px;
  background: #f8fbff;
  padding: 9px 10px;
}
.funding-stat-card span,
.funding-stat-card em {
  display: block;
  color: #617081;
  font-size: 12px;
  font-style: normal;
}
.funding-stat-card strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 17px;
  line-height: 1.2;
}
.analysis-report {
  display: grid;
  gap: 12px;
  font-size: 14px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.analysis-screenshot-source {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  box-sizing: border-box;
  background: #fff;
  color: #1f2d3d;
  padding: 18px;
  font-family: Arial, "Helvetica Neue", sans-serif;
}
.analysis-screenshot-source h2 {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.35;
}
.analysis-note {
  color: #5d6b7a;
  font-size: 12px;
  line-height: 1.45;
}
.analysis-block,
.analysis-segment {
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
}
.analysis-block h4,
.analysis-segment h4 {
  margin: 0 0 8px;
  font-size: 15px;
}
.analysis-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.analysis-block-head h4 {
  margin: 0;
}
.analysis-block h5 {
  margin: 10px 0 6px;
  font-size: 13px;
  color: #35465a;
}
.analysis-segment h4 span {
  color: #6b7785;
  font-size: 12px;
  font-weight: 700;
}
.analysis-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.analysis-metrics span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border-radius: 999px;
  background: #f3f6fa;
  padding: 4px 8px;
  color: #46576a;
  font-size: 12px;
}
.analysis-metrics-main span {
  background: #eef5ff;
}
.analysis-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.analysis-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.analysis-list li {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 4px 8px;
  padding: 6px 0;
  border-top: 1px solid #eef1f5;
  min-width: 0;
}
.analysis-list small {
  grid-column: 1 / -1;
  color: #6b7785;
}
.analysis-notes-input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid #d5dee9;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  line-height: 1.5;
}
.analysis-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #617081;
  font-size: 12px;
  font-weight: 700;
}
.analysis-field select {
  width: min(360px, 100%);
}
.analysis-input-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.analysis-user-notes {
  white-space: normal;
  color: #243447;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.ai-analysis-block {
  background: #f8fbff;
}
.ai-analysis-text {
  color: #1f2d3d;
  line-height: 1.65;
  white-space: normal;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ai-analysis-text p {
  margin: 0 0 10px;
}
.ai-analysis-text strong,
.ai-markdown-table strong {
  font-weight: 800;
}
.ai-color-red {
  color: #b42318;
  font-weight: 700;
}
.ai-color-green {
  color: #067647;
  font-weight: 700;
}
.ai-color-orange {
  color: #b54708;
  font-weight: 700;
}
.ai-color-blue {
  color: #175cd3;
  font-weight: 700;
}
.ai-color-gray {
  color: #667085;
}
.ai-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 10px 0 14px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.ai-markdown-table {
  width: 100%;
  min-width: 620px;
  font-size: 13px;
}
.ai-markdown-table th,
.ai-markdown-table td {
  text-align: left;
  vertical-align: top;
  white-space: normal;
}
.ai-markdown-table td {
  line-height: 1.45;
}
.ai-markdown-table tr.ai-row-strong td {
  background: #e7edf5;
  font-weight: 700;
}
.ai-markdown-table tr.ai-row-warning td {
  background: #fff4d6;
}
.ai-markdown-table tr.ai-row-danger td {
  background: #ffe4e4;
}
.ai-markdown-table tr.ai-row-success td {
  background: #dcfce7;
}
.ai-markdown-table tr.ai-row-muted td {
  background: #f1f3f5;
  color: #667085;
}
.ai-markdown-table td.ai-cell-border {
  box-shadow: inset 0 0 0 2px #111827;
  background-clip: padding-box;
}
.ai-markdown-table td.ai-cell-strong {
  background: #dbe5f1;
  font-weight: 800;
}
.ai-markdown-table td.ai-cell-warning {
  background: #ffe8a3;
}
.ai-markdown-table td.ai-cell-danger {
  background: #ffc9c9;
}
.ai-markdown-table td.ai-cell-success {
  background: #bbf7d0;
}
.ai-markdown-table td.ai-cell-muted {
  background: #e5e7eb;
  color: #667085;
}
.analysis-history-list {
  display: grid;
  gap: 10px;
}
.analysis-history-item {
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.analysis-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.analysis-history-head span {
  border-radius: 999px;
  background: #eef5ff;
  color: #1f5fbf;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}
.analysis-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}
.analysis-history-meta span {
  border: 1px solid #e1e7ef;
  border-radius: 999px;
  background: #f7f9fc;
  color: #35465a;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.analysis-history-preview {
  margin: 6px 0;
  color: #243447;
  line-height: 1.45;
}
.analysis-history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.analysis-compare-table th,
.analysis-compare-table td {
  white-space: nowrap;
}
.pos { color: #137333; }
.neg { color: #b42318; }
.error-text {
  color: #b42318;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.muted { color: #617081; }
@media (max-width: 900px) {
  .layout {
    width: min(100% - 16px, 560px);
    padding: 12px 0 32px;
  }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .account-selector-row {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .operation-dock {
    top: 126px;
  }
  .operation-dock-body {
    max-height: calc(100vh - 204px);
  }
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .panel-head-actions {
    align-items: stretch;
    width: 100%;
  }
  .panel-head-actions .refresh-all-button {
    margin-left: auto;
  }
  .reminder-condition-grid {
    grid-template-columns: 1fr;
  }
  .reminder-form-grid {
    grid-template-columns: 1fr;
  }
  .compact-reminder-card {
    grid-template-columns: 1fr;
  }
  .reminder-actions {
    justify-content: flex-start;
  }
  .panel-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .snapshot-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    overflow-x: visible;
  }
  .snapshot-filter-row .account-groups {
    display: contents;
  }
  .snapshot-filter-row .inline-filter,
  .snapshot-account-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
  }
  .snapshot-filter-row .inline-filter select,
  .snapshot-filter-row .inline-filter input,
  .snapshot-filter-row #snapshotAccount,
  .account-picker-toggle {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .snapshot-button-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .snapshot-button-row .refresh-all-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  .mobile-only {
    display: inline-flex;
  }
  .operation-section {
    display: none;
  }
  .trade-page-grid {
    display: grid;
  }
  .param-row { grid-template-columns: 1fr; }
  .panel {
    padding: 12px;
  }
  .snapshot {
    grid-template-columns: minmax(0, 1fr);
  }
  .total-card {
    grid-column: auto;
  }
  .card {
    min-width: 0;
    overflow-x: hidden;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .transfer-query-grid,
  .order-query-grid {
    grid-template-columns: 1fr;
  }
  .transfer-query-grid button,
  .order-query-grid button {
    width: 100%;
  }
  .pager {
    justify-content: flex-start;
  }
  .analysis-columns,
  .analysis-list li {
    grid-template-columns: 1fr;
  }
  .analysis-input-actions,
  .modal-head,
  .modal-head-actions {
    flex-wrap: wrap;
  }
  pre {
    min-height: 260px;
  }
}

@media (max-width: 520px) {
  .snapshot-filter-row,
  .snapshot-button-row,
  .toolbar-actions {
    grid-template-columns: 1fr;
  }
  .modal {
    max-width: calc(100vw - 12px);
    padding: 12px;
  }
  .ai-markdown-table {
    min-width: 560px;
  }
}

@media (min-width: 901px) {
  .trade-page-grid {
    grid-template-columns: 520px 1fr;
  }
}
