/* 모닝 브리프(첫 탭): 16:9 한 화면에 4개 영역. 위 한 줄 스냅샷 + 아래 3칸(밸류체인 · 뉴스 · 브리핑 초안) */
:root { --flag: #9a5b00; --flag-bg: #fff6e3; --flag-line: #e8c98a; --navy: #14294a; }

.badge { font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 4px; letter-spacing: .02em; color: #fff; background: var(--flag); }
.badge-line { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--flag-bg); color: var(--flag); border: 1px solid var(--flag-line); white-space: nowrap; }

.mb-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); min-width: 0; }
.mb-h h2 { margin: 0; font-size: 14px; font-weight: 800; color: var(--navy); white-space: nowrap; }
.mb-h .meta { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-no { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--navy); color: #fff; font-size: 11.5px; font-weight: 800; flex: none; }
.mb-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }

/* ① 스냅샷 */
.snaps { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); }
.snap { position: relative; padding: 6px 12px 7px; border-right: 1px solid var(--line); min-width: 0; }
.snap:last-child { border-right: 0; }
.snap-n { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.snap-n span { overflow: hidden; text-overflow: ellipsis; }
.snap-v { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; white-space: nowrap; }
.snap-c { font-size: 13px; font-weight: 800; white-space: nowrap; }
.snap-c small { font-size: 11px; font-weight: 600; opacity: .8; margin-left: 2px; }
.snap-g { font-size: 10px; font-weight: 800; color: var(--accent); letter-spacing: .04em; line-height: 1.5; }
.snap.gs:not(:first-child) { border-left: 2px solid var(--line); margin-left: -1px; }
.snap-s { display: flex; justify-content: space-between; align-items: center; margin-top: 1px; font-size: 10.5px; color: var(--ink-3); font-weight: 700; }
.snap-s .spark { width: 64px; height: 16px; }
.snap .badge { font-size: 10px; padding: 0 5px; }
.snap-d { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; }
.snap.flag { background: var(--flag-bg); box-shadow: inset 0 3px 0 var(--flag); }
.snap.off { background: var(--panel-2); }

/* 공통 칸 */
.mb-mid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr) minmax(0, .9fr); gap: 12px; min-height: 0; }
.mb-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mb-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 14px 8px; scrollbar-width: thin; }
.segs { display: flex; gap: 4px; flex-wrap: wrap; }
.seg { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg small { font-weight: 600; color: var(--ink-3); }
.seg.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.seg.on small { color: #c5d2e6; }

/* ② 밸류체인 */
.chain-b { padding-top: 0; }
.chain-cap, .node { display: grid; grid-template-columns: 104px 92px 138px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.chain-cap { grid-template-columns: 78px 112px 62px minmax(0, 1fr); position: sticky; top: 0; background: var(--panel); padding: 7px 0 5px; font-size: 11px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); z-index: 1; }
.chain-cap span:nth-child(3) { text-align: right; }
.layer { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 0; border-bottom: 1px solid var(--line); }
.layer:last-child { border-bottom: 0; }
.layer-l { position: relative; display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; padding-top: 3px; }
.layer-l b { font-size: 12.5px; color: var(--navy); }
.layer-l span { font-weight: 700; }
.layer-l small { color: var(--ink-3); font-size: 10.5px; }
.layer-a { display: none; position: absolute; bottom: -13px; left: 2px; font-style: normal; font-size: 9px; color: var(--ink-3); background: var(--panel); padding: 0 3px; z-index: 1; }
.layer.kr { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.node { padding: 1.5px 0; font-size: 12.5px; line-height: 1.45; }
.chain-t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px -14px 0; padding: 3px 14px; background: var(--panel-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.chain-t b { font-size: 13px; }
.chain-t > b { color: var(--navy); }
.chain-b > .chain-t:first-child { margin-top: -8px; border-top: 0; }
.node-n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-c { font-weight: 800; white-space: nowrap; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.mbar { display: inline-block; width: 34px; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; flex: none; }
.mbar b { display: block; height: 100%; border-radius: 3px; }
.mbar b.up { background: var(--up); }
.mbar b.down { background: var(--down); }
.node-i { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ③ 뉴스 */
.nw-tabs { padding: 8px 14px 0; }
.nw-g { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 11.5px; }
.nw-g:first-child { margin-top: 0; }
.nw-g .meta { color: var(--ink-3); margin-left: auto; }
.cat { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 4px; background: var(--chip); color: var(--ink-2); white-space: nowrap; margin-right: 6px; }
.cat.c-macro { background: #e6ecf5; color: #1b3a66; }
.cat.c-ai { background: #e9e8f6; color: #3a3585; }
.cat.c-energy { background: #e4f0ec; color: #1d5c4b; }
.imp-n { font-weight: 700; color: var(--ink-3); }
.imp-n.pos { color: var(--good); }
.imp-n.neg { color: var(--alert); }
.nws { list-style: none; margin: 0; padding: 0; }
.nw { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); align-items: start; }
.nws .nw:first-child { border-top: 0; }
.imp { font-size: 11px; font-weight: 800; text-align: center; padding: 2px 0; border-radius: 4px; margin-top: 1px; }
.imp.pos { background: var(--good-bg); color: var(--good); }
.imp.neg { background: var(--alert-bg); color: var(--alert); }
.imp.neu { background: var(--chip); color: var(--ink-3); }
.nw-b { min-width: 0; }
.nw-t { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nw-s { display: flex; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; min-width: 0; }
.nw-l { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nw-m { margin-left: auto; white-space: nowrap; flex: none; }

/* ④ 브리핑 초안 */
.brief { border-color: var(--navy); }
.brief .mb-h { background: var(--navy); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; border-bottom: 0; }
.brief .mb-h h2 { color: #fff; }
.brief .mb-no { background: #fff; color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.brief .mb-h .btn { padding: 3px 10px; font-size: 12px; border-color: #5d7396; background: transparent; color: #fff; }
.brief .mb-h .btn.primary { background: #fff; color: var(--navy); border-color: #fff; }
.btn.big { padding: 10px 18px; font-size: 14px; margin-top: 6px; }
.btn.primary:hover { filter: brightness(1.12); background: var(--navy); }
.brief .mb-h .btn.primary:hover { background: #e8eef6; filter: none; }
.brief-empty { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 6px 8px; color: var(--ink-2); font-size: 13px; }
.brief-empty b { font-size: 15px; color: var(--navy); }
.brief-empty ol { margin: 6px 0; padding-left: 20px; line-height: 1.8; }
.brief-empty p { margin: 0 0 6px; font-size: 12px; color: var(--ink-3); }
.brief-doc { font-size: 12.5px; line-height: 1.55; }
.brief-doc h3 { margin: 2px 0 2px; font-size: 15px; color: var(--navy); }
.brief-doc h4 { margin: 10px 0 3px; font-size: 12.5px; color: var(--navy); padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.brief-doc p { margin: 3px 0; }
.brief-doc p.li { padding-left: 12px; position: relative; }
.brief-doc p.li::before { content: "•"; position: absolute; left: 1px; color: var(--ink-3); }
.brief-doc p.li.sub { margin-left: 14px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brief-doc p.li.sub::before { content: "–"; }
.brief-doc p.note { font-size: 11px; color: var(--ink-3); }
.brief-doc a { color: var(--accent); }
.brief-doc h4 + p:not(.li) { font-size: 13.5px; font-weight: 700; background: var(--accent-soft); border-left: 3px solid var(--navy); padding: 7px 10px; border-radius: 0 6px 6px 0; }

/* 모닝 탭일 때 머리줄을 한 줄로 줄이고 화면 높이에 맞춘다 */
body.morning .picker-row, body.morning .foot, body.morning .stamp, body.morning .brand-text small { display: none; }
body.morning .top { display: flex; align-items: center; gap: 22px; padding: 0 20px; background: var(--panel); }
body.morning .top-row { max-width: none; margin: 0; padding: 8px 0; flex: none; }
body.morning .tabs { max-width: none; margin: 0; padding: 0; flex: 1; align-self: flex-end; }
body.morning main { max-width: none; padding: 10px 20px 12px; gap: 10px; }
@media (min-width: 1180px) and (min-height: 620px) {
  body.morning { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  body.morning main { flex: 1; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
}
@media (max-width: 1179px) {
  .snaps { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .snap { border-bottom: 1px solid var(--line); }
  .mb-mid { grid-template-columns: 1fr; }
  .mb-h { flex-wrap: wrap; }
  .mb-body { overflow: visible; }
}

.brief-by { font-size: 11px !important; font-weight: 700; color: var(--ink-3); margin: 0 0 4px !important; }
.brief-warn { font-size: 11.5px !important; font-weight: 700; color: var(--flag); background: var(--flag-bg); border: 1px solid var(--flag-line); border-radius: 6px; padding: 5px 8px; }

/* 개장 가늠 · 전일 수급 · 오늘 일정 한 줄 */
.mb-strip { display: flex; align-items: stretch; flex-wrap: wrap; overflow: hidden; }
.strip-g { display: flex; align-items: center; gap: 12px; padding: 5px 12px; flex: none; border-right: 1px solid var(--line); white-space: nowrap; min-width: 0; font-size: 12.5px; }
.strip-g:last-child { border-right: 0; }
.strip-g.grow { flex: 1 1 100%; overflow: hidden; border-top: 1px solid var(--line); padding-top: 5px; padding-bottom: 5px; }
.strip-g:nth-child(2) { flex: 1; }
.strip-g > b { font-size: 12px; font-weight: 800; color: var(--navy); display: flex; flex-direction: column; line-height: 1.25; }
.strip-g > b small { font-size: 10px; font-weight: 600; color: var(--ink-3); }
.gz { display: inline-flex; align-items: baseline; gap: 4px; font-size: 12px; color: var(--ink-2); }
.gz em { font-style: normal; font-weight: 700; color: var(--ink-2); }
.gz b { font-weight: 800; color: var(--ink); }
.gz i { font-style: normal; font-weight: 800; }
.gz small { font-size: 10.5px; color: var(--ink-3); }
.gz .chip { font-size: 10.5px; padding: 0 6px; font-weight: 700; }

/* 브리핑 도구줄 · 편집 · 5줄판 */
.brief-tools { display: flex; align-items: center; gap: 10px; padding: 7px 14px 0; }
.brief-arc { font-size: 11.5px; color: var(--ink-3); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.brief-arc select { font: inherit; font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--panel); }
.brief-edit { width: 100%; height: 100%; min-height: 320px; resize: none; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12.5px/1.6 var(--font); color: var(--ink); background: var(--panel-2); }
.brief-edit:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.brief-short { white-space: pre-wrap; font: 13.5px/1.9 var(--font); margin: 6px 0 0; padding: 12px 14px; background: var(--accent-soft); border-left: 3px solid var(--navy); border-radius: 0 8px 8px 0; }
@media (max-width: 1179px) { .mb-strip { flex-direction: column; } .strip-g { border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; white-space: normal; } }

/* 맥지표 박스 상태 */
.mac { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; white-space: nowrap; min-width: 0; }
.mac b { font-size: 10.5px; font-weight: 800; padding: 0 5px; border-radius: 4px; line-height: 1.55; }
.mac.hold b { background: var(--navy); color: #fff; }
.mac.pending b { background: var(--panel); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--ink-3); }
.mac em { font-style: normal; font-weight: 700; color: var(--ink); }
.mac i { font-style: normal; font-weight: 700; font-size: 11px; }
.mac.none { color: var(--ink-3); font-size: 11.5px; }
.ovs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; padding: 3px 0 2px; }
.ov { display: grid; grid-template-columns: 84px 60px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 1.5px 0; font-size: 12.5px; line-height: 1.45; border-bottom: 1px solid var(--line); }
.ov:nth-last-child(-n+2) { border-bottom: 0; }
.ov .node-c { justify-content: flex-end; }
a.mac { cursor: pointer; border-radius: 5px; padding: 0 3px; margin: 0 -3px; }
a.mac:hover { text-decoration: none; background: var(--accent-soft); }
a.mac:hover em { text-decoration: underline; text-underline-offset: 2px; }
