/* Ask My Numbers: report in the browser + side-tab chat.
   Tokens come from app.css (--ink, --paper, --card, --mute, --line, --accent).
   Chat pattern follows the AskTheBuilding / Ten Tenth side-tab widget. */
:root { --chat-w: 380px; --fill: #b6ada5; }
.page-report main { max-width: 1000px; }
.page-report main { transition: margin-right .28s ease; }

/* Month switcher */
.rv-switch { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 18px; }
.rv-steps { display: inline-flex; align-items: center; gap: 10px; }
.rv-step { text-decoration: none; padding: 8px 10px; border: 1px solid var(--line); min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; }
.rv-step.is-off { color: var(--line); }
.rv-pick { display: inline; margin: 0; }
.rv-pick select { min-width: 10.5rem; padding: 0 8px; border: 1px solid var(--line); background: var(--paper); }
.rv-pick button { margin: 0 0 0 6px; }

/* Report */
.rv-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.rv-logo { height: 26px; width: auto; display: none; margin: 0 0 18px; } /* the site header already shows the logo on screen */
@media print { .rv-logo { display: block; } }
.rv-head h1 { margin: 0 0 4px; }
.rv-kicker { color: var(--mute); font-size: 14px; letter-spacing: .02em; margin: 0 0 6px; word-break: break-word; }
.rv-actions { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rv-actions .button { margin-top: 0; }
.rv-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; }
.rv-jump label { margin: 0; font-size: 14px; color: var(--mute); }
.rv-jump select { min-height: 44px; min-width: 14rem; font: inherit; border: 1px solid var(--line); background: var(--paper); }
.rv-layout { display: block; }
.rv-side { display: none; }
.rv-section, .rv-summary { scroll-margin-top: 16px; }
.watch { margin: 0; padding-left: 1.2rem; }
.watch li { margin: 0 0 6px; }
.movers { display: grid; grid-template-columns: 1fr; gap: 16px; }
.movers h3 { font-size: 15px; font-weight: 500; margin: 0 0 6px; }
.movers ul { margin: 0; padding-left: 1.1rem; }
.movers li { margin: 0 0 4px; }
.rv-sample { margin: 0 0 18px; }
.rv-section { margin: 0 0 28px; }
.rv-section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); font-weight: 500; margin: 0 0 10px; }
.rv-summary p { font-size: 19px; line-height: 1.5; margin: 0; }
.kpis { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 13px; color: var(--mute); }
.kpi-value { font-size: 28px; font-weight: 300; letter-spacing: -.02em; }
.kpi-note { font-size: 13px; color: var(--mute); }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; max-height: 260px; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar-cur { fill: #6BA48A; }
.chart .bar-prev { fill: #b6ada5; }
.chart .tick { font-size: 12px; fill: var(--mute); font-family: var(--font); }
.chart figcaption { font-size: 13px; color: var(--mute); margin-top: 6px; }
.key { display: inline-block; width: 10px; height: 10px; vertical-align: baseline; margin-left: 4px; }
.key-cur { background: #6BA48A; } .key-prev { background: #b6ada5; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
td.path { word-break: break-all; }
.stack { display: flex; height: 12px; background: var(--card); margin: 0 0 8px; overflow: hidden; }
.stack-desktop { background: #6BA48A; } .stack-mobile { background: #b6ada5; } .stack-tablet { background: var(--line); }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: baseline; }
.bars td:first-child { position: relative; }
.hbar { display: block; height: 4px; background: #b6ada5; margin-top: 4px; min-width: 2px; }
.rv-foot { margin-top: 24px; }

/* Side-tab chat */
.amn-chat__tab {
  position: fixed; top: 42%; right: 0; transform: translateY(-50%);
  writing-mode: vertical-rl; text-orientation: mixed;
  background: var(--ink); color: var(--paper); text-decoration: none;
  border-radius: 10px 0 0 10px; padding: 1.1rem .55rem;
  letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; font-weight: 500;
  box-shadow: -4px 4px 18px rgba(0,0,0,.18); z-index: 9991;
}
.amn-chat__tab:hover, .amn-chat__tab:focus-visible { background: #1E384B; color: #fff; outline: 2px solid #1E384B; outline-offset: 2px; }
/* Stack Feedback under the chat tab so the two labels don't cover each other. */
.page-report .amn-feedback__tab { top: calc(42% + 8.75rem); transform: none; }
.amn-chat__panel {
  position: fixed; top: 0; right: 0; width: min(var(--chat-w), 100vw); height: 100vh; height: 100dvh;
  background: var(--paper); color: var(--ink); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0,0,0,.14); display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .28s ease; visibility: hidden;
  z-index: 9992; padding: 1rem 1rem .6rem; box-sizing: border-box;
}
.amn-chat[data-state="open"] .amn-chat__panel, .amn-chat:not(.is-js) .amn-chat__panel:target { transform: none; visibility: visible; }
.amn-chat[data-state="open"] .amn-chat__tab { display: none; }
.amn-chat__header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.amn-chat__eyebrow { margin: 0; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.amn-chat__title { margin: .2rem 0 0; font-size: 1.15rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink); }
.amn-chat__close { font-size: 1.7rem; line-height: 1; text-decoration: none; color: var(--ink); padding: .1rem .4rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.amn-chat__help { margin: 0 0 .6rem; font-size: .82rem; line-height: 1.4; color: #333; }
.amn-chat__log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: .6rem; padding: .5rem .15rem;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: .5rem;
}
.amn-chat__bubble { max-width: 92%; padding: .6rem .75rem; border-radius: 10px; font-size: .9rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.amn-chat__bubble--user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.amn-chat__bubble--bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.amn-chat__bubble--meta { align-self: center; background: transparent; color: var(--mute); font-size: .78rem; padding: .2rem; }
.amn-chat__bubble--thinking { color: var(--mute); font-style: italic; }
.amn-chat__dots { display: inline-flex; gap: .22rem; margin-left: .35rem; }
.amn-chat__dots span { width: .38rem; height: .38rem; border-radius: 50%; background: var(--accent); opacity: .35; animation: amn-dot 1.2s ease-in-out infinite; }
.amn-chat__dots span:nth-child(2) { animation-delay: .2s; } .amn-chat__dots span:nth-child(3) { animation-delay: .4s; }
@keyframes amn-dot { 0%, 80%, 100% { opacity: .35; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
.amn-chat__chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .5rem; }
.amn-chat__chip { margin: 0; min-height: 34px; padding: .3rem .65rem; font-size: .8rem; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; text-align: left; }
.amn-chat__chip:hover { border-color: var(--ink); }
.amn-chat__month { display: flex; align-items: center; gap: .5rem; margin: 0 0 .4rem; font-size: .8rem; }
.amn-chat__month label { margin: 0; color: var(--mute); }
.amn-chat__month select { min-height: 34px; font-size: .85rem; border: 1px solid var(--line); background: var(--paper); }
.amn-chat__compose { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; }
.amn-chat__compose textarea { width: 100%; font: inherit; font-size: .95rem; min-height: 44px; max-height: 140px; padding: .5rem .6rem; border: 1px solid var(--line); resize: vertical; }
.amn-chat__send { margin: 0; }
.amn-chat__send[disabled] { opacity: .55; cursor: progress; }

/* Wide screens: push the report left so the panel covers nothing. */
@media (min-width: 1100px) {
  body.page-report.amn-chat-open main { margin-right: var(--chat-w); }
}
@media (min-width: 1280px) {
  .page-report main { max-width: 1120px; }
  .rv-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 28px; align-items: start; }
  .rv-side {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 16px;
    font-size: 14px; padding-top: 4px;
  }
  .rv-side a { color: var(--mute); text-decoration: none; }
  .rv-side a:hover, .rv-side a:focus-visible { color: var(--ink); }
  .movers { grid-template-columns: 1fr 1fr; }
}
/* Phones: the panel is full screen; the tab sits along the bottom edge. */
@media (max-width: 640px) {
  .amn-chat__panel { width: 100vw; border-left: 0; }
  .amn-chat__tab { writing-mode: horizontal-tb; top: auto; bottom: 0; right: 12px; transform: none; border-radius: 10px 10px 0 0; padding: .7rem .9rem; }
  .page-report .amn-feedback__tab { top: auto; bottom: 0; right: auto; left: 12px; transform: none; }
  .rv-switch { flex-direction: column; align-items: flex-start; }
  .kpi-value { font-size: 24px; }
  body.page-report { padding-bottom: 56px; }
}
@media (prefers-reduced-motion: reduce) { .amn-chat__panel, .page-report main { transition: none; } .amn-chat__dots span { animation: none; } }
