/* 訪客與會員也看得到的後台系列畫面：我的 AI 問答（列表、答案頁、閱讀頁、進度步驟）、
   markdown 內文、評級標籤。從 admin.css 拆出來，admin.css 只給管理員載入。
   摘要卡、閱讀頁、評級、進度卡沿用既有名稱（reader-*、.rating、.card）：
   show／report 頁的 inline JS、markdown controller 與 spec 認得的是它們。 */
/* 後台：資料台（/ops）與 TradingAgents（列表、發起、執行頁、閱讀頁、設定）。
   版型 1「報告式」：每頁先講結論（page_header 的 h1 ＋ 一行 lead），細節往下排。
   新 class 一律帶區域前綴：資料台 ops-*（來源組沿用 .src-*）、TradingAgents ta-*。
   摘要卡、閱讀頁、評級、進度卡沿用既有名稱（sumcard-*、reader-*、.rating、.card）：
   show／report 頁的 inline JS、markdown controller 與 spec 認得的是它們。 */
/* ── 共用：進度條、數字閃光、執行中的脈動點 ──────────────────────────────── */
.bar{height:.75rem;background:var(--panel-2);border-radius:var(--r-pill);overflow:hidden}
@keyframes flash { 0%{background:rgba(242,178,48,.4)} 100%{background:transparent} }
.flash-num{animation:flash .6s ease-out;border-radius:.25rem}
/* 「執行中」「排隊中」的 tag 前面一顆會呼吸的點：靜態的字看不出它真的在動 */
.ta-live::before{content:"●";margin-right:.25rem;display:inline-block;animation:pulse 1.2s ease-in-out infinite}
@media (prefers-reduced-motion: reduce){
.flash-num,.ta-live::before,.ta-step.is-running::before{animation:none}
}
/* ── 資料台：來源組 ──────────────────────────────────────────────────────
   組織軸是「誰負責」：腳本、排程、執行中的標記在卡頭，它寫的
   那幾張表在卡身。表頭那條淡金帶貼齊卡片兩緣，所以卡片本身不留內距、各段自己留。 */
.panel.src{padding:0;overflow:hidden}
/* 執行中：左緣金線。不用背景色——.row-running 那種淡金底放大到整張卡會太重。 */
.panel.src.is-running{box-shadow:inset .25rem 0 0 var(--gold-deep),var(--shadow-card)}
/* 表格卡（資料台的執行紀錄、分析執行列表）：表頭淡金帶貼齊卡片兩緣，跟來源組的
   覆蓋度表同一個樣子。儲存格內距只在桌機給——手機上 .runs-table 改成一列一張卡
   （components.css），內距由那邊決定。 */
.panel.ta-runs{padding:0;overflow:hidden}
:is(.ops-runs,.ta-runs) .tbl-wrap{margin:0}
.ta-runs .runs-table{font-size:.9375rem}
@media (min-width: 48rem){
:is(.ops-runs .runs,.ta-runs .runs-table) :is(th,td){padding:.75rem 1rem}
:is(.ops-runs .runs,.ta-runs .runs-table) :is(th,td):first-child{padding-left:1.5rem}
:is(.ops-runs .runs,.ta-runs .runs-table) :is(th,td):last-child{padding-right:1.5rem}
:is(.ops-runs .runs,.ta-runs .runs-table) thead th{padding-block:.5rem;font-size:.8125rem;border-radius:0}
}
.user-plan-note{display:block;margin-top:.25rem;color:var(--muted);font-size:.8125rem;white-space:nowrap}
/* ── 評級 ──────────────────────────────────────────────────────────────────
   不用紅綠，用金（看多）—墨（看空）雙極。兩個理由：站上 .pos/.neg 已經是綠漲
   紅跌，評級若照台股習慣翻成紅漲，同一列會出現「紅色的漲幅 ＋ 紅色的賣出」，
   紅色同時代表兩件相反的事；更根本的是紅綠在這站定義為**事實的好壞**，而評級
   是十二個 agent 吵完架之後的**意見**，借用事實色會讓意見看起來像結論。
   填色濃度＝信心強度，箭頭是色盲與黑白列印下的第二編碼。 */
.rating{display:inline-flex;align-items:center;gap:.3125rem;font-family:var(--sans);
  font-size:.875rem;line-height:1.4;padding:.125rem .625rem;border-radius:var(--r-pill);
  border:.0625rem solid;white-space:nowrap}
.rating .arw{font-size:.8em;opacity:.9}
/* 金的濃度＝看多的信心：買進深金白字（5.58）、加碼主要金、持有白底；看空那一側
   換成墨色由淺到深。 */
.r-buy{background:var(--gold);border-color:var(--gold);color:#ffffff;font-weight:700}
.r-over{background:var(--primary);border-color:var(--primary);color:var(--text);font-weight:700}
.r-hold{background:var(--panel);border-color:var(--line);color:var(--muted);font-weight:500}
.r-under{background:var(--panel);border-color:var(--text);color:var(--text);font-weight:700}
.r-sell{background:var(--text);border-color:var(--text);color:var(--ink);font-weight:700}
.r-none{background:transparent;border-color:var(--line);color:var(--muted);font-weight:400}
/* ── TradingAgents：分析執行列表 ─────────────────────────────────────────── */
.ta-runs .sym{font-weight:500}
.ta-name{font-weight:700;margin-left:.75rem}
.ta-runs th.ta-th-act{text-align:right}
.ta-runs td[data-cell="act"]{text-align:right}
.ta-runs td[data-cell^="act"]{width:1%;white-space:nowrap}
.ta-runs td[data-cell="act2"] form{margin:0}
.ta-label{display:block;margin:0 0 .5rem;padding:0;font-weight:700;font-size:.9375rem;color:var(--text)}
.card{background:var(--ink);border:.0625rem solid var(--line);border-left:.1875rem solid var(--line);
  border-radius:var(--r-inner);padding:.75rem .875rem}
/* ── 單篇報告的閱讀頁 ────────────────────────────────────────────────────
   跟摘要牆的取捨剛好相反。牆要並排比較，所以欄寬由螢幕決定；這一頁只有一篇
   文章，欄寬就該由「一行讀得下去幾個字」決定——49rem 在 19px 下約 41 個中文
   字，是長文的舒適區。行距也拉到 1.9：中文沒有詞距，靠的是行距在分行。
   版面：頂端一條（回摘要、下一份）→ 兩欄（左目錄、右：標題＋引言＋正文）。
   DOM 順序是標題、目錄、正文：窄螢幕單欄時目錄落在標題與正文之間。 */
.reader-top{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:.5rem 1.5rem;
  max-width:49rem;margin:0 auto 1.5rem}
.reader-next{color:var(--text);font-size:.9375rem;font-weight:500;text-decoration:none}
.reader-next:hover{color:var(--gold)}
.reader{display:grid;gap:1.5rem 2.5rem;grid-template-columns:minmax(0,49rem);justify-content:center}
.reader-head{min-width:0}
.reader-title{font-family:var(--title);font-size:2.25rem;margin:.25rem 0 .5rem;display:flex;align-items:center;
  gap:.75rem;flex-wrap:wrap;line-height:1.3}
.reader-meta{margin:0;font-size:.8125rem;color:var(--muted)}
.reader-main{min-width:0}
.md-body{font-size:1.0625rem;line-height:1.7}
.md-body h3,.md-body h4,.md-body h5{color:var(--gold);margin:1rem 0 .375rem;text-transform:none;letter-spacing:0}
/* h6 用淡字色：淺金在白底上讀不出來 */
.md-body h6{color:var(--muted);margin:.875rem 0 .3125rem;font-size:1.0547rem;text-transform:none;letter-spacing:0}
.md-body code{background:var(--panel-2);padding:.0625rem .3125rem;border-radius:.3125rem;font-family:var(--mono);font-size:.9375rem}
.md-body ul{margin:.375rem 0;padding-left:1.375rem}
.md-body p{margin:.375rem 0}
.md-body hr{margin:1.75rem 0;border:0;border-top:.0625rem solid var(--line)}
/* markdown 表格：白卡、表頭淡金帶（同站上其他表格）。直接放在奶油底上，所以不吃
   .panel .tbl-wrap 的捲動陰影遮片（那個遮片要跟底色同色）。 */
.md-body .tbl-wrap{margin:1rem 0 1.5rem;background:var(--panel);border:.0625rem solid var(--line);border-radius:var(--r-inner)}
.md-body table{width:100%;border-collapse:collapse;font-size:.9375rem;line-height:1.5}
.md-body th,.md-body td{padding:.5rem .875rem;text-align:left;border-top:.0625rem solid var(--line-soft)}
.md-body tr:first-child > *{border-top:0}
.md-body th{color:var(--muted);font-weight:500;background:var(--panel-2)}
.reader-body{max-width:none;font-size:1.1875rem;line-height:1.9}
/* 正文的標題：章節（h3）用圓體主文字色，往下一層才用金色分層（.md-body）。 */
.reader-body h3{font-size:1.375rem;margin:2.25rem 0 .75rem;font-family:var(--title);color:var(--text)}
.reader-body h4{font-size:1.1875rem;margin:1.5rem 0 .5rem}
/* h5／h6 只在三層以上的報告出現。**不能讓它們掉回瀏覽器預設**（0.83em／0.67em
   ＝ 15.8px／12.7px，比 19px 的正文還小——標題比內文小是壞掉，不是層級）。
   深度由顏色（.md-body 的 gold／muted）與間距承擔，字級守住不小於正文。 */
.reader-body h5,.reader-body h6{font-size:1.1875rem;margin:1.25rem 0 .375rem}
.reader-body h3,.reader-body h4,.reader-body h5,.reader-body h6{scroll-margin-top:1.5rem}
.reader-body p{margin:0 0 1.125rem}
.reader-body ul{margin:.75rem 0 1.125rem;padding-left:1.5rem}
.reader-body li{margin:.25rem 0}
/* 目錄：外觀是共用的 .toc（components.css），這裡只管它在閱讀頁的位置與行數。
   窄螢幕沒有第二欄可以放，就退回標題與正文之間的一塊，收高度、自己捲——一萬字的
   報告在手機上沒有目錄就只能一路刷。 */
.reader-toc{align-self:start;max-height:14rem;overflow-y:auto}
.reader-toc .toc-list{display:flex;flex-direction:column;gap:.125rem}
/* 一條最多三行。整行粗體當標題的報告（多空辯論稿）標題長到七十幾個字，不夾的話
   一條就佔掉半個目錄。多行的條目不用全圓（會變成兩頭尖的膠囊），用卡片內的小圓角。 */
.reader-toc .toc-link{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
  border-radius:var(--r-inner);padding:.4375rem .75rem;font-size:.875rem;line-height:1.45;color:var(--muted)}
.reader-toc .toc-link:hover{color:var(--text)}
.reader-toc .toc-link--sub{padding-left:1.5rem;font-size:.8125rem}
/* ── 個股問答：提問框（個股頁附錄的 frame、答案頁底下的「再問一題」）與題目清單 ── */
.ta-ask-form textarea{display:block;width:100%;resize:vertical;min-height:5.5rem;line-height:1.6}
.ta-ask-actions{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:.75rem;margin-top:.75rem}
.ta-asks-table .ta-ask-qlink{font-weight:700;color:var(--text);text-decoration:none}
.ta-asks-table .ta-ask-qlink:hover{color:var(--gold);text-decoration:underline}
.ta-ask-sym{white-space:nowrap}
/* 我的 AI 問答：一列一段對話，右邊是接續、刪除 */
.ask-convo-count{margin-left:.5rem;font-size:.8125rem;white-space:nowrap}
.ask-convo-acts{text-align:right}
.ask-convo-acts > *{display:inline-flex;vertical-align:middle;margin-left:.375rem}
.ask-convo-acts form{margin:0}
/* 答案頁：標題就是問題本身，常常兩三行，字級比報告標題小一號 */
.ta-ask-title{font-size:1.75rem}
.ta-ask-progress{margin-top:0}
.ta-ask-progress-h{display:flex;justify-content:space-between;align-items:baseline;gap:1rem;margin-bottom:.5rem}
.ta-ask-progress-h h2{margin:0;font-size:1.25rem}
/* 還在答的時候可以按停止（會員版 stock_asks/show） */
.ta-ask-stop{margin:.875rem 0 0}
/* 每一步一行：做了什麼（粗）＋查了什麼（淡）。進行中的那步有脈動點，完成金勾，失敗紅叉。 */
.ta-steps{list-style:none;margin:0;padding:0;display:grid;gap:.375rem}
.ta-step{display:flex;flex-wrap:wrap;align-items:baseline;gap:.125rem .625rem;padding-left:1.375rem;position:relative;
  font-size:.9375rem;line-height:1.55}
.ta-step::before{position:absolute;left:0;top:0;width:1rem;text-align:center;font-weight:700}
.ta-step.is-done::before{content:"✓";color:var(--gold)}
.ta-step.is-bad::before{content:"✕";color:var(--red)}
.ta-step.is-running::before{content:"●";color:var(--green);animation:pulse 1.2s ease-in-out infinite}
.ta-step.is-prep::before{content:"…";color:var(--muted)}
.ta-step.is-note{color:var(--muted);font-size:.875rem}
.ta-step.is-note::before{content:"“";color:var(--muted)}
.ta-step-label{font-weight:700}
.ta-step-detail{color:var(--muted);min-width:0;overflow-wrap:anywhere}
.ta-steps-box{margin-top:2.5rem}
.ta-steps-box summary{cursor:pointer;font-weight:700}
.ta-steps-box[open] summary{margin-bottom:.75rem}
.ta-ask-again{margin-top:1.5rem}
.md-body a{color:var(--gold);text-decoration:underline;text-underline-offset:.15em;overflow-wrap:anywhere}
/* Cmd-F 找不到收合的內容，列印也一樣。 */
@media print{
details{display:block}
details > *{display:block !important}
.actions{display:none}
}
/* 閱讀頁的兩欄：15 ＋ 2.5 ＋ 49 ＋ 左右內距 4 ＝ 70.5rem，72rem 留一點餘裕。 */
@container main (min-width: 72rem){
/* **兩欄只在目錄真的存在時成立。** 目錄少於三個標題時 markdown controller 會把
     [data-toc-box] 整塊移除；欄位若寫死兩欄，剩下的正文會掉進第一欄
     （15rem＝240px），文字既窄又靠左——19px 下一行只剩約十二個中文字。
     而且這是常態不是邊緣情形：目錄只收 h3/h4（＝markdown 的 # 與 ##），整篇只用
     ### 以下標題的報告可收標題數是 0，實測 52 篇報告有 31 篇（60%）沒有目錄。
     用 :has() 而不是讓 controller 順手加個 class：條件直接綁在「目錄在不在」這個
     事實上，改了移除方式也不會漏掉。 */
.reader:has([data-toc-box]){grid-template-columns:15rem minmax(0,49rem)}
/* 頂端那條（回摘要／下一份）切齊兩欄的外緣：有目錄時是 15 ＋ 2.5 ＋ 49，沒有時就是 49。 */
.reader-top:has(~ .reader [data-toc-box]){max-width:66.5rem}
/* 標題與正文在最後一欄（有目錄時第 2 欄、沒有時唯一那欄）；目錄跨兩列，從標題旁邊
     一路黏到正文結束，黏的位置從頂欄底下開始。 */
.reader-head,.reader-main{grid-column:-2}
.reader-toc{grid-column:1;grid-row:1 / span 2;position:sticky;top:calc(var(--sticky-top) + 1.5rem);
    max-height:calc(100vh - var(--sticky-top) - 3rem)}
}
/* ── 窄斷點：手機 ── */
@media (max-width: 47.9375rem){
.ta-name{margin-left:.375rem}
.ta-runs .runs-table tr{padding-inline:1rem}
/* 手機卡片的動作格由 components.css 分成兩格（查看靠左、刪除靠右）；桌機那條「查看
     靠右」在這裡收回來 */
.ta-runs .runs-table td[data-cell="act"]{text-align:left}
/* 桌機上用 width:1% 把動作欄縮到內容寬；grid 項目吃到它會只剩格子的 1%，字溢出歪掉 */
.ta-runs td[data-cell^="act"]{width:auto}
.reader-title{font-size:1.625rem}
.reader-body{font-size:1.0625rem;line-height:1.85}
}
/* ── 觸控：44px 目標 ── */
@media (pointer: coarse){
.reader-next{min-height:2.75rem;display:inline-flex;align-items:center}
/* 閱讀頁的目錄項是 -webkit-box（夾三行），min-height 撐高時字會貼在上緣：改用上下內距
     撐到 44px，字留在正中 */
.reader-toc .toc-link{min-height:0;padding-block:.75rem}
}
#user-subscriptions td form{display:inline-block;margin:0 .5rem 0 0}
