/* Cập nhật phiên bản — biểu ngữ không chiếm chỗ + khối trong Cài đặt + hộp thoại. Chỉ dùng token của stc_theme (sáng + tối). */
#upd-banner { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 28px; background: var(--stc-surface-2); color: var(--stc-text); border-bottom: 1px solid var(--stc-border); font-size: 14px; }
#upd-banner[hidden] { display: none; }
#upd-banner .upd-msg { flex: 1 1 260px; min-width: 0; }
#upd-banner .upd-msg b { color: var(--stc-text-strong); font-weight: 600; }
#upd-banner.upd-ok { border-bottom-color: var(--stc-ok); }
#upd-banner.upd-old { background: var(--stc-err-solid); color: var(--stc-on-err-solid); border-bottom-color: var(--stc-err-solid); }
#upd-banner.upd-old .upd-msg b { color: var(--stc-on-err-solid); }
#upd-banner.upd-old .stc-btn2 { background: var(--stc-on-err-solid); color: var(--stc-err-solid); border-color: var(--stc-on-err-solid); font-weight: 600; }
#upd-banner.upd-old .stc-btn2.ghost { background: transparent; color: var(--stc-on-err-solid); border-color: var(--stc-on-err-solid); }
#upd-banner.upd-fail { border-bottom-color: var(--stc-warn); }

.upd-panel { font-size: 14px; line-height: 1.55; }
.upd-panel .upd-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: var(--stc-text-strong); }
.upd-panel .upd-meta { margin: 0 0 10px; color: var(--stc-muted); font-size: 13px; }
.upd-panel .upd-notes { margin: 8px 0 12px; padding: 10px 12px; background: var(--stc-input); border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; font-size: 13.5px; }
.upd-panel .upd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.upd-panel .upd-err { color: var(--stc-err); }
.upd-panel .upd-good { color: var(--stc-ok); }
.upd-panel .upd-warn { color: var(--stc-warn); }
.upd-panel .upd-list { margin: 6px 0 0; padding-left: 20px; }
.upd-panel .upd-bar { height: 8px; border-radius: 4px; background: var(--stc-input); border: 1px solid var(--stc-border); overflow: hidden; margin: 8px 0 4px; }
.upd-panel .upd-bar > i { display: block; height: 100%; background: var(--stc-accent); width: 0; }
.upd-panel .upd-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--stc-muted); font-size: 13.5px; }
.upd-clients { margin-top: 14px; font-size: 13.5px; }
.upd-clients table { border-collapse: collapse; width: 100%; }
.upd-clients th, .upd-clients td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--stc-border); }
.upd-clients th { color: var(--stc-muted); font-weight: 600; }
.upd-clients .upd-tag { color: var(--stc-warn); }
@media (prefers-reduced-motion: no-preference) { .upd-panel .upd-bar > i { transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1); } }

/* ---- Nút Cập nhật ở đầu thanh bên (#stc-upd-btn): chỉ báo + mở hộp thoại cập nhật. Mờ khi không có gì; chấm đỏ khi có bản mới;
   nhấn mạnh khi dưới bản tối thiểu; vòng tiến độ khi đang tải. Chú thích hiện khi di chuột HOẶC tiêu điểm bàn phím, Esc để ẩn. ---- */
.stc-side-brand { position: relative; }
.sidebar .stc-side-brand { gap: 8px; padding-right: 12px; }      /* chừa chỗ cho nút ở thanh bên 216 px (cửa sổ <= 1100 px) */
.stc-upd-btn { position: relative; flex-shrink: 0; margin-left: auto; width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0;
  border: 1px solid transparent; border-radius: var(--stc-r-card); background: transparent; color: var(--stc-muted); cursor: pointer; }
.stc-upd-btn[hidden] { display: none; }
.stc-upd-btn > svg { grid-area: 1 / 1; }
.stc-upd-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stc-upd-ring { width: 30px; height: 30px; transform: rotate(-90deg); display: none; }
.stc-upd-ring .arc { fill: none; stroke: var(--stc-accent); stroke-width: 2.4; stroke-linecap: round; transition: stroke-dasharray 0.4s var(--stc-ease, ease-out); }
html[data-theme="light"] .stc-upd-ring .arc { stroke: var(--stc-accent-text); }
.stc-upd-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--stc-err); box-shadow: 0 0 0 2px var(--stc-side); display: none; }
.stc-upd-btn:hover { color: var(--stc-text-strong); background: var(--stc-accent-soft); }
.stc-upd-btn:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 1px; }
html[data-theme="light"] .stc-upd-btn:focus-visible { outline-color: var(--stc-accent-text); }
.stc-upd-btn[data-upd-state="idle"] { color: var(--stc-dim); }
.stc-upd-btn[data-upd-state="new"] { color: var(--stc-text-strong); }
.stc-upd-btn[data-upd-state="new"] .stc-upd-dot, .stc-upd-btn[data-upd-state="urgent"] .stc-upd-dot { display: block; }
.stc-upd-btn[data-upd-state="urgent"] { color: var(--stc-err-text); border-color: var(--stc-err); background: var(--stc-err-soft); }
.stc-upd-btn[data-upd-state="progress"], .stc-upd-btn[data-upd-state="busy"] { color: var(--stc-accent-text); }
.stc-upd-btn[data-upd-state="progress"] .stc-upd-ring { display: block; }
.stc-upd-btn[data-upd-state="progress"] .stc-upd-ico { width: 14px; height: 14px; }
.stc-upd-btn[data-upd-state="busy"] .stc-upd-ico { opacity: 0.85; }

.stc-upd-tip { position: absolute; z-index: 60; top: calc(100% - 2px); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-surface); color: var(--stc-text);
  box-shadow: var(--stc-shadow); font-size: 12.5px; line-height: 1.45; visibility: hidden; opacity: 0; pointer-events: none; }
.stc-upd-tip b { color: var(--stc-text-strong); font-weight: 600; }
.stc-upd-tip span { overflow-wrap: anywhere; }
/* Chú thích là <span> nằm TRONG hàng logo nên dính luật tên thương hiệu `.stc-side-brand span` (17-19 px, đậm, nowrap; ẩn ở 64 px):
   chữ không xuống dòng, tràn khỏi khung (hàng logo scrollWidth 511 px ở thanh bên 216 px). Chặn kế thừa đó bằng độ ưu tiên cao hơn. */
.stc-side-brand .stc-upd-tip { display: flex; font-size: 12.5px; font-weight: 400; letter-spacing: 0; white-space: normal; }
.stc-side-brand .stc-upd-tip span { display: block; font-size: inherit; font-weight: inherit; letter-spacing: inherit; white-space: normal; color: var(--stc-text); }
.stc-upd-btn:not([hidden]):hover:not(.tip-off) + .stc-upd-tip, .stc-upd-btn:not([hidden]):focus-visible:not(.tip-off) + .stc-upd-tip { visibility: visible; opacity: 1; }
@media (max-width: 900px) {
  .stc-side-brand, .sidebar .stc-side-brand { flex-direction: column; gap: 6px; padding-right: 0; }
  .stc-upd-btn { margin-left: 0; }
  .stc-upd-tip { top: 8px; left: calc(100% + 6px); right: auto; width: 240px; }
}
@media (prefers-reduced-motion: reduce) { .stc-upd-ring .arc { transition: none; } }
