:root {
  --bg: #080c11;
  --panel: #101720;
  --panel2: #0d141d;
  --stroke: #24303e;
  --text: #f4f7fb;
  --muted: #8ea6c7;
  --green: #16d79a;
  --red: #ff5269;
  --amber: #f8bd56;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: radial-gradient(
    circle at 50% -20%,
    #101a25 0,
    #080c11 38%,
    #070a0e 100%
  );
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
  min-height: 100vh;
}
.app-shell {
    
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 60px;
}
.titlebar {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: invert(1);
}
.brand-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-actions form {
  margin: 0;
}
.icon-btn {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  border: 1px solid var(--stroke);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.012)
  );
  color: #a9b9cf;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}
.icon-btn:hover {
  color: #fff;
  border-color: #3a4b60;
}
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(360px, 0.95fr);
  gap: 18px;
}
.dash-card {
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(18, 25, 35, 0.96),
    rgba(14, 20, 29, 0.98)
  );
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-chart {
  padding: 22px;
  min-height: 245px;
}
.dash-card-h,
.section-title {
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #91aacb;
}
.pnl-calendar-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 9px;
  margin: 20px 0 10px;
  color: #6986ad;
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}
.pnl-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 9px;
}
.cal-cell {
  min-height: 74px;
  border: 1px solid #202b38;
  border-radius: 13px;
  background: #0c131c;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cal-cell span {
  font-size: 11px;
  color: #6986ad;
}
.cal-cell strong {
  font-size: 13px;
  color: #fff;
}
.cal-cell.win strong {
  color: #67e9bb;
}
.cal-cell.loss strong {
  color: #ff8695;
}
.dash-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.mini-kpi {
  min-height: 121px;
  padding: 28px;
  border: 0;
  border-right: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
  background: transparent;
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 13px;
}
.mini-kpi:nth-child(2n) {
  border-right: 0;
}
.mini-kpi:nth-child(n + 3) {
  border-bottom: 0;
}
.mini-kpi span {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ba8d0;
}
.mini-kpi strong {
  font-size: 27px;
  letter-spacing: -0.02em;
}
.mini-kpi em {
  font-size: 10px;
  font-style: normal;
  color: #526b8b;
  margin-top: auto;
}
.mini-kpi.clickable {
  cursor: pointer;
}
.mini-kpi.clickable:hover {
  background: rgba(255, 255, 255, 0.02);
}
.pos {
  color: #28dba1 !important;
}
.neg {
  color: #ff6478 !important;
}
.flat {
  color: #eaf1ff !important;
}
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 46px 4px 12px;
}
.section-title {
  margin: 0;
}
.btn-add {
  height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(35, 209, 145, 0.3);
  background: rgba(19, 169, 113, 0.08);
  color: #59e7b3;
  font-weight: 800;
  cursor: pointer;
}
.account-card {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto 250px;
  align-items: center;
  gap: 24px;
  padding: 18px 20px;
  margin: 12px 0;
  border-radius: 22px;
  border: 1px solid var(--stroke);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.025),
    rgba(255, 255, 255, 0.01)
  );
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}
.account-card:has(.status-dot.live) {
  border-color: rgba(26, 204, 146, 0.36);
}
.account-left,
.account-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dot-stack {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #5d6c7d;
  box-shadow: 0 0 0 7px rgba(93, 108, 125, 0.12);
}
.status-dot.live {
  background: #26d8a2;
  box-shadow: 0 0 0 7px rgba(38, 216, 162, 0.11),
    0 0 22px rgba(38, 216, 162, 0.26);
}
.status-dot.idle {
  background: #8191a6;
}
.status-dot.off {
  background: #ff5269;
  box-shadow: 0 0 0 7px rgba(255, 82, 105, 0.11);
}
.status-dot.disabled {
  background: #56616f;
}
.dot-gear {
  border: 0;
  background: transparent;
  color: #b1c0d2;
  font-size: 17px;
  cursor: pointer;
  padding: 2px;
}
.account-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 900;
}
.status-badge,
.pos-badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 900;
}
.status-badge.live {
  background: rgba(24, 211, 151, 0.15);
  color: #32e5aa;
}

.status-dot.idle{
    background:#f8bd56;
    box-shadow:
        0 0 0 7px rgba(248,189,86,.12),
        0 0 18px rgba(248,189,86,.18);
}

.status-badge.idle{
    background:rgba(248,189,86,.14);
    color:#f8bd56;
}

.status-badge.offline {
  background: rgba(129, 145, 166, 0.13);
  color: #b5c3d5;
}
.account-sub {
  margin-top: 8px;
  font-size: 13px;
}
.account-right {
  justify-content: flex-end;
}
.neo-switch {
  position: relative;
  width: 68px;
  height: 36px;
  display: inline-block;
}
.neo-switch input {
  position: absolute;
  opacity: 0;
}
.neo-switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1px solid #354354;
  background: #101720;
  box-shadow: inset 0 7px 14px rgba(0, 0, 0, 0.42);
}
.neo-switch .thumb {
  position: absolute;
  width: 28px;
  height: 28px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #7b899a;
  transition: 0.2s;
}
.neo-switch input:checked ~ .track {
  border-color: rgba(20, 207, 143, 0.42);
  background: rgba(15, 118, 83, 0.16);
}
.neo-switch input:checked ~ .thumb {
  left: 36px;
  background: #23d59c;
  box-shadow: 0 0 22px rgba(35, 213, 156, 0.36);
}
.btn-close {
  height: 44px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 65, 77, 0.3);
  background: rgba(104, 17, 29, 0.22);
  color: #ff6d7f;
  cursor: pointer;
}
.position-box {
  border-left: 1px solid var(--stroke);
  padding-left: 24px;
  min-width: 0;
}
.position-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pos-badge.idle {
  background: #27313e;
  color: #aebed0;
}
.pos-badge.buy {
  background: rgba(26, 210, 152, 0.14);
  color: #36e4ab;
}
.pos-badge.sell {
  background: rgba(255, 82, 105, 0.15);
  color: #ff7f90;
}
.pos-contracts {
  font-weight: 900;
}
.position-line2 {
  margin-top: 9px;
  font-size: 13px;
  color: #a8bbd2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-card {
  width: min(430px, 100%);
  margin: 52px auto 0;
  border: 1px solid var(--stroke);
  border-radius: 24px;
  background: var(--panel);
  padding: 34px;
  text-align: center;
}
.login-logo {
  width: 58px;
  filter: invert(1);
}
.login-card h2 {
  margin: 12px 0 3px;
}
.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
}
.login-form {
  display: flex;
  gap: 10px;
}
.login-form input,
.field input,
.field select {
  width: 100%;
  height: 52px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f4f7fb;
  font-size: 15px;
}
.login-form input {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: #0d141d;
  padding: 0 15px;
}
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-load {
  height: 52px;
  border-radius: 18px;
  padding: 0 24px;
  font-weight: 900;
  cursor: pointer;
}
.btn-primary {
  border: 1px solid rgba(62, 222, 146, 0.32);
  background: linear-gradient(135deg, #2ac77f, #54d99b);
  color: #fff;
}
.btn-secondary {
  border: 1px solid var(--stroke);
  background: #131b25;
  color: #c2cedc;
}
.btn-danger {
  border: 1px solid rgba(255, 82, 105, 0.3);
  background: rgba(109, 24, 37, 0.18);
  color: #ff7c8d;
}
.btn-load {
  border: 1px solid rgba(45, 210, 147, 0.3);
  background: rgba(31, 125, 93, 0.15);
  color: #dff9ef;
}
.error-note {
  margin-top: 16px;
  color: #ff7c8d;
}
.modal-open {
  overflow: hidden;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop[hidden] {
  display: none;
}
.modal {
  width: min(850px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid #2b3847;
  border-radius: 28px;
  background: radial-gradient(
      circle at 100% 0,
      rgba(26, 213, 151, 0.08),
      transparent 33%
    ),
    #0f161e;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 30px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-title {
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.13em;
}
.modal-sub {
  margin-top: 7px;
  color: #7f91a6;
}
.modal-body {
  padding: 25px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.modal label {
  display: block;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
}
.help {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border: 1px solid #465363;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #9cabbd;
  font-size: 11px;
  margin-left: 6px;
}
.field {
  height: 55px;
  border: 1px solid #25303d;
  border-radius: 18px;
  background: #0d141d;
  padding: 0 17px;
  box-shadow: inset 0 8px 18px rgba(0, 0, 0, 0.26);
}
.field:focus-within {
  border-color: rgba(36, 215, 153, 0.36);
}
.api-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 14px;
}
.select-field select {
  appearance: auto;
}
.field-note {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: #75869a;
}
.auto-close-setting{display:flex;align-items:center;justify-content:space-between;gap:18px;border:1px solid rgba(255,183,77,.26);background:rgba(255,183,77,.06);border-radius:13px;padding:13px 14px;margin-top:2px}.auto-close-setting label{margin:0}.auto-close-setting p{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.4}

/* Account-card performance: per-account PnL, balance and a direct trade link. */
.account-card.account-card-row{grid-template-columns:minmax(150px,1fr) minmax(205px,280px) 34px 72px auto minmax(118px,auto)}
.account-card-row .account-metrics{display:flex;align-items:center;gap:10px;min-width:0;border-left:1px solid var(--stroke);padding-left:10px;justify-content:space-between;white-space:nowrap}.account-metrics>div{display:flex;flex-direction:column;gap:3px;min-width:0}.account-metrics span{font-size:10px;color:var(--muted);font-weight:800;text-transform:uppercase;letter-spacing:.05em}.account-metrics strong{font-size:14px;line-height:1.1}.account-metrics strong b{font-weight:900}.account-metrics strong i{font-style:normal;color:var(--muted);padding:0 4px}.account-metrics button{border:0;background:transparent;color:#9eb5d0;padding:4px 0;cursor:pointer;font-size:12px;font-weight:800;white-space:nowrap}.account-metrics button:hover{color:#fff;text-decoration:underline}.account-metrics button b{color:#fff;font-size:14px}
@media(max-width:700px){.account-card.account-card-row{flex-wrap:wrap!important}.account-card-row .account-metrics{order:6;flex:1 0 100%;border-left:0;border-top:1px solid var(--stroke);padding:9px 0 0;margin-top:2px;justify-content:space-between}.account-metrics>div{flex-direction:row;align-items:center;gap:7px}.account-metrics span{font-size:9px}.account-metrics button{font-size:11px}}
.advanced {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 13px;
}
.advanced summary {
  cursor: pointer;
  color: #8ba1bd;
  font-size: 12px;
  font-weight: 800;
}
.advanced .modal-grid {
  margin-top: 16px;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 30px 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.spacer {
  flex: 1;
}
.modal-x {
  border: 0;
  background: transparent;
  color: #b9c5d3;
  font-size: 30px;
  cursor: pointer;
}
.trades-modal {
  width: min(760px, 100%);
}
.trade-filters {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.trade-filters select {
  height: 42px;
  border: 1px solid var(--stroke);
  border-radius: 13px;
  background: #0c131b;
  color: #fff;
  padding: 0 12px;
}
.trades-table {
  padding: 10px 18px 20px;
}
.trade-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr;
  gap: 16px;
  align-items: center;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}
.trade-row > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.trade-row > div:last-child {
  text-align: right;
  align-items: flex-end;
}
.trade-row span {
  font-size: 12px;
  color: #8fa1b6;
}
.trade-row strong {
  font-size: 13px;
}
.empty-state,
.loading-row {
  padding: 38px;
  text-align: center;
  color: #8395aa;
}
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 16px;
  border-radius: 13px;
  background: #14202a;
  border: 1px solid #304052;
  opacity: 0;
  transform: translateY(-6px);
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.success {
  border-color: rgba(38, 216, 162, 0.4);
}
.toast.error {
  border-color: rgba(255, 82, 105, 0.4);
}
@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 680px);
  }
  .titlebar {
    height: 96px;
  }
  .brand-title {
    font-size: 24px;
  }
  .top-actions {
    gap: 7px;
  }
  .icon-btn {
    width: 48px;
    height: 48px;
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .dash-chart {
    min-height: auto;
    padding: 18px;
  }
  .pnl-calendar {
    overflow-x: auto;
    grid-template-columns: repeat(14, 78px);
    padding-bottom: 5px;
  }
  .pnl-calendar-head {
    grid-template-columns: repeat(7, 1fr);
  }
  .cal-cell {
    min-height: 84px;
  }
  .mini-kpi {
    min-height: 116px;
    padding: 22px 18px;
  }
  .mini-kpi strong {
    font-size: 23px;
  }
  .account-card {
    grid-template-columns: 1fr auto;
    padding: 17px 16px;
    gap: 14px;
  }
  .position-box {
    grid-column: 1/-1;
    border-left: 0;
    border-top: 1px solid var(--stroke);
    padding: 13px 0 0;
  }
  .account-right {
    gap: 10px;
  }
  .btn-close {
    padding: 0 14px;
  }
  .modal-grid,
  .api-row {
    grid-template-columns: 1fr;
  }
  .modal {
    border-radius: 22px;
  }
  .modal-head,
  .modal-body,
  .modal-actions {
    padding-left: 18px;
    padding-right: 18px;
  }
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary,
  .modal-actions .btn-danger {
    padding: 0 18px;
  }
  .trade-row {
    grid-template-columns: 1fr 0.8fr 0.7fr;
  }
}
@media (max-width: 520px) {
  .brand-logo {
    width: 40px;
    height: 40px;
  }
  .brand {
    gap: 12px;
  }
  .brand-title {
    font-size: 22px;
  }
  .top-actions .icon-btn:nth-child(4) {
    display: none;
  }
  .section-row {
    margin-top: 34px;
  }
  .account-name {
    font-size: 15px;
  }
  .account-card {
    grid-template-columns: 1fr;
  }
  .account-right {
    grid-row: 2;
    justify-content: flex-start;
    margin-left: 38px;
  }
  .position-box {
    grid-row: 3;
  }
  .neo-switch {
    width: 62px;
  }
  .neo-switch input:checked ~ .thumb {
    left: 30px;
  }
  .btn-close {
    height: 42px;
  }
  .dash-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .pnl-calendar-head {
    display: none;
  }
  .login-form {
    flex-direction: column;
  }
  .modal-actions {
    flex-wrap: wrap;
  }
  .modal-actions .spacer {
    display: none;
  }
  .modal-actions button {
    flex: 1;
  }
  .trade-row {
    grid-template-columns: 1fr 1fr;
  }
  .trade-row > div:nth-child(2) {
    display: none;
  }
}

/* =====================================================================
   QWAK V5.3 — MOBILE UI REWRITE
   Desktop rules above stay intact. These rules intentionally recompose
   the dashboard for phones instead of merely shrinking desktop UI.
   ===================================================================== */
@media (max-width: 700px) {
  html,
  body {
    overflow-x: hidden;
  }
  body {
    background: #070b10;
  }

  .app-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 50px 14px 38px;
  }

  /* Header */
  .titlebar {
    height: 82px;
    margin: 0 0 18px;
    padding: 0 2px;
    gap: 12px;
  }
  .brand {
    gap: 10px;
    min-width: 0;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
  }
  .brand-title {
    font-size: 21px;
    line-height: 1;
    white-space: nowrap;
  }
  .top-actions {
    gap: 7px;
    margin-left: auto;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    font-size: 18px;
  }

  /* Performance becomes a clean vertical stack */
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-card {
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  }
  .dash-chart {
    padding: 18px 14px 14px;
    min-height: 0;
    overflow: hidden;
  }
  .dash-card-h {
    font-size: 12px;
    letter-spacing: 0.15em;
    margin-bottom: 15px;
  }

  /* Real Monday→Sunday 2-row calendar, no horizontal clipping */
  .pnl-calendar-head {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    margin: 0 0 7px;
    font-size: 9px;
  }
  .pnl-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    padding: 0;
  }
  .cal-cell {
    min-width: 0;
    min-height: 66px;
    border-radius: 11px;
    padding: 7px 6px;
    overflow: hidden;
  }
  .cal-cell span {
    font-size: 9px;
    line-height: 1.1;
    white-space: nowrap;
  }
  .cal-cell strong {
    font-size: 10px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* KPIs: dense 2x2 tiles */
  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mini-kpi {
    min-height: 98px;
    padding: 18px 18px 15px;
    gap: 8px;
  }
  .mini-kpi span {
    font-size: 11px;
  }
  .mini-kpi strong {
    font-size: 23px;
    line-height: 1.05;
  }
  .mini-kpi em {
    font-size: 9px;
    margin-top: 1px;
  }

  /* Accounts heading */
  .section-row {
    margin: 34px 2px 12px;
    align-items: center;
    gap: 12px;
  }
  .section-title {
    font-size: 12px;
  }
  .btn-add {
    height: 40px;
    padding: 0 14px;
    border-radius: 13px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Account card — deliberate phone composition */
  .account-card {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "controls"
      "position";
    gap: 0;
    margin: 10px 0;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
  }
  .account-left {
    grid-area: meta;
    align-items: flex-start;
    gap: 12px;
    padding: 17px 16px 13px;
  }
  .dot-stack {
    padding-top: 4px;
  }
  .status-dot {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 0 6px rgba(93, 108, 125, 0.12);
  }
  .status-dot.live {
    box-shadow: 0 0 0 6px rgba(38, 216, 162, 0.11),
      0 0 18px rgba(38, 216, 162, 0.24);
  }
  .dot-gear {
    font-size: 16px;
  }
  .meta {
    min-width: 0;
  }
  .account-name {
    gap: 8px;
    flex-wrap: wrap;
    font-size: 17px;
    line-height: 1.1;
  }
  .status-badge,
  .pos-badge {
    padding: 4px 9px;
    font-size: 9px;
  }
  .account-sub {
    margin-top: 8px;
    font-size: 13px;
  }

  .account-right {
    grid-area: controls;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 16px 14px 50px;
  }
  .neo-switch {
    width: 62px;
    height: 34px;
    flex: 0 0 62px;
  }
  .neo-switch .thumb {
    width: 26px;
    height: 26px;
  }
  .neo-switch input:checked ~ .thumb {
    left: 31px;
  }
  .btn-close {
    height: 40px;
    padding: 0 16px;
    border-radius: 14px;
    font-size: 12px;
    white-space: nowrap;
  }

  .position-box {
    grid-area: position;
    border-left: 0;
    border-top: 1px solid var(--stroke);
    padding: 13px 16px 14px 50px;
    min-width: 0;
  }
  .position-line1 {
    gap: 7px;
  }
  .position-line2 {
    margin-top: 7px;
    font-size: 12px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  /* Modals */
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-height: 90vh;
    border-radius: 22px 22px 16px 16px;
  }
  .modal-head {
    padding: 18px 17px 15px;
  }
  .modal-body {
    padding: 17px;
    gap: 16px;
  }
  .modal-actions {
    padding: 14px 17px 17px;
  }
  .modal-grid,
  .api-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .field {
    height: 50px;
    border-radius: 15px;
  }
  .field input,
  .field select {
    height: 48px;
    font-size: 14px;
  }

  /* Trades modal becomes readable instead of a compressed desktop table */
  .trades-table {
    padding: 7px 14px 17px;
  }
  .trade-row {
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    padding: 13px 4px;
  }
  .trade-row > div:last-child {
    align-items: flex-end;
  }
}

@media (max-width: 470px) {
  .app-shell {
    padding-top: 70px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .titlebar {
    height: 76px;
  }
  .brand-title {
    font-size: 20px;
  }

  /* Keep the header breathable on narrow phones: Logs, Health, Logout. */
  .top-actions .icon-btn:nth-child(3),
  .top-actions .icon-btn:nth-child(4) {
    display: none;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 13px;
  }

  .dash-chart {
    padding-left: 10px;
    padding-right: 10px;
  }
  .pnl-calendar-head,
  .pnl-calendar {
    gap: 3px;
  }
  .cal-cell {
    min-height: 61px;
    padding: 6px 4px;
    border-radius: 9px;
  }
  .cal-cell span {
    font-size: 8px;
  }
  .cal-cell strong {
    font-size: 9px;
  }

  .mini-kpi {
    min-height: 92px;
    padding: 16px 14px 13px;
  }
  .mini-kpi strong {
    font-size: 21px;
  }

  .account-right {
    padding-left: 16px;
  }
  .position-box {
    padding-left: 16px;
  }
  .btn-close {
    flex: 1;
    max-width: 190px;
  }

  .section-row {
    margin-left: 0;
    margin-right: 0;
  }
  .btn-add {
    padding: 0 12px;
  }
}

/* =====================================================================
   V5.4 — ACCOUNT CARD / COPY ROW LAYOUT
   Desktop + mobile follow the supplied Copy references.
   ===================================================================== */
.account-card.account-card-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 34px 72px auto minmax(118px, auto);
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 12px 18px;
  border-radius: 22px;
}
.account-card-row .account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.account-card-row .account-name-text {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-card-row .account-gear {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 17px;
}
.account-card-row .account-switch {
  justify-self: center;
}
.account-card-row .account-close {
  white-space: nowrap;
}
.account-card-row .position-summary {
  min-width: 0;
  border-left: 1px solid var(--stroke);
  padding-left: 18px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 6px;
  align-items: center;
}
.account-card-row .position-summary-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 24px;
}
.account-card-row .position-pnl {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.account-card-row .pos-contracts {
  font-size: 11px;
}

@media (max-width: 700px) {
  .account-card.account-card-row {
    grid-template-columns: minmax(86px, 1fr) 28px 94px minmax(104px, 122px) minmax(
        70px,
        86px
      );
    gap: 8px;
    min-height: 88px;
    padding: 13px 14px;
    border-radius: 22px;
    overflow: visible;
  }
  .account-card-row .account-identity {
    gap: 8px;
    min-width: 0;
  }
  .account-card-row .account-identity .status-dot {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    box-shadow: 0 0 0 6px rgba(93, 108, 125, 0.11);
  }
  .account-card-row .account-name-text {
    font-size: 16px;
    min-width: 0;
  }
  .account-card-row .status-badge {
    display: none;
  }
  .account-card-row .account-gear {
    width: 26px;
    height: 26px;
    font-size: 16px;
  }
  .account-card-row .account-switch {
    width: 94px;
    height: 44px;
    flex: 0 0 94px;
  }
  .account-card-row .account-switch .thumb {
    width: 34px;
    height: 34px;
    top: 4px;
    left: 5px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 54px;
  }
  .account-card-row .account-close {
    width: 100%;
    height: 58px;
    padding: 0 10px;
    border-radius: 17px;
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
  }
  .account-card-row .position-summary {
    border-left: 0;
    padding-left: 0;
    gap: 7px;
    align-self: center;
  }
  .account-card-row .position-summary-top {
    gap: 7px;
  }
  .account-card-row .pos-badge {
    padding: 4px 9px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 13px;
    color: #c5cfdb !important;
  }
}

@media (max-width: 470px) {
  .account-card.account-card-row {
    grid-template-columns: minmax(70px, 1fr) 24px 78px 96px 66px;
    gap: 6px;
    min-height: 82px;
    padding: 11px 10px;
  }
  .account-card-row .account-identity {
    gap: 6px;
  }
  .account-card-row .account-name-text {
    font-size: 15px;
  }
  .account-card-row .account-gear {
    width: 24px;
    height: 24px;
    font-size: 15px;
  }
  .account-card-row .account-switch {
    width: 78px;
    height: 40px;
    flex-basis: 78px;
  }
  .account-card-row .account-switch .thumb {
    width: 30px;
    height: 30px;
    top: 4px;
    left: 4px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 43px;
  }
  .account-card-row .account-close {
    height: 54px;
    padding: 0 7px;
    font-size: 11px;
  }
  .account-card-row .pos-badge {
    padding: 4px 7px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 12px;
  }
}

/* =====================================================================
   V5.5 — MOBILE ACCOUNT CARD COMPACT SINGLE ROW
   Reference layout:
   dot → name → gear → switch → Close → side/status → qty → Open PnL
   Desktop remains unchanged.
   ===================================================================== */
@media (max-width: 700px) {
  .account-card.account-card-row {
    display: grid;
    grid-template-columns: minmax(72px, 1fr) 24px 74px 92px minmax(104px, auto);
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 10px 12px;
    border-radius: 22px;
  }

  .account-card-row .account-identity {
    min-width: 0;
    gap: 8px;
  }

  .account-card-row .account-identity .status-dot {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    box-shadow: 0 0 0 5px rgba(93, 108, 125, 0.1);
  }

  .account-card-row .account-name-text {
    font-size: 17px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .account-card-row .status-badge {
    display: none;
  }

  .account-card-row .account-gear {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 15px;
  }

  .account-card-row .account-switch {
    width: 74px;
    height: 38px;
    min-width: 74px;
  }
  .account-card-row .account-switch .thumb {
    width: 30px;
    height: 30px;
    top: 3px;
    left: 4px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 38px;
  }

  .account-card-row .account-close {
    width: 92px;
    height: 42px;
    padding: 0 10px;
    border-radius: 15px;
    font-size: 0;
    line-height: 1;
    white-space: nowrap;
  }

  .account-card-row .position-summary {
    min-width: 0;
    border-left: 0;
    padding-left: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    white-space: nowrap;
  }

  .account-card-row .position-summary-top {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 0;
    flex: 0 0 auto;
  }

  .account-card-row .pos-badge {
    padding: 4px 8px;
    font-size: 10px;
    line-height: 1;
  }

  .account-card-row .pos-contracts {
    font-size: 11px;
    line-height: 1;
  }

  .account-card-row .position-pnl {
    margin: 0;
    font-size: 13px;
    line-height: 1;
    color: inherit !important;
  }
}

@media (max-width: 470px) {
  .account-card.account-card-row {
    grid-template-columns: minmax(58px, 1fr) 21px 64px 76px minmax(88px, auto);
    gap: 5px;
    min-height: 66px;
    padding: 9px 9px;
    border-radius: 20px;
  }

  .account-card-row .account-identity {
    gap: 6px;
  }
  .account-card-row .account-identity .status-dot {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
    box-shadow: 0 0 0 4px rgba(93, 108, 125, 0.09);
  }
  .account-card-row .account-name-text {
    font-size: 15px;
  }
  .account-card-row .account-gear {
    width: 21px;
    height: 21px;
    font-size: 14px;
  }

  .account-card-row .account-switch {
    width: 64px;
    min-width: 64px;
    height: 36px;
  }
  .account-card-row .account-switch .thumb {
    width: 28px;
    height: 28px;
    top: 3px;
    left: 3px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 31px;
  }

  .account-card-row .account-close {
    width: 76px;
    height: 40px;
    padding: 0 6px;
    border-radius: 14px;
  }

  .account-card-row .position-summary {
    gap: 5px;
  }
  .account-card-row .position-summary-top {
    gap: 4px;
  }
  .account-card-row .pos-badge {
    padding: 4px 6px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .account-card.account-card-row {
    grid-template-columns: minmax(52px, 1fr) 20px 58px 68px minmax(80px, auto);
    gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .account-card-row .account-name-text {
    font-size: 14px;
  }
  .account-card-row .account-switch {
    width: 58px;
    min-width: 58px;
    height: 34px;
  }
  .account-card-row .account-switch .thumb {
    width: 26px;
    height: 26px;
    top: 3px;
    left: 3px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 28px;
  }
  .account-card-row .account-close {
    width: 68px;
    height: 38px;
  }

  .account-card-row .pos-badge {
    padding: 3px 5px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 10px;
  }
}

/* =====================================================================
   V5.6 — MOBILE ACCOUNT CARD PROPORTIONS
   Keep identity compact; give the switch and Close button the visual
   weight shown in the approved mobile reference.
   ===================================================================== */
@media (max-width: 700px) {
  .account-card.account-card-row {
    grid-template-columns: max-content 24px 112px 136px max-content;
    justify-content: center;
    column-gap: 10px;
    min-height: 104px;
    padding: 14px 16px;
    border-radius: 28px;
  }

  .account-card-row .account-identity {
    width: max-content;
    min-width: 0;
    gap: 9px;
  }

  .account-card-row .account-name-text {
    width: auto;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    font-size: 22px;
  }

  .account-card-row .account-gear {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .account-card-row .account-switch {
    width: 112px;
    min-width: 112px;
    height: 48px;
  }
  .account-card-row .account-switch .thumb {
    width: 38px;
    height: 38px;
    top: 4px;
    left: 5px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 68px;
  }

  .account-card-row .account-close {
    width: 136px;
    height: 62px;
    padding: 0 12px;
    border-radius: 20px;
  }

  .account-card-row .position-summary {
    width: max-content;
    min-width: max-content;
    justify-content: flex-start;
    gap: 8px;
  }
  .account-card-row .position-summary-top {
    gap: 7px;
  }
  .account-card-row .pos-badge {
    padding: 5px 9px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 15px;
    font-weight: 800;
  }
}

@media (max-width: 560px) {
  .account-card.account-card-row {
    grid-template-columns: max-content 22px 96px 118px max-content;
    column-gap: 7px;
    min-height: 92px;
    padding: 12px 12px;
    border-radius: 25px;
  }
  .account-card-row .account-identity {
    gap: 7px;
  }
  .account-card-row .account-name-text {
    font-size: 19px;
  }
  .account-card-row .account-gear {
    width: 22px;
    height: 22px;
    font-size: 15px;
  }
  .account-card-row .account-switch {
    width: 96px;
    min-width: 96px;
    height: 44px;
  }
  .account-card-row .account-switch .thumb {
    width: 34px;
    height: 34px;
    top: 4px;
    left: 5px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 56px;
  }
  .account-card-row .account-close {
    width: 118px;
    height: 56px;
    border-radius: 18px;
  }

  .account-card-row .position-summary {
    gap: 6px;
  }
  .account-card-row .position-summary-top {
    gap: 5px;
  }
  .account-card-row .pos-badge {
    padding: 4px 7px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 13px;
  }
}

@media (max-width: 470px) {
  .account-card.account-card-row {
    grid-template-columns: max-content 20px 78px 92px max-content;
    column-gap: 5px;
    min-height: 82px;
    padding: 10px 8px;
    border-radius: 23px;
  }
  .account-card-row .account-identity {
    gap: 6px;
  }
  .account-card-row .account-identity .status-dot {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
  }
  .account-card-row .account-name-text {
    font-size: 16px;
  }
  .account-card-row .account-gear {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
  .account-card-row .account-switch {
    width: 78px;
    min-width: 78px;
    height: 38px;
  }
  .account-card-row .account-switch .thumb {
    width: 30px;
    height: 30px;
    top: 3px;
    left: 4px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 43px;
  }
  .account-card-row .account-close {
    width: 92px;
    height: 48px;
    border-radius: 16px;
  }

  .account-card-row .position-summary {
    gap: 5px;
  }
  .account-card-row .position-summary-top {
    gap: 4px;
  }
  .account-card-row .pos-badge {
    padding: 4px 6px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .account-card.account-card-row {
    grid-template-columns: max-content 18px 66px 78px max-content;
    column-gap: 4px;
    padding-left: 7px;
    padding-right: 7px;
  }
  .account-card-row .account-name-text {
    font-size: 14px;
  }
  .account-card-row .account-gear {
    width: 18px;
    height: 18px;
    font-size: 13px;
  }
  .account-card-row .account-switch {
    width: 66px;
    min-width: 66px;
    height: 34px;
  }
  .account-card-row .account-switch .thumb {
    width: 26px;
    height: 26px;
    top: 3px;
    left: 3px;
  }
  .account-card-row .account-switch input:checked ~ .thumb {
    left: 36px;
  }
  .account-card-row .account-close {
    width: 78px;
    height: 42px;
  }

  .account-card-row .pos-badge {
    padding: 3px 5px;
    font-size: 10px;
  }
  .account-card-row .pos-contracts {
    font-size: 11px;
  }
  .account-card-row .position-pnl {
    font-size: 10px;
  }
}

/* =====================================================================
   V5.7 — MOBILE ACCOUNT CARD FLEX ALIGNMENT
   Use flex layout so every account-card element shares one vertical axis.
   Desktop remains unchanged.
   ===================================================================== */
@media (max-width: 700px) {
  .account-card.account-card-row {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center !important;
    justify-content: center;
    gap: 10px;
  }

  .account-card-row .account-identity,
  .account-card-row .account-gear,
  .account-card-row .account-switch,
  .account-card-row .account-close,
  .account-card-row .position-summary,
  .account-card-row .position-summary-top {
    align-self: center;
  }

  .account-card-row .account-identity {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
  }

  .account-card-row .account-gear {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .account-card-row .account-switch {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }

  .account-card-row .account-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .account-card-row .position-summary {
    display: flex;
    flex-direction: row;
    align-items: center !important;
    justify-content: flex-start;
    flex: 0 0 auto;
    margin: 0;
  }

  .account-card-row .position-summary-top {
    display: flex;
    align-items: center !important;
    justify-content: flex-start;
    margin: 0;
  }

  .account-card-row .pos-badge,
  .account-card-row .pos-contracts,
  .account-card-row .position-pnl,
  .account-card-row .account-name-text {
    line-height: 1;
  }
}

@media (max-width: 560px) {
  .account-card.account-card-row {
    gap: 7px;
  }
}

@media (max-width: 470px) {
  .account-card.account-card-row {
    gap: 5px;
  }
}

@media (max-width: 390px) {
  .account-card.account-card-row {
    gap: 4px;
  }
}

/* =====================================================================
   V5.8 — MOBILE ACCOUNT CARD: SMALLER CONTROLS
   Keep flex centering from V5.7, only reduce toggle + Close button size.
   ===================================================================== */
@media (max-width: 700px) {
  .account-card-row .account-switch {
    width: 70px !important;
    min-width: 70px !important;
    height: 34px !important;
    flex: 0 0 70px !important;
  }

  .account-card-row .account-switch .track {
    border-radius: 999px;
  }

  .account-card-row .account-switch .thumb {
    width: 26px !important;
    height: 26px !important;
    top: 3px !important;
    left: 4px !important;
  }

  .account-card-row .account-switch input:checked ~ .thumb {
    left: 39px !important;
  }

  .account-card-row .account-close {
    width: 86px !important;
    min-width: 86px !important;
    height: 38px !important;
    padding: 0 10px !important;
    border-radius: 13px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 470px) {
  .account-card-row .account-switch {
    width: 64px !important;
    min-width: 64px !important;
    height: 32px !important;
    flex-basis: 64px !important;
  }

  .account-card-row .account-switch .thumb {
    width: 24px !important;
    height: 24px !important;
    top: 3px !important;
    left: 3px !important;
  }

  .account-card-row .account-switch input:checked ~ .thumb {
    left: 35px !important;
  }

  .account-card-row .account-close {
    width: 78px !important;
    min-width: 78px !important;
    height: 36px !important;
    padding: 0 8px !important;
    border-radius: 12px !important;
  }
}

/* =====================================================================
   V5.9 — MOBILE ACCOUNT CARD: NO OVERLAP
   Fix duplicated "Close PositionsClose" and reserve a separate area
   for BUY/SELL/IDLE + quantity + Open PnL.
   ===================================================================== */
@media (max-width: 700px) {
  .account-card.account-card-row {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    padding-left: 14px;
    padding-right: 14px;
  }

  .account-card-row .account-identity {
    flex: 0 0 auto !important;
    min-width: 0;
  }

  .account-card-row .account-gear {
    flex: 0 0 22px !important;
  }

  .account-card-row .account-switch {
    flex: 0 0 70px !important;
  }

  .account-card-row .position-summary {
    flex: 1 1 auto !important;
    min-width: 92px !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }

  .account-card-row .position-summary-top {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
  }

  .account-card-row .position-pnl {
    flex: 0 0 auto !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 470px) {
  .account-card.account-card-row {
    gap: 6px !important;
    padding-left: 10px;
    padding-right: 10px;
  }

  .account-card-row .account-gear {
    flex-basis: 20px !important;
  }

  .account-card-row .account-switch {
    width: 60px !important;
    min-width: 60px !important;
    flex-basis: 60px !important;
  }

  .account-card-row .account-switch input:checked ~ .thumb {
    left: 31px !important;
  }

  .account-card-row .account-close {
    width: 120px !important;
    min-width: 120px !important;
    flex-basis: 120px !important;
    height: 34px !important;
    padding: 0 6px !important;
  }

  .account-card-row .position-summary {
    min-width: 78px !important;
    gap: 4px !important;
  }

  .account-card-row .position-summary-top {
    gap: 3px !important;
  }
}

@media (max-width: 390px) {
  .account-card.account-card-row {
    gap: 4px !important;
    padding-left: 7px;
    padding-right: 7px;
  }

  .account-card-row .account-name-text {
    font-size: 14px !important;
  }

  .account-card-row .account-switch {
    width: 54px !important;
    min-width: 54px !important;
    flex-basis: 54px !important;
  }

  .account-card-row .account-switch .thumb {
    width: 22px !important;
    height: 22px !important;
    top: 3px !important;
    left: 3px !important;
  }

  .account-card-row .account-switch input:checked ~ .thumb {
    left: 28px !important;
  }

  .account-card-row .account-close {
    width: 60px !important;
    min-width: 60px !important;
    flex-basis: 60px !important;
  }

  .account-card-row .position-summary {
    min-width: 72px !important;
  }
}

/* Keep account performance visible in the desktop row (loaded after legacy card overrides). */
@media (min-width: 701px) {
  .account-card.account-card-row {
    display:grid !important;
    grid-template-columns:minmax(150px,1fr) minmax(205px,280px) 34px 72px auto minmax(118px,auto) !important;
  }
}

@keyframes qwak-auto-close-text-pulse{0%,100%{opacity:.52;text-shadow:none}50%{opacity:1;text-shadow:0 0 8px rgba(255,125,143,.85)}}
.account-card-row .account-close.is-auto-close{animation:none;font-weight:inherit;letter-spacing:normal}
.account-card-row .account-close .auto-close-label{display:inline-block;animation:qwak-auto-close-text-pulse 1.35s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.account-card-row .account-close .auto-close-label{animation:none}}

/* Fixed outer width: 127px on desktop (including its 1px borders); 112px on mobile. */
@media(min-width:701px){.account-card-row .account-close{box-sizing:border-box!important;width:127px!important;min-width:127px!important;max-width:127px!important;flex-basis:127px!important}}
@media(max-width:700px){.account-card-row .account-close{box-sizing:border-box!important;width:112px!important;min-width:112px!important;max-width:112px!important;flex-basis:112px!important}}

/* Mobile account card: controls/status on row one; performance on row two. */
@media(max-width:700px){
  .account-card.account-card-row{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 20px 60px 112px minmax(70px,auto)!important;
    grid-template-areas:
      "identity gear toggle close position"
      "metrics metrics metrics metrics metrics"!important;
    align-items:center!important;
    gap:10px 6px!important;
    padding:14px!important;
  }
  .account-card-row .account-identity{grid-area:identity;min-width:0!important;overflow:hidden}
  .account-card-row .account-gear{grid-area:gear;justify-self:center;flex:none!important}
  .account-card-row .account-switch{grid-area:toggle;justify-self:center;flex:none!important;width:60px!important;min-width:60px!important;flex-basis:auto!important}
  .account-card-row .account-close{grid-area:close;justify-self:end;flex:none!important}
  .account-card-row .position-summary{grid-area:position;min-width:0!important;max-width:none!important;justify-content:flex-end!important;border:0!important;padding:0!important;margin:0!important}
  .account-card-row .account-metrics{grid-area:metrics;order:initial!important;flex:initial!important;width:100%;margin:0!important;padding:9px 0 0!important;justify-content:space-between!important}
}
@media(max-width:390px){.account-card.account-card-row{grid-template-columns:minmax(0,1fr) 18px 56px 112px minmax(64px,auto)!important;gap:9px 4px!important}.account-card-row .account-switch{width:56px!important;min-width:56px!important}}

@media(max-width:700px){
  .account-card-row .account-name-text{font-size:14px!important}
  .account-card-row .account-switch{transform:scale(.9);transform-origin:center}
}

