:root {
  /* Cool neutral graphite — flat surfaces, hairline borders, no glow */
  --bg: #0a0b0c;
  --surface: #101113;
  --surface-raised: #15171a;
  --surface-soft: #1a1d20;
  --surface-selected: #1b1e22;
  --line: #23262a;
  --line-soft: #181a1d;
  --line-strong: #34383d;
  --text: #e6e8ea;
  --muted: #8a9098;
  --muted-strong: #a4abb3;
  --accent: #b8a06a;
  --accent-dim: #7c6c44;
  --accent-soft: #1c1d1a;
  --green: #4db38a;
  --green-bg: #0e1a15;
  --red: #e0635f;
  --red-bg: #1c1413;
  --neutral: #aab0b6;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  /* Tracking for the small uppercase labels that carry the institutional feel */
  --track-label: 0.07em;
  --track-tab: 0.09em;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

body.modal-open {
  overflow: hidden;
}

/* --- Live news drawer ---------------------------------------------------- */
/* Desktop: the open drawer shifts all in-flow content right via body
   padding, so no layout rewiring is needed; fixed modals are unaffected.
   Phones: it overlays the full width instead. */
body.news-open {
  padding-left: 340px;
}

.news-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  width: 340px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  transform: translateX(-100%);
  transition: transform 0.16s ease;
}

body.news-open .news-panel {
  transform: none;
}

.news-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.news-title {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.news-status {
  flex: 1;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: right;
}

/* --- News channel mute chips ------------------------------------------ */
.news-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.news-channels:empty {
  display: none;
}

.news-channel-chip {
  padding: 2px 8px;
  border: 1px solid var(--accent-dim, var(--line));
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: normal;
}

.news-channel-chip:hover {
  border-color: var(--accent);
}

.news-channel-chip.muted {
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.55;
  text-decoration: line-through;
}

.news-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.news-item {
  display: block;
  padding: 10px 16px 11px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
}

.news-item:hover {
  background: var(--surface-soft);
}

.news-item.news-new {
  animation: news-flash 1.6s ease-out;
}

@keyframes news-flash {
  0% { background: rgba(184, 160, 106, 0.16); }
  100% { background: transparent; }
}

.news-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.news-meta strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.news-meta time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.news-item p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-line;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(360px, auto) minmax(280px, 1fr) auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 16px;
  border-right: 1px solid var(--line);
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--accent-dim);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand-copy {
  min-width: 0;
}

h1 {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-copy p,
.modal-header p {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.view-tabs {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 6px;
}

.view-tabs button {
  min-width: 100px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--track-tab);
  text-transform: uppercase;
  transition: color 0.12s ease;
}

.view-tabs button:hover,
.view-tabs button:focus-visible {
  color: var(--text);
  outline: none;
}

.view-tabs button.active {
  border-color: var(--accent);
  background: var(--surface-selected);
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.live-badge,
.toolbar-button,
.icon-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.live-badge {
  color: var(--muted-strong);
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}

.live-freshness {
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.state-dot,
.status-pulse {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.state-dot.live,
.status-strip.live .status-pulse {
  background: var(--green);
}

.state-dot.error,
.status-strip.error .status-pulse {
  background: var(--red);
}

.status-strip.connecting .status-pulse {
  animation: pulse 1.4s ease-in-out infinite;
  background: var(--muted);
}

.toolbar-button,
.icon-button {
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.toolbar-button {
  padding: 0 11px;
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.icon-button {
  width: 32px;
  padding: 0;
  color: var(--muted);
}

.toolbar-button svg,
.icon-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
}

.toolbar-button:hover,
.toolbar-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.toolbar-button.loading svg {
  animation: spin 0.8s linear infinite;
}

.status-strip {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.status-label {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.macro-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 22px;
  min-height: 26px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  overflow-x: auto;
}

.macro-strip[hidden] {
  display: none;
}

.macro-item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.macro-item label {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.macro-item strong {
  color: var(--text);
  font-weight: 600;
}

.macro-item em {
  font-style: normal;
}

.macro-item.stale {
  opacity: 0.55;
}

.workspace {
  width: min(1780px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.view-panel[hidden] {
  display: none;
}

.daily-board {
  display: grid;
  gap: 14px;
}

.analytics-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.panel-heading {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.panel-heading h2 {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.panel-heading h2 {
  display: flex;
  align-items: center;
}

.help-tip {
  position: relative;
  width: 15px;
  height: 15px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  cursor: help;
  flex: 0 0 auto;
}

.help-tip:hover,
.help-tip:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 9px);
  left: -10px;
  z-index: 80;
  width: min(330px, 78vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: normal;
  text-align: left;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.help-tip:hover::after,
.help-tip:focus::after {
  opacity: 1;
  visibility: visible;
}

.panel-heading span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.regime-grid {
  display: grid;
  /* auto-fit: the grid wraps by available width, not viewport width, so it
     stays readable when the news drawer narrows the content area. */
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
}

.regime-cell {
  min-width: 0;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.regime-cell:last-child {
  border-right: 0;
}

.metric-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.metric-value {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  /* Wrap instead of truncating: theme names must stay whole words. */
  white-space: normal;
}

.regime-cell:first-child .metric-value {
  font-size: 18px;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.metric-detail {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: normal;
}

.tone-positive,
.change-positive {
  color: var(--green) !important;
}

.tone-negative,
.change-negative {
  color: var(--red) !important;
}

.tone-neutral,
.change-flat {
  color: var(--neutral) !important;
}

.split-value {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.split-value span:nth-child(2) {
  color: var(--muted);
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.analytics-grid.equal {
  grid-template-columns: 1fr 1fr;
}

.analytics-grid.triple {
  grid-template-columns: 1.3fr 0.85fr 0.85fr;
}

/* The open news drawer removes 340px of content width, which viewport
   media queries cannot see; stack the analytics grids one breakpoint
   earlier when it is open. */
@media (max-width: 1440px) {
  body.news-open .analytics-grid,
  body.news-open .analytics-grid.equal,
  body.news-open .analytics-grid.triple {
    grid-template-columns: 1fr;
  }
}

.benchmark-grid {
  display: grid;
  /* 122px: "SEMICONDUCTORS" must fit unbroken at 10px mono. */
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
}

.benchmark-card {
  min-width: 0;
  min-height: 132px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  padding: 13px 14px;
  text-align: left;
  transition: background 0.12s ease;
}

.benchmark-card:last-child {
  border-right: 0;
}

.benchmark-card:hover,
.benchmark-card:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.benchmark-symbol {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.benchmark-name {
  display: block;
  min-height: 24px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: normal;
}

.metric-lines {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.metric-line,
.breadth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-line strong,
.breadth-row strong {
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
}

.breadth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
  padding: 10px 14px;
}

.breadth-row {
  min-height: 29px;
  border-bottom: 1px solid var(--line-soft);
}

.breadth-spark {
  display: inline-flex;
  align-items: center;
}

.breadth-spark .sparkline {
  width: 92px;
  height: 16px;
}

.theme-delta {
  font-family: var(--font-mono);
}

.crypto-flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crypto-flow-card {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.crypto-flow-card:last-child {
  border-right: 0;
}

.crypto-flow-summary {
  min-height: 96px;
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.crypto-flow-summary .metric-value {
  display: block;
  margin-top: 7px;
  font-size: 21px;
}

.flow-side-metrics {
  display: grid;
  gap: 5px;
}

.crypto-flow-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.crypto-flow-lists.single {
  grid-template-columns: 1fr;
}

.crypto-flow-lists.single .flow-list:first-child {
  border-right: 0;
}

.flow-list {
  min-width: 0;
  padding: 11px 13px;
}

.flow-list:first-child {
  border-right: 1px solid var(--line-soft);
}

.flow-list-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.flow-item {
  min-height: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.flow-item:last-child {
  border-bottom: 0;
}

.flow-item strong {
  color: var(--text);
  font-weight: 600;
}

.flow-empty {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.flow-empty.solo {
  display: block;
  padding: 11px 13px;
}

.tone-warn {
  color: var(--accent);
}

.theme-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.theme-table th,
.theme-table td {
  height: 36px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 10px;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-table tr:last-child td {
  border-bottom: 0;
}

.theme-table th {
  height: 28px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.theme-table td {
  font-family: var(--font-mono);
}

.theme-link {
  min-width: 0;
  max-width: calc(100% - 36px);
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-family: inherit;
  font-weight: inherit;
  line-height: 1.3;
  padding: 0;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
}

.theme-link:hover {
  color: var(--accent);
}

.theme-table tbody tr {
  transition: background 0.12s ease;
}

.theme-table tbody tr:hover {
  background: var(--surface-soft);
}

.theme-table th:first-child,
.theme-table td:first-child {
  width: 38px;
  color: var(--muted);
  text-align: center;
}

.theme-table th:nth-child(2),
.theme-table td:nth-child(2) {
  width: auto;
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 600;
  text-align: left;
}

.theme-table th:nth-child(3),
.theme-table td:nth-child(3) {
  width: 60px;
}

.theme-table th:nth-child(4),
.theme-table td:nth-child(4),
.theme-table th:nth-child(5),
.theme-table td:nth-child(5),
.theme-table th:nth-child(6),
.theme-table td:nth-child(6) {
  width: 68px;
}

.theme-table th:last-child,
.theme-table td:last-child {
  width: 112px;
}

.member-count {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
}

.score-value {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.score-bar {
  position: relative;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  padding-right: 2px;
}

.score-bar::before {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: var(--score);
  background: rgba(184, 160, 106, 0.24);
}

.status-tag {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-dominant,
.status-strong {
  color: var(--green);
}

.status-emerging {
  color: var(--accent);
}

.status-neutral {
  color: var(--neutral);
}

.status-deteriorating,
.status-fading {
  color: var(--red);
}

.rotation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.rotation-column:first-child {
  border-right: 1px solid var(--line);
}

.rotation-label {
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.rotation-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 76px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10px;
  transition: background 0.12s ease;
}

.rotation-row:hover {
  background: var(--surface-soft);
}

.rotation-row:last-child {
  border-bottom: 0;
}

.rotation-row strong {
  overflow: hidden;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
}

.rotation-row span {
  color: var(--muted);
  font-family: var(--font-mono);
  text-align: right;
}

.board {
  column-gap: 12px;
  columns: 460px;
}

.board.board-crypto {
  columns: 500px;
}

.board.flat {
  columns: auto;
  max-width: 860px;
}

.market-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.category-tabs {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  background: var(--surface);
}

.category-tabs button {
  padding: 6px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.category-tabs button + button {
  border-left: 1px solid var(--line);
}

.category-tabs button:hover {
  color: var(--text);
}

.category-tabs button.active {
  background: var(--surface-raised);
  color: var(--text);
}

/* Transparent wrapper: tape panels become direct children of the board's
   multicol flow, packing with the Majors panel instead of leaving holes. */
.crypto-tape {
  display: contents;
}

.crypto-tape[hidden] {
  display: none;
}

.tape-panel .group-title,
.tape-panel .asset-row {
  /* Every track is shrinkable: fixed widths overflowed the panel when the
     masonry column came out narrower than their sum, pushing 24h volume
     values into (and past) the right border. */
  grid-template-columns:
    minmax(84px, 1.2fr) minmax(60px, 1fr) minmax(48px, 0.8fr)
    minmax(50px, 0.8fr) minmax(60px, 1fr) minmax(68px, 1fr);
}

.tape-panel .group-title span:last-child,
.tape-panel .asset-row span:last-child {
  padding-right: 13px;
}

.tape-panel .tape-funding,
.tape-panel .tape-oi,
.tape-panel .tape-volume {
  color: var(--muted-strong);
  font-family: var(--font-mono);
}

.tape-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 5px 9px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.tape-pager button {
  min-width: 22px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.tape-pager button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.tape-pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.market-search {
  min-width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 7px 9px;
}

.market-search svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.market-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-transform: none;
}

.toolbar-button.compact {
  min-height: 29px;
  padding: 0 10px;
}

.group-panel {
  min-width: 0;
  width: 100%;
  display: inline-block;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  break-inside: avoid;
  vertical-align: top;
}

.group-title,
.asset-row {
  display: grid;
  grid-template-columns:
    minmax(88px, 1.7fr) minmax(64px, 1fr) minmax(56px, 0.9fr) minmax(52px, 0.9fr)
    minmax(52px, 0.9fr) minmax(50px, 0.8fr) minmax(56px, 0.9fr);
  align-items: stretch;
}

.group-title {
  background: var(--surface-raised);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.group-title span:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
  color: var(--accent);
}

.group-title span:first-child button {
  width: auto;
  flex: 0 1 auto;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
}

.session-chip {
  flex: 0 1 auto;
  overflow: hidden;
  padding: 1px 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.05em;
  line-height: 1.35;
  white-space: normal;
}

.session-chip[data-state="open"] {
  border-color: rgba(77, 179, 138, 0.35);
  color: var(--green);
}

.session-chip[data-state="edge"] {
  border-color: rgba(184, 160, 106, 0.4);
  color: var(--accent);
}

.funding-chip {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.04em;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
}

.funding-chip.funding-hot {
  border-color: rgba(224, 108, 108, 0.4);
  color: var(--red);
}

.funding-chip.funding-negative {
  border-color: rgba(77, 179, 138, 0.35);
  color: var(--green);
}

.rvol-cell {
  color: var(--muted-strong);
  font-family: var(--font-mono);
}

.rvol-cell.rvol-warm {
  color: var(--accent);
}

.rvol-cell.rvol-hot {
  color: var(--text);
  background: rgba(184, 160, 106, 0.14);
}

.group-title button {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-overflow: ellipsis;
  text-transform: inherit;
  white-space: nowrap;
}

.group-title button:hover,
.group-title button.active-sort {
  color: var(--text);
}

.group-title button.active-sort::after {
  content: " ↓";
  color: var(--accent);
}

.group-title button.active-sort[aria-sort="ascending"]::after {
  content: " ↑";
}

.group-title span,
.asset-row span {
  min-width: 0;
  overflow: hidden;
  padding: 7px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-title span:not(:first-child),
.asset-row span:not(:first-child) {
  text-align: right;
}

.asset-row {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: background 0.1s ease;
}

.asset-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.012);
}

.asset-row:hover,
.asset-row:focus-visible {
  background: var(--surface-soft);
}

.asset-row:focus-visible,
.benchmark-card:focus-visible,
.theme-link:focus-visible,
.toolbar-button:focus-visible,
.icon-button:focus-visible,
.intervals button:focus-visible,
.profile-description-toggle:focus-visible,
.group-title button:focus-visible,
.market-search:focus-within {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.change-abs-cell {
  color: var(--muted-strong);
}

.last-cell.flash-up,
.change-abs-cell.flash-up,
.change-positive.flash-up {
  animation: flash-up 0.45s ease-out;
}

.last-cell.flash-down,
.change-abs-cell.flash-down,
.change-negative.flash-down {
  animation: flash-down 0.45s ease-out;
}

.symbol-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-sans);
  text-align: left;
}

.symbol-cell strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-cell small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: normal;
}

.sparkline-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.sparkline {
  width: 48px;
  height: 22px;
}

.sparkline polyline {
  fill: none;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.sparkline-positive polyline {
  stroke: var(--green);
}

.sparkline-negative polyline {
  stroke: var(--red);
}

.sparkline-empty {
  color: var(--muted);
}

.stale-row {
  color: var(--muted);
}

.empty-state {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.skeleton-line,
.loading-cell span,
.loading-cell strong,
.loading-cell em,
.loading-blocks span,
.loading-list span,
.loading-table span,
.loading-rows span,
.board-loading .group-title span {
  display: block;
  overflow: hidden;
  background: linear-gradient(90deg, var(--surface-soft), #22262a, var(--surface-soft));
  background-size: 220% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}

.loading-panel {
  overflow: hidden;
}

.skeleton-line {
  width: 140px;
  height: 10px;
}

.skeleton-line.short {
  width: 92px;
}

.skeleton-line.title {
  width: 168px;
}

.loading-regime .loading-cell {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.loading-regime .loading-cell:last-child {
  border-right: 0;
}

.loading-cell span {
  width: 48px;
  height: 8px;
}

.loading-cell strong {
  width: 78%;
  height: 16px;
}

.loading-cell em {
  width: 62%;
  height: 8px;
}

.loading-blocks {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.loading-blocks span {
  min-height: 132px;
  border-right: 1px solid var(--line);
}

.loading-blocks span:last-child {
  border-right: 0;
}

.loading-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.loading-list span,
.loading-table span,
.loading-rows span {
  height: 18px;
}

.loading-table {
  display: grid;
}

.loading-table span {
  height: 36px;
  border-bottom: 1px solid var(--line-soft);
}

.loading-rows span {
  height: 37px;
  border-top: 1px solid var(--line-soft);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.modal.open {
  display: flex;
}

.modal-shell,
.editor-shell {
  width: min(1180px, 100%);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.modal-shell {
  height: min(980px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto auto minmax(320px, 1fr) auto;
  grid-template-areas:
    "modal-header"
    "modal-intervals"
    "modal-error"
    "modal-chart"
    "modal-profile";
  overflow: hidden;
}

.modal-shell.profile-hidden {
  height: min(820px, calc(100vh - 36px));
  grid-template-rows: auto auto auto minmax(340px, 1fr);
  grid-template-areas:
    "modal-header"
    "modal-intervals"
    "modal-error"
    "modal-chart";
}

.editor-shell {
  height: min(780px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr;
}

.modal-header {
  grid-area: modal-header;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.modal-header h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.editor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(360px, 1fr);
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
}

.editor-form {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.asset-form {
  grid-column: 2;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  align-items: end;
}

.editor-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-form input,
.editor-form select {
  width: 100%;
  min-height: 31px;
  border: 1px solid var(--line);
  background: #0c0d0f;
  color: var(--text);
  padding: 0 9px;
  font-family: var(--font-mono);
  transition: border-color 0.12s ease;
}

.editor-form input:focus,
.editor-form select:focus {
  border-color: var(--line-strong);
  outline: none;
}

.editor-form button,
.editor-group button,
.editor-asset button {
  min-height: 31px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.12s ease;
}

.editor-form button:hover,
.editor-group button:hover,
.editor-asset button:hover {
  border-color: var(--line-strong);
}

.editor-form button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.editor-list {
  min-height: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  overflow: auto;
}

.editor-group {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.editor-group-header,
.editor-asset {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
}

.editor-group-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-assets {
  display: grid;
}

.editor-asset {
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.editor-asset span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.35;
  white-space: normal;
}

.editor-empty {
  padding: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.intervals {
  grid-area: modal-intervals;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.interval-group {
  margin: 0 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.interval-group:first-child {
  margin-left: 0;
}

.intervals button {
  min-width: 48px;
  min-height: 29px;
  margin-right: -1px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--muted-strong);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.intervals button.session-closed {
  color: var(--muted);
  background: var(--surface);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

.intervals button:hover {
  position: relative;
  z-index: 1;
  border-color: var(--line-strong);
  color: var(--text);
}

.intervals button.active {
  position: relative;
  z-index: 1;
  border-color: var(--accent-dim);
  background: var(--surface-selected);
  color: var(--accent);
}

.chart-error {
  grid-area: modal-error;
  padding: 10px 14px;
  border-bottom: 1px solid var(--red);
  color: var(--red);
  background: var(--red-bg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.chart-legend {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 3;
  display: flex;
  gap: 10px;
  padding: 3px 7px;
  background: rgba(10, 11, 12, 0.72);
  border: 1px solid var(--line-soft);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chart-legend i {
  width: 10px;
  height: 2px;
  display: inline-block;
}

.chart {
  grid-area: modal-chart;
  position: relative;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
}

.chart-loading {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.loading-spinner {
  width: 15px;
  height: 15px;
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.asset-profile {
  grid-area: modal-profile;
  min-height: 0;
  max-height: min(330px, 36vh);
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  grid-template-rows: auto auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
}

.asset-profile[hidden] {
  display: none;
}

.profile-summary {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.profile-kicker,
.profile-meta,
.profile-metric span,
.profile-empty {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
}

.profile-summary h3 {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.profile-summary h3 span {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

.profile-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
}

.profile-description {
  color: var(--muted-strong);
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.profile-description.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.profile-description-toggle {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 1px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.profile-metrics {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  align-content: start;
  gap: 1px;
  background: var(--line-soft);
  overflow: auto;
}

.profile-metric {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  background: var(--surface);
}

.profile-metric:nth-last-child(1):nth-child(3n + 1) {
  grid-column: 1 / -1;
}

.profile-metric span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.profile-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-market-context {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line-soft);
}

.profile-market-context.is-loading {
  border-top-color: var(--line-strong);
}

.profile-market-context > :only-child {
  grid-column: 1 / -1;
}

.profile-range,
.profile-performance {
  min-width: 0;
  background: var(--surface);
  padding: 10px 14px;
}

.profile-range {
  display: grid;
  gap: 7px;
}

.profile-range-head,
.range-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-range-head span,
.range-labels {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-range-head strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.range-track {
  position: relative;
  height: 2px;
  background: var(--line-strong);
}

.range-track::before,
.range-track::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
}

.range-track::before {
  left: 0;
}

.range-track::after {
  right: 0;
}

.range-track span {
  position: absolute;
  top: 50%;
  left: var(--range-position);
  width: 8px;
  height: 8px;
  border: 1px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 160, 106, 0.14);
  transform: translate(-50%, -50%);
}

.range-labels span:nth-child(2) {
  color: var(--muted-strong);
  text-align: center;
}

.profile-performance {
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 1px;
  padding: 0;
}

.profile-context-loading {
  grid-column: 1 / -1;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.performance-cell {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 8px;
  background: var(--surface);
  font-family: var(--font-mono);
}

.performance-cell span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.performance-cell strong {
  font-size: 11px;
  font-weight: 600;
}

.profile-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  align-content: center;
  justify-items: start;
  padding: 14px;
  color: var(--muted);
  font-size: 10px;
}

.profile-empty strong {
  color: var(--text);
  font-size: 10px;
}

.profile-empty.small {
  align-content: start;
  border-left: 1px solid var(--line-soft);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.42;
  }
}

@keyframes skeleton {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

@keyframes flash-up {
  0% {
    background: rgba(77, 179, 138, 0.28);
  }
  100% {
    background: transparent;
  }
}

@keyframes flash-down {
  0% {
    background: rgba(224, 99, 95, 0.28);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 1050px) {
  .app-header {
    grid-template-columns: minmax(270px, 1fr) auto;
  }

  .view-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line);
  }

  .view-tabs button {
    min-height: 34px;
  }

  .analytics-grid,
  .analytics-grid.equal,
  .analytics-grid.triple {
    grid-template-columns: 1fr;
  }

  .loading-blocks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .asset-profile {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .profile-market-context {
    grid-template-columns: 1fr;
  }

  .profile-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .profile-metrics {
    grid-template-columns: repeat(3, minmax(94px, 1fr));
  }

  .regime-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .regime-cell:nth-child(3) {
    border-right: 0;
  }

  .regime-cell:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* Phones: the drawer overlays instead of pushing content. */
  body.news-open {
    padding-left: 0;
  }

  .news-panel {
    width: 100%;
    border-right: 0;
  }

  .brand {
    padding: 7px 10px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 10px;
  }

  h1 {
    font-size: 11px;
  }

  .topbar-actions {
    padding: 7px 10px;
  }

  .toolbar-button span,
  .live-badge {
    display: none;
  }

  .toolbar-button {
    width: 32px;
    padding: 0;
  }

  .view-tabs button {
    min-width: 0;
    flex: 1;
  }

  .workspace {
    padding: 10px;
  }

  .regime-grid {
    grid-template-columns: 1fr 1fr;
  }

  .regime-cell:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .regime-cell:nth-child(even) {
    border-right: 0;
  }

  .regime-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .regime-cell:first-child .metric-value {
    font-size: 16px;
  }

  .benchmark-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .benchmark-card {
    border-bottom: 1px solid var(--line);
  }

  .benchmark-card:nth-child(even) {
    border-right: 0;
  }

  .breadth-grid,
  .crypto-flow-grid,
  .crypto-flow-summary,
  .crypto-flow-lists,
  .rotation-grid {
    grid-template-columns: 1fr;
  }

  .crypto-flow-card,
  .crypto-flow-card:last-child,
  .flow-list:first-child {
    border-right: 0;
  }

  .crypto-flow-card:not(:last-child),
  .flow-list:first-child {
    border-bottom: 1px solid var(--line);
  }

  .rotation-column:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  /* Phones: drop the middle return columns so theme names stay readable.
     Score table keeps # / Theme / Score / 5D / Status; momentum keeps
     # / Theme / Δ pace / Status. */
  .theme-table th:nth-child(4),
  .theme-table td:nth-child(4),
  .theme-table th:nth-child(5),
  .theme-table td:nth-child(5) {
    display: none;
  }

  .theme-table th:nth-child(3),
  .theme-table td:nth-child(3) {
    width: 66px;
  }

  .theme-table th:last-child,
  .theme-table td:last-child {
    width: 88px;
  }

  /* DETERIORATING (13ch) must fit the 88px status cell whole. */
  .status-tag {
    font-size: 8.5px;
    letter-spacing: 0.02em;
  }

  .board {
    columns: 1;
  }

  .market-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .market-search {
    min-width: 100%;
  }

  /* Phones: six data columns cannot fit, so secondary ones drop out.
     Watchlist rows keep Symbol / Last / 1D% / Trend; tape rows keep
     Symbol / Last / 1D% / 24h Vol. */
  .group-panel:not(.tape-panel) .group-title,
  .group-panel:not(.tape-panel) .asset-row {
    grid-template-columns: minmax(96px, 1.4fr) minmax(72px, 1fr) minmax(56px, 0.9fr) minmax(52px, 0.9fr);
  }

  .group-panel:not(.tape-panel) .group-title span:nth-child(3),
  .group-panel:not(.tape-panel) .group-title span:nth-child(5),
  .group-panel:not(.tape-panel) .group-title span:nth-child(6),
  .asset-row [data-cell="abs"],
  .asset-row [data-cell="open"],
  .asset-row [data-cell="rvol"] {
    display: none;
  }

  .tape-panel .group-title,
  .tape-panel .asset-row {
    grid-template-columns: minmax(84px, 1.3fr) minmax(70px, 1fr) minmax(56px, 0.9fr) minmax(72px, 1fr);
  }

  .tape-panel .group-title span:nth-child(4),
  .tape-panel .group-title span:nth-child(5),
  .tape-panel .tape-funding,
  .tape-panel .tape-oi {
    display: none;
  }

  .modal-shell {
    grid-template-rows: auto auto auto minmax(260px, 1fr) auto;
  }

  .modal-shell.profile-hidden {
    grid-template-rows: auto auto auto minmax(260px, 1fr);
  }

  .chart {
    min-height: 260px;
  }

  .profile-metrics {
    grid-template-columns: repeat(2, minmax(94px, 1fr));
  }

  .profile-performance {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }

  .range-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .range-labels span:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .profile-metric:nth-last-child(1):nth-child(3n + 1) {
    grid-column: auto;
  }

  .profile-metric:nth-last-child(1):nth-child(2n + 1) {
    grid-column: 1 / -1;
  }

  .modal {
    padding: 0;
  }

  .modal-shell,
  .editor-shell {
    height: 100vh;
    height: 100dvh; /* stable under iOS Safari's dynamic toolbar */
    border-right: 0;
    border-left: 0;
  }

  .editor-grid,
  .asset-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .asset-form,
  .editor-list {
    grid-column: 1;
  }
}
