:root {
  /* Brand */
  --brand: #0f8a5f;
  --brand-700: #0a6a4a;
  --brand-50: #e6f4ed;

  /* Surfaces */
  --bg: #f4f6f5;
  --bg-grad-1: #eef3ef;
  --bg-grad-2: #f7f9f6;
  --surface: #ffffff;
  --surface-2: #f7f9f7;
  --surface-3: #eef2ef;

  /* Text */
  --ink: #0e1a14;
  --ink-2: #2a3832;
  --muted: #6a7770;
  --subtle: #9aa39d;

  /* Lines */
  --line: #e0e6e1;
  --line-strong: #c9d2cb;

  /* Accents */
  --green: #0f8a5f;
  --green-soft: #d8efe3;
  --red: #c14941;
  --red-soft: #fadcd9;
  --amber: #b07417;
  --amber-soft: #fbecc8;
  --teal: #176d78;
  --blue: #2b6cb0;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 30, 23, 0.04), 0 1px 1px rgba(15, 30, 23, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 30, 23, 0.06), 0 2px 6px rgba(15, 30, 23, 0.04);
  --shadow-lg: 0 20px 50px rgba(15, 30, 23, 0.12), 0 6px 14px rgba(15, 30, 23, 0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand-700);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 1px 2px rgba(10, 60, 40, 0.18);
}

.btn-primary:hover {
  background: var(--brand-700);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--red);
  border-color: #92332d;
  color: #fff;
}

.btn-danger:hover {
  background: #a93d36;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}

.link-btn:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  white-space: nowrap;
}

.lang-btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.lang-btn:hover {
  color: var(--ink-2);
}

.lang-btn.active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
}

/* ===================== Inputs ===================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-inline label {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.checkbox-field .checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}

.checkbox-field .checkbox-line input {
  width: 16px;
  height: 16px;
  margin: 0;
}

input,
select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%236a7770' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.14);
}

input::placeholder {
  color: var(--subtle);
}

/* ===================== 币种选择下拉(单/多选,全站共用) ===================== */
.multi-select {
  position: relative;
}
.ms-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 30px 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ms-control:hover {
  border-color: var(--line-strong);
}
.multi-select.open .ms-control {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.14);
}
.ms-chips {
  display: contents;
}
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: var(--brand-50);
  border: 1px solid rgba(15, 138, 95, 0.28);
  color: var(--brand-700);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
}
.ms-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--brand-700);
  font-size: 14px;
  line-height: 1;
}
.ms-chip-x:hover {
  background: rgba(15, 138, 95, 0.16);
}
.ms-input {
  flex: 1;
  min-width: 90px;
  width: auto;
  height: 26px;
  border: none;
  background: transparent;
  padding: 0 2px;
  box-shadow: none;
}
.ms-input:focus {
  border: none;
  box-shadow: none;
}
/* 单选模式:输入框承载当前值,占满整行,字体与普通 input 一致。 */
.multi-select.single .ms-input {
  font-size: 13.5px;
  min-width: 0;
}
.ms-caret {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 140ms ease;
  pointer-events: none;
}
.multi-select.open .ms-caret {
  transform: rotate(-135deg);
  margin-top: -2px;
}
.ms-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 4px;
}
.ms-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.ms-option:hover,
.ms-option.active {
  background: var(--surface-3);
}
.ms-option .ms-opt-sym {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 600;
}
.ms-option .ms-opt-meta {
  color: var(--muted);
  font-size: 12px;
}
.ms-option.selected {
  color: var(--brand-700);
  font-weight: 700;
}
.ms-option.selected::after {
  content: "✓";
  color: var(--brand);
  font-weight: 700;
}
.ms-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.ms-add {
  color: var(--brand-700);
  font-weight: 600;
}

/* ===================== Login Screen ===================== */
.auth-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(15, 138, 95, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(23, 109, 120, 0.09), transparent 60%),
    linear-gradient(180deg, #eef3ef 0%, #f7f9f6 60%, #eef3ef 100%);
  overflow: hidden;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 30, 23, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 30, 23, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 40px 36px 32px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 60px -20px rgba(15, 30, 23, 0.18),
    0 10px 24px -8px rgba(15, 30, 23, 0.10);
}

.auth-tools {
  display: flex;
  justify-content: flex-end;
  margin: -14px -8px 16px 0;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.auth-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}

.auth-brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--teal) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.5px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 8px 18px rgba(15, 138, 95, 0.32),
    0 2px 4px rgba(15, 138, 95, 0.18);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form .field label {
  font-size: 11.5px;
  color: var(--ink-2);
}

.auth-form input {
  height: 44px;
  font-size: 14px;
}

.auth-form .btn {
  margin-top: 6px;
  height: 46px;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.auth-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.auth-hint code {
  background: var(--surface-3);
  padding: 2px 7px;
  border-radius: 5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 500;
}

.auth-notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  border: 1px solid #f0d99a;
  line-height: 1.5;
}

.auth-footer {
  position: relative;
  margin-top: 24px;
  color: var(--subtle);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ===================== App Shell ===================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.app-header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
}

.brand-text p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.symbol-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.symbol-bar .field-inline label {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.symbol-bar input {
  width: 170px;
  height: 32px;
  border: 1px solid var(--line);
  font-weight: 600;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0;
}

.symbol-bar .btn {
  height: 32px;
  padding: 0 12px;
}

.symbol-presets {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.symbol-presets::-webkit-scrollbar {
  display: none;
}

.symbol-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 46px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.symbol-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.symbol-chip.active {
  background: var(--brand-50);
  border-color: rgba(15, 138, 95, 0.28);
  color: var(--brand-700);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.app-main {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===================== Market strip ===================== */
.market-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  position: relative;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 78px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--ink);
}

/* ===================== Layout ===================== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.main-column,
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, var(--surface-2));
}

.card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.card-title h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===================== Account grid ===================== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px 16px 16px;
}

.account-card {
  padding: 14px 14px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.account-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.account-card .name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--brand-700);
  letter-spacing: 0.02em;
}

.tag.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.bad {
  background: var(--red-soft);
  color: var(--red);
}

.balances {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-top: 14px;
}

.balances > div {
  min-width: 0;
}

.balances span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.balances strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 0;
}

.account-empty {
  grid-column: 1 / -1;
}

/* ===================== Tables ===================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}

th.num,
td.num {
  text-align: right;
}

td {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

tbody tr {
  transition: background 100ms ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.num-pos {
  color: var(--green);
  font-weight: 600;
}

.num-neg {
  color: var(--red);
  font-weight: 600;
}

.live-cell {
  transition: color 120ms ease, background 120ms ease;
}

.pnl-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.25;
}

.pnl-stack strong,
.pnl-stack span {
  color: inherit;
  font-weight: 600;
}

.pnl-stack span {
  font-size: 12px;
}

.exit-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.25;
}

.exit-stack span {
  display: block;
}

.exit-stack b {
  color: var(--muted);
  font-weight: 700;
  margin-right: 4px;
}

.side-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.side-pill.long {
  background: var(--green-soft);
  color: var(--brand-700);
}

.side-pill.short {
  background: var(--red-soft);
  color: var(--red);
}

.empty {
  padding: 22px 18px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ===================== Event log ===================== */
.log {
  height: 230px;
  overflow: auto;
  padding: 8px 16px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  background: var(--surface);
}

.log div {
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-2);
}

.log-time {
  color: var(--muted);
  margin-right: 6px;
}

.log div:last-child {
  border-bottom: 0;
}

.log .error {
  color: var(--red);
}

.log:empty::before {
  content: attr(data-empty);
  display: block;
  padding: 10px 0;
  color: var(--subtle);
  font-style: italic;
}

/* ===================== Responsive ===================== */
@media (max-width: 1280px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 16px;
  }

  .market-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-header-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .symbol-bar,
  .header-actions {
    justify-self: stretch;
  }

  .symbol-bar {
    grid-template-columns: 1fr auto;
  }

  .symbol-bar .field-inline {
    justify-content: space-between;
  }

  .symbol-presets {
    grid-column: 1 / -1;
  }

  .header-actions {
    justify-content: space-between;
  }

  .market-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 16px 14px 24px;
  }
}

@media (max-width: 520px) {
  .market-strip {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 28px 22px 24px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .symbol-bar {
    grid-template-columns: 1fr;
  }

  .symbol-bar .field-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .symbol-bar input {
    width: 100%;
  }

  .user-pill {
    flex: 1;
  }
}


/* 对冲开仓卡片输出 + 波动率高亮(hedge open / vol-hot) */
.hedge-out { margin-top: 10px; }
.hedge-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hedge-table th, .hedge-table td { padding: 4px 8px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
.hedge-table th { color: var(--muted, #9aa); font-weight: 600; }
.hedge-liqcheck thead th { color: var(--muted, #9aa); }
.hedge-diff-warn td { color: #ff6b6b; font-weight: 600; }
/* 仓位已开但止盈止损挂单失败的醒目红色横幅(降级告警,非失败) */
.hedge-exit-warn {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--red, #c14941);
  border-left: 4px solid var(--red, #c14941);
  border-radius: 8px;
  background: var(--red-soft, #fadcd9);
  color: var(--red, #c14941);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
}
tr.vol-hot td { background: rgba(255, 196, 0, 0.12); }
tr.vol-hot td.symbol { font-weight: 700; }

/* 开仓前确认弹框(每个币种独立预览→人工确认才下单)。沿用全站浅色主题变量。 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 23, 0.32);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade 0.14s ease-out;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e0e6e1);
  border-radius: var(--radius-lg, 14px);
  padding: 22px 24px 20px;
  width: min(420px, 92vw);
  max-height: 88vh;
  overflow: auto;
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(15, 30, 23, 0.12));
  animation: modal-pop 0.16s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes modal-pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #e0e6e1);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--ink, #0e1a14); }
.modal-symbol {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--brand-700, #0a6a4a);
  background: var(--brand-50, #e6f4ed);
  padding: 3px 11px;
  border-radius: 999px;
}
.modal-kv { margin: 0; display: flex; flex-direction: column; }
.modal-kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line, #e0e6e1);
}
.modal-kv-row:last-child { border-bottom: none; }
.modal-kv dt { color: var(--muted, #6a7770); font-size: 13px; }
.modal-kv dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  color: var(--ink, #0e1a14);
}
.mv-long { color: var(--green, #0f8a5f); }
.mv-short { color: var(--red, #c14941); }
.mv-sep { color: var(--subtle, #9aa39d); margin: 0 6px; }
.mv-ok { color: var(--green, #0f8a5f); }
.mv-bad { color: var(--red, #c14941); }
.modal-warn {
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm, 6px);
  background: var(--red-soft, #fadcd9);
  border: 1px solid var(--red, #c14941);
  color: var(--red, #c14941);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.modal-actions button {
  padding: 9px 20px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--line-strong, #c9d2cb);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.12s ease, background 0.12s ease;
}
.modal-actions button:hover { filter: brightness(0.97); }
.modal-cancel { background: var(--surface, #fff); color: var(--ink-2, #2a3832); }
.modal-confirm {
  background: var(--brand, #0f8a5f);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.modal-confirm:hover { filter: brightness(1.06); }
