/* 실시간 뉴스 — 꾸밈 없는 작업 도구 화면. 정보 밀도 높게, 읽기 빠르게.
   색은 뜻에만: 빨강=속보, 주황=단독, 파랑=선택·동작, 초록=연결됨. 깜빡임 없음(새 기사는 한 번 옅게 물들었다 빠질 뿐). */
:root {
  --n-bg: #0d0e10; --n-panel: #141518; --n-panel2: #1b1c20; --n-line: #24252a; --n-line2: #31323a;
  --n-text: #e6e7ea; --n-sub: #8b8d94; --n-dim: #5d5f66;
  --n-blue: #4c8dff; --n-blue-bg: rgba(76, 141, 255, .13); --n-red: #ff5a5f; --n-red-bg: rgba(255, 90, 95, .12);
  --n-amber: #f5a524; --n-amber-bg: rgba(245, 165, 36, .13); --n-green: #3ecf8e; --n-new: rgba(76, 141, 255, .16); --n-hl: rgba(245, 165, 36, .1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --n-bg: #f5f6f8; --n-panel: #ffffff; --n-panel2: #f0f1f4; --n-line: #e3e5ea; --n-line2: #d2d5dc;
  --n-text: #16171b; --n-sub: #5c606a; --n-dim: #9a9ea8;
  --n-blue: #2f6fed; --n-blue-bg: rgba(47, 111, 237, .09); --n-red: #d92d33; --n-red-bg: rgba(217, 45, 51, .08);
  --n-amber: #b26b00; --n-amber-bg: rgba(178, 107, 0, .1); --n-green: #13945f; --n-new: rgba(47, 111, 237, .1); --n-hl: rgba(178, 107, 0, .08);
  color-scheme: light;
}
html, body { height: 100%; }
body { background: var(--n-bg); color: var(--n-text); font-family: var(--font-sans); font-size: 13.5px; line-height: 1.5; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.mono, .t { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; display: block; }
kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 0 4px; border: 1px solid var(--n-line2); border-bottom-width: 2px; border-radius: 4px; color: var(--n-sub); background: var(--n-panel2); line-height: 16px; }

/* 위 막대 */
.bar { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--n-line); background: var(--n-panel); flex-wrap: wrap; }
.crumb { color: var(--n-sub); text-decoration: none; font-size: 13px; }
.crumb:hover { color: var(--n-text); }
.crumb-sep { color: var(--n-dim); }
.app-title { font-size: 15px; font-weight: 700; }
.bar-gap { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--n-sub); padding: 3px 9px; border: 1px solid var(--n-line); border-radius: 99px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--n-dim); }
.live[data-state="live"] i { background: var(--n-green); }
.live[data-state="poll"] i { background: var(--n-amber); }
.live[data-state="down"] i { background: var(--n-red); }
.search { position: relative; width: min(320px, 40vw); }
.search input { width: 100%; height: 32px; border-radius: 6px; border: 1px solid var(--n-line2); background: var(--n-bg); padding: 0 34px 0 10px; }
.search input:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 3px var(--n-blue-bg); }
.search kbd { position: absolute; right: 8px; top: 7px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 6px; border: 1px solid var(--n-line2); background: var(--n-panel2); cursor: pointer; white-space: nowrap; font-size: 13px; text-decoration: none; }
.btn:hover { border-color: var(--n-dim); }
.btn.primary { background: var(--n-blue); border-color: var(--n-blue); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--n-sub); }
.btn.ghost:hover { color: var(--n-text); background: var(--n-panel2); }
.btn.ghost.on { color: var(--n-amber); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.icon-btn { width: 32px; padding: 0; }
.only-narrow { display: none; }

/* 배치 */
.layout { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr) 380px; min-height: 0; }
.side { border-right: 1px solid var(--n-line); background: var(--n-panel); overflow: auto; }
.main { min-width: 0; overflow: auto; position: relative; }
.detail { border-left: 1px solid var(--n-line); background: var(--n-panel); overflow: auto; padding: 16px 18px 40px; }

/* 왼쪽 */
.side-sec { padding: 12px 14px; border-bottom: 1px solid var(--n-line); }
.sec-title { font-size: 11.5px; font-weight: 600; color: var(--n-sub); margin-bottom: 7px; }
.sec-title small { font-weight: 400; color: var(--n-dim); margin-left: 4px; }
.sec-row { display: flex; justify-content: space-between; align-items: center; }
.seg { display: flex; border: 1px solid var(--n-line2); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; height: 28px; border: 0; background: transparent; font-size: 12.5px; color: var(--n-sub); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--n-line2); }
.seg button.on { background: var(--n-blue-bg); color: var(--n-blue); font-weight: 600; }
.views { display: flex; flex-direction: column; gap: 1px; }
.views button { display: flex; justify-content: space-between; align-items: center; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--n-sub); text-align: left; }
.views button:hover { background: var(--n-panel2); color: var(--n-text); }
.views button.on { background: var(--n-blue-bg); color: var(--n-blue); font-weight: 600; }
.kw-form { display: flex; gap: 6px; }
.kw-form input { flex: 1; min-width: 0; height: 26px; border-radius: 5px; border: 1px solid var(--n-line2); background: var(--n-bg); padding: 0 8px; font-size: 12.5px; }
.kw-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 4px; }
.kw { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--n-hl); color: var(--n-amber); border-radius: 4px; padding: 1px 4px 1px 7px; }
.kw button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 2px; font-size: 13px; line-height: 1; }
.chk { display: flex; gap: 7px; align-items: center; font-size: 12px; color: var(--n-sub); margin-top: 6px; }
.outlets-sec { border-bottom: 0; }
.og { margin-bottom: 8px; }
.og-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--n-sub); padding: 3px 0; cursor: pointer; user-select: none; }
.og-head input { margin: 0; }
.og-head .n { margin-left: auto; font: 11px var(--font-mono); color: var(--n-dim); }
.ol { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 0 2px 16px; cursor: pointer; }
.ol input { margin: 0; }
.ol .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ol .sp { font: 10.5px var(--font-mono); color: var(--n-dim); }
.ol.off .nm { color: var(--n-dim); }

/* 가운데 흐름 */
.main-head { position: sticky; top: 0; z-index: 2; background: var(--n-bg); border-bottom: 1px solid var(--n-line); padding: 8px 16px; display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--n-sub); flex-wrap: wrap; }
.main-head b { color: var(--n-text); font-weight: 600; }
.newpill { position: sticky; top: 44px; z-index: 3; display: block; margin: 6px auto -32px; height: 28px; padding: 0 14px; border-radius: 99px; border: 0; background: var(--n-blue); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.stream { list-style: none; }
.row { display: grid; grid-template-columns: 64px 92px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 6px 16px; border-bottom: 1px solid var(--n-line); cursor: pointer; }
.row:hover { background: var(--n-panel); }
.row.sel { background: var(--n-blue-bg); box-shadow: inset 2px 0 0 var(--n-blue); }
.row.fresh { animation: fresh 5s ease-out; }
@keyframes fresh { from { background: var(--n-new); } to { background: transparent; } }
.row.hl { background: var(--n-hl); }
.row .tm { font: 12px var(--font-mono); color: var(--n-sub); font-variant-numeric: tabular-nums; }
.row .src { font-size: 12px; color: var(--n-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .src i { display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }
.row .tt { font-size: 13.5px; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.row.flash .tt { font-weight: 600; }
.row .meta { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.badge { font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 3px; line-height: 17px; margin-right: 5px; vertical-align: 1px; }
.badge.flash { color: var(--n-red); background: var(--n-red-bg); }
.badge.excl { color: var(--n-amber); background: var(--n-amber-bg); }
.cnt { font: 11px var(--font-mono); color: var(--n-blue); background: var(--n-blue-bg); padding: 0 5px; border-radius: 3px; }
.lag { font: 11px var(--font-mono); color: var(--n-dim); min-width: 40px; text-align: right; }
.lag.fast { color: var(--n-green); }
.row.late .tt, .row.late .tm { color: var(--n-sub); }
.more { padding: 14px; text-align: center; color: var(--n-dim); font-size: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--n-sub); }

/* 주요 사건 */
.story { padding: 12px 16px; border-bottom: 1px solid var(--n-line); cursor: pointer; }
.story:hover { background: var(--n-panel); }
.story.sel { background: var(--n-blue-bg); }
.story h3 { font-size: 14.5px; font-weight: 600; line-height: 1.45; margin: 2px 0 5px; word-break: keep-all; }
.story .sline { font-size: 12px; color: var(--n-sub); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.story .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.chip { font-size: 11px; color: var(--n-sub); border: 1px solid var(--n-line2); border-radius: 4px; padding: 0 5px; }
.chip.first { color: var(--n-blue); border-color: var(--n-blue); }

/* 속도표 */
.speed { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.speed th, .speed td { text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--n-line); white-space: nowrap; }
.speed th { position: sticky; top: 41px; background: var(--n-bg); color: var(--n-sub); font-weight: 600; font-size: 11.5px; z-index: 1; cursor: pointer; }
.speed td.r, .speed th.r { text-align: right; }
.speed .bar-cell { width: 30%; min-width: 120px; }
.speed .sbar { height: 6px; border-radius: 3px; background: var(--n-blue); opacity: .75; }
.speed .way { font-size: 11px; color: var(--n-sub); }
.speed .err { color: var(--n-red); font-size: 11px; }
.arch-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--n-line); }
.arch-form input[type=search], .arch-form input[type=date], .arch-form select { height: 32px; border-radius: 6px; border: 1px solid var(--n-line2); background: var(--n-bg); padding: 0 8px; font-size: 13px; }
.arch-form input[type=search] { flex: 1; min-width: 200px; }
.arch-form input[type=search]:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 3px var(--n-blue-bg); }
.arch-status { font-size: 12px; color: var(--n-sub); padding: 8px 16px; border-bottom: 1px solid var(--n-line); display: flex; gap: 12px; flex-wrap: wrap; }
.arch-status .on { color: var(--n-green); }
.arch-status .off { color: var(--n-amber); }
.arow { display: grid; grid-template-columns: 130px 100px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 16px; border-bottom: 1px solid var(--n-line); text-decoration: none; color: inherit; }
.arow:hover { background: var(--n-panel); }
.arow .tm { font: 12px var(--font-mono); color: var(--n-sub); }
.arow .src { font-size: 12px; color: var(--n-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arow .tt { font-size: 13.5px; line-height: 1.45; word-break: keep-all; }
.arow .tt mark { background: var(--n-hl); color: inherit; border-radius: 2px; }
.arow .via { font-size: 10.5px; color: var(--n-dim); border: 1px solid var(--n-line2); border-radius: 3px; padding: 0 4px; }
@media (max-width: 760px) { .arow { grid-template-columns: 1fr auto; } .arow .tm { grid-column: 1; } .arow .src { grid-column: 2; grid-row: 1; } .arow .tt { grid-column: 1 / -1; } .arow .via { display: none; } }
/* 편의 기능 — 분야 칩·지금 뜨는 낱말·시간 구분선·묶어 보기·읽음 */
.main-head { flex-direction: column; align-items: stretch; gap: 6px; }
.hrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hx { display: flex; flex-direction: column; gap: 6px; }
.topics, .trends { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tchip, .trend { border: 1px solid var(--n-line2); background: transparent; color: var(--n-sub); border-radius: 99px; height: 24px; padding: 0 10px; font-size: 12px; cursor: pointer; }
.tchip:hover, .trend:hover { color: var(--n-text); border-color: var(--n-dim); }
.tchip.on { background: var(--n-blue-bg); border-color: var(--n-blue); color: var(--n-blue); font-weight: 600; }
.trend { border-color: transparent; background: var(--n-panel2); color: var(--n-text); }
.trend small { color: var(--n-dim); font-family: var(--font-mono); margin-left: 2px; }
.trend.on { background: var(--n-amber-bg); color: var(--n-amber); }
.tlabel { font-size: 11.5px; color: var(--n-dim); margin-right: 4px; }
.sort-seg { margin-left: auto; display: inline-flex; border: 1px solid var(--n-line2); border-radius: 6px; overflow: hidden; }
.sort-seg button { border: 0; background: transparent; color: var(--n-sub); font-size: 12px; height: 24px; padding: 0 10px; cursor: pointer; }
.sort-seg button + button { border-left: 1px solid var(--n-line2); }
.sort-seg button.on { background: var(--n-blue-bg); color: var(--n-blue); font-weight: 600; }
.sort-seg + .grp-toggle { margin-left: 10px; }
.grp-toggle { margin-left: auto; font-size: 12px; color: var(--n-sub); display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.sep { list-style: none; padding: 4px 16px; font-size: 11px; font-weight: 600; color: var(--n-dim); background: var(--n-bg); border-bottom: 1px solid var(--n-line); letter-spacing: .02em; }
.row.read .tt { color: var(--n-sub); }
.btn.saved { color: var(--n-amber); border-color: var(--n-amber); }
.speed-note { font-size: 12px; color: var(--n-sub); padding: 10px 16px; line-height: 1.6; }

/* 오른쪽 상세 */
.d-empty { color: var(--n-sub); font-size: 12.5px; line-height: 1.7; }
.d-empty h3 { color: var(--n-text); font-size: 13px; margin-bottom: 6px; }
.d-empty ul { padding-left: 16px; }
.d-out { font-size: 12px; color: var(--n-sub); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-title { font-size: 17px; font-weight: 700; line-height: 1.45; margin: 6px 0 8px; word-break: keep-all; }
.d-desc { font-size: 13px; color: var(--n-sub); line-height: 1.65; margin-bottom: 10px; }
.d-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; background: var(--n-panel2); }
.d-times { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; font-size: 12px; margin-bottom: 12px; }
.d-times dt { color: var(--n-sub); }
.d-times dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.d-acts { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.d-sec { font-size: 12px; font-weight: 600; color: var(--n-sub); margin: 14px 0 6px; display: flex; justify-content: space-between; }
.tline { list-style: none; border-left: 2px solid var(--n-line2); margin-left: 4px; }
.tline li { position: relative; padding: 4px 0 8px 14px; cursor: pointer; }
.tline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--n-panel); border: 2px solid var(--n-line2); }
.tline li.first::before { border-color: var(--n-blue); background: var(--n-blue); }
.tline li.cur .tl-t { color: var(--n-blue); }
.tline li:hover .tl-t { text-decoration: underline; }
.tl-h { font-size: 11.5px; color: var(--n-sub); display: flex; gap: 8px; }
.tl-h b { color: var(--n-text); font-weight: 600; }
.tl-t { font-size: 13px; line-height: 1.45; word-break: keep-all; }

.dlg { border: 1px solid var(--n-line2); border-radius: 12px; background: var(--n-panel); color: var(--n-text); padding: 20px; width: min(520px, calc(100vw - 32px)); margin: auto; }
.dlg::backdrop { background: rgba(0, 0, 0, .5); }
.dlg h2 { font-size: 16px; margin-bottom: 12px; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--n-line); }
.keys td:first-child { white-space: nowrap; width: 1%; padding-right: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--n-text); color: var(--n-bg); padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 50; }

/* 좁은 화면 — 상세는 아래 판, 필터는 펼침 */
@media (max-width: 1180px) { .layout { grid-template-columns: 230px minmax(0, 1fr); } .detail { display: none; } .detail.open { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100vw); z-index: 20; box-shadow: -10px 0 30px rgba(0, 0, 0, .35); } }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .only-narrow { display: inline-flex; }
  .side { display: none; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 21; box-shadow: 10px 0 30px rgba(0, 0, 0, .35); }
  .side.open { display: block; }
  .search { width: 100%; order: 10; }
  .search kbd { display: none; }
  .row { grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 14px; }
  .row .tm { grid-row: 1; grid-column: 1; font-size: 11px; }
  .row .src { grid-row: 1; grid-column: 1; padding-left: 60px; }
  .row .meta { grid-row: 1; grid-column: 2; }
  .row .tt { grid-row: 2; grid-column: 1 / -1; }
  .detail.open { width: 100vw; }
  .speed .bar-cell, .speed .hide-n { display: none; }
}
