/* ===== Investments page — 2026 redesign =====
   Layout, hero, tax card, holdings table/rows, trade sheet and detail view.
   Loaded after style.css; only overrides what this page needs. */

[hidden] { display: none !important; }

/* Read-only viewer: the server stamps <html class="viewer-mode">. style.css carries the same owner-only
   rule; it is repeated here so this page can never show a write control if that rule moves. */
.viewer-mode .owner-only { display: none !important; }

/* ---------- page grid ---------- */
.inv-page { display: flex; flex-direction: column; gap: 14px; }
.inv-page .card { margin-bottom: 0; }
.inv-top { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.inv-grid { display: grid; gap: 14px; align-items: start; }
.inv-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .inv-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-top { grid-template-columns: 1fr; }
}
/* Viewers have no AI card (owner-only), so Recent trades | Closed share the row instead of leaving a gap.
   On phones .inv-grid is display:contents, so this has no effect there. */
.viewer-mode #history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- shared bits ---------- */
.ch { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch .card-title { margin-bottom: 0; }
.ch-sub { font-size: 12px; color: var(--text-dim); }
.dim { color: var(--text-dim); }
.tn { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.c { text-align: center; }
.inv-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--blue);
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.inv-link svg { flex-shrink: 0; }
.btn svg { flex-shrink: 0; }
.top-bar .actions a.btn { text-decoration: none; }

.segmented.seg-sm { display: inline-flex; }
.segmented.seg-sm button { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; border-radius: 10px; }
.segmented.seg-sm button.active { box-shadow: 0 1px 4px rgba(0,0,0,0.18); }
.segmented.seg-fill { display: flex; }
.segmented.seg-fill button { flex: 1 1 0; }

.inv-field {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-input); color: var(--text);
  font-size: 13px; font-family: inherit; font-weight: 500;
}
.inv-field:focus { outline: none; border-color: var(--primary); }
select.inv-field { -webkit-appearance: none; appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2370757A' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

.inv-page .stat-tile { padding: 10px 6px; border-radius: 10px; }
.inv-page .stat-tile .value { font-variant-numeric: tabular-nums; }
.stat-tile .sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.tiles-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tiles-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tiles-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
@media (max-width: 640px) {
  .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.note-blue {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(26,115,232,0.07); border: 1px solid rgba(26,115,232,0.18);
  font-size: 13px;
}
.note-blue svg { flex-shrink: 0; }
.note-blue .t { font-weight: 600; }
.note-blue .s { font-size: 12px; color: var(--text-dim); }
.info-line { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.info-line svg { flex-shrink: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.legend i.line { width: 14px; height: 2px; border-radius: 0; }
.legend i.dash { width: 14px; height: 0; border-top: 2px dashed var(--primary); background: none; }
.legend i.band { width: 14px; height: 8px; }

/* ---------- hero ---------- */
.gf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main side" "pills pills" "chead chead" "chart chart";
  gap: 0 16px;
  align-items: start;
  padding: 20px 22px;
  flex-wrap: nowrap;
}
.gf-main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gf-side { grid-area: side; text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.gf-pills { grid-area: pills; }
.gf-chart-head { grid-area: chead; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.gf-chart-head .card-title { margin-bottom: 0; }
.gf-chart { grid-area: chart; position: relative; height: 200px; margin-top: 8px; }
.gf-hero .market-clock {
  margin: 6px 0 0; padding: 5px 10px; gap: 8px; font-size: 12px; border-radius: 10px;
  display: inline-flex; white-space: nowrap;
}
.gf-hero .market-clock .mc-time { margin-left: 0; font-size: 12px; }
.gf-hero .market-clock .mc-et { font-size: 12px; font-weight: 700; color: var(--text); }
.gf-hero .market-clock .mc-status { font-size: 12px; }

/* ---------- tax card ---------- */
.tax-big { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tax-big .v { font-size: 34px; font-weight: 800; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; color: var(--green); }
.tax-big .l { font-size: 13px; color: var(--text-dim); }
.tax-net { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.tax-box { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--glass-border); }
.tax-box .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tax-box .row + .row { margin-top: 6px; }
.tax-box .row .l { font-size: 12px; color: var(--text-dim); }
.tax-box .row .v { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tax-box .row .v.big { font-size: 15px; font-weight: 800; }

/* mobile-only tax strip + tabs */
.tax-strip { display: none; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.viewer-mode .tax-strip { cursor: default; } /* viewers: figures only, no link to /tax.html */
.tax-strip .ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(24,128,56,0.10); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tax-strip .body { flex: 1 1 0; min-width: 0; }
.tax-strip .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tax-strip .head .v { font-size: 18px; font-weight: 800; color: var(--green); white-space: nowrap; }
.tax-strip .sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
#mobile-tabs { display: none; margin-bottom: 0; }

/* ---------- holdings ---------- */
.h-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.h-title { display: flex; align-items: baseline; gap: 10px; }
.h-title .card-title { margin-bottom: 0; }
.h-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.h-search { width: 220px; }
/* funnel button — phones only (see the ≤768px block); lit when a type/signal filter is active */
.h-filter-btn { display: none; width: 40px; height: 40px; padding: 0; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; color: var(--text); }
.h-filter-btn svg { display: block; }
.h-filter-btn.active { border-color: var(--primary); color: var(--primary); }
.h-scroll { overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; }
.h-table { min-width: 1080px; }
.h-tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 56px 60px 80px 92px 80px 100px 110px 118px 96px 136px;
  gap: 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 13px;
}
/* Read-only (viewer) table: the 136px Trade column is not rendered, so the name column takes the space */
.h-table.ro .h-tr { grid-template-columns: minmax(0, 1fr) 72px 56px 60px 80px 92px 80px 100px 110px 118px 96px; }
.h-tr.h-th { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; padding: 10px 0 8px; cursor: default; }
@media (hover: hover) { .h-tr:not(.h-th):hover { background: rgba(148,163,184,0.06); } }
.h-sym { font-weight: 700; font-size: 14px; }
.h-name { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-sub { font-size: 11px; }
.h-weight { display: flex; align-items: center; gap: 8px; }
.h-weight .bar { flex: 1 1 0; height: 6px; border-radius: 3px; background: var(--bg-input); overflow: hidden; }
.h-weight .bar i { display: block; height: 100%; border-radius: 3px; background: var(--blue); }
.h-weight span { font-size: 12px; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.h-trade { display: flex; gap: 6px; justify-content: center; }
.btn-quick.sm { flex: 0 0 auto; padding: 6px 10px; }
.h-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; }
.h-more { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--blue); background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.h-more svg { transition: transform 0.15s; }
.h-more.open svg { transform: rotate(180deg); }
.h-totals { display: flex; gap: 18px; font-size: 13px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.h-totals span { color: var(--text-dim); }
.h-totals b { color: var(--text); }

/* mobile holding rows */
.hm-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.hm-top { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.hm-main { flex: 1 1 0; min-width: 0; }
.hm-sym { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.hm-meta { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.hm-right { text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hm-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.hm-actions .btn-quick { flex: 1 1 0; }
.hm-tax { font-size: 11px; color: var(--text-dim); white-space: nowrap; margin-left: 4px; }
/* Read-only (viewer) phone row: no Buy/Sell buttons, the tax hint sits under the meta line */
.hm-actions.ro { margin-top: 6px; }
.hm-actions.ro .hm-tax { margin-left: 0; }
.hm-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 14px 0 4px; font-size: 14px; font-weight: 600; color: var(--blue); background: none; border: none; cursor: pointer; font-family: inherit; }

/* ---------- allocation / movers / signals ---------- */
.alloc-wrap { display: flex; align-items: center; gap: 18px; margin-top: 10px; }
.alloc-donut { position: relative; width: 124px; height: 124px; flex-shrink: 0; }
.alloc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.alloc-center .n { font-size: 20px; font-weight: 800; line-height: 1; }
.alloc-center .l { font-size: 10px; color: var(--text-dim); margin-top: 3px; letter-spacing: 0.4px; }
.alloc-legend { flex: 1 1 0; min-width: 0; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 4px 0; }
.legend-row .n { display: inline-flex; align-items: center; gap: 8px; }
.legend-row .v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.sector-wrap { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.sector-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; }
.sector-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.sector-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sector-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.sector-legend b { color: var(--text); }

.mv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.mv-row .sym { font-weight: 700; min-width: 52px; }
.mv-row .name { flex: 1 1 0; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-row .abs { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.mv-row .pct { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.mv-lag { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-top: 10px; }

#signals-ai { margin-top: 8px; font-size: 13px; line-height: 1.5; padding: 8px 10px; border-radius: 8px; background: rgba(59,130,246,0.07); border: 1px solid rgba(59,130,246,0.18); }
#signals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.sig-head { font-weight: 700; font-size: 11px; letter-spacing: 0.5px; margin-bottom: 2px; }
.signal-row { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }

/* ---------- charts ---------- */
.chart-h { position: relative; margin-top: 10px; }
.chart-h.h110 { height: 110px; }
.chart-h.h190 { height: 190px; }

/* ---------- recent / closed / news / ai ---------- */
.rt-realized { font-size: 11px; font-weight: 600; white-space: nowrap; }
.closed-best { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.closed-best .box { padding: 10px 12px; background: var(--bg); border-radius: 10px; }
.closed-best .lbl { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.closed-best .row { display: flex; justify-content: space-between; margin-top: 4px; font-weight: 700; gap: 8px; }
.closed-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.closed-item:last-child { border-bottom: none; }
.news-item svg { flex-shrink: 0; margin-top: 2px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 500; background: var(--bg-input); border: 1px solid var(--border); cursor: pointer; color: var(--text); font-family: inherit; }
#ai-question { margin-top: 10px; width: 100%; height: 40px; font-size: 13px; box-sizing: border-box; }

/* ---------- detail view ---------- */
/* top bar: chevron back inside the title + a single ⋯ menu (HoldingDetail.dc.html) */
.d-h1 { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.d-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.d-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-left: -6px; padding: 0; flex-shrink: 0;
  border: none; border-radius: 8px; background: none; color: var(--text-dim); cursor: pointer;
}
.d-back svg { display: block; }
.d-back:active { opacity: 0.6; }
@media (hover: hover) { .d-back:hover { background: var(--bg-input); color: var(--text); } }
.d-menu-wrap { position: relative; }
.d-menu-btn { width: 36px; min-width: 36px; padding: 0; border-radius: 12px; }
.d-menu-btn svg { display: block; }
.d-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 120;
  display: flex; flex-direction: column; min-width: 180px; padding: 6px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.d-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: none; border-radius: 8px; background: none; color: var(--text);
  font-size: 14px; font-weight: 500; font-family: inherit; text-align: left; cursor: pointer; white-space: nowrap;
}
.d-menu button svg { flex-shrink: 0; }
.d-menu button.danger { color: var(--red); }
@media (hover: hover) { .d-menu button:hover { background: var(--bg-input); } }
.d-price { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.d-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding: 10px; background: var(--bg); border-radius: 16px; }
.d-strip > div { text-align: center; }
.d-strip .l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
.d-strip .v { font-weight: 700; }
.d-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; font-size: 14px; margin-top: 12px; }
.d-grid span { color: var(--text-dim); }
.d-grid div div { font-weight: 600; }
.d-actions { display: flex; gap: 10px; }
.d-big { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: 16px; font-size: 15px; font-weight: 700; color: #fff; border: none; cursor: pointer; font-family: inherit; }
.d-big.buy { background: var(--green); }
.d-big.sell { background: var(--red); }
.d-big:active { opacity: 0.8; }
.lot-tr { display: grid; grid-template-columns: 96px 44px 74px minmax(0, 1fr) 72px; gap: 6px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; font-variant-numeric: tabular-nums; }
.lot-tr.lot-th { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; padding: 10px 0 6px; }
.lot-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 10px; font-size: 13px; flex-wrap: wrap; }
/* Phones: the fixed 96/44/74/72 px columns left Gain ~0 px at 375 px, so its figure ran into
   Tax. Narrower fixed columns and a floor under Gain and Tax. */
@media (max-width: 420px) {
  .lot-tr { grid-template-columns: 70px 34px 60px minmax(64px, 1fr) minmax(52px, auto); gap: 4px; font-size: 12px; }
  .lot-tr .h-sub { font-size: 10px; }
}
.detail-txn { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; gap: 8px; }
.detail-txn:last-child { border-bottom: none; }
.detail-txn .acts { display: flex; gap: 6px; align-items: center; }
.detail-txn .acts .btn { min-height: auto; padding: 2px 8px; font-size: 11px; }
@media (min-width: 900px) {
  .detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .detail-grid .card { margin-bottom: 0; }
  .detail-grid .d-col { display: flex; flex-direction: column; gap: 14px; }
}

/* ---------- trade sheet ---------- */
.trade-sheet { display: flex; flex-direction: column; gap: 14px; }
.trade-sheet form { display: flex; flex-direction: column; gap: 14px; }
.ts-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ts-sym { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ts-name { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.ts-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ts-close { width: 36px; height: 36px; border-radius: 12px; border: none; background: var(--bg-input); color: var(--text-dim); font-size: 22px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ts-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-size: 13px; color: var(--text-dim); font-weight: 500; }
.ts-mode { display: inline-flex; gap: 10px; }
.ts-mode button { background: none; border: none; padding: 0 0 1px; color: var(--text-dim); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; font-size: 12px; font-family: inherit; }
.ts-mode button.active { color: var(--text); border-bottom-color: var(--primary); }
.ts-big {
  display: flex; align-items: stretch; min-height: 52px;
  border: 1px solid var(--primary); box-shadow: 0 0 0 3px rgba(255,159,10,0.18);
  border-radius: 13px; background: var(--bg-input); overflow: hidden;
}
.ts-big button { width: 52px; border: none; background: transparent; color: var(--text); font-size: 22px; cursor: pointer; flex-shrink: 0; }
.ts-big input { flex: 1 1 0; min-width: 0; text-align: center; border: none; background: transparent; color: var(--text); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; outline: none; font-family: inherit; }
.ts-big input::-webkit-outer-spin-button, .ts-big input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ts-big input[type=number] { -moz-appearance: textfield; }
.ts-big .pre { display: inline-flex; align-items: center; padding-left: 16px; color: var(--text-dim); font-weight: 600; font-size: 26px; }
.ts-big .pre + input { text-align: left; padding-left: 4px; }
.ts-chips { display: flex; gap: 6px; margin-top: 8px; }
.ts-chips button { flex: 1 1 0; min-height: 36px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); cursor: pointer; font-family: inherit; }
.ts-chips button.active { background: var(--text); color: var(--bg-card); border-color: var(--text); }
.ts-fields { display: flex; gap: 12px; }
.ts-field { flex: 1 1 0; min-width: 0; }
.ts-field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 4px; font-weight: 500; }
.ts-input-wrap { position: relative; display: flex; align-items: center; }
.ts-input-wrap input { width: 100%; padding: 0 13px; min-height: 46px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-input); color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; font-family: inherit; }
.ts-input-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,159,10,0.18); }
.ts-live { position: absolute; right: 10px; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--green); background: rgba(24,128,56,0.10); padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.trade-sheet .trade-total { margin-bottom: 0; }
.trade-sheet .trade-total .tt-value { line-height: 1.15; }
.trade-sheet .trade-total .tt-value small { font-size: 16px; font-weight: 600; color: var(--text-dim); }
.tt-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ts-preview { padding: 12px 14px; border-radius: 14px; background: rgba(26,115,232,0.06); border: 1px solid rgba(26,115,232,0.18); }
.ts-preview.plain { background: var(--bg); border-color: var(--glass-border); }
.ts-preview.plain .ts-line { border-top-color: var(--border); }
.ts-pv-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-dim); }
.ts-pv-title { color: var(--blue); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.ts-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; padding: 4px 0; }
.ts-row .l { color: var(--text-dim); flex-shrink: 0; }
.ts-row .v { font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }
.ts-row .v.strong { font-weight: 700; }
.ts-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(26,115,232,0.18); font-size: 13px; font-weight: 600; }
.ts-line svg { flex-shrink: 0; }
.ts-line.ok { color: var(--green); }
.ts-line.fee { color: var(--red); }
.ts-line.muted { color: var(--text-dim); font-weight: 500; }
.ts-after { font-size: 12px; color: var(--text-dim); text-align: center; }
.ts-error { font-size: 13px; color: var(--red); font-weight: 600; text-align: center; }
#txn-submit-btn { min-height: 52px; font-size: 16px; border-radius: 16px; color: #fff; }
#txn-submit-btn.btn-success { color: #fff; }
#txn-submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- phone (≤768px) ---------- */
@media (max-width: 768px) {
  .inv-page { gap: 12px; }
  .inv-top, .inv-grid { display: contents; }
  .inv-page > *, .inv-top > *, .inv-grid > * { order: 3; }
  #hero-card { order: 0; }
  #tax-strip { order: 1; }
  #mobile-tabs { order: 2; }
  .tax-strip { display: flex; }
  #mobile-tabs { display: flex; }

  .gf-hero { display: flex; flex-direction: column; padding: 18px 16px; }
  .gf-main { order: 0; }
  .gf-pills { order: 1; }
  .gf-chart { order: 2; height: 96px; margin-top: 12px; }
  .gf-chart-head { order: 3; margin-top: 10px; }
  .gf-chart-head .card-title { display: none; }
  .gf-chart-head .segmented { display: flex; width: 100%; }
  .gf-chart-head .segmented button { flex: 1 1 0; padding: 6px 4px; }
  .gf-side { order: 4; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; text-align: left; margin-top: 10px; gap: 6px; }
  .gf-updated { font-size: 11px; }
  #gf-lasttxn { display: none; }
  .gf-hero .market-clock { margin: 0; padding: 0; border: none; background: none; font-size: 11px; gap: 5px; }
  .gf-hero .market-clock .mc-et { display: none; }
  .gf-hero .market-clock .mc-label { display: none; }
  .gf-hero .market-clock .mc-time { font-family: inherit; font-weight: 600; }
  .gf-value { font-size: 30px; }
  /* Mobile.dc.html hero: "≈ ₪…" without the rate, three pills (Today, 1M, All) — Realized moves to the tax strip */
  .gf-rate { display: none; }
  #gf-week, #gf-ytd, #gf-realized { display: none; }

  .h-toolbar { flex-direction: column; align-items: stretch; }
  .h-title { justify-content: space-between; }
  /* row 1: Search · Value ▾ · funnel; row 2 (funnel-toggled): type segment + signal select */
  .h-tools { flex-wrap: wrap; }
  .h-search { flex: 1 1 0; width: auto; min-width: 0; height: 40px; font-size: 14px; order: 0; }
  .h-tools select { height: 40px; }
  #sort-select { order: 1; }
  .h-filter-btn { display: inline-flex; order: 2; }
  .h-tools .segmented { display: none; order: 3; flex: 1 1 100%; }
  .h-tools .segmented button { flex: 1 1 0; }
  #filter-signal { display: none; order: 4; flex: 1 1 100%; }
  .h-tools.filters-open .segmented { display: flex; }
  .h-tools.filters-open #filter-signal { display: block; }
  .h-foot { justify-content: center; }
  .h-totals { display: none; }
  #signals-grid { grid-template-columns: 1fr; }
  .alloc-wrap { flex-wrap: wrap; }
}

/* Main top bar only: collapse Refresh / CSV / Tax to icon squares. Scoped to #main-topbar so the
   holding-detail bar (chevron + ⋯, no .btn-label spans) is not squashed into 36px boxes, and to .tb-btn
   so the "Read-only · Sign out" pill forms.js injects into .actions for viewers keeps its own sizing. */
@media (max-width: 640px) {
  #main-topbar .actions { gap: 8px; }
  #main-topbar .actions .tb-btn { width: 36px; min-width: 36px; padding: 0; border-radius: 12px; }
  #main-topbar .actions .tb-btn .btn-label { display: none; }
  #main-topbar .actions .tb-btn.btn-primary { width: auto; padding: 0 12px; }
  #main-topbar .actions .tb-btn.btn-primary .btn-label { display: inline; }
}
