/*
 * แถบข้างขวา (rail) ของหน้าหุ้นรายตัว — คู่กับ lib/company_rail.php · ใช้กับ .page-container-wide (1280px):
 * คอลัมน์หลัก 980px (ขนาดหน้าปกติเดิม) + rail 280px + gap 20px พอดี 1280 · จอแคบกว่า 1320px rail ตกลงมาใต้คอลัมน์หลัก (การ์ดแบ่ง 2 คอลัมน์)
 */
.rail-layout { display: flex; gap: 20px; align-items: flex-start; }
.rail-main { flex: 0 1 980px; min-width: 0; }
.rail-aside { flex: 0 0 280px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1320px) {
    .rail-layout { flex-direction: column; align-items: stretch; }
    .rail-main { flex: none; width: 100%; max-width: 980px; margin: 0 auto; }
    /* การ์ดแบ่งครึ่งเป็น 2 คอลัมน์แทนยืดเต็มความกว้าง; มือถือ (<=600px) คอลัมน์เดียว */
    .rail-aside { display: block; flex: none; width: 100%; max-width: 980px; margin: 0 auto; column-count: 2; column-gap: 12px; }
    .rail-aside > .rail-card { break-inside: avoid; margin-bottom: 12px; }
}
@media (max-width: 600px) {
    .rail-aside { column-count: 1; }
}

.rail-card { min-width: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-box); padding: 14px 16px; }
.rail-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }

.rail-price { font-size: 30px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.rail-chg { font-size: 15px; font-weight: 700; margin-top: 2px; }
.rail-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.rail-spark { margin: 12px 0 4px; }
.rail-spark svg { display: block; width: 100%; height: 56px; }
.rail-spark .caption { font-size: 11px; color: var(--text-faint); }

.rail-range { margin-top: 14px; }
.rail-range .labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.rail-range .bar { position: relative; height: 6px; border-radius: 3px; background: var(--border); margin: 6px 0 4px; }
.rail-range .bar i { position: absolute; top: -3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--card-bg); box-sizing: border-box; }
.rail-range .caption { font-size: 11px; color: var(--text-faint); }

.rail-index { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: -14px -16px 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 700; color: var(--text-primary); text-decoration: none; }
.rail-index .idx-logo { height: 16px; width: auto; flex: 0 0 auto; }

/* หัวข้อการ์ดที่มีค่าเสริมชิดขวาในบรรทัดเดียวกัน (เช่น %Div. ของการ์ด DPS/EPS) */
.rail-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rail-title-row .dpseps-yield { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--text-muted); }
.rail-title-row .dpseps-yield b.dps { color: var(--accent); font-weight: 700; }

.rail-more { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; color: var(--text-muted); text-decoration: none; }
.rail-more:hover { color: var(--accent); }
.rail-news { list-style: none; margin: 0; padding: 0; }
.rail-news li { min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); font-size: 13px; }
.rail-news li:first-child { border-top: 0; padding-top: 0; }
.rail-news .d { flex: 0 0 auto; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.rail-news a, .rail-news .t { flex: 1 1 auto; min-width: 0; color: var(--text-primary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-news a:hover { color: var(--accent); text-decoration: underline; }

.rail-group { font-size: 14px; color: var(--text-secondary); margin-bottom: 2px; }
.rail-group b { color: var(--text-primary); }
.rail-peers { list-style: none; margin: 0; padding: 0; }
.rail-peers li { display: flex; align-items: baseline; gap: 8px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; font-size: 13px; }
.rail-peers li.self { background: var(--autocomplete-hover-bg); }
.rail-peers .sym { flex: 1 1 auto; font-weight: 700; color: var(--text-primary); text-decoration: none; }
.rail-peers .sym:hover { color: var(--accent); text-decoration: underline; }
.rail-peers .price { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rail-peers .price { flex: 0 0 44px; text-align: right; }
.rail-peers .chg-abs { flex: 0 0 44px; text-align: right; font-variant-numeric: tabular-nums; }
.rail-peers .chg { flex: 0 0 62px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.rail-consensus { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--text-muted); }
.rail-consensus .tp { margin-left: auto; color: var(--text-secondary); }
.rail-consensus .tp b { color: var(--text-primary); }
.rail-rec-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--border); margin: 8px 0 3px; }
.rail-rec-bar i { display: block; height: 100%; }
.rail-rec-bar .buy { background: var(--good); }
.rail-rec-bar .hold { background: var(--text-faint); }
.rail-rec-bar .sell { background: var(--bad); }
.rail-rec-nums { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); }
.rail-reports { list-style: none; margin: 10px 0 0; padding: 0; }
.rail-reports li { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 0; border-top: 1px solid var(--border); font-size: 13px; }
.rail-reports .d { flex: 0 0 auto; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.rail-reports a { flex: 1 1 auto; min-width: 0; color: var(--text-primary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-reports a:hover { color: var(--accent); text-decoration: underline; }
.rail-reports .tp { flex: 0 0 auto; min-width: 38px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.rail-eps { display: flex; gap: 8px; margin-top: 10px; }
.rail-eps > div { flex: 1 1 0; display: flex; flex-direction: column; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }
.rail-eps .lbl { font-size: 11px; color: var(--text-muted); }
.rail-eps b { font-size: 18px; color: var(--text-primary); line-height: 1.2; }
.rail-eps .unit { font-size: 11px; color: var(--text-faint); }

.rail-price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.rail-price-row .rail-chg { margin-top: 0; }
.rail-title-row .rail-asof { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; color: var(--text-faint); }

.rail-price-row[data-symbol] { cursor: default; }
