/* M190-10: quản lý tin tức trên /tin-tuc (chỉ hiện với tài khoản Mod trở lên – tt-sua.js thêm vào trang). Dùng biến màu của tp.css. */
.tt-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: 16px; background: linear-gradient(110deg, rgba(47, 102, 245, .08), rgba(18, 181, 160, .08)); box-shadow: inset 0 0 0 1px rgba(47, 102, 245, .25); }
.tt-bar-txt { display: grid; gap: 2px; min-width: 0; }
.tt-bar-txt b { font: 700 18px/1.3 var(--font-title); font-stretch: 106%; color: var(--ink); }
.tt-bar-txt span { color: var(--ink-2); font-size: 14px; }
.tt-bar .btn { flex: none; min-height: 46px; padding: 0 22px; }
.tt-bar .btn:disabled { opacity: .6; cursor: progress; } /* M413-01: chờ tải danh sách chuyên mục */
.tt-err { color: var(--red); }

.tt-drafts { padding: 16px 18px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.tt-drafts ul { display: grid; margin: 10px 0 0; padding: 0; list-style: none; }
.tt-drafts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tt-drafts li > div { display: grid; gap: 2px; min-width: 0; }
.tt-drafts a { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.tt-drafts a:hover { color: var(--azure-2); }
.tt-meta, .tt-note { color: var(--muted); font-size: 13px; }
.tt-h { font: 700 20px/1.3 var(--font-title); font-stretch: 106%; color: var(--ink); }

.tt-btn { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1.5px solid rgba(47, 102, 245, .35); border-radius: 9px; background: #fff; color: var(--azure-2); cursor: pointer; font: 600 14px/1 var(--font-title); font-stretch: 104%; }
.tt-btn:hover, .tt-btn:focus-visible { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(47, 102, 245, .12); }
.tt-btn.is-del { border-color: rgba(229, 72, 61, .4); color: #c2352b; }
.tt-btn.is-del:hover, .tt-btn.is-del:focus-visible { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229, 72, 61, .12); }
.tt-btn[disabled] { opacity: .6; cursor: default; }
.tt-btn[hidden] { display: none; }
.tt-acts-inline { display: flex; flex: none; gap: 8px; }

/* nút Sửa / Xoá nằm trên góc phải thẻ tin */
.nl-item.tt-has { position: relative; }
.tt-acts { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .92); box-shadow: 0 6px 16px -8px rgba(19, 35, 63, .4); }

.tt-art-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.tt-art-acts[hidden] { display: none; }
.tt-badge { padding: 5px 10px; border-radius: 999px; background: rgba(233, 169, 58, .16); color: #8a5a00; font-size: 13px; font-weight: 600; }

/* hộp thoại viết / sửa / xoá */
.tt-dlg { width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(19, 35, 63, .45); }
.tt-dlg.is-sm { width: min(460px, calc(100vw - 24px)); }
.tt-dlg::backdrop { background: rgba(10, 22, 48, .45); }
.tt-dlg-in { display: grid; gap: 14px; padding: 22px; }
.tt-row2 { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; align-items: start; }
.tt-field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.tt-field > span { font-weight: 600; font-size: 14px; color: var(--ink); }
.tt-field small { color: var(--muted); font-size: 12.5px; }
.tt-field input, .tt-field select, .tt-field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: 400 15px/1.5 var(--font-body); }
.tt-field textarea { resize: vertical; }
.tt-field input:focus, .tt-field select:focus, .tt-field textarea:focus { outline: 0; border-color: var(--azure); box-shadow: 0 0 0 4px rgba(47, 102, 245, .12); }
.tt-img { width: 100%; max-width: 300px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.tt-img[hidden] { display: none; }
.tt-imgrow { display: flex; gap: 8px; }
.tt-imgmsg.is-err, .tt-msg.is-err { color: var(--red); }
.tt-chk { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; }
.tt-chk input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--azure); }
.tt-msg { min-height: 1.4em; margin: 0; font-size: 14px; color: var(--ink-2); }
.tt-dlg-acts { position: sticky; bottom: 0; z-index: 1; display: flex; justify-content: flex-end; gap: 10px; margin: 0 -22px -22px; padding: 12px 22px 16px; border-top: 1px solid var(--line); background: var(--surface); } /* luôn thấy nút Lưu khi khung dài */
.tt-dlg-acts .btn { min-height: 46px; padding: 0 22px; }
.tt-danger { background: var(--red); box-shadow: 0 10px 24px -12px rgba(229, 72, 61, .8); }
.tt-danger:hover, .tt-danger:focus-visible { background: #c2352b; box-shadow: 0 0 0 4px rgba(229, 72, 61, .18); }

/* M190-12: khung soạn có định dạng + emoji */
.tt-inp-row { display: flex; align-items: stretch; gap: 8px; }
.tt-inp-row > input, .tt-inp-row > textarea { flex: 1; min-width: 0; }
.tt-field > label { font-weight: 600; font-size: 14px; color: var(--ink); }
.tt-rte { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.tt-rte:focus-within { border-color: var(--azure); box-shadow: 0 0 0 4px rgba(47, 102, 245, .12); }
.tt-rte-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; background: var(--bg); }
.tt-tb { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer;
  font: 600 15px/1 var(--font-body), "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.tt-tb:hover, .tt-tb:focus-visible { border-color: var(--line); background: #fff; color: var(--azure-2); }
.tt-tb.is-b { font-weight: 800; } .tt-tb.is-i { font-style: italic; font-family: Georgia, serif; } .tt-tb.is-u { text-decoration: underline; } .tt-tb.is-s { text-decoration: line-through; }
.tt-tb.is-col { color: #d93a2f; text-decoration: underline 3px #d93a2f; text-underline-offset: 3px; }
.tt-tb.is-mark { color: #e0b100; font-size: 17px; }
.tt-inp-row .tt-tb { height: auto; min-height: 44px; border-color: var(--line); background: #fff; font-size: 18px; }
.tt-tb-sep { width: 1px; height: 22px; margin: 0 3px; background: var(--line); }
.tt-field .tt-tb-sel { width: auto; min-height: 34px; padding: 0 6px; font: 500 14px/1 var(--font-body); } /* thắng quy tắc ô nhập rộng 100 % của .tt-field */
.tt-tb-sel { height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 500 14px/1 var(--font-body); }
.tt-tb-wrap { position: relative; display: inline-flex; }
.tt-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; padding: 10px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 18px 40px -16px rgba(19, 35, 63, .45); }
.tt-pop[hidden] { display: none; }
.tt-inp-row .tt-pop { left: auto; right: 0; }
.tt-rte-bar .tt-tb-wrap { position: static; } /* bảng màu / liên kết / emoji neo theo thanh công cụ → không tràn mép phải */
.tt-rte-bar .tt-pop { left: 6px; top: calc(100% + 4px); }
.tt-colors { display: flex; flex-wrap: wrap; gap: 6px; width: 212px; }
.tt-sw { width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.tt-sw:hover, .tt-sw:focus-visible { box-shadow: 0 0 0 2px var(--azure); }
.tt-sw-def { flex-basis: 100%; min-height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); cursor: pointer; font: 500 13px/1 var(--font-body); }
.tt-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: min(340px, 78vw); }
.tt-link input { min-height: 38px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 8px; font: 400 14px/1.4 var(--font-body); }
.tt-link small { grid-column: 1 / -1; }
.tt-emo { width: min(332px, 82vw); }
.tt-emo-tabs { display: flex; gap: 4px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tt-emo-tabs button, .tt-emo-grid button { display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font: 22px/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.tt-emo-tabs button { width: 40px; height: 34px; }
.tt-emo-tabs button[aria-pressed="true"] { background: rgba(47, 102, 245, .12); }
.tt-emo-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 210px; overflow-y: auto; }
.tt-emo-grid button { aspect-ratio: 1; }
.tt-emo-tabs button:hover, .tt-emo-grid button:hover, .tt-emo-grid button:focus-visible { background: var(--bg-2); }
.tt-rte-ed { display: grid; align-content: start; gap: 12px; min-height: 240px; max-height: 52vh; overflow-y: auto; padding: 14px 16px; color: var(--ink-2); font-size: 16px; line-height: 1.7; outline: 0; }
.tt-rte-ed:empty::before { content: "Viết nội dung bài…"; color: var(--muted); }
.tt-rte-count { display: block; padding: 4px 10px 6px; color: var(--muted); font-size: 12px; text-align: right; }
.tt-rte-count.is-err { color: var(--red); }

/* M413-01: ảnh trong khung soạn – mỗi ảnh một khung nét đứt có thanh nút + ô chú thích; khung đang tải mờ + thanh %; khung lỗi viền đỏ */
.tt-rte { position: relative; }
.tt-rte.is-drag { border-color: var(--azure); box-shadow: 0 0 0 4px rgba(47, 102, 245, .12); }
.tt-tb.is-img { gap: 5px; font-size: 14px; white-space: nowrap; }
.tt-rte-ed .tt-fig { gap: 8px; margin: 0; padding: 8px; border: 1.5px dashed rgba(47, 102, 245, .35); border-radius: 12px; background: var(--bg); }
.tt-rte-ed .tt-fig:hover, .tt-rte-ed .tt-fig:focus-within { border-color: var(--azure); }
.tt-rte-ed .tt-fig.is-hint { border-color: var(--azure); box-shadow: 0 0 0 4px rgba(47, 102, 245, .18); }
.tt-rte-ed .tt-fig img { max-height: 44vh; cursor: grab; }
.tt-fig-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.tt-fig-bar button, .tt-fig-up button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); cursor: pointer; font: 600 12.5px/1 var(--font-body); white-space: nowrap; }
.tt-fig-bar button:hover, .tt-fig-bar button:focus-visible, .tt-fig-up button:hover, .tt-fig-up button:focus-visible { border-color: var(--azure); color: var(--azure-2); }
.tt-fig-bar button.is-del { color: #c2352b; }
.tt-fig-bar button.is-del:hover, .tt-fig-bar button.is-del:focus-visible { border-color: var(--red); color: #c2352b; }
.tt-rte .tt-fig-cap { width: min(100%, 520px); min-height: 34px; padding: 4px 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); font: 400 14px/1.4 var(--font-body); text-align: center; }
.tt-fig.is-up img, .tt-fig.is-err img { opacity: .45; }
.tt-fig-up { display: grid; justify-items: center; gap: 4px; width: 100%; color: var(--ink-2); font-size: 13.5px; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.tt-fig-up small { color: var(--muted); font-size: 12.5px; }
.tt-fig-up [hidden] { display: none; }
.tt-fig-prog { width: min(100%, 320px); height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.tt-fig-prog i { display: block; width: 0; height: 100%; border-radius: 99px; background: var(--azure); transition: width .15s; }
.tt-rte-ed .tt-fig.is-err { border-color: var(--red); background: rgba(229, 72, 61, .06); }
.tt-fig.is-err .tt-fig-st { color: #c2352b; font-weight: 600; }
.tt-drop-line { position: absolute; left: 12px; right: 12px; z-index: 3; height: 3px; border-radius: 3px; background: var(--azure); pointer-events: none; }
.tt-drop-line[hidden] { display: none; }
.tt-rte-note { display: block; padding: 4px 10px 0; color: var(--ink-2); font-size: 13px; }
.tt-rte-note:empty { display: none; }
.tt-rte-note.is-err { color: var(--red); }

@media (max-width: 640px) {
  .tt-bar { flex-direction: column; align-items: stretch; }
  .tt-row2 { grid-template-columns: minmax(0, 1fr); }
  .tt-dlg-in { padding: 18px 16px; }
  .tt-dlg-acts { margin: 0 -16px -18px; padding: 12px 16px 14px; }
  .tt-drafts li { flex-direction: column; align-items: flex-start; }
  .tt-dlg-acts .btn { flex: 1; padding: 0 12px; }
}
