/* Crypto portfolio tracker — dark modern */
:root {
  --bg: #06070c;
  --bg-elev: #0c0f18;
  --bg-elev-2: #121624;
  --bg-hover: #171c2e;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.12);
  --text: #eef2fb;
  --muted: #8b93a8;
  --faint: #5c6478;
  --gain: #3dffb0;
  --gain-dim: rgba(61,255,176,.12);
  --loss: #ff5d73;
  --loss-dim: rgba(255,93,115,.12);
  --warn: #ffcc4d;
  --warn-dim: rgba(255,204,77,.14);
  --accent: #6ea8ff;
  --accent-2: #8b7cff;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --radius: 16px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; max-width: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  letter-spacing: .01em;
  overflow-x: hidden;
  overflow-y: auto;
}

.orb {
  position: fixed; inset: auto;
  width: 52vw; height: 52vw; max-width: 720px; max-height: 720px;
  border-radius: 50%; filter: blur(90px); opacity: .22; pointer-events: none; z-index: 0;
}
.orb-a { top: -18vw; left: -10vw; background: #1b3d88; }
.orb-b { bottom: -20vw; right: -12vw; background: #0d5a48; }

.app { position: relative; z-index: 1; max-width: 1440px; margin: 0 auto; padding: 28px 22px 80px; }

/* Header */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(145deg, #7aa7ff, #5dffc3 70%);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15), 0 10px 30px rgba(93,255,195,.18);
}
.logo svg { width: 24px; height: 24px; }
.brand h1 { margin: 0; font-size: 1.28rem; font-weight: 650; letter-spacing: .04em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-updated { color: var(--muted); font-size: .8rem; font-family: var(--mono); margin-right: 4px; }
.meta-updated strong { color: var(--text); font-weight: 500; }

button, .btn {
  font-family: var(--font); cursor: pointer; border: 1px solid var(--line-strong);
  background: var(--bg-elev-2); color: var(--text);
  border-radius: 11px; padding: 9px 14px; font-size: .88rem; font-weight: 500;
  transition: .15s ease; display: inline-flex; align-items: center; gap: 8px;
}
button.primary, label.primary, .btn.primary {
  background: linear-gradient(180deg, #7eb3ff, #4d8dff);
  border-color: transparent; color: #071018; font-weight: 600;
}
button.ghost, label.ghost, .btn.ghost { background: transparent; }
button.danger, label.danger, .btn.danger { color: var(--loss); border-color: rgba(255,93,115,.3); }
@media (hover: hover) and (pointer: fine) {
  button:hover, .btn:hover, label.btn-file:hover { background: var(--bg-hover); border-color: rgba(255,255,255,.2); }
  button.primary:hover, label.primary:hover, .btn.primary:hover { filter: brightness(1.06); }
  button.danger:hover, label.danger:hover, .btn.danger:hover { background: var(--loss-dim); }
}
button:disabled { opacity: .5; cursor: wait; }
.icon-btn { padding: 8px 10px; }

/* KPI cards */
.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 340px);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 22px;
  min-width: 0;
}
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 0; min-width: 0; }
.ready-top { padding: 16px; display: flex; flex-direction: column; min-height: 0; }
.ready-top h2 { margin: 0 0 10px; font-size: .9rem; }
.ready-top .sell-list { max-height: 220px; overflow: auto; flex: 1; }
.kpi {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; min-height: 96px;
  box-shadow: var(--shadow);
}
.kpi .lbl { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.kpi .val { margin-top: 8px; font-family: var(--mono); font-size: 1.28rem; font-weight: 600; letter-spacing: -.02em; }
.kpi .sub { margin-top: 4px; font-size: .78rem; color: var(--muted); }
.kpi.gain .val { color: var(--gain); }
.kpi.loss .val { color: var(--loss); }
.kpi.warn { border-color: rgba(255,204,77,.28); }
.kpi.warn .val { color: var(--warn); }
.kpi .val .fxpair { display: flex; flex-direction: column; gap: 2px; }
.kpi .val .fx-usd { font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.fxpair { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.15; }
td.left .fxpair { align-items: flex-start; }
.fx-gbp { font-variant-numeric: tabular-nums; }
.fx-usd { font-size: .72em; color: var(--faint); font-variant-numeric: tabular-nums; }
.fx-sep { opacity: .5; margin: 0 6px; }
#donutVal .fxpair { align-items: center; font-size: .72rem; }
#donutVal .fx-gbp { font-size: 1.05rem; }
#donutVal .fx-usd { font-size: .68rem; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.charts-row {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
  min-width: 0;
}
.charts-side { display: grid; gap: 16px; min-width: 0; }

.panel {
  background: rgba(12,15,24,.78);
  border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.panel-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px; flex-wrap: wrap;
}
.panel-hd h2 { margin: 0; font-size: .95rem; font-weight: 600; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; padding: 7px 11px; font-size: .8rem; color: var(--muted); border-radius: 8px;
}
.tabs button.active { background: var(--bg-elev-2); color: var(--text); }
.tabs .count { font-family: var(--mono); font-size: .72rem; color: var(--faint); margin-left: 4px; }

.search {
  flex: 1; min-width: 160px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 11px; padding: 9px 12px 9px 34px; font-family: var(--font); font-size: .88rem;
  outline: none;
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); opacity: .45; }

/* Table */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  border-top: 1px solid var(--line);
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  scrollbar-gutter: stable;
}
table { width: max-content; border-collapse: collapse; min-width: 1080px; table-layout: auto; }
th, td { padding: 11px 12px; text-align: right; font-size: .8rem; white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 2;
  background: #101522; color: var(--muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; font-size: .68rem;
  cursor: pointer; user-select: none; border-bottom: 1px solid var(--line);
}
th:hover { color: var(--text); }
th.sorted { color: var(--accent); }
th.left, td.left { text-align: left; }

th:first-child, td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 8px 0 14px rgba(0,0,0,.4);
}
th:first-child {
  z-index: 5;
  top: 0;
  background: #101522;
}
td:first-child { background: var(--bg-elev); }
tbody tr:hover td:first-child { background: var(--bg-hover); }
tbody tr.ready td:first-child { background: #1a1810; }

td { border-bottom: 1px solid rgba(255,255,255,.035); font-family: var(--mono); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody tr.ready {
  background: linear-gradient(90deg, rgba(255,204,77,.13), rgba(255,204,77,.03) 42%, transparent);
}
tbody tr.ready:hover { background: linear-gradient(90deg, rgba(255,204,77,.2), rgba(255,204,77,.05) 50%, rgba(255,255,255,.03)); }

.ticker {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center; font-size: .62rem; font-weight: 700;
  font-family: var(--font); letter-spacing: .02em; color: #081018;
  text-decoration: none; flex-shrink: 0;
}
a.avatar:hover { filter: brightness(1.12); outline: 1px solid rgba(255,255,255,.25); }
.t-name-row {
  display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
}
.t-name {
  font-family: var(--font); font-weight: 600; font-size: .88rem;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t-name-row .trig-badge,
.t-name-row .badge { flex-shrink: 0; }
.t-sub { font-family: var(--font); color: var(--faint); font-size: .7rem; margin-top: 1px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font); font-size: .68rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; letter-spacing: .04em;
}
.badge-open { background: rgba(110,168,255,.12); color: var(--accent); }
.badge-sold_profit { background: var(--gain-dim); color: var(--gain); }
.badge-sold_loss { background: var(--loss-dim); color: var(--loss); }
.badge-na { background: rgba(255,255,255,.06); color: var(--muted); }
.badge-junk { background: rgba(255,93,115,.12); color: var(--loss); }
.badge-dex { background: rgba(255,204,77,.12); color: var(--warn); }
.badge-dead { background: rgba(139,147,168,.14); color: var(--muted); }
.badge-ready { background: var(--warn-dim); color: var(--warn); }

.pos { color: var(--gain); }
.neg { color: var(--loss); }
.muted { color: var(--muted); }
.na { color: var(--faint); }
.bar {
  height: 5px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; min-width: 64px;
}
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #5dffc3, #6ea8ff); border-radius: inherit; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions button { padding: 5px 8px; font-size: .75rem; background: transparent; }

/* Side panels */
.side { display: flex; flex-direction: column; gap: 16px; }
.side .panel { padding: 16px; }
.side h2 { margin: 0 0 12px; font-size: .9rem; }
.chart-wrap { display: grid; place-items: center; position: relative; }
.chart-wrap canvas { width: 210px; height: 210px; }
.chart-center {
  position: absolute; text-align: center; pointer-events: none;
}
.chart-center .c-val { font-family: var(--mono); font-weight: 600; font-size: 1.05rem; }
.chart-center .c-lbl { color: var(--muted); font-size: .7rem; margin-top: 2px; }
.legend { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.swatch { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }
.legend-row .lg-name { flex: 1; color: var(--muted); }
.legend-row .lg-pct { font-family: var(--mono); font-size: .75rem; }

.sell-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }

button.sell-item,
button.sell-item-btn {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  padding: 10px 10px; border-radius: 12px;
  background: var(--warn-dim); border: 1px solid rgba(255,204,77,.18);
}
button.sell-item:hover,
button.sell-item-btn:hover { filter: brightness(1.08); }
.sell-item {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  padding: 10px 10px; border-radius: 12px; background: var(--warn-dim); border: 1px solid rgba(255,204,77,.18);
}
.sell-item .s-t { font-weight: 600; }
.sell-item .s-p { font-family: var(--mono); font-size: .75rem; color: var(--warn); }
.empty-side { color: var(--muted); font-size: .82rem; line-height: 1.45; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(3,4,8,.72); z-index: 20;
  display: block; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px;
  backdrop-filter: blur(8px);
}
.overlay.hidden { display: none; }
.modal {
  width: min(480px, 100%); background: #10141f; border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
  margin: 12px auto;
  max-height: none;
}
.modal h3 { margin: 0 0 6px; font-size: 1.1rem; }
.modal p.hint { margin: 0 0 16px; color: var(--muted); font-size: .82rem; }
.confirm-body { margin: 0 0 16px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: .78rem; color: var(--muted); }
input[type="text"], input[type="number"], select, textarea {
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: .88rem; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.help { font-size: .72rem; color: var(--faint); }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 40;
  background: #151b2c; border: 1px solid var(--line-strong); color: var(--text);
  padding: 12px 14px; border-radius: 12px; font-size: .85rem; display: none;
  box-shadow: var(--shadow); max-width: 360px;
}
.toast.show { display: block; }
.toast.err { border-color: rgba(255,93,115,.4); }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gain);
  box-shadow: 0 0 0 4px rgba(61,255,176,.12); display: inline-block;
}
.status-dot.busy { background: var(--warn); box-shadow: 0 0 0 4px rgba(255,204,77,.12); animation: pulse 1s infinite; }
.status-dot.bad { background: var(--loss); box-shadow: 0 0 0 4px rgba(255,93,115,.12); }
@keyframes pulse { 50% { opacity: .45; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .summary-row { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .ready-top .sell-list { max-height: 180px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .charts-row { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-height: min(70vh, 720px); }
}
@media (max-width: 900px) {
  .app {
    padding: 16px max(12px, env(safe-area-inset-right)) 60px max(12px, env(safe-area-inset-left));
  }
  th:first-child, td:first-child {
    position: sticky; left: 0; z-index: 3;
    background: #101522;
    box-shadow: 6px 0 10px rgba(0,0,0,.28);
    width: 84px;
    max-width: 84px;
    min-width: 84px;
    padding-left: 8px;
    padding-right: 6px;
    box-sizing: border-box;
  }
  th:first-child { z-index: 5; top: 0; }
  td:first-child { background: #0c0f18; }
  tbody tr:hover td:first-child { background: #121624; }
  tbody tr.ready td:first-child { background: #1a1810; }
  td:first-child .avatar,
  td:first-child .t-sub,
  td:first-child .badge { display: none; }
  td:first-child .ticker { gap: 0; }
  td:first-child .t-name-row { max-width: 100%; }
  td:first-child .t-name {
    font-size: .75rem;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .row-actions button { padding: 8px 10px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .val { font-size: 1.05rem; }
  .brand h1 { font-size: 1.1rem; }
  .form-row { grid-template-columns: 1fr; }
  table { min-width: 980px; }
  .overlay { padding: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal { padding: 16px 14px 18px; margin: 0 auto 24px; width: 100%; border-radius: 14px; }
  .modal-actions {
    position: sticky; bottom: 0;
    background: #10141f;
    padding: 10px 0 calc(8px + env(safe-area-inset-bottom));
    margin-top: 12px;
    flex-wrap: wrap;
  }
  .modal p.hint { display: none; }
}

.hidden { display: none !important; }

.sell-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sell-cell select {
  padding: 4px 8px; font-size: .75rem; border-radius: 8px; min-width: 72px;
  background: var(--bg-elev-2); color: var(--text);
}

.tp-input {
  width: 118px; padding: 4px 8px; font-size: .75rem; border-radius: 8px;
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--line-strong);
  font-family: var(--mono);
}
.sell-qty { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
button.tiny {
  padding: 4px 8px; font-size: .7rem; border-radius: 8px;
}
.left-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.pct-mark { color: var(--muted); font-size: .75rem; font-family: var(--mono); }

.notify-toggle { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; color: var(--text); font-size: .85rem; }
.notify-toggle input { accent-color: #5dffc3; }
.notify-topic {
  display: flex; align-items: center; gap: 8px; margin: 8px 0;
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  word-break: break-all;
}
.notify-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 8px; }
.notify-actions .btn, .notify-actions button { padding: 7px 10px; font-size: .8rem; }
code { font-family: var(--mono); font-size: .78em; }

a.badge-ready, button.badge-ready { text-decoration: none; color: var(--warn); border: 0; cursor: pointer; font: inherit; }
button.badge-ready { display: inline-flex; align-items: center; }
a.sell-item { text-decoration: none; color: inherit; }
a.sell-item:hover { filter: brightness(1.08); }
.kraken-app-link {
  display: inline-block; margin: -4px 0 10px;
  font-size: .8rem; color: var(--accent); text-decoration: none;
}
.kraken-app-link:hover { text-decoration: underline; }

.edit-nav {
  display: flex; gap: 8px; align-items: center; margin: 8px 0 12px;
}
.edit-nav select {
  flex: 1; min-width: 0;
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font-family: var(--mono); font-size: .85rem;
}
.edit-nav button { padding: 8px 12px; flex-shrink: 0; }

a.t-link { color: inherit; text-decoration: none; }
a.t-link:hover { color: var(--accent); text-decoration: underline; }

tr.synth td { background: rgba(110,168,255,.08); }
tr.synth:hover td { background: rgba(110,168,255,.14); }
.period-select {
  margin-left: 8px; padding: 2px 6px; font-size: .7rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 8px; text-transform: none; letter-spacing: 0; font-family: var(--font);
}
.kpi .lbl { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (min-width: 901px) {
  th:first-child, td:first-child { width: 118px; max-width: 118px; min-width: 118px; }
  td:first-child .t-sub, td:first-child .badge { display: none; }
  .ticker { gap: 6px; }
  .avatar { width: 22px; height: 22px; font-size: .55rem; border-radius: 7px; }
  .t-name { font-size: .8rem; max-width: 52px; }
  .t-name-row { max-width: 100%; }
}
body.book-fixed .summary-row,
body.book-sip .summary-row,
body.book-isa .summary-row {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 720px) {
  .summary-row, .kpis { max-width: 100%; }
  .kpi .val.pnl-line { flex-wrap: wrap; }
  .kpi .kpi-pct { display: inline-block; }
}

.bag-chart-panel { margin-top: 0; padding: 16px 18px 12px; min-height: 0; }
.bag-chart-hd {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.bag-chart-hd h2 { margin: 0 0 4px; font-size: .95rem; }
.bag-chart-hd .empty-side { margin: 0; }
.bag-chart-stats { display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap; }
.bag-vs-pct { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; }
.bag-vs-fig { font-family: var(--mono); font-size: .95rem; }
.bag-vs-fig .fxpair { align-items: flex-start; }
.bag-chart-stats .pos { color: var(--gain); }
.bag-chart-stats .neg { color: var(--loss); }
.bag-chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: .75rem; align-items: center; }
.bag-chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 99px; margin-right: 6px; vertical-align: middle; }
.bag-chart-legend .lg-val { background: #6ea8ff; }
.bag-chart-legend .lg-cost { background: #8b93a8; }
.bag-chart-wrap { width: 100%; height: 240px; position: relative; }
.chart-tip {
  position: absolute;
  transform: translateX(-50%);
  pointer-events: none;
  background: #151b2c;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .75rem;
  z-index: 4;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.chart-tip .tip-when { font-weight: 600; margin-bottom: 2px; }
.bag-chart-wrap canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 640px) {
  .bag-chart-wrap { height: 180px; }
  .bag-vs-pct { font-size: 1.1rem; }
}

.credit {
  margin: 18px 4px 0;
  text-align: center;
  color: var(--faint);
  font-size: .72rem;
  letter-spacing: .02em;
}

.dca-box {
  margin-top: 4px; padding: 12px; border-radius: 12px;
  border: 1px dashed var(--line-strong); background: rgba(110,168,255,.06);
}
.dca-title { font-size: .78rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }

.qty-cell .t-sub { margin-top: 2px; font-size: .72rem; }
.qty-cell .up { color: var(--gain); }
.qty-cell .down { color: var(--loss); }

.view-switch { display: flex; gap: 6px; margin-top: 8px; }
.view-switch button {
  padding: 4px 10px; font-size: .78rem; border-radius: 999px;
}
.view-switch button.active {
  background: var(--accent); color: #071018; border-color: transparent;
}
.wallets-view { margin-top: 8px; }
.wallet-hd { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.wallet-hd h2 { margin: 0 0 4px; }
.wallet-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wallet-card {
  border: 1px solid var(--line); border-radius: 14px; margin: 10px 0;
  background: var(--bg-elev); overflow: hidden;
}
.wallet-card summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between;
  gap: 12px; padding: 14px 16px; align-items: center;
}
.wallet-card summary::-webkit-details-marker { display: none; }
.wallet-card .w-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0;
}
.wallet-card .w-name { font-weight: 600; }
.wallet-card .w-value {
  font-family: var(--mono); font-weight: 600; font-size: .92rem;
  color: var(--accent); white-space: nowrap;
}
.wallet-table .w-tok-gbp {
  font-family: var(--mono); font-weight: 600; font-size: .85rem;
  color: var(--accent); white-space: nowrap;
}
.wallet-table th:nth-child(5),
.wallet-table td.w-tok-gbp { text-align: right; padding-left: 6px; padding-right: 8px; }
@media (max-width: 640px) {
  .wallet-table .w-tok-gbp { font-size: .8rem; }
  .wallet-table th, .wallet-table td { padding: 6px 8px; }
}
.wallet-card .w-meta { color: var(--muted); font-size: .8rem; font-family: var(--mono); }
.wallet-table { width: 100%; }
.wallet-table th, .wallet-table td { padding: 8px 12px; }
.wallet-card tr.neg { background: var(--loss-dim); }
.actual-input { width: 110px; }

.wallets-link {
  display: block;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: .68rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wallets-link:hover { color: #fff; }
a.wallets-link, a.share-chart-link { color: var(--accent); }
a.wallets-link:hover, a.share-chart-link:hover { color: #fff; }

.wallet-trig-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wallet-trig-link:hover { color: var(--accent); }

.wallet-col {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  max-width: 140px;
  line-height: 1.25;
}
.wallet-col-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.wallet-col-link:hover { color: #fff; }
.wallet-col-sep { color: var(--muted); font-size: .72rem; padding: 0 2px; }
.wallet-col-cell { vertical-align: middle; }
.wallet-kraken-status {
  display: inline-flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 3px;
  max-width: 100%;
  text-decoration: none;
}
.wallet-kraken-status:hover { color: inherit; text-decoration: none; }
.wallet-kraken-status .badge { pointer-events: none; }
.badge-kraken {
  background: rgba(110,168,255,.14);
  color: #6ea8ff;
}
.badge-armed {
  background: rgba(93,255,195,.18);
  color: var(--accent);
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .04em;
}
.badge-armed:hover { background: rgba(93,255,195,.28); }
.badge-arm-off {
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-weight: 500;
}
.arm-cell { vertical-align: middle; white-space: nowrap; }
.wallet-table .badge-armed { font-family: var(--font); }

@media (min-width: 901px) {
  th:first-child, td:first-child { width: 108px; max-width: 108px; min-width: 108px; }
  td:first-child .wallets-link { display: block; white-space: nowrap; }
}

.wallet-total { margin-top: 10px; }
.wallet-total .wt-main { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; }
.wallet-total .wt-qty { color: var(--accent); }
.wallet-total .wt-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; font-family: var(--mono); }

.wallet-total-banner {
  margin: 0 0 14px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg-elev);
}
.wallet-total-banner .wt-main { font-family: var(--mono); font-size: 1.45rem; font-weight: 600; }
.wallet-total-banner .wt-qty { color: var(--accent); }
.wallet-total-banner .wt-sub { color: var(--muted); font-size: .85rem; margin-top: 4px; font-family: var(--mono); }

.kpi .val.pnl-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi .kpi-pct { font-size: 1.05rem; font-weight: 600; white-space: nowrap; letter-spacing: -.02em; padding-top: 2px; }

.batch-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.batch-bar.idle button { opacity: .45; }
.batch-bar #selCount { font-size: .78rem; color: var(--muted); min-width: 6.5rem; }
.batch-bar button { padding: 6px 10px; font-size: .78rem; }
th.left input[type="checkbox"], .ticker input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: #6ea8ff; flex-shrink: 0; cursor: pointer;
}
/* Asset header: keep th as table-cell (display:flex on th breaks column alignment). */
th.left:first-child { vertical-align: middle; }
.th-asset-inner { display: inline-flex; align-items: center; gap: 8px; }
th[data-sort="wallet"],
td.wallet-col-cell {
  min-width: 4.75rem;
  width: 4.75rem;
  max-width: 5.25rem;
  box-sizing: border-box;
  vertical-align: middle;
}
td.wallet-col-cell { white-space: normal; }

.view-switch { flex-wrap: wrap; max-width: 560px; }
.overview-view { margin-top: 8px; }
.overview-hd { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: end; }
.overview-hd h2 { margin: 0 0 4px; }
.overview-period { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 8px; }
#overviewBody td.book-name { font-weight: 600; }
#overviewBody tr.total-row td { border-top: 1px solid var(--line-strong); font-weight: 650; }

/* Overview: 5 tiles — never force 4 cols on narrow (1.0.116) */
#overviewKpis {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
  max-width: 100%;
  min-width: 0;
}
@media (min-width: 901px) {
  #overviewKpis { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  #overviewKpis { grid-template-columns: repeat(5, 1fr); }
}
.overview-view .table-wrap table {
  min-width: 520px;
  width: 100%;
}

#btnHideAmounts.active {
  background: var(--warn-dim);
  border-color: rgba(255,204,77,.45);
  color: var(--warn);
}

.bank-modal { max-width: 520px; }
.bank-list { max-height: 320px; overflow: auto; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.bank-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  width: 100%; padding: 8px 10px;
}
.bank-row img { width: 28px; height: 28px; object-fit: contain; background: #fff; border-radius: 6px; }

.bank-connections { margin: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.bank-conn-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
  font-size: .9rem;
}
.settings-bank-connections { margin: 4px 0 10px 0; }


/* App login — same dark page, full-screen until a session exists */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(6, 7, 12, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-gate.hidden { display: none; }
.auth-card {
  width: min(420px, 100%);
  background: #10141f;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: .04em; }
.auth-card p.hint { margin: 0 0 4px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.auth-tabs { display: flex; gap: 8px; margin: 14px 0 16px; }
.auth-card label { margin-top: 10px; }
.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: .88rem;
  outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-error { color: var(--loss); min-height: 1.2em; font-size: .82rem; margin: 10px 0 4px; }
.auth-card button[type="submit"] { width: 100%; justify-content: center; margin-top: 6px; }
.whoami {
  display: inline-block;
  margin-left: 10px;
  color: var(--accent, #5dffc3);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0;
  vertical-align: middle;
}

.aj-hint {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: .9rem;
}
ol.howto {
  margin: 8px 0 12px;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: .85rem;
}
ol.howto li { margin: 4px 0; }

.app-version {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 40;
  opacity: 0.45;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

/* —— Triggers page (1.0.5) —— */
.triggers-view { margin-top: 8px; }
.triggers-hd { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.triggers-hd h2 { margin: 0 0 4px; }
.triggers-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.triggers-layout {
  display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 14px; margin-top: 12px;
}
@media (max-width: 820px) {
  .triggers-layout { grid-template-columns: 1fr; }
}
.panel-inset {
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev);
  padding: 12px; min-height: 280px;
}
.trig-hold-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer;
  margin-bottom: 4px;
}
.trig-hold-item:hover { background: rgba(255,255,255,.04); }
.trig-hold-item.active {
  border-color: var(--accent); background: rgba(93,255,195,.08);
}
.trig-hold-item .th-book {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-family: var(--mono);
}
.trig-hold-item .th-name { font-weight: 600; }
.trig-hold-item .th-count {
  font-family: var(--mono); font-size: .75rem; color: var(--accent);
  background: rgba(93,255,195,.12); padding: 2px 8px; border-radius: 999px;
}
.trig-editor-hd {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.trig-ticker { font-size: 1.15rem; font-weight: 650; }
.trig-kraken-hold {
  margin-top: 4px;
  font-size: .78rem;
  font-family: var(--mono);
  line-height: 1.35;
  max-width: 42rem;
}
.trig-kraken-hold.kraken-hold-ok { color: var(--gain); }
.trig-kraken-hold.kraken-hold-earn { color: var(--warn); }
.trig-kraken-hold.kraken-hold-none { color: var(--muted); }
.trig-kraken-hold.kraken-hold-unknown { color: var(--faint); }
.trig-kraken-hold .kraken-hold-warn { color: var(--warn); }
.trig-kraken-hold[role="button"] { cursor: help; }

.trig-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.trig-row {
  display: grid; grid-template-columns: 72px 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,.18);
}
.trig-row .side-above { color: var(--gain); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.trig-row .side-below { color: var(--loss); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.trig-row .trig-note { color: var(--muted); font-size: .78rem; }
.trig-row .trig-notional {
  color: var(--muted); font-size: .72rem; font-family: var(--mono);
  margin-top: 2px; line-height: 1.3; word-break: break-word;
}
.trig-add-box { margin-top: 4px; }
.trig-add-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
button.linkish, .linkish {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.trig-badge {
  display: inline-block; flex-shrink: 0; margin-left: 0; padding: 1px 6px; border-radius: 999px;
  font-size: .65rem; font-family: var(--mono); font-weight: 600;
  background: rgba(93,255,195,.14); color: var(--accent); vertical-align: middle;
  cursor: pointer; border: 1px solid rgba(93,255,195,.25);
  line-height: 1.2;
}
.trig-badge:hover { background: rgba(93,255,195,.28); }

.trig-row-quote {
  grid-template-columns: 72px 1fr auto auto auto;
}
.trig-quote-sel {
  font-size: .75rem; padding: 4px 6px; border-radius: 6px;
  background: rgba(0,0,0,.35); color: var(--text); border: 1px solid var(--line);
}
.trig-quote-badge {
  font-size: .7rem; color: var(--muted); font-family: var(--mono);
}
.trig-btc-help { margin: 0 0 8px; }
.trig-btc-live { color: var(--muted); font-family: var(--mono); font-size: .85em; }


/* —— Triggers 1.0.11: qty, totals, mark-done —— */
.trig-hd-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
/* 1.5.27.2: Chart link beside ↻ Price (display only) */
.trig-hd-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.trig-chart-ext { display: inline-flex; align-items: center; gap: 3px; text-decoration: none; }
.trig-hd-btns .trig-chart-ext { padding: 4px 8px; font-size: .7rem; border-radius: 8px; }
@media (max-width: 640px) { .trig-hd-btns { justify-content: flex-start; } }
.trig-held { color: var(--text); font-family: var(--mono); font-size: .78rem; }
.trig-ladder { font-family: var(--mono); font-size: .72rem; }
.trig-totals-wrap { margin-bottom: 10px; }
.trig-totals {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(93,255,195,.06); font-size: .82rem; line-height: 1.45;
}
.trig-totals-line { margin: 0 0 4px; }
.trig-totals-line:last-child { margin-bottom: 0; }
.trig-totals-progress {
  color: var(--muted); font-family: var(--mono); font-size: .75rem; margin: 2px 0 8px;
}
.trig-totals-progress:last-child { margin-bottom: 0; }
.trig-row-v10 {
  grid-template-columns: 64px minmax(0, 1fr) auto auto auto auto auto;
  align-items: center;
}
.trig-row-v10.trig-row-quote {
  grid-template-columns: 64px minmax(0, 1fr) auto auto auto auto auto auto;
}
.trig-row-main { min-width: 0; }
.trig-row-price { font-family: var(--mono); }
.trig-qty-edit {
  display: inline-flex; align-items: center; gap: 4px; margin: 0;
  font-size: .72rem; color: var(--muted);
}
.trig-qty-input {
  width: 72px; padding: 4px 6px; border-radius: 6px;
  background: rgba(0,0,0,.35); color: var(--text); border: 1px solid var(--line);
  font-family: var(--mono); font-size: .75rem;
}
.trig-qty-unit { font-family: var(--mono); font-size: .7rem; opacity: .85; }
.trig-done-btn { white-space: nowrap; }
.trig-done-btn.is-done { opacity: .85; }
.trig-row-done {
  opacity: .55;
}
.trig-row-done .trig-row-price,
.trig-row-done .trig-note,
.trig-row-done .trig-notional {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,.35);
}
@media (max-width: 720px) {
  .trig-row-v10, .trig-row-v10.trig-row-quote {
    grid-template-columns: 56px 1fr;
    gap: 8px;
  }
  .trig-row-v10 > .trig-qty-edit,
  .trig-row-v10 > .trig-quote-sel,
  .trig-row-v10 > .trig-quote-badge,
  .trig-row-v10 > .t-sub,
  .trig-row-v10 > .trig-done-btn,
  .trig-row-v10 > .danger {
    justify-self: start;
  }
}

.kraken-keys { padding: 10px 12px 6px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.kraken-keys-hd { font-size: 12px; opacity: 0.75; margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.kr-api-docs-wrap { margin-left: auto; }
a.cex-api-docs { opacity: 1; text-decoration: none; white-space: nowrap; }
a.cex-api-docs:hover { text-decoration: underline; }
.cex-note { font-size: 12px; opacity: 0.8; margin: 0 0 8px; max-width: 52rem; }
.kraken-keys-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kraken-keys-row .tp-input { flex: 1 1 140px; min-width: 120px; }
td.actual-cell { white-space: nowrap; }
td.actual-cell .actual-input { max-width: 7.5rem; display: inline-block; vertical-align: middle; }
td.actual-cell .tiny { margin-left: 4px; vertical-align: middle; }
td.actual-cell .kraken-split {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: normal;
  line-height: 1.2;
}


/* Multichain address panel (Wallets) */
.chain-addrs .kraken-keys-row .tp-input { flex: 1 1 160px; min-width: 120px; }
.chain-etherscan-row { margin-top: 4px; }
.chain-addrs [data-chain-status] { min-height: 1.1em; margin-top: 4px; }
.chain-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 6px 0;
}
.chain-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 220px;
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.92;
}
.chain-field.is-filled { opacity: 1; }
.chain-field-ada {
  flex: 1 1 180px;
  max-width: 280px;
}
.chain-field-ada .chain-field-lab { font-weight: 600; }
.chain-field-lab {
  letter-spacing: 0.02em;
  opacity: 0.75;
  text-transform: uppercase;
  font-size: 0.65rem;
}
.chain-field .tp-input { width: 100%; min-width: 0; box-sizing: border-box; }

.chain-field-btcxpub {
  display: flex;
  flex-direction: column;
  gap: 4px;
  grid-column: 1 / -1;
}
.chain-btcxpub-hint {
  font-size: 0.75rem;
  opacity: 0.75;
  line-height: 1.25;
}
.chain-btcxpub-script {
  max-width: 220px;
  font-size: 0.85rem;
}

.chain-more {
  margin: 4px 0 6px;
  font-size: 0.8rem;
}
.chain-more > summary {
  cursor: pointer;
  opacity: 0.8;
  user-select: none;
}
.chain-more[open] > summary { margin-bottom: 4px; }

.kraken-trading { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kraken-trading.trading-on { background: rgba(255, 93, 115, 0.08); border-radius: 8px; padding: 8px; border: 1px solid rgba(255,93,115,.35); }
.kraken-trading.trading-off { opacity: 0.9; }
.kraken-trading [data-kraken-trading-status] { flex: 1 1 100%; font-size: 12px; }
#trigKrakenTradingWrap.trig-kraken-trading { margin-top: 6px; margin-bottom: 2px; }
#trigKrakenTradingWrap.trig-kraken-trading #trigKrakenTradingNote { flex: 1 1 100%; font-size: 12px; }
.trig-arm-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; font-size: 13px; }
.trig-extra-venue-arms { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.trig-arm-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.trig-arm-wrap input[type="checkbox"] { accent-color: #ff5d73; }
.trig-pair-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted, #9aa3b5); }
.trig-pair-select { min-width: 220px; max-width: 320px; font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--inset, #12141c); color: inherit; border: 1px solid var(--border, #2a2f3d); }
.tx-view .panel-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tx-table td, .tx-table th { white-space: nowrap; }
.tx-table td.left { white-space: normal; }

.strategy-view { margin-top: 8px; }
.strategy-hd { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.strategy-hd h2 { margin: 0 0 4px; }
.strategy-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.strategy-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .strategy-grid { grid-template-columns: 1fr; }
}
.strategy-card .form-row { margin-top: 8px; }
.strat-live-gbp {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.strategy-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.strategy-apply-label { display: flex; flex-direction: column; justify-content: flex-end; }
.strategy-apply-label .invisible { visibility: hidden; height: 0; overflow: hidden; }
.strategy-cmp th, .strategy-cmp td { text-align: right; padding: 6px 8px; }
.strategy-cmp th.left, .strategy-cmp td.left { text-align: left; }
.strategy-rules { grid-column: 1 / -1; }
.strategy-rules-list { margin: 8px 0 0; padding-left: 1.2em; line-height: 1.45; font-size: 0.9rem; }
.strategy-rules-list li { margin: 2px 0; }
#strategyTradingWrap { margin-top: 0; padding-top: 0; border-top: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#strategyTradingWrap #strategyTradingNote { flex: 1 1 100%; font-size: 12px; }
#btnStratForceTrade.strat-force-btn {
  min-height: 40px;
  min-width: 7.5rem;
  padding: 8px 14px;
  font-weight: 600;
}
@media (max-width: 900px) {
  #btnStratForceTrade.strat-force-btn {
    min-height: 44px;
    flex: 1 1 auto;
  }
}
.layer-force-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.layer-force-layer-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-width: 5.5rem;
}
.layer-force-layer-label select {
  min-height: 40px;
  min-width: 5rem;
}
#btnLayerForceSell.strat-force-btn,
#btnLayerForceReload.strat-force-btn {
  min-height: 40px;
  min-width: 7.5rem;
  padding: 8px 14px;
  font-weight: 600;
}
@media (max-width: 900px) {
  #btnLayerForceSell.strat-force-btn,
  #btnLayerForceReload.strat-force-btn {
    min-height: 44px;
    flex: 1 1 auto;
  }
}
.strategy-alloc-box { margin-top: 12px; }
#stratPosHint { font-weight: 600; }

.strategy-webhook { grid-column: 1 / -1; }
.strategy-webhook textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
  min-height: 2.6em;
  background: var(--inset, #12141c);
  color: inherit;
  border: 1px solid var(--border, #2a2f3d);
  border-radius: 8px;
  padding: 6px 8px;
}
.strategy-webhook input[type="text"] {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.strategy-sig td, .strategy-sig th { font-size: 12px; }
.strategy-sig td.left { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* Strategy multi-pot (v1.0.52+) */
.strategy-avail-bar { margin-top: 10px; }
.strategy-avail-metrics {
  display: flex; flex-wrap: wrap; gap: 14px 22px;
  margin-top: 6px; font-size: 0.92rem;
}
.strategy-avail-metrics strong { font-variant-numeric: tabular-nums; }
.strategy-pot-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 12px 0 4px;
}
.strategy-pot-tabs .pot-tab {
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--muted);
}
.strategy-pot-tabs .pot-tab.active {
  background: var(--accent);
  color: #0a0c12;
  border-color: transparent;
  font-weight: 600;
}

/* v1.0.104 — pot vs start (fair − reset target); v1.0.106 overall in stack totals */
.strat-vs-start {
  margin: 8px 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.35;
}
.strat-vs-start.pos { color: var(--gain); }
.strat-vs-start.neg { color: var(--loss); }
.strat-vs-start.flat { color: var(--muted); font-weight: 600; }
.strategy-stack-total.strategy-overall-vs {
  min-width: 220px;
  flex: 1 1 240px;
}
.strategy-stack-total.strategy-overall-vs .strat-vs-start {
  margin: 0;
  font-size: 1.12rem;
  display: block;
}
.strategy-overall-vs-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
}
#btnStratRestartAllVsStart {
  min-height: 2.5rem; min-width: 9.5rem;
  padding: 0.45rem 0.75rem; font-size: 0.95rem;
  touch-action: manipulation; white-space: nowrap;
}

/* Strategy TV chart links (v1.0.53) */
.strategy-pot-hd {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px;
  justify-content: space-between;
}
.strategy-tv-link {
  display: inline-block;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--accent, #7aa2ff);
}
.strategy-tv-link:hover { opacity: 0.9; }
.strategy-pot-tabs .strategy-tv-link-tab {
  align-self: center;
  margin-left: 4px;
  padding: 4px 2px;
}


/* === 1.0.56 UI friendliness === */
body.ui-simple .adv-only { display: none !important; }
.mode-toggle-wrap { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.mode-toggle-wrap .mode-label { font-size: .72rem; color: var(--muted); margin-right: 4px; }
.mode-btn {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: .78rem; cursor: pointer;
  min-height: 36px;
}
.mode-btn.active { background: var(--bg-elev-2); color: var(--text); border-color: var(--accent, #5dffc3); }
.shares-book-switch { display: inline-flex; gap: 4px; margin-top: 8px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.shares-book-switch.hidden { display: none !important; }
.shares-book-switch button {
  border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  padding: 8px 14px; min-height: 36px; cursor: pointer; font-weight: 600;
}
.shares-book-switch button.active { background: var(--bg-elev-2); color: var(--text); }
.status-control { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.status-control select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; min-height: 36px;
}
.status-control.hidden { display: none !important; }
.settings-view .settings-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); padding: 12px 0 20px; }
.settings-card { padding: 14px; }
.settings-card .panel { box-shadow: none; border: 0; padding: 0; background: transparent; }
.settings-card #notifyPanel { margin: 0; }
.danger-card input { width: 100%; margin: 8px 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.warn-note { color: #ffb454 !important; }
.book-empty {
  padding: 28px 18px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 14px; margin: 12px 0;
}
.book-empty .tap-target { margin-top: 12px; }
.tap-target {
  position: relative; z-index: 2; pointer-events: auto !important;
  min-height: 44px; min-width: 44px; opacity: 1 !important;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: rgba(110, 168, 255, 0.28);
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
}
label.btn-file {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 14px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  background: rgba(255,255,255,.04);
  margin: 0;
}
label.btn-file.primary {
  border-color: transparent;
}
button.tap-target:active,
.btn.tap-target:active,
label.btn-file:active,
a.tap-target:active {
  transform: scale(0.98);
  filter: brightness(1.12);
  border-color: rgba(110, 168, 255, .55);
  background: var(--bg-hover);
}
a.koinly-ref.tap-target { text-decoration: none; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
@media (max-width: 720px) {
  .top-actions { position: relative; z-index: 6; }
  .top-actions .ghost,
  .top-actions .primary,
  .top-actions a.koinly-ref,
  .top-actions label.btn-file {
    min-height: 44px;
    padding: 10px 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--line-strong);
  }
  .top-actions .primary {
    background: linear-gradient(180deg, #7eb3ff, #4d8dff);
    border-color: transparent;
  }
}
.onboard-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(3,4,8,.72);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.onboard-overlay.hidden { display: none !important; }
.onboard-card {
  width: min(420px, 100%); background: var(--bg-elev, #12151f); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.onboard-actions { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.onboard-skip { width: 100%; margin-top: 4px; }
.overview-view tr[data-book] { cursor: pointer; }
.overview-view tr[data-book]:hover td { background: rgba(93,255,195,.06); }
body.book-banks #donutPanel.empty-donut,
body.book-banks #donutPanel.hidden-empty { display: none !important; }
/* 1.0.95: Cash/Fixed — no Junk/DEX/Dead/Hist/Open batch bar */
body.book-banks #batchBar,
body.book-fixed #batchBar { display: none !important; }
.batch-bar button[data-batch].hidden { display: none !important; }
.batch-bar button[data-batch]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#btnImportKoinly, #btnAdd, #koinlyReferralTop { position: relative; z-index: 3; }
@media (max-width: 720px) {
  .view-switch button { min-height: 40px; padding: 8px 10px; }
}


/* === 1.0.57 Strategy stack snapshot === */
.strategy-stack-wrap {
  margin-top: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.strategy-stack {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.strategy-stack th, .strategy-stack td {
  padding: 5px 8px;
  white-space: nowrap;
}
.strategy-stack th.left, .strategy-stack td.left { white-space: normal; }
.strategy-stack td.stack-status { color: var(--muted); font-size: 0.82rem; }
.strategy-stack-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line, #2a2f3d);
}
.strategy-stack-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}
.strategy-stack-total .stack-total-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.strategy-stack-total strong {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}
@media (max-width: 640px) {
  .strategy-stack { font-size: 0.8rem; }
  .strategy-stack th, .strategy-stack td { padding: 4px 6px; }
}

/* === 1.0.59 Strategy stack refresh affordance === */
.strategy-stack-hd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.strategy-stack-hd #btnStratRefreshStack {
  flex: 0 0 auto;
}
.strategy-stack-total strong .stack-partial,
.strategy-stack-total strong {
  font-variant-numeric: tabular-nums;
}


/* === 1.0.60 password settings === */
#settingsPassword label,
#settingsUserPasswords label {
  display: block;
  margin-top: 10px;
  font-size: .84rem;
  color: var(--muted);
}
#settingsPassword input,
#settingsUserPasswords input,
#settingsUserPasswords select {
  display: block;
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}
#settingsPassword .primary,
#settingsUserPasswords .primary,
#settingsUserPasswords .ghost {
  margin-top: 12px;
}
.settings-pw-block { margin-top: 4px; }
.admin-once-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(93,255,195,.28);
  background: rgba(93,255,195,.06);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-once-box.hidden { display: none; }
.admin-once-box code,
.admin-reset-url {
  font-family: ui-monospace, monospace;
  font-size: .82rem;
  word-break: break-all;
  flex: 1 1 160px;
}
#authResetCard.hidden { display: none; }


/* === 1.0.61 csv mapper === */
/* === 1.0.62 settings API links (per-login) === */
.csv-mapper-modal { max-width: 640px; }
.csv-mapper-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 12px;
}
.csv-mapper-grid .req { color: var(--warn); }
.csv-mapper-profile { margin-bottom: 10px; }
.csv-preview-hd { margin: 8px 0 6px; font-size: .9rem; font-weight: 600; }
.csv-preview-wrap { max-height: 180px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; }
.csv-preview-table { width: 100%; font-size: .78rem; }
.csv-preview-table th, .csv-preview-table td {
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line);
  font-family: var(--mono); white-space: nowrap;
}
.toast-action {
  margin-left: 10px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: transparent;
  color: var(--accent); font: inherit; font-size: .8rem; cursor: pointer;
}
@media (max-width: 600px) {
  .csv-mapper-grid { grid-template-columns: 1fr; }
}
body.ui-simple #btnMapCsv { /* quiet but visible next to Import */ }

/* === 1.0.63 ntfy app link === */
.notify-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* === 1.0.64 third-party links === */
.settings-api-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.settings-api-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 0; border-top: 1px solid var(--line);
}
.settings-api-row:first-of-type { border-top: none; padding-top: 0; }
.settings-api-name { font-size: .9rem; font-weight: 600; }
.settings-api-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* === 1.0.65/1.0.66 howto overlays === */
.howto-modal { max-width: 720px; }
.howto-modal .howto-body { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.howto-modal .howto-body p { margin: 0 0 10px; }
.howto-modal .howto-body ol.howto { margin: 8px 0 12px; }
.howto-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.howto-btn { font-size: .78rem; }
.settings-card-hd, .strategy-card-hd {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}
.settings-card-hd .dca-title, .strategy-card-hd .dca-title { margin: 0; }
.help-howto-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.help-howto-list li { margin: 0; }


/* === 1.0.66 hide amounts (class toggle; detailed masking still via masked()) === */
body.hide-amounts #btnHideAmounts.active { border-color: var(--accent, #5dffc3); }

.howto-modal .howto-h { font-size: .92rem; margin: 12px 0 6px; color: var(--text, #eef2fb); }
.howto-pine-wrap { margin: 10px 0 14px; border: 1px solid var(--border, #2a3142); border-radius: 10px; overflow: hidden; background: #0a0c12; }
.howto-pine-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border, #2a3142); background: #12141c; }
.howto-pine-label { font-size: .82rem; color: var(--muted, #9aa3b5); }
.howto-pine { margin: 0; padding: 10px 12px; max-height: 280px; overflow: auto; font-size: .78rem; line-height: 1.35; }
.howto-pine code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #d7deee; white-space: pre; }


/* === 1.0.83 mobile burger nav === */
.brand-text { min-width: 0; flex: 1; }
.brand-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.nav-burger { display: none; flex-shrink: 0; gap: 8px; }
.nav-burger-icon { flex-shrink: 0; }
.nav-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 45;
  background: rgba(3, 4, 8, .55);
  -webkit-tap-highlight-color: transparent;
}
.main-nav-panel { /* desktop: inline under title */ }

@media (max-width: 720px) {
  .nav-burger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    min-width: 52px;
    padding: 12px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--line-strong);
    box-shadow: 0 1px 0 rgba(255,255,255,.06) inset;
  }
  .nav-burger .nav-burger-icon { width: 26px; height: 26px; }
  body.nav-open .nav-burger {
    border-color: rgba(110, 168, 255, .55);
    background: var(--bg-hover);
  }
  .main-nav-panel {
    display: none;
    position: fixed;
    top: 0;
    /* 1.4.87: right:0 alone is off-screen when Android useWideViewPort expands
       the layout viewport (Strategy stack / Shares tables). JS sets left+width
       from visualViewport; these are fallbacks before the first layout pass. */
    right: 0;
    left: auto;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100%;
    z-index: 50;
    padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-elev);
    border-left: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    box-sizing: border-box;
  }
  body.nav-open .main-nav-panel { display: flex; }
  body.nav-open .nav-backdrop { display: block; }
  .main-nav-panel .view-switch {
    flex-direction: column;
    flex-wrap: nowrap;
    max-width: none;
    margin-top: 0;
    gap: 6px;
  }
  .main-nav-panel .view-switch button {
    width: 100%;
    justify-content: flex-start;
    border-radius: 11px;
    min-height: 44px;
    padding: 10px 14px;
  }
  .main-nav-panel .shares-book-switch {
    width: 100%;
    margin-top: 0;
    justify-content: stretch;
  }
  .main-nav-panel .shares-book-switch button {
    flex: 1;
    min-height: 44px;
  }
  .main-nav-panel .mode-toggle-wrap {
    margin-top: 0;
    width: 100%;
  }
  .main-nav-panel .mode-btn { min-height: 44px; flex: 1; justify-content: center; }
}

/* === 1.0.84/1.0.85 mobile toolbar Actions + Shares SIP|ISA host === */
/* Desktop: Actions button hidden; panel uses display:contents so children
   sit in .top-actions exactly as before (full toolbar unchanged).
   Mobile: JS portals #toolbarActionsPanel (+ backdrop) to document.body on
   open so position:fixed is viewport-anchored. */
.toolbar-actions-btn { display: none; flex-shrink: 0; gap: 8px; }
/* Phone file pickers only open if the tap hits the input.
   Cover the button; do not use display:none or a 1px clip on the active overlay. */
label.btn-file { position: relative; }
label.btn-file > .file-proxy {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  z-index: 2;
  font-size: 16px;
  cursor: pointer;
  /* Must override .file-proxy clip/1px — otherwise Android taps miss the input. */
  clip: auto;
  overflow: visible;
  clip-path: none;
  -webkit-clip-path: none;
  pointer-events: auto;
}
label.btn-file > .file-proxy.is-off { display: none !important; pointer-events: none !important; }
/* Off-label fallback only (do not use inside label.btn-file — clip kills hit-testing). */
.file-proxy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}
.toolbar-actions-icon { flex-shrink: 0; }
.toolbar-actions-panel { display: contents; }
.toolbar-actions-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 45;
  background: rgba(3, 4, 8, .55);
  -webkit-tap-highlight-color: transparent;
}
/* Mobile host for SIP|ISA — empty on desktop; JS moves #sharesBookSwitch in */
.shares-book-switch-host { display: none; }
.shares-book-switch-host.hidden { display: none !important; }

@media (max-width: 720px) {
  .toolbar-actions-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--line-strong);
  }
  body.toolbar-actions-open .toolbar-actions-btn {
    border-color: rgba(110, 168, 255, .55);
    background: var(--bg-hover);
  }
  /* Mobile: only Show/Hide £ + Refresh stay in the strip; rest in bottom sheet.
     Panel may be a direct child of body (ported) — selectors stay class-based. */
  .toolbar-actions-panel {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    max-height: min(78vh, 640px);
    padding: 14px 16px max(20px, env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-elev);
    border-top: 1px solid var(--line-strong);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  body.toolbar-actions-open .toolbar-actions-panel { display: flex; }
  body.toolbar-actions-open .toolbar-actions-backdrop { display: block; }
  .toolbar-actions-panel > .ghost,
  .toolbar-actions-panel > .primary,
  .toolbar-actions-panel > a.koinly-ref,
  .toolbar-actions-panel > label.btn-file {
    width: 100%;
    justify-content: flex-start;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    box-sizing: border-box;
  }
  .toolbar-actions-panel > .primary {
    background: linear-gradient(180deg, #7eb3ff, #4d8dff);
    border-color: transparent;
  }

  /* SIP|ISA on Shares page chrome (not buried in Menu drawer) */
  .shares-book-switch-host:not(.hidden) {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }
  .shares-book-switch-host .shares-book-switch {
    margin-top: 0;
    width: auto;
  }
  .shares-book-switch-host .shares-book-switch button {
    min-height: 44px;
    padding: 10px 14px;
  }
}


/* === 1.0.94 Cash slim: Account | Balance | Overdraft === */
body.book-banks #bookTableWrap table {
  min-width: 520px;
  width: 100%;
}
body.book-banks th:first-child,
body.book-banks td:first-child {
  width: auto;
  min-width: 220px;
  max-width: none;
}
body.book-banks td:first-child .t-sub,
body.book-banks td:first-child .badge { display: initial; }

/* === 1.0.115 Property (Fixed) slim: Asset | Qty | Paid | Value | P&L === */
body.book-fixed #bookTableWrap table {
  min-width: 520px;
  width: 100%;
}
body.book-fixed th:first-child,
body.book-fixed td:first-child {
  width: auto;
  min-width: 140px;
  max-width: none;
}
/* allow asset name to show fully on Fixed */
body.book-fixed td:first-child .t-sub,
body.book-fixed td:first-child .badge { display: initial; }
body.book-fixed td:first-child .t-name { max-width: none; overflow: visible; white-space: normal; }
body.book-banks .cash-account {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
body.book-banks tr.cash-row { cursor: pointer; }
body.book-banks tr.cash-row:hover td { background: rgba(93, 255, 195, 0.06); }
body.book-banks .cash-balance,
body.book-banks .cash-overdraft {
  font-family: var(--mono);
  white-space: nowrap;
}
body.book-banks .cash-bal-src { font-size: 0.68rem; opacity: 0.7; }
.bank-tx-modal {
  width: min(90vw, 1400px);
  max-width: min(90vw, 1400px);
}
@media (max-width: 640px) {
  .bank-tx-modal {
    width: min(96vw, 1400px);
    max-width: min(96vw, 1400px);
  }
}
.bank-tx-wrap { max-height: min(70vh, 640px); overflow: auto; margin: 12px 0; }
.bank-tx-table { min-width: 0; width: 100%; }

/* === 1.0.95 Cash nicknames === */
body.book-banks .cash-account-labels {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
body.book-banks .cash-nickname {
  width: 100%;
  max-width: 320px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line, #2a3142);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
}
body.book-banks .cash-nickname:focus {
  border-color: var(--accent, #5dffc3);
  background: rgba(93, 255, 195, 0.06);
}
body.book-banks .cash-nickname::placeholder {
  color: var(--muted, #8b93a8);
  font-weight: 500;
  opacity: 0.85;
}
body.book-banks .cash-api-name {
  font-size: 0.68rem;
  opacity: 0.7;
}
body.book-banks .cash-tx-link,
body.book-banks .cash-account-name {
  all: unset;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent, #5dffc3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
body.book-banks .cash-tx-link:hover,
body.book-banks .cash-account-name:hover {
  color: #9bffdb;
}


/* 1.1.0 — multi pension / ISA book chips (wrap; no page sideways scroll) */
.share-book-chips {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: 1 1 100%;
  margin: 4px 0 2px;
  box-sizing: border-box;
}
.share-book-chips.hidden { display: none !important; }
.share-book-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
}
.share-book-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  max-width: 100%;
  box-sizing: border-box;
}
.share-book-chip.active {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--accent, #5dffc3);
}
.share-book-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.share-book-chip-badge {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(93, 255, 195, 0.15);
  color: var(--accent, #5dffc3);
  flex-shrink: 0;
}
.share-book-chip-badge-model {
  background: rgba(120, 170, 255, 0.18);
  color: #9ec1ff;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-book-chip-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}
.share-book-chip-menu:hover { background: var(--bg-elev-2); color: var(--text); }
.share-book-chip-add {
  border-style: dashed;
  font-weight: 600;
  color: var(--muted);
}
.share-book-menu-pop {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev, var(--bg));
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.share-book-menu-pop button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
}
.share-book-menu-pop button:hover { background: var(--bg-elev-2); }
.share-book-menu-pop button.danger { color: #ff7b7b; }
@media (max-width: 900px) {
  .share-book-chip-name { max-width: 110px; }
  /* keep chips inside viewport — never force body horizontal scroll */
  .share-book-chips, .share-book-chips-row { overflow-x: hidden; }
}

/* Settings · auto exchange API panels (from Koinly wallet labels) */
.settings-cex-panels { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.settings-cex-panels .settings-cex-panel {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  padding: 10px 12px;
}
.settings-cex-head { margin-top: 6px; }


/* 1.1.26 — Cash In-from account filter */
/* 1.1.27 — compact summary + dropdown / bottom-sheet (UI chrome only) */
.cash-income-bar {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(93, 255, 195, 0.06);
  border: 1px solid rgba(93, 255, 195, 0.14);
  position: relative;
}
.cash-income-bar.hidden { display: none !important; }
.cash-in-from-compact { position: relative; }
.cash-in-from-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 4px 2px;
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
}
.cash-in-from-summary:hover { background: rgba(255,255,255,.04); }
.cash-in-from-lbl {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.cash-in-from-summary-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent, #5dffc3);
}
.cash-in-from-caret {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.cash-in-from-panel {
  display: none;
  margin-top: 8px;
  padding: 10px 12px 12px;
  border-radius: 10px;
  background: var(--bg-elev, #0c0f18);
  border: 1px solid var(--line-strong, rgba(255,255,255,.12));
  box-shadow: var(--shadow);
  z-index: 30;
}
.cash-in-from-compact.open .cash-in-from-panel,
.cash-in-from-panel:not([hidden]) { display: block; }
.cash-in-from-panel[hidden] { display: none !important; }
.cash-in-from-panel-hd {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 8px;
}
.cash-in-from-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84rem;
}
.cash-in-from-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  padding: 6px 4px;
  min-height: 40px;
  border-radius: 8px;
}
.cash-in-from-opt:hover { background: rgba(255,255,255,.04); }
.cash-in-from-opt.on { color: var(--accent, #5dffc3); font-weight: 600; }
.cash-in-from-opt input { accent-color: var(--accent, #5dffc3); width: 18px; height: 18px; flex-shrink: 0; }
.cash-in-from-hint {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.cash-in-from-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(3, 4, 8, .55);
  -webkit-tap-highlight-color: transparent;
}
body.cash-in-from-open .cash-in-from-backdrop { display: block; }
body:not(.book-banks) .cash-income-bar { display: none !important; }

/* Desktop: popover under the summary */
@media (min-width: 721px) {
  .cash-in-from-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin-top: 0;
  }
  .cash-in-from-backdrop { display: none !important; }
  .cash-in-from-opts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  .cash-in-from-opt {
    display: inline-flex;
    min-height: 0;
    padding: 4px 0;
  }
}

/* Mobile: bottom sheet for the checkbox list */
@media (max-width: 720px) {
  .cash-in-from-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    margin: 0;
    z-index: 50;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  }
}

/* 1.1.27 — Cash bank table: finger swipe pans horizontally without focusing nickname */
body.book-banks #bookTableWrap {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: contain;
}
body.book-banks #bookTableWrap table {
  touch-action: pan-x pan-y;
}
body.book-banks #bookTableWrap td.cash-account-cell,
body.book-banks #bookTableWrap .cash-account,
body.book-banks #bookTableWrap .cash-account-labels,
body.book-banks #bookTableWrap .cash-nickname {
  touch-action: pan-x pan-y;
}
/* Sticky first col ate most of the swipe surface on phones — unstick on narrow Cash */
@media (max-width: 720px) {
  body.book-banks #bookTableWrap th:first-child,
  body.book-banks #bookTableWrap td:first-child {
    position: static;
    left: auto;
    box-shadow: none;
    z-index: auto;
  }
}


/* Layer scale-out (owner) */
.layer-scale-view { margin-top: 8px; }
.layer-chart-wrap { width: 100%; height: 200px; position: relative; margin-top: 8px; }
.layer-chart-wrap canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 720px) {
  .layer-chart-wrap { height: 160px; }
}

.layer-asset-tabs { margin-top: 4px; }
.layer-asset-actions { grid-column: 1 / -1; margin: 4px 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.layer-howto-list { margin: 8px 0 0; padding-left: 1.25rem; line-height: 1.45; font-size: 13px; color: var(--muted, #9aa4b2); }
.layer-howto-list li { margin-bottom: 6px; }
.layer-howto-list code { font-size: 12px; }
#layerPlanTable input.layer-pct-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 4px 6px;
}
#layerPlanTable select.layer-hit-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 4px 6px;
  font-size: 12px;
  min-width: 7.5rem;
}
#layerPlanTable tr.layer-hit td { background: rgba(46, 125, 50, 0.18); }
#layerPlanTable tr.layer-reload-row td { background: rgba(0, 188, 212, 0.12); }
#layerPlanTable tr.layer-off td { opacity: 0.55; }
#layerPlanTable td.layer-on-cell { text-align: center; width: 2.5rem; }
#layerPlanTable label.layer-on-label { display: inline-flex; align-items: center; justify-content: center; margin: 0; cursor: pointer; }
#layerPlanTable input.layer-on-cb { width: 1rem; height: 1rem; accent-color: #6ea8ff; cursor: pointer; }
#layerArmWrap.trading-on { border-color: rgba(46, 125, 50, 0.5); }

/* Trading 212 Layer sell / trade key slot on Settings */
.settings-t212-trade-slot {
  margin: 0 0 8px;
  padding: 10px 12px;
}
.settings-t212-trade-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 720px) {
  .settings-t212-trade-fields { grid-template-columns: 1fr; }
}

.layer-manual-px-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 8px 0 4px;
  align-items: flex-end;
}
.layer-manual-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 9.5rem;
}
.layer-manual-hdr {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #e8ecf4);
}
.layer-manual-fields {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.layer-manual-px-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  color: var(--muted, #9aa4b2);
  flex: 0 0 auto;
}
.layer-manual-px-row input.layer-manual-px-input,
.layer-manual-px-row input.layer-manual-mult-input {
  width: 5.2rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 4px 6px;
  font-size: 12px;
}


/* Strategy · add Kraken crypto / Trading 212 stock pots */
.strategy-t212-bar,
.strategy-add-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-inset, rgba(127,127,127,.08));
}
.strategy-t212-bar .help,
.strategy-add-bar .help {
  flex: 1 1 100%;
  margin: 0;
}
#stratKrakenBar { margin-bottom: 6px; }


/* 1.2.0 Passkeys / fingerprint login */
.auth-passkey { margin-top: 12px; }
.auth-passkey.pk-first { margin: 14px 0 2px; }
.auth-passkey-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 14px;
  font-size: .95rem;
  min-height: 46px;
}
.auth-passkey-icon { flex: 0 0 auto; }
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .78rem;
  margin: 10px 0;
}
.auth-or::before, .auth-or::after {
  content: "";
  flex: 1 1 auto;
  border-top: 1px solid var(--line-strong);
}
.auth-passkey.pk-first .auth-or-top { display: none; }
.auth-passkey:not(.pk-first) .auth-or-bottom { display: none; }
.passkey-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.passkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}
.passkey-main { min-width: 0; }
.passkey-label { font-weight: 600; }
.passkey-here {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: .72rem;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.passkey-meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.passkey-offer-modal { max-width: 420px; }


/* AJ Bell cash ledger disclosure (1.3.9) — compact, no other layout changes */
.cash-inout {
  margin: 0 0 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12,15,24,.55);
  min-width: 0;
}
.cash-inout > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.cash-inout > summary::-webkit-details-marker { display: none; }
.cash-inout > summary::after {
  content: " ▾";
  color: var(--muted);
  font-weight: 500;
}
.cash-inout[open] > summary::after { content: " ▴"; }
.cash-inout-kpis {
  padding: 0 12px 12px;
  margin: 0;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.cash-inout-kpis .kpi {
  min-height: 0;
  padding: 12px 12px 10px;
}
.cash-inout-kpis .kpi .val { font-size: 1.05rem; margin-top: 6px; }
@media (max-width: 560px) {
  .cash-inout-kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* 1.3.16 Move to Kraken (inside At sell target panel) */
.move-kraken-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.move-kraken-hd { margin: 0 0 8px; font-size: .82rem; font-weight: 650; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.move-kraken-list { max-height: 160px; }
.move-kraken-list .sell-item .s-t { font-size: .84rem; }
.move-kraken-list .t-sub { font-size: .72rem; }
.move-kraken-block.is-empty .move-kraken-list { display: none; }
.move-kraken-block.is-empty .move-kraken-hd { margin-bottom: 4px; }

#layerPlanTable td.layer-lab-cell {
  min-width: 6.5rem;
  white-space: nowrap;
}
#layerPlanTable .layer-reload-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  white-space: nowrap;
  color: #0a3a40;
  background: rgba(0, 188, 212, 0.35);
}
.layer-cash-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin: 8px 0 4px;
}
.layer-cash-edit-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-width: 7rem;
}
.layer-cash-edit-label input {
  min-height: 36px;
  width: 8rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 4px 8px;
}
#layerReloadMeta { min-height: 1.1em; margin: 4px 0 0; }

/* MSTR mNAV panel (1.3.18) */
.mstr-mnav-panel {
  margin: 8px 0 12px;
  padding: 0 4px;
  border: 1px solid var(--line, rgba(255,255,255,0.1));
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
}
.mstr-mnav-panel > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mstr-mnav-panel > summary::-webkit-details-marker { display: none; }
.mstr-mnav-sum-val {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #6ea8ff);
  font-size: 1.05rem;
}
.mstr-mnav-body { padding: 0 12px 12px; }
.mstr-mnav-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 8px; }
.mstr-mnav-big {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.mstr-mnav-meta, .mstr-mnav-prices { font-size: 0.82rem; color: var(--muted, #9aa4b2); line-height: 1.45; }
.mstr-mnav-prices { margin: 4px 0 10px; }
.mstr-mnav-table-wrap { max-height: none; margin-bottom: 8px; }
#mstrMnavRungTable td.layer-hit, #mstrMnavRungTable tr.mnav-hit td {
  background: rgba(46, 125, 50, 0.16);
}
.mstr-mnav-trail {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 6px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 188, 212, 0.08);
}
.mstr-mnav-settings { margin-top: 6px; }
.mstr-mnav-settings > summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); padding: 4px 0; }
.mstr-mnav-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.mstr-mnav-settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}
.mstr-mnav-settings-grid input {
  min-height: 34px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: inherit;
  padding: 4px 8px;
}
.mstr-mnav-banner {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 180, 60, 0.45);
  background: rgba(255, 160, 40, 0.14);
  font-size: 0.88rem;
  line-height: 1.4;
  font-weight: 600;
}
.mstr-mnav-banner.mnav-act {
  border-color: rgba(244, 67, 54, 0.55);
  background: rgba(244, 67, 54, 0.16);
}
.mstr-mnav-stale { color: #ffb74d; }
@media (max-width: 560px) {
  .mstr-mnav-big { font-size: 1.45rem; }
  #mstrMnavRungTable th, #mstrMnavRungTable td { padding: 5px 6px; font-size: 0.72rem; }
}

/* MSTR mNAV 1.3.20 strip + signals */
.mstr-mnav-strip {
  display: block;
  width: 100%;
  margin: 8px 0 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255,255,255,0.12));
  background: rgba(255,255,255,0.04);
  color: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.mstr-mnav-strip.mnav-near {
  border-color: rgba(255, 180, 60, 0.55);
  background: rgba(255, 160, 40, 0.14);
}
.mstr-mnav-strip.mnav-act {
  border-color: rgba(244, 67, 54, 0.55);
  background: rgba(244, 67, 54, 0.16);
}
.mstr-mnav-signals { font-size: 0.8rem; line-height: 1.45; margin: 4px 0 8px; color: var(--muted, #9aa4b2); }
.mstr-mnav-signals .mnav-amber, .mstr-mnav-options-body .mnav-amber { color: #ffb74d; font-weight: 600; }
.mstr-mnav-options { margin: 6px 0 10px; }
.mstr-mnav-options > summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); }
.mstr-mnav-options-body { font-size: 0.8rem; line-height: 1.45; margin: 6px 0; }
.mstr-mnav-manual-lab { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 12px; }


/* Exit plan strip 1.3.21 (MSTR + TSLA) */
.exit-plan-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 6px 12px 4px;
  padding: 0;
  background: transparent;
  border: none;
  width: auto;
  max-width: 100%;
}
.exit-plan-strip.hidden { display: none; }
.exit-plan-strip .exit-strip-btn {
  margin: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}
.exit-strip-sep {
  color: var(--muted, #9aa4b2);
  font-size: 0.85rem;
  user-select: none;
}
.tsla-exit-panel .mstr-mnav-big.tsla-below { color: #ffb74d; }
.tsla-exit-panel .mstr-mnav-big.tsla-above { color: #81c784; }
#tslaExitRungTable td.layer-hit, #tslaExitRungTable tr.mnav-hit td {
  background: rgba(129, 199, 132, 0.12);
}
@media (max-width: 520px) {
  .exit-plan-strip { margin: 4px 8px; }
  .exit-plan-strip .exit-strip-btn { font-size: 0.72rem; padding: 5px 8px; }
}

/* 1.3.29 Exit plans tab + Pensions/ISA attention badge */
.exit-plans-view .exit-plan-strip { margin: 8px 0 12px; }
.exit-plan-section { margin-top: 10px; }
.exit-plan-more > summary { color: var(--muted, #9aa4b2); font-weight: 550; }
.exit-plan-notice {
  margin: 6px 0 10px;
  padding: 0;
}
.exit-plan-notice.hidden { display: none !important; }
.exit-plan-notice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line, rgba(255,255,255,0.14));
  background: rgba(110, 168, 255, 0.12);
  color: inherit;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.exit-plan-notice.exit-near .exit-plan-notice-btn {
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.45);
}
.exit-plan-notice.exit-hit .exit-plan-notice-btn,
.exit-plan-notice.exit-act .exit-plan-notice-btn {
  background: rgba(244, 67, 54, 0.18);
  border-color: rgba(244, 67, 54, 0.5);
}

/* 1.4.0 plan tiles (Exit + Entry) */
.plan-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
@media (max-width: 640px) {
  .plan-tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.plan-tile {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line, rgba(255,255,255,0.14));
  background: rgba(255,255,255,0.04);
  color: inherit;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
}
.plan-tile:hover { border-color: var(--accent, #6ea8ff); }
.plan-tile-near { background: rgba(255, 193, 7, 0.14); border-color: rgba(255, 193, 7, 0.45); }
.plan-tile-hit { background: rgba(76, 175, 80, 0.14); border-color: rgba(76, 175, 80, 0.45); }
.plan-tile-act { background: rgba(244, 67, 54, 0.16); border-color: rgba(244, 67, 54, 0.5); }
.exit-plan-detail.hidden { display: none !important; }
.entry-score-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
}
.entry-score-good { background: rgba(76, 175, 80, 0.2); }
.entry-score-fair { background: rgba(255, 255, 255, 0.08); }
.entry-score-stretch { background: rgba(244, 67, 54, 0.2); }
.entry-budgets { margin: 8px 0 14px; }
.entry-alloc { margin-bottom: 12px; }
.entry-dry-out {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.72rem;
  margin-top: 8px;
}
.entry-asset-detail {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255,255,255,0.1));
  background: rgba(255,255,255,0.03);
}

/* 1.4.1 Available to spend */
.entry-available { margin: 8px 0 14px; padding: 10px 12px; }
.entry-avail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 8px 0;
}
.entry-avail-card {
  border: 1px solid var(--line, rgba(255,255,255,0.12));
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
}
.entry-avail-hd { font-size: 0.78rem; font-weight: 650; color: var(--muted, #9aa4b2); }
.entry-avail-big { font-size: 1.45rem; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.entry-alloc-from { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.85rem; }
.entry-fiat-list { margin-top: 10px; overflow-x: auto; }


/* === 1.4.66 Strategy pot cash claim === */
.strategy-stack { min-width: 720px; }
.strategy-stack td.stack-cash { font-size: 0.82rem; line-height: 1.35; max-width: 11rem; white-space: normal; }
.strategy-stack td.stack-cash .stack-cash-gbp { color: var(--muted); }
.strategy-stack .stack-long-cash { color: #e6a23c; font-size: 0.78rem; }
.strategy-cash-claim {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.strategy-cash-claim .cash-claim-line { color: var(--text, inherit); }
.strategy-cash-claim .cash-claim-short {
  color: #e74c3c;
  font-weight: 600;
}
.strategy-cash-claim .cash-claim-total { margin-top: 2px; font-size: 0.8rem; opacity: 0.95; }

/* 1.5.07 spare cash (display only) */
.spare-cash-host {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
  overflow-x: hidden;
}
.spare-cash-chip {
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  background: var(--panel, rgba(255,255,255,0.04));
  max-width: 100%;
}
.spare-cash-chip.spare-cash-short {
  border-color: #e74c3c;
}
.spare-cash-sum {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
.spare-cash-sum::-webkit-details-marker { display: none; }
.spare-cash-lbl { font-weight: 600; opacity: 0.9; }
.spare-cash-val { font-weight: 700; }
.spare-cash-short, .spare-cash-short .spare-cash-val, .spare-cash-kpi-short .sub {
  color: #e74c3c !important;
  font-weight: 700;
}
.spare-cash-detail {
  padding: 0 12px 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}
.spare-cash-detail ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
}
.spare-cash-line {
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}
.strategy-cash-claim .spare-cash-line { margin: 2px 0; }
.spare-cash-kpi .sub { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .spare-cash-sum { font-size: 0.9rem; min-height: 48px; }
  .spare-cash-line { font-size: 0.82rem; }
}

@media (max-width: 640px) {
  .strategy-cash-claim { font-size: 0.82rem; gap: 6px; }
  .strategy-cash-claim .cash-claim-line { line-height: 1.35; }
}
@media (max-width: 640px) {
  .strategy-stack { min-width: 640px; }
  .strategy-stack td.stack-cash { max-width: 9rem; font-size: 0.78rem; }
}

/* 1.4.77 pension income hold + dividends */
.badge-income { background: rgba(93,255,195,.14); color: var(--gain); font-size: .68rem; font-weight: 650; padding: 2px 6px; border-radius: 999px; }
.income-hold-summary { margin: 0 0 10px; padding: 0 2px; font-size: .84rem; color: var(--muted); }
.pension-div-body { padding: 0 12px 12px; font-size: .84rem; }
.pension-div-body .div-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pension-div-body table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.pension-div-body th, .pension-div-body td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pension-div-body th { color: var(--muted); font-weight: 600; font-size: .72rem; }
.pension-div-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pension-div-body .div-unmatched { color: var(--warn); }
@media (max-width: 560px) {
  .pension-div-body .div-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* 1.4.78/79 sell-% amount hints + rung grouping */
.sell-pct-hint-wrap {
  display: block;
  margin-top: 2px;
  margin-bottom: 10px; /* keep ≈ line with this rung; space before next label */
}
.sell-pct-hint {
  display: block;
  font-size: .72rem;
  font-weight: 550;
  color: var(--muted);
  line-height: 1.25;
  margin-top: 0;
}
.sell-pct-hint.is-hit { opacity: .65; font-style: italic; }
label .sell-pct-hint-wrap .sell-pct-hint { margin-top: 0; }
/* Exit-plan / xp: each rung (and trail/backstop) is its own group */
.form-row.sell-pct-rung {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  row-gap: 6px;
}
.form-row.sell-pct-rung:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.form-row.sell-pct-rung > label { margin-bottom: 0; }
.form-row.sell-pct-rung .sell-pct-hint-wrap { margin-bottom: 2px; } /* row already has padding to next */
/* MSTR / TSLA settings: group target + sell-% per rung */
.sell-pct-rung-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.mstr-mnav-settings-grid > .sell-pct-rung-group:first-of-type {
  margin-top: 4px;
}
.sell-pct-rung-group .sell-pct-hint-wrap { margin-bottom: 0; }
@media (max-width: 560px) {
  .sell-pct-rung-group { grid-template-columns: 1fr; }
}
/* Layer table: ≈ under pct input, not glued to next row */
td .sell-pct-hint,
.layer-pct-input + .sell-pct-hint {
  margin-top: 2px;
  margin-bottom: 2px;
}

/* 1.4.82 pension dividend ranking */
.div-yield-hint { margin: 8px 0 12px; font-size: .78rem; }
.div-rank-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 8px; }
.div-rank-table { min-width: 720px; font-size: .78rem; }
.div-rank-table th, .div-rank-table td { vertical-align: top; padding: 6px 5px; }
.div-rank-zero { opacity: .72; }
.div-rank-sort { align-items: center; gap: 12px; }
.div-rank-sort select { font-size: .8rem; max-width: 14rem; }

/* 1.4.83 projected income */
.div-projected { margin: 4px 0 10px; }
.div-proj-kpis { margin-top: 4px; }
.div-goal-lab { display: inline-flex; align-items: center; gap: 4px; font-size: inherit; }
.div-goal-lab input { font-size: 1rem; font-weight: 650; }
.proj-pace .val { font-size: 1.05rem; font-weight: 650; }
.proj-yield-est { margin: 6px 2px 0; }


/* 1.4.84 Halving cycle tile (Crypto page) */
.halving-cycle-tile {
  margin: 10px 12px 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(247, 147, 26, 0.4);
  background: linear-gradient(135deg, rgba(247, 147, 26, 0.14), rgba(255,255,255,0.03));
  font-size: 0.9rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.halving-cycle-tile.hidden { display: none !important; }
.halving-tile-hd {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 4px;
}
.halving-tile-main { font-weight: 650; }
.halving-tile-sub { margin-top: 4px; opacity: 0.9; font-size: 0.86rem; }
.halving-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(247, 147, 26, 0.22);
  border: 1px solid rgba(247, 147, 26, 0.35);
  vertical-align: middle;
}

/* 1.5.03 Market mood (Fear & Greed + flows) */
.market-mood-card {
  margin: 6px 12px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(93, 255, 195, 0.22);
  background: linear-gradient(135deg, rgba(93, 255, 195, 0.08), rgba(255,255,255,0.03));
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.market-mood-card.hidden { display: none !important; }
.market-mood-hd {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 10px; margin-bottom: 6px;
}
.market-mood-hd strong { font-size: 0.92rem; }
.market-mood-hd .t-sub { font-size: 0.72rem; opacity: 0.75; }
.market-mood-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
  max-width: 100%; min-width: 0;
}
.mm-gauge {
  flex: 1 1 140px; min-width: 0; max-width: 100%;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.06);
  box-sizing: border-box;
}
.mm-gauge-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mm-score {
  font-size: 1.45rem; font-weight: 800; line-height: 1;
  min-width: 2.2rem;
}
.mm-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 750; letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.mm-pill.mm-efear { background: #b71c1c; color: #fff; }
.mm-pill.mm-fear { background: #e57373; color: #1a1a1a; }
.mm-pill.mm-neutral { background: #b0bec5; color: #1a1a1a; }
.mm-pill.mm-greed { background: #81c784; color: #1a1a1a; }
.mm-pill.mm-egreed { background: #2e7d32; color: #fff; }
.mm-score.mm-efear { color: #ef5350; }
.mm-score.mm-fear { color: #e57373; }
.mm-score.mm-neutral { color: #cfd8dc; }
.mm-score.mm-greed { color: #81c784; }
.mm-score.mm-egreed { color: #66bb6a; }
.mm-hist { margin-top: 4px; font-size: 0.78rem; opacity: 0.9; line-height: 1.3; }
.mm-flows {
  flex: 2 1 200px; min-width: 0; max-width: 100%;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.06);
  box-sizing: border-box; font-size: 0.84rem; line-height: 1.35;
}
.mm-flow-line { margin: 0 0 4px; word-break: break-word; }
.mm-flow-line:last-child { margin-bottom: 0; }
.mm-leave { color: #81c784; } /* exchange: coins leaving */
.mm-enter { color: #e57373; } /* exchange: coins entering */
.mm-etf-in { color: #81c784; } /* ETF net inflow */
.mm-etf-out { color: #e57373; } /* ETF net outflow */
.mm-etf-btn {
  display: block; width: 100%; text-align: left; margin-top: 4px;
  padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04); color: inherit; cursor: pointer;
  font: inherit; font-size: 0.82rem; touch-action: manipulation;
  box-sizing: border-box; max-width: 100%; min-width: 0;
}
.mm-etf-btn:active { filter: brightness(1.08); }
.mm-etf-expand {
  margin-top: 6px; padding: 6px 8px; border-radius: 8px;
  background: rgba(0,0,0,0.25); font-size: 0.78rem;
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.mm-etf-expand.hidden { display: none !important; }
.mm-etf-table { width: 100%; border-collapse: collapse; min-width: 0; }
.mm-etf-table th, .mm-etf-table td {
  padding: 3px 6px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mm-etf-table th:first-child, .mm-etf-table td:first-child { text-align: left; }
.mm-credit { margin-top: 6px; font-size: 0.68rem; opacity: 0.65; line-height: 1.3; }
.mm-stale { opacity: 0.85; }
.mm-stale::after { content: " · cached"; font-size: 0.68rem; opacity: 0.7; }
@media (max-width: 420px) {
  .market-mood-card { margin: 6px 8px 8px; padding: 8px 10px; }
  .mm-score { font-size: 1.25rem; }
  .mm-gauge, .mm-flows { flex: 1 1 100%; }
}


/* 1.4.87 nav viewport — keep wide Strategy/Shares tables from expanding the page */
@media (max-width: 720px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .app { max-width: 100%; min-width: 0; overflow-x: hidden; }
  .strategy-view,
  .strategy-view .panel,
  .strategy-avail-bar,
  .strategy-stack-wrap,
  .strategy-add-bar,
  #bagView,
  #bookTableWrap.table-wrap,
  .table-wrap {
    max-width: 100%;
    min-width: 0;
  }
  .strategy-stack-wrap,
  #bookTableWrap.table-wrap,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .topbar, .top-actions, .brand, .brand-text {
    max-width: 100%;
    min-width: 0;
  }
}

/* 1.4.89 QR login + signed-in devices */
.auth-qr { margin-top: 10px; }
.auth-qr-btn { width: 100%; justify-content: center; }
.auth-qr-panel { margin-top: 10px; text-align: center; }
.auth-qr-box { display: flex; justify-content: center; margin: 8px 0; }
.auth-qr-box img { width: 196px; height: 196px; image-rendering: pixelated; background: #fff; border-radius: 8px; }
.qr-approve-modal { max-width: 420px; }
.qr-approve-meta { margin: 10px 0; line-height: 1.5; font-size: .92rem; }
.qr-approve-meta div { margin: 4px 0; }
.sessions-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.session-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border, #3333); }
.session-main { flex: 1; min-width: 0; }

/* 1.4.91 band live */
.strat-band-live { margin-top: 10px; }
.strat-band-live-params { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.strat-band-live-params label { font-size: .85rem; display: flex; flex-direction: column; gap: 2px; min-width: 5.5rem; }
.strat-band-live-params input { width: 5.5rem; }

/* 1.4.93: Strategy pot Band chart — 1.4.98 windowed pan/zoom */
.strat-band-chart { margin-top: 10px; overflow-x: hidden; max-width: 100%; }
.band-chart { width: 100%; max-width: 100%; overflow: hidden; }
.band-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; opacity: 0.9; margin: 4px 0 2px; }
.band-chart-legend span { white-space: nowrap; }
.band-chart-toolbar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 4px 0 6px; }
.band-chart-btn {
  min-width: 2.5rem; min-height: 2.5rem; padding: 0.45rem 0.7rem;
  font-size: 1rem; line-height: 1.1; touch-action: manipulation;
}
.band-chart-btn.band-chart-refresh { min-width: 7.5rem; font-size: 0.95rem; }
.band-chart-win-label { margin-left: 2px; }
.band-chart-plot {
  width: 100%; max-width: 100%;
  touch-action: pan-y; /* vertical page scroll; JS handles horizontal pan */
  cursor: grab; user-select: none; -webkit-user-select: none;
  overscroll-behavior-x: contain;
}
.band-chart-plot:active { cursor: grabbing; }
.band-chart-plot svg { display: block; width: 100%; max-width: 100%; height: 140px; }
.band-chart-loading { padding: 8px 0; }
.band-live-trades { margin-top: 6px; font-size: 12px; line-height: 1.35; max-width: 100%; overflow-x: hidden; word-break: break-word; }
.band-live-trades table { width: 100%; border-collapse: collapse; }
.band-live-trades th, .band-live-trades td { text-align: left; padding: 2px 4px; border-bottom: 1px solid rgba(128,128,128,0.25); }
.band-live-trades .side-buy { color: #66bb6a; }
.band-live-trades .side-sell { color: #ef5350; }

/* 1.4.94: Band chart marker legend */
.band-chart-legend { align-items: center; }
.band-leg-tri { display: inline-block; width: 0; height: 0; margin-right: 3px; vertical-align: middle; }
.band-leg-tri.up { border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid currentColor; }
.band-leg-tri.down { border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid currentColor; }
.band-leg-tri.hollow.up { border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent;
  border-bottom: 8px solid; border-bottom-color: currentColor; opacity: 0.55; }


/* 1.4.99: previous starts / undo restart */
#btnStratUndoLastRestart {
  min-height: 2.5rem; min-width: 8.5rem;
  padding: 0.45rem 0.75rem; font-size: 0.95rem;
  touch-action: manipulation; white-space: nowrap;
}
.strat-vs-start-hist { margin: 2px 0 6px; line-height: 1.35; }
.strat-prev-starts { margin-top: 6px; font-size: 0.9rem; max-width: 100%; }
.strat-prev-starts summary { cursor: pointer; user-select: none; }
.strat-prev-starts-body { margin-top: 4px; }
.strat-prev-start-row { margin: 2px 0; line-height: 1.35; }

/* 1.4.99: Compare strategies — window selector + Which won (phone/Tesla tap targets) */
.pot-cmp-win {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px;
  align-items: stretch;
}
.pot-cmp-win-btn {
  flex: 1 1 auto;
  min-height: 2.75rem; min-width: 5.5rem;
  padding: 0.55rem 0.85rem; font-size: 0.95rem;
  touch-action: manipulation; white-space: nowrap;
}
.pot-cmp-win-btn.active {
  border-color: #4fc3f7; background: rgba(79,195,247,0.18); font-weight: 600;
}
.pot-cmp-won { margin: 4px 0 8px; line-height: 1.4; }

/* 1.5.01: Strategy pot panel — stop global table{min-width:1080px} blowing out the phone viewport.
   Root cause: .strategy-cmp (Spot vs ledger) and .band-live-trades table inherit
   `table { min-width: 1080px; width: max-content }` from the bag book table, expanding
   .strategy-card past the screen while html/body overflow-x:hidden clips the right edge. */
.strategy-view,
.strategy-view .panel,
.strategy-grid,
.strategy-card,
.strategy-view .panel-inset,
.strat-band-chart,
.band-chart {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.strategy-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}
@media (max-width: 900px) {
  .strategy-grid { grid-template-columns: minmax(0, 1fr); }
}
.strategy-view .table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* Override global bag-table min-width inside Strategy (except the stack snapshot, which scrolls in its wrap) */
.strategy-view table.strategy-cmp:not(.strategy-stack),
.strategy-view .band-live-trades table,
.strategy-view table.strategy-sig {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  table-layout: auto;
}
.strategy-view table.strategy-cmp:not(.strategy-stack) th,
.strategy-view table.strategy-cmp:not(.strategy-stack) td {
  white-space: normal;
}
.strategy-stack-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.band-chart {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.band-chart-plot {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.band-chart-range,
.strat-vs-start,
.strat-vs-start-hist {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.strat-vs-start .strat-vs-extra,
.strat-vs-start-hist .strat-vs-extra {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}
.strategy-actions {
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}
.strategy-actions > button,
.strategy-actions .ghost {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
}
@media (max-width: 720px) {
  .strategy-view .strategy-card,
  .strategy-view .panel-inset {
    overflow-x: hidden; /* clip any residual; stack/cmp scroll in their own wraps */
  }
  .strategy-actions > button {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }
}

/* === 1.5.02 Allocation tiles (treemap) — shared Crypto / Shares === */
.alloc-hd {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; margin-bottom: 4px;
}
.alloc-hd h2 { margin: 0; }
.alloc-switches, .alloc-pct-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.alloc-pct-row { margin: 6px 0 8px; }
.alloc-mode-btn, .alloc-pct-btn {
  min-height: 2.5rem; min-width: 4.25rem; padding: 0.4rem 0.7rem;
  touch-action: manipulation; font-size: 0.92rem;
}
.alloc-mode-btn.active, .alloc-pct-btn.active {
  border-color: var(--accent, #5dffc3);
  background: rgba(93, 255, 195, 0.14);
  font-weight: 650;
}
.alloc-sub { margin: 0 0 4px; font-size: 0.82rem; }
.alloc-tiles-wrap {
  position: relative;
  width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box;
}
.alloc-tiles {
  position: relative;
  width: 100%; max-width: 100%; min-width: 0;
  /* JS sets exact height (~1.2× width on phone, cap 520). Fallbacks: */
  height: min(120vw, 520px);
  min-height: 260px;
  max-height: 520px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  padding: 0;
}
@media (min-width: 900px) {
  .alloc-tiles { min-height: 320px; }
}
.alloc-tile {
  position: absolute;
  box-sizing: border-box;
  border: none;
  /* gap comes from layout padding; soft rounded tiles like the reference */
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(10, 12, 18, 0.12);
  padding: 4px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
  min-width: 0; min-height: 0;
  color: #0a0c12;
  transition: filter 0.12s ease;
}
.alloc-tile:active, .alloc-tile:focus-visible { filter: brightness(0.95); outline: 2px solid var(--accent); outline-offset: -2px; }
.alloc-tile .at-tkr {
  font-weight: 750; font-size: clamp(0.65rem, 2.8vw, 1.05rem);
  letter-spacing: 0.02em; line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.alloc-tile .at-pct {
  font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: clamp(0.6rem, 2.4vw, 0.95rem); line-height: 1.15;
}
.alloc-tile.at-tiny .at-pct { display: none; }
.alloc-tile.at-micro .at-tkr,
.alloc-tile.at-micro .at-pct { display: none; }
.alloc-tile.at-up { background: #c8e6c9; }
.alloc-tile.at-down { background: #ffcdd2; }
.alloc-tile.at-flat { background: #e0e0e0; }
.alloc-tile.at-na { background: #cfd8dc; }
.alloc-tile.at-more { background: #b0bec5; }
.alloc-tile .at-pct.at-up { color: #1b5e20; }
.alloc-tile .at-pct.at-down { color: #b71c1c; }
.alloc-tile .at-pct.at-flat,
.alloc-tile .at-pct.at-na { color: #37474f; }

.alloc-tile-expand {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line, #2a2f3d);
  background: var(--bg-elev, #12141c);
  max-width: 100%; min-width: 0;
  box-sizing: border-box;
}
.alloc-tile-expand.hidden { display: none !important; }
.alloc-exp-hd {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  align-items: baseline; margin-bottom: 6px;
}
.alloc-exp-hd strong { font-size: 1.05rem; }
.alloc-exp-metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 6px 12px; font-size: 0.88rem; margin-bottom: 8px;
}
.alloc-exp-metrics .t-sub { margin: 0; }
.alloc-exp-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.alloc-exp-actions button {
  min-height: 2.5rem; touch-action: manipulation; flex: 1 1 auto;
}
.alloc-more-list {
  display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.alloc-more-row {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.04);
  border: none; color: inherit; width: 100%; text-align: left; cursor: pointer;
  min-height: 2.5rem; touch-action: manipulation;
}
.alloc-donut-wrap { max-width: 100%; min-width: 0; }
.alloc-donut-wrap.hidden { display: none !important; }
.alloc-tiles-wrap.hidden { display: none !important; }

@media (max-width: 720px) {
  .alloc-tiles { min-height: 280px; height: min(125vw, 480px); }
  #donutPanel { max-width: 100%; min-width: 0; overflow-x: hidden; }
}

tr.alloc-flash { outline: 2px solid var(--accent, #5dffc3); outline-offset: -2px; }

/* 1.5.07 Entry Always buy */
.entry-always-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(93, 255, 195, 0.18);
  color: var(--accent, #5dffc3);
  vertical-align: middle;
}
.entry-on-cell, .entry-always-cell { text-align: center; }
.entry-on-cell input, .entry-always-cell input { width: 1.25rem; height: 1.25rem; }
.entry-alloc-hint { margin: 8px 0 0; font-size: 0.82rem; line-height: 1.35; }
.entry-avail-card .t-sub { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }

/* 1.5.07 Entry AJ Bell order + Always */
.entry-aj-order { margin-top: 8px; gap: 6px; }
.entry-aj-order label { font-size: 0.85em; }
.entry-aj-fee-hint { margin: 4px 0 0; font-size: 0.8em; }
.entry-aj-fees { margin: 4px 0 6px; }
.entry-always-badge { font-size: 0.75em; opacity: 0.85; margin-left: 4px; }
.entry-on, .entry-always { width: 1rem; height: 1rem; }

.entry-aj-bow { margin-top: 6px; }
.entry-aj-status { margin-top: 6px; font-weight: 600; }
.entry-aj-wait { color: #e0c070; margin: 4px 0 6px; }

.entry-profit-card { margin-top: 12px; }
.entry-profit-use { display: block; margin: 6px 0; }
.entry-profit-row { margin: 6px 0; padding: 6px 0; border-bottom: 1px solid #2a3340; }

/* 1.5.08: Entry asset detail inline under tapped tile / row */
#entryTiles > .entry-asset-detail { grid-column: 1 / -1; }
.entry-asset-detail { background: rgba(93,255,195,.06); border: 1px solid rgba(93,255,195,.25); border-radius: 10px; padding: 10px; margin: 2px 0 6px; }
.plan-tile.entry-tile-sel { outline: 2px solid rgba(93,255,195,.6); }
tr[data-entry-row] { cursor: pointer; }
tr.entry-row-sel > td { background: rgba(93,255,195,.06); }
tr.entry-detail-tr > td { padding: 0 4px 6px; }
tr.entry-detail-tr .entry-asset-detail { position: sticky; left: 0; max-width: calc(100vw - 40px); box-sizing: border-box; }

/* 1.5.08: Entry detail · Your holdings */
.entry-hold { margin-top: 10px; border-top: 1px solid var(--line, #2a3340); padding-top: 8px; }
.entry-hold-title { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.entry-hold-row { padding: 6px 0; border-bottom: 1px solid var(--line, #2a3340); font-size: 12px; line-height: 1.45; }
.entry-hold-row .fxpair { display: inline-flex !important; flex-direction: row !important; gap: 4px; align-items: baseline; }
.entry-hold-row .fxpair > span { display: inline !important; }
.entry-hold-row .fx-usd { font-size: 10px; opacity: .6; }
.entry-hold-row.entry-hold-total { border-bottom: 0; border-top: 1px solid var(--line-strong, #3a4350); }
.entry-hold-exit { margin: 6px 0; }
.entry-open-trig { margin-top: 4px; }
.entry-stretch-hint { margin-top: 6px; }

/* 1.5.10: Pair trade · Rebalancing vs hold chart axis labels + legend */
.pt-perf-chart { position: relative; }
.pt-perf-chart .pt-ax { position: absolute; left: 2px; font-size: 10px; line-height: 1; color: var(--muted, #9aa); background: rgba(0,0,0,.35); padding: 1px 3px; border-radius: 3px; pointer-events: none; }
.pt-perf-chart .pt-ax-hi { top: 1px; }
.pt-perf-chart .pt-ax-lo { bottom: 4px; }
.pt-ax-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted, #9aa); margin-top: 1px; }
.pt-legend span { white-space: nowrap; }

/* 1.5.11: Band chart — chart-only Daily view toggle + caption */
.band-chart-mode { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.band-chart-mode .band-chart-mode-btn { flex: 1 1 auto; min-width: 7rem; font-size: 0.95rem; white-space: nowrap; }
.band-chart-mode .band-chart-mode-btn.active {
  border-color: #4fc3f7; background: rgba(79,195,247,0.18); font-weight: 600;
}
.band-chart-daily-note {
  margin: 2px 0 6px; padding: 6px 8px; line-height: 1.35;
  border-left: 3px solid #4fc3f7; background: rgba(79,195,247,0.08); border-radius: 4px;
  overflow-wrap: anywhere;
}

/* 1.5.12: Strategy · per-pot Pause strategy switch + paused tab badge */
.strat-pause-wrap { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; }
.strat-pause-wrap.is-paused span { color: var(--warn, #e0a030); font-weight: 600; }
.pot-tab.pot-paused { border-style: dashed; }
.pot-paused-badge { font-size: 0.85em; opacity: 0.85; }

/* 1.5.13: Strategy · trading method card + BAG signal status */
.strat-method { margin-top: 10px; }
.strat-method-pick { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; max-width: 16rem; }
.strat-method-pick select { min-height: 36px; }
.strat-ema-params .notify-toggle, .strat-auto-params .notify-toggle { flex-direction: row; align-items: center; min-width: 0; }
.strat-band-live-params label.is-dim { opacity: .5; }
.strat-method-status { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); font-size: .88rem; line-height: 1.45; }
.strat-method-status .bagsig-arm { font-weight: 600; margin-bottom: 4px; }
.strat-method-status .bagsig-arm.is-on { color: #66bb6a; }
.strat-method-status .bagsig-arm.is-off { color: var(--warn, #e0a030); }
.strat-method-status .bagsig-last.side-buy .bagsig-status { color: #66bb6a; }
.strat-method-status .bagsig-last.side-sell .bagsig-status { color: #ef5350; }
.strat-method-status .bagsig-pending { margin-top: 6px; }
.strat-method-status .bagsig-pending button { margin-left: 6px; }
@media (max-width: 560px) {
  .strat-method-pick { max-width: none; }
  .strat-ema-params label, .strat-auto-params label { min-width: 44%; }
}
/* 1.5.13: Entry auto-save status + AJ Bell real cash */
.entry-save-status { align-self: center; margin-right: 6px; opacity: .8; }
.entry-save-status.is-saved { color: #66bb6a; opacity: 1; }
.entry-aj-real { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }

/* ===== 1.5.14 full chart ===== */
.fc-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(3,4,8,.86); display: flex; }
.fc-overlay.hidden { display: none; }
body.fc-open { overflow: hidden; }
.fc-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; margin: 10px; background: #0b0e16;
  border: 1px solid var(--line-strong); border-radius: 14px; padding: 8px 10px; gap: 6px; overflow: hidden; }
.fc-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.fc-head-t { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.fc-head-t strong { font-size: 1rem; }
.fc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fc-bar button.active { background: var(--accent-dim, rgba(79,195,247,.18)); border-color: var(--accent, #4fc3f7); color: #fff; }
.fc-sep { width: 8px; }
.fc-ind label { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; font-size: .78rem; color: var(--text, #dfe6f3); margin-right: 6px; }
.fc-ind label.hidden { display: none; }
.fc-set { font-size: .78rem; }
.fc-set summary { cursor: pointer; color: var(--muted); }
.fc-set-grid { display: grid; grid-template-columns: repeat(5, minmax(70px, 1fr)); gap: 6px; margin-top: 6px; }
.fc-set-grid input { padding: 6px 8px; }
.fc-readout { font-size: .76rem; color: var(--muted); min-height: 1.3em; white-space: nowrap; overflow-x: auto; }
.fc-readout b { color: #e8edf7; font-weight: 600; }
.fc-up { color: #26a69a !important; } .fc-down { color: #ef5350 !important; }
.fc-wrap { position: relative; flex: 1; min-height: 240px; }
.fc-chart { position: absolute; inset: 0; }
.fc-draw { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; }
.fc-draw.fc-draw-live { pointer-events: auto; touch-action: none; cursor: grab; }
.fc-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .74rem; }
.fc-err { color: var(--warn, #ffb74d) !important; }
.fc-attr { text-decoration: none; opacity: .8; }
.strat-full-chart-btn { margin-left: 6px; }
/* the chart library lays out with a <table>: undo BAG's global table/td rules inside it
   (min-width 1080px, cell padding, sticky 84px first column on phones) */
.fc-chart table { width: auto; min-width: 0; border-collapse: separate; table-layout: auto; }
.fc-chart th, .fc-chart td, .fc-chart td:first-child, .fc-chart tr:hover td, .fc-chart tr:hover td:first-child {
  padding: 0; border: 0; position: static; left: auto; z-index: auto; box-shadow: none; background: transparent;
  width: auto; min-width: 0; max-width: none; white-space: normal; text-align: left; font: inherit; font-family: inherit; transition: none; }
.fc-chart tbody tr, .fc-chart tbody tr:hover { background: transparent; transition: none; }
@media (max-width: 640px) {
  .fc-panel { margin: 0; border-radius: 0; padding: 6px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .fc-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .fc-bar::-webkit-scrollbar { display: none; }
  .fc-bar button, .fc-ind label { flex: 0 0 auto; }
  .fc-bar button { min-height: 34px; min-width: 40px; }
  .fc-set-grid { grid-template-columns: repeat(2, 1fr); }
  .fc-wrap { min-height: 300px; }
}

/* ===== 1.5.16 asset screen (chart + one panel) ===== */
.fc-pots:empty, .fc-asset:empty { display: none; }
.fc-pots { margin: 2px 0 0; }
.fc-pots .pot-tab .am-tab-sub, .am-styles .pot-tab .am-tab-sub { font-weight: 400; opacity: .75; font-size: .64rem; }
.fc-overlay.fc-asset-mode .fc-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fc-overlay.fc-asset-mode .fc-wrap { flex: 0 0 auto; height: clamp(320px, 54vh, 560px); }
.fc-asset { padding-top: 8px; }
.am-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(420px, 2.6fr); gap: 10px; }
.am-grid .am-card { min-height: 0; }
.am-hold { order: 1; } .am-resv { order: 2; } .am-sig { order: 3; } .am-pot { order: 4; }
.am-span { grid-column: 1 / -1; }
.am-card-hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.am-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin: 6px 0 8px; }
.am-kpis > div { display: flex; flex-direction: column; gap: 2px; }
.am-kpis strong { font-family: var(--mono); font-size: 1rem; }
.am-kpis strong .fxpair { display: flex; flex-direction: column; }
/* 1.5.22: Holding card — every figure (and its $ line and %) sits left-aligned under its own label */
.am-kpis > div { align-items: flex-start; text-align: left; min-width: 0; }
.am-kpis strong { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.am-kpis strong .fxpair { align-items: flex-start; }
.am-kpis strong > small { display: block; margin-top: 1px; }
.am-hold > p.help .fxpair { align-items: flex-start; }
.am-kpis strong .fx-usd, .am-table .fx-usd { font-size: .66rem; color: var(--muted); font-weight: 400; }
.am-kpis small { font-size: .72rem; }
.am-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: .76rem; table-layout: auto; }
.am-table th, .am-table td, .am-table td:first-child, .am-table th:first-child, .am-table tr:hover td, .am-table tr:hover td:first-child {
  position: static; left: auto; z-index: auto; box-shadow: none; background: transparent; width: auto; min-width: 0; max-width: none; white-space: normal; }
.am-table td:first-child { min-width: 92px; }
.am-res { min-width: 640px; }
.am-table th { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 500; text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.am-table td { text-align: right; padding: 6px; border-bottom: 1px solid var(--line); font-family: var(--mono); vertical-align: top; }
.am-table .left { text-align: left; }
.am-table td.left { font-family: var(--font); }
.am-table .fxpair { display: flex; flex-direction: column; align-items: flex-end; }
.am-table tr.am-sel td { background: rgba(110,168,255,.08); }
.am-table tr.am-free td { color: var(--muted); }
.am-res-wrap { overflow-x: auto; }
.am-pill { display: inline-block; font-size: .64rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; margin: 1px 3px 1px 0; white-space: nowrap; font-family: var(--font); }
.am-on { background: var(--gain-dim); color: var(--gain); }
.am-off { background: rgba(255,255,255,.06); color: var(--muted); }
.am-paused { background: var(--warn-dim); color: var(--warn); }
.am-info { background: rgba(110,168,255,.14); color: var(--accent); }
.am-styles { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.am-styles .pot-tab { border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--muted); }
.am-styles .pot-tab.active { background: var(--accent); color: #0a0c12; border-color: transparent; font-weight: 600; }
.am-preview-note { font-size: .76rem; background: var(--warn-dim); border: 1px solid rgba(255,204,77,.35); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.am-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.am-set label { display: flex; flex-direction: column; gap: 3px; font-size: .72rem; color: var(--muted); }
.am-set input, .am-set select { padding: 6px 8px; }
.am-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.am-actions .am-pause { margin: 0; font-size: .78rem; }
.am-actions button { min-height: 32px; }
.am-last { font-size: .8rem; margin: 4px 0; }
.am-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.am-open-btn { margin-top: 3px; border: 1px solid rgba(110,168,255,.45); background: rgba(110,168,255,.12); color: var(--accent); }
#tbody tr[data-id] { cursor: pointer; }
@media (max-width: 900px) {
  .am-grid { grid-template-columns: 1fr; }
  .am-pot { order: 3; } .am-sig { order: 4; }
}
@media (max-width: 640px) {
  .fc-overlay.fc-asset-mode .fc-wrap { height: 52vh; min-height: 280px; }
  /* phone: drawing tools + indicator settings sit behind the Tools button */
  .fc-overlay.fc-asset-mode:not(.fc-tools-open) .fc-tools, .fc-overlay.fc-asset-mode:not(.fc-tools-open) .fc-set { display: none; }
  .fc-overlay.fc-asset-mode .fc-am-btn { display: inline-flex; }
  .fc-overlay.fc-asset-mode.fc-tools-open #fcToolsBtn { background: var(--accent-dim, rgba(79,195,247,.18)); border-color: var(--accent, #4fc3f7); color: #fff; }
  .fc-overlay.fc-asset-mode .fc-head { flex-wrap: wrap; justify-content: flex-end; }
  .fc-overlay.fc-asset-mode .fc-head-t { flex: 1 1 100%; }
  .am-table { font-size: .7rem; }
  .am-res th:nth-child(5), .am-res td:nth-child(5) { min-width: 120px; }
  .am-set { grid-template-columns: repeat(2, 1fr); }
  .am-actions button { flex: 1 1 40%; min-height: 40px; }
}
.fc-overlay.fc-asset-mode .fc-panel > * { flex-shrink: 0; }
.am-card { min-width: 0; }
@media (max-width: 900px) {
  .am-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .am-actions .am-pause { flex: 1 1 100%; }
  .am-res { min-width: 560px; }
}
.am-set label { min-width: 0; }
.am-set input, .am-set select { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 640px) {
  /* reserved table → stacked rows on phones (no sideways scroll) */
  .am-res { min-width: 0; }
  .am-res thead { display: none; }
  .am-res tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
  .am-res td, .am-res td:first-child { border: 0; padding: 0; text-align: left; min-width: 0; }
  .am-res td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .am-res td:nth-child(6) { grid-column: 2; grid-row: 1; text-align: right; }
  .am-res td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .am-res td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .am-res td:nth-child(4) { grid-column: 2; grid-row: 3; text-align: right; }
  .am-res td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; font-size: .7rem; }
  .am-res td:nth-child(5)::before { content: "Cash: "; color: var(--muted); }
  .am-res tr.am-sel { background: rgba(110,168,255,.08); border-radius: 8px; }
}
.am-table td:not(.left) { white-space: nowrap; }
@media (max-width: 640px) {
  .am-res td:not(.left) { white-space: normal; }
  .am-res tr.am-sel td { background: transparent; }
  .am-res tr.am-sel { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
}
@media (min-width: 901px) { .am-grid { grid-template-columns: minmax(340px, 1fr) minmax(420px, 2fr); } }
.am-open-btn { font-size: .64rem; padding: 2px 6px; white-space: nowrap; position: relative; z-index: 1; }
@media (max-width: 640px) {
  .am-hold .am-table td:not(.left) { white-space: normal; }
  .am-hold .am-table td.left .am-pill { white-space: normal; }
  .am-hold .am-table td, .am-hold .am-table th { padding: 6px 3px; }
}
.fc-am-btn { display: none; }
.fc-head .fc-am-btn, .fc-head #fcClose { flex: 0 0 auto; }
/* 1.5.27.2: chart-view asset dropdown */
.fc-head .fc-asset-pick { flex: 0 1 auto; margin-left: auto; max-width: 220px; min-width: 0; font-size: .75rem; padding: 4px 6px; border-radius: 8px;
  background: var(--panel, #121725); color: inherit; border: 1px solid rgba(255,255,255,.14); }
.fc-set input.fc-ro { opacity: .75; cursor: default; background: transparent; border-style: dashed; }
.fc-set-pot-note { color: var(--accent, #7cc4ff); }
@media (max-width: 640px) { .fc-head .fc-asset-pick { max-width: 46vw; font-size: 16px; padding: 6px 6px; } }
/* confirm pop-ups (Trading On, Force buy/sell…) must sit above the full-chart overlay */
body.fc-open #confirm { z-index: 35; }
.am-sub-hd { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.am-set .am-cb { flex-direction: row; align-items: center; gap: 6px; align-self: end; }
.am-set .am-cb input { width: auto; }
.am-pv-note { margin: 0; color: var(--warn); }
.am-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.am-actions .ghost[data-am-strat] { margin-left: auto; }
@media (max-width: 640px) { .am-actions .ghost[data-am-strat] { margin-left: 0; flex: 1 1 100%; } }

/* ===== 1.5.17: trigger handles, drag confirm, BAG ladder card ===== */
.fc-trig-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.fc-grip { position: absolute; right: 0; height: 22px; transform: translateY(-50%); box-sizing: border-box; display: flex; align-items: center; gap: 3px; padding: 0 4px;
  font-size: 10.5px; font-weight: 600; color: #fff; border-radius: 3px 0 0 3px; pointer-events: auto; touch-action: none; cursor: ns-resize;
  user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1px rgba(0,0,0,.35); white-space: nowrap; justify-content: flex-end; }
.fc-grip-sell { background: #ef5350; }
.fc-grip-buy { background: #26a69a; }
.fc-grip-lock { opacity: .75; cursor: not-allowed; }
.fc-grip-live { outline: 2px solid #fff; }
.fc-grip-h { font-size: 12px; line-height: 1; }
/* 1.5.27.4: Layer rung handles + drag confirm */
.fc-grip-lb { background: #e8774f; }
.fc-grip-lb.fc-grip-l0 { background: #26a69a; }
.fc-grip-lb.fc-grip-lboff { background: #78808f; }
.fc-grip-lb.fc-grip-lbmoving { outline: 1px dashed #fff; }
.fc-trig-confirm .lb-dc-list { margin: 4px 0 4px 1.1em; padding: 0; max-height: 40vh; overflow: auto; }
.fc-trig-confirm .lb-dc-list li { margin: 1px 0; font-variant-numeric: tabular-nums; }
.fc-trig-confirm .lb-dc-list li.lb-dc-main { color: #ffcc80; }
.fc-trig-confirm .lb-dc-bad { margin-top: 4px; }
.fc-trig-confirm .lb-dc-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 2px; }
.fc-trig-confirm .lb-dc-mode button { min-width: 0; }
.fc-trig-confirm .lb-dc-ex { margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.lb-card .lb-l0mode select { max-width: 12em; }
.fc-trig-confirm { position: absolute; left: 8px; right: 70px; top: 8px; z-index: 6; background: rgba(18,22,34,.97); border: 1px solid var(--accent, #4fc3f7);
  border-radius: 8px; padding: 8px 10px; font-size: .82rem; box-shadow: 0 6px 24px rgba(0,0,0,.5); max-width: 520px; }
.fc-trig-confirm.hidden { display: none; }
.fc-tc-btns { display: flex; gap: 8px; margin-top: 6px; }
.fc-tc-btns button { min-height: 34px; min-width: 72px; }
.lb-card .lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; align-items: end; }
.lb-card .lb-span { grid-column: 1 / -1; }
.lb-card .lb-rungs input.lb-num { max-width: 6.5em; }
.lb-card .lb-rungs tr.lb-off td { opacity: .6; }
.lb-card .lb-runby { margin: 8px 0; }
.lb-card .lb-unavail { color: var(--warn, #ffb74d); }
.lb-card .lb-warn { margin: 6px 0; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--warn, #ffb74d); background: var(--warn-dim, rgba(255,183,77,.12)); font-size: .8rem; }
.lb-card .lb-wh { margin-top: 8px; }
.lb-card .lb-status p { margin: 2px 0; }
/* 1.5.24 BAG limit orders */
.lb-card .lb-ord { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-card .lb-rungs select.lb-bbsel { max-width: 11em; }
.lb-card .lb-bb { margin-top: 6px; }
.lb-card .lb-plan-done ul { margin: 4px 0 0 1.1em; padding: 0; font-size: .8rem; }
.lb-card .lb-plan-note { margin: 4px 0; }
@media (max-width: 640px) {
  .fc-grip { height: 26px; font-size: 11px; padding: 0 3px; }
  .fc-trig-confirm { right: 8px; }
  .lb-card .lb-grid { grid-template-columns: 1fr 1fr; }
}
.lb-card .lb-rungs { max-width: 680px; }
.lb-card .lb-rungs th, .lb-card .lb-rungs td { padding: 3px 8px; vertical-align: middle; }
.lb-card .lb-rungs input, .lb-card .lb-rungs select { padding: 4px 6px; min-height: 30px; }
.lb-card .lb-rungs select { min-width: 4.6em; }
.lb-card input::placeholder { color: rgba(160,170,190,.5); font-style: italic; }
.lb-card .lb-grid label { display: flex; flex-direction: column; gap: 2px; }
.lb-card { min-width: 0; max-width: 100%; box-sizing: border-box; }
.lb-card .lb-grid input, .lb-card .lb-grid select { width: 100%; min-width: 0; box-sizing: border-box; }
.lb-card .lb-rungs .lb-num { width: 5.4em; }
@media (max-width: 640px) {
  .lb-card .lb-rungs th, .lb-card .lb-rungs td { padding: 3px 3px; }
  .lb-card .lb-rungs .lb-num { width: 4.3em; }
  .lb-card .lb-rungs select { min-width: 3.9em; padding: 4px 2px; }
  .lb-card .lb-rungs td:last-child { font-size: .72rem; }
}
/* 1.5.17 asset screen: Layer summary + Add to a trading style */
.am-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .85rem; margin: 6px 0 8px; }
.am-kv span { color: var(--muted, #9aa4b2); }
.am-pill.am-warn { background: rgba(255,183,77,.18); color: #ffb74d; }
.am-layer-rungs td, .am-layer-rungs th { padding: 3px 8px; }
.am-open-ladder { margin-left: 6px; padding: 1px 8px; min-height: 0; font-size: .75rem; }
.am-add { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; }
.am-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; }
.am-add-row select { min-width: 9em; }
.am-add-row .t-sub { font-size: .78rem; }
.am-add-off { opacity: .6; }

/* ---- 1.5.18 Markets (display only) ---- */
.mkt-panel { margin: 6px 12px 10px; box-sizing: border-box; min-width: 0; padding: 10px 12px 12px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg-elev); }
.mkt-panel.hidden { display: none !important; }
.mkt-hd { display: flex; align-items: center; justify-content: space-between; }
.mkt-toggle { background: none; border: 0; color: var(--text); font: inherit; padding: 2px 0; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.mkt-title { font-weight: 700; font-size: 1.02rem; }
.mkt-tiles { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.mkt-tile, .mkt-box { background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mkt-tile-hd { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.mkt-big { font-size: 1.35rem; font-weight: 700; line-height: 1.15; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mkt-sub { font-size: .78rem; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mkt-foot { margin-top: auto; padding-top: 4px; font-size: .68rem; color: var(--faint); }
.mkt-spark { display: block; max-width: 100%; }
.mkt-stale { filter: grayscale(1); opacity: .55; }
.mkt-up { color: var(--gain); }
.mkt-down { color: var(--loss); }
.mkt-f-hot { color: #ff5d73; }
.mkt-f-warm { color: #ffb74d; }
.mkt-f-calm { color: var(--text); }
.mkt-f-neg { color: #4fc3f7; }
.mkt-frow { display: flex; gap: 8px; align-items: baseline; font-size: .8rem; flex-wrap: wrap; }
.mkt-frow > span:first-child { min-width: 34px; color: var(--muted); }
.mkt-macro .mkt-frow > span:first-child { min-width: 92px; }
.mkt-frow strong { font-variant-numeric: tabular-nums; }
.mkt-etf-row { background: none; border: 0; color: var(--text); text-align: left; padding: 2px 0; font: inherit; font-size: .8rem; cursor: pointer; }
.mkt-etf-row.active strong { text-decoration: underline; }
.mkt-more { background: none; border: 0; color: #4fc3f7; padding: 2px 0; font-size: .76rem; cursor: pointer; text-align: left; }
.mkt-lower { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-top: 8px; }
.mkt-filter { display: flex; gap: 4px; margin-bottom: 4px; }
.mkt-filter .active { background: var(--bg-hover); border-color: var(--line-strong); }
.mkt-news, .mkt-evs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.mkt-news li { display: flex; flex-direction: column; font-size: .82rem; line-height: 1.3; }
.mkt-news a, .mkt-evs a { color: var(--text); text-decoration: none; }
.mkt-news a:hover, .mkt-evs a:hover { text-decoration: underline; }
.mkt-news .t-sub, .mkt-ev .t-sub { font-size: .7rem; }
.mkt-ev { display: grid; grid-template-columns: 118px 1fr auto; gap: 6px; font-size: .8rem; align-items: baseline; }
.mkt-ev-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.mkt-ev-act { grid-column: 2 / -1; display: flex; gap: 4px; }
.mkt-ev-fomc .mkt-ev-date { color: #ffb74d; }
.mkt-ev-cpi .mkt-ev-date { color: #4fc3f7; }
.mkt-ev-jobs .mkt-ev-date { color: #81c784; }
.mkt-warn { color: #ffb74d; }
.mkt-mine { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.mkt-mine summary { cursor: pointer; font-size: .82rem; }
.mkt-mine .mkt-evs { margin: 6px 0; }
.mkt-ev-form { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.mkt-ev-form .form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mkt-ev-form label { display: flex; flex-direction: column; font-size: .74rem; color: var(--muted); gap: 2px; }
.mkt-ev-form .mkt-wide { flex: 1 1 240px; }
.mkt-ev-form .notify-toggle { flex-direction: row; align-items: center; }
.mkt-err { color: var(--loss); }
.am-grid .am-mkt { order: 5; grid-column: 1 / -1; }
.mkt-am-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.mkt-am-cols > div > .mkt-tile-hd:first-child { margin-top: 0; }
@media (max-width: 900px) { .mkt-am-cols { grid-template-columns: minmax(0, 1fr); } }
.am-mkt .mkt-fund-table td, .am-mkt .mkt-fund-table th { font-size: .78rem; }
.am-mkt .mkt-avg td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.am-mkt .mkt-tile-hd { margin-top: 8px; }
.am-mkt .mkt-frow { margin-top: 6px; }
.settings-fred-row.hidden, .settings-fred-slot.hidden { display: none !important; }
@media (max-width: 1100px) { .mkt-tiles { grid-template-columns: repeat(3, minmax(150px, 1fr)); } }
@media (max-width: 640px) {
  .mkt-panel { padding: 8px; margin: 8px 0 12px; }
  .mkt-tiles { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .mkt-tile { flex: 0 0 72%; scroll-snap-align: start; }
  .mkt-lower { grid-template-columns: 1fr; }
  .mkt-ev { grid-template-columns: 112px 1fr; }
  .mkt-ev-in { grid-column: 2; }
}
.settings-fred-slot input, .mkt-ev-form input[type="date"], .mkt-ev-form input[type="time"], .mkt-ev-form input[type="url"], .mkt-ev-form input[type="text"], .mkt-ev-form select {
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 8px; padding: 6px 9px; font-family: var(--mono); font-size: .82rem; outline: none; color-scheme: dark;
}
.settings-fred-slot input { max-width: 420px; width: 100%; box-sizing: border-box; padding: 9px 12px; }
.mkt-ev-form .form-row { display: flex; }
.mkt-ev-form .form-row > label:not(.mkt-wide):not(.notify-toggle) { flex: 0 1 150px; }
.mkt-tiles { align-items: stretch; }
@media (max-width: 640px) { .mkt-ev-box { order: -1; } .mkt-lower { display: flex; flex-direction: column; } }
/* 1.5.18: missed-signal legend + tip on the chart */
.fc-miss-legend { position: absolute; left: 8px; top: 6px; z-index: 3; display: flex; gap: 10px; flex-wrap: wrap; font-size: .7rem; color: #c9d1e0;
  background: rgba(11,14,22,.78); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 3px 8px; pointer-events: none; }
.fc-miss-o { color: #b0bec5; }
.fc-miss-tip { position: absolute; z-index: 4; max-width: 260px; font-size: .74rem; color: #eef2fb; background: #151b2c; border: 1px solid rgba(255,179,0,.45);
  border-radius: 8px; padding: 4px 8px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.fc-miss-tip.hidden { display: none; }
.fc-fill-tip { border-color: rgba(0,229,160,.5); max-width: 280px; } /* 1.5.22 fills */
/* 1.5.18: Reserved table "At trigger / rung" column + Move-to-Kraken action line */
.am-res { min-width: 760px; }
.am-res .am-at-td { white-space: nowrap; }
.am-res .am-at .t-sub { font-size: .66rem; }
.am-move { display: block; color: var(--warn, #ffcc4d); font-size: .68rem; line-height: 1.35; margin-top: 2px; white-space: normal; font-family: var(--font); }
@media (max-width: 640px) {
  .am-res { min-width: 0; }
  .am-res td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; font-size: .72rem; text-align: left; }
  .am-res td:nth-child(5)::before { content: "At trigger / rung: "; color: var(--muted); }
  .am-res td:nth-child(5) .am-at { display: inline; }
  .am-res td:nth-child(5) .am-at .t-sub { display: inline; margin-left: 4px; }
  .am-res td:nth-child(6) { grid-column: 1 / -1; grid-row: 5; text-align: left; font-size: .7rem; }
  .am-res td:nth-child(6)::before { content: "Cash: "; color: var(--muted); }
  .am-res td:nth-child(7) { grid-column: 2; grid-row: 1; text-align: right; }
  .am-res tr.am-free td:nth-child(5) { display: none; }
  .am-res .am-at-td { white-space: normal; }
}
@media (max-width: 640px) {
  .am-res td:nth-child(5)::before, .am-res td:nth-child(6)::before { font-family: var(--font); }
  /* rows whose status carries a note / Move-to-Kraken line: give the status its own full-width line */
  .am-res tr:has(td:nth-child(7) .am-move) td:nth-child(7), .am-res tr:has(td:nth-child(7) div.t-sub) td:nth-child(7) { grid-column: 1 / -1; grid-row: 6; text-align: left; }
  .am-res td:nth-child(7) .am-move { text-align: left; }
}
/* 1.5.18: Layer ladder — starting ring-fence + gain */
.lst-box { margin: 8px 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.lst-hd { display: flex; align-items: center; gap: 8px; font-size: .8rem; margin-bottom: 4px; }
.lst-kv strong .t-sub { display: block; font-weight: 400; font-size: .68rem; }
.lst-edit { margin: 6px 0 10px; font-size: .78rem; }
.lst-edit summary { cursor: pointer; color: var(--muted); }
.lst-edit input { padding: 6px 8px; width: 100%; box-sizing: border-box; }
/* 1.5.18: asset chart currency switch */
.am-qsw { display: inline-flex; gap: 4px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); vertical-align: middle; }
.am-qsw .pot-tab { min-width: 40px; }
.am-qnote { flex-basis: 100%; font-size: .7rem; margin-top: 3px; }
@media (max-width: 640px) { .am-qsw { margin-left: 0; padding-left: 0; border-left: 0; } #fcPotBar.fc-bar { flex-wrap: wrap; overflow-x: visible; } }

/* ===== 1.5.19 Holding card: where it is (per wallet / account) ===== */
.am-wb { margin-top: 6px; }
.am-wb-table td.left strong { font-weight: 600; word-break: break-word; }
.am-wb-table tr.am-wb-tot td { border-bottom: 0; border-top: 1px solid var(--line-strong); font-weight: 600; }
.am-wb-table tr.am-wb-gap td.left strong { color: var(--warn); }
.am-wb-table tr.am-wb-more td { color: var(--muted); }
.am-wb-flag { color: var(--warn); font-size: .68rem; margin-top: 2px; font-family: var(--font); }
.am-wb-split { font-size: .68rem; margin-top: 3px; color: var(--text, #e6e8ef); font-family: var(--font); }
.am-wb-split .t-sub { font-size: .64rem; }
.am-wb > .am-wb-split { margin-top: 6px; }
.am-wb-table td:nth-child(4), .am-wb-table th:nth-child(4) { width: 3.6em; }
@media (max-width: 640px) {
  .am-wb-table thead { display: none; }
  .am-wb-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
  .am-wb-table td, .am-wb-table td:first-child { border: 0; padding: 0; min-width: 0; }
  .am-wb-table td.left { grid-column: 1 / -1; }
  .am-wb-table td:nth-child(2) { text-align: left; white-space: normal; }
  .am-wb-table td:nth-child(3) .fxpair { align-items: flex-end; }
  .am-wb-table td:nth-child(4) { width: auto; min-width: 3.4em; }
  .am-wb-table tr.am-wb-tot { border-top: 1px solid var(--line-strong); border-bottom: 0; }
  .am-wb-table tr.am-wb-tot td { border-top: 0; }
  .am-wb-table tr.am-wb-tot td.left { grid-column: 1 / -1; }
  .am-wb-table tr.am-wb-more td[colspan] { grid-column: 1 / -1; }
}
/* the bag table's global "td:first-child .t-sub { display: none }" must not hide the wallet sub-lines */
.am-wb-table td:first-child div.t-sub { display: block; }
.am-wb-table td:first-child span.t-sub { display: inline; }

/* 1.5.20 friend accounts: PAPER / LIVE */
.fr-badge { display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; vertical-align: middle; font-family: var(--mono); }
.fr-badge-paper { background: rgba(120, 140, 180, .18); color: #9fb3d9; border: 1px solid rgba(120, 140, 180, .35); }
.fr-badge-live { background: rgba(255, 90, 90, .16); color: #ff8a8a; border: 1px solid rgba(255, 90, 90, .45); }
.fr-mode { margin: 6px 0 8px; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(120, 140, 180, .4); background: rgba(120, 140, 180, .06); }
.fr-mode.fr-live { border: 1px solid rgba(255, 90, 90, .45); background: rgba(255, 90, 90, .06); }
.fr-mode .help { margin: 6px 0; }
.fr-mode-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; }
.fr-mode-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fr-keys-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: .82rem; }
.fr-live-modal .fr-live-ack { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--text); margin: 4px 0 12px; }
.fr-live-modal .fr-live-ack input { margin-top: 3px; }
.fr-live-modal input[type="text"] { width: 100%; box-sizing: border-box; }
.fr-layer-note { margin: 4px 0 8px; color: var(--muted); }
.pot-tab.active .fr-badge-paper { color: #fff; background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .45); }
.pot-tab.active .fr-badge-live { color: #fff; background: rgba(255, 70, 70, .55); }

/* 1.5.21: live chart badge, candle-close countdown, estimated liquidation levels (display only) */
.fc-live { margin-left: 8px; font-size: 11px; padding: 1px 7px; border-radius: 10px; white-space: nowrap; vertical-align: middle; }
.fc-live::before { content: "●"; margin-right: 4px; font-size: 9px; }
.fc-live-on { color: #81c784; background: rgba(129,199,132,.12); }
.fc-live-stale { color: #ffb74d; background: rgba(255,183,77,.14); }
.fc-live-closed, .fc-live-paused { color: #90a4ae; background: rgba(144,164,174,.12); }
.fc-countdown { position: absolute; right: 0; z-index: 4; pointer-events: none; text-align: center; font: 600 10.5px/16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #fff; background: rgba(38,166,154,.92); border-radius: 2px; padding: 0 2px; box-sizing: border-box; white-space: nowrap; overflow: hidden; }
.fc-countdown.fc-cd-dn { background: rgba(239,83,80,.92); }
.fc-countdown.fc-cd-closed { background: rgba(96,110,128,.92); font-size: 9.5px; }
.mkt-liq .mkt-lhead, .mkt-liq .mkt-lrow { display: grid; grid-template-columns: 2.6em 1fr 1fr; gap: 4px 8px; align-items: baseline; }
.mkt-liq .mkt-lrow { font-size: 12px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.mkt-liq .mkt-lhead { font-size: 10.5px; margin-bottom: 2px; }
.mkt-liq .mkt-lcoin { font-weight: 600; }
.mkt-liq .mkt-lup strong { color: #ce93d8; }
.mkt-liq .mkt-ldn strong { color: #ffb74d; }
.mkt-liq .mkt-lrow-na { grid-template-columns: 2.6em 1fr; }
@media (max-width: 640px) {
  .mkt-liq .mkt-lhead, .mkt-liq .mkt-lrow { grid-template-columns: 2.4em 1fr 1fr; gap: 2px 6px; }
  .mkt-liq .mkt-lcell { font-size: 11px; }
  .mkt-liq .mkt-lcell .t-sub { display: block; }
  .fc-live { display: inline-block; margin: 2px 0 0 0; }
}
@media (min-width: 1101px) { .mkt-tiles { grid-template-columns: repeat(4, minmax(150px, 1fr)); } .mkt-tiles .mkt-liq { grid-column: span 2; } }
@media (max-width: 1100px) and (min-width: 641px) { .mkt-tiles .mkt-liq { grid-column: 1 / -1; } }
@media (max-width: 640px) { .mkt-tiles .mkt-liq { flex: 0 0 92%; min-width: 260px; } }

/* ---- 1.5.22 tools: backtester + results by strategy ---- */
.bt-card, .sr-card { margin-top: 12px; }
.bt-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 10px; align-items: end; }
.bt-top label, .bt-grid label { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--muted, #9aa4b2); min-width: 0; }
.bt-top input, .bt-top select, .bt-grid input, .bt-grid select { width: 100%; min-width: 0; box-sizing: border-box; }
.bt-grid label.notify-toggle { flex-direction: row; align-items: center; }
.bt-cfgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; margin: 10px 0; }
.bt-cfg { border: 1px solid rgba(255,255,255,.08); border-top: 3px solid #4fc3f7; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bt-cfg-hd { display: flex; gap: 6px; align-items: center; }
.bt-cfg-name { flex: 1; min-width: 0; font-weight: 600; }
.bt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px 8px; }
.bt-rungs input[type=number] { width: 78px; }
.bt-rungs td, .bt-rungs th { padding: 2px 4px; text-align: left; }
.bt-res td, .bt-res th { white-space: nowrap; }
.bt-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin: 8px 0; }
.bt-chart { height: 260px; width: 100%; }
.bt-best td { background: rgba(0,229,160,.08); font-weight: 600; }
.bt-bb { margin-top: 10px; }
.bt-trades summary, .bt-bb summary { cursor: pointer; margin: 6px 0; }
.bt-fill-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px;
  background: rgba(255,179,0,.10); border: 1px solid rgba(255,179,0,.45); font-size: .82rem; }
input.bt-filled, select.bt-filled { outline: 2px solid rgba(255,179,0,.8); }
.sr-thin { background: rgba(255,179,0,.15); color: #ffcc80; font-size: .68rem; }
.sr-table td, .sr-table th { white-space: nowrap; }
.sr-table td.left { white-space: normal; min-width: 130px; }
.am-srres { order: 6; }
@media (max-width: 600px) {
  .bt-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-cfgs { grid-template-columns: minmax(0, 1fr); }
  .bt-charts { grid-template-columns: minmax(0, 1fr); }
  .bt-chart { height: 220px; }
}
/* 1.5.22: the tools' tables size to their content (the global table{min-width:1080px} is for the bag book) */
#btCard table, #srCard table, .am-srres table { min-width: 0; width: auto; max-width: none; }
#btCard .bt-res { min-width: min(100%, 420px); }
#btCard .bt-res td:not(.left) { text-align: right; }
@media (max-width: 600px) {
  #btCard .bt-res th, #btCard .bt-res td { padding: 4px 6px; font-size: .78rem; }
  #btCard .table-wrap, #srCard .table-wrap, .am-srres .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
/* the bag book's narrow sticky first column (phone) must not squeeze the tools' label column */
#btCard th:first-child, #btCard td:first-child, #srCard th:first-child, #srCard td:first-child,
.am-srres th:first-child, .am-srres td:first-child { width: auto; max-width: none; min-width: 0; }
#btCard td:first-child, #srCard td:first-child, .am-srres td:first-child { white-space: nowrap; }
#srCard td.left:first-child, .am-srres td.left:first-child { white-space: normal; min-width: 120px; }
.am-grid > .am-srres { grid-column: 1 / -1; }

/* 1.5.23: Layer ringfence = coins held (one-time recompute note / flag) */
.layer-rf-fix { margin: 6px 0 4px; padding: 8px 10px; border-radius: 8px; font-size: .8rem; line-height: 1.4; }
.layer-rf-fix.ok { background: rgba(0,229,160,.07); border: 1px solid rgba(0,229,160,.35); }
.layer-rf-fix.warn { background: rgba(255,179,0,.10); border: 1px solid rgba(255,179,0,.55); }

/* 1.5.23: Buy / Sell panel under the Holding card */
.am-trade { order: 1; }
@media (min-width: 901px) {
  .am-grid > .am-hold { grid-column: 1; grid-row: 1; }
  .am-grid > .am-trade { grid-column: 1; grid-row: 2; }
  .am-grid > .am-resv { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
}
.am-trade .mt-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.am-trade .mt-row select { flex: 1 1 auto; min-width: 0; }
.am-trade .mt-free { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; margin: 6px 0 8px; }
.am-trade .mt-free > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.am-trade .mt-free strong { font-family: var(--mono); font-size: .9rem; overflow-wrap: anywhere; }
.am-trade .mt-seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.am-trade .mt-seg .mt-gap { flex: 0 0 10px; }
.am-trade .mt-seg .mt-buy.active { background: rgba(38,166,154,.22); border-color: #26a69a; color: #fff; }
.am-trade .mt-seg .mt-sell.active { background: rgba(239,83,80,.22); border-color: #ef5350; color: #fff; }
.am-trade .mt-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 10px; }
.am-trade .mt-fields label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.am-trade .mt-fields input, .am-trade .mt-fields select { width: 100%; min-width: 0; }
.am-trade .mt-est { font-family: var(--mono); font-size: .76rem; margin: 8px 0 4px; min-height: 1.1em; }
.am-trade .mt-orders { margin-top: 8px; }
.am-pill.mt-paper { background: rgba(255,183,77,.2); color: #ffb74d; }
#confirmBody.pre-line { white-space: pre-line; text-align: left; line-height: 1.5; }
.fc-hl-row { display: flex; gap: 6px; margin: 6px 0 4px; }
.fc-hl-row input { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .am-trade .mt-free { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-trade .mt-seg button { flex: 1 1 22%; min-height: 40px; }
}
/* 1.5.24: backtest "Why" row (0 trades is never silent) */
#btCard .bt-res td .bt-why { white-space: normal; text-align: left; font-size: .82em; max-width: 26em; line-height: 1.3; }
#btCard .bt-res td .bt-why-zero { color: var(--warn, #d9a400); }
/* 1.5.25: trading guards */
.event-pause-banner { margin: 6px 12px; padding: 10px 14px; border-radius: 10px; background: rgba(217,164,0,.16); border: 1px solid rgba(217,164,0,.55); color: var(--text, #eee); font-size: .92em; line-height: 1.4; }
.event-pause-banner.hidden { display: none; }
.alloc-tile .at-blowoff, .guards-asset .at-blowoff { display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 8px; background: #c0392b; color: #fff; font-size: .72em; font-weight: 600; white-space: nowrap; }
#settingsGuards .guards-sec { border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; margin-top: 8px; }
#settingsGuards .guards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
#settingsGuards .guards-grid label { font-size: .88em; }
#settingsGuards .guards-assets { display: flex; flex-direction: column; gap: 4px; }
#settingsGuards .guards-asset span { font-size: .88em; }
/* 1.5.25: backtest history sources */
#btCard .bt-src .bt-src-row { font-size: .88em; }
#btCard .bt-src .bt-src-cross { color: var(--warn, #d9a400); }
#btCard .bt-src .bt-src-clip, #btCard .bt-src .bt-src-bf { color: var(--warn, #d9a400); }
/* 1.5.26: stop-losses */
.stop-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.02); }
.stop-box.stop-on { border-color: rgba(229,57,53,.55); background: rgba(229,57,53,.06); }
.stop-box.stop-fired { border-color: #e53935; background: rgba(229,57,53,.14); }
.stop-box .stop-hd { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; }
.stop-box .stop-st { font-size: .88em; }
.stop-box .stop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 10px; margin-top: 8px; }
.stop-box .stop-grid label { font-size: .86em; display: flex; flex-direction: column; gap: 3px; }
.stop-box .stop-why { font-size: .82em; }
.strat-stop-box.hidden { display: none; }
.stop-box .stop-refused { margin: 6px 0 0; padding: 7px 10px; border-radius: 8px; background: rgba(229,57,53,.18); border: 1px solid #e53935; color: #ffb4b0; font-size: .9em; }
/* 1.5.27: Kraken below-trigger limit bids */
.krbid-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.krbid-line .krbid-btn { margin-left: 2px; }
.krbid-line, .trig-note { overflow-wrap: anywhere; white-space: normal; } /* 1.5.27.1: full why-not text, wrapped */
/* 1.5.27.5: note above BAG's chart when Layer lines can't be dragged yet */
.fc-lb-note { margin: 2px 0 4px; font-size: .78rem; color: var(--muted, #9aa3b5); }
.fc-grip-lb.fc-grip-bb { background: #43a047; z-index: 3; }
.fc-grip-lb.fc-grip-live { z-index: 4; }
/* 1.5.27.5: asset panel Layer card — the order status (BAG limit orders) wraps instead of running off the card */
.am-layer-rungs td:last-child { white-space: normal; font-size: .7rem; }
.am-layer-rungs td:last-child .lb-ord { white-space: normal; }

/* 1.5.28.1: BAG ladder card header — link to the full chart */
.lb-chart-link { margin-left: 6px; white-space: nowrap; }

/* 1.5.28.3: Trading 212 ladder — ringfence bigger than the real holding; per-rung notes */
.lb-held-warn { border: 1px solid #e53935; background: rgba(229,57,53,.14); color: #ff8a80; border-radius: 10px; padding: 8px 10px; margin: 8px 0; line-height: 1.4; }
.lb-held-warn strong { color: #ff6b6b; }
.lb-held-warn button { margin-left: 6px; }
.lb-rung-msg { font-size: .85em; }
.lb-rung-wait { color: #ffb454; }
/* 1.5.28.6: a rung waiting for the price (Trading 212 "too far") wraps instead of stretching the table */
.lb-rung-msg[data-lb-far-wait] { display: inline-block; white-space: normal; max-width: 22em; text-align: left; vertical-align: middle; line-height: 1.35; }
@media (max-width: 640px) { .lb-rung-msg[data-lb-far-wait] { max-width: 14em; } }
.lb-rung-bad { color: #ff6b6b; }

/* 1.5.28.4 (display only): a Layer ladder run by BAG (BAG / BAG limit orders) hides the TradingView-only parts.
   They stay in the page (their saved values are kept) and come back when Run by is TradingView webhook. */
#layerScaleView.lp-bag .lp-tv-only { display: none !important; }
#layerScaleView.lp-bag #layerPlanTable th:nth-child(n+3):nth-child(-n+7),
#layerScaleView.lp-bag #layerPlanTable td:nth-child(n+3):nth-child(-n+7) { display: none; }
/* 1.5.28.5: Layer ladder price currency + "would trade straight away" warning (display only) */
.lb-mkt-warn ul { margin: 4px 0 4px 18px; padding: 0; }
.lb-mkt-warn li { margin: 2px 0; }
.lb-unit { margin: 6px 0 2px; }
.lb-unit-tag { font-weight: normal; }
.fc-lb-mkt { margin: 2px 0 6px; font-size: .82rem; padding: 6px 8px; }

/* 1.5.28.7: Layer rung levels could not load (note above the chart) */
.fc-lb-lverr { color: #ffb454; }

/* 1.5.28.20: Charts tab — asset search + chips above the full chart (display only) */
.fc-charts-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.fc-charts-pick.hidden { display: none; }
.fc-charts-search { flex: 0 1 220px; min-width: 0; padding: 6px 10px; border-radius: 10px; font-size: .85rem;
  background: var(--panel, #121725); color: inherit; border: 1px solid rgba(255,255,255,.14); }
.fc-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 300px; min-width: 0; max-height: 72px; overflow-y: auto; }
.fc-chip { border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.fc-chip.active { background: var(--accent-dim, rgba(79,195,247,.18)); border-color: var(--accent, #4fc3f7); color: #fff; }
@media (max-width: 640px) {
  .fc-charts-pick { flex-wrap: nowrap; }
  .fc-charts-search { flex: 0 0 34%; font-size: 16px; padding: 7px 9px; }
  .fc-chips { flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .fc-chip { min-height: 36px; }
}

/* 1.5.28.21 Entry: sub-tabs, Value-now cards, This month card, Autoinvest warning */
.entry-subtabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.entry-subtab {
  flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line, rgba(255,255,255,0.14));
  background: transparent; color: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.entry-subtab.active { background: var(--accent, #6ea8ff); color: #0b0f1a; border-color: transparent; }
.entry-sec.hidden { display: none !important; }
.plan-tile.entry-vcard { font-weight: 500; padding: 9px 11px; }
.entry-vcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.entry-vcard-tk { font-weight: 700; font-size: 0.9rem; }
.entry-vcard-nm { color: var(--muted, #9aa4b2); font-size: 0.74rem; }
.entry-vcard-note { color: var(--muted, #9aa4b2); font-size: 0.72rem; margin-top: 4px; }
.entry-vcard-skip { opacity: 0.75; background: rgba(255,255,255,0.02); border-color: var(--line, rgba(255,255,255,0.14)); }
.entry-sc { font-size: 0.72rem; font-weight: 700; border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.entry-sc-g { color: #0b0f1a; background: #3dffb0; }
.entry-sc-f { color: #0b0f1a; background: #ffb020; }
.entry-sc-s { color: #fff; background: #ff5d73; }
.entry-sc-x { color: #c9d2df; background: #2a3246; }
.entry-vbar { height: 5px; border-radius: 4px; background: rgba(255,255,255,0.08); margin: 5px 0 4px; overflow: hidden; }
.entry-vbar i { display: block; height: 100%; background: var(--accent, #6ea8ff); }
.entry-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.entry-chips span { font-size: 0.7rem; color: #c9d2df; background: rgba(255,255,255,0.07); border-radius: 999px; padding: 1px 7px; }
.entry-score-help { font-size: 0.74rem; }
.entry-month-card { padding: 10px 12px; margin: 6px 0 12px; }
.entry-month-hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.entry-pill { font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line, rgba(255,255,255,0.14)); color: var(--muted, #9aa4b2); white-space: nowrap; }
.entry-pill.off { color: #ffb020; border-color: rgba(255,176,32,0.45); }
.entry-pill.on { color: #3dffb0; border-color: rgba(61,255,176,0.45); }
.entry-pill.warn { color: #6ea8ff; border-color: rgba(110,168,255,0.55); }
.entry-kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 0.82rem; margin: 6px 0; color: inherit; }
.entry-kv span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.entry-month-rows { margin-top: 4px; }
.entry-month-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line, rgba(255,255,255,0.1)); color: inherit; }
.entry-month-row-l { flex: 1; min-width: 0; }
.entry-month-row-r { text-align: right; font-variant-numeric: tabular-nums; }
.entry-month-note { font-size: 0.76rem; color: var(--muted, #9aa4b2); margin: 6px 0 0; }
.entry-month-btns { display: flex; gap: 8px; margin-top: 10px; }
.entry-month-btns button { flex: 1; padding: 10px; border-radius: 10px; font-weight: 650; }
.entry-month-btns.hidden { display: none; }
.entry-set-card { padding: 10px 12px; margin: 6px 0 12px; }
.entry-autoinvest-warn {
  margin: 4px 0 10px; padding: 9px 11px; border-radius: 10px; font-size: 0.8rem; line-height: 1.35;
  background: rgba(255, 176, 32, 0.12); border: 1px solid rgba(255, 176, 32, 0.5); color: #ffd27a;
}
.entry-excl-note { font-size: 0.74rem; }
@media (max-width: 640px) {
  #entryTiles.plan-tile-grid.entry-vcards { grid-template-columns: 1fr; }
}
.entry-month-skip { font-size: 0.74rem; color: #ffb020; margin-top: 6px; }

/* 1.5.28.22: ± beside number fields that can be negative (phone keypads with no "-") */
.neg-wrap { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.neg-wrap > input { flex: 1 1 auto; min-width: 0; width: auto; }
.neg-toggle {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; margin: 0;
  padding: 0 6px; border-radius: 8px; border: 1px solid var(--line, rgba(255,255,255,0.18)); background: rgba(255,255,255,0.06);
  color: inherit; font-weight: 700; font-size: 0.95rem; line-height: 1; cursor: pointer; vertical-align: middle; flex: 0 0 auto;
}
.neg-toggle:active { background: rgba(110,168,255,0.25); }
.neg-toggle:disabled { opacity: 0.4; }
/* 1.5.28.23: AJ Bell SIPP pair (alerts only) */
.ps-act { margin-bottom: 8px; }
.ps-act.hidden { display: none !important; }
#pairSippBox .ps-mode label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
/* 1.5.28.24: exit-plan backtest (under each plan's Backstop) */
.xbt-wrap { margin: 6px 0 10px; }
.xbt-card { margin-top: 6px; }
.xbt-card table { min-width: 0; width: auto; max-width: none; }
.xbt-res td.xbt-best { background: rgba(0,229,160,.10); font-weight: 600; }
.xbt-cfg .bt-grid label.notify-toggle { grid-column: 1 / -1; }
.xbt-assume { margin: 4px 0 4px 18px; padding: 0; }
.xbt-assume li { margin: 2px 0; }
.xbt-card .neg-wrap { display: flex; gap: 4px; align-items: center; }
.xbt-card .neg-wrap input { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .xbt-card .bt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xbt-fill-bar { font-size: .8rem; }
}
.xbt-cfg .bt-grid label.notify-toggle { flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; color: inherit; font-size: .8rem; }
.xbt-cfg .bt-grid input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }
.xbt-res th, .xbt-res td { padding: 6px 6px; }
.xbt-res td .t-sub { font-size: .7rem; white-space: nowrap; }
.xbt-res thead button { max-width: 120px; white-space: normal; line-height: 1.15; }
.xbt-cfg .bt-grid label.xbt-full { grid-column: 1 / -1; }
/* 1.5.28.25: Entry holdings with no usable price history */
.entry-vcard-nodata { opacity: .8; background: rgba(255,255,255,0.02); border-style: dashed; }
.entry-vcard-nodata .entry-vcard-note { color: var(--muted, #9aa4b2); }

/* 1.5.28.25: This month — when the fixed list was worked out + Recalculate */
.entry-month-recalc { margin-top: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08); }
.entry-month-recalc.is-stale { border-color: rgba(245,180,60,0.55); background: rgba(245,180,60,0.07); }
.entry-month-recalc .help { margin: 4px 0 0; }

/* 1.5.28.26: Strategy pot ring-fence line */
.strat-may-use { margin: 6px 0 4px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(120,170,255,0.35); background: rgba(120,170,255,0.07); font-size: 0.92em; }
.strat-may-use.is-warn { border-color: rgba(245,180,60,0.6); background: rgba(245,180,60,0.08); }
.strat-may-use-warn { display: block; margin-top: 3px; color: #f5b43c; }

/* 1.5.28.28 Crypto.com Exchange pot panel */
.strat-cdc-panel { width: 100%; margin-top: 10px; padding: 10px 12px; min-height: 0; height: auto; align-self: flex-start; flex: 0 0 100%; }
.strat-cdc-panel .cdc-hd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.strat-cdc-panel .cdc-err { color: #ff8a8a; margin: 6px 0; font-size: .86rem; overflow-wrap: anywhere; }
.strat-cdc-panel .cdc-warn { color: #f0c060; }
.strat-cdc-panel code { font-family: var(--mono); overflow-wrap: anywhere; }

/* 1.5.28.28: crypto Entry rows + crypto exit plans (alerts only) */
.cx-exit, .cx-entry { margin-top: 14px; padding: 12px 14px; }
.cx-hd, .cx-plan-hd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.cx-hd .tiny { margin-left: auto; }
.cx-alert-badge { display: inline-block; font-size: .66rem; font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px;
  background: rgba(240, 192, 96, .16); color: #f0c060; border: 1px solid rgba(240, 192, 96, .55); font-family: var(--mono); }
.cx-plan { margin-top: 10px; padding: 10px 12px; }
.cx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 6px 0; }
.cx-stats > div { display: flex; flex-direction: column; gap: 1px; }
.cx-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 6px 0; }
.cx-form label { display: flex; flex-direction: column; gap: 2px; font-size: .82rem; }
.cx-form label.notify-toggle { flex-direction: row; align-items: center; }
.cx-table td, .cx-table th { text-align: left; }
.cx-table td { vertical-align: middle; }
.cx-table .neg-wrap { display: inline-flex; width: auto; vertical-align: middle; }
.cx-table input[type=number], .cx-table .neg-wrap > input[type=number] { width: 78px; flex: 0 0 auto; display: inline-block; }
.cx-table .neg-toggle { min-width: 32px; height: 32px; }
.cx-form input[type=number] { width: 120px; }
.cx-pending { margin: 8px 0; padding: 8px 10px; }
.cx-pending ul { margin: 4px 0 4px 18px; padding: 0; }
.cx-st { font-size: .74rem; color: var(--muted, #9aa); }
.cx-st-hit { color: #f0c060; font-weight: 700; }
.cx-st-done { color: #7fd18b; font-weight: 700; }
.cx-score { font-weight: 700; white-space: nowrap; }
.cx-score-good { color: #7fd18b; }
.cx-score-fair { color: #f0c060; }
.cx-score-stretched { color: #ff8a8a; }
.cx-log { margin-top: 6px; overflow-wrap: anywhere; }
.cx-levels, .cx-record, .cx-bt { margin-top: 6px; }
.cx-levels summary, .cx-record summary, .cx-bt summary { cursor: pointer; font-weight: 600; }
.cx-table td:first-child { white-space: nowrap; }
.cx-table td:first-child .notify-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
@media (max-width: 640px) {
  #cxEntryTable thead { display: none; }
  #cxEntryTable, #cxEntryTable tbody { display: block; width: 100%; min-width: 0 !important; }
  #cxEntryTable tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line, rgba(255,255,255,.12)); }
  #cxEntryTable td { text-align: left; padding: 0; border: 0; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  #cxEntryTable td.cx-coin { grid-column: 1 / 3; }
  #cxEntryTable td.cx-sc { grid-column: 3; grid-row: 1; text-align: right; }
  #cxEntryTable td[data-l]::before { content: attr(data-l); display: block; font-size: .66rem; color: var(--muted, #8a93a6); }
  #cxEntryTable td.cx-sc::before { display: none; }
  .cx-table input[type=number], .cx-table .neg-wrap > input[type=number] { width: 64px; }
  .cx-table td, .cx-table th { padding: 6px 4px; font-size: .8rem; }
  .cx-plan .cx-table thead { display: none; }
  .cx-plan .cx-table, .cx-plan .cx-table tbody { display: block; width: 100%; }
  .cx-plan .cx-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(255,255,255,.12)); }
  .cx-plan .cx-table td { padding: 0; border: 0; white-space: normal; min-width: 0; }
  .cx-plan .cx-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .cx-plan .cx-table td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  .cx-plan .cx-table td:nth-child(2), .cx-plan .cx-table td:nth-child(3) { grid-column: 1 / 3; }
  .cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cx-entry .table-wrap { max-height: none; }

/* 1.5.28.28.1 Ring-fenced cash box (Entry → This month, under Pools) */
.ring-fenced { margin: 0 0 14px; padding: 10px 12px; min-height: 0; }
.ring-fenced-shares { margin: 12px 0; }
.ring-fenced .rf-help { margin: 2px 0 8px; }
.rf-acct { border: 1px solid var(--line, rgba(255,255,255,0.12)); border-radius: 10px; background: rgba(255,255,255,0.03); margin: 6px 0; max-width: 100%; }
.rf-sum { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 44px; padding: 10px 12px; -webkit-tap-highlight-color: transparent; }
.rf-sum::-webkit-details-marker { display: none; }
.rf-sum::before { content: "▸"; opacity: 0.6; }
.rf-acct[open] > .rf-sum::before { content: "▾"; }
.rf-name { font-weight: 650; }
.rf-total { margin-left: auto; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rf-sub { flex-basis: 100%; font-size: 0.8rem; }
.rf-detail { padding: 0 12px 10px; font-size: 0.88rem; }
.rf-list, .rf-sublist { list-style: none; margin: 0; padding: 0; }
.rf-list > li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line, rgba(255,255,255,0.08)); }
.rf-list > li > span:first-child { flex: 1 1 10rem; overflow-wrap: anywhere; }
.rf-list b { font-variant-numeric: tabular-nums; }
.rf-sublist { flex-basis: 100%; padding-left: 12px; }
.rf-sublist > li { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 3px 0; font-size: 0.82rem; opacity: 0.9; }
.rf-sublist > li > span:first-child { flex: 1 1 8rem; }

/* 1.5.28.28.2: "(Terra Classic)" note on a Kraken LUNA wallet row */
.w-coin-note { display: block; color: var(--muted); font-size: .72rem; line-height: 1.2; margin-top: 2px; white-space: nowrap; }
