:root {
  --bg: #0b0f14;
  --surface: #121820;
  --surface2: #1a2230;
  --border: #2a3548;
  --text: #e8edf5;
  --muted: #8b9ab5;
  --accent: #f0b429;
  --accent-dim: #c48d12;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.hidden { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app {
  max-width: 1340px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  overflow: visible;
}

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

.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  font-size: 2rem;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(240,180,41,.4));
}
.brand h1 { font-size: 1.4rem; font-weight: 700; }
.brand p { color: var(--muted); font-size: .85rem; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.badge-running { background: rgba(34,197,94,.12); color: var(--success); border-color: rgba(34,197,94,.3); }
.badge-idle { background: var(--surface2); color: var(--muted); }
.badge-alarm { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.4); animation: pulse 1s infinite; }

@keyframes pulse { 50% { opacity: .7; } }

.phone-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -8px 0 20px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 180, 41, 0.45);
  background: rgba(240, 180, 41, 0.12);
  color: var(--text);
}

.phone-banner.hidden { display: none; }

.phone-banner-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.phone-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.phone-banner-text strong {
  color: var(--accent);
  font-size: 1rem;
}

.phone-banner-text span {
  color: var(--muted);
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  transition: .15s;
}
.tab:hover { color: var(--text); background: var(--surface2); }
.tab.active { background: var(--accent); color: #111; font-weight: 600; }

.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.panel-head h2 { font-size: 1.1rem; }
.muted { color: var(--muted); font-size: .85rem; }

.panel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 14px;
  flex-wrap: wrap;
}

.group-mode-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: var(--muted);
}

.group-mode-select {
  padding: 7px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
}

.group-mode-select:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.field-error {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.45;
}

.field-error.hidden {
  display: none;
}

.symbol-validation-alert {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.08);
  position: relative;
  z-index: 30;
}

.symbol-validation-alert.hidden {
  display: none;
}

.symbol-validation-alert-soft {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: none;
}

.symbol-validation-alert-soft .symbol-validation-title {
  color: #f87171;
  font-weight: 600;
}

.symbol-validation-title {
  color: #fca5a5;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.symbol-validation-text {
  color: #fecaca;
  font-size: 0.84rem;
  line-height: 1.5;
}

.symbol-suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.symbol-suggest-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.symbol-suggest-chip:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
}

.field input.input-invalid {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.06);
}

.field input.input-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28);
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.field input.input-invalid-shake {
  animation: field-shake 0.38s ease;
}

.symbol-input-wrap {
  position: relative;
}

.symbol-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: min(50vh, 360px);
  overflow-y: auto;
}

.symbol-suggest.hidden {
  display: none;
}

.symbol-suggest li {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
}

.symbol-suggest li:hover,
.symbol-suggest li:focus {
  background: rgba(255, 255, 255, 0.06);
}

.symbol-suggest-base {
  font-weight: 600;
  color: var(--text);
}

.symbol-suggest-quote {
  color: var(--muted);
  font-size: 0.8rem;
}

.btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #111; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.35); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .85rem;
}
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface2); color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tr.triggered td { background: rgba(239,68,68,.08); }
tr.history-test td { background: rgba(234,179,8,.08); }
.tag-test { margin-left: 6px; font-size: .7rem; background: rgba(234,179,8,.15); color: #ca8a04; }
.history-time { white-space: nowrap; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .875rem;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.threshold-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.threshold-row input { flex: 1; min-width: 0; }
.threshold-row select.threshold-unit {
  width: auto;
  min-width: 5.5em;
  flex-shrink: 0;
}
.input-with-suffix {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input-with-suffix input { flex: 1; min-width: 0; }
.input-suffix {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 1.2em;
}
.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
}
.field-check input { width: auto; }
.field-check label { margin: 0; color: var(--text); font-size: .875rem; }

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 8px;
  margin-bottom: 16px;
}

.settings-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-section-head h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.settings-section-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.field-readonly .readonly-value {
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: .875rem;
  word-break: break-all;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  opacity: 0;
  transform: translateY(8px);
  transition: .25s;
  pointer-events: none;
  z-index: 999;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(34,197,94,.4); }
.toast.err { border-color: rgba(239,68,68,.4); }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  background: #0c1f24;
  font-family: "Noto Sans SC", "Sora", sans-serif;
  color: #e8f2f0;
}

.login-overlay.hidden { display: none; }

.login-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 18% 30%, rgba(45, 212, 191, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 40% at 82% 70%, rgba(14, 116, 144, 0.28), transparent 55%),
    linear-gradient(145deg, #071418 0%, #0f2a30 42%, #12353a 100%);
  animation: loginMeshDrift 18s ease-in-out infinite alternate;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(232, 242, 240, 0.12);
  animation: loginOrbFloat 14s ease-in-out infinite alternate;
}

.login-orb-a {
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  right: -8%;
  top: 12%;
  background: radial-gradient(circle at 35% 35%, rgba(94, 234, 212, 0.16), transparent 65%);
}

.login-orb-b {
  width: min(32vw, 280px);
  height: min(32vw, 280px);
  right: 18%;
  bottom: 18%;
  animation-delay: -4s;
  background: radial-gradient(circle at 60% 40%, rgba(125, 211, 252, 0.12), transparent 70%);
}

.login-orb-c {
  width: min(18vw, 140px);
  height: min(18vw, 140px);
  left: 42%;
  top: 28%;
  animation-delay: -7s;
  opacity: 0.7;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(36px, 8vh, 64px);
  min-height: 100%;
  width: 100%;
  padding: clamp(28px, 6vw, 64px);
  text-align: center;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginRise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-logo {
  width: 36px;
  height: 36px;
  margin-bottom: 22px;
  border: 2px solid #5eead4;
  border-radius: 4px;
  transform: rotate(12deg);
  box-shadow: 10px 8px 0 rgba(45, 212, 191, 0.25);
  animation: loginLogoTilt 6s ease-in-out infinite alternate;
}

.login-title {
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: #f4fffc;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.login-access {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 22px 0 8px;
  border-top: 1px solid rgba(94, 234, 212, 0.28);
  animation: loginRise 1s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.login-field span {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: rgba(232, 242, 240, 0.55);
}

.login-field input {
  width: 100%;
  padding: 14px 0;
  border: none;
  border-bottom: 2px solid rgba(232, 242, 240, 0.22);
  border-radius: 0;
  background: transparent;
  color: #f4fffc;
  font-family: inherit;
  font-size: 1.05rem;
  outline: none;
  text-align: center;
  transition: border-color 0.25s ease;
}

.login-field input::placeholder {
  color: rgba(232, 242, 240, 0.28);
}

.login-field input:focus {
  border-bottom-color: #2dd4bf;
}

.login-submit {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 12px 22px;
  border: 1px solid rgba(45, 212, 191, 0.55);
  border-radius: 2px;
  background: #134e4a;
  color: #ecfdf5;
  font-family: "Sora", "Noto Sans SC", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.login-submit:hover {
  background: #0f766e;
  border-color: #5eead4;
  transform: translateX(4px);
}

.login-submit:active {
  transform: translateX(2px) scale(0.98);
}

.login-error {
  color: #fda4af;
  font-size: 0.875rem;
  min-height: 1.2em;
  text-align: center;
}

.login-error.hidden { display: none; }

@keyframes loginMeshDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-2%, 1.5%, 0) scale(1.04); }
}

@keyframes loginOrbFloat {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-12px, 18px, 0); }
}

@keyframes loginLogoTilt {
  from { transform: rotate(12deg); }
  to { transform: rotate(18deg); }
}

@keyframes loginRise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .login-shell {
    padding: 28px 22px 36px;
    gap: 40px;
  }

  .login-title {
    font-size: clamp(2.6rem, 16vw, 3.6rem);
  }

  .login-submit {
    width: 100%;
    justify-content: center;
  }

}

/* --- Account info (Binance-style) --- */
.account-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-subtabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.account-subtabs::-webkit-scrollbar { display: none; }

.account-subtab {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.account-subtab:hover { color: var(--text); }
.account-subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.account-order-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-order-section + .account-order-section {
  margin-top: 8px;
}

.account-order-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.account-order-section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
}

.account-order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-order-meta {
  margin-top: 10px;
  font-size: 0.75rem;
}

.account-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.account-history-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.account-history-field-grow {
  flex: 1 1 140px;
}

.account-history-select,
.account-history-input {
  min-width: 120px;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
}

.account-history-input {
  max-width: none;
  width: 100%;
}

.account-history-hint {
  font-size: 0.78rem;
  margin-left: auto;
}

.account-history-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-balance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.account-balance-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.account-balance-main-block {
  flex: 1;
  min-width: 0;
}

.account-balance-side-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: right;
  flex-shrink: 0;
}

.account-side-stat .account-stat-label {
  margin-bottom: 4px;
}

.account-side-stat .account-stat-value {
  font-size: 0.95rem;
}

.account-balance-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.account-balance-main {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.account-eye-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1rem;
  line-height: 1;
}
.account-eye-btn:hover { color: var(--text); }

.account-pnl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.account-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}

.account-stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.account-stat-value {
  font-size: 1rem;
  font-weight: 600;
}

.account-type-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface2);
  color: var(--muted);
  margin-bottom: 12px;
}

.account-positions { display: flex; flex-direction: column; gap: 12px; }

.account-position-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.account-position-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.account-position-side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.account-position-side-long {
  background: rgba(14, 203, 129, 0.2);
  color: #0ecb81;
}

.account-position-side-short {
  background: rgba(246, 70, 93, 0.2);
  color: #f6465d;
}

.account-position-title {
  font-weight: 700;
  font-size: 1rem;
}

.account-position-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--muted);
}

.account-position-pnl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.account-position-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-position-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
}

.account-position-row + .account-position-row {
  margin-top: 10px;
}

.account-position-cell-right {
  text-align: right;
}

.account-position-row .account-position-cell:nth-child(2) {
  text-align: center;
}

.account-position-row .account-position-cell:nth-child(3) {
  text-align: right;
}

.account-position-cell-value-lg {
  font-size: 1rem;
}

.account-size-unit-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: inherit;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.account-size-unit-btn:hover {
  color: var(--accent);
}

.account-size-unit-chevron {
  font-size: 0.65rem;
  opacity: 0.75;
}

.account-position-cell-label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 3px;
  line-height: 1.3;
}

.account-position-cell-value {
  font-size: 0.88rem;
  font-weight: 600;
  word-break: break-all;
  line-height: 1.35;
}

.account-assets-table {
  width: 100%;
}

.pnl-positive { color: #0ecb81; }
.pnl-negative { color: #f6465d; }

@media (max-width: 720px) {
  .account-balance-main { font-size: 1.45rem; }
  .account-balance-card { padding: 14px 16px; }
  .account-position-card { padding: 12px 14px; }
  .account-position-head { margin-bottom: 10px; }
}

@media (max-width: 480px) {
  .app { padding: 16px 10px 32px; }
  .account-page { gap: 12px; }
  .account-balance-card { padding: 12px 14px; }
  .account-balance-main { font-size: 1.35rem; }
  .account-balance-top {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
  }
  .account-balance-side-stats {
    flex-direction: row;
    gap: 12px;
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }
  .account-side-stat .account-stat-value { font-size: 0.88rem; }
  .account-pnl-row { padding: 8px 0; font-size: 0.82rem; }
  .account-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 8px;
  }
  .account-stat-label { font-size: 0.72rem; }
  .account-stat-value { font-size: 0.9rem; }
  .account-position-card { padding: 10px 12px; }
  .account-position-title { font-size: 0.92rem; }
  .account-position-cell-value-lg { font-size: 0.9rem; }
  .account-position-row { gap: 6px 4px; }
  .account-position-grid { gap: 8px; }
  .account-position-cell-label {
    font-size: 0.62rem;
    margin-bottom: 2px;
  }
  .account-position-cell-value { font-size: 0.75rem; }
  .tabs .tab { padding: 8px 10px; font-size: 0.82rem; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .account-history-toolbar { gap: 8px; }
  .account-history-hint { margin-left: 0; width: 100%; }
  .account-history-select,
  .account-history-input { max-width: none; width: 100%; }
}

/* Account compare */
.compare-summary-bar {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--card, #141820);
  border: 1px solid var(--border, #2a3140);
  border-radius: 10px;
}

.compare-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.compare-summary-item strong {
  font-size: 1.15rem;
}

.compare-section-head {
  margin-top: 4px;
}

.compare-section-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.compare-table-wrap {
  overflow-x: auto;
}

.compare-leverage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.compare-leverage-table th,
.compare-leverage-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border, #2a3140);
  white-space: nowrap;
}

.compare-leverage-table th {
  color: var(--muted, #9aa3b2);
  font-weight: 500;
  font-size: 0.8rem;
}

.compare-th-left {
  border-right: 1px solid var(--border, #2a3140);
  text-align: center !important;
  color: #e8eaed !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

.compare-th-right {
  text-align: center !important;
  color: #e8eaed !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

.compare-leverage-table td.compare-symbol,
.compare-leverage-table td.compare-lev {
  border-right: 1px solid var(--border, #2a3140);
}

.compare-symbol {
  font-weight: 600;
}

.compare-lev,
.compare-lev2 {
  font-variant-numeric: tabular-nums;
}

.compare-pos2 {
  color: var(--muted, #9aa3b2);
}

@media (max-width: 860px) {
  .compare-summary-bar {
    gap: 14px;
  }
}

/* Alert settings */
.alert-settings {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
}

.alert-settings-block {
  padding: 16px 18px;
  border: 1px solid var(--border, #2a3140);
  border-radius: 10px;
  background: var(--card, #141820);
}

.alert-settings-block h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.alert-settings-block .muted {
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.alert-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  cursor: pointer;
  user-select: none;
}

.alert-channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 4px;
  padding-left: 2px;
}

