/* 個股重要新聞面板 — owner: news (docs/ARCHITECTURE.md §9). 紅漲綠跌：利多 = --up（紅）、利空 = --down（綠）。 */

.nws {
  --nws-rail: 22px;
  --nws-line: var(--border, rgba(150, 172, 230, 0.11));
  --nws-gold: var(--warn, #f5b544);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  font-size: var(--fs-sm, 12.5px);
  color: var(--text, #e7edf8);
}

/* ---- header ---- */
.nws-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.nws-hd__t { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.nws-hd h3 { margin: 0; font-size: var(--fs-lg, 15px); font-weight: 650; letter-spacing: 0.02em; }
.nws-src {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--r-pill, 999px);
  font-size: var(--fs-2xs, 10.5px); color: var(--muted, #8190ac); background: var(--panel-2, rgba(22, 32, 58, 0.72));
  border: 1px solid var(--nws-line); cursor: help; white-space: nowrap;
}
.nws-src__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--down, #1fcb7e); box-shadow: 0 0 6px var(--down, #1fcb7e); }
.nws-src.is-warn .nws-src__dot { background: var(--nws-gold); box-shadow: 0 0 6px var(--nws-gold); }
.nws-jev { margin-left: 2px; padding-left: 6px; border-left: 1px solid var(--nws-line); color: var(--faint, #56627c); }
.nws-jev.is-on { color: var(--accent, #6c8cff); }

.nws-seg { display: inline-flex; padding: 2px; border-radius: var(--r-pill, 999px); background: var(--panel-2, rgba(22, 32, 58, 0.72)); border: 1px solid var(--nws-line); }
.nws-seg__b {
  appearance: none; border: 0; background: transparent; color: var(--muted, #8190ac); font: inherit; font-size: var(--fs-xs, 11.5px);
  padding: 3px 11px; border-radius: var(--r-pill, 999px); cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--dur-2, 220ms) var(--ease-out), color var(--dur-2, 220ms);
}
.nws-seg__b:hover { color: var(--text, #e7edf8); }
.nws-seg__b.is-on { background: var(--accent-soft, rgba(108, 140, 255, 0.16)); color: var(--text, #e7edf8); box-shadow: inset 0 0 0 1px rgba(108, 140, 255, 0.35); }
.nws-seg__b:focus-visible { outline: none; box-shadow: var(--ring); }
.nws-seg__n {
  font-family: var(--font-mono, monospace); font-size: 10px; min-width: 16px; padding: 0 5px; border-radius: 8px; text-align: center;
  background: rgba(150, 172, 230, 0.12); color: var(--text-2, #b9c4da);
}

.nws-asof {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-md, 9px);
  font-size: var(--fs-xs, 11.5px); color: var(--text-2, #b9c4da);
  background: linear-gradient(90deg, var(--accent-soft, rgba(108, 140, 255, 0.16)), transparent 80%);
  border: 1px solid rgba(108, 140, 255, 0.22);
}
.nws-asof__i { font-style: normal; }

/* ---- list (timeline rail) ---- */
.nws-list { list-style: none; margin: 0; padding: 0; position: relative; }
.nws-list::before {
  content: ""; position: absolute; left: calc(var(--nws-rail) / 2 - 0.5px); top: 14px; bottom: 14px; width: 1px;
  background: linear-gradient(var(--nws-line), var(--border-strong, rgba(150, 172, 230, 0.22)) 20%, var(--nws-line));
}
.nws-it {
  --tone: var(--flat, #8a94a8);
  position: relative; display: grid; grid-template-columns: var(--nws-rail) minmax(0, 1fr) auto; gap: 0 10px;
  padding: 10px 10px 10px 0; border-radius: var(--r-md, 9px); cursor: pointer;
  transition: background var(--dur-2, 220ms) var(--ease-out), box-shadow var(--dur-2, 220ms);
  animation: nws-in var(--dur-3, 380ms) var(--ease-out) both;
}
.nws-list .nws-it:nth-child(2) { animation-delay: 30ms; }
.nws-list .nws-it:nth-child(3) { animation-delay: 60ms; }
.nws-list .nws-it:nth-child(4) { animation-delay: 90ms; }
.nws-list .nws-it:nth-child(n + 5) { animation-delay: 120ms; }
@keyframes nws-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.nws-it + .nws-it { margin-top: 2px; }
.nws-it:hover { background: var(--panel-hover, rgba(34, 48, 84, 0.55)); }
.nws-it.is-pinned { background: var(--accent-soft, rgba(108, 140, 255, 0.16)); box-shadow: inset 0 0 0 1px rgba(108, 140, 255, 0.4); }
.nws-it.tone-up { --tone: var(--up, #ff4d5e); }
.nws-it.tone-down { --tone: var(--down, #1fcb7e); }
.nws-it.is-material { background: linear-gradient(90deg, rgba(245, 181, 68, 0.08), transparent 55%); }
.nws-it.is-material:hover { background: linear-gradient(90deg, rgba(245, 181, 68, 0.14), var(--panel-hover, rgba(34, 48, 84, 0.55)) 70%); }
.nws-it.is-later { opacity: 0.72; }
.nws-it.is-later:hover { opacity: 1; }

.nws-it__rail { display: flex; justify-content: center; padding-top: 5px; }
.nws-it__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--tone); position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--panel-solid, #0d1427), 0 0 10px color-mix(in srgb, var(--tone) 70%, transparent);
}
.nws-it.is-material .nws-it__dot { outline: 1.5px solid var(--nws-gold); outline-offset: 2px; }

.nws-it__main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.nws-it__tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nws-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; padding: 1px 7px; border-radius: var(--r-xs, 4px);
  color: #1a1204; background: linear-gradient(180deg, #ffd27a, var(--nws-gold)); box-shadow: 0 0 10px rgba(245, 181, 68, 0.35);
}
.nws-chip {
  font-size: 10.5px; font-weight: 650; padding: 1px 8px; border-radius: var(--r-pill, 999px); color: var(--tone, var(--flat));
  background: color-mix(in srgb, var(--tone, var(--flat)) 15%, transparent); border: 1px solid color-mix(in srgb, var(--tone, var(--flat)) 40%, transparent);
}
.nws-chip.tone-up { --tone: var(--up, #ff4d5e); }
.nws-chip.tone-down { --tone: var(--down, #1fcb7e); }
.nws-chip.tone-flat { --tone: var(--flat, #8a94a8); }
.nws-topic { font-size: 10.5px; color: var(--text-2, #b9c4da); padding: 1px 7px; border-radius: var(--r-xs, 4px); background: rgba(150, 172, 230, 0.09); }
.nws-rule { font-size: 10px; color: var(--faint, #56627c); border: 1px dashed var(--nws-line); padding: 0 5px; border-radius: 4px; }

.nws-imp { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted, #8190ac); margin-left: auto; }
.nws-imp__bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.nws-imp__bars i { width: 3px; border-radius: 1px; background: rgba(150, 172, 230, 0.18); }
.nws-imp__bars i:nth-child(1) { height: 4px; }
.nws-imp__bars i:nth-child(2) { height: 6px; }
.nws-imp__bars i:nth-child(3) { height: 9px; }
.nws-imp__bars i:nth-child(4) { height: 11px; }
.nws-imp__bars i.on { background: var(--accent, #6c8cff); }
.nws-imp.lv-2 .nws-imp__bars i.on { background: var(--nws-gold); }
.nws-imp.lv-3 .nws-imp__bars i.on { background: var(--danger, #ff6b6b); box-shadow: 0 0 5px rgba(255, 107, 107, 0.5); }
.nws-imp.lv-3 .nws-imp__l { color: var(--text, #e7edf8); font-weight: 600; }

.nws-it__title {
  color: var(--text, #e7edf8); font-size: var(--fs-md, 13.5px); font-weight: 560; line-height: 1.45; text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
a.nws-it__title:hover { color: var(--accent-strong, #8aa4ff); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(138, 164, 255, 0.5); }
a.nws-it__title:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 3px; }
.nws-ext { display: inline-block; margin-left: 4px; font-size: 11px; color: var(--muted, #8190ac); transition: transform var(--dur-1, 120ms); }
a.nws-it__title:hover .nws-ext { transform: translate(1px, -1px); color: var(--accent-strong, #8aa4ff); }
.nws-it__sum {
  margin: 0; color: var(--text-2, #b9c4da); font-size: var(--fs-xs, 11.5px); line-height: 1.55; opacity: 0.85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line;
}
.nws-it__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: var(--fs-2xs, 10.5px); color: var(--muted, #8190ac); }
.nws-pub { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2, #b9c4da); font-weight: 550; }
.nws-fav {
  width: 15px; height: 15px; border-radius: 4px; display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 700;
  color: var(--text, #e7edf8); background: linear-gradient(135deg, rgba(108, 140, 255, 0.45), rgba(67, 198, 217, 0.35));
}
.nws-it.is-material .nws-fav { background: linear-gradient(135deg, #ffd27a, var(--nws-gold)); color: #1a1204; }
.nws-dom { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--faint, #56627c); }
.nws-it__meta time { font-variant-numeric: tabular-nums; }
.nws-also a { color: var(--text-2, #b9c4da); text-decoration: none; }
.nws-also a:hover { color: var(--accent-strong, #8aa4ff); text-decoration: underline; }

.nws-thumb {
  width: 76px; height: 54px; object-fit: cover; border-radius: var(--r-sm, 6px); align-self: center;
  border: 1px solid var(--nws-line); background: var(--panel-2); opacity: 0.92;
}
@media (max-width: 520px) { .nws-thumb { display: none; } }

/* ---- later (time machine) ---- */
.nws-later { border-top: 1px dashed var(--border-strong, rgba(150, 172, 230, 0.22)); padding-top: 8px; }
.nws-later > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs, 11.5px);
  color: var(--accent-strong, #8aa4ff); padding: 3px 0; user-select: none;
}
.nws-later > summary::-webkit-details-marker { display: none; }
.nws-later > summary::before { content: "▸"; transition: transform var(--dur-2, 220ms); }
.nws-later[open] > summary::before { transform: rotate(90deg); }

/* ---- states ---- */
.nws-empty {
  padding: 18px 14px; border-radius: var(--r-md, 9px); text-align: center; color: var(--muted, #8190ac);
  border: 1px dashed var(--border-strong, rgba(150, 172, 230, 0.22)); background: rgba(150, 172, 230, 0.03);
}
.nws-empty b { display: block; color: var(--text-2, #b9c4da); font-size: var(--fs-md, 13.5px); margin-bottom: 4px; }
.nws-empty p { margin: 0; font-size: var(--fs-xs, 11.5px); line-height: 1.6; }
.nws-empty code { font-family: var(--font-mono, monospace); background: var(--panel-2); padding: 1px 6px; border-radius: 4px; color: var(--accent-strong, #8aa4ff); }
.nws-empty--error { border-color: rgba(255, 107, 107, 0.35); }
.nws-btn, .nws-link {
  appearance: none; font: inherit; font-size: var(--fs-xs, 11.5px); cursor: pointer; margin-top: 8px;
  color: var(--accent-strong, #8aa4ff); background: var(--accent-soft, rgba(108, 140, 255, 0.16));
  border: 1px solid rgba(108, 140, 255, 0.35); border-radius: var(--r-pill, 999px); padding: 3px 12px;
}
.nws-link { background: transparent; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.nws-note { margin: 0; font-size: var(--fs-2xs, 10.5px); color: var(--faint, #56627c); text-align: center; }

.nws-skel .nws-it { cursor: default; animation: none; }
.nws-skel .sk { display: block; border-radius: 4px; background: linear-gradient(90deg, rgba(150, 172, 230, 0.07), rgba(150, 172, 230, 0.16), rgba(150, 172, 230, 0.07)); background-size: 200% 100%; animation: nws-shimmer 1.3s linear infinite; }
.nws-skel .sk-tags { width: 42%; height: 12px; }
.nws-skel .sk-title { width: 92%; height: 14px; }
.nws-skel .sk-short { width: 60%; }
.nws-skel .sk-meta { width: 34%; height: 10px; }
.nws-skel .nws-it__dot { background: rgba(150, 172, 230, 0.2); box-shadow: 0 0 0 3px var(--panel-solid, #0d1427); }
@keyframes nws-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- footer: per-source status ---- */
.nws-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px solid var(--nws-line); }
.nws-sc {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted, #8190ac); padding: 1px 7px;
  border-radius: var(--r-pill, 999px); background: rgba(150, 172, 230, 0.06);
}
.nws-sc b { font-family: var(--font-mono, monospace); font-weight: 600; color: var(--text-2, #b9c4da); }
.nws-sc.is-bad { color: var(--danger, #ff6b6b); background: rgba(255, 107, 107, 0.08); }
.nws-sc.is-bad b { color: var(--danger, #ff6b6b); }
.nws-foot__t { margin-left: auto; font-size: 10px; color: var(--faint, #56627c); }

:root[data-theme="light"] .nws-it__dot { box-shadow: 0 0 0 3px var(--panel-solid, #fff), 0 0 8px color-mix(in srgb, var(--tone) 50%, transparent); }
:root[data-theme="light"] .nws-badge { color: #3a2600; }

@media (prefers-reduced-motion: reduce) {
  .nws-it, .nws-skel .sk { animation: none; }
}

/* Drawer K-line legend entry for news markers (drawer owns the legend; the swatch style lives here). */
.ins .mk-news i {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: conic-gradient(var(--up, #ff4d5e) 0 50%, var(--down, #1fcb7e) 0 75%, var(--flat, #8a94a8) 0);
  box-shadow: 0 0 0 1.5px var(--warn, #f5b544);
}
