/* Interface refinement: shared surfaces, portfolio hierarchy and compact navigation. */

/* 1. Color, type and shared controls. */
:root {
  --bg: #0b1119;
  --surface-1: #141d29;
  --surface-2: #1b2838;
  --surface-3: #25374b;
  --surface-inset: #101823;
  --text: #edf2f7;
  --text-2: #c1ccda;
  --muted: #9baabd;
  --accent: #72d8ca;
  --accent-ink: #092623;
  --green: #72d9ab;
  --red: #ff939c;
  --amber: #edc887;
  --border: rgba(172, 193, 215, .14);
  --border-strong: rgba(172, 193, 215, .25);
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;
  --fs-3xl: 30px;
  --r-md: 12px;
  --r-lg: 14px;
  --shadow: none;
}
body { background: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: none; }
.view.active { animation: none; }
.panel, .metrics article, .terminalcard, .attentionBlock, .attentionCard,
.opportunity, .brPanel, .marketLeaderCard, .currencyGoldHighlight, .researchLaunch {
  background: var(--surface-1);
  box-shadow: none;
}
.panel, .terminalcard, .marketLeaderCard, .currencyGoldHighlight { border-color: var(--border); }
.eyebrow { font-size: 10px; letter-spacing: .11em; font-weight: 700; }
.chartnote, .footnote { line-height: 1.65; }
.button { min-height: 40px; gap: 8px; padding: 0 13px; font-size: 12px; border-radius: 8px; }
.button.primary { background: var(--accent); }
.button.quiet { color: var(--text-2); }
.button.quiet:hover { background: var(--surface-2); }
.textbutton { font-size: 12px; }
.uiIcon, .navIcon { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.field input, .field select, .filters > input, .filters > select { min-height: 40px; }
.segmented { background: var(--surface-inset); }
.segmented button { min-height: 34px; }
.pill { font-size: 11px; padding: 4px 9px; }

/* 2. Header and desktop workspace navigation. */
.shell { width: 100%; max-width: 1920px; padding: 0; }
.top {
  min-width: 0;
  min-height: 76px;
  padding: 16px 24px;
  margin: 0;
  gap: 18px;
  background: var(--bg);
  backdrop-filter: none;
  z-index: 5;
}
.top .brand { min-width: 0; flex-shrink: 0; gap: 11px; }
.brand small { font-size: 9px; letter-spacing: .13em; color: var(--muted); }
.brand b { display: block; margin-top: 3px; font-size: 14px; font-weight: 700; }
.logo { width: 36px; height: 36px; background: var(--accent); border-radius: 10px; }
.status { min-width: 0; flex-shrink: 1; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
#versionBadge { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#connection { min-width: 0; max-width: min(280px, 100%); overflow: hidden; text-overflow: ellipsis; }
.actions { flex-shrink: 0; align-items: center; gap: 8px; }
.top .commandTrigger > span { font-size: inherit; line-height: inherit; }
.commandTrigger kbd { margin-left: 5px; font-size: 9px; }
.mobileQuickNav { display: none; }
#nav button[data-view]::before { display: none; content: none; }
#nav .navIcon { width: 18px; height: 18px; color: inherit; }
#nav button.active { box-shadow: none; color: var(--accent); background: #17322f; border-color: #2d514d; }
#nav button:hover { color: var(--text); background: var(--surface-2); }
#nav button.active:hover { color: var(--accent); background: #1a3a35; }

/* 3. Overview: value first, followed by coverage, allocation and market context. */
.welcome.overviewWelcome { padding: 0; margin: 0 0 24px; align-items: center; gap: 20px; }
.welcome.overviewWelcome > div:first-child { max-width: none; }
.welcome.overviewWelcome h1 { margin: 8px 0; font-size: 28px; line-height: 1.2; letter-spacing: -.035em; }
.overviewWelcome p { color: var(--muted); font-size: 13px; }
.overviewSync { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: right; }
.overviewSync #asof { color: var(--text-2); font: 10px var(--mono); }
.syncDot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--muted); }
.overviewSummary { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.2fr); gap: 20px; margin-bottom: 18px; }
.portfolioValueCard { min-width: 0; padding: 26px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface-1); }
.valueCardHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.valueCardHead .eyebrow { color: var(--text-2); font-size: 10px; }
.unitsTag { flex-shrink: 0; padding: 3px 7px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; font: 10px var(--mono); }
.portfolioValueCard .total { min-width: 0; max-width: none; padding: 0; border: 0; text-align: left; }
.portfolioValueCard .total strong { margin: 17px 0 10px; font: 500 clamp(36px, 3.2vw, 54px) / 1.15 var(--mono); letter-spacing: -.055em; overflow-wrap: anywhere; }
.portfolioValueCard .total span { display: block; max-width: none; font: 11px / 1.8 var(--mono); }
.valueCardFoot { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.valueCardFoot .uiIcon { width: 15px; height: 15px; flex-basis: 15px; }
.metrics.overviewMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.overviewMetrics article { min-width: 0; align-content: start; gap: 5px; padding: 18px 20px; border-radius: 12px; }
.overviewMetrics article small { color: var(--muted); font-size: 10px; letter-spacing: .055em; }
.overviewMetrics article strong { color: var(--text); font: 500 25px / 1.3 var(--mono); letter-spacing: -.035em; }
.overviewMetrics article span { font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.deskDataStrip { margin-bottom: 24px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-inset); }
.deskDataStrip #marketDataStatus { color: var(--text-2); font-size: 12px; line-height: 1.6; }
.exposurePanel { margin: 0 0 24px; padding: 22px; }
.exposurePanel h2 { margin-top: 6px; font-size: 19px; }
.exposureMap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.exposureTile { min-height: 100px; padding: 14px; border-radius: 8px; }
.exposureTile.gain { background: #17312c; border-color: #29473e; }
.exposureTile.loss { background: #31232d; border-color: #4f343f; }
.exposureTile.unknown { background: var(--surface-2); }
.exposureTile strong { font-size: 23px; letter-spacing: -.04em; }
.exposureTile span { font-size: 11px; }
.exposureBarNote { display: none; }
.overviewWorkspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); align-items: start; gap: 20px; margin-bottom: 24px; }
.overviewWorkspace > *, .overviewContext { min-width: 0; }
.overviewWorkspace > .chartpanel { margin: 0; padding: 22px; }
.overviewContext .terminalcards { grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 0; }
.overviewContext .terminalcard { gap: 14px; padding: 20px; }
.overviewContext .walletSummary { flex-direction: column; align-items: stretch; gap: 14px; }
.overviewContext .walletDonut { align-self: center; width: 88px; height: 88px; }
.overviewContext .walletLegend { width: 100%; font-size: 12px; }
.overviewContext .walletLegend li { grid-template-columns: 8px minmax(0, 1fr) auto 41px; gap: 7px; }
.overviewContext .walletLegend b { font-size: 11px; }
.overviewContext .walletLegend small { font-size: 10px; }
.overviewContext .walletLegend em { font-size: 10px; }
.overviewContext .leaderRow { min-height: 36px; padding: 7px 0; border-radius: 4px; font-size: 12px; }
.overviewContext .leaderRow + .leaderRow { border-top: 1px solid var(--border); }
.overviewContext .sentimentReadout strong { font-size: 34px; }
.overviewContext .sentimentFoot { flex-wrap: wrap; font-size: 11px; line-height: 1.6; }
.overviewContext .sentimentNote { font-size: 11px; line-height: 1.65; }
.attentionBlock { margin: 0 0 24px; padding: 22px; border: 1px solid var(--border); }
.attentionCard { background: var(--surface-inset); }
.attentionCard > small { font-size: 10px; }
.attentionCard > span { font-size: 12px; }

/* 4. Cohesive market pages, prices and inspectable tables. */
.marketPageHead { padding: 0 0 24px; }
.marketPageHead h1 { margin: 8px 0 10px; font-size: clamp(28px, 2.5vw, 36px); letter-spacing: -.04em; }
.marketPageHead p { max-width: 700px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.sectionhead h2, .marketDirectoryHead h2 { font-size: 23px; }
.sectionhead p, .cardHead p { line-height: 1.65; }
.metrics article strong { font-family: var(--mono); font-weight: 500; }
.marketFilters { gap: 16px; }
.marketLeaderCard { padding: 20px; }
.marketLeaderCard h3 { font-size: 14px; }
.marketLeaderCard > div > span { font-size: 11px; }
.marketCoin small { font-size: 10px; }
.tablebox { max-width: 100%; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #34485c transparent; }
th { padding: 13px 16px; letter-spacing: .05em; font-size: 10px; }
td { padding: 14px 16px; font-size: 12px; }
.marketTable th, .currencyGoldTable thead th { font-size: 10px; }
.marketTable td, .currencyGoldTable td { font-size: 12px; }
.quoteAuditSource { font-size: 11px; line-height: 1.6; }
.currencyGoldHighlights { gap: 18px; margin-bottom: 26px; }
.currencyGoldHighlight { padding: 22px; border-radius: var(--r-lg); }
.currencyGoldHighlightGold { border-top-color: #9f895b; }
.currencyGoldHighlight h3 { font-size: 14px; }
.currencyGoldHighlight > div > span { font-size: 11px; }
.currencyGoldHighlight > small { margin: 8px 0 19px; font-size: 12px; }
.currencyGoldHighlight dt { margin-bottom: 6px; font-size: 12px; }
.currencyGoldHighlight dd { font-size: clamp(22px, 1.7vw, 30px); letter-spacing: -.04em; }
.currencyGoldHighlight p { margin-top: 17px; font-size: 12px; }
.currencyGoldHighlight p > span { font-size: 11px; }
.currencyGoldPanelHead h2 { font-size: 21px; }
.currencyGoldFeedStatus, .currencyGoldTableNote { font-size: 12px; line-height: 1.65; }
.currencyGoldIdentity > b { font-size: 13px; }
.currencyGoldIdentity > small { font-size: 11px; line-height: 1.55; }
.currencyGoldTime > span, .currencyGoldTime > small, .currencyGoldSource { font-size: 11px; }
#currencyGoldDenomination { margin-bottom: 7px; color: var(--text-2); }
.currencyGoldFootnote { font-size: 12px; }
footer { color: var(--muted); font-size: 11px; line-height: 1.8; }

/* 5. Desktop and medium-width layouts. */
@media (min-width: 1101px) {
  .shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .top { grid-column: 1 / -1; flex-wrap: nowrap; }
  #nav { grid-column: 1; grid-row: 2 / 4; position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; align-items: stretch; gap: 28px; height: calc(100vh - 76px); padding: 28px 14px; margin: 0; overflow-y: auto; border: 0; border-right: 1px solid var(--border); background: var(--surface-inset); }
  #nav .mobileNav { display: none; }
  #nav .navGroup { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; border: 0; border-radius: 0; background: none; }
  #nav .navGroupLabel { display: block; margin: 0 12px 9px; font-size: 9px; letter-spacing: .15em; }
  #nav button { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 11px; font-size: 12px; text-align: left; color: var(--text-2); }
  main { grid-column: 2; min-width: 0; padding: 28px 30px 0; }
  footer { grid-column: 2; margin: 8px 30px 0; padding: 18px 0 26px; }
}
@media (min-width: 1101px) and (max-width: 1499px) {
  .top { gap: 14px; padding: 16px 20px; }
  .brand b { font-size: 13px; }
  #connection { max-width: min(258px, 100%); font-size: 10px; }
  #commandOpen .actionLabel, #commandOpen kbd, #signout .actionLabel { display: none; }
  #commandOpen, #signout { width: 40px; padding: 0; }
  .top .actions { gap: 6px; }
  .top .actions .button { padding-left: 10px; padding-right: 10px; font-size: 11px; }
  .overviewWorkspace { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
  .overviewContext .terminalcard { padding: 17px; }
}
@media (max-width: 1100px) {
  .shell { display: block; max-width: none; padding: 0; }
  .top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: 'brand status' 'actions actions'; row-gap: 12px; }
  .top .brand { grid-area: brand; }
  .top .status { grid-area: status; order: initial; width: auto; margin: 0; justify-content: flex-end; }
  #connection { max-width: min(290px, 100%); font-size: 10px; }
  .top .actions { grid-area: actions; display: flex; flex-wrap: wrap; margin: 0; justify-content: flex-end; }
  .top .actions .button { flex: 0 0 auto; }
  #commandOpen kbd { display: none; }
  #exportExcel { display: inline-flex; }
  #nav { position: static; display: block; height: auto; padding: 15px 24px; margin: 0; border: 0; border-bottom: 1px solid var(--border); overflow: visible; background: var(--surface-inset); }
  #nav .navGroup { display: none; }
  #nav .mobileNav { display: flex; align-items: center; gap: 14px; width: 100%; color: var(--muted); font-size: 12px; }
  #nav .mobileNav select { flex: 1; min-width: 0; min-height: 42px; padding: 8px 12px; color: var(--text); background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 8px; font-weight: 600; }
  main { padding: 24px 24px 0; }
  footer { margin: 24px 24px 0; padding: 16px 0 24px; }
  .overviewWorkspace { grid-template-columns: minmax(0, 1fr); }
  .overviewContext .terminalcards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overviewSummary { gap: 16px; }
  .portfolioValueCard { padding: 22px; }
  .overviewMetrics article { padding: 16px; }
}
@media (min-width: 601px) and (max-width: 850px) {
  .overviewSummary { grid-template-columns: minmax(0, 1fr); }
  .metrics.overviewMetrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overviewMetrics article strong { font-size: 22px; }
  .overviewMetrics article small { min-height: 2.8em; }
  .overviewContext .terminalcards { grid-template-columns: minmax(0, 1fr); }
  .overviewContext .walletSummary { flex-direction: row; }
  .overviewContext .walletLegend { max-width: 420px; }
  .currencyGoldHighlights { gap: 12px; }
  .currencyGoldHighlight { padding: 17px; }
  .currencyGoldHighlight > div { align-items: flex-start; }
  .currencyGoldHighlight dd { font-size: 20px; }
}

/* 6. Phone: visible primary actions and four persistent workspace shortcuts. */
@media (max-width: 600px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .top { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: none; gap: 10px; padding: 12px 16px; }
  .top .brand { grid-area: auto; grid-column: 1 / -1; grid-row: 1; min-height: 42px; padding-right: 100px; gap: 9px; }
  .brand > span:last-child { min-width: 0; }
  .brand small { font-size: 8px; letter-spacing: .09em; white-space: nowrap; }
  .brand b { font-size: 12px; white-space: nowrap; }
  .logo { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 9px; }
  .logo svg { width: 19px; height: 19px; }
  .top .actions { display: contents; }
  .top .actions .button { min-height: 42px; margin: 0; padding: 0 10px; font-size: 11px; flex: initial; }
  #commandOpen, #signout { position: absolute; top: 12px; width: 42px; padding: 0; }
  #commandOpen { right: 64px; }
  #signout { right: 16px; }
  #commandOpen .actionLabel, #signout .actionLabel { display: none; }
  #refresh { grid-column: 1; grid-row: 2; }
  #add { grid-column: 2; grid-row: 2; }
  #exportExcel { display: none; }
  .top .status { grid-area: auto; grid-column: 1 / -1; grid-row: 3; width: 100%; justify-content: space-between; gap: 8px; }
  #versionBadge { display: inline-flex; font-size: 9px; padding: 3px 7px; }
  #connection { min-height: 25px; max-width: 100%; padding: 3px 7px; font-size: 9px; }
  #nav { padding: 12px 16px; }
  #nav .mobileNav { gap: 12px; font-size: 11px; }
  #nav .mobileNav select { min-height: 42px; font-size: 12px; }
  main { padding: 22px 16px 0; }
  footer { margin: 20px 16px 0; padding-bottom: 22px; font-size: 10px; }
  .welcome.overviewWelcome { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 19px; }
  .welcome.overviewWelcome h1 { margin: 6px 0; font-size: 24px; }
  .overviewWelcome p { font-size: 12px; }
  .overviewSync { gap: 7px; font-size: 10px; line-height: 1.5; text-align: left; }
  .overviewSync br { display: none; }
  .overviewSync #asof { margin-left: 5px; font-size: 9px; }
  .overviewSummary { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 15px; }
  .portfolioValueCard { padding: 21px; }
  .valueCardHead .eyebrow { font-size: 9px; }
  .unitsTag { font-size: 9px; }
  .portfolioValueCard .total strong { margin: 15px 0 9px; font-size: clamp(32px, 9vw, 40px); }
  .portfolioValueCard .total span { font-size: 10px; line-height: 1.75; }
  .valueCardFoot { margin-top: 17px; padding-top: 12px; font-size: 10px; }
  .metrics.overviewMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .overviewMetrics article { min-height: 94px; padding: 14px; gap: 4px; }
  .overviewMetrics article small { font-size: 9px; letter-spacing: .035em; }
  .overviewMetrics article strong { font-size: 23px; }
  .overviewMetrics article span { font-size: 10px; line-height: 1.55; }
  .deskDataStrip { align-items: flex-start; gap: 10px; padding: 12px; margin-bottom: 18px; }
  .deskDataStrip > div { gap: 8px; }
  .deskDataStrip #marketDataStatus { font-size: 11px; }
  .deskDataStrip .textbutton { min-height: 32px; font-size: 11px; }
  .exposurePanel { padding: 16px; margin-bottom: 20px; }
  .exposurePanel .cardHead { align-items: center; gap: 10px; }
  .exposurePanel h2 { font-size: 17px; }
  .exposurePanel .textbutton { font-size: 11px; }
  #exposureMap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; margin-top: 15px; }
  .exposureAreaNote { display: none; }
  .exposureBarNote { display: inline; }
  .exposureTile { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 66px 88px; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 8px 10px; border-color: var(--border); background: var(--surface-inset); }
  .exposureTile.gain, .exposureTile.loss, .exposureTile.unknown { background: var(--surface-inset); border-color: var(--border); }
  .exposureTile::before { content: ''; position: absolute; z-index: -1; inset: 0 auto 0 0; width: calc(var(--exposure-share, 0) * 1%); background: rgba(156, 180, 205, .12); pointer-events: none; }
  .exposureTile.gain::before { background: rgba(114, 217, 171, .16); }
  .exposureTile.loss::before { background: rgba(255, 147, 156, .14); }
  .exposureTile b { font-size: 11px; }
  .exposureTile strong { font-size: 14px; text-align: right; }
  .exposureTile span { font-size: 10px; text-align: right; }
  #exposureMapNote { font-size: 10px; }
  .overviewWorkspace { gap: 16px; margin-bottom: 20px; }
  .overviewWorkspace > .chartpanel { padding: 16px; }
  .overviewContext .terminalcards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .overviewContext .terminalcard { padding: 18px; }
  .overviewContext .walletSummary { flex-direction: row; gap: 14px; }
  .overviewContext .walletDonut { width: 74px; height: 74px; flex: 0 0 74px; }
  .overviewContext .walletLegend li { grid-template-columns: 7px minmax(0, 1fr) auto; gap: 7px; }
  .overviewContext .walletLegend em { grid-column: 3; margin-top: -4px; }
  .overviewContext .walletLegend b { font-size: 11px; }
  .overviewContext .leaderRow { min-height: 42px; }
  .attentionBlock { padding: 16px; }
  .attentionHeading { align-items: flex-start; }
  .attentionHeading h2 { font-size: 18px; }
  .attentionHeading .chartnote { font-size: 10px; text-align: left; }
  .attentionCard { padding: 15px; }
  .marketPageHead { gap: 16px; padding-bottom: 20px; }
  .marketPageHead h1 { font-size: 28px; }
  .marketPageHead p { font-size: 12px; }
  .marketHeadActions { width: 100%; gap: 8px; }
  .marketHeadActions .button { flex: 1; }
  .marketDirectoryHead h2 { font-size: 21px; }
  .marketLeaderCard { padding: 17px; }
  .currencyGoldHighlights { gap: 12px; margin-bottom: 22px; }
  .currencyGoldHighlight { padding: 20px; }
  .currencyGoldHighlight > div { flex-direction: row; align-items: center; gap: 12px; }
  .currencyGoldHighlight dd { font-size: 27px; }
  .currencyGoldPanelHead h2 { font-size: 19px; }
  .currencyGoldSource { gap: 10px; line-height: 1.6; }
  .currencyGoldFeedStatus, .currencyGoldTableNote, .currencyGoldFootnote { font-size: 11px; }
  #currencyGoldDenomination, #currencyGoldStatus { font-size: 11px; }
  .field input, .field select, .filters > input, .filters > select { min-height: 42px; }
  .segmented button, .segmented.small button { min-height: 38px; }
  .button, .watchButton, .marketPagination .button, .dialoghead .close { min-height: 42px; }
  .watchButton { min-width: 40px; }
  .mobileQuickNav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-strong); background: var(--surface-inset); }
  .mobileQuickNav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 50px; padding: 5px 2px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--muted); font: 600 10px var(--font); cursor: pointer; }
  .mobileQuickNav .navIcon { width: 19px; height: 19px; flex-basis: 19px; }
  .mobileQuickNav button.active { color: var(--accent); background: #17322f; border-color: #2d514d; }
  .mobileQuickNav button:hover { color: var(--text); }
}
@media (max-width: 360px) {
  .top, main { padding-left: 12px; padding-right: 12px; }
  #nav { padding-left: 12px; padding-right: 12px; }
  .brand b { font-size: 11px; }
  .brand small { font-size: 7px; }
  .top .brand { padding-right: 96px; }
  .portfolioValueCard { padding: 18px; }
  .currencyGoldHighlight dd { font-size: 24px; }
}

/* Date review: readable peaks, quote times and explicit historical coverage. */
#dateCompare > .tabs { margin: 0 0 24px; }
.peakForm { margin-bottom: 24px; }
.peakSummary { display: flex; justify-content: space-between; gap: 20px; margin: 24px 0; }
.peakSummary h3 { margin-bottom: 8px; font-size: 21px; }
.peakSummary p, .peakSummary span { color: var(--muted); font-size: 12px; line-height: 1.7; }
.peakSummary > div:last-child { text-align: right; }
.peakSummary strong, .peakSummary span { display: block; }
.peakSummary strong { margin-bottom: 6px; font: 13px var(--mono); }
.peakTable { min-width: 930px; }
.peakTable td { vertical-align: top; font-family: var(--mono); }
.peakTable td.asset { min-width: 190px; max-width: 290px; font-family: var(--font); }
.peakTable td small { display: block; margin-top: 6px; color: var(--muted); white-space: normal; font: 11px / 1.6 var(--font); }
.peakTable td .peakPartial { color: var(--amber); }
.peakMethod { margin: 20px 0; padding: 18px 20px; }
.peakMethod b { font-size: 13px; }
.peakMethod p { max-width: 1040px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.peakScrollHint { display: none; }
@media (max-width: 1000px) { .peakScrollHint { display: block; margin-bottom: 12px; } }
@media (max-width: 600px) {
  .peakSummary { flex-direction: column; gap: 12px; }
  .peakSummary > div:last-child { text-align: left; }
  .peakForm { align-items: stretch; }
  .peakForm .field { width: 100%; }
  .peakForm .button { width: 100%; justify-content: center; }
  .peakMethod { padding: 16px; }
}

/* Activity: the same directional language at sample, token, address and trade level. */
.flowOverview { margin: 22px 0 14px; padding: 24px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-1); }
.flowOverview h2 { margin-top: 6px; font-size: 21px; }
.flowMetrics { margin: 22px 0 18px; gap: 12px; }
.flowMetrics article { min-width: 0; padding: 16px; background: var(--surface-inset); }
.flowMetrics article strong { font-size: clamp(23px, 2vw, 32px); overflow-wrap: anywhere; }
.flowMetrics article small { font-size: 10px; }
.flowMetrics article span { font-size: 11px; }
.flowBuy, .buying, .flowTable .flowBuy { color: var(--green); }
.flowSell, .selling, .flowTable .flowSell { color: var(--red); }
.balanced { color: var(--text-2); }
.flowBalanceSummary { margin: 14px 0; }
.flowSplit { display: flex; width: 100%; min-width: 120px; height: 8px; overflow: hidden; border-radius: 4px; background: var(--red); }
.flowSplit i { display: block; height: 100%; background: var(--green); }
.flowBalanceSummary .flowSplit { height: 12px; margin-bottom: 7px; }
.flowBalanceSummary small { color: var(--text-2); font: 11px var(--mono); }
.flowCoverage { padding: 12px 16px; margin: 14px 0 20px; border-left: 2px solid var(--amber); background: var(--surface-inset); border-radius: 0 8px 8px 0; font-size: 12px; color: var(--text-2); line-height: 1.65; }
.flowDetail { overflow: hidden; margin: 0 0 20px; }
.flowDetail > .tabs { margin: 0; padding: 16px 20px 0; border-bottom: 1px solid var(--border); }
.tabs { gap: 6px; flex-wrap: wrap; }
.tabs [role=tab] { min-height: 42px; padding: 9px 14px; }
.flowFilters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(200px, .55fr); gap: 16px; padding: 20px 20px 8px; }
.flowFilters input, .flowFilters select { min-width: 0; width: 100%; }
.flowFilterNote { padding: 0 20px 14px; margin: 0; }
.flowScrollHint { display: none; padding: 0 20px 12px; color: var(--muted); font-size: 11px; }
.flowTable { min-width: 1030px; }
.flowTable td { vertical-align: top; font: 12px var(--mono); padding-top: 18px; padding-bottom: 18px; }
.flowTable td.left { font-family: var(--font); }
.flowTable td small { display: block; margin-top: 6px; color: var(--muted); font: 10px / 1.5 var(--font); }
.flowTable .flowSplit { margin-top: 4px; }
.flowBadge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font: 700 11px var(--font); padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-inset); }
.flowBadge.buying { border-color: #315445; }
.flowBadge.selling { border-color: #64414a; }
.flowSources { max-width: 280px; min-width: 155px; color: var(--muted); font: 11px / 1.6 var(--font); }
.flowSources summary { color: var(--text-2); cursor: pointer; }
.flowSources p { margin-top: 10px; overflow-wrap: anywhere; }
.flowCount { margin: 0; padding: 14px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.flowMethod { padding: 18px 20px; margin: 18px 0; }
.flowMethod summary { color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.flowMethod p { margin-top: 12px; color: var(--muted); line-height: 1.7; font-size: 12px; max-width: 1000px; }
.workspaceLink { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset); }
.workspaceLink strong { font-size: 15px; }
.workspaceLink p { color: var(--muted); font-size: 12px; margin-top: 5px; }
.view > .sectionhead:first-child { margin-top: 0; margin-bottom: 24px; align-items: center; }
.view > .sectionhead:first-child h2 { font-size: clamp(25px, 2.5vw, 32px); letter-spacing: -.035em; }
#analytics > .tabs { margin: 24px 0 20px; }
@media (max-width: 900px) { .flowMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .flowScrollHint { display: block; } }
@media (max-width: 600px) {
  .flowOverview { padding: 18px 16px; }
  .flowOverview h2 { font-size: 19px; }
  .flowOverview .cardHead { gap: 12px; }
  .flowMetrics { gap: 8px; margin: 16px 0; }
  .flowMetrics article { padding: 12px; }
  .flowMetrics article strong { font-size: 22px; }
  .flowMetrics article small { font-size: 9px; }
  .flowFilters { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; }
  .flowDetail > .tabs { padding: 10px 10px 0; gap: 3px; }
  .flowDetail .tabs [role=tab] { padding: 8px 10px; font-size: 11px; }
  .flowFilterNote { padding: 0 16px 12px; font-size: 11px; }
  .flowScrollHint { padding-left: 16px; }
  .flowCoverage { font-size: 11px; }
  .flowMethod { padding: 16px; }
  .workspaceLink { align-items: flex-start; flex-direction: column; padding: 16px; gap: 14px; }
  #whales .marketHeadActions { align-items: flex-end; }
  #whales .marketHeadActions .field { flex: 1; }
  #whales .marketHeadActions .button { flex: 0 0 auto; }
}

/* 9. AI summaries, range statistics and asked-question results. */
.aiPanel {
  margin: 18px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(114, 216, 202, .07), transparent 62%), var(--surface-1);
}
.aiPanelHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.aiPanelHead h3 { margin: 2px 0 0; font-size: var(--fs-lg); }
.aiPanel .aiText { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: 1.65; max-width: 80ch; }
.aiPanel .aiNote { margin: 9px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.aiRefresh { flex: none; }

.peakStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.peakStats[hidden] { display: none; }
.peakStats article {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.peakStats small { font-size: 10px; font-weight: 700; letter-spacing: .09em; color: var(--muted); }
.peakStats strong { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.peakStats span { color: var(--muted); font-size: var(--fs-xs); }

.rangeBar {
  display: block; position: relative; height: 4px; margin-top: 7px; border-radius: 99px;
  background: linear-gradient(90deg, rgba(255, 147, 156, .55), rgba(237, 200, 135, .5), rgba(114, 217, 171, .55));
}
.rangeBar i {
  position: absolute; top: 50%; width: 3px; height: 11px; border-radius: 2px;
  background: var(--text); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--surface-1);
}

.commandAnswer {
  margin: 0 0 10px; padding: 9px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: rgba(114, 216, 202, .08);
  color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5;
}
.commandAnswer[hidden] { display: none; }

@media (max-width: 620px) {
  .aiPanel { padding: 15px 16px; }
  .aiPanelHead { flex-direction: column; gap: 10px; }
  .aiRefresh { align-self: flex-start; }
}
/* 10. Portfolio pulse: movers, concentration and quote health on the home page. */
.pulsePanel { margin: 18px 0 0; }
.pulsePanel .cardHead { align-items: flex-start; }
.pulsePanel .cardHead p { color: var(--muted); margin: 4px 0 0; font-size: var(--fs-xs); }
.pulseGrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin-top: 14px; }
.pulseCard {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.pulseCardHead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pulseCardHead h3 { margin: 0; font-size: var(--fs-md); }
.pulseCardHead strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }

.pulseBars { display: flex; flex-direction: column; gap: 1px; }
.pulseRow {
  display: grid; grid-template-columns: 54px minmax(40px, 1fr) auto auto;
  align-items: center; gap: 10px; padding: 5px 4px;
  background: none; border: 0; border-radius: 6px; color: inherit;
  cursor: pointer; text-align: left; font: inherit;
}
.pulseRow:hover, .pulseRow:focus-visible { background: rgba(255, 255, 255, .05); }
.pulseName { font-weight: 700; font-size: var(--fs-sm); }
.pulseTrack { position: relative; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.pulseTrack i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.pulseTrack i.positive { background: var(--green); }
.pulseTrack i.negative { background: var(--red); }
.pulseValue, .pulseChange { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); white-space: nowrap; }
.pulseChange { min-width: 64px; text-align: right; opacity: .85; }
.pulseValue.positive, .pulseChange.positive { color: var(--green); }
.pulseValue.negative, .pulseChange.negative { color: var(--red); }
.pulseFoot { margin: 2px 0 0; }

.pulseStack, .pulseHealthBar {
  display: flex; height: 10px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .07);
}
.shareSeg { display: block; height: 100%; }
.shareSeg.s0 { background: var(--accent); }
.shareSeg.s1 { background: #6fa8dc; }
.shareSeg.s2 { background: #9b8cf0; }
.shareSeg.s3 { background: #d7a45f; }
.shareSeg.other { background: rgba(255, 255, 255, .2); }

.pulseLegend {
  list-style: none; margin: 2px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 3px;
  font-size: var(--fs-xs); color: var(--text-2);
}
.pulseLegend li { display: flex; align-items: center; gap: 7px; }
.pulseLegend li b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.pulseLegend .shareSeg { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.pulseLegend.compact li i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.pulseLegend i.good { background: var(--green); }
.pulseLegend i.warn { background: var(--amber); }
.pulseLegend i.bad { background: var(--red); }

.pulseFacts { margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
.pulseFacts div { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); }
.pulseFacts dt { color: var(--muted); }
.pulseFacts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

.pulseHealthBar i.good { background: var(--green); }
.pulseHealthBar i.warn { background: var(--amber); }
.pulseHealthBar i.bad { background: var(--red); }

@media (max-width: 1040px) {
  .pulseGrid { grid-template-columns: 1fr 1fr; }
  .pulseGrid > .pulseCard:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .pulseGrid { grid-template-columns: 1fr; }
  .pulseRow { grid-template-columns: 46px minmax(30px, 1fr) auto; }
  .pulseChange { display: none; }
}
/* 11. Risk strip: drawdown, value at risk, beta and exit liquidity. */
.riskStrip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px; }
.riskStrip article {
  display: flex; flex-direction: column; gap: 5px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface-inset);
}
.riskStrip small { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.riskStrip strong { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.riskStrip strong.negative { color: var(--red); }
.riskStrip strong.positive { color: var(--green); }
.riskStrip span { color: var(--muted); font-size: var(--fs-xs); line-height: 1.45; }
.riskStatus { margin: 0 0 2px; }

@media (max-width: 1040px) { .riskStrip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .riskStrip { grid-template-columns: 1fr; } }
/* 12. Portfolio review: evidence-backed candidates. */
.reviewPanel .cardHead { align-items: flex-start; }
.reviewList { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 14px; }
.reviewCard {
  padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2);
  border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
}
.reviewCard.high { border-left-color: var(--red); }
.reviewCard.medium { border-left-color: var(--amber); }
.reviewCard.low { border-left-color: var(--accent); }
.reviewCardHead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reviewCardHead h4 { margin: 0; font-size: var(--fs-md); flex: 1 1 180px; }
.reviewKind { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.reviewEvidence { margin: 8px 0 6px; padding-left: 18px; color: var(--text-2); font-size: var(--fs-xs); }
.reviewEvidence li { margin: 2px 0; }
.reviewCounter, .reviewAction { margin: 4px 0 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); }
.reviewCounter b, .reviewAction b { color: var(--text-2); margin-right: 4px; }
.reviewAction { color: var(--text-2); }
.reviewCounts { margin-top: 14px; }
.reviewAi { margin: 14px 0 0; }
.reviewSources { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.reviewSources summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.reviewSources ul { margin: 10px 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; }
.reviewSources li { margin: 6px 0; }
.pill.high { background: rgba(255, 147, 156, .16); color: var(--red); }
.pill.medium { background: rgba(237, 200, 135, .16); color: var(--amber); }
.pill.low { background: rgba(114, 216, 202, .14); color: var(--accent); }
/* 13. Generic table sorting: click a header to sort, again to reverse. */
th.sortableCell { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortableCell:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
th.sortableCell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sortGlyph { opacity: .4; font-size: .85em; }
th.sortedAsc .sortGlyph, th.sortedDesc .sortGlyph { opacity: 1; color: var(--accent); }
/* 14. Market headlines in the overview rail. */
.newsHeadRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.newsList { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.newsItem a { display: block; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.4; text-decoration: none; }
.newsItem a:hover, .newsItem a:focus-visible { color: var(--accent); text-decoration: underline; }
.newsItem.matched a { color: var(--text); font-weight: 600; }
.newsMeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 10px; }
.newsTag { padding: 1px 6px; border-radius: 999px; background: rgba(114, 216, 202, .14); color: var(--accent); font-weight: 700; letter-spacing: .04em; }/* 15. Chart dynamics: entrance animations, live-price pulse, hover price tag. */
.pricechart .chartLineAnim {
  stroke-dasharray: 3600;
  stroke-dashoffset: 3600;
  animation: chartDraw .9s ease-out forwards;
}
.pricechart .chartFade { animation: chartFadeIn .55s ease-out both; }
.pricechart .chartPulse { animation: chartPulse 2.4s ease-in-out infinite; }
.pricechart .chartHoverPriceBox { filter: drop-shadow(0 1px 4px rgba(4, 10, 18, .55)); }
.pricechart .chartCrosshairY,
.pricechart .chartHoverPrice { transition: opacity .12s ease; }
@keyframes chartDraw { to { stroke-dashoffset: 0; } }
@keyframes chartFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes chartPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
@media (prefers-reduced-motion: reduce) {
  .pricechart .chartLineAnim,
  .pricechart .chartFade,
  .pricechart .chartPulse { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 1; }
}
/* 16. Improvement log (System view). */
.changelogList { margin: 8px 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; }
.changelogList li { margin: 6px 0; }
.changelogList b { color: var(--text); }
/* 17. Decision signal card (asset detail). */
.signalConfluence { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.confluenceCell { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset); }
.confluenceCell small { color: var(--muted); font-size: var(--fs-xs); letter-spacing: .06em; text-transform: uppercase; }
.confluenceCell b { font-size: var(--fs-md); }
.confluenceCell span { color: var(--muted); font-size: var(--fs-xs); }
.confluenceCell.entryTf { border-color: var(--accent); }
@media (max-width: 640px) { .signalConfluence { grid-template-columns: 1fr; } }
/* 18. Signal calibration strip. */
.signalCalibration { margin: 10px 0; }
.signalCalibration .chartnote { margin: 0 0 6px; }
.signalCalibration .chartnote span { color: var(--muted); font-size: var(--fs-xs); }
.signalCalibration table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.signalCalibration th, .signalCalibration td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.signalCalibration th { color: var(--muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
/* 19. Professional overview layout: full-width bands, no orphaned columns. */
/* The summary band pairs the value card with a 2x2 metric grid that fills it. */
.overviewSummary { align-items: stretch; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.overviewSummary .overviewMetrics { height: 100%; }
.overviewSummary .portfolioValueCard { display: flex; flex-direction: column; }
.overviewSummary .valueCardFoot { margin-top: auto; }

/* Workspace: chart gets the wide column, the rail keeps only two live cards. */
.overviewWorkspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 20px; align-items: stretch; }
.overviewWorkspace > .chartpanel { display: flex; flex-direction: column; }
.overviewWorkspace .overviewContext .terminalcards { display: flex; flex-direction: column; gap: 16px; }
/* Cards size to their content: stretching a short card to the chart's height
   creates the blank panel this layout exists to remove. */
.overviewWorkspace .overviewContext .terminalcard { flex: 0 0 auto; }

/* Second band: headlines and sentiment share the full width, equal heights. */
.overviewContextRow { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; margin: 0 0 24px; align-items: stretch; }
.overviewContextRow .terminalcard { margin: 0; height: 100%; }
.overviewContextRow .newsCard #marketNews { overflow: auto; }

/* Insight band: full-width AI strip, then the briefing as a three-up row.
   Pairing them side by side squeezed the briefing cards into unreadable columns. */
.overviewInsights { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 0; align-items: start; }
.overviewInsights .aiPanel, .overviewInsights .attentionBlock { margin: 0; }
.overviewInsights .attentionGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overviewInsights .aiPanel .aiText { max-width: none; }

/* Pulse: three equal cards; the widest panel reads as one instrument cluster. */
.pulsePanel .pulseGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.pulsePanel .pulseCard { height: 100%; }
.pulsePanel .riskStrip { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); align-items: stretch; }

@media (max-width: 1180px) {
  .overviewSummary, .overviewWorkspace, .overviewContextRow, .overviewInsights { grid-template-columns: minmax(0, 1fr); }
  .overviewWorkspace .overviewContext .terminalcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pulsePanel .pulseGrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .overviewWorkspace .overviewContext .terminalcards { grid-template-columns: minmax(0, 1fr); }
}
/* 20. Local AI market brief + final headline band. */
.marketAnalysis { margin: 0 0 22px; padding: 22px; }
.marketAnalysisHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.marketAnalysisHead h2 { margin: 5px 0; font-size: var(--fs-xl); }
.marketAnalysisHead p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.marketAnalysisControls { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.marketAnalysisControls .field { min-width: 120px; }
.marketAnalysisControls .button { white-space: nowrap; }
.marketAnalysisGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.marketAnalysisGrid article { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset); }
.marketAnalysisGrid article small { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; }
.marketAnalysisGrid article p { margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.65; }
.marketAnalysisGrid article[dir="rtl"] { text-align: right; }
.marketAnalysisGrid article[dir="rtl"] p { font-size: 15px; line-height: 1.9; }
.marketAnalysis > #analysisStatus { margin: 10px 0 0; }
.overviewNewsEnd { margin-top: 22px; }
.overviewNewsEnd .newsHeadRow { align-items: flex-start; }
.overviewNewsEnd .newsHeadRow p { margin: 4px 0 0; }
.newsItem a [lang="ar"], .newsTitle [lang="ar"] { display: block; text-align: right; font-size: 15px; line-height: 1.85; }
.newsItem a [hidden] { display: none; }
.newsItem a [lang="en"][hidden] { display: none; }
@media (max-width: 1100px) {
  .marketAnalysisHead { flex-direction: column; }
  .marketAnalysisControls { justify-content: flex-start; }
  .marketAnalysisGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .marketAnalysis { padding: 16px; }
  .marketAnalysisControls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .marketAnalysisControls .button { grid-column: 1 / -1; }
  .marketAnalysisGrid { grid-template-columns: 1fr; }
}
/* 21. Headline language controls. */
.newsActions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.newsActions .button { padding: 7px 12px; font-size: var(--fs-sm); }
/* 22. Per-view refresh status: every page announces its own load and completion. */
.pageRefreshStatus { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset); color: var(--text-2); font-size: var(--fs-xs); }
.pageRefreshStatus:not(.done)::before { content: ''; width: 10px; height: 10px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: pageRefreshSpin .8s linear infinite; }
.pageRefreshStatus.done { color: var(--muted); }
.pageRefreshStatus.hasErrors { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
@keyframes pageRefreshSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pageRefreshStatus:not(.done)::before { animation: none; border-color: var(--accent); } }
/* Estimated contribution date controls. */
.analyticsContributionHead { align-items: flex-start; gap: 18px; }
.contributionControls { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.contributionDateRange { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 10px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-inset); }
.contributionDateRange .formStatus { flex: 1 1 220px; color: var(--muted); font-size: var(--fs-xs); }
@media (max-width: 780px) { .analyticsContributionHead { flex-direction: column; } .contributionControls { width: 100%; } }
/* Attribution flow: cumulative lines, named legend, and daily diverging ribbon. */
.attributionView { margin-top: var(--sp-3); min-width: 0; }
#analyticsDaily:has(.attributionView) { display: block; max-height: none; overflow: visible; }
.attributionChartWrap { position: relative; width: 100%; }
.attributionChart { display: block; width: 100%; height: auto; overflow: visible; }
.attributionGrid { stroke: rgba(164,195,219,.08); stroke-width: 1; }
.attributionZero { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.attributionAxis { fill: var(--muted); font: 10px var(--mono); }
.attributionLine { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity .14s, stroke-width .14s; }
.attributionLine.isDimmed, .attributionEnd.isDimmed, .attributionEndLabel.isDimmed { opacity: .16; }
.attributionLine.isFocused { stroke-width: 3; }
.attributionEndLabel { font: 600 10px var(--mono); }
.attributionHit { fill: transparent; cursor: crosshair; }
.attributionHit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.attributionTooltip { position: absolute; z-index: 2; top: 10px; min-width: 180px; max-width: 260px; padding: 9px 11px; color: var(--text); background: var(--surface-inset); border: 1px solid var(--border-strong); border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: var(--fs-xs); pointer-events: none; }
.attributionTooltip > strong { display: block; margin-bottom: 5px; font: 600 var(--fs-sm) var(--mono); }
.attributionTooltip ul { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.attributionTooltip li { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.attributionTooltip li b { font: 500 var(--fs-xs) var(--mono); }
.attributionLegend { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px 20px; margin: 8px 0; }
.attributionLegendItem { display: grid; grid-template-columns: 12px minmax(80px,1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 6px 4px; text-align: left; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid rgba(164,195,219,.06); cursor: pointer; }
.attributionLegendItem:hover, .attributionLegendItem[aria-pressed="true"] { background: var(--surface-2); }
.attributionLegendItem > i { display: block; width: 10px; height: 2px; border-radius: 2px; }
.attributionLegendItem > b { overflow: hidden; font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.attributionLegendItem > span { font: 500 var(--fs-xs) var(--mono); }
.attributionChartNote { margin: 8px 0 16px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.55; }
.attributionRibbonTitle { margin: 12px 0 6px; font-size: var(--fs-sm); }
.attributionRibbon { display: grid; gap: 6px; }
.attributionRibbonRow { display: grid; grid-template-columns: 58px minmax(80px,1fr) 100px 60px; align-items: center; gap: 8px; min-width: 0; }
.attributionRibbonRow time { color: var(--text-2); font: 500 var(--fs-xs) var(--mono); }
.attributionRibbonRow > b { text-align: right; font: 500 var(--fs-xs) var(--mono); white-space: nowrap; }
.attributionRibbonRow > small { color: var(--muted); font-size: 9px; text-align: right; }
.attributionRibbonTrack { display: flex; height: 12px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.035); }
.attributionRibbonLosses, .attributionRibbonGains { display: flex; align-items: stretch; width: 50%; height: 100%; }
.attributionRibbonLosses { justify-content: flex-end; }
.attributionRibbonGains { justify-content: flex-start; }
.attributionRibbonSegment { display: block; height: 100%; min-width: 1px; opacity: .8; }
.attributionRibbonSegment.loss { background: var(--red); }
.attributionRibbonSegment.gain { background: var(--accent); }
.attributionRibbonSegment:hover { opacity: 1; filter: brightness(1.15); }
.attributionExact { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.attributionExact summary { color: var(--text-2); cursor: pointer; font-size: var(--fs-xs); }
.attributionTableScroll { max-width: 100%; overflow: auto; }
.attributionExact table { width: 100%; border-collapse: collapse; font: 400 var(--fs-xs) var(--mono); }
.attributionExact th, .attributionExact td { padding: 6px 8px; border-bottom: 1px solid rgba(164,195,219,.07); text-align: right; white-space: nowrap; }
.attributionExact th:first-child, .attributionExact td:first-child { text-align: left; }
@media (max-width: 680px) { .attributionLegend { grid-template-columns: 1fr; } .attributionEndLabel { display: none; } .attributionRibbonRow { grid-template-columns: 46px minmax(55px,1fr) 84px; } .attributionRibbonRow > small { display: none; } }

/* 23. Day-by-day contribution sections. */
.dayContribution { margin: 14px 0 4px; }
.dayContribution + .dayContribution { border-top: 1px dashed var(--border); padding-top: 10px; }
.dayContributionHead { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.dayContributionHead h4 { margin: 0; font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.dayContributionHead b { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.dayContributionHead b.gain { color: var(--green); }
.dayContributionHead b.loss { color: var(--red); }
.dayContributionHead small { color: var(--muted); font-size: var(--fs-xs); }
