/* =====================================================================
   ui2, familia e-atualizacoes: Novidades e comunicados (/novidades/).
   Sem mockup: a faixa baixa e o cartao de ferramentas do /changelog/, mais
   o arquivo por ano na lateral. O comportamento e o do news.js do
   ultrapack-notifications (ids e classes up-news-* no markup); a pele usa as
   classes nov-*. So tokens: cor, raio e sombra saem do tokens.css.
   ===================================================================== */

/* ---------- cor por assunto (selo, ladrilho da data, pontinho da aba) ---------- */
.ui2-novidades [data-topic] { --nov-c: var(--accent); --nov-s: var(--accent-soft); }
.ui2-novidades [data-topic="auto-updater"] { --nov-c: var(--green); --nov-s: var(--green-soft); }
.ui2-novidades [data-topic="planos"] { --nov-c: var(--amber); --nov-s: var(--amber-soft); }
.ui2-novidades [data-topic="avisos"] { --nov-c: var(--danger); --nov-s: var(--danger-soft); }
.ui2-novidades [data-topic="suporte"] { --nov-c: var(--brand-slate); --nov-s: var(--surface-3); }

/* ---------- faixa baixa, como no /changelog/ (titulo e fichas na mesma linha) ---------- */
.ui2-novidades .band { padding: 20px 0 22px; }
.ui2-novidades .band > .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 28px; align-items: center;
  grid-template-areas: "crumbs crumbs" "title chips" "lead lead";
}
.ui2-novidades .band .crumbs { grid-area: crumbs; margin-bottom: 8px; }
.ui2-novidades .band h1 { grid-area: title; font-size: clamp(1.55rem, 1.2rem + 1vw, 2.1rem); line-height: 1.15; }
.ui2-novidades .band-lead { grid-area: lead; margin-top: 5px; font-size: var(--fs-body); max-width: none; }
.ui2-novidades .band .chips { grid-area: chips; margin-top: 0; gap: 8px; justify-content: flex-end; }
.ui2-novidades .band .chip { padding: 6px 12px; font-size: var(--fs-xs); gap: 7px; }
.ui2-novidades .band .chip .i { width: 14px; height: 14px; }
.ui2-novidades .band .chip b { color: var(--ink); font-weight: 600; }

/* ---------- grade: arquivo e cartoes na lateral, comunicados no meio ---------- */
.nov-sec { padding-top: 20px; }
.nov-layout {
  display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px 28px; align-items: start;
  grid-template-areas: "years feed" "notes feed"; grid-template-rows: auto 1fr;
}
.nov-years { grid-area: years; padding: 6px 0 10px; }
.nov-notes { grid-area: notes; display: grid; gap: 14px; align-content: start; }
.nov-feed { grid-area: feed; min-width: 0; }

/* arquivo por ano */
.nov-side-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 8px; font: 700 .95rem/1.2 var(--font-display); color: var(--ink); }
.nov-side-hd .i { width: 17px; height: 17px; color: var(--accent); }
.nov-years-list { display: grid; gap: 4px; padding: 0 10px; }
.nov-year {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 9px 10px 9px 12px; border: 1px solid transparent; border-radius: var(--r-sm); background: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-align: left; cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.nov-year:hover { background: var(--surface-2); color: var(--ink); }
.nov-year[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--line); color: var(--accent-ink); }
.nov-short { display: none; }
.nov-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill); background: var(--surface-3); font: 600 11.5px/1 var(--font-body); color: var(--text);
  font-variant-numeric: tabular-nums;
}
.nov-year[aria-pressed="true"] .nov-count { background: var(--accent); color: var(--on-dark); }

/* ladrilho de icone duotom */
.nov-tile { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }
.nov-tile .i { width: 19px; height: 19px; }
.nov-tile--slate { background: var(--surface-3); color: var(--brand-slate); }

/* versoes de plugins e temas */
.nov-note { padding: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.nov-note .nov-tile { margin-bottom: 6px; }
.nov-note strong { font: 700 .98rem/1.25 var(--font-display); color: var(--ink); }
.nov-note p { font-size: var(--fs-sm); line-height: 1.5; }
.nov-more { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); transition: gap .2s ease, color .2s ease; }
.nov-more .i { width: 15px; height: 15px; }
.nov-more:hover { gap: 9px; color: var(--accent-ink); }

/* suporte */
.nov-help { display: flex; align-items: center; gap: 12px; padding: 14px 18px; transition: box-shadow .2s ease, border-color .2s ease; }
.nov-help:hover { box-shadow: var(--sh-hover); }
.nov-help-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nov-help-txt b { font-size: var(--fs-sm); color: var(--ink); }
.nov-help-txt span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); }
.nov-help-txt .i { width: 14px; height: 14px; }

/* ---------- cartao de ferramentas: assuntos, busca, filtros ---------- */
.nov-topics { padding: 14px 18px 0; gap: 7px; }
.nov-topic { display: inline-flex; align-items: center; gap: 7px; }
.nov-topic small { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.nov-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--nov-c); }
.nov-topic:hover { border-color: var(--ink); }
.nov-topic[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.nov-topic[aria-pressed="true"] small { color: inherit; opacity: .7; }
.nov-topic[aria-pressed="true"] .nov-dot { box-shadow: 0 0 0 2px var(--surface); }

.nov-tools { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 14px 18px; }
.nov-search { flex: 1 1 260px; min-width: 0; }
.nov-search .input { height: 42px; padding-right: 42px; }
.nov-search .input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.nov-search-x {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: var(--surface-3); color: var(--text); cursor: pointer; transition: background .2s ease, color .2s ease;
}
.nov-search-x:hover { background: var(--accent-soft); color: var(--accent-ink); }
.nov-search-x .i { width: 14px; height: 14px; }
.nov-unread { white-space: nowrap; color: var(--ink); font-weight: 500; }
.nov-expand .i { width: 15px; height: 15px; }
.nov-expand:disabled { opacity: .5; cursor: default; }

.nov-bar-meta {
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--surface-2); border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-card) var(--r-card); font-size: var(--fs-sm); color: var(--text);
}
.nov-bar-meta p { font-weight: 600; color: var(--ink); }
.nov-clear { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: var(--bd); border-radius: var(--r-pill); background: var(--surface); font-size: var(--fs-xs); font-weight: 600; color: var(--accent-ink); cursor: pointer; transition: border-color .2s ease; }
.nov-clear:hover { border-color: var(--accent); }
.nov-clear .i { width: 12px; height: 12px; }
.nov-save { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.nov-save .i { width: 14px; height: 14px; color: var(--green); }
.nov-save a { font-weight: 600; color: var(--accent); }
.nov-save a:hover { color: var(--accent-ink); }

/* ---------- comunicados, agrupados por ano ---------- */
.nov-entries { margin-top: 22px; display: grid; gap: 26px; }
.nov-group { display: grid; gap: 12px; }
.nov-group-hd { display: flex; align-items: center; gap: 10px; }
.nov-group-hd h2 { font-size: 1.25rem; }
.nov-group-hd > i { flex: 1; height: 1px; background: var(--line); }

.nov-item { scroll-margin-top: 16px; overflow: hidden; transition: box-shadow .2s ease, border-color .2s ease; }
.nov-item:hover { box-shadow: var(--sh-hover); }
/* nao lido: um filete na cor do assunto (navegador sem :has fica sem o filete) */
.nov-item:has(.up-news-unread-badge:not([hidden])) { box-shadow: inset 4px 0 0 var(--nov-c), var(--sh-card); }
.nov-item:has(.up-news-unread-badge:not([hidden])):hover { box-shadow: inset 4px 0 0 var(--nov-c), var(--sh-hover); }
.nov-sum {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 20px; gap: 16px; align-items: center;
  padding: 16px 20px; cursor: pointer; list-style: none;
}
.nov-sum::-webkit-details-marker { display: none; }
.nov-sum::marker { content: ""; }
.nov-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 56px; height: 58px; border-radius: var(--r-sm); background: var(--nov-s); color: var(--nov-c);
}
.nov-date strong { font: 800 1.35rem/1 var(--font-display); letter-spacing: -.02em; }
.nov-date span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
.nov-head { min-width: 0; }
.nov-head h3 { font-size: 1.05rem; line-height: 1.3; transition: color .2s ease; overflow-wrap: anywhere; }
.nov-sum:hover h3 { color: var(--accent); }
.nov-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.nov-tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); border: 1px solid currentColor; background: var(--surface);
  font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--nov-c);
}
.nov-tag .i { width: 12px; height: 12px; }
.nov-unread-badge > i { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.nov-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s ease, color .2s ease; }
.nov-item[open] .nov-chev { transform: rotate(180deg); color: var(--ink); }

.nov-body { padding: 0 20px 18px 92px; }
.nov-text { padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--text); max-width: 72ch; }
.nov-text > * + * { margin-top: 10px; }
.nov-text p { line-height: 1.7; }
.nov-text ul, .nov-text ol { display: grid; gap: 6px; padding-left: 0; list-style: none; }
.nov-text ol { list-style: decimal; padding-left: 20px; }
.nov-text ul li { position: relative; padding-left: 20px; line-height: 1.6; }
.nov-text ul li::before { content: ""; position: absolute; left: 4px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--nov-c); }
.nov-text a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.nov-text a:hover { color: var(--accent-ink); }
.nov-text strong, .nov-text b { color: var(--ink); }
.nov-text img { border-radius: var(--r-sm); }
.nov-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.nov-mark:disabled { background: var(--green-soft); color: var(--green); cursor: default; }

/* vazio e fim da lista */
.nov-empty { margin-top: 22px; padding: 34px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.nov-empty h2 { font-size: 1.15rem; margin-top: 6px; }
.nov-empty p { max-width: 48ch; font-size: var(--fs-sm); }
.nov-empty .btn { margin-top: 8px; }
.nov-end { display: flex; align-items: center; gap: 14px; margin-top: 26px; font-size: var(--fs-xs); color: var(--muted); }
.nov-end span { flex: 1; height: 1px; background: var(--line); }
.nov-end p { text-align: center; }

/* aviso de "marcado como lido", com o Desfazer */
.nov-toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 320; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 10px 10px 10px 16px; border-radius: var(--r-pill); background: var(--ink); color: var(--surface);
  font-size: var(--fs-sm); box-shadow: var(--sh-pop);
}
.nov-toast .i { width: 16px; height: 16px; color: var(--green-soft); }
.nov-toast button { padding: 6px 12px; border: 0; border-radius: var(--r-pill); background: var(--nav-hover); color: var(--surface); font-weight: 600; cursor: pointer; transition: background .2s ease; }
.nov-toast button:hover { background: var(--accent); }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .ui2-novidades .band > .wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "crumbs" "title" "lead" "chips"; }
  .ui2-novidades .band .chips { justify-content: flex-start; margin-top: 12px; }
  .nov-layout { grid-template-columns: 236px minmax(0, 1fr); gap: 18px 22px; }
}
@media (max-width: 980px) {
  /* uma coluna: o arquivo vira uma linha de pilulas em cima, os cartoes descem */
  .nov-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "years" "feed" "notes"; grid-template-rows: auto; }
  .nov-years { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 14px; }
  .nov-side-hd { padding: 0; }
  .nov-side-hd .i { display: none; }
  .nov-years-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
  .nov-year { width: auto; padding: 6px 8px 6px 12px; border-radius: var(--r-pill); border-color: var(--line); }
  .nov-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ui2-novidades .band { padding: 14px 0 16px; }
  .ui2-novidades .band .crumbs { margin-bottom: 6px; }
  .ui2-novidades .band-lead { font-size: var(--fs-sm); line-height: 1.5; }
  .ui2-novidades .band .chips { gap: 5px 4px; margin-top: 10px; }
  .ui2-novidades .band .chip { padding: 4px 9px; font-size: 11px; gap: 5px; }
  .ui2-novidades .band .chip .i { width: 12px; height: 12px; }
  .nov-sec { padding-top: 14px; }
  .nov-long { display: none; }
  .nov-short { display: inline; }
  .nov-notes { grid-template-columns: minmax(0, 1fr); }
  .nov-topics { padding: 12px 12px 0; gap: 6px; }
  .nov-topics > button { padding: 6px 11px; font-size: var(--fs-xs); gap: 6px; }
  .nov-tools { padding: 12px; gap: 10px 14px; }
  .nov-search { flex-basis: 100%; }
  .nov-expand { margin-left: auto; }
  .nov-bar-meta { padding: 10px 12px; }
  .nov-save { margin-left: 0; flex-basis: 100%; }
  .nov-entries { margin-top: 16px; gap: 20px; }
  .nov-sum { grid-template-columns: 46px minmax(0, 1fr) 18px; gap: 12px; padding: 14px; }
  .nov-date { width: 46px; height: 50px; }
  .nov-date strong { font-size: 1.15rem; }
  .nov-date span { font-size: 10px; }
  .nov-head h3 { font-size: .98rem; }
  .nov-body { padding: 0 14px 16px; }
  .nov-acts .btn { flex: 1 1 auto; }
  .nov-toast { bottom: 64px; }
}
@media (max-width: 360px) {
  .nov-topics > button { padding: 5px 9px; }
  .nov-unread { font-size: var(--fs-xs); }
}
