/* CloudC4 Trading DevX — desk components
   Hairlines, density, no card-on-card. Do not import styles.css. */

/* ── Type + utilities ────────────────────────────────────── */

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.015em; }
.page-heading {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.news-masthead { align-items: center; }
.news-masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.news-masthead-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.news-masthead-mark svg { width: 30px; height: 30px; }
.news-jump-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  position: sticky;
  top: calc(var(--header-h) + 4px);
  z-index: 8;
  background: var(--bg);
  padding: 0.35rem 0;
}
.news-sec-burger {
  display: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 12px;
  min-height: 2.6rem;
  padding: 0 0.85rem 0 0.7rem;
  align-items: center;
  gap: 0.55rem;
  font-weight: 650;
  cursor: pointer;
}
.news-sec-burger .nav-burger-lines { width: 16px; gap: 4px; }
body.news-sec-open .news-sec-burger .nav-burger-lines span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
body.news-sec-open .news-sec-burger .nav-burger-lines span:nth-child(2) { opacity: 0; }
body.news-sec-open .news-sec-burger .nav-burger-lines span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }
.news-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
}
.news-jump a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.88rem;
}
.news-jump a:hover { background: var(--bg-hover); }
#sec-cloudc4, #sec-headlines { scroll-margin-top: 5.5rem; }
.headlines-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.95fr);
  gap: 1rem 1.15rem;
  align-items: stretch;
  width: 100%;
}
.headlines-hero .news-card,
.headlines-hero .news-card.is-hero-card {
  display: flex;
  flex-direction: column;
  grid-template-columns: 1fr;
  min-height: 0;
  padding: 0;
}
.headlines-hero .news-card-media {
  width: 100%;
  min-height: 22rem;
  height: auto;
  max-height: none;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 0;
}
.headlines-hero .news-thumb,
.headlines-hero .news-card-media .news-thumb,
.headlines-hero .news-thumb.is-contain {
  width: 100%;
  height: auto;
  max-height: min(72vh, 38rem);
  object-fit: contain;
  object-position: center center;
}
.headlines-hero .news-card-body { padding: 1rem 1.05rem 1.15rem; gap: 0.4rem; }
.headlines-hero .news-card-body h3 {
  font-family: "Newsreader", "Source Serif 4", Georgia, serif;
  font-size: clamp(1.75rem, 3.1vw, 2.65rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.headlines-hero .news-summary { font-size: 1.02rem; line-height: 1.45; }
.headline-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.headline-live {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--bad, #e11d48);
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.55);
  animation: headline-pulse 1.6s ease-out infinite;
}
@keyframes headline-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45); }
  70% { box-shadow: 0 0 0 0.55rem rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}
.headlines-four {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}
.headlines-four .news-card,
.headlines-four .news-card.is-rail-card {
  grid-template-columns: 148px minmax(0, 1fr);
  padding: 0.55rem;
}
.headlines-four .news-card-media,
.headlines-four .news-thumb,
.headlines-four .news-card-media .news-thumb {
  width: 148px;
  height: 148px;
}
.headlines-four .news-card-body h3 {
  font-size: 1.12rem;
  line-height: 1.28;
  font-weight: 700;
}
.news-excl-panel {
  position: relative;
  padding-bottom: 1.65rem;
  border: 0;
  background: transparent;
}
.news-window-grid.is-one-row:not(.is-expanded) {
  grid-template-rows: auto;
  grid-auto-rows: 0;
  overflow: hidden;
  align-items: start;
  max-height: none;
}
.news-window-grid.is-one-row:not(.is-expanded) > * {
  min-height: 0;
  overflow: hidden;
}
.news-window-grid.is-expanded {
  grid-auto-rows: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: none;
}
.news-grid .news-history-link {
  display: none;
}
.news-card {
  height: 100%;
}
.news-feed-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 2.1rem;
  margin: 0.35rem 0 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}
.news-feed-loader[hidden] { display: none !important; }
.news-feed-loader-bar {
  width: 7.5rem;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 75%, #fff) 45%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: news-feed-shimmer 1.1s ease-in-out infinite;
}
.news-feed-loader-label { font-weight: 550; }
@keyframes news-feed-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
/* Burger through tablet so 768 jumpers cannot wrap to a second row. */
@media (max-width: 900px) {
  .news-sec-burger { display: inline-flex; }
  .news-jump { display: none; }
  .news-sec-drawer { z-index: 1500; }
  #news-section-prefs { display: none; }
}
@media (max-width: 900px) {
  .headlines-stage { grid-template-columns: 1fr; }
  .headlines-hero .news-card-media { min-height: 14rem; }
  .headlines-hero .news-thumb { max-height: min(52vh, 22rem); }
  .headlines-four .news-card, .headlines-four .news-card.is-rail-card { grid-template-columns: 112px minmax(0, 1fr); }
  .headlines-four .news-card-media, .headlines-four .news-thumb { width: 112px; height: 112px; object-fit: contain; }
}
.news-masthead-title {
  font-family: "Newsreader", "Source Serif 4", Georgia, serif;
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
}
.list-heading {
  margin: 1rem 0 0.45rem;
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.list-heading.subtle { font-size: 0.9rem; opacity: 0.92; }
.page-header { width: 100%; margin: 0 0 0.85rem; padding: 0; }
.page-sub, .page-lead { margin: 0.35rem 0 0; color: var(--muted); max-width: 52rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.warn { color: var(--warn); font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.82rem; line-height: 1.45; }
.muted { color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.sub a { font-weight: 600; }
.between { justify-content: space-between; width: 100%; }
.row { display: flex; align-items: center; }
.gap { gap: 0.5rem; margin-top: 0.75rem; }
.wrap { flex-wrap: wrap; }
.chk { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 0.35rem; }
.empty { color: var(--muted); padding: 0.75rem 0; }

.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.pill {
  font-size: 0.75rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.pill.ok { border-color: color-mix(in srgb, var(--good) 50%, var(--border)); color: var(--good); }
.pill.bad { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); color: var(--bad); }
.pill.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); color: var(--warn); }
.pill.muted { color: var(--muted); }

.badge {
  display: inline-block;
  background: var(--badge-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  vertical-align: middle;
}
.badge-live, .badge-live_book {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 35%, transparent);
}
.badge-scope-you { color: var(--accent); }
.badge-scope-bot { color: var(--warn); }
.badge-ira-safe { color: var(--good); }

.grade { font-variant-numeric: tabular-nums; }
.grade-Ap, .grade-A, .grade-Am { color: var(--good); }
.grade-Bp, .grade-B, .grade-Bm { color: var(--grade-b); }
.grade-C { color: var(--warn); }
.grade-D, .grade-F { color: var(--bad); }
.grade-OPEN { color: var(--accent); }

/* ── Controls ────────────────────────────────────────────── */

button, select, input, textarea {
  font: inherit;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.4rem 0.75rem;
}
button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 650;
}
button:hover { filter: none; background: var(--accent-hover); }
button.secondary,
.btn-ghost,
.btn {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 550;
}
button.secondary:hover,
.btn-ghost:hover,
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
}
.btn-primary,
.btn-emphasis {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
}
.btn-primary:hover, .btn-emphasis:hover { background: var(--accent-hover); }
.btn-sm { font-size: 0.82rem; padding: 0.28rem 0.65rem; }
.btn-danger, button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: transparent; }
.btn-mini {
  appearance: none;
  font-size: 0.72rem;
  padding: 0.18rem 0.45rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
input, select { min-width: 8rem; }
input[type="search"], input[type="text"], textarea { border-radius: 10px; }

.range-btns, .filter-btns {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
}
.range-btns .range,
.filter-btns button {
  background: transparent;
  border-color: var(--border);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.range-btns .range.active,
.filter-btns button.active,
.filter-btns .secondary.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
  font-weight: 650;
}
.filter-group-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 650;
  margin-right: 0.15rem;
  white-space: nowrap;
}

/* ── Page frame ──────────────────────────────────────────── */

.page-main {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0.85rem clamp(0.75rem, 2vw, 1.5rem) 2rem;
  width: 100%;
  max-width: 100%;
}

/* Hairline sections — not elevated cards */
.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0.85rem 0 1rem;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 650;
}
.card h3 { margin: 1rem 0 0.4rem; font-size: 0.9375rem; color: var(--text); }

.desk-section-head { margin-top: 0; }
.desk-section { min-width: 0; }

/* ── P&L tiles ───────────────────────────────────────────── */

.day-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 0.5rem;
}
.tot-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 0.7rem 0.85rem;
}
.tot-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}
.tot-value {
  font-size: 1.75rem;
  font-weight: 650;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.tot-sub { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }

.acct-filter-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}
.acct-filter-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.acct-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0.15rem 0;
}
.acct-pill, .acct-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.acct-pill:hover { background: var(--bg-hover); }
.acct-pill.is-on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  font-weight: 650;
}

/* ── Tables ──────────────────────────────────────────────── */

.table-wrap { overflow: auto; margin-top: 0.75rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--table-border);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
tr:hover td { background: var(--bg-hover); }
.tag-yes { color: var(--good); }
.tag-no { color: var(--bad); }
.analysis-cell {
  max-width: min(100%, 40rem);
  white-space: normal;
  line-height: 1.35;
  word-break: break-word;
}
th.th-sort, .th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort:hover, .th-sort:hover, .th-sort.is-sorted { color: var(--accent); }
.sort-ind { font-size: 0.7em; opacity: 0.75; margin-left: 0.15rem; }

.scroll-panel {
  position: relative;
  border-radius: 0;
  border: 1px solid var(--border);
  background: transparent;
  min-width: 0;
}
.scroll-panel .table-wrap.hover-scroll,
.scroll-panel .hover-scroll {
  border: 0;
  background: transparent;
  max-height: min(16rem, 36vh);
  transition: max-height 0.22s ease;
}
.scroll-panel .hover-scroll-sm { max-height: min(13rem, 30vh); }
.scroll-panel .hover-scroll-lg { max-height: min(20rem, 42vh); }
.scroll-panel.is-expanded .table-wrap.hover-scroll,
.scroll-panel.is-expanded .hover-scroll { max-height: min(70vh, 52rem); }
.scroll-panel.is-expanded .hover-scroll-sm { max-height: min(60vh, 40rem); }
.scroll-panel.is-expanded .hover-scroll-lg { max-height: min(78vh, 56rem); }
.scroll-panel.is-expandable .hover-scroll { padding-bottom: 1.65rem; }

.hover-scroll {
  max-height: min(28rem, 55vh);
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior-y: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.hover-scroll-sm { max-height: min(22rem, 45vh); }
.hover-scroll-lg { max-height: min(34rem, 62vh); }

.panel-expand {
  position: absolute;
  left: 50%;
  bottom: 0.15rem;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 1.35rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.panel-expand[hidden], .expand-arrow[hidden] { display: none !important; }
.panel-expand:hover { color: var(--text); background: var(--bg-hover-strong); }
.panel-expand[aria-expanded="true"] .panel-expand-icon { display: inline-block; transform: rotate(180deg); }
.panel-expand-icon { display: inline-block; transition: transform 0.15s ease; }

/* ── Home Board | Watch ──────────────────────────────────── */

#sec-board, #sec-watch {
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
}
@media (min-width: 960px) {
  .page-main.grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 1.25rem;
  }
  #sec-live { grid-column: 1 / -1; }
  #sec-board { grid-column: 1; }
  #sec-watch { grid-column: 2; }
}
#sec-board .table-wrap, #sec-watch .table-wrap { width: 100%; overflow-x: auto; }
#sec-board table, #sec-watch table { width: 100%; }
#sec-board th:nth-child(4),
#sec-board td:nth-child(4) {
  min-width: 12rem;
  width: 40%;
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sec-watch th:nth-child(4),
#sec-watch td:nth-child(4) {
  min-width: 10rem;
  width: 35%;
}

/* ── Trades desk ─────────────────────────────────────────── */

.trades-desk { width: 100%; }
.trades-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.desk-table { width: 100%; min-width: 720px; }
.desk-table-dense { min-width: 1100px; font-size: 0.92rem; }
.desk-table th { white-space: nowrap; }
.desk-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

.pos-grid-wrap { min-width: 0; overflow-x: auto; }
.pos-grid {
  --pos-cols: minmax(8.5rem, 1.15fr) minmax(4.25rem, 0.7fr) minmax(4rem, 0.65fr) minmax(5rem, 0.75fr) minmax(5rem, 0.75fr) minmax(5.5rem, 0.85fr) minmax(5.5rem, 0.85fr) minmax(4.5rem, 0.65fr) minmax(6.5rem, 0.95fr);
  width: 100%;
  min-width: 860px;
  font-size: 0.875rem;
}
.pos-grid-head, .pos-grid-row {
  display: grid;
  grid-template-columns: var(--pos-cols);
  align-items: center;
  column-gap: 0.35rem;
  padding: 0 0.15rem;
}
.pos-grid-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}
.pos-grid-head .pos-cell {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.pos-grid-row {
  border-bottom: 1px solid var(--border-subtle);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  min-height: 2.75rem;
}
.pos-grid-row:hover { background: var(--bg-hover); }
.pos-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-cell.pos-num { text-align: right; font-variant-numeric: tabular-nums; }
.pos-cell.pos-status, .pos-cell.pos-executor { text-align: center; }
.pos-cell.pos-account { display: flex; align-items: center; gap: 0.35rem; }
.pos-grid-empty { padding: 1.25rem 0.75rem; text-align: center; }

.agent-exec-list { min-width: 920px; width: 100%; font-size: 0.875rem; }
.agent-exec-head, .agent-exec-row {
  display: grid;
  grid-template-columns:
    minmax(6.5rem, 0.7fr) minmax(3.5rem, 0.45fr) minmax(6.5rem, 0.85fr)
    minmax(6rem, 0.9fr) minmax(14rem, 2.4fr) minmax(4.25rem, 0.5fr) minmax(3.75rem, 0.45fr);
  gap: 0.4rem 0.55rem;
  align-items: center;
  padding: 0.45rem 0.25rem;
}
.agent-exec-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.agent-exec-row { border-bottom: 1px solid var(--border-subtle); min-height: 2.6rem; }
.agent-exec-row:hover { background: var(--bg-hover); }
.agent-exec-cell { min-width: 0; }
.agent-exec-cell.ae-time { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.agent-exec-cell.ae-summary {
  font-size: 0.875rem;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: normal;
}
.agent-exec-cell.ae-status, .agent-exec-cell.ae-thought { text-align: center; }
.agent-exec-cell.ae-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.action-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 650;
  white-space: nowrap;
}
.action-chip.action-buy { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.action-chip.action-sell { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.action-chip.action-hold { color: var(--muted); background: var(--bg-elevated); }

.universe-toolbar { display: flex; align-items: center; gap: 0.5rem; }
.universe-search-wrap { position: relative; }
.universe-search {
  min-width: 14rem;
  max-width: 22rem;
  border-radius: var(--radius-pill);
}
.universe-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 16rem;
  overflow: auto;
}
.uni-extras { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.desk-account-filter { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.just-added, tr.just-added td { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ── Charts ──────────────────────────────────────────────── */

html:has(body.charts-body),
body.charts-body {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}
body.charts-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
body.charts-body .top { flex-shrink: 0; }
body.charts-body #app-banner,
body.charts-body .app-footer { display: none !important; }
body.charts-body #app-root {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.charts-page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.charts-overlay {
  position: absolute;
  z-index: 5;
  top: 0.45rem;
  left: 0.45rem;
  right: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  pointer-events: none;
}
.charts-overlay > * { pointer-events: auto; }
.charts-symbol-form,
.charts-layout-bar,
.charts-interval-bar,
.charts-quick-chips {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px);
}
.charts-symbol-input {
  width: 7.5rem;
  padding: 0.3rem 0.5rem;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.82rem;
  text-transform: uppercase;
}
.charts-go,
.charts-layout-btn,
.charts-iv,
.charts-chip,
.charts-fill-btn {
  appearance: none;
  margin: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
}
.charts-go, .charts-fill-btn { color: var(--text); }
.charts-layout-btn.is-active,
.charts-iv.is-active,
.charts-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.charts-fill-btn { border-color: var(--border); background: color-mix(in srgb, var(--bg-elevated) 88%, transparent); }
a.charts-open-tv {
  display: inline-flex;
  margin-left: auto;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
}
.charts-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-h) - 3.25rem);
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}
.tv-chart-host { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; position: relative; }
.tv-chart-host.tv-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--border);
}
.tv-chart-host.tv-chart-single { display: block; }
.tv-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.tv-chart-host.tv-chart-single .tv-pane.is-solo { position: absolute; inset: 0; }
.tv-pane.is-active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 75%, transparent); z-index: 1; }
.tv-pane-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.35rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.tv-pane-select {
  appearance: none;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  font-family: var(--mono);
  cursor: pointer;
  text-align: left;
}
.tv-pane-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
  background: var(--bg);
}
.tv-pane.is-active .tv-pane-index { background: var(--accent); color: var(--on-accent); }
.tv-pane-frame { flex: 1 1 auto; position: relative; min-height: 0; width: 100%; }
.tv-pane-frame iframe,
.tv-chart-host iframe {
  display: block;
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  background: var(--bg);
}
.charts-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  margin: 0;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
a.chart-symbol-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
a.tv-pane-open { color: var(--accent); font-size: 0.85rem; font-weight: 650; padding: 0.15rem 0.4rem; text-decoration: none; }

@media (max-width: 767px) and (min-height: 640px) {
  .tv-chart-host.tv-chart-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 767px) and (orientation: landscape) {
  .tv-chart-host.tv-chart-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ── News ────────────────────────────────────────────────── */

.news-page {
  width: 100%;
  max-width: 100%;
  padding: 0.85rem clamp(0.75rem, 2vw, 1.5rem) 2rem;
}
.news-search {
  min-width: 8rem;
  max-width: 18rem;
  flex: 1 1 10rem;
  border-radius: var(--radius-pill);
}
@media (max-width: 767px) {
  .news-header-tools {
    width: 100%;
  }
  .news-search {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.section-collapse-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.section-collapse-btn:hover { filter: none; background: transparent; }
.section-collapse-btn:hover h3 { color: var(--accent); }
.collapse-chevron { display: inline-flex; width: 1.1rem; color: var(--muted); }
.news-section.is-collapsed .section-body { display: none; }
.news-prefs-panel { margin-bottom: 1rem; }
.news-prefs-list { list-style: none; margin: 0.75rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.news-prefs-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.news-split, .news-calendars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 0;
  width: 100%;
  align-items: stretch;
}
@media (min-width: 1100px) {
  .news-split.news-calendars {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 1.25rem;
  }
}
.news-calendars,
.news-calendars > *,
.news-excl-panel,
#sec-earnings,
#sec-econ,
#sec-cloudc4 {
  min-width: 0;
  max-width: 100%;
}
.news-calendars .table-wrap,
.news-calendars .hover-scroll,
#earnings-scroll, #econ-scroll {
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.date-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.35rem 0 0.75rem;
  scrollbar-width: thin;
  max-width: 100%;
  min-width: 0;
}
.date-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-width: 3.7rem;
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: normal;
  line-height: 1.15;
}
.date-tab-dow {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
}
.date-tab-md {
  font-size: 0.82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.date-tab-day { font-variant-numeric: tabular-nums; }
.date-tab-count {
  display: block;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}
.date-tab.is-on, .date-tab.active, .date-tab.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.news-table { width: 100%; font-size: 0.85rem; }
.news-table th { white-space: nowrap; }
.news-table tr.news-row-uni { background: color-mix(in srgb, var(--good) 8%, transparent); }
.news-table tr.impact-high td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.news-table tr.impact-med td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cal-table td.mono, .cal-table th.th-sort { white-space: nowrap; }
.cal-table .cal-row-summary {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

/* Feed tiles: 4× prior 48px thumbs (192px). Count is viewport-dynamic. */
:root {
  --news-card-min: 28rem;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--news-card-min, 28rem)), 1fr));
  gap: 0.95rem 1.1rem;
  margin-top: 0.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: stretch;
}
.news-card-wrap {
  min-width: 0;
  max-width: 100%;
  height: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.news-card {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  text-decoration: none;
  color: inherit;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  box-shadow: none;
  padding: 0.75rem;
  min-width: 0;
  height: 100%;
}
.news-card:hover {
  background: var(--bg-hover);
  transform: none;
  box-shadow: none;
  text-decoration: none;
}
.news-card-media {
  position: relative;
  width: 192px;
  height: 192px;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
  flex: 0 0 192px;
}
.news-thumb, .news-card-media .news-thumb {
  width: 192px;
  height: 192px;
  min-height: 0;
  object-fit: cover;
  display: block;
}
.news-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 650;
}
.news-card-body { padding: 0; display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.news-card-body h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.news-summary {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-tickers, .news-live-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-height: 1.7rem;
  overflow: hidden;
}
.news-ticker, .news-live-ticker {
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.news-ticker.is-topic, .news-live-ticker { color: var(--accent); }
.news-live-ticker.pos { color: var(--good); }
.news-live-ticker.neg { color: var(--bad); }
.news-live-tickers { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.35rem 0; }
.news-live-tickers-lg .news-live-ticker { font-size: 0.85rem; padding: 0.3rem 0.55rem; }
.news-new-badge {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  font-size: 0.62rem;
  font-weight: 650;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--good);
  color: var(--on-accent);
}
.news-exclusive-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-pill);
  padding: 0.12rem 0.55rem;
}
.news-exclusive-lead-host { margin: 0 0 0.75rem; }
.news-exclusive-lead { padding: 0; }
.news-exclusive-lead-label { font-size: 0.72rem; font-weight: 650; color: var(--accent); margin: 0 0 0.35rem; }
.news-exclusive-lead .news-card { grid-template-columns: 80px minmax(0, 1fr); }
.news-exclusive-dek { font-size: 1.05rem; line-height: 1.45; color: var(--muted); max-width: 40rem; margin: 0.25rem auto 1rem; }
.news-exclusive-page .page-header { max-width: 40rem; margin-left: auto; margin-right: auto; }
.news-exclusive-page #excl-tickers { max-width: 40rem; margin-left: auto; margin-right: auto; }
.news-exclusive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
  width: 100%;
}
@media (min-width: 1100px) {
  .news-exclusive-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 40rem) minmax(16rem, 22rem) minmax(0, 1fr);
  }
  .news-exclusive-reading { grid-column: 2; }
  .news-exclusive-rail { grid-column: 3; }
}
.news-exclusive-reading { min-width: 0; max-width: 40rem; width: 100%; margin: 0 auto; }
.news-exclusive-rail { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1099px) {
  /* Hero + body first. Market Analysis after the stills — never above them.
     $INV phone vision (2026-08-14) failed when order:-1 hid the figures. */
  .news-exclusive-reading { order: 1; }
  .news-exclusive-rail { order: 2; }
}

/* Intrinsic-aspect figures — never width:100% + object-fit:cover */
.news-exclusive-hero {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
  border-radius: 0;
  margin: 0.35rem 0 1.15rem;
  background: transparent;
  border: none;
}
.news-exclusive-hero img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(38vh, 20rem);
  min-height: 0;
  object-fit: contain;
  object-position: left center;
  display: block;
  border-radius: 10px;
}
.news-hero-caption { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.78rem; font-style: italic; }
.news-exclusive-body p { line-height: 1.55; margin: 0 0 0.85rem; }
.news-inline-figure {
  margin: 1.15rem 0 1.35rem;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: none;
  width: fit-content;
  max-width: 100%;
}
.news-inline-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(46vh, 22rem);
  object-fit: contain;
  border-radius: 10px;
}
.news-inline-figure.is-portrait { max-width: min(42%, 16rem); float: left; margin: 0.25rem 1rem 0.85rem 0; }
.news-inline-figure.is-square { max-width: min(48%, 18rem); float: left; margin: 0.25rem 1rem 0.85rem 0; }
.news-inline-figure.is-landscape { max-width: 100%; float: none; clear: both; margin: 1.1rem auto; }
.news-exclusive-body::after { content: ""; display: block; clear: both; }
.pnl-chip {
  display: inline-flex; flex-wrap: wrap; gap: 0.2rem 0.4rem; align-items: baseline;
  font-size: 0.7rem; font-family: var(--mono); padding: 0.1rem 0.42rem;
  border-radius: 999px; border: 1px solid var(--border);
}
.pnl-widget { display: flex; flex-direction: column; gap: 0.55rem; }
.pnl-widget .pnl-section-title {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.88;
}
.pnl-widget .pnl-section-title + .pnl-row { margin-top: 0.1rem; }
.pnl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.55rem;
  font-variant-numeric: tabular-nums;
  padding: 0.4rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.pnl-row:last-child { border-bottom: 0; }
.pnl-row .pnl-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: nowrap;
}
.pnl-row .pnl-metrics .hint { font-size: 0.72rem; }
.news-inline-figure figcaption {
  padding: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  opacity: 0.78;
  font-style: italic;
  max-width: 36rem;
}
.news-inline-ticker { font-family: var(--mono); font-weight: 650; color: var(--accent); }
.news-live-ticker.is-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0 0.1rem;
  font-size: 0.82em;
}

.ma-grid { display: flex; flex-direction: column; gap: 0.85rem; }
.ma-thesis { font-size: 1.02rem; line-height: 1.45; font-weight: 500; }
.ma-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; }
.ma-metric {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-panel);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ma-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.ma-value { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.ma-certainty-bar { margin-top: 0.35rem; height: 0.35rem; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.ma-certainty-bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.news-recommended-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.news-recommended-list li { padding: 0.55rem 0; border-bottom: 1px solid var(--border-subtle); }
.news-source-list, .news-history-list { margin: 0; padding-left: 1.1rem; }
.analysis-link { color: var(--accent); font-weight: 650; font-size: 0.82rem; }

/* ── Chat ────────────────────────────────────────────────── */

body.chat-body { display: flex; flex-direction: column; min-height: 100vh; }
.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  min-height: 0;
  max-height: calc(100dvh - var(--header-h));
  padding: 0.85rem 0.75rem;
  border-left: 1px solid var(--border);
  background: var(--bg);
  order: 2;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: calc(100dvh - var(--header-h));
  order: 1;
}
.chat-sidebar-head { flex-shrink: 0; }
.chat-new-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}
.chat-new-btn:hover { background: var(--bg-hover); }
.chat-sidebar-label { margin: 0.25rem 0.35rem 0; font-size: 0.72rem; color: var(--muted); }
.session-list { list-style: none; margin: 0; padding: 0.25rem 0; overflow-y: auto; flex: 1 1 auto; }
.session-list li { margin: 0 0 0.2rem; }
.session-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  font-size: 0.82rem;
}
.session-list button:hover { background: var(--bg-hover); }
.session-list button.active { background: var(--accent-soft); color: var(--text); }
.sess-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-time { display: block; color: var(--muted); font-size: 0.7rem; margin-top: 0.15rem; }
.chat-sidebar-foot { flex-shrink: 0; padding-top: 0.5rem; border-top: 1px solid var(--border); font-size: 0.72rem; color: var(--muted); }
.chat-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.chat-messages { width: 100%; padding: 1.25rem clamp(0.75rem, 2vw, 1.5rem) 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.chat-messages:has(.msg.system:only-child), .chat-messages.is-empty-state { justify-content: center; min-height: min(52vh, 28rem); }
.msg { width: 100%; line-height: 1.6; word-break: break-word; }
.msg .msg-role { display: block; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.4rem; }
.msg.user .msg-bubble {
  display: inline-block;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 1.15rem 1.15rem 0.35rem 1.15rem;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  white-space: pre-wrap;
}
.msg.assistant .msg-body { font-size: 0.98rem; line-height: 1.65; }
.msg.system { text-align: center; color: var(--muted); }
.msg.system .msg-body {
  display: inline-block;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
}
.msg.error .msg-body { color: var(--bad); padding: 0.75rem 1rem; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--border)); }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4 { margin: 1.1em 0 0.45em; font-weight: 650; }
.msg-body p { margin: 0.55em 0; }
.msg-body ul, .msg-body ol { margin: 0.5em 0; padding-left: 1.35rem; }
.msg-body code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-elevated); padding: 0.1em 0.35em; border-radius: 5px; }
.msg-body pre { margin: 0.75em 0; padding: 0.75rem 0.9rem; border-radius: 10px; background: var(--bg-elevated); border: 1px solid var(--border); overflow-x: auto; font-family: var(--mono); font-size: 0.8rem; }
.msg-body .md-table-wrap { width: 100%; overflow-x: auto; margin: 0.75em 0; border: 1px solid var(--border); }
.thinking-card { display: inline-flex; flex-direction: column; gap: 0.25rem; padding: 0.65rem 0.9rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elevated); }
.thinking-spinner { width: 0.85rem; height: 0.85rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: chat-spin 0.7s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
.process-panel { margin: 0 0 0.75rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elevated); }
.process-panel > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.85rem; font-size: 0.82rem; font-weight: 650; }
.process-panel > summary::-webkit-details-marker { display: none; }
.chat-composer-wrap { flex-shrink: 0; width: 100%; padding: 0 clamp(0.75rem, 2vw, 1.5rem) 0.85rem; }
.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--bg-elevated);
}
.chat-composer textarea {
  width: 100%;
  resize: none;
  min-height: 2.75rem;
  max-height: 10rem;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.25rem;
  outline: none;
  border-radius: 0;
}
.chat-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.chat-send {
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 0.35rem 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
.chat-disclaimer { margin: 0.4rem 0 0; font-size: 0.72rem; color: var(--muted); text-align: center; }
.chat-meta { font-size: 0.75rem; color: var(--muted); }
.chat-chats-btn { display: none; }

@media (max-width: 767px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-sidebar {
    display: none;
  }
  body.chat-sheet-open .chat-sidebar {
    display: flex;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 55;
    max-height: min(72dvh, 32rem);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    background: var(--bg-elevated);
    order: 0;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
  }
  .chat-chats-btn { display: inline-flex; }
}

/* ── Settings ────────────────────────────────────────────── */

.settings-page { align-items: start; }
.settings-lead { margin: 0 0 0.85rem; max-width: 62rem; line-height: 1.45; }
.settings-toolbar { margin-bottom: 0.85rem; }
.settings-collapse-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.settings-collapse-btn:hover { filter: none; background: transparent; }
.settings-collapse-btn:hover h2 { color: var(--accent); }
.settings-collapsible.is-collapsed .settings-section-body { display: none; }
.settings-section-body { margin-top: 0.85rem; }
.status-human { width: 100%; }
.field-label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.broker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 0.75rem; }
.broker-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 0.75rem 0.85rem;
  background: var(--bg-elevated);
}
.action-result {
  margin: 0.65rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.88rem;
}
.action-result.is-ok { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); color: var(--good); }
.action-result.is-err { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); color: var(--bad); }
.settings-toast-host {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.settings-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
.settings-confirm {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.settings-confirm[hidden] { display: none !important; }
.settings-confirm-card {
  width: min(28rem, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 1.1rem 1.15rem;
}

/* ── Strategies / thought / agents ───────────────────────── */

.strat-page { width: 100%; padding: 0.85rem clamp(0.75rem, 2.5vw, 1.5rem) 2.5rem; }
.strat-toolbar { margin: 0.75rem 0; width: 100%; }
.strat-filter-groups { display: flex; flex-direction: column; gap: 0.45rem; }
.strat-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); }
table.strat-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 0.9rem; }
table.strat-table th, table.strat-table td { padding: 12px clamp(8px, 1.2vw, 14px); border-bottom: 1px solid var(--border); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.65rem; }
.stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 0.65rem 0.75rem; }
.stat .v { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.75rem; color: var(--muted); }
.scope-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.65rem; }
.scope-item .label { font-size: 0.72rem; color: var(--muted); }
.scope-item .value { font-weight: 650; }
.trade-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.85rem; }
.trade-card { border: 1px solid var(--border); border-radius: 0; padding: 0.75rem 0; background: transparent; }
.trade-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)); gap: 10px 14px; }
.metric .label { font-size: 0.72rem; color: var(--muted); }
.metric .value { font-size: 0.92rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric .value.sym { color: var(--accent); }
.criteria { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.agents-list { display: flex; flex-direction: column; gap: 0; }
.workers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
  gap: 0.75rem;
}
.agent-row, .worker-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.agent-detail { display: flex; flex-direction: column; gap: 0.85rem; }
.kv-table { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: 0.35rem 1rem; }
.thought-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 0; }
.thought-prose { line-height: 1.5; }
.thought-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.thought-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.65rem; }
.thought-dl dt { font-size: 0.72rem; color: var(--muted); }
.thought-dl dd { margin: 0.15rem 0 0; }
.thought-raw { overflow: auto; max-height: 20rem; background: var(--bg-elevated); padding: 0.75rem; border: 1px solid var(--border); }
.thought-advanced { margin-top: 1rem; }
.status-pill { display: inline-flex; padding: 0.15rem 0.5rem; border-radius: var(--radius-pill); border: 1px solid var(--border); font-size: 0.75rem; }
.status-ok { color: var(--good); }

/* ── Workers ─────────────────────────────────────────────── */

.workers-hero, .worker-detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.workers-summary { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.workers-stat {
  min-width: 5.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 0.55rem 0.7rem;
}
.workers-stat-value { display: block; font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.workers-stat-label { font-size: 0.75rem; color: var(--muted); }
.eyebrow { margin: 0 0 0.2rem; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; }
.workers-onboard:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.workers-create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.85rem;
  align-items: start;
}
.workers-create-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.workers-power-label {
  font-size: 0.78rem;
  font-weight: 650;
}
.workers-radio {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.workers-power-field {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 9rem;
}
.workers-chat {
  display: grid;
  grid-template-columns: minmax(11rem, 16rem) minmax(0, 1fr);
  min-height: 22rem;
  border: 1px solid var(--border);
}
.workers-chat-threads { border-right: 1px solid var(--border); overflow-y: auto; max-height: 28rem; }
.chat-thread-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: inherit;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  border-radius: 0;
}
.chat-thread-btn:hover, .chat-thread-btn.is-active { background: var(--bg-hover); }
.workers-chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 22rem; }
.workers-chat-head { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.workers-chat-log { flex: 1 1 auto; overflow-y: auto; max-height: 18rem; padding: 0.85rem 0.9rem; }
.workers-chat-compose { padding: 0.65rem 0.75rem; border-top: 1px solid var(--border); }
.workers-chat-input { width: 100%; min-width: 0; border-radius: 10px; }
.workers-chat-compose-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.45rem; }
.unread-dot {
  display: inline-flex;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 650;
  background: var(--accent);
  color: var(--on-accent);
}
.wk-modal-root:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.worker-status-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.65rem; }
.worker-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 0; }
.worker-power-toggle { display: flex; gap: 0.65rem; align-items: flex-start; }
.worker-detail-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.worker-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  min-width: 11rem;
  z-index: 20;
  padding: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.worker-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: 0.45rem 0.6rem; cursor: pointer; border-radius: 8px; }
.worker-menu button:hover { background: var(--bg-hover); }
.worker-card-actions-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.worker-card-menu { position: relative; }
.worker-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  min-height: 0;
  min-width: 0;
  border-radius: 12px;
}
.worker-card-thumb {
  width: 2rem;
  height: 2rem;
  margin: 0;
  border-radius: 7px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg);
}
.worker-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.worker-card-thumb.is-empty { display: none; }
.worker-card:hover, .worker-card:focus-visible {
  background: var(--bg-hover);
  transform: none;
  box-shadow: none;
  outline: none;
}
.worker-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.65rem; }
.worker-card-identity { display: flex; align-items: flex-start; gap: 0.65rem; min-width: 0; }
.worker-stream-icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg);
}
.worker-stream-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.worker-stream-icon.is-empty { background: var(--accent-soft); }
.worker-role-mark {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}
.worker-card-name { margin: 0; font-size: 1rem; font-weight: 650; }
.worker-role-label { display: block; margin-top: 0.12rem; font-size: 0.72rem; color: var(--muted); }
.worker-card-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; align-items: center; }
.worker-card-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.worker-card-work { margin: 0; font-size: 0.82rem; }
.worker-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.worker-link { color: var(--accent); font-weight: 600; }
.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: var(--radius-pill);
  display: inline-block;
  background: var(--muted);
}
.status-dot.on { background: var(--good); }
.status-dot.off { background: var(--warn); }
.action-result-ok { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); color: var(--good); }
.action-result-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); color: var(--bad); }
.wk-modal {
  width: min(720px, 100%);
  max-height: min(92vh, 880px);
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: var(--radius-panel);
}
.wk-modal-root[hidden] { display: none !important; }
.wk-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.wk-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.wk-templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 0.65rem; }
.wk-template {
  text-align: left;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
}
.wk-template:hover, .wk-template.is-on { background: var(--accent-soft); }
.chat-msg { max-width: min(42rem, 92%); padding: 0.55rem 0.75rem; border: 1px solid var(--border-subtle); }
.chat-msg.is-operator { align-self: flex-end; background: var(--accent-soft); }
.chat-msg-meta { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--muted); }
.chat-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }

/* ── Misc ────────────────────────────────────────────────── */

.block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  overflow: auto;
  max-height: 320px;
  white-space: pre-wrap;
}
.toolbar { margin: 0.75rem 0; width: 100%; }
a.strat-link { font-weight: 650; }

/* ── Narrow ──────────────────────────────────────────────── */

@media (max-width: 900px) {
  .day-totals, #day-totals { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; padding: 0.85rem 0.85rem 2rem; }
  .news-split, .news-calendars {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    max-width: 100%;
  }
  /* Wide tables scroll inside the wrap — never stretch the magazine. */
  #sec-earnings, #sec-econ, .news-calendars, .news-excl-panel {
    overflow-x: hidden;
  }
  table.cal-table, table.news-table, #earnings-table, #econ-table {
    width: max-content !important;
    min-width: 42rem !important;
  }
  .workers-chat { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  :root { --news-card-min: 100%; }
  .page-heading { font-size: 1.15rem; }
  .news-masthead-title { font-size: 1.65rem; }
  .news-grid, .news-window-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    max-width: 100%;
  }
  .news-card { grid-template-columns: 128px minmax(0, 1fr); padding: 0.7rem; }
  .news-card-media, .news-thumb, .news-card-media .news-thumb, .news-thumb-ph { width: 128px; height: 128px; }
  .news-card-media { flex-basis: 128px; }
  .news-card-media .news-live-tickers { display: none; }
  .workers-list { grid-template-columns: 1fr; }
  .tot-value { font-size: 1.5rem; }
  table.data-table th, table.data-table td { padding: 0.4rem 0.45rem; font-size: 0.78rem; }
  .news-inline-figure, .news-inline-figure.is-portrait, .news-inline-figure.is-square { max-width: 100%; }
  .news-inline-figure img { max-height: min(36vh, 16rem); }
  .news-exclusive-hero, .news-exclusive-hero img { max-height: min(28vh, 14rem); width: auto; height: auto; max-width: 100%; }
  .ma-metrics { grid-template-columns: 1fr; }
  .btn, button.secondary, .panel-expand, .section-collapse-btn { min-height: 2.5rem; }
  .desk-table-dense { min-width: 960px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  #day-totals { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
