/* =====================================================================
   Phong cách: Atlantis admin dashboard + điều khiển Windows 11 (WinUI 3)
   - Atlantis: thanh trên xanh #1572E8, ô logo xanh đậm, menu trái trắng (mục chọn = khối xanh có bóng),
     dải gradient xanh phía sau trình phát, thẻ trắng bóng mềm, nút viên thuốc, nhãn trạng thái màu đặc
   - WinUI: phông Segoe UI Variable, ToggleSwitch, Slider, viền sáng khi focus, cấu trúc ContentDialog, toast Acrylic
   - Chủ đề Sáng (mặc định) / Tối: <html data-theme="light|dark"> (index.html + app.js)
   ===================================================================== */
:root {
  /* ---- Tối (Atlantis dark) ---- */
  --mica: #1a2035;
  --bg: #1a2035;
  --stage: #1a2035;
  --hero: linear-gradient(180deg, #1e3a6e 0%, #1c2b4c 38%, #1a2035 72%);
  --hero-size: 100% 100%;
  --topbar: #1f283e;
  --brand-bg: transparent;
  --panel: #1f283e;
  --panel-2: #202940;
  --panel-3: #283350;
  --card: #202940;
  --card-hover: #243050;
  --dialog: #202940;
  --dialog-foot: #1a2035;
  --acrylic: rgba(32, 41, 64, .94);
  --smoke: rgba(10, 14, 26, .6);
  --ctl: #1a2035;
  --ctl-hover: #1d2540;
  --ctl-press: #171d30;
  --ctl-input: #1a2035;
  --ctl-stroke: #2f374b;
  --ctl-stroke-top: #2f374b;
  --ctl-stroke-bottom: #2f374b;
  --ctl-strong: #4a5470;
  --subtle-hover: rgba(255, 255, 255, .05);
  --subtle-press: rgba(255, 255, 255, .03);
  --thumb-ring: #2b3552;
  --knob: rgba(255, 255, 255, .75);
  --line: #2f374b;
  --line-2: #3a4560;
  --dash: #46516d;
  --surface-stroke: #2f374b;
  --heading: #ffffff;
  --text: #e1e4ee;
  --muted: #9aa1b5;
  --disabled: rgba(255, 255, 255, .35);
  --accent: #3d8ff5;
  --accent-hover: #2d82ee;
  --accent-press: #1572e8;
  --accent-text: #ffffff;
  --accent-soft: rgba(61, 143, 245, .16);
  --accent-glow: rgba(21, 114, 232, .45);
  --accent-stroke-top: transparent;
  --accent-stroke-bottom: transparent;
  --secondary: #6861ce;
  --secondary-hover: #5c55bf;
  --video: #1572e8;
  --textc: #e8922a;
  --voice: #2bb930;
  --music: #6861ce;
  --ok: #31ce36;
  --ok-soft: #1f3a2c;
  --warn: #ffad46;
  --warn-soft: #3d3424;
  --err: #f25961;
  --err-soft: #3d2430;
  --err-text: #ffb3b8;
  --playhead: #ffffff;
  --tick: rgba(255, 255, 255, .22);
  --tick-major: rgba(255, 255, 255, .42);
  --scroll: rgba(255, 255, 255, .22);
  --scroll-hover: rgba(255, 255, 255, .4);
  --focus: #ffffff;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23ffffff' stroke-opacity='.79' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chevron-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23ffffff' stroke-opacity='.79' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow-card: 0 4px 16px rgba(0, 0, 0, .28);
  --shadow-flyout: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-dialog: 0 24px 60px rgba(0, 0, 0, .5);
  --shadow-side: 4px 0 14px rgba(0, 0, 0, .25);
  --font: "Huninn", "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Lato, system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-display: "Huninn", "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", Lato, system-ui, sans-serif;
  --radius: 8px;
  --radius-ctl: 6px;
  --tl-head: 52px;   /* chỉ biểu tượng + nút ⊞/⊟ (tên track ở title) */
  --track-h: 24px;   /* gọn (người dùng chốt 2026-12-06) */
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* ---- Sáng (Atlantis) ---- */
  --mica: #f9fbfd;
  --bg: #f9fbfd;
  --stage: #f9fbfd;
  --hero: linear-gradient(-45deg, #06418e, #1572e8);
  --hero-size: 100% 42%;
  --topbar: #1572e8;
  --brand-bg: transparent;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --panel-3: #f1f3f8;
  --card: #ffffff;
  --card-hover: #fbfcfe;
  --dialog: #ffffff;
  --dialog-foot: #f9fbfd;
  --acrylic: rgba(255, 255, 255, .94);
  --smoke: rgba(26, 32, 53, .35);
  --ctl: #ffffff;
  --ctl-hover: #f7f9fc;
  --ctl-press: #eef2f8;
  --ctl-input: #ffffff;
  --ctl-stroke: #ebedf2;
  --ctl-stroke-top: #ebedf2;
  --ctl-stroke-bottom: #ebedf2;
  --ctl-strong: #c4cad8;
  --subtle-hover: rgba(21, 114, 232, .06);
  --subtle-press: rgba(21, 114, 232, .1);
  --thumb-ring: #ffffff;
  --knob: #8d9498;
  --line: #ebedf2;
  --line-2: #dfe3ec;
  --dash: #cdd4e2;
  --surface-stroke: #ebedf2;
  --heading: #2a2f5b;
  --text: #3e4256;
  --muted: #7f8597;
  --disabled: rgba(0, 0, 0, .3);
  --accent: #1572e8;
  --accent-hover: #1269db;
  --accent-press: #0f5bc4;
  --accent-text: #ffffff;
  --accent-soft: rgba(21, 114, 232, .1);
  --accent-glow: rgba(21, 114, 232, .35);
  --secondary: #6861ce;
  --secondary-hover: #5c55bf;
  --ok: #2bb930;
  --ok-soft: #e7f8e8;
  --warn: #f29b1d;
  --warn-soft: #fff5e6;
  --err: #f25961;
  --err-soft: #fdecee;
  --err-text: #b3202a;
  --playhead: #1a2035;
  --tick: rgba(0, 0, 0, .2);
  --tick-major: rgba(0, 0, 0, .4);
  --scroll: rgba(0, 0, 0, .18);
  --scroll-hover: rgba(0, 0, 0, .32);
  --focus: #1572e8;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23000000' stroke-opacity='.6' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow-card: 2px 6px 15px rgba(69, 65, 78, .1);
  --shadow-flyout: 0 8px 24px rgba(69, 65, 78, .16);
  --shadow-dialog: 0 24px 60px rgba(26, 32, 53, .22);
  --shadow-side: 4px 4px 10px rgba(69, 65, 78, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--mica) fixed, var(--bg); color: var(--text);
  font: 13px/1.45 var(--font);
  --rail-w: 68px;
  display: grid; grid-template-rows: 48px minmax(0, 1fr) var(--tl-h, 290px); grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-width: 1000px; overflow: hidden;
}
.hidden { display: none !important; }
.row { display: flex; align-items: center; }
.gap-xs { gap: 4px; }
.gap-s { gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
svg { flex: none; }
code, kbd { font: 11px "Cascadia Mono", Consolas, ui-monospace, monospace; background: var(--ctl); border: 1px solid var(--ctl-stroke); border-radius: 4px; padding: 0 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
::selection { background: var(--accent); color: var(--accent-text); }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-ctl);
  border: 1px solid var(--ctl-stroke); border-top-color: var(--ctl-stroke-top); border-bottom-color: var(--ctl-stroke-bottom);
  background: var(--ctl); color: var(--text); font: inherit; font-weight: 400;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .08s;
}
.btn:hover { background: var(--ctl-hover); }
.btn:active { background: var(--ctl-press); color: var(--muted); border-bottom-color: var(--ctl-stroke); }
.btn.primary {
  background: var(--accent); color: var(--accent-text); font-weight: 600;
  border-color: var(--accent-stroke-top); border-bottom-color: var(--accent-stroke-bottom);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); color: var(--accent-text); opacity: .9; }
.btn.ghost { background: var(--ctl); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.full { width: 100%; }
.btn.grow { flex: 1; }
.btn.danger:hover { color: var(--err); }
.btn:disabled { background: var(--ctl-press); color: var(--disabled); cursor: progress; }
.btn.primary:disabled { background: var(--disabled); color: var(--accent-text); border-color: transparent; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.tool.icon { width: 32px; padding: 0; justify-content: center; }
.tool svg { width: 16px; height: 16px; }
.tool:hover:not(:disabled) { background: var(--subtle-hover); }
.tool:active:not(:disabled) { background: var(--subtle-press); color: var(--muted); }
.tool:disabled { opacity: .35; cursor: default; }
.tool.play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-text); }
.tool.play:hover:not(:disabled) { background: var(--accent-hover); }
.tool.play:active:not(:disabled) { background: var(--accent-press); color: var(--accent-text); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px;
  border-radius: var(--radius-ctl); cursor: pointer; font-size: 13px;
}
.icon-btn:hover { background: var(--subtle-hover); color: var(--text); }
.icon-btn:active { background: var(--subtle-press); }

/* ---------- Trường nhập ---------- */
.input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--ctl);
  border: 1px solid var(--line-2); border-radius: var(--radius-ctl);
  padding: 6px 10px; outline: none; min-height: 32px; transition: border-color .12s, box-shadow .12s, background .12s;
}
.input:hover, select:hover, textarea:hover { background: var(--ctl-hover); border-color: var(--ctl-strong); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 30px;
  background: var(--chevron) right 10px center / 12px no-repeat, var(--ctl);
}
select:hover { background: var(--chevron) right 10px center / 12px no-repeat, var(--ctl-hover); }
select option { background: var(--dialog); color: var(--text); }
textarea { resize: vertical; }
/* focus: cả viền sáng lên màu nhấn + quầng sáng nhẹ (không dùng gạch chân) */
.input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:focus, textarea:focus { background: var(--ctl-input); }
.input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.field { display: grid; gap: 5px; margin: 0 0 12px; }
.field > span { color: var(--text); font-size: 12px; display: flex; justify-content: space-between; }
.field output { color: var(--text); }
input[type=range] {
  width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; accent-color: var(--accent);
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent)) 0 0 / var(--fill, 0%) 100% no-repeat, var(--ctl-strong);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%;
  background: var(--accent); border: 1px solid var(--ctl-stroke); box-shadow: inset 0 0 0 5px var(--thumb-ring);
  transition: box-shadow .1s;
}
input[type=range]:hover::-webkit-slider-thumb { box-shadow: inset 0 0 0 4px var(--thumb-ring); }
input[type=range]:active::-webkit-slider-thumb { box-shadow: inset 0 0 0 6px var(--thumb-ring); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--ctl-strong); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  border: 1px solid var(--ctl-stroke); box-shadow: inset 0 0 0 5px var(--thumb-ring);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 12px; }
.pane-row { display: flex; gap: 6px; margin: 0 0 10px; }

/* ---------- Thanh trên ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px;
  background: transparent; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 400; color: var(--text); margin-right: 8px; }
.brand svg { color: var(--accent); }
.project-title {
  width: 260px; height: 32px; background: transparent; border: 1px solid transparent; color: var(--text);
  font: inherit; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-ctl); text-align: center; outline: none;
}
.project-title:hover { background: var(--ctl); border-color: var(--ctl-stroke); }
.project-title:focus {
  background: var(--ctl-input); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.save-state { color: var(--muted); font-size: 12px; min-width: 70px; }
.queue-meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.queue-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* ---------- Không gian làm việc ---------- */
.workspace {
  --drawer-w: 300px; --insp-w: 300px;
  display: grid; grid-template-columns: var(--drawer-w) minmax(360px, 1fr) var(--insp-w); min-height: 0;
  position: relative;
}
/* thanh kéo để đổi độ rộng ngăn nội dung (mỗi mục menu nhớ độ rộng riêng) */
.drawer-resizer, .insp-resizer, .rail-resizer {
  position: absolute; top: 0; bottom: 0; left: calc(var(--drawer-w) - 3px); width: 7px;
  cursor: col-resize; z-index: 5; touch-action: none;
}
.insp-resizer { left: auto; right: calc(var(--insp-w) - 4px); }
.rail-resizer { left: auto; right: 0; width: 6px; }
.drawer-resizer::after, .insp-resizer::after, .rail-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent; transition: background .15s;
}
.drawer-resizer:hover::after, .drawer-resizer.dragging::after,
.insp-resizer:hover::after, .insp-resizer.dragging::after,
.rail-resizer:hover::after, .rail-resizer.dragging::after { background: var(--accent); width: 2px; left: 2px; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing video, body.resizing iframe { pointer-events: none; }
.rail {
  background: transparent;
  display: flex; flex-direction: column; gap: 4px; padding: 6px 4px;
}
.rail-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px; border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--text);
  font: 11px/1.2 var(--font); cursor: pointer;
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { background: var(--subtle-hover); }
.rail-btn:active { background: var(--subtle-press); color: var(--muted); }
.rail-btn.on { background: var(--subtle-hover); }
.rail-btn.on::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; margin-top: -8px;
  border-radius: 2px; background: var(--accent);
}
.badge-n {
  position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--ctl-strong); color: var(--bg); font: 600 10px/16px var(--font); font-style: normal;
}
.badge-n:empty { display: none; }
.badge-n.live { background: var(--accent); color: var(--accent-text); }

.drawer {
  background: var(--panel); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-top-left-radius: var(--radius);
  overflow-y: auto; overflow-x: hidden; padding: 16px;
}
.drawer h2, .inspector h2 { font: 600 20px/28px var(--font-display); margin: 0 0 14px; }
.drawer h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 22px 0 10px; }
.drawer .btn.full { margin-bottom: 8px; }

/* Phương tiện */
.dropzone {
  display: grid; justify-items: center; gap: 2px; padding: 16px 10px; margin-bottom: 10px;
  border: 1px dashed var(--dash); border-radius: var(--radius); background: var(--card);
  text-align: center; cursor: pointer; color: var(--muted);
}
.dropzone strong { color: var(--text); }
.dropzone span { font-size: 11px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent); }
.dropzone.busy { opacity: .6; pointer-events: none; }
#library-tags { margin-bottom: 8px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.media-item {
  position: relative; border-radius: var(--radius-ctl); overflow: hidden; background: var(--card);
  border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--ctl-stroke);
}
.media-item:hover { border-color: var(--line-2); }
.media-item.used::after {
  content: "Đang dùng"; position: absolute; left: 4px; top: 4px; font-size: 10px; padding: 1px 5px;
  border-radius: 4px; background: rgba(0, 0, 0, .65); color: var(--accent);
}
.media-item.current { border-color: var(--accent); }
.media-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; pointer-events: none; }
.media-item .add, .media-item .del {
  position: absolute; top: 4px; width: 22px; height: 22px; border: 0; border-radius: var(--radius-ctl); cursor: pointer;
  display: none; align-items: center; justify-content: center; font-size: 12px;
}
.media-item .add { right: 4px; background: var(--accent); color: var(--accent-text); }
.media-item .add svg { width: 14px; height: 14px; }
.media-item .del { right: 30px; background: rgba(0, 0, 0, .7); color: #fff; }
.media-item:hover .add, .media-item:hover .del { display: flex; }
.media-item .tags {
  width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font: 11px var(--font); padding: 4px 6px; outline: none;
}
.media-item .tags:focus { color: var(--text); }

/* Văn bản */
.checks { display: grid; gap: 10px; margin-bottom: 6px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch i {
  width: 40px; height: 20px; border-radius: 10px; background: var(--ctl-press); border: 1px solid var(--ctl-strong);
  position: relative; flex: none; transition: background .12s, border-color .12s;
}
.switch i::after {
  content: ""; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; border-radius: 50%;
  background: var(--knob); transition: left .12s, width .1s, height .1s, top .1s;
}
.switch:hover i { background: var(--ctl-hover); }
.switch:hover i::after { width: 14px; height: 14px; top: 2px; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { left: 23px; background: var(--accent-text); }
.switch:hover input:checked + i::after { left: 21px; }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.sub-sample {
  height: 120px; border-radius: var(--radius); display: grid; place-items: end center; padding-bottom: 18px;
  background: linear-gradient(135deg, #2d3748, #1a202c);
}
.sub-sample span, .frame-sub span {
  font-weight: 800; color: #fff; text-align: center;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 2px 4px #000; -webkit-text-stroke: .6px #000;
}
.sub-sample span { font-size: 18px; }

/* Đã xuất */
.filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--ctl-stroke); background: var(--ctl); color: var(--text); border-radius: 16px;
  padding: 4px 12px; font: 12px var(--font); cursor: pointer;
}
.chip:hover { background: var(--ctl-hover); }
.chip.on { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.chip .n { margin-left: 5px; color: var(--accent); }
.chip.on .n { color: var(--accent-text); opacity: .8; }
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; align-items: start; }
.job {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 8px; min-width: 0; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
}
.job:hover { background: var(--card-hover); }
.job.viewing { border-color: var(--accent); }
.job .thumb {
  width: 64px; height: 86px; border-radius: var(--radius-ctl); background: #000; overflow: hidden; position: relative;
  display: grid; place-items: center; cursor: pointer;
}
.job .thumb.r169 { height: 40px; align-self: start; }
.job .thumb.r11 { height: 64px; align-self: start; }
.job .thumb video { width: 100%; height: 100%; object-fit: cover; }
.job .thumb .play { position: absolute; color: #fff; font-size: 14px; text-shadow: 0 1px 3px #000; }
.job .thumb .err-icon { color: var(--err); font-weight: 800; font-size: 20px; }
.job .thumb .pct { font-size: 12px; font-weight: 650; color: #fff; }
.job-body { min-width: 0; display: grid; gap: 3px; align-content: start; }
.job-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 11px; color: var(--muted); }
.badge { padding: 0 6px; border-radius: var(--radius-ctl); font-size: 11px; font-weight: 600; background: var(--ctl); border: 1px solid var(--ctl-stroke); }
.badge.done { color: var(--ok); }
.badge.failed { color: var(--err); }
.badge.running, .badge.queued { color: var(--warn); }
.job-step { font-size: 11px; color: var(--muted); }
.job-err { font-size: 11px; color: var(--err); word-break: break-word; }
.bar { height: 3px; border-radius: 2px; background: var(--ctl-strong); overflow: hidden; margin: 2px 0; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width .4s; }
.job-actions { grid-column: 1 / -1; display: flex; gap: 4px; align-items: center; }
.job-actions:empty { display: none; }
.job-actions .btn.small { flex: 1 1 0; min-width: 0; padding: 0 6px; justify-content: center; }
.job-actions .del { flex: none; }
.job-step:empty, .job-err:empty { display: none; }

/* ---------- Trình phát ---------- */
.stage { display: grid; grid-template-rows: 44px minmax(0, 1fr) 56px; min-width: 0; background: var(--stage); }
.stage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.stage-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-select { width: auto; min-height: 30px; padding: 4px 28px 4px 10px; font-size: 12px; background-position: right 8px center, 0 0; }
.seg { display: inline-flex; gap: 2px; background: var(--ctl); border: 1px solid var(--ctl-stroke); border-radius: var(--radius-ctl); padding: 2px; }
.seg button {
  position: relative; border: 0; background: transparent; color: var(--muted); padding: 3px 10px; border-radius: 3px;
  font: 12px var(--font); cursor: pointer;
}
.seg button:hover { background: var(--subtle-hover); color: var(--text); }
.seg button.on { background: var(--ctl-hover); color: var(--text); font-weight: 600; }
.seg button.on::after {
  content: ""; position: absolute; left: 50%; bottom: 1px; width: 12px; height: 3px; margin-left: -6px;
  border-radius: 2px; background: var(--accent);
}
.viewport { container-type: size; display: grid; place-items: center; padding: 16px; min-height: 0; }
.frame {
  position: relative; overflow: hidden; background: #000; border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-flyout); container-type: inline-size;
}
.frame.r916 { width: min(100cqw, 100cqh * 9 / 16); aspect-ratio: 9 / 16; }
.frame.r169 { width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; }
.frame.r11 { width: min(100cqw, 100cqh); aspect-ratio: 1; }
.frame:fullscreen { border-radius: 0; }
.frame-img {
  position: absolute; inset: 0; background: center / cover no-repeat;
  transform-origin: center; will-change: transform;
}
.frame-note {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12%;
  text-align: center; color: rgba(255, 255, 255, .55); font-size: max(11px, 3.6cqw);
}
.frame-sub {
  position: absolute; left: 6%; right: 6%; bottom: 14%; display: flex; justify-content: center;
}
.frame-sub span { font-size: max(12px, 6.4cqw); line-height: 1.2; }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.transport {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 14px;
  border-top: 1px solid var(--line);
}
.time { font: 12px "Cascadia Mono", Consolas, ui-monospace, monospace; color: var(--muted); }
.time b { color: var(--accent); font-weight: 600; }
.transport .right { justify-content: flex-end; }
.res { color: var(--muted); font-size: 11px; border: 1px solid var(--ctl-stroke); background: var(--ctl); border-radius: var(--radius-ctl); padding: 1px 6px; }

/* ---------- Thuộc tính ---------- */
.inspector { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; padding: 16px; min-width: 0; }
.insp-head { display: flex; justify-content: space-between; align-items: baseline; }
.insp-img {
  aspect-ratio: 16 / 10; border-radius: var(--radius); background: var(--card) center / cover no-repeat;
  margin-bottom: 8px; cursor: pointer; display: grid; place-items: center; color: var(--muted); font-size: 12px;
  border: 1px dashed transparent;
}
.insp-img.empty { border-color: var(--dash); }
.insp-img:hover { border-color: var(--accent); }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 14px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Timeline ---------- */
.timeline {
  display: grid; grid-template-rows: 40px minmax(0, 1fr); background: var(--panel);
  border-top: 1px solid var(--line); min-height: 0;
}
.tl-toolbar { display: flex; align-items: center; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tl-toolbar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.tl-toolbar input[type=range] { width: 140px; }
.tl-body { display: grid; grid-template-columns: var(--tl-head) 1fr; min-height: 0; }
.tl-heads { border-right: 1px solid var(--line); }
.tl-head {
  height: var(--track-h); margin-bottom: 3px; display: flex; align-items: center; gap: 6px;
  padding: 0 10px; color: var(--muted); font-size: 12px;
}
.tl-head svg { width: 14px; height: 14px; }
.tl-head.ruler-head { height: 22px; margin-bottom: 4px; }
.tl-head.h-video { height: 44px; }
.tl-head.h-voice { height: 28px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-inner { position: relative; min-width: 100%; height: 100%; }
.ruler {
  position: relative; height: 22px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none;
}
.ruler .tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--tick); }
.ruler .tick.major { height: 10px; background: var(--tick-major); }
.ruler .lbl { position: absolute; top: 2px; font: 10px "Cascadia Mono", Consolas, ui-monospace, monospace; color: var(--muted); transform: translateX(3px); }
.track { position: relative; height: var(--track-h); margin-bottom: 3px; }
.track.t-video { height: 44px; }
.track.t-voice { height: 28px; }
.clip {
  position: absolute; top: 0; bottom: 0; border-radius: var(--radius-ctl); overflow: hidden; cursor: pointer;
  border: 2px solid transparent; user-select: none; font-size: 11px; color: #fff;
}
.clip.sel { border-color: var(--playhead); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5) inset; }
.clip.dragging { opacity: .4; }
.clip.drop-on { border-color: var(--accent); }
.clip .cap {
  position: absolute; left: 0; right: 0; top: 0; padding: 2px 6px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; background: linear-gradient(rgba(0, 0, 0, .6), transparent);
}
.clip .cap b { margin-right: 6px; }
.c-video { background: var(--video) left center / auto 100% repeat-x; }
.c-video.ph { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .06) 0 8px, transparent 8px 16px); }
.c-video .dur {
  position: absolute; right: 4px; bottom: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .6);
  font: 10px "Cascadia Mono", Consolas, ui-monospace, monospace;
}
.c-text { background: var(--textc); border-color: transparent; }
.c-text .cap { position: static; background: none; line-height: 20px; padding: 0 8px; }
.c-text.sel { border-color: var(--playhead); }
.c-voice {
  background:
    repeating-linear-gradient(90deg, transparent 0 2px, rgba(0, 0, 0, .0) 2px 4px),
    var(--voice);
}
.c-voice .wave {
  position: absolute; inset: 13px 4px 2px; opacity: .85;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .85) 0 2px, transparent 2px 4px);
  -webkit-mask: var(--wave) center / 100% 100%; mask: var(--wave) center / 100% 100%;
}
.c-voice .cap { background: none; padding-top: 0; font-size: 10px; line-height: 12px; color: #fff; }
.c-music { background: var(--music); cursor: default; }
.c-music .cap { background: none; line-height: 20px; padding: 0 8px; color: #fff; }
.track-empty {
  position: absolute; inset: 0 12px 0 0; display: flex; align-items: center; padding: 0 12px;
  border: 1px dashed var(--dash); border-radius: var(--radius-ctl); color: var(--muted); font-size: 12px;
}
.track-empty.over { border-color: var(--accent); color: var(--accent); }
.add-clip {
  position: absolute; top: 0; bottom: 0; width: 40px; border-radius: var(--radius-ctl); border: 1px dashed var(--dash);
  background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.add-clip svg { width: 16px; height: 16px; }
.add-clip:hover { color: var(--accent); border-color: var(--accent); }
.drop-marker { position: absolute; top: 26px; height: 44px; width: 3px; margin-left: -1px; background: var(--accent); border-radius: 2px; pointer-events: none; z-index: 4; }
.playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 5; pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--playhead); }
.playhead i {
  position: absolute; top: 0; left: -6px; width: 12px; height: 14px; background: var(--playhead);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
}

/* ---------- Hộp thoại xuất ---------- */
dialog {
  border: 1px solid var(--surface-stroke); border-radius: var(--radius); padding: 0; background: var(--dialog); color: var(--text);
  width: min(720px, 94vw); box-shadow: var(--shadow-dialog); overflow: hidden;
}
dialog[open] { animation: dlg-in .2s cubic-bezier(.1, .9, .2, 1); }
@keyframes dlg-in { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: var(--smoke); }
.export { margin: 0; }
.series-hint { margin: 0 16px 8px; }
.series-list { list-style: none; margin: 0; padding: 0 16px 12px; display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.series-list button {
  width: 100%; text-align: left; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl); background: var(--card);
  color: inherit; font: inherit; cursor: pointer;
}
.series-list button:hover { background: var(--card-hover); }
.series-list button:active { background: var(--ctl-press); }
.series-list .n { opacity: .6; font-variant-numeric: tabular-nums; }
.series-list .meta { opacity: .6; font-size: 12px; white-space: nowrap; }
.export-head, .export-foot { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.export-head h3 { margin: 0; font: 600 20px/28px var(--font-display); }
.export-foot {
  justify-content: flex-end; gap: 8px; padding: 20px 24px; margin-top: 8px;
  background: var(--dialog-foot); border-top: 1px solid var(--line);
}
.export-foot .btn { min-width: 120px; }
.export-body { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 4px 24px 12px; }
.series-hint { margin: 0 24px 8px; }
.series-list { padding: 0 24px 12px; }
.export-preview {
  aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000 center / cover no-repeat; align-self: start;
}
.export-preview.r169 { aspect-ratio: 16 / 9; }
.export-preview.r11 { aspect-ratio: 1; }


@media (max-width: 1280px) {
  body { --rail-w: 64px; }
  .workspace { --insp-w: 260px; grid-template-columns: var(--drawer-w) minmax(320px, 1fr) var(--insp-w); }
  .project-title { width: 180px; }
}

/* ---------- Nền tảng (content-playbook) ---------- */
.platform-select { font-weight: 600; color: var(--accent); }
.small-tool { font-size: 11px; height: 24px; padding: 0 8px; border: 1px solid var(--ctl-stroke); background: var(--ctl); }
.small-tool.on { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.small-tool.on:hover:not(:disabled) { background: var(--accent-hover); }
.safe { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.safe i { position: absolute; background: rgba(255, 80, 80, .22); outline: 1px dashed rgba(255, 120, 120, .7); }
.safe .s-top { left: 0; right: 0; top: 0; }
.safe .s-bottom { left: 0; right: 0; bottom: 0; }
.safe .s-left { left: 0; }
.safe .s-right { right: 0; }
.rec-band {
  position: absolute; top: 0; bottom: 0; background: var(--accent-soft);
  border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); pointer-events: none;
}
.rec-band span { position: absolute; right: 4px; bottom: 1px; font-size: 9px; color: var(--accent); white-space: nowrap; }
.max-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); pointer-events: none; }
.max-line span { position: absolute; left: 4px; bottom: 1px; font-size: 9px; color: var(--err); white-space: nowrap; }
.insp-h { font-size: 14px; font-weight: 600; color: var(--text); margin: 18px 0 8px; }
.plat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; }
.plat-card b { color: var(--accent); }
.plat-card .pc-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); margin-top: 3px; }
.plat-card .pc-row span:last-child { color: var(--text); text-align: right; }
.checks-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 5px; font-size: 12px; }
.checks-list li { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: start; }
.checks-list li::before { font-weight: 700; text-align: center; }
.checks-list li.ok::before { content: "✓"; color: var(--ok); }
.checks-list li.warn::before { content: "!"; color: var(--warn); }
.checks-list li.err::before { content: "✕"; color: var(--err); }
.checks-list li.info::before { content: "i"; color: var(--accent); font-style: italic; }
.checks-list li.err { color: var(--err); }
.checks-list li .fix { color: var(--accent); cursor: pointer; text-decoration: underline; margin-left: 4px; }
.plat-picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.plat-pick {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-ctl); cursor: pointer; background: var(--card);
}
.plat-pick:hover { background: var(--card-hover); }
.plat-pick input { accent-color: var(--accent); grid-row: span 2; }
.plat-pick b { font-size: 12px; }
.plat-pick small { color: var(--muted); font-size: 11px; }
.plat-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.export-fields { min-width: 0; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.job .pbadge { font-size: 10px; padding: 0 5px; border-radius: var(--radius-ctl); background: var(--accent-soft); color: var(--accent); }
.post-body { grid-template-columns: 220px 1fr; }
.post-cover { width: 100%; border-radius: var(--radius); background: #000; margin-bottom: 8px; display: block; }
.post-fields { min-width: 0; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.ai-label { border: 1px solid var(--line); background: var(--warn-soft); border-radius: var(--radius-ctl); padding: 10px 12px; margin-bottom: 10px; font-size: 12px; }
.ai-label b { color: var(--text); }
.ai-label b::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 8px;
  border-radius: 50%; background: var(--warn); color: var(--warn-soft); font-size: 11px; font-weight: 800; vertical-align: -2px; }
.copy-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; margin-bottom: 10px; align-items: start; }
.copy-field > span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.copy-field pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 var(--font); background: var(--ctl);
  border: 1px solid var(--ctl-stroke); border-radius: var(--radius-ctl); padding: 7px 10px; max-height: 180px; overflow-y: auto;
}
.manual-checks { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.manual-checks label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.manual-checks input { accent-color: var(--accent); margin-top: 2px; }
.manual-checks label:has(input:checked) { color: var(--muted); text-decoration: line-through; }

/* ---------- Thanh cuộn: mảnh, bo tròn, không mũi tên, sáng lên khi rê chuột ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb {
  background: var(--scroll); border-radius: 12px;
  border: 4px solid transparent; background-clip: padding-box; min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hover); border-width: 3px; }
::-webkit-scrollbar-thumb:active { background-color: var(--scroll-hover); border-width: 3px; }
/* Firefox (không hỗ trợ ::-webkit-scrollbar) */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
}

/* ---------- Mạng xã hội ---------- */
.social-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.social-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.social-card.on { border-color: var(--line); box-shadow: inset 3px 0 0 var(--ok); }
.social-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.social-head b { font-size: 14px; }
.social-head .st { margin-left: auto; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--ctl-stroke); color: var(--muted); white-space: nowrap; }
.social-card.on .social-head .st { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.social-card .field { margin-bottom: 9px; }
.social-card .field.check { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.social-card details { margin: 2px 0 10px; font-size: 12px; color: var(--muted); }
.social-card summary { cursor: pointer; margin-bottom: 8px; }
.social-card .help { font-size: 12px; color: var(--muted); margin: 0 0 10px; padding-left: 18px; line-height: 1.5; }
.social-card .help code, .publish-box code { font-size: 11px; background: var(--ctl); padding: 1px 4px; border-radius: 4px; word-break: break-all; user-select: all; }
.publish-box { border: 1px solid var(--line); background: var(--accent-soft); border-radius: var(--radius-ctl); padding: 10px 12px; margin-bottom: 10px; font-size: 12px; display: grid; gap: 8px; }
.publish-box:empty { display: none; }
.publish-box .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.publish-box .row select { width: auto; flex: 1 1 140px; height: 30px; }
.publish-box .row .btn { flex: none; }
.publish-box .msg { color: var(--muted); }
.publish-box .msg.err { color: var(--err); word-break: break-word; }
.publish-box .msg.ok { color: var(--ok); }
.publish-box a { color: var(--accent); }
.post-fields pre[contenteditable] { cursor: text; outline: none; border-radius: 4px; }
.post-fields pre[contenteditable]:focus { box-shadow: 0 0 0 1px var(--accent); }
.job .pub { font-size: 10px; padding: 0 5px; border-radius: var(--radius-ctl); background: var(--ctl); color: var(--warn); text-decoration: none; white-space: nowrap; }
.job .pub.done { color: var(--ok); }
.job .pub.failed { color: var(--err); }

/* ---------- Đạo diễn hình ảnh (Claude) ---------- */
.art-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.art-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.art-opts .field { margin: 0; }
.art-box.off .art-opts { display: none; }
.art-report { margin: 0 0 12px; font-size: 12px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-ctl); padding: 10px 12px; }
.art-report summary { cursor: pointer; font-weight: 600; }
.art-report .art-guide { color: var(--muted); margin: 8px 0; white-space: pre-wrap; }
.art-report ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.art-report li .sc { font-weight: 600; }
.art-report li .sc.ok { color: var(--ok); }
.art-report li .sc.bad { color: var(--warn); }
.art-report li .sc.block { color: var(--err); }
.art-report li .iss { color: var(--muted); }
#art-hint[data-warn="1"], #image-style-hint[data-warn="1"], #sub-pos-hint[data-warn="1"] { color: var(--warn); }
#image-style-field.dim { opacity: .55; }
#image-style-hint { margin-top: -4px; }

/* thanh menu trái: chữ không bị cắt khi hẹp; đủ rộng thì biểu tượng + chữ nằm ngang */
.rail { min-width: 0; overflow: hidden; }
.rail-btn { min-width: 0; text-align: center; overflow-wrap: anywhere; }
a.rail-btn { text-decoration: none; box-sizing: border-box; }
.rail.wide .rail-btn { flex-direction: row; justify-content: flex-start; gap: 14px; height: 36px; padding: 0 12px; font-size: 13px; text-align: left; overflow-wrap: normal; }
.rail.wide .rail-btn svg { flex: none; }
.rail.wide .rail-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail.wide .badge-n { position: static; margin-left: auto; }

/* ---------- Thư viện ảnh: chọn nhiều + xoá nhiều ---------- */
.lib-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.lib-bar:not(.on) > :not(#lib-select) { display: none; }
.lib-bar.on #lib-select { display: none; }
.lib-count { font-size: 12px; color: var(--muted); margin-right: auto; }
.btn.danger-solid { background: var(--err); border-color: transparent; color: var(--err-soft); font-weight: 600; }
.btn.danger-solid:hover { background: var(--err); filter: brightness(1.08); }
.btn.danger-solid:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.media-item .pick {
  position: absolute; left: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; z-index: 2;
  border: 2px solid #fff; background: rgba(0, 0, 0, .45); display: none; place-items: center;
  color: var(--accent-text); font-size: 12px; font-weight: 800; box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.media-grid.selecting .media-item .pick { display: grid; }
.media-grid.selecting .media-item .add, .media-grid.selecting .media-item .del { display: none !important; }
.media-grid.selecting .media-item.used::after { left: auto; right: 4px; }
.media-item.picked { border-color: var(--accent); }
.media-item.picked .pick { background: var(--accent); border-color: var(--accent); }
.media-item.picked .pick::after { content: "✓"; }
.media-item.picked img { opacity: .8; }

/* ---------- Windows 11: nút đổi chủ đề, chi tiết nhỏ ---------- */
.theme-btn svg { width: 16px; height: 16px; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 2px 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg);
  transition: transform .12s;
}
details[open] > summary::before { transform: rotate(45deg); }
.hint { line-height: 1.5; }
.workspace { background: transparent; }
.stage-head, .transport { background: transparent; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* =====================================================================
   Lớp Atlantis — đặt cuối file để đè lên các quy tắc chung ở trên
   ===================================================================== */
body { background: var(--bg); color: var(--text); }
.drawer h2, .inspector h2 { color: var(--heading); }

/* ---- thanh trên: nền xanh, ô logo xanh đậm ---- */
.topbar {
  background: var(--topbar); color: #fff; border-bottom: 0; position: relative; z-index: 6;
  box-shadow: 0 2px 12px var(--bar-shadow);
}
.topbar .brand {
  align-self: stretch; margin: 0 4px 0 0; padding: 0; gap: 10px;
  background: var(--brand-bg); color: #fff; font: 700 15px/1 var(--font-display); letter-spacing: .2px;
}
.topbar .brand svg { color: #fff; }
.topbar .tool { color: #fff; }
.topbar .tool:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.topbar .tool:active:not(:disabled) { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar .tool:disabled { opacity: .45; }
.topbar .project-title {
  background: rgba(0, 0, 0, .14); border-color: transparent; color: #fff; border-radius: 6px; width: 320px; text-align: left;
}
.topbar .project-title::placeholder { color: rgba(255, 255, 255, .75); }
.topbar .project-title:hover { background: rgba(0, 0, 0, .2); border-color: transparent; }
.topbar .project-title:focus { background: rgba(0, 0, 0, .24); border-color: rgba(255, 255, 255, .55); box-shadow: 0 0 0 3px rgba(255, 255, 255, .15); }
.topbar .save-state, .topbar .queue-meta { color: rgba(255, 255, 255, .85); }
.topbar .queue-meta .dot { background: #4be351; box-shadow: 0 0 0 3px rgba(75, 227, 81, .25); }
.topbar .btn.primary {
  background: var(--secondary); color: #fff; border: 0; border-radius: var(--radius-btn); padding: 0 20px; height: 36px;
  box-shadow: 0 4px 12px rgba(104, 97, 206, .45);
}
.topbar .btn.primary:hover { background: var(--secondary-hover); }
.topbar :focus-visible { outline-color: #fff; }

/* ---- menu trái (rail) + ngăn nội dung: nền trắng như sidebar Atlantis ---- */
.rail {
  background: var(--panel); border-right: 1px solid var(--line); padding: 10px 5px; gap: 6px;
  position: relative; z-index: 3; box-shadow: 4px 0 14px var(--bar-shadow);
}
.rail-btn { color: var(--muted); border-radius: 6px; }
.rail-btn:hover { color: var(--accent); background: var(--subtle-hover); }
.rail-btn.on {
  background: var(--accent); color: #fff;
  box-shadow: 4px 4px 10px rgba(0, 0, 0, .1), 4px 4px 15px -5px var(--accent-glow);
}
.rail-btn.on::before { content: none; }
.badge-n { background: var(--ok); color: #fff; }
.badge-n.live { background: var(--secondary); color: #fff; }
.rail-btn.on .badge-n { background: #fff; color: var(--accent); }
.drawer {
  background: var(--panel); border-left: 0; border-right: 1px solid var(--line); border-top-left-radius: 0;
  box-shadow: none;
}
.drawer h3, .insp-h {
  font: 700 11px/1.4 var(--font); text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
}

/* ---- trình phát: dùng nền chung của ứng dụng (không dải màu riêng) ---- */
.stage { background: transparent; }
.stage-label { font: 700 16px/1.2 var(--font-display); color: var(--heading); }
.frame { border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.transport { background: var(--panel); border-top: 1px solid var(--line); }
.tool.play { box-shadow: 0 4px 12px var(--accent-glow); }
.time b { color: var(--accent); }

/* ---- thuộc tính + timeline ---- */
.inspector { background: var(--bg); border-left: 1px solid var(--line); }
.timeline { background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px var(--bar-shadow); position: relative; z-index: 4; }
.tl-heads { background: var(--panel); }
.tl-head { color: var(--muted); font-weight: 600; }
/* clip timeline: phẳng, không bóng */
.clip { border-radius: 2px; box-shadow: none; }
.clip.sel { box-shadow: none; }
.clip .cap { background: none; text-shadow: none; }
.c-video .cap { background: rgba(0, 0, 0, .38); }
.c-video .dur { background: rgba(0, 0, 0, .45); }

/* ---- nút: bo góc nhẹ (--radius-btn) ---- */
:root { --radius-btn: 6px; }
.btn { border-radius: var(--radius-btn); border-color: var(--line-2); background: var(--ctl); font-weight: 600; padding: 0 16px; }
.btn:hover { background: var(--ctl); border-color: var(--accent); color: var(--accent); }
.btn:active { background: var(--ctl-press); color: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 3px 10px var(--accent-glow); }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.primary:active { background: var(--accent-press); color: #fff; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn.danger-solid { background: var(--err); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(242, 89, 97, .35); }
.btn.danger-solid:hover { color: #fff; }
.btn.small { height: 28px; padding: 0 12px; }
.small-tool { border-radius: var(--radius-btn); }
.chip { border-color: var(--line-2); font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--ctl); }
.chip.on { box-shadow: 0 3px 8px var(--accent-glow); }
.chip.on:hover { color: #fff; background: var(--accent); }

/* ---- thẻ: nền trắng, bóng mềm, không viền ---- */
.job, .plat-card, .social-card, .art-report, .plat-pick, .series-list button {
  background: var(--card); border-color: transparent; box-shadow: var(--shadow-card);
}
.job:hover, .plat-pick:hover, .series-list button:hover { background: var(--card-hover); }
.job.viewing { border-color: var(--accent); }
.plat-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.media-item { box-shadow: var(--shadow-card); border-radius: 6px; }
.dropzone { background: var(--bg); border: 2px dashed var(--dash); border-radius: 8px; }
.insp-img { box-shadow: var(--shadow-card); }
.plat-card b { color: var(--accent); }
.social-card.on { box-shadow: var(--shadow-card), inset 4px 0 0 var(--ok); }

/* ---- nhãn trạng thái: khối màu đặc ---- */
.badge { border: 0; border-radius: 30px; padding: 1px 9px; color: #fff; background: var(--muted); }
.badge.done { background: var(--ok); color: #fff; }
.badge.failed { background: var(--err); color: #fff; }
.badge.running, .badge.queued { background: var(--warn); color: #fff; }
.job .pbadge { border-radius: 30px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.job .pub { border-radius: 30px; }
.bar { background: var(--line); height: 5px; border-radius: 5px; }
.bar i { border-radius: 5px; background: linear-gradient(90deg, #1572e8, #48abf7); }

/* ---- ô nhập: viền đều, focus sáng viền (WinUI + Atlantis) ---- */
.input, select, textarea { border-color: var(--line-2); border-radius: 6px; }
.input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- hộp thoại, thông báo, cảnh báo ---- */
dialog { border: 0; border-radius: 10px; }
.export-head h3 { color: var(--heading); }
.export-foot .btn { min-width: 110px; }
.ai-label { background: var(--card); border: 0; border-left: 4px solid var(--warn); box-shadow: var(--shadow-card); border-radius: 6px; }
.publish-box { background: var(--card); border: 0; border-left: 4px solid var(--accent); box-shadow: var(--shadow-card); border-radius: 6px; }
.checks-list li.ok::before { color: var(--ok); }

/* bóng đổ chỉ dùng cho thanh trên, menu trái và khung timeline phía dưới */
:root { --bar-shadow: rgba(0, 0, 0, .35); }
:root[data-theme="light"] { --bar-shadow: rgba(69, 65, 78, .14); }

/* ẩn/hiện ngăn nội dung bên trái (nút ☰ trên thanh trên, hoặc bấm lại mục menu đang chọn) */
.workspace.drawer-off .drawer { visibility: hidden; padding: 0; border: 0; overflow: hidden; }
.workspace.drawer-off .drawer-resizer { display: none; }
.workspace .drawer { transition: padding .15s; }
.topbar .menu-btn svg { width: 18px; height: 18px; }

/* ---------- Menu trái cao hết màn hình: cột 1 từ dưới thanh trên tới đáy; vùng làm việc + timeline ở cột 2 ---------- */
.topbar { grid-column: 1 / -1; grid-row: 1; }
.rail { grid-column: 1; grid-row: 2 / 4; z-index: 5; }
.workspace { grid-column: 2; grid-row: 2; min-width: 0; }
.timeline { grid-column: 2; grid-row: 3; min-width: 0; }
/* ẩn cả menu trái (nút ☰ / Ctrl+\) */
body.rail-off { grid-template-columns: 0 minmax(0, 1fr); }
body.rail-off .rail { display: none; }


/* bóng thanh trên: chế độ Sáng cần đậm hơn để thấy rõ như chế độ Tối */
:root { --topbar-shadow: rgba(0, 0, 0, .35); }
:root[data-theme="light"] { --topbar-shadow: rgba(18, 38, 63, .30); }
.topbar { box-shadow: 0 3px 14px var(--topbar-shadow); }

/* (2026-12-04, người dùng chốt) thanh trên trải HẾT chiều ngang và nằm TRÊN menu trái: menu bắt đầu ngay dưới thanh trên,
   bóng thanh trên phủ lên đầu menu (topbar z-index 8 > rail 5) */
.topbar { grid-column: 1 / -1; grid-row: 1; z-index: 8; }
.rail { grid-row: 2 / 4; z-index: 5; }

/* ---------- Menu trái hẹp (< 120px): CHỈ biểu tượng; tên mục hiện ở tooltip khi rê chuột (bindRailTips trong app.js) ---------- */
body { --rail-w: 60px; }
.rail:not(.wide) .rail-btn { height: 44px; padding: 0; justify-content: center; flex: none; }
.rail:not(.wide) .rail-btn span { display: none; }
.rail:not(.wide) .badge-n { top: 3px; right: 3px; left: auto; }
.rail-tip {
  position: fixed; z-index: 100; transform: translateY(-50%); pointer-events: none;
  padding: 6px 10px; border-radius: var(--radius-ctl); white-space: nowrap;
  font: 600 12px/1.3 var(--font); color: var(--text);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-flyout);
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility .12s;
}
.rail-tip::before { /* mũi nhọn chỉ về mục menu */
  content: ""; position: absolute; left: -5px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  background: inherit; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg);
}
.rail-tip.show { opacity: 1; visibility: visible; transition-delay: .15s; }

/* ---------- Phương tiện: thư mục, tìm + sắp xếp + kiểu xem, lưới / danh sách ---------- */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pane-head h2 { margin: 0; }
.pane-head .btn svg { margin-right: 2px; }
.lib-folders { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.lib-folders .lib-folder-ico { width: 18px; height: 18px; color: var(--accent); margin-right: 6px; flex: none; }
.lib-folders select { flex: 1; min-width: 0; font-weight: 600; margin-right: 4px; }
.lib-folders .tool { color: var(--muted); }
.lib-folders .tool:hover:not(:disabled) { color: var(--accent); }
.dropzone.compact {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; margin-bottom: 8px; text-align: left;
}
.dropzone.compact .dz-text { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone.compact .dz-text strong { font-size: 13px; }
.dropzone.compact #dz-target { font-size: 12px; }
.lib-search-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.lib-search-row .input { flex: 1; min-width: 0; }
.lib-search-row .mini-select { flex: none; }
.lib-search-row .seg button { padding: 3px 6px; display: grid; place-items: center; }
.lib-search-row .seg svg { width: 15px; height: 15px; }
#lib-use { margin-bottom: 10px; }
.lib-bar .mini-select { min-height: 28px; max-width: 170px; }
.lib-bar .mini-select:disabled { opacity: .45; }
#lib-more { margin: -4px 0 12px; }

/* lưới: chỉ ảnh + ô nhãn; danh sách: ảnh nhỏ + tên, thư mục, kích thước, nhãn */
.media-item .meta .nm, .media-item .meta .sub { display: none; }
.media-grid.list { grid-template-columns: 1fr; gap: 4px; }
.media-grid.list .media-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; padding: 4px; }
.media-grid.list .media-item img { width: 56px; height: 56px; border-radius: 3px; }
.media-grid.list .media-item .meta { display: grid; gap: 1px; min-width: 0; padding-right: 54px; }
.media-grid.list .media-item .meta .nm, .media-grid.list .media-item .meta .sub {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-grid.list .media-item .meta .nm { font-size: 12px; font-weight: 600; }
.media-grid.list .media-item .meta .sub { font-size: 11px; color: var(--muted); }
.media-grid.list .media-item .tags { border: 0; background: transparent; padding: 0; margin-top: 2px; }
.media-grid.list .media-item .tags:focus { border-bottom: 1px solid var(--accent); }
.media-grid.list .media-item .add, .media-grid.list .media-item .del { top: 50%; margin-top: -11px; }
.media-grid.list .media-item.used::after { top: auto; bottom: 4px; left: 4px; font-size: 9px; }

/* ---------- Dự án ---------- */
.proj-list { display: grid; gap: 8px; }
.proj {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; padding: 8px; border-radius: var(--radius);
  background: var(--card); border: 1px solid transparent; box-shadow: var(--shadow-card); cursor: pointer;
}
.proj:hover { background: var(--card-hover); }
.proj.current { border-color: var(--accent); }
.proj-thumb {
  grid-row: span 2; width: 52px; height: 70px; border-radius: var(--radius-ctl); overflow: hidden;
  background: var(--ctl); color: var(--muted); display: grid; place-items: center;
}
.proj-thumb.r169 { height: 30px; align-self: start; }
.proj-thumb.r11 { height: 52px; align-self: start; }
.proj-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proj-body { min-width: 0; display: grid; gap: 2px; align-content: start; }
.proj-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-meta { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-actions { grid-column: 2; display: flex; align-items: center; gap: 2px; }
.proj-actions .icon-btn { width: 26px; height: 26px; display: grid; place-items: center; opacity: 0; }
.proj:hover .proj-actions .icon-btn, .proj-actions .icon-btn:focus-visible { opacity: 1; }
.proj-actions .icon-btn:hover { color: var(--accent); }
.proj-actions .icon-btn.danger:hover { color: var(--err); }
.badge.status { cursor: pointer; font: 600 11px/18px var(--font); border: 0; color: #fff; }
.badge.status.doing { background: var(--warn); }
.badge.status.done { background: var(--ok); }
.badge.status:hover { filter: brightness(1.08); }
.badge.open { background: var(--accent); color: #fff; border: 0; font-size: 10px; vertical-align: 1px; }

/* ---------- Trình phát hẹp (ngăn trái/phải kéo rộng): không để nội dung đẩy cột trình phát tràn sang bảng thuộc tính ---------- */
.stage { grid-template-columns: minmax(0, 1fr); overflow: hidden; container: stage / inline-size; }
.stage-head { min-width: 0; }
.stage-label { flex: 1 1 auto; min-width: 48px; }
/* hàng nút trên trình phát xuống dòng khi hẹp (mọi nút luôn thấy được), hàng đầu cao tối thiểu 44px */
.stage { grid-template-rows: auto minmax(0, 1fr) 56px; }
.stage-head { min-height: 44px; flex-wrap: wrap; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; }
.stage-head > .row { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
.stage-head > .row > * { flex: none; white-space: nowrap; }
.transport .time { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transport { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); min-width: 0; overflow: hidden; }
.transport > * { min-width: 0; }
.transport .right { overflow: hidden; }
@container stage (max-width: 560px) {
  .transport .res { display: none; }
  .stage-label { font-size: 14px; }
}
@container stage (max-width: 440px) {
  #safe-toggle { display: none; }
}

/* Phương tiện: công tắc chế độ nguồn ảnh "Ảnh của tôi" | "AI vẽ ảnh" (chỉ hiện phần của chế độ đang chọn) */
.seg.media-mode { display: flex; width: 100%; padding: 3px; margin: 2px 0 14px; }
.seg.media-mode button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 10px; font-size: 13px; }
.seg.media-mode svg { width: 16px; height: 16px; flex: none; }
.seg.media-mode button.on { background: var(--accent); color: var(--accent-text); }
.seg.media-mode button.on::after { display: none; }
#ai-section .art-box { margin-top: 10px; }
.seg.media-mode button { white-space: nowrap; min-width: 0; overflow: hidden; }

/* Văn bản → Vị trí phụ đề: 3 vị trí có sẵn (biểu tượng khung + vạch chữ), thanh tinh chỉnh; kéo phụ đề trên trình phát */
#sub-pos-box { margin-top: 6px; }
#sub-pos-box.dim { opacity: .5; }
.seg.sub-pos { margin-bottom: 10px; }
.seg.sub-pos .pos-ico { width: 12px; height: 18px; }
.frame-sub { cursor: ns-resize; touch-action: none; z-index: 3; border-radius: 4px; }
.frame-sub:hover, .frame-sub.dragging { outline: 1px dashed rgba(255, 255, 255, .7); outline-offset: 3px; }
.frame-sub:empty { pointer-events: none; }


/* Trình phát: khung video vuông góc, không bo góc (người dùng chốt 2026-12-04) */
.frame, .frame video, .frame-img { border-radius: 0; }

/* Phương tiện: 3 tab Ảnh · Nhạc · Video (kiểu Pivot WinUI: chữ + vạch nhấn dưới tab đang chọn) */
.media-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 14px; }
.media-tabs button {
  flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative;
  padding: 9px 6px 10px; border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); cursor: pointer;
  border-radius: var(--radius-ctl) var(--radius-ctl) 0 0; white-space: nowrap;
}
.media-tabs button:hover { color: var(--text); background: var(--subtle-hover); }
.media-tabs button.on { color: var(--accent); }
.media-tabs button.on::after { content: ""; position: absolute; left: 16%; right: 16%; bottom: -1px; height: 3px; border-radius: 2px; background: var(--accent); }
.media-tabs svg { width: 16px; height: 16px; flex: none; }
.media-tabs .n { font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px; background: var(--ctl); color: var(--muted); }
.media-tabs .n:empty { display: none; }
/* video trong thư viện: nhãn thời lượng trên ảnh đại diện */
.media-item .vdur {
  position: absolute; right: 4px; top: 4px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px;
  border-radius: 4px; background: rgba(0, 0, 0, .68); color: #fff; font: 600 11px var(--font); pointer-events: none;
}
.media-item .vdur svg { width: 9px; height: 9px; }
.media-item:hover .vdur, .media-grid.selecting .media-item .vdur { display: none; }
.media-grid.list .media-item .vdur { right: auto; left: 6px; top: auto; bottom: 6px; padding: 0 4px; font-size: 9px; }
.media-grid.list .media-item:hover .vdur { display: inline-flex; }
/* cảnh dùng video: nhãn trên trình phát, ảnh bảng thuộc tính, clip timeline */
.frame-img.vid::after, .insp-img.vid::after {
  content: "▶ VIDEO"; position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 4px;
  background: rgba(0, 0, 0, .6); color: #fff; font: 700 10px var(--font); letter-spacing: .06em;
}
.insp-img { position: relative; }
.clip.vid .cap b::after { content: " ▶"; font-size: .8em; }
/* tab Nhạc: danh sách bài, bài đang dùng có viền nhấn */
.music-list { display: grid; gap: 4px; margin: 4px 0 10px; }
.music-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--ctl-stroke); border-radius: var(--radius-ctl); background: var(--card); cursor: pointer;
}
.music-row:hover { border-color: var(--line-2); }
.music-row.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.music-row .mi { display: grid; min-width: 0; }
.music-row .mi b, .music-row .mi small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row .mi b { font-size: 13px; font-weight: 600; }
.music-row .mi small { font-size: 11px; color: var(--muted); }
.music-row .mplay { width: 30px; height: 30px; border-radius: 50%; }
.music-row.playing .mplay { background: var(--accent); color: var(--accent-text); }
.music-row .mplay-ph { display: grid; place-items: center; width: 30px; height: 30px; color: var(--muted); }
.music-row .mplay-ph svg, .music-row .mplay svg { width: 15px; height: 15px; }
.music-row .mused { display: none; }
.music-row.on .mused { display: inline-block; background: var(--accent); color: var(--accent-text); }
.music-row .mdel { visibility: hidden; }
.music-row:hover .mdel { visibility: visible; }

/* hộp đăng bài: chọn nhiều tài khoản */
.pub-accs { display: grid; gap: 4px; }
.pub-accs:empty { display: none; }
.pub-acc { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius-ctl); background: var(--card); border: 1px solid var(--ctl-stroke); cursor: pointer; }
.pub-acc .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pub-acc .st { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pub-acc.done .st { color: var(--ok); }
.pub-acc.failed .st { color: var(--err); }
.pub-acc.uploading .st, .pub-acc.processing .st { color: var(--warn); }

/* Mạng xã hội: màu / biểu tượng nền tảng, hướng dẫn lấy khoá (trang /account#social dùng thẻ .kp-* như Khoá API) */
:root { --net-youtube: #e62117; --net-tiktok: #161823; --net-facebook: #1877f2; }
:root[data-theme="light"] { --net-youtube: #e62117; --net-tiktok: #161823; --net-facebook: #1877f2; }
.net-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; }
.net-youtube .net-ico, .net-ico.net-youtube { background: var(--net-youtube); }
.net-tiktok .net-ico, .net-ico.net-tiktok { background: var(--net-tiktok); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.net-facebook .net-ico, .net-ico.net-facebook { background: var(--net-facebook); }
.stab-ico.net-ico { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.net-help { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.net-help summary { cursor: pointer; font-weight: 600; color: var(--text); }
.net-help .help { margin: 8px 0 0; padding-left: 18px; line-height: 1.6; }
.net-help code { font-size: 11px; background: var(--ctl); padding: 1px 4px; border-radius: 4px; word-break: break-all; user-select: all; }

/* Phương tiện → Nhạc / Video: tab con "Thư viện của tôi" | "Kho trực tuyến" (Pexels, Pixabay, Jamendo) */
#media-src { margin-top: -4px; }
.stock-search { display: flex; gap: 6px; margin-bottom: 8px; }
.stock-search .mini-select { flex: none; max-width: 120px; }
.stock-search .input { flex: 1 1 auto; min-width: 0; }
.stock-search #stock-go { flex: none; display: inline-grid; place-items: center; width: 34px; padding: 0; }
.stock-search #stock-go svg { width: 16px; height: 16px; }
#stock-orient { margin-bottom: 10px; }
.stock-keybar {
  margin-bottom: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.5; background: var(--card);
  border-left: 4px solid var(--warn); border-radius: 6px; box-shadow: var(--shadow-card);
}
.stock-keybar code { font-size: 11px; }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.stock-grid > .hint { grid-column: 1 / -1; }
.stock-card { display: grid; border: 1px solid var(--ctl-stroke); border-radius: var(--radius-ctl); background: var(--card); overflow: hidden; }
.stock-card .sthumb { position: relative; aspect-ratio: 16 / 10; background: var(--ctl); overflow: hidden; cursor: zoom-in; }
.stock-card .sthumb img, .stock-card .sprev { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stock-card .vdur {
  position: absolute; right: 4px; top: 4px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; z-index: 1;
  border-radius: 4px; background: rgba(0, 0, 0, .68); color: #fff; font: 600 11px var(--font); pointer-events: none;
}
.stock-card .vdur svg { width: 9px; height: 9px; }
.stock-card .vdur i { font-style: normal; }
.stock-card .sres {
  position: absolute; left: 4px; bottom: 4px; padding: 0 5px; border-radius: 3px; z-index: 1;
  background: rgba(0, 0, 0, .55); color: #fff; font: 600 10px var(--font); pointer-events: none;
}
.stock-card .sres:empty { display: none; }
.stock-card .smeta { display: flex; align-items: center; gap: 6px; padding: 6px; min-width: 0; }
.stock-card .smeta small { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }
.stock-imp { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; }
.stock-imp svg { width: 13px; height: 13px; }
.stock-music .stock-row { grid-template-columns: 30px minmax(0, 1fr) auto auto; cursor: default; }
.stock-row .lic {
  padding: 1px 6px; border-radius: 4px; font: 700 10px var(--font); letter-spacing: .02em; white-space: nowrap;
  background: var(--ok); color: #fff;
}
.stock-row .lic.nc { background: var(--warn); }
.stock-row > .hint { margin: 0; font-size: 11px; }
.stock-err { color: var(--err); }

/* Phông chữ giao diện: Huninn (người dùng chốt 2026-12-04) — file ở static/fonts/, biến --font / --font-display ở đầu file.
   Phụ đề xem trước trên trình phát giữ phông của video thật (SUBTITLE_FONT, mặc định Arial) để xem trước đúng với video xuất ra. */
.frame-sub, .sub-sample { font-family: Arial, "Segoe UI", sans-serif; }

/* Dự án → bảng "Dự án đang mở": ảnh/video đã dùng, âm thanh & cài đặt xuất, video đã xuất (renderProjRes) */
.proj-res { margin: 0 0 14px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--card); display: grid; gap: 12px; }
.pr-head { display: grid; gap: 2px; min-width: 0; }
.pr-kicker { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.pr-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-meta { font-size: 12px; color: var(--muted); }
.pr-sec { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.pr-sh { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.pr-sh svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.pr-sh .n { font-style: normal; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px; background: var(--ctl); color: var(--muted); }
.pr-sh .n:empty { display: none; }
.pr-link { margin-left: auto; border: 0; background: none; color: var(--accent); font: 600 12px var(--font); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.pr-link:hover { background: var(--subtle-hover); }
.pr-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.pr-thumb { position: relative; aspect-ratio: 1; border: 1px solid var(--ctl-stroke); border-radius: 4px; background: var(--ctl) center / cover no-repeat; cursor: pointer; padding: 0; }
.pr-thumb:hover { border-color: var(--accent); }
.pr-thumb.vid::after { content: "▶"; position: absolute; right: 2px; bottom: 1px; font-size: 9px; color: #fff; text-shadow: 0 0 3px #000; }
.pr-thumb.missing { border: 1px dashed var(--err); }
.pr-thumb.missing::before { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--err); font-weight: 700; }
.pr-more { display: grid; place-items: center; aspect-ratio: 1; border-radius: 4px; background: var(--ctl); color: var(--muted); font-size: 12px; font-weight: 600; }
.pr-note { margin: 0; font-size: 11px; color: var(--muted); }
.pr-note.warn { color: var(--warn); }
.pr-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; font-size: 12px; }
.pr-dl dt { color: var(--muted); }
.pr-dl dd { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-jobs { display: grid; gap: 4px; }
.pr-job {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 6px 4px 4px;
  border: 1px solid var(--ctl-stroke); border-radius: var(--radius-ctl); background: var(--panel); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.pr-job:hover, .pr-job.on { border-color: var(--accent); }
.pj-cover { width: 30px; height: 30px; border-radius: 3px; background: var(--ctl) center / cover no-repeat; }
.pj-txt { display: grid; min-width: 0; }
.pj-txt b, .pj-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-txt b { font-size: 12px; font-weight: 600; }
.pj-txt small { font-size: 11px; color: var(--muted); }
.pj-st { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--ctl); color: var(--muted); white-space: nowrap; }
.pr-job.s-done .pj-st { background: var(--ok); color: #fff; }
.pr-job.s-failed .pj-st { background: var(--err); color: #fff; }
.pr-job.s-running .pj-st, .pr-job.s-queued .pj-st { background: var(--accent); color: var(--accent-text); }

/* Lịch tạo video (mục "Lịch tạo"): form tạo / sửa lịch + danh sách thẻ lịch */
.sch-form { display: grid; gap: 10px; margin: 0 0 14px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--card); }
.sch-form h4 { margin: 0; font-size: 14px; }
.sch-form .field { margin: 0; }
.sch-form .seg.media-mode { margin: 0; }
.sch-form .hint { margin: 0; }
.sch-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#sch-quick { margin: -4px 0 0; }
#sch-series { width: 100%; margin: 6px 0; }
#sch-script { width: 100%; margin-top: 6px; font: 12px "Cascadia Mono", Consolas, monospace; resize: vertical; }
.sch-list { display: grid; gap: 8px; }
.sch-card { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--ctl-stroke); border-radius: var(--radius); background: var(--card); }
.sch-card.st-pending { border-left: 3px solid var(--accent); }
.sch-card.st-failed, .sch-card.st-missed { border-left: 3px solid var(--warn); }
.sch-top { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.sch-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.sch-ico svg { width: 16px; height: 16px; }
.sch-main { display: grid; min-width: 0; }
.sch-main b, .sch-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-main b { font-size: 13px; }
.sch-main small { font-size: 11px; color: var(--muted); }
.sch-st { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--accent); color: var(--accent-text); white-space: nowrap; }
.st-started .sch-st { background: var(--ctl); color: var(--muted); }
.st-started .sch-st[data-job="done"] { background: var(--ok); color: #fff; }
.st-started .sch-st[data-job="failed"], .st-failed .sch-st { background: var(--err); color: #fff; }
.st-missed .sch-st { background: var(--warn); color: #fff; }
.sch-when { font-size: 12px; color: var(--text); }
.st-pending .sch-when { font-weight: 600; }
.sch-note { margin: 0; font-size: 11px; color: var(--warn); }
.sch-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-head { position: relative; }
.pr-sched { justify-self: start; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; }
/* form lịch: mọi phần tử con co theo độ rộng ngăn (tên file dài không đẩy form tràn ngang) */
.sch-form { grid-template-columns: minmax(0, 1fr); }
.sch-form > *, .sch-form [data-for] > * { min-width: 0; max-width: 100%; }
.sch-form .dropzone { margin-bottom: 0; }
.sch-form .dz-text { display: block; max-width: 100%; }
.sch-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.sch-row2 select, .sch-form select, .sch-form .input, .sch-form textarea { width: 100%; min-width: 0; box-sizing: border-box; }
#sch-script { box-sizing: border-box; }

/* Timeline thu gọn: ở các mục không dựng video (Dự án, Đã xuất, Lịch tạo, Mạng xã hội) timeline tự thu về thanh công cụ,
   nhường chỗ cho ngăn nội dung + trình phát; nút ▲/▼ ở cuối thanh để mở / thu tay (người dùng chốt 2026-12-04). */
body { transition: grid-template-rows .22s ease; }
body.tl-min { grid-template-rows: 48px minmax(0, 1fr) 40px; }
body.tl-min .timeline { grid-template-rows: 40px 0; }
body.tl-min .tl-body { display: none; }
body.tl-min .tl-toolbar { border-bottom: 0; }
body.tl-min .tl-toolbar .tool:not(#tl-toggle), body.tl-min .tl-toolbar .sep, body.tl-min #zoom, body.tl-min .tl-zoom-label { display: none; }
.tl-summary { display: none; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-summary b { color: var(--text); font-weight: 600; }
body.tl-min .tl-summary { display: inline; cursor: pointer; }
#tl-toggle { margin-left: 6px; }
#tl-toggle svg { width: 14px; height: 14px; transition: transform .2s; }
body.tl-min #tl-toggle svg { transform: rotate(180deg); }

/* ================= Trang đăng nhập (login.html) ================= */
body.login-page { display: block; min-width: 0; min-height: 100vh; overflow: auto; background: var(--bg); }
.login-band { position: fixed; inset: 0 0 auto 0; height: 38vh; background: var(--topbar); }
.login-wrap { position: relative; display: grid; justify-items: center; gap: 18px; padding: 9vh 16px 40px; }
.login-brand { display: flex; align-items: center; gap: 10px; color: #fff; font: 20px var(--font-display); }
.login-card {
  width: min(400px, 100%); padding: 28px 28px 20px; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--bar-shadow) 0 10px 34px; border: 1px solid var(--line);
}
.login-card h1 { margin: 0 0 4px; font: 22px var(--font-display); color: var(--heading); }
.login-card .hint { margin: 0 0 18px; }
.login-card .field { margin-bottom: 14px; }
.login-card .input { width: 100%; height: 38px; font-size: 14px; }
.pw-box { position: relative; display: block; }
.pw-box .input { padding-right: 40px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--muted); cursor: pointer;
}
.pw-eye:hover { background: var(--subtle-hover); color: var(--text); }
.pw-eye.on { color: var(--accent); }
.login-submit { width: 100%; height: 40px; justify-content: center; font-size: 14px; margin-top: 4px; }
.login-foot { text-align: center; margin: 16px 0 0 !important; }
.login-err {
  margin: 0 0 14px; padding: 9px 12px; border-radius: var(--radius-ctl); font-size: 13px;
  background: var(--err-soft); color: var(--err-text); border: 1px solid var(--err);
}

/* ================= Tài khoản: nút người dùng ở thanh trên, menu, chip "đang xem dữ liệu của", hộp thoại người dùng ================= */
.user-box { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; margin-left: 4px;
  border: 0; border-radius: var(--radius-btn); background: transparent; color: #fff; cursor: pointer; font: inherit;
}
.user-btn:hover { background: rgba(255, 255, 255, .14); }
.user-btn .user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .chev { opacity: .8; }
.avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--secondary); color: #fff; font: 13px var(--font-display); text-transform: uppercase;
}
.user-btn .avatar { background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.avatar.big { width: 40px; height: 40px; font-size: 17px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 280px; padding: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--surface-stroke); border-radius: var(--radius);
  box-shadow: var(--shadow-dialog);
}
.um-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
  border-radius: 6px 6px 0 0; color: inherit; text-decoration: none; cursor: pointer; }
.um-head:hover, .um-head:focus-visible { background: var(--subtle-hover); outline: none; }
.um-head:hover .um-go, .um-head:focus-visible .um-go { text-decoration: underline; }
.um-head > div { flex: 1; }
.um-go { margin-top: 3px; font-size: 12px; color: var(--accent); }
.um-chev { flex: none; transform: rotate(-90deg); color: var(--muted); }
.um-head > div { display: grid; min-width: 0; }
.um-head b { font-weight: 400; font-family: var(--font-display); font-size: 15px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-head small { color: var(--muted); }
.um-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0;
  border-radius: var(--radius-ctl); background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.um-item svg { width: 18px; height: 18px; color: var(--muted); }
.um-item:hover { background: var(--subtle-hover); }
.um-item.danger, .um-item.danger svg { color: var(--err-text); }
.acting-chip {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 4px 0 10px; margin-right: 6px;
  border: 0; border-radius: 15px; background: var(--warn); color: #1d1d1d; font: inherit; font-size: 12px; cursor: pointer;
}
.acting-chip .acting-back { padding: 3px 9px; border-radius: 12px; background: rgba(0, 0, 0, .14); }
.acting-chip:hover .acting-back { background: rgba(0, 0, 0, .24); }
.acting-chip b { font-weight: 400; font-family: var(--font-display); }

dialog.dlg-sm { width: min(420px, 94vw); }
dialog.dlg-wide { width: min(860px, 96vw); }
.dlg-body { padding: 4px 24px 12px; max-height: 70vh; overflow-y: auto; }
.dlg-sm .dlg-body .input { width: 100%; }
.btn.danger { color: var(--err-text); }

/* hộp thoại "Kết nối mạng xã hội" (menu tài khoản) */
dialog.dlg-social { width: min(620px, 96vw); }
.dlg-owner { margin-left: 8px; font: 14px var(--font); color: var(--muted); }
.um-n { margin-left: auto; font-style: normal; font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.um-n:empty { display: none; }

/* nút "Xuất video" trên thanh công cụ timeline, SAU thanh trượt "Thu phóng", trước nút ▲/▼ (người dùng chốt 2026-12-04).
   Tông màu nhấn của ứng dụng (cùng họ với thanh trượt thu phóng + đầu phát), gọn theo chiều cao thanh 40px, không bóng tím nổi. */
.tl-toolbar .export-btn {
  height: 28px; padding: 0 14px; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-btn);
  background: var(--accent); color: var(--accent-text); font-size: 12px; box-shadow: none;
}
.tl-toolbar .export-btn:hover { background: var(--accent-hover); color: var(--accent-text); }
.tl-toolbar .export-btn:active { background: var(--accent-press); }
.tl-toolbar .export-btn svg { flex: none; }
.tl-toolbar .tl-export-sep { margin: 0 6px 0 10px; }
.tl-toolbar .export-btn { margin-right: 2px; }
body.tl-min .tl-toolbar .export-btn { margin-right: 4px; }   /* timeline thu gọn: nút vẫn hiện cạnh nút ▲ */

/* ---- Thanh tab cuộn ngang dùng chung (views/scroll-tabs.js): trang Khoá API, trang Mạng xã hội ---- */
.stabs-wrap { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); margin: 0 0 14px; }
.stabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.stabs::-webkit-scrollbar { display: none; }
.stab { display: inline-flex; align-items: center; gap: 7px; flex: none; white-space: nowrap; position: relative;
  padding: 9px 14px 10px; background: transparent; border: 0; border-radius: var(--radius-ctl) var(--radius-ctl) 0 0;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.stab:hover { color: var(--text); background: var(--subtle-hover); }
.stab.on { color: var(--accent); }
.stab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.stab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stab-badge { font-style: normal; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 8px;
  background: var(--ctl); border: 1px solid var(--line-2); color: var(--muted); }
.stab-badge.full { background: var(--ok); border-color: transparent; color: #fff; }
.stab-badge.some { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.stab-dirty { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.stab.dirty .stab-dirty { display: inline-block; }
.stab-nav { display: none; flex: none; width: 30px; align-items: center; justify-content: center; padding: 0;
  background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: var(--radius-ctl); }
.stabs-wrap.overflow .stab-nav { display: inline-flex; }
.stab-nav:hover:not(:disabled) { color: var(--text); background: var(--subtle-hover); }
.stab-nav:disabled { opacity: .3; cursor: default; }
.stab-nav svg { width: 16px; height: 16px; }
.stab-nav.prev svg { transform: rotate(90deg); }
.stab-nav.next svg { transform: rotate(-90deg); }
.key-field { position: relative; flex: 1; min-width: 0; display: flex; }
.key-field .input { width: 100%; }
.key-field:has(.key-eye) .input { padding-right: 38px; }
.key-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 30px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0;
  border-radius: var(--radius-ctl); color: var(--muted); cursor: pointer; }
.key-eye:hover { color: var(--accent); background: var(--subtle-hover); }
.key-eye[aria-pressed="true"] { color: var(--accent); }
.key-eye svg { width: 18px; height: 18px; }
/* mỗi khoá là một thẻ: đầu (tên + trạng thái + công tắc cấp quyền) · ô khoá + nút xoá · gợi ý · giới hạn request */
.kl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kl-field { display: flex; align-items: center; height: 32px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--ctl); overflow: hidden; }
.kl-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kl-field .input { flex: 1; min-width: 0; height: 100%; border: 0; border-radius: 0; background: transparent; box-shadow: none; text-align: right; padding: 0 8px; }
.kl-field .input:focus { box-shadow: none; }
.kl-field:has(.input:disabled) { background: var(--subtle-hover); border-style: dashed; }
.kl-field .input:disabled { color: var(--muted); cursor: not-allowed; opacity: 1; }
.kl-field .input::-webkit-inner-spin-button { opacity: .5; }
.kl-field span { flex: none; min-width: 64px; justify-content: center; padding: 0 10px; height: 100%; display: flex; align-items: center; font-size: 12px; color: var(--muted);
  border-left: 1px solid var(--line); background: var(--subtle-hover); }
@media (max-width: 560px) { .kl-grid { grid-template-columns: 1fr; } }

.key-grant { font-size: 12px; color: var(--muted); margin-top: 2px; }
.key-grant input:disabled + i { opacity: .45; }
.keys-grant-bar { border: 1px solid var(--line); background: var(--accent-soft); border-radius: var(--radius-ctl); padding: 10px 12px; margin-bottom: 12px; }
.keys-grant-bar p { margin: 0 0 8px; font-size: 12.5px; }
.keys-grant-bar div { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Trang Thống kê & lịch sử: phủ cả vùng làm việc (ngăn + trình phát + thuộc tính) ---- */
.stats-page {
  position: absolute; inset: 0; z-index: 6; overflow: auto; padding: 18px 22px 28px;
  background: var(--bg); display: flex; flex-direction: column; gap: 14px;
}
.st-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.st-head h2 { margin: 0; font: 400 20px/1.2 var(--font-display); color: var(--heading); }
.st-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.st-kpi, .st-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.st-kpi { padding: 14px 16px; display: grid; gap: 4px; }
.st-kpi small { color: var(--muted); font-size: 12px; }
.st-kpi b { font: 400 26px/1.1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.st-kpi span { color: var(--muted); font-size: 12px; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.st-card { padding: 14px 16px; min-width: 0; }
.st-card h3 { margin: 0 0 10px; font: 400 14px/1.3 var(--font-display); color: var(--heading); }
.st-wide { grid-column: 1 / -1; }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.st-card-head h3 { margin: 0; }
.st-chart { position: relative; width: 100%; overflow: hidden; }
.st-chart svg { display: block; }
.st-bar { fill: var(--accent); }
.st-grid-line { stroke: var(--line); stroke-width: 1; }
.st-base-line { stroke: var(--line-2); stroke-width: 1; }
.st-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.st-hit { fill: transparent; cursor: default; }
.st-hit.on { fill: var(--accent-soft); }
.st-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--dialog); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; box-shadow: var(--shadow-card);
}
.st-plat { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.st-details { margin-top: 8px; font-size: 12.5px; }
.st-details summary { cursor: pointer; color: var(--muted); }
.st-nets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-net { border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 10px 12px; display: grid; gap: 2px; }
.st-net small { color: var(--muted); font-size: 12px; }
.st-net b { font: 400 22px/1.1 var(--font-display); color: var(--heading); font-variant-numeric: tabular-nums; }
.st-tablewrap { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.st-table th { text-align: left; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.st-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.st-table tr:last-child td { border-bottom: 0; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-table .st-barcol { width: 40%; }
.st-table a { color: var(--accent); }
.st-meter { display: block; height: 8px; border-radius: 4px; background: var(--ctl); border: 1px solid var(--line-2); position: relative; overflow: hidden; margin-top: 4px; }
.st-meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 4px; }
.st-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--line-2); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.st-chip.ok { background: var(--ok); color: #fff; border-color: transparent; }
.st-chip.err { background: var(--err-soft); color: var(--err-text); border-color: transparent; }
.st-chip.granted { background: var(--accent); color: #fff; border-color: transparent; }
.st-empty { color: var(--muted); font-size: 12.5px; margin: 4px 0; }
#st-more { margin-top: 8px; }
@media (max-width: 1100px) { .st-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- SweetAlert2 (notify.js): thông báo, hỏi xác nhận, nhập liệu, đang xử lý — theo token chủ đề ---------- */
.vg-swal { z-index: 2000; font-family: var(--font); }
.vg-swal.swal2-backdrop-show { background: rgba(10, 16, 30, .42); }
.vg-swal .swal2-popup {
  background: var(--dialog); color: var(--text); border-radius: 10px; box-shadow: var(--shadow-flyout);
  font-family: var(--font); padding: 22px 0 18px; width: min(440px, calc(100vw - 32px));
}
.vg-swal .swal2-title { color: var(--heading); font-family: var(--font-display); font-size: 18px; font-weight: 400; padding: 6px 24px 0; }
.vg-swal .swal2-html-container { color: var(--text); font-size: 14px; line-height: 1.55; white-space: pre-line; margin: 10px 24px 0; padding: 0; }
.vg-swal .swal2-input-label { color: var(--muted); font-size: 13px; margin: 14px 24px 0; justify-content: flex-start; text-align: left; }
.vg-swal .swal2-input { margin: 8px 24px 0; width: auto; height: 36px; font-size: 14px; box-shadow: none; }
.vg-swal .swal2-validation-message { background: var(--err-soft); color: var(--err-text); margin: 10px 24px 0; font-size: 13px; }
.vg-swal .swal2-validation-message::before { background: var(--err); }
.vg-swal .swal2-actions { gap: 8px; margin: 20px 0 0; padding: 0 24px; justify-content: flex-end; width: 100%; box-sizing: border-box; }
.vg-swal .swal2-actions .btn { min-width: 96px; margin: 0; }
.vg-swal .swal2-icon { margin: 4px auto 0; transform: scale(.72); }
.vg-swal .swal2-icon.swal2-question { border-color: var(--accent); color: var(--accent); }
.vg-swal .swal2-icon.swal2-warning { border-color: var(--warn); color: var(--warn); }
.vg-swal .swal2-icon.swal2-error { border-color: var(--err); }
.vg-swal .swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background: var(--err); }
.vg-swal .swal2-icon.swal2-success { border-color: var(--ok); color: var(--ok); }
.vg-swal .swal2-icon.swal2-success [class^="swal2-success-line"] { background: var(--ok); }
.vg-swal .swal2-icon.swal2-success .swal2-success-ring { border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.vg-swal .swal2-icon.swal2-success [class^="swal2-success-circular-line"], .vg-swal .swal2-icon.swal2-success .swal2-success-fix { background: var(--dialog); }
.vg-swal .swal2-loader { border-color: var(--accent) transparent var(--accent) transparent; }
.vg-swal .vg-busy .swal2-actions { margin-top: 18px; justify-content: center; }
.vg-swal .vg-busy .swal2-html-container { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.vg-swal .swal2-close { color: var(--muted); }
.vg-swal .swal2-close:hover { color: var(--text); }
.vg-swal .swal2-close:focus { box-shadow: none; }
/* toast: góc trên phải, dưới thanh trên */
.vg-swal.vg-swal-toasts { padding: 64px 16px 16px; }
.vg-swal .swal2-popup.swal2-toast {
  background: var(--acrylic); color: var(--text); border-left: 4px solid var(--ok); border-radius: 8px; padding: 10px 14px;
  width: auto; min-width: 300px; max-width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-flyout);
  backdrop-filter: blur(30px) saturate(125%); -webkit-backdrop-filter: blur(30px) saturate(125%);
}
.vg-swal .swal2-popup.swal2-toast.err { border-left-color: var(--err); }
.vg-swal .swal2-toast .swal2-title { font-size: 14px; color: var(--text); margin: 0 0 0 10px; padding: 0; white-space: pre-line; overflow-wrap: anywhere; }
.vg-swal .swal2-toast .swal2-icon { transform: scale(.7); margin: -4px -6px -4px -6px; }
.vg-swal .swal2-toast .swal2-timer-progress-bar { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.vg-swal .swal2-toast.err .swal2-timer-progress-bar { background: color-mix(in srgb, var(--err) 55%, transparent); }

/* Liên kết Điều khoản dịch vụ / Quyền riêng tư (trang công khai /terms, /privacy) */
.login-legal { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.login-legal a, .um-legal a { color: inherit; text-decoration: none; }
.login-legal a:hover, .um-legal a:hover { color: var(--accent); text-decoration: underline; }
.um-legal { margin-top: 4px; padding: 8px 12px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); text-align: center; }

/* ================= Trang Tài khoản (account.html: Khoá API · Mạng xã hội) — người dùng chốt 2026-12-05 ================= */
body.acct-body { grid-template-rows: 48px minmax(0, 1fr); grid-template-columns: 236px minmax(0, 1fr); min-width: 0; }
.acct-body .topbar { grid-column: 1 / -1; grid-row: 1; }
.acct-body .topbar .brand { text-decoration: none; }
.acct-back { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: var(--radius-ctl);
  text-decoration: none; font-size: 13px; }
.acct-back svg { transform: rotate(90deg); }
.acct-user { display: flex; align-items: center; gap: 8px; color: #fff; padding: 0 4px; text-decoration: none; }
.acct-user .user-name { font-size: 13px; }
.acct-nav {
  grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 4px; padding: 18px 10px 12px; min-height: 0; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); box-shadow: 4px 0 14px var(--bar-shadow); position: relative; z-index: 3;
}
.acct-nav-h { font: 700 11px/1.4 var(--font); text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 0 12px 8px; }
.acct-nav-a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.acct-nav-a svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.acct-nav-a span { flex: 1; min-width: 0; }
.acct-nav-a:hover { background: var(--subtle-hover); color: var(--accent); }
.acct-nav-a:hover svg { color: var(--accent); }
.acct-nav-a.on { background: var(--accent); color: #fff; box-shadow: 4px 4px 10px rgba(0, 0, 0, .1), 4px 4px 15px -5px var(--accent-glow); }
.acct-nav-a.on svg { color: #fff; }
.acct-n { font-style: normal; min-width: 20px; padding: 0 6px; line-height: 18px; border-radius: 9px; text-align: center; font-size: 11px; font-weight: 700; background: var(--ok); color: #fff; }
.acct-n:empty { display: none; }
.acct-nav-a.on .acct-n { background: #fff; color: var(--accent); }
.acct-nav-foot { margin-top: auto; padding: 10px 12px 0; font-size: 11.5px; color: var(--muted); }
.acct-nav-foot a { color: var(--muted); }
.acct-main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow-y: auto; padding: 28px 32px 56px; }
.acct-page { max-width: 1040px; margin: 0 auto; display: grid; gap: 16px; align-content: start; }
.acct-head h1 { margin: 0 0 6px; font: 700 22px/1.3 var(--font-display); color: var(--heading); }
.acct-owner { font: 400 15px var(--font); color: var(--muted); }
.acct-head .hint { margin: 0; max-width: 860px; line-height: 1.6; }
.acct-page .stabs-wrap { margin: 0; }
.acct-page .keys-grant-bar { margin: 0; }
@media (max-width: 760px) {
  body.acct-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px auto minmax(0, 1fr); }
  .acct-nav { grid-row: 2; flex-direction: row; padding: 8px; overflow-x: auto; box-shadow: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .acct-nav-h, .acct-nav-foot, .acct-user .user-name { display: none; }
  .acct-nav-a { flex: none; white-space: nowrap; padding: 8px 10px; }
  .acct-main { grid-column: 1; grid-row: 3; padding: 18px 14px 40px; }
}

/* ---- Trang Khoá API: mỗi dịch vụ một thẻ, mỗi khoá một dòng (thứ tự ưu tiên · trạng thái · mức đã dùng / giới hạn · thao tác) ---- */
.kp-list { display: grid; gap: 14px; }
.kp-svc { display: grid; gap: 12px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.kp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kp-title { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kp-title b { font-size: 15px; font-weight: 600; }
.kp-sum { font-size: 11.5px; padding: 1px 9px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--line-2); color: var(--muted); }
.kp-sum.ok { background: var(--ok); border-color: transparent; color: #fff; }
.kp-sum.warn { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.kp-head-r { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.kp-head-r .key-grant { margin: 0; }
.kp-head-r .btn svg, .kp-actions .btn svg { width: 15px; height: 15px; }
.kp-hint { margin: -6px 0 0; }
.kp-granted { font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-ctl); background: var(--accent-soft); border-left: 3px solid var(--accent); }
.kp-granted.warn { background: var(--subtle-hover); border-left-color: var(--warn); }
.kp-keys { display: grid; gap: 8px; }
.kp-empty { padding: 18px; text-align: center; font-size: 13px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.kp-key { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.kp-key.active { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.kp-key.full { box-shadow: inset 3px 0 0 var(--err); }
.kp-key.off .kp-main, .kp-key.off .kp-pos { opacity: .55; }
.kp-pos { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: var(--ctl); border: 1px solid var(--line-2); color: var(--muted); }
.kp-key.active .kp-pos { background: var(--ok); border-color: transparent; color: #fff; }
.kp-main { flex: 1; min-width: 0; display: grid; gap: 8px; }
.kp-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.kp-name { font-size: 13.5px; font-weight: 600; }
.kp-val { font: 12px ui-monospace, Consolas, monospace; color: var(--muted); background: var(--ctl); padding: 1px 6px; border-radius: 4px; }
.kp-state, .kp-region { font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--ctl); border: 1px solid var(--line-2); color: var(--muted); }
.kp-key.active .kp-state { background: var(--ok); border-color: transparent; color: #fff; }
.kp-key.full .kp-state { background: var(--err); border-color: transparent; color: #fff; }
.kp-usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 18px; max-width: 620px; }
.kp-meter { display: grid; gap: 4px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.kp-meter b { color: var(--text); font-weight: 600; }
.kp-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.kp-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.kp-meter.near .kp-bar i { background: var(--warn); }
.kp-meter.over .kp-bar i { background: var(--err); }
.kp-meter.over b { color: var(--err); }
.kp-actions { flex: none; display: flex; align-items: center; gap: 6px; }
.kp-actions .icon-btn { width: 30px; height: 32px; display: grid; place-items: center; }
.kp-actions .icon-btn svg { width: 16px; height: 16px; }
.kp-up svg { transform: rotate(180deg); }
.kp-actions .icon-btn:disabled { opacity: .3; cursor: default; }
.kp-actions .icon-btn:hover:not(:disabled) { color: var(--accent); background: var(--subtle-hover); }
.kp-on { margin: 0 6px; }
.kp-del.btn { width: 32px; padding: 0; }
.kp-del.btn:hover { border-color: var(--err); color: var(--err); }
.kp-form { display: grid; gap: 14px; padding: 16px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--subtle-hover); }
.kp-form-h { font-size: 14px; font-weight: 600; }
.kp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px 14px; align-items: end; }
.kp-grid .field { margin: 0; }
.kp-grid .key-val { font-family: ui-monospace, Consolas, monospace; }
.kp-grid .key-val::placeholder { font-family: var(--font); }
.kp-lim { display: grid; gap: 8px; }
.kp-lim-h { font-size: 12px; color: var(--muted); }
.kp-form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.kp-form-foot .btn { min-width: 120px; }
@media (max-width: 860px) {
  .kp-key { flex-wrap: wrap; }
  .kp-actions { width: 100%; justify-content: flex-end; }
  .kp-usage, .kp-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Trang Mạng xã hội: cùng thiết kế trang Khoá API (thẻ .kp-svc, dòng .kp-key, form .kp-form) — người dùng chốt 2026-12-05 ---- */
.kp-title .sp-ico { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
.sp-acc .kp-pos { width: 34px; height: 34px; font-size: 14px; }
.sp-acc.active .kp-pos, .sp-app.active .kp-pos { background: var(--ok); }
.sp-acc.full .kp-state { background: var(--warn); color: #1d1d1d; }
.sp-acc.full { box-shadow: inset 3px 0 0 var(--warn); }
.sp-acc:not(.full):not(.active) .kp-state { background: var(--ok); border-color: transparent; color: #fff; }
.kp-key .sp-def { background: var(--accent); border-color: transparent; color: #fff; }
.sp-info { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-app .kp-pos svg { width: 15px; height: 15px; }
.sp-kv { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.sp-kv > span { display: grid; gap: 3px; min-width: 0; }
.sp-kv small { font-size: 11.5px; color: var(--muted); }
.sp-kv .kp-val { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-mkdef.on { color: var(--ok); opacity: 1 !important; }
.sp-grid { align-items: end; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-grid .field.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sp-grid select { width: 100%; }
.sp-manual { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.sp-manual summary { cursor: pointer; margin-bottom: 10px; }
.kp-svc > .net-help { margin: 0; }
@media (max-width: 860px) { .sp-grid { grid-template-columns: minmax(0, 1fr); } .sp-info { white-space: normal; } }

/* ---- Trang Người dùng (/account#users): dòng người dùng cùng kiểu dòng khoá ---- */
.up-row .kp-pos { width: 34px; height: 34px; font-size: 14px; background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.up-row.active .kp-pos { background: var(--ok); color: #fff; }
.up-row.off .kp-main, .up-row.off .kp-pos { opacity: .55; }
.up-row .kp-state.role-admin { background: var(--secondary, var(--accent)); border-color: transparent; color: #fff; }
.up-row .kp-region.up-locked { background: var(--err); border-color: transparent; color: #fff; }
.up-row .kp-region.up-viewing { background: var(--ok); border-color: transparent; color: #fff; }
.up-row .up-view { white-space: nowrap; }
.up-form-hint { margin: -4px 0 0; }
.kp-actions .btn:disabled, .kp-on input:disabled + i { opacity: .4; cursor: default; }
.acct-nav-h.acct-admin { margin-top: 14px; }

/* ================= Trang Video (videos.html: Video đã xuất · Lịch tạo · Lịch đăng) — người dùng chốt 2026-12-05 ================= */
.vd-site .acct-page { max-width: 1280px; }
.vd-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.vd-head > div:first-child { flex: 1; min-width: 260px; }
.vd-head-r { display: flex; gap: 8px; flex-wrap: wrap; }
.vd-head-r .btn svg, .kp-head-r .btn svg { width: 15px; height: 15px; }
.vd-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vd-search { flex: 1 1 280px; position: relative; display: flex; align-items: center; }
.vd-search svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.vd-search .input { width: 100%; padding-left: 32px; }
.vd-tools select { width: auto; min-width: 150px; }
/* mục (dự án / chủ đề / nhóm) */
.vd-sec { scroll-margin-top: 12px; transition: box-shadow .3s; }
.vd-sec.vd-focus { box-shadow: 0 0 0 2px var(--accent); }
.vd-sec-ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
.vd-gone { color: var(--muted); font-style: italic; }
.vd-all { display: grid; place-items: center; width: 22px; }
.vd-all input, .vd-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.vd-sec .kp-head-r { gap: 6px; }
.vd-sec .kp-head-r .icon-btn svg { width: 16px; height: 16px; }
.vd-danger:hover { color: var(--err) !important; }
.vd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.vd-sec-empty { grid-column: 1 / -1; margin: 0; padding: 14px; text-align: center; font-size: 12.5px; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--radius-ctl); }
.vd-more { justify-self: center; }
/* thẻ video */
.vd-tile { display: grid; grid-template-rows: auto 1fr; min-width: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.vd-tile:hover { border-color: var(--line-2); box-shadow: var(--shadow-card); }
.vd-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vd-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--ctl); display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.vd-thumb img, .vd-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vd-tile:not(.st-done) .vd-thumb { cursor: default; }
.vd-check { position: absolute; top: 6px; left: 6px; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 6px; background: var(--dialog); box-shadow: var(--shadow-card); opacity: 0; transition: opacity .15s; cursor: pointer; }
.vd-tile:hover .vd-check, .vd-tile.sel .vd-check, .vd-check:focus-within, .vd-selecting .vd-check { opacity: 1; }
.vd-plat { position: absolute; top: 6px; right: 6px; z-index: 2; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
  background: var(--dialog); color: var(--text); box-shadow: var(--shadow-card); }
.vd-play { position: absolute; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: color-mix(in srgb, var(--dialog) 82%, transparent); color: var(--accent); opacity: 0; transition: opacity .15s; }
.vd-play svg { width: 18px; height: 18px; }
.vd-thumb:hover .vd-play { opacity: 1; }
.vd-err { font: 700 26px var(--font-display); color: var(--err); }
.vd-pct { font: 700 20px var(--font-display); color: var(--accent); }
.vd-thumb .bar { position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; }
.vd-body { display: grid; gap: 6px; padding: 9px 10px 8px; min-width: 0; align-content: start; }
.vd-title { font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); min-width: 0; }
.vd-gchip { font-size: 10.5px; padding: 0 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-pubs { display: flex; gap: 4px; flex-wrap: wrap; font-size: 11px; color: var(--muted); min-width: 0; }
.vd-pubs:empty { display: none; }
.vd-pubs .pub { font-size: 10.5px; padding: 0 6px; border-radius: var(--radius-ctl); background: var(--ctl); color: var(--warn); text-decoration: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-pubs .pub.done { color: var(--ok); }
.vd-pubs .pub.failed { color: var(--err); }
.vd-pubs .pub.sched { color: var(--accent); }
.vd-errtxt { color: var(--err); font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-actions { display: flex; gap: 2px; justify-content: flex-end; margin: 0 -4px -2px; }
.vd-actions .icon-btn { width: 30px; height: 30px; display: grid; place-items: center; text-decoration: none; }
.vd-actions .icon-btn svg { width: 16px; height: 16px; }
.vd-actions .vd-pri { color: var(--accent); }
/* thanh chọn nhiều (nổi ở đáy) */
.vd-selbar { position: fixed; z-index: 6; left: 50%; bottom: 20px; transform: translateX(calc(-50% + 118px)); display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 16px; background: var(--dialog); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-dialog);
  max-width: calc(100vw - 280px); flex-wrap: wrap; }
.vd-selbar b { font-size: 13px; margin-right: 6px; }
.vd-selbar .btn svg { width: 15px; height: 15px; }
/* hộp thoại */
dialog.dlg-wide { width: min(640px, 94vw); }
.vd-player { width: auto !important; max-width: 94vw; }
.vd-player-body { display: grid; place-items: center; padding: 0 24px 4px; }
.vd-player video { display: block; max-width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius-ctl); }
.vd-player video.r916 { width: min(380px, calc(70vh * 9 / 16)); aspect-ratio: 9 / 16; }
.vd-player video.r169 { width: min(880px, 88vw); aspect-ratio: 16 / 9; }
.vd-player video.r11 { width: min(560px, 70vh); aspect-ratio: 1; }
.vd-player .export-foot { justify-content: flex-end; }
.vd-player .export-foot .btn { min-width: 0; }
.vd-player-meta { margin-right: auto; font-size: 12px; color: var(--muted); }
.vd-pub-body { display: grid; gap: 14px; }
.vd-pub-body .field { margin: 0; }
.vd-pub-videos { display: flex; gap: 6px; flex-wrap: wrap; }
.vd-pub-v { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 8px 3px 3px; font-size: 12px;
  background: var(--ctl); border: 1px solid var(--line); border-radius: 6px; }
.vd-pub-v img { width: 36px; height: 24px; object-fit: cover; border-radius: 3px; }
.vd-pub-v span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-pub-v.more { padding: 3px 10px; color: var(--muted); }
.vd-target { display: grid; gap: 10px; }
.vd-nets button { display: inline-flex; align-items: center; gap: 6px; }
.vd-n { font-style: normal; font-size: 10.5px; min-width: 16px; line-height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ok); color: #fff; text-align: center; }
.vd-accs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.vd-acc { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-ctl);
  background: var(--panel); cursor: pointer; min-width: 0; }
.vd-acc:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.vd-acc input { accent-color: var(--accent); margin: 0; }
.vd-acc .avatar { width: 24px; height: 24px; font-size: 11px; }
.vd-acc-t { display: grid; min-width: 0; }
.vd-acc-t b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-acc-t small { font-size: 11px; color: var(--muted); }
.vd-acc-t small:empty { display: none; }
.vd-noacc { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius-ctl); }
.vd-noacc a { color: var(--accent); }
.vd-priv select { width: 100%; }
.vd-pub-text { display: grid; gap: 10px; }
.vd-pub-text .input, .vd-pub-text textarea { width: 100%; }
.vd-later { display: grid; gap: 8px; }
.vd-later .filters { margin: 0; }
.vd-grp-list { display: grid; gap: 6px; margin-bottom: 14px; max-height: 40vh; overflow-y: auto; }
.vd-grp-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-ctl); cursor: pointer; }
.vd-grp-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.vd-grp-item svg { width: 16px; height: 16px; color: var(--accent); }
.vd-grp-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.vd-grp-item small { color: var(--muted); font-size: 11.5px; }
.vd-grp-item input { accent-color: var(--accent); margin: 0; }
/* lịch tạo */
.vd-sch-form .vd-span { grid-column: 1 / -1; }
.vd-sch-form .vd-script { display: grid; gap: 8px; }
.vd-sch-form textarea, .vd-sch-form select, .vd-sch-form .input { width: 100%; }
.vd-sch-form .sch-src { justify-self: start; }
.vd-quick { margin: 0; align-self: end; }
.vd-auto { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-ctl); background: var(--panel); }
.vd-auto > .hint { margin: -4px 0 0; }
.vd-sch-list { display: grid; gap: 8px; }
.vd-sch .kp-pos svg, .vd-prow .kp-pos svg { width: 15px; height: 15px; }
.vd-sch-info, .vd-sch-when { font-size: 12px; color: var(--muted); }
.vd-sch-note { margin: 0; font-size: 12px; color: var(--err); }
.vd-sch .kp-state[data-job="done"] { background: var(--ok); border-color: transparent; color: #fff; }
.vd-sch .kp-state[data-job="failed"] { background: var(--err); border-color: transparent; color: #fff; }
.vd-sch .kp-state[data-job="running"], .vd-sch .kp-state[data-job="queued"] { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.vd-auto-chip { background: var(--accent-soft) !important; color: var(--accent) !important; border-color: transparent !important; }
.kp-key.st-started:not(.full) { box-shadow: inset 3px 0 0 var(--accent); }
/* lịch đăng */
.vd-pthumb { flex: none; width: 64px; height: 40px; border-radius: 6px; overflow: hidden; display: grid; place-items: center;
  background: var(--ctl); color: var(--muted); cursor: pointer; }
.vd-pthumb img { width: 100%; height: 100%; object-fit: cover; }
.vd-pthumb svg { width: 16px; height: 16px; }
.vd-prow .vd-net { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.vd-prow .kp-state[data-pub="done"] { background: var(--ok); border-color: transparent; color: #fff; }
.vd-prow .kp-state[data-pub="failed"] { background: var(--err); border-color: transparent; color: #fff; }
.vd-prow .kp-state[data-pub="uploading"], .vd-prow .kp-state[data-pub="processing"] { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.vd-prow .vd-pwhen { white-space: normal; }
.stab-badge[hidden] { display: none; }
@media (max-width: 760px) {
  .vd-selbar { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; }
  .vd-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .vd-check { opacity: 1; }
  .vd-tools select { flex: 1 1 140px; }
}

/* ================= Menu trên: Dự án · Video · Thống kê (người dùng chốt 2026-12-05) — trình dựng, trang Video, trang Tài khoản.
   Menu trái của trình dựng chỉ còn chức năng dựng video (AI viết, Phương tiện, Âm thanh, Văn bản). ================= */
.topnav { display: flex; align-items: center; gap: 2px; align-self: stretch; }
.top-btn {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; align-self: center;
  border: 0; border-radius: var(--radius-ctl); background: transparent; color: rgba(255, 255, 255, .82);
  font: 13.5px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.top-btn svg { width: 16px; height: 16px; flex: none; }
.top-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.top-btn:active { background: rgba(255, 255, 255, .08); }
.top-btn.on { background: rgba(255, 255, 255, .2); color: #fff; }
.top-btn.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -7px; height: 3px; border-radius: 3px 3px 0 0; background: #fff; }
.top-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.top-n { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ok); color: #fff;
  font: 600 10.5px/18px var(--font); text-align: center; }
.top-n.live { background: var(--secondary, var(--ok)); }
.top-n:empty { display: none; }
.top-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .28); flex: none; }
.acct-body .topnav { margin-left: 6px; }
@media (max-width: 1100px) { .top-btn span:not(.top-n) { display: none; } .top-btn { padding: 0 9px; } }
@media (max-width: 760px) { .acct-body .topnav { margin-left: 0; } .acct-body .topbar .brand span { display: none; } }
/* thanh trên không xuống dòng khi hẹp: ô tên dự án co lại, ẩn chữ logo / trạng thái hàng chờ */
.topbar .brand span, .topbar .tool, .topbar .queue-meta, .topbar .save-state { white-space: nowrap; }
.topbar .project-title { flex: 0 1 260px; min-width: 110px; }
@media (max-width: 1100px) { .topbar .brand span, .topbar .queue-meta { display: none; } .topbar { gap: 8px; } }

/* ================= Trang Dự án (projects.html) + tên dự án trong bảng thuộc tính — người dùng chốt 2026-12-05 ================= */
.insp-proj-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; }
.insp-proj-head h2 { margin: 0 !important; }
.insp-proj-head .save-state { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-proj-all { font-size: 12px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.insp-proj-all:hover { text-decoration: underline; }
.insp-proj-title .input { font-weight: 600; }
.pj-nav-h2 { margin-top: 14px; }
.pj-tile .pj-thumb { text-decoration: none; color: var(--muted); }
.pj-noimg { width: 34px; height: 34px; opacity: .55; }
.pj-badge { position: absolute; top: 6px; left: 6px; z-index: 2; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-card); }
.pj-tile.pj-open { border-color: var(--accent); }
.pj-title { color: var(--text); text-decoration: none; }
.pj-title:hover { color: var(--accent); }
.pj-title[data-empty] { color: var(--muted); font-style: italic; }
.pj-foot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pj-status { font: 600 11px/18px var(--font); padding: 0 8px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--warn-soft); color: var(--warn); }
.pj-status.st-done { background: var(--ok-soft); color: var(--ok); }
.pj-status:hover { box-shadow: 0 0 0 1px currentColor; }
.pj-time { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.pj-tile.pj-done .pj-thumb img { filter: saturate(.6); }
.pj-empty { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--muted); text-align: center; }
.pj-empty > svg { width: 40px; height: 40px; opacity: .5; }
.pj-empty p { margin: 0; }
.pj-empty .btn svg { width: 15px; height: 15px; }
.vd-head-r a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
/* thẻ dự án có 6 nút → không hẹp hơn 220px (lưới chung của trang Video xuống 150px khi màn hẹp) */
.pj-grid, .vd-grid.pj-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pj-tile .vd-actions { flex-wrap: wrap; }

/* ================= Trang Thống kê riêng (stats.html, /stats) — người dùng chốt 2026-12-05: không menu trái, không timeline ================= */
.st-body .st-main { grid-column: 1 / -1; padding: 0; }
.st-body .stats-page { position: static; inset: auto; overflow: visible; max-width: 1400px; margin: 0 auto; padding: 24px 32px 56px; background: none; }
.st-body .st-head h1 { margin: 0; font: 700 22px/1.3 var(--font-display); color: var(--heading); }
@media (max-width: 760px) { .st-body .stats-page { padding: 16px; } }

/* ================= Tài khoản → Phân quyền (perms-page.js) + Nhật ký hoạt động (logs-page.js) — người dùng chốt 2026-12-05 ================= */
.pm-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.pm-users { display: grid; gap: 10px; position: sticky; top: 0; }
.pm-ulist { display: grid; gap: 4px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 2px; }
.pm-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-ctl); color: var(--text); font: inherit; }
.pm-user:hover { border-color: var(--line-2); background: var(--subtle-hover); }
.pm-user.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.pm-user.off .pm-uname { opacity: .55; }
.pm-uname { flex: 1; min-width: 0; display: grid; }
.pm-uname b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-uname small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-user .kp-state { flex: none; }
.pm-user .kp-state.pm-admin { background: var(--ok); border-color: transparent; color: #fff; }
.pm-user .kp-state.pm-custom { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.pm-detail { display: grid; gap: 14px; min-width: 0; }
.pm-head .avatar { width: 30px; height: 30px; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.pm-card { gap: 6px; padding: 12px 14px; }
.pm-card.pm-off { opacity: .8; }
.pm-kids { display: grid; gap: 2px; padding-left: 12px; border-left: 2px solid var(--line); margin-left: 4px; }
.pm-row { display: flex; align-items: center; gap: 12px; padding: 6px 4px; border-radius: var(--radius-ctl); cursor: pointer; }
.pm-row:hover { background: var(--subtle-hover); }
.pm-row.dis { cursor: default; }
.pm-row.dis .pm-txt { opacity: .55; }
.pm-row.pm-page .pm-txt b { font-size: 14.5px; }
.pm-txt { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.pm-txt b { font-size: 13px; font-weight: 600; }
.pm-txt em { font-style: normal; font-size: 11px; color: var(--muted); }
.pm-txt .pm-tag { padding: 0 7px; border-radius: 9px; background: var(--ctl); border: 1px solid var(--line-2); }
.pm-txt .pm-diff { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pm-txt small { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }
.pm-row .switch { flex: none; }
.pm-row .switch input:disabled + i { opacity: .45; }
.lg-page .vd-tools .vd-search { flex: 1 1 220px; }
.lg-count { margin: -4px 0 0; }
.lg-table td { vertical-align: top; }
.lg-who { font-weight: 600; }
.lg-sub { display: block; font-size: 11px; color: var(--muted); }
.lg-kind { display: inline-block; font-size: 10.5px; padding: 0 7px; border-radius: 9px; background: var(--ctl); color: var(--muted); white-space: nowrap; }
.lg-kind.k-auth { background: var(--accent-soft); color: var(--accent); }
.lg-kind.k-create { background: var(--ok-soft); color: var(--ok); }
.lg-kind.k-delete { background: var(--err-soft); color: var(--err); }
.lg-kind.k-update { background: var(--warn-soft); color: var(--warn); }
.lg-times { color: var(--accent); font-weight: 600; }
.lg-target { word-break: break-word; }
.lg-ip { font: 12px ui-monospace, Consolas, monospace; color: var(--muted); }
.lg-more { justify-self: center; }
@media (max-width: 900px) { .pm-layout { grid-template-columns: minmax(0, 1fr); } .pm-users { position: static; } .pm-ulist { max-height: 240px; } }

/* (2026-12-06) Thanh trên giống nhau ở mọi trang: nút ☰ ẩn/hiện menu trái (Ctrl+\) + menu người dùng — js/core/shell.js */
body.acct-body.nav-off { grid-template-columns: 0 minmax(0, 1fr); }
body.acct-body.nav-off .acct-nav { display: none; }
@media (max-width: 760px) {
  body.acct-body.nav-off { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px 0 minmax(0, 1fr); }
  .acct-body .user-btn .user-name, .acct-body .user-btn .chev { display: none; }
}

/* ================= Trang Mạng xã hội /social (2026-12-06, người dùng chốt) — js/social-page.js, js/pages/social-*.js ================= */
.sc-body .acct-page.sc-page { max-width: 1500px; }
.sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sc-head .hint { max-width: 900px; }
.acct-n.live { background: var(--accent); }
/* Soạn & đăng: 3 cột cao bằng màn hình, mỗi cột tự cuộn */
.sc-composing .acct-main { display: flex; flex-direction: column; overflow: hidden; padding: 20px 24px 18px; }
.sc-composing #page-compose { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.sc-compose { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 350px; gap: 14px; }
.sc-col { min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sc-col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 14px; color: var(--heading); }
.sc-col-h b { font: 400 15px var(--font-display); }
.sc-col-tools { margin-left: auto; display: flex; gap: 2px; }
.sc-col-tools .icon-btn svg { width: 16px; height: 16px; }
.sc-n { font-size: 11.5px; color: var(--muted); background: var(--ctl); border: 1px solid var(--ctl-stroke); border-radius: 9px; padding: 0 7px; }
.sc-n:empty { display: none; }
.sc-search { position: relative; display: block; margin: 0 12px 8px; }
.sc-search svg { position: absolute; left: 9px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--muted); pointer-events: none; }
.sc-search .input { width: 100%; padding-left: 30px; }
.sc-lib-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 12px 8px; }
.sc-lib-filters select { min-width: 0; }
.sc-lib-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 8px; border-bottom: 1px solid var(--line); }
.sc-lib-bar .btn svg { width: 14px; height: 14px; }
.sc-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.sc-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.sc-lib-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: grid; gap: 6px; align-content: start; }
.sc-li { display: grid; grid-template-columns: 22px auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px 6px 6px; border-radius: 8px;
  border: 1px solid transparent; cursor: grab; user-select: none; }
.sc-li:hover { background: var(--subtle-hover); }
.sc-li.on { background: var(--accent-soft); border-color: var(--accent); }
.sc-li.in:not(.on) { opacity: .72; }
.sc-li:active { cursor: grabbing; }
.sc-li-thumb, .sc-part-thumb { position: relative; overflow: hidden; border-radius: 6px; background: #000; flex: none; }
.sc-li-thumb img, .sc-part-thumb img, .sc-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-li-thumb.r916 { width: 40px; height: 64px; } .sc-li-thumb.r169 { width: 64px; height: 36px; } .sc-li-thumb.r11 { width: 52px; height: 52px; }
.sc-li-body { min-width: 0; display: grid; gap: 2px; }
.sc-li-body b { font-weight: 600; font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-li-meta { font-size: 11px; color: var(--muted); }
.sc-li-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.sc-li-chips:empty { display: none; }
.sc-pill { font-style: normal; font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 8px; background: var(--ctl); border: 1px solid var(--ctl-stroke); color: var(--muted); white-space: nowrap; }
.sc-pill.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.sc-pill.net-youtube { color: var(--net-youtube); } .sc-pill.net-facebook { color: var(--net-facebook); } .sc-pill.net-tiktok { color: var(--text); }
.sc-empty { margin: 0; padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--muted); }
.sc-ghost { position: fixed; top: -100px; left: 0; padding: 6px 12px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; }
/* chuỗi bài */
.sc-series { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: end; padding: 4px 14px 12px; border-bottom: 1px solid var(--line); }
.sc-series .field { margin: 0; }
.sc-series .field small { font-weight: 400; color: var(--muted); }
.sc-series .input, .sc-series textarea { width: 100%; }
.sc-num { padding-bottom: 7px; font-size: 13px; white-space: nowrap; }
.sc-series-fmt, .sc-series-foot { grid-column: 1 / -1; }
.sc-series textarea { resize: vertical; min-height: 38px; }
.sc-chain-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: grid; gap: 10px; align-content: start; transition: background .12s; }
.sc-chain-list.over { background: var(--accent-soft); }
.sc-dragging .sc-chain-list { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: var(--radius); }
.sc-drop-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 48px 20px; border: 2px dashed var(--ctl-strong); border-radius: var(--radius); color: var(--muted); font-size: 12.5px; }
.sc-drop-empty svg { width: 34px; height: 34px; color: var(--accent); }
.sc-drop-empty b { font-size: 14px; color: var(--heading); font-weight: 600; }
.sc-drop-empty span { max-width: 420px; line-height: 1.5; }
.sc-card { position: relative; display: grid; grid-template-columns: 18px auto minmax(0, 1fr); gap: 10px; padding: 10px 12px 10px 6px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); transition: border-color .12s, box-shadow .12s; }
.sc-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sc-card.dragging { opacity: .45; }
.sc-card.drop-before::before, .sc-card.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--accent); }
.sc-card.drop-before::before { top: -7px; } .sc-card.drop-after::after { bottom: -7px; }
.sc-grip { display: grid; place-items: center; color: var(--muted); cursor: grab; border-radius: 4px; }
.sc-grip:hover { background: var(--subtle-hover); color: var(--text); }
.sc-grip svg { width: 16px; height: 16px; }
.sc-card-thumb { position: relative; overflow: hidden; border-radius: 6px; background: #000; cursor: pointer; align-self: start; }
.sc-card-thumb.r916 { width: 92px; height: 164px; } .sc-card-thumb.r169 { width: 160px; height: 90px; } .sc-card-thumb.r11 { width: 120px; height: 120px; }
.sc-part { position: absolute; left: 5px; top: 5px; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 10.5px; font-weight: 700; }
.sc-playbtn { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity .15s; background: rgba(0, 0, 0, .25); }
.sc-playbtn svg { width: 26px; height: 26px; color: #fff; }
.sc-card-thumb:hover .sc-playbtn { opacity: 1; }
.sc-card-body { min-width: 0; display: grid; gap: 7px; align-content: start; }
.sc-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-final { flex: 1; min-width: 0; font: 400 14px var(--font-display); color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-card-acts { display: flex; gap: 1px; }
.sc-card-acts .icon-btn { width: 26px; height: 26px; }
.sc-card-acts svg { width: 14px; height: 14px; } .sc-card-acts svg.up { transform: rotate(180deg); }
.sc-f { display: grid; gap: 3px; font-size: 11.5px; color: var(--muted); }
.sc-f > span { display: flex; align-items: center; justify-content: space-between; }
.sc-f .input, .sc-f textarea { width: 100%; font-size: 13px; }
.sc-f textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
.sc-cnt { font-style: normal; font-size: 10.5px; color: var(--muted); }
.sc-cnt.near { color: var(--warn); } .sc-cnt.over { color: var(--err-text, var(--err)); font-weight: 700; }
.sc-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 11.5px; }
.sc-tags { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; min-width: 0; }
.sc-tags .sc-pill { color: var(--accent); }
.sc-time { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.sc-time svg { width: 13px; height: 13px; }
.sc-time.own { color: var(--accent); font-weight: 600; }
.sc-at { width: 190px; font-size: 12px; }
.sc-warn { color: var(--warn); font-size: 11.5px; }
.sc-err { color: var(--err-text, var(--err)); }
/* cột phải: đăng lên, thời gian, xem trước */
.sc-side { overflow-y: auto; }
.sc-block { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.sc-block-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 400 14px var(--font-display); color: var(--heading); }
.sc-block .field { margin: 0; }
.sc-block .input, .sc-block select { width: 100%; }
.sc-targets { display: grid; gap: 8px; }
.sc-net { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; }
.sc-net.off { opacity: .75; }
.sc-net-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sc-net-h .net-ico { width: 18px; height: 18px; border-radius: 5px; }
.sc-net-note { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.sc-acc { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.sc-acc:hover { background: var(--subtle-hover); }
.sc-acc input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.sc-acc-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.net-bg-youtube { background: var(--net-youtube) !important; } .net-bg-facebook { background: var(--net-facebook) !important; }
.net-bg-tiktok { background: var(--net-tiktok) !important; }
.sc-priv { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding-top: 4px; }
.sc-when { justify-self: start; }
.sc-plan { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 12px; max-height: 150px; overflow-y: auto; }
.sc-plan li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 4px; background: var(--ctl); }
.sc-plan li span { color: var(--muted); }
.sc-plan li.more { justify-content: center; color: var(--muted); background: none; }
.sc-prev-tabs button { padding: 2px 8px; font-size: 11.5px; }
.sc-submit { position: sticky; bottom: 0; padding: 12px 14px; background: var(--card); border-top: 1px solid var(--line); display: grid; gap: 8px; margin-top: auto; }
.sc-sum { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.sc-sum b { color: var(--heading); font-size: 13px; }
.sc-sum-warn { color: var(--warn); }
.sc-submit .btn { height: 38px; font-size: 14px; }
.sc-submit .btn svg { width: 16px; height: 16px; }
/* xem trước bài đăng (mô phỏng chung, không dùng logo nền tảng) */
.sp { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); font-size: 13px; }
.sp-video { position: relative; background: #000; margin: 0 auto; }
.sp-video.r916 { width: 100%; max-width: 230px; aspect-ratio: 9 / 16; } .sp-video.r169 { width: 100%; aspect-ratio: 16 / 9; } .sp-video.r11 { width: 100%; aspect-ratio: 1; }
.sp-video img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.sp-play { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); pointer-events: none; }
.sp-play svg { width: 20px; height: 20px; color: #fff; }
.sp-tag { color: var(--net-facebook); }
.sp-fb-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.sp-fb-head .avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.sp-fb-head div { display: grid; } .sp-fb-head b { font-weight: 600; }
.sp-fb-head small { color: var(--muted); font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; }
.sp-fb-head small svg { width: 11px; height: 11px; }
.sp-fb-text { padding: 0 12px 8px; line-height: 1.45; word-break: break-word; }
.sp-fb-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; padding-bottom: 0; }
.sp-more { border: 0; background: none; color: var(--muted); font: 600 12.5px var(--font); padding: 2px 12px 8px; cursor: pointer; }
.sp-facebook .sp-video { max-width: none; }
.sp-facebook .sp-video.r916 { max-height: 380px; aspect-ratio: auto; height: 380px; }
.sp-fb-acts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin: 0 10px; }
.sp-fb-acts span { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.sp-fb-acts svg, .sp-tt-side svg { width: 15px; height: 15px; }
.sp-tiktok { position: relative; background: #000; color: #fff; border: 0; }
.sp-tiktok .sp-video { max-width: none; }
.sp-tt-side { position: absolute; right: 8px; bottom: 90px; display: grid; gap: 12px; }
.sp-tt-side span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .15); }
.sp-tt-cap { position: absolute; left: 0; right: 48px; bottom: 0; padding: 30px 10px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); font-size: 12px; }
.sp-tt-cap p { margin: 3px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.sp-tt-cap .sp-tag { color: #fff; font-weight: 700; }
.sp-tt-cap small { opacity: .7; }
.sp-yt-meta { display: flex; gap: 8px; padding: 10px 12px 4px; }
.sp-yt-meta div { display: grid; gap: 2px; min-width: 0; }
.sp-yt-title { font-weight: 600; line-height: 1.3; }
.sp-yt-meta small { color: var(--muted); font-size: 11.5px; }
.sp-yt-desc { margin: 4px 12px 12px; padding: 8px 10px; border-radius: 8px; background: var(--ctl); font-size: 12px; line-height: 1.45; max-height: 120px; overflow: hidden; }
.sp-youtube .sp-video.r916 { max-width: 200px; }
.sc-player .sc-player-body { padding: 0 20px 20px; display: grid; place-items: center; }
.sc-player video { max-width: 100%; max-height: 72vh; background: #000; border-radius: 6px; }
.sc-nav-acc:empty { display: none; }
/* Tiến trình đăng */
.sc-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.sc-kpi { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--ctl-strong); }
.sc-kpi b { font: 400 24px var(--font-display); color: var(--heading); }
.sc-kpi span { font-size: 12px; color: var(--muted); }
.sc-kpi.run { border-left-color: var(--accent); } .sc-kpi.wait { border-left-color: var(--warn); }
.sc-kpi.ok { border-left-color: var(--ok); } .sc-kpi.err { border-left-color: var(--err); }
.sc-batches { display: grid; gap: 14px; }
.sc-batch { gap: 10px; }
.sc-batch.live { border-color: var(--accent); }
.sc-batch-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-batch-title { display: grid; gap: 2px; flex: 1; min-width: 200px; }
.sc-batch-title b { font: 400 16px var(--font-display); color: var(--heading); }
.sc-batch-title small { color: var(--muted); font-size: 12px; }
.sc-batch-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-total { display: flex; align-items: center; gap: 12px; }
.sc-total .sc-bar { flex: 1; }
.sc-total-pct { font: 400 18px var(--font-display); color: var(--heading); min-width: 48px; text-align: right; }
.sc-total-text { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.sc-total-text b { color: var(--text); }
.sc-bar { height: 6px; border-radius: 4px; background: var(--ctl-strong); overflow: hidden; }
.sc-bar.big { height: 12px; border-radius: 6px; }
.sc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s ease; }
.sc-bar.ok i { background: var(--ok); } .sc-bar.err i { background: var(--err); } .sc-bar.wait i { background: var(--warn); } .sc-bar.muted i { background: var(--muted); }
.sc-bar.run i { background-image: linear-gradient(45deg, rgba(255, 255, 255, .28) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .28) 50%,
  rgba(255, 255, 255, .28) 75%, transparent 75%); background-size: 18px 18px; animation: sc-stripes 1s linear infinite; }
@keyframes sc-stripes { to { background-position: 18px 0; } }
@media (prefers-reduced-motion: reduce) { .sc-bar.run i, .sc-spin { animation: none; } }
.sc-parts { display: grid; gap: 8px; }
.sc-part-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 10px; border-radius: 8px; background: var(--ctl); }
.sc-part-thumb.r916 { width: 54px; height: 96px; } .sc-part-thumb.r169 { width: 120px; height: 68px; } .sc-part-thumb.r11 { width: 80px; height: 80px; }
.sc-part-body { min-width: 0; display: grid; gap: 6px; align-content: start; }
.sc-part-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-line { display: grid; grid-template-columns: minmax(150px, 220px) auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; }
.sc-line-acc { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sc-line-acc .net-ico { width: 16px; height: 16px; border-radius: 4px; }
.sc-line-acc span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-line-main { display: grid; gap: 3px; min-width: 0; }
.sc-line-text { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.sc-line-acts { display: flex; gap: 4px; justify-content: flex-end; }
.sc-line-acts .btn svg, .sc-table .btn svg { width: 13px; height: 13px; }
.sc-state { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--ctl); color: var(--muted); border: 1px solid var(--ctl-stroke); }
.sc-state.run { background: var(--accent); border-color: var(--accent); color: #fff; }
.sc-state.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.sc-state.err { background: var(--err); border-color: var(--err); color: #fff; }
.sc-state.wait { background: var(--warn); border-color: var(--warn); color: #1d1d1d; }
.sc-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: sc-spin .8s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }
/* Đã đăng */
.sc-hist-filters { display: grid; grid-template-columns: minmax(0, 1fr) 160px 160px; gap: 8px; }
.sc-hist-filters .sc-search { margin: 0; }
.sc-hist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sc-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sc-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sc-table tr:last-child td { border-bottom: 0; }
.sc-hist-v { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.sc-hist-v .sc-part-thumb.r916 { width: 34px; height: 60px; } .sc-hist-v .sc-part-thumb.r169 { width: 64px; height: 36px; }
.sc-nowrap { white-space: nowrap; }
.sc-table .sc-err, .sc-table .sc-warn { font-size: 11px; margin-top: 3px; max-width: 280px; }
/* hẹp */
@media (max-width: 1280px) { .sc-compose { grid-template-columns: 260px minmax(0, 1fr) 310px; } }
@media (max-width: 1100px) {
  .sc-composing .acct-main { overflow-y: auto; display: block; }
  .sc-compose { grid-template-columns: minmax(0, 1fr); }
  .sc-col { max-height: none; }
  .sc-lib-list { max-height: 360px; }
  .sc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sc-line { grid-template-columns: minmax(0, 1fr) auto; }
  .sc-line-main { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .sc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-hist-filters { grid-template-columns: 1fr 1fr; } .sc-hist-filters .sc-search { grid-column: 1 / -1; }
  .sc-card { grid-template-columns: 18px minmax(0, 1fr); } .sc-card-thumb { display: none; }
}
.sc-body .btn svg { width: 15px; height: 15px; flex: none; }
.sc-head > .btn { flex: none; }
.sc-table td .btn { vertical-align: middle; display: inline-flex; align-items: center; gap: 5px; margin: 2px 0; }
:where(.sc-page) svg { width: 16px; height: 16px; flex: none; }   /* mặc định cho biểu tượng chưa đặt cỡ (độ ưu tiên thấp nhất) */

/* ================= Hiệu ứng từng cảnh · chữ · icon (2026-12-06, người dùng chốt) — controllers/effects.js, views/overlays.js ================= */
.frame-img.prev { display: none; }
.frame-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 1; }
.frame-ov { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.fov { position: absolute; pointer-events: auto; cursor: move; touch-action: none; user-select: none; white-space: nowrap; transform-origin: center; }
.fov-in { display: inline-block; white-space: pre-wrap; line-height: 1.28; paint-order: stroke fill; border-radius: .3em; overflow-wrap: break-word; }
.fov.icon .fov-in { line-height: 1; }
.fov:hover { outline: 1px dashed rgba(255, 255, 255, .75); outline-offset: 2px; }
.fov.sel { outline: 2px solid var(--accent); outline-offset: 3px; }
.fov.off { filter: grayscale(.4); }
.fov-h { display: none; position: absolute; right: -9px; bottom: -9px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); cursor: nwse-resize; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.fov.sel .fov-h { display: block; }
.frame.snap-x::before, .frame.snap-y::after { content: ""; position: absolute; z-index: 4; pointer-events: none; background: #ff4fd8; }
.frame.snap-x::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.frame.snap-y::after { top: 50%; left: 0; right: 0; height: 1px; }
/* ngăn trái */
.fx-target { margin: -4px 0 10px; color: var(--accent); font-weight: 600; }
.fx-target:empty { display: none; }
.fx-tabs { display: flex; margin-bottom: 12px; }
.fx-tabs button { flex: 1; }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 14px; }
.fx-tile { display: grid; gap: 5px; padding: 5px; border-radius: 8px; border: 1px solid var(--ctl-stroke); background: var(--ctl);
  color: var(--text); cursor: pointer; text-align: center; font: inherit; }
.fx-tile:hover { background: var(--subtle-hover); }
.fx-tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.fx-tile small { font-size: 11.5px; line-height: 1.25; }
.fx-thumb { position: relative; display: grid; place-items: center; height: 56px; border-radius: 6px; overflow: hidden;
  background: #2a3346 center / cover no-repeat; color: #fff; font-size: 22px; }
.fx-thumb.glyph { text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.fx-thumb.glyph::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .28); }
.fx-thumb.glyph { isolation: isolate; } .fx-thumb.glyph::before { z-index: -1; }
/* ô chuyển cảnh: hai màu, phần "cảnh sau" chạy hiệu ứng khi rê chuột */
.fx-thumb.tr { background: linear-gradient(135deg, #1572e8, #5a9cf0); }
.fx-thumb.tr i { position: absolute; inset: 0; background: linear-gradient(135deg, #f25961, #ffad46); }
.fx-tile:hover .fx-thumb.tr i, .fx-tile.on .fx-thumb.tr i { animation: fx-tr 1.6s ease-in-out infinite; }
.tr-default i { animation-name: fx-fade !important; } .tr-fade i, .tr-dissolve i, .tr-hblur i, .tr-pixelize i, .tr-radial i { animation-name: fx-fade !important; }
.tr-none i { animation: none !important; clip-path: inset(0 0 0 50%); }
.tr-fadeblack i, .tr-fadewhite i { animation-name: fx-fade !important; }
.tr-fadeblack { background: linear-gradient(135deg, #1572e8, #000 70%) !important; } .tr-fadewhite { background: linear-gradient(135deg, #1572e8, #fff 70%) !important; }
.tr-wipeleft i { animation-name: fx-wipel !important; } .tr-wiperight i { animation-name: fx-wiper !important; } .tr-wipeup i { animation-name: fx-wipeu !important; }
.tr-slideleft i, .tr-smoothleft i { animation-name: fx-slidel !important; } .tr-slideright i { animation-name: fx-slider !important; }
.tr-slideup i { animation-name: fx-slideu !important; } .tr-slidedown i { animation-name: fx-slided !important; }
.tr-circleopen i, .tr-circleclose i { animation-name: fx-circle !important; } .tr-zoomin i { animation-name: fx-zoom !important; }
.fx-thumb.tr i { opacity: 1; clip-path: inset(0 0 0 50%); }
@keyframes fx-tr { 0%, 15% { clip-path: inset(0 0 0 100%); } 60%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes fx-fade { 0%, 15% { opacity: 0; clip-path: none; } 60%, 100% { opacity: 1; clip-path: none; } }
@keyframes fx-wipel { 0%, 15% { clip-path: inset(0 0 0 100%); } 60%, 100% { clip-path: inset(0); } }
@keyframes fx-wiper { 0%, 15% { clip-path: inset(0 100% 0 0); } 60%, 100% { clip-path: inset(0); } }
@keyframes fx-wipeu { 0%, 15% { clip-path: inset(100% 0 0 0); } 60%, 100% { clip-path: inset(0); } }
@keyframes fx-slidel { 0%, 15% { clip-path: none; transform: translateX(100%); } 60%, 100% { clip-path: none; transform: none; } }
@keyframes fx-slider { 0%, 15% { clip-path: none; transform: translateX(-100%); } 60%, 100% { clip-path: none; transform: none; } }
@keyframes fx-slideu { 0%, 15% { clip-path: none; transform: translateY(100%); } 60%, 100% { clip-path: none; transform: none; } }
@keyframes fx-slided { 0%, 15% { clip-path: none; transform: translateY(-100%); } 60%, 100% { clip-path: none; transform: none; } }
@keyframes fx-circle { 0%, 15% { clip-path: circle(0 at 50% 50%); } 60%, 100% { clip-path: circle(75% at 50% 50%); } }
@keyframes fx-zoom { 0%, 15% { clip-path: none; opacity: 0; transform: scale(1.5); } 60%, 100% { clip-path: none; opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fx-tile .fx-thumb.tr i { animation: none !important; } }
/* mẫu chữ */
.text-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.tp-tile { display: grid; gap: 6px; justify-items: center; padding: 10px 6px 7px; border-radius: 8px; border: 1px solid var(--ctl-stroke);
  background: #39424f linear-gradient(160deg, #4b5a72, #232a36); cursor: pointer; font: inherit; color: #fff; }
.tp-tile:hover { box-shadow: 0 0 0 2px var(--accent); }
.tp-sample { font-size: 17px; line-height: 1.25; padding: 2px 8px; border-radius: 5px; paint-order: stroke fill; max-width: 100%; overflow: hidden; white-space: nowrap; }
.tp-tile small { font-size: 11px; color: rgba(255, 255, 255, .85); }
/* icon */
.search-box { position: relative; display: block; margin-bottom: 10px; }
.search-box svg { position: absolute; left: 9px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--muted); pointer-events: none; }
.search-box .input { width: 100%; padding-left: 30px; }
.sticker-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.sticker-cats button { border: 1px solid var(--ctl-stroke); background: var(--ctl); color: var(--text); font: inherit; font-size: 12px;
  padding: 3px 10px; border-radius: 12px; cursor: pointer; }
.sticker-cats button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; margin-bottom: 10px; }
.st-tile { aspect-ratio: 1; display: grid; place-items: center; font-size: 26px; line-height: 1; border: 1px solid transparent; border-radius: 8px;
  background: none; cursor: grab; font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif; }
.st-tile:hover { background: var(--subtle-hover); border-color: var(--ctl-stroke); transform: scale(1.08); }
.hint.warn { color: var(--warn); }
/* bảng thuộc tính */
.insp-sec { border-top: 1px solid var(--line); margin: 14px -2px 0; padding: 10px 2px 0; }
.insp-sec > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--heading); list-style: none; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.insp-sec > summary::-webkit-details-marker { display: none; }
.insp-sec > summary::before { content: "▸"; font-size: 11px; color: var(--muted); transition: transform .15s; }
.insp-sec[open] > summary::before { transform: rotate(90deg); }
.ov-list { display: grid; gap: 4px; margin-bottom: 8px; }
.ov-empty { margin: 0 0 4px; }
.ov-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) repeat(4, auto); gap: 2px; align-items: center; padding: 4px 4px 4px 6px;
  border-radius: 6px; border: 1px solid var(--ctl-stroke); background: var(--ctl); cursor: pointer; }
.ov-item:hover { background: var(--subtle-hover); }
.ov-item.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ov-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 5px; background: var(--panel); font: 700 14px Arial, sans-serif;
  font-family: "Segoe UI Emoji", Arial, sans-serif; }
.ov-name { min-width: 0; display: grid; }
.ov-name b { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-name small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-item .icon-btn { width: 24px; height: 24px; }
.ov-item .icon-btn svg { width: 14px; height: 14px; }
.ov-edit { display: grid; gap: 2px; padding: 10px; margin-bottom: 8px; border-radius: 8px; background: var(--ctl); border: 1px solid var(--ctl-stroke); }
.ov-edit .field { margin-bottom: 6px; }
.ov-edit.is-icon .ov-only-text { display: none !important; }
.ov-edit textarea { resize: vertical; }
.ov-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.ov-row .switch { white-space: nowrap; }
.ov-row:has(.switch) { grid-template-columns: auto 34px 1fr; margin: 2px 0 6px; }
.ov-row input[type="color"], .ov-edit .field input[type="color"] { width: 100%; height: 30px; padding: 2px; border-radius: var(--radius-ctl);
  border: 1px solid var(--ctl-stroke); background: var(--ctl); cursor: pointer; }
.ov-row:has(.switch) input[type="color"] { width: 34px; }
.ov-toggles { display: flex; gap: 3px; margin: 0 0 8px; }
.ov-tg { min-width: 32px; height: 28px; border-radius: var(--radius-ctl); border: 1px solid var(--ctl-stroke); background: var(--card); color: var(--text);
  cursor: pointer; font: 600 14px var(--font); }
.ov-tg.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ov-sep { width: 8px; }
/* timeline */
.clip.c-video .fx-badges { position: absolute; right: 3px; top: 3px; display: flex; gap: 2px; pointer-events: none; }
.fxb { display: inline-flex; align-items: center; height: 16px; min-width: 16px; justify-content: center; padding: 0 3px; border-radius: 4px;
  background: rgba(0, 0, 0, .6); color: #fff; font: 700 10px Arial, sans-serif; font-style: normal; font-family: "Segoe UI Emoji", Arial, sans-serif; }
.fxb svg { width: 11px; height: 11px; }
.fxb sup { font-size: 8px; margin-left: 1px; }
.tr-mark { position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; margin-top: -6px; transform: rotate(45deg); z-index: 2;
  background: #fff; border: 2px solid var(--accent); border-radius: 2px; pointer-events: none; }
.tr-mark.cut { background: var(--accent); }
.fov { width: max-content; }
.fx-tabs button { padding: 5px 4px; font-size: 12.5px; white-space: nowrap; min-width: 0; }
.seg.media-mode.fx-tabs button { padding: 7px 4px; font-size: 12.5px; gap: 0; }

/* ===== Timeline: track Chữ + Icon (views/timeline-fx.js), thu gọn track, tự co giãn chiều cao (2026-12-06) ===== */
.tl-body { overflow-y: auto; overflow-x: hidden; align-items: start; }
.tl-scroll { align-self: start; }
.tl-inner { height: auto; min-height: 100%; }
.tl-head.h-ov { height: 20px; }
.track.t-ov { height: 20px; }
.fx-empty { position: absolute; left: 0; top: 1px; bottom: 1px; display: flex; align-items: center; padding: 0 10px; white-space: nowrap;
  color: var(--muted); font-size: 11.5px; border: 1px dashed var(--dash); border-radius: var(--radius-ctl); }
.ovc { position: absolute; height: 18px; display: flex; align-items: center; gap: 5px; padding: 0 9px; border-radius: 4px; cursor: grab;
  background: #8b5cf6; color: #fff; font-size: 11px; user-select: none; touch-action: none; overflow: hidden; border: 1.5px solid transparent;
  box-sizing: border-box; }
.ovc.icon { background: #d946ef; }
.ovc:hover { filter: brightness(1.08); }
.ovc.sel { border-color: var(--playhead); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35) inset; z-index: 2; }
.ovc-ico { flex: none; font: 700 12px Arial, sans-serif; font-family: "Segoe UI Emoji", Arial, sans-serif; }
.ovc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ovc.icon .ovc-t { display: none; }
.ovc.icon .ovc-d { margin-left: auto; }
.ovc-d { flex: none; font: 10px "Cascadia Mono", Consolas, ui-monospace, monospace; opacity: .9; }
.ovc-l, .ovc-r { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; background: rgba(255, 255, 255, .0); }
.ovc-l { left: 0; } .ovc-r { right: 0; }
.ovc:hover .ovc-l, .ovc:hover .ovc-r, .ovc.sel .ovc-l, .ovc.sel .ovc-r { background: rgba(255, 255, 255, .45); }
body.tl-resizing, body.tl-resizing * { cursor: ew-resize !important; }

/* Thu gọn / mở rộng track (nút ⊞/⊟ .tl-fold TRƯỚC biểu tượng track; tên track chỉ ở title — views/timeline.js applyTrackFold) */
.tl-head[data-track] { position: relative; justify-content: center; gap: 5px; padding: 0 4px; overflow: hidden; cursor: default; }
.tl-head .tl-ico { width: 14px; height: 14px; flex: none; }
.tl-fold { flex: none; width: 14px; height: 14px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 3px;
  background: transparent; color: var(--muted); cursor: pointer; opacity: .75; }
.tl-fold:hover { color: var(--accent); opacity: 1; }
.tl-fold svg { width: 14px; height: 14px; display: block; }
.tl-fold .v { display: none; }
.tl-head.fold .tl-fold .v { display: inline; }
/* ⊟ và ⊞ (cùng biểu tượng track) LUÔN cùng cỡ 14px — dải thu gọn 16px để vừa (người dùng báo lệch cỡ 2026-12-06) */
.tl-head.fold { height: 16px !important; }
.track.fold { height: 16px !important; }
.track.fold .clip { border-width: 1px; border-radius: 2px; }
.track.fold .clip .cap, .track.fold .clip .wave, .track.fold .clip .dur, .track.fold .fx-badges, .track.fold .tr-mark,
.track.fold .ovc > span, .track.fold .add-clip svg, .track.fold .fx-empty { display: none; }
.track.fold .ovc { height: 14px; border-width: 1px; padding: 0; }
.track.fold .track-empty { font-size: 0; }

/* ---------- Đăng nhập bước 2: xác thực 2 lớp ---------- */
.mfa-badge { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px;
  background: var(--accent-soft); color: var(--accent); }
.seg.mfa-tabs { display: flex; width: 100%; margin: 0 0 16px; padding: 3px; }
.seg.mfa-tabs button { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; font-size: 12px; white-space: nowrap; }
.seg.mfa-tabs svg { flex: none; width: 14px; height: 14px; }
.seg.mfa-tabs button.on { background: var(--accent); color: var(--accent-text); }
.seg.mfa-tabs button.on::after { display: none; }
.login-card .input.mfa-code { height: 46px; font: 22px/1 ui-monospace, Consolas, monospace; letter-spacing: 6px; text-align: center; }
.mfa-send { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; }
.mfa-send .hint { margin: 0 !important; font-size: 12px; }
.login-foot a { color: var(--accent); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* ---------- Tài khoản → Bảo mật (xác thực 2 lớp) ---------- */
.sec-status { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--warn); }
.sec-status.on { border-left-color: var(--ok); }
.sec-status b { font-size: 15px; }
.sec-status .hint { margin: 2px 0 0; }
.sec-ico { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sec-ico svg { width: 17px; height: 17px; }
.sec-ico.big { width: 40px; height: 40px; background: var(--ctl); color: var(--warn); }
.sec-status.on .sec-ico.big { color: var(--ok); }
.sec-ico.big svg { width: 22px; height: 22px; }
.kp-grid.sec-one { grid-template-columns: minmax(0, 320px); }
.sec-row .kp-name { word-break: break-all; }
.sec-qr-wrap { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.sec-qr { width: 180px; height: 180px; flex: none; border-radius: 8px; background: #fff; border: 1px solid var(--line); image-rendering: pixelated; }
.sec-steps { flex: 1; min-width: 240px; margin: 0; padding-left: 18px; display: grid; gap: 10px; font-size: 13px; line-height: 1.55; }
.sec-steps code, .sec-codes code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--ctl); padding: 1px 6px; border-radius: 4px; }
.sec-secret { letter-spacing: 1px; word-break: break-all; }
.sec-steps .btn { height: 22px; padding: 0 8px; font-size: 11.5px; vertical-align: middle; }
.input.sec-code { font: 18px/1 ui-monospace, Consolas, monospace; letter-spacing: 5px; }
.sec-grow { flex: 1; }
.sec-codes-box { display: grid; gap: 12px; padding: 16px; border: 1px dashed var(--warn); border-radius: var(--radius); background: var(--subtle-hover); font-size: 13px; }
.sec-codes-box p { margin: 0; line-height: 1.55; }
.sec-codes { margin: 0; padding-left: 22px; display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 36px; }
.sec-codes code { font-size: 14px; letter-spacing: 1px; }
.acct-n.sec-n { background: var(--warn); color: #1d1d1d; font-weight: 600; }
.acct-n.sec-n.on { background: var(--ok); color: #fff; }
.up-row .kp-region.up-mfa-on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* ---------- Tài khoản → Máy chủ email (SMTP, chỉ admin) ---------- */
.mail-presets { gap: 6px; }
.mail-presets .hint { font-size: 12px; }
.kp-grid.mail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.mail-grid .field em, .mail-grid .field .hint { font-style: normal; font-size: 11.5px; }
.mail-hint { margin: 0; }
.mail-test { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.mail-test .field { margin: 0; flex: 0 1 320px; }
.mail-test .hint { margin: 0 0 8px; font-size: 12px; }
.sec-link { color: var(--accent); }
@media (max-width: 760px) { .kp-grid.mail-grid { grid-template-columns: minmax(0, 1fr); } }
.mail-grid .field > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-grid .field > span em { margin-left: 4px; color: var(--muted); }

/* ---------- Lấy lại tài khoản (trang đăng nhập #flow-form) ---------- */
.login-forgot { margin: -6px 0 14px; text-align: right; font-size: 12px; }
.login-card .fl-body:empty { display: none; }
.login-card textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; font-size: 13px; }
.login-card select.input { padding: 0 30px 0 10px; }
.login-card .hint.fl-note { margin: -6px 0 14px; font-size: 12px; }
.fl-opt { font-style: normal; color: var(--muted); font-size: 11px; }
.fl-links .login-foot { margin-top: 10px !important; }
.fl-links .login-foot:first-child { margin-top: 16px !important; }

/* ---------- Tài khoản → Thiết bị đăng nhập ---------- */
.dv-ico.ban { background: var(--ctl); color: var(--err); }
.dv-row .kp-main { gap: 4px; }
.dv-meta { margin: 0; font-size: 12px; }
.dv-ua { margin: 0; font-size: 11px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-old { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.dv-row.full { box-shadow: inset 3px 0 0 var(--err); }

/* ---------- Tài khoản → Khôi phục tài khoản (admin) ---------- */
.rq-row { align-items: flex-start; }
.rq-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 12.5px; }
.rq-grid > span { color: var(--muted); }
.rq-grid > b { font-weight: 400; color: var(--text); word-break: break-word; }
.rq-note { white-space: pre-wrap; word-break: break-word; background: var(--ctl); border-radius: var(--radius-ctl); padding: 6px 8px; }
.rq-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }
.kp-region.rq-proof-0 { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.kp-region.rq-proof-1 { background: var(--ok); border-color: transparent; color: #fff; }
.kp-region.rq-proof-2 { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.rq-row .kp-state.rq-kind-both { background: var(--err); border-color: transparent; color: #fff; }
.rq-row .kp-state.rq-kind-password, .rq-row .kp-state.rq-kind-mfa { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.rq-row.off .kp-state { background: var(--ctl); color: var(--muted); border-color: var(--line-2); }
.rq-temp { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.rq-temp code { font: 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 1px; padding: 6px 12px; border-radius: var(--radius-ctl); background: var(--ctl); user-select: all; }
.acct-n.rec-n { background: var(--warn); color: #1d1d1d; font-weight: 600; }
@media (max-width: 760px) { .rq-grid { grid-template-columns: 1fr; gap: 2px; } .rq-grid > span { margin-top: 4px; } .rq-actions { max-width: none; } }
.up-row .kp-region.up-pwtemp { background: var(--warn); border-color: transparent; color: #1d1d1d; }
.login-card .input[readonly] { background: var(--ctl); color: var(--muted); }
