:root {
  --bg: #f4f8fb;
  --panel: #ffffff;
  --panel-2: #eef4f8;
  --border: #dbe6ee;
  --text: #13293a;
  --muted: #5e7283;
  --accent: #086288;
  --accent-2: #4D8DBA;
  --accent-soft: #e3f2fb;
  --accent-text: #ffffff;
  --sky: #97D7FF;
  --cream: #FFEFC4;
  --ok: #138a4b;
  --ok-soft: #e3f6ec;
  --warn: #a86400;
  --warn-soft: #fff3d6;
  --err: #c62f3a;
  --err-soft: #fde8ea;
  --del: #fde2e4;
  --ins: #dcf5e4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(8, 40, 60, .06), 0 4px 16px rgba(8, 40, 60, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1821;
    --panel: #0f2230;
    --panel-2: #15303f;
    --border: #22445a;
    --text: #e4f0f7;
    --muted: #93adbf;
    --accent: #97D7FF;
    --accent-2: #4D8DBA;
    --accent-soft: #12394f;
    --accent-text: #062436;
    --sky: #97D7FF;
    --cream: #FFEFC4;
    --ok: #4cc98a;
    --ok-soft: #173326;
    --warn: #f0b04a;
    --warn-soft: #3a2c12;
    --err: #ff7b85;
    --err-soft: #3d1a1f;
    --del: #4a1f25;
    --ins: #183d28;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.5;
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, pre { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }

/* ---------- Layout ---------- */
.shell { display: flex; height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--border); padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); padding: 4px 8px 18px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 800; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); }
#nav a:hover { background: var(--panel-2); }
#nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ico { width: 22px; text-align: center; }
.me { border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.me-name { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { flex: 1; overflow: auto; padding: 28px 32px 60px; }
.page { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---------- Components ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.tool-card { display: block; color: var(--text); transition: transform .12s, border-color .12s; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool-card .big { font-size: 28px; }
.tool-card h3 { margin-top: 8px; }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 14px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
.danger { color: var(--err); }
.danger:hover { border-color: var(--err); }
.sm { padding: 4px 9px; font-size: 13px; }
button.link { border: 0; background: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--accent); }

input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--muted); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }

.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; display: flex; }
.progress > .ok { background: var(--ok); }
.progress > .err { background: var(--err); }
.progress > .run { background: var(--accent); opacity: .5; }

.drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center;
  cursor: pointer; color: var(--muted); transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { color: var(--text); }

.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { padding: 4px 12px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.steps span.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.steps span.done { background: var(--accent-soft); color: var(--accent); }

/* ---------- Rows table ---------- */
.rows { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rows-head, .r { display: grid; grid-template-columns: 34px 40px 210px 1fr 70px; gap: 10px; align-items: start; padding: 8px 12px; }
.rows-head { background: var(--panel-2); font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; z-index: 1; }
.r { border-top: 1px solid var(--border); background: var(--panel); }
.r.off { opacity: .45; }
.r .idx { color: var(--muted); font-size: 13px; padding-top: 7px; }
.r input[type=text] { font-family: Consolas, monospace; font-size: 13px; }
.r textarea { font-size: 14px; min-height: 38px; }
.r .chars { font-size: 12px; color: var(--muted); text-align: right; padding-top: 8px; }
.r input[type=checkbox] { margin-top: 10px; }
.rows-body { max-height: 62vh; overflow: auto; }
.diff { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 14px; }
.diff del { background: var(--del); text-decoration: line-through; border-radius: 3px; }
.diff ins { background: var(--ins); text-decoration: none; border-radius: 3px; }
.diff .row { margin-top: 6px; }

/* ---------- Job items ---------- */
.items { display: flex; flex-direction: column; }
.it { display: grid; grid-template-columns: 26px 220px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); }
.it:first-child { border-top: 0; }
.it .name { font-family: Consolas, monospace; font-size: 13px; word-break: break-all; }
.it .txt { font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; cursor: pointer; }
.it .txt.open { -webkit-line-clamp: unset; color: var(--text); }
.it .msg { font-size: 12px; color: var(--err); }
.it audio { height: 34px; width: 240px; }
.it .acts { display: flex; gap: 6px; align-items: center; }
.it textarea { margin-top: 6px; }

.jobs-list .job { display: grid; grid-template-columns: 1fr 220px 130px; gap: 16px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--text); }
.jobs-list .job:first-child { border-top: 0; }
.jobs-list .job:hover { background: var(--panel-2); }

/* ---------- Chat ---------- */
/* .view có padding 28px trên / 60px dưới – margin âm để trang chat phủ kín toàn bộ chiều cao */
.chat { display: grid; grid-template-columns: 250px 1fr; gap: 0; height: 100vh; margin: -28px -32px -60px; }
.chat-list { border-right: 1px solid var(--border); background: var(--panel); padding: 14px 10px; overflow: auto; }
.chat-list a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list a:hover { background: var(--panel-2); }
.chat-list a.active { background: var(--accent-soft); color: var(--accent); }
.chat-item { display: flex !important; align-items: center; gap: 4px; padding-right: 4px !important; }
.chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-del { flex-shrink: 0; border: 0; background: none; padding: 2px 6px; font-size: 13px; opacity: 0; border-radius: 6px; }
.chat-item:hover .chat-del, .chat-item.active .chat-del, .chat-del:focus { opacity: .6; }
.chat-del:hover { opacity: 1 !important; background: var(--err-soft); }
@media (hover: none) { .chat-del { opacity: .6; } }
.chat-main { display: flex; flex-direction: column; min-width: 0; height: 100%; min-height: 0; position: relative; }
.msgs { flex: 1; overflow: auto; padding: 24px 32px; }
.msgs-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg-u-wrap { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-u { background: var(--accent-soft); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg-a { align-self: stretch; }
.msg-a .md > :first-child { margin-top: 0; }
.msg-a .tools { display: flex; gap: 6px; margin-top: 6px; }
.md pre { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; overflow: auto; }
.md code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
.md blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding-left: 12px; color: var(--muted); }
.composer { border-top: 1px solid var(--border); background: var(--panel); padding: 14px 32px; }
.composer-box { max-width: 820px; margin: 0 auto; }
.composer-inner { display: flex; gap: 10px; align-items: flex-end; }
.attach-btn { font-size: 18px; padding: 8px 11px; }
.pending { display: flex; flex-wrap: wrap; gap: 8px; }
.pending:not(:empty) { margin-bottom: 10px; }
.composer textarea { min-height: 46px; max-height: 240px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Tệp đính kèm ---------- */
.atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.att { position: relative; display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); }
.att:hover { border-color: var(--accent); }
.att-ico { font-size: 20px; flex-shrink: 0; display: grid; place-items: center; width: 24px; }
.att-txt { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: 11px; color: var(--muted); }
.att-img { padding: 0; overflow: hidden; }
.att-img img { display: block; height: 84px; max-width: 220px; object-fit: cover; }
.att-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; padding: 0; border-radius: 50%; justify-content: center; font-size: 11px; background: var(--panel); box-shadow: var(--shadow); }
.att-x:hover { color: var(--err); border-color: var(--err); }
.drop-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); border: 3px dashed var(--accent); border-radius: 12px; pointer-events: none; font-size: 18px; font-weight: 600; color: var(--accent); }


/* ---------- Thiết kế slide ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tpl { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; text-align: left; white-space: normal; border-width: 2px; }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl img, .tpl-fallback { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--panel-2); display: block; }
.tpl-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.sw { display: inline-block; width: 16px; height: 16px; border-radius: 4px; margin-right: 3px; border: 1px solid var(--border); vertical-align: middle; }
.deck { max-width: 1500px; margin: 0 auto; }
.deck-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.deck-title { font-size: 18px; font-weight: 700; flex: 1 1 200px; min-width: 160px; max-width: 380px; border-color: transparent; background: transparent; }
.deck-title:hover, .deck-title:focus { border-color: var(--border); background: var(--panel); }
.deck-head select { width: auto; }
.deck-body { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.deck-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); max-height: calc(100vh - 130px); overflow: auto; position: sticky; top: 0; }
.dk-item { display: flex; gap: 10px; padding: 8px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: center; }
.dk-item:hover { background: var(--panel-2); }
.dk-item.on { background: var(--accent-soft); }
.dk-thumb { position: relative; width: 96px; flex-shrink: 0; aspect-ratio: 16 / 9; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.dk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dk-num { position: absolute; left: 3px; bottom: 2px; font-size: 11px; font-weight: 700; background: var(--panel); border-radius: 4px; padding: 0 4px; }
.dk-cap { min-width: 0; }
.dk-lay { font-size: 11px; color: var(--muted); }
.dk-t { font-size: 13px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.deck-preview { aspect-ratio: 16 / 9; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; margin-bottom: 12px; }
.deck-preview img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.dk-empty { color: var(--muted); padding: 20px; text-align: center; }
.slide-fields { display: flex; flex-direction: column; gap: 12px; }
.items-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.item-row { display: flex; gap: 8px; align-items: flex-start; }
.item-n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 8px; flex-shrink: 0; }
.item-fields { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.img-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.img-pick button { padding: 2px; border-width: 2px; }
.img-pick button.on { border-color: var(--accent); }
.img-pick img { height: 64px; display: block; }
.ai-box { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); }
.ai-result { margin-top: 10px; background: var(--panel); border-radius: 8px; padding: 10px 12px; }
.ai-result pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; margin: 6px 0 10px; max-height: 260px; overflow: auto; }
.tt-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.layout-grid figure { margin: 0; }
.layout-grid img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; display: block; }
.layout-grid figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; }
@media (max-width: 960px) { .deck-body { grid-template-columns: 1fr; } .deck-list { position: static; max-height: 240px; } }

.pk-map select { padding: 5px 8px; font-size: 13px; }
.pk-map td { vertical-align: middle; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth .brand { justify-content: center; padding-bottom: 6px; }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 50; max-width: 90vw; box-shadow: var(--shadow); }
.toast.err { background: var(--err); color: #fff; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 8px 10px; border-top: 1px solid var(--border); text-align: left; }
table.tbl th { color: var(--muted); font-size: 12px; text-transform: uppercase; border-top: 0; }

.spin { width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { background: var(--panel-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.hint pre { margin: 6px 0 0; white-space: pre-wrap; color: var(--text); }

/* ---------- Soạn script ---------- */
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.editor textarea#script {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 13.5px; line-height: 1.6;
  height: calc(100vh - 250px); min-height: 360px; resize: none; tab-size: 2;
}
.editor .statusbar { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding: 6px 2px 0; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 140px); }
.side .card { padding: 14px; }
.side .scroll { overflow: auto; max-height: 38vh; margin: 0 -6px; }
.issue { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 6px; background: none; font-size: 13px; white-space: normal; }
.issue:hover { background: var(--panel-2); }
.issue .ln { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); margin-right: 4px; }
.issue.error .lv { color: var(--err); }
.issue.warn .lv { color: var(--warn); }
.issue.info .lv { color: var(--accent); }
.outline a { display: flex; justify-content: space-between; gap: 8px; padding: 3px 6px; border-radius: 6px; font-family: Consolas, monospace; font-size: 12px; color: var(--text); cursor: pointer; }
.outline a:hover { background: var(--panel-2); }
.outline a span:last-child { color: var(--muted); flex-shrink: 0; }
.stat { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .shell { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: auto; flex-direction: row; align-items: center; padding: 8px; overflow-x: auto; }
  .brand { padding: 0 8px; }
  .brand span:last-child, .ico + * { }
  #nav { flex-direction: row; }
  .me { border: 0; padding: 0 8px; }
  .view { padding: 16px; }
  .rows-head { display: none; }
  .r { grid-template-columns: 30px 1fr; }
  .r .idx, .r .chars { display: none; }
  .it { grid-template-columns: 26px 1fr; }
  .jobs-list .job { grid-template-columns: 1fr; gap: 6px; }
  .chat { grid-template-columns: 1fr; margin: -16px; height: calc(100vh - 60px); }
  .chat-list { display: none; }
}

.vid-prev { width: 100%; max-height: 240px; margin-top: 8px; border-radius: 8px; background: #000; }

/* ---- Tạo animation ---- */
.an-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border-radius: 999px; font-size: 12.5px; background: var(--panel-2); }
.an-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.an-item { display: flex; flex-direction: column; gap: 6px; }
.an-thumb { display: block; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #111; position: relative; border: 1px solid var(--border); }
.an-thumb iframe { width: 1280px; height: 720px; border: 0; transform: scale(.1875); transform-origin: 0 0; pointer-events: none; position: absolute; }
.an-thumb span { color: #aaa; font-size: 13px; position: absolute; inset: 0; display: grid; place-items: center; }
.an-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.anim-studio { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; height: 100vh; margin: -28px -32px -60px; }
.an-chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--panel); }
.an-chat-head { padding: 10px 14px; border-bottom: 1px solid var(--border); gap: 8px; }
.an-chat-head input { flex: 1; font-weight: 600; border-color: transparent; background: transparent; }
.an-chat-head input:hover, .an-chat-head input:focus { border-color: var(--border); background: var(--bg); }
.an-chat .msgs { padding: 16px; }
.an-chat .composer { padding: 10px 14px; }
.an-chat .msg-u-wrap { max-width: 92%; }
.an-coding { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 13px; animation: anPulse 1.4s ease-in-out infinite; }
@keyframes anPulse { 50% { opacity: .55; } }
.an-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 20px; gap: 10px; overflow: auto; }
.an-toolbar { gap: 6px; flex-wrap: wrap; }
.an-toolbar select { width: auto; max-width: 340px; }
.an-frame-wrap { position: relative; width: 100%; aspect-ratio: 16/9; max-height: calc(100vh - 170px); background: #0d0f16; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,.18); flex-shrink: 0; }
.an-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.an-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa; font-size: 15px; padding: 20px; text-align: center; }
.an-status { font-size: 13.5px; min-height: 20px; }
.an-status.ok { color: var(--ok, #1a7f37); }
.an-status.err { color: var(--err, #c62828); }
.an-code textarea { width: 100%; min-height: 320px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; margin-top: 6px; white-space: pre; }
.an-assets summary { cursor: pointer; font-size: 13.5px; color: var(--muted); }
.an-asset { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.an-dlg { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; width: min(560px, 92vw); background: var(--panel); color: var(--text); }
.an-dlg::backdrop { background: rgba(0,0,0,.35); }
.an-std { display: flex; flex-direction: column; gap: 6px; }
.pend { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; margin: 0 6px 6px 0; }
.pend button { border: 0; background: none; padding: 0 6px; }
@media (max-width: 900px) { .anim-studio { grid-template-columns: 1fr; height: auto; } .an-chat { height: 70vh; } }

/* ---- Kịch bản dạy học ---- */
.plan-page { max-width: 1400px; }
.plan-head { gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.plan-head input#pl-title { flex: 1; min-width: 240px; font-size: 20px; font-weight: 700; border-color: transparent; background: transparent; }
.plan-head input#pl-title:hover, .plan-head input#pl-title:focus { border-color: var(--border); background: var(--panel); }
.pl-revise { gap: 8px; margin-bottom: 12px; }
.pl-revise input { flex: 1; }
.hint.err { background: var(--err-soft, #fdecea); color: var(--err, #c62828); }
.pl-busy { animation: anPulse 1.6s ease-in-out infinite; }
.plan-body { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.pl-tree { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; padding-right: 4px; }
.pl-node { display: flex; align-items: center; gap: 6px; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; color: var(--text); width: 100%; }
.pl-node:hover { background: var(--panel-2); }
.pl-node.on { background: var(--accent-soft); color: var(--accent); }
.pl-lesson { font-weight: 600; margin-top: 8px; }
.pl-act { padding-left: 18px; }
.pl-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-num { font-size: 11.5px; color: var(--muted); min-width: 26px; font-variant-numeric: tabular-nums; }
.pl-st { font-size: 12px; width: 16px; text-align: center; color: var(--muted); }
.pl-st.ok { color: var(--ok, #1a7f37); }
.pl-edit { min-width: 0; }
.pl-content { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.pl-writebar { gap: 8px; }
.pl-writebar input { flex: 1; }
.pl-slides { display: flex; flex-direction: column; gap: 8px; }
.pl-slide { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.pl-slide-h { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: var(--panel-2); }
.pl-slide-h strong { flex: 1; }
.pl-slide-b { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; padding: 8px 10px; }
.pl-notes { color: var(--muted); }
.pl-q { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.pl-q .row { gap: 6px; }
.pl-opt { display: flex; align-items: center; gap: 6px; }
.pl-opt input[type=text] { flex: 1; }
.pl-md { background: var(--panel-2); border-radius: 10px; padding: 12px 16px; }
.pl-md-edit { width: 100%; font-family: Consolas, monospace; font-size: 13px; }
.pl-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px; }
.pl-wait .spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: plSpin 1s linear infinite; }
@keyframes plSpin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .plan-body { grid-template-columns: 1fr; } .pl-tree { position: static; max-height: none; } .pl-slide-b { grid-template-columns: 1fr; } }

/* ---- Video đặt tự do trên slide ---- */
.deck-preview { position: relative; }
.vlayer { position: absolute; pointer-events: none; }
.vbox { position: absolute; pointer-events: auto; cursor: move; border: 2px dashed #ff7a00; background: rgba(255, 122, 0, .12); border-radius: 4px; touch-action: none; user-select: none; }
.vbox:hover, .vbox.drag { background: rgba(255, 122, 0, .22); border-style: solid; }
.vbox.empty { border-color: #999; background: rgba(120, 120, 120, .15); }
.vbox-label { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(0,0,0,.65); color: #fff; padding: 2px 6px; border-radius: 4px; white-space: nowrap; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.vbox-h { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #ff7a00; border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; }
.media-box { margin-top: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; }
.media-row { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.media-pos { gap: 6px; flex-wrap: wrap; }
.vid-mini { width: 200px; border-radius: 6px; background: #000; }

/* ---- Icon hệ thống (SVG nét mảnh) ---- */
.ic { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.ico { width: 22px; height: 22px; display: inline-grid; place-items: center; color: var(--muted); }
#nav a.active .ico, #nav a:hover .ico { color: var(--accent); }
.me-name { display: flex; align-items: center; gap: 8px; }
#logout { display: inline-flex; align-items: center; gap: 4px; }
#logout .ic { width: 16px; height: 16px; }
.h1-ic { display: inline-block; width: 28px; height: 28px; vertical-align: -4px; margin-right: 10px; color: var(--accent); }
.tc-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tc-ic .ic { width: 24px; height: 24px; }
.tool-card:hover .tc-ic { background: var(--accent); color: #fff; }
.empty-ic { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-ic .ic { width: 32px; height: 32px; }
.attach-btn { display: inline-flex; align-items: center; justify-content: center; }
#new-chat .ic { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; }

.deck-del { display: inline-grid; place-items: center; padding: 6px; color: var(--muted); opacity: .55; }
.deck-del .ic { width: 16px; height: 16px; }
.job:hover .deck-del { opacity: 1; }
.deck-del:hover { color: var(--err, #c62828); border-color: var(--err, #c62828); background: var(--err-soft, #fdecea); }

/* ---- Tạo animation: đính kèm ở yêu cầu đầu tiên ---- */
.an-new { position: relative; }
.an-attach { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.an-attach .ic { width: 16px; height: 16px; }
.an-files { display: flex; flex-wrap: wrap; gap: 8px; }
.an-files:not(:empty) { margin-top: 10px; }
.an-file { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); max-width: 280px; }
.an-file img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.an-file .ic { width: 18px; height: 18px; margin: 0 4px; color: var(--muted); }
.an-file .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-file button { border: 0; background: none; padding: 2px 6px; }
.an-new .drop-overlay { position: absolute; inset: 0; border-radius: inherit; }

/* ---- 🎬 Dựng bài giảng ---- */
.lb { display: flex; flex-direction: column; height: 100vh; margin: -28px -32px -60px; background: var(--bg); }
.lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); flex-wrap: wrap; }
.lb-top #lb-title { flex: 1; min-width: 200px; font-weight: 700; font-size: 17px; border-color: transparent; background: transparent; }
.lb-top #lb-title:hover, .lb-top #lb-title:focus { border-color: var(--border); background: var(--bg); }
.lb-top select { width: auto; }
.lb-body { flex: 1; display: grid; grid-template-columns: 210px 1fr 330px; min-height: 0; }
.lb-scenes { border-right: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.lb-sc { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; position: relative; background: var(--bg); }
.lb-sc:hover { border-color: var(--accent); }
.lb-sc.on { border-color: var(--accent); background: var(--accent-soft); }
.lb-sc-n { width: 22px; height: 22px; border-radius: 6px; background: var(--panel-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.lb-sc.on .lb-sc-n { background: var(--accent); color: #fff; }
.lb-sc-b { min-width: 0; flex: 1; }
.lb-sc-t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sc-tools { position: absolute; right: 4px; bottom: 4px; display: none; gap: 2px; }
.lb-sc:hover .lb-sc-tools { display: flex; }
.lb-sc-tools button { border: 0; background: var(--panel); padding: 1px 5px; font-size: 11px; border-radius: 4px; }
.lb-add { display: flex; gap: 4px; margin-top: 6px; }
.lb-add select { flex: 1; min-width: 0; font-size: 12px; }
.lb-add .ic { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
.lb-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.lb-insert { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel); flex-wrap: wrap; align-items: center; }
.lb-stage-wrap { flex: 1; position: relative; min-height: 220px; background: #dfe2ea; overflow: hidden; }
.lb-stage { position: absolute; transform-origin: 0 0; box-shadow: 0 6px 30px rgba(0,0,0,.25); background: #fff; }
.ls-el.lb-edit { cursor: move; outline: 1px dashed transparent; }
.ls-el.lb-edit:hover { outline-color: rgba(8,98,136,.5); }
.ls-el.lb-sel { outline: 2px solid #086288 !important; }
.ls-text[contenteditable=true] { cursor: text; outline: 2px dashed #ffb400; }
.lb-h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid #086288; border-radius: 3px; z-index: 999; }
.lb-h-nw { left: -8px; top: -8px; cursor: nwse-resize; } .lb-h-n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.lb-h-ne { right: -8px; top: -8px; cursor: nesw-resize; } .lb-h-e { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.lb-h-se { right: -8px; bottom: -8px; cursor: nwse-resize; } .lb-h-s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.lb-h-sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .lb-h-w { left: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.lb-tl { border-top: 1px solid var(--border); background: var(--panel); padding: 8px 12px 10px; max-height: 34vh; overflow: auto; user-select: none; }
.lb-tl-ctl { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.lb-tl-grid { display: grid; grid-template-columns: 150px var(--w); position: relative; row-gap: 3px; }
.lb-tl-lab { font-size: 12px; padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-radius: 4px; }
.lb-tl-lab.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lb-ruler { position: relative; height: 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.lb-ruler span { position: absolute; top: 0; font-size: 10px; color: var(--muted); transform: translateX(-50%); }
.lb-track { position: relative; height: 22px; background: var(--panel-2); border-radius: 4px; cursor: pointer; }
.lb-track.on { background: var(--accent-soft); }
.lb-bar { position: absolute; top: 5px; height: 12px; border-radius: 3px; background: #c7cbe0; }
.lb-track.on .lb-bar { background: #a9a3f5; }
.lb-bar.lb-clock { background: #9ed7b6; }
.lb-dot { position: absolute; top: 3px; width: 14px; height: 14px; margin-left: -7px; background: #086288; transform: rotate(45deg); border-radius: 2px; cursor: ew-resize; }
.lb-cue { position: absolute; top: 2px; min-width: 16px; height: 18px; margin-left: -8px; padding: 0 3px; background: #ff9f1a; color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; display: grid; place-items: center; cursor: ew-resize; }
.lb-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #e53935; pointer-events: none; }
.lb-props { border-left: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 12px 14px 40px; font-size: 13px; }
.lb-props h3 { margin: 0 0 10px; font-size: 16px; }
.lb-sec { font-weight: 700; margin: 14px 0 6px; font-size: 13px; }
.lb-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.lb-f.wide { margin-top: 6px; }
.lb-f input, .lb-f select { font-size: 13px; padding: 5px 7px; color: var(--text); }
.lb-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lb-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.lb-colors { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.lb-sw { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--border); padding: 0; cursor: pointer; }
.lb-sw.on, .lb-colors input.on { outline: 2px solid #086288; outline-offset: 1px; }
.lb-sw.none { background: repeating-linear-gradient(45deg, #fff, #fff 4px, #eee 4px, #eee 8px); font-size: 12px; }
.lb-colors input[type=color] { width: 30px; height: 26px; padding: 0; border: 0; }
.lb-bgs { display: flex; gap: 4px; flex-wrap: wrap; }
.lb-cue-row { margin-top: 4px; }
.lb-cue-row select { width: auto; flex: 1; }
.lb-dlg { width: min(860px, 94vw); }
.lb-media, .lb-anims { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; max-height: 60vh; overflow: auto; }
.lb-anims { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.lb-mi, .lb-ai { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; text-align: left; font-size: 12px; }
.lb-mi:hover, .lb-ai:hover { border-color: var(--accent); }
.lb-mi img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #111; }
.lb-mi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-ai .an-thumb { width: 100%; pointer-events: none; }
.lb-ai .an-thumb iframe { transform: scale(calc(206 / 1280)); }

/* ---- Thanh menu thu gọn / mở rộng ---- */
.sidebar { transition: width .18s ease, padding .18s ease; overflow: hidden; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-bottom: 14px; }
.brand-row .brand { padding: 4px 8px; min-width: 0; }
.nav-toggle { flex-shrink: 0; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer; }
.nav-toggle:hover { background: var(--panel-2); color: var(--accent); }
.nav-toggle .ic { width: 20px; height: 20px; }
#nav a, .brand, #logout, .me-name { white-space: nowrap; }
.lbl { overflow: hidden; text-overflow: ellipsis; }
.shell.nav-collapsed .sidebar { width: 64px; padding: 16px 8px; }
.shell.nav-collapsed .lbl, .shell.nav-collapsed #ver, .shell.nav-collapsed .me-name span:not(.ico) { display: none; }
.shell.nav-collapsed .brand-row { flex-direction: column; gap: 10px; }
.shell.nav-collapsed .brand-row .brand { padding: 0; }
.shell.nav-collapsed #nav a { justify-content: center; padding: 10px 0; }
.shell.nav-collapsed .me { flex-direction: column; padding: 12px 0 0; gap: 10px; }
.shell.nav-collapsed .me-name { justify-content: center; }
@media (max-width: 860px) {
  .nav-toggle { display: none; }
  .brand-row { padding: 0; }
  .shell.nav-collapsed .sidebar { width: auto; }
  .shell.nav-collapsed .lbl { display: inline; }
}

/* ---- Slide master trong trình dựng ---- */
.lb-mhead { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 2px 0 4px; }
.lb-scenes > .sm, #lb-scene-list > .sm { width: 100%; margin-top: 4px; }
.lb-lay .lb-sc-n { font-size: 14px; }
.ls-el[data-ph]::before { content: attr(data-ph); position: absolute; left: 0; top: -20px; font: 600 12px "Segoe UI", sans-serif; color: #086288; background: rgba(227,242,251,.95); padding: 1px 6px; border-radius: 4px; pointer-events: none; z-index: 5; }
.ls-el[data-ph] { outline: 1px dashed rgba(8,98,136,.45); }
.ls-el.ls-locked { pointer-events: none; }
.lb-phnote { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 10px; font-size: 12px; margin-bottom: 8px; }
.lb-tpls { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 60vh; overflow: auto; }
.lb-tpl { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
#lb-master.primary { color: #fff; }

.stale-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: #fff4d6; color: #6b4a00; border-bottom: 1px solid #f0c75e; padding: 8px 16px; font-size: 14px; text-align: center; }
.stale-banner .sm { margin-left: 8px; }

/* ---- Thư viện mẫu slide ---- */
.tp-card + .tp-card { margin-top: 16px; }
.tp-title { font-size: 17px; font-weight: 700; border-color: transparent; background: transparent; padding: 4px 6px; width: 100%; }
.tp-title:hover:not(:disabled), .tp-title:focus { border-color: var(--border); background: var(--bg); }
.tp-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 12px; margin-top: 12px; }
.tp-thumb { display: flex; flex-direction: column; gap: 4px; }
.tp-stage { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.tp-stage .ls-scene { transform-origin: 0 0; transform: scale(var(--k, .1625)); pointer-events: none; }
.tp-stage .ls-el[data-ph] { outline: none; }
.tp-cap { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-tplbar { background: #fff4d6; color: #6b4a00; padding: 6px 14px; font-size: 13px; border-bottom: 1px solid #f0c75e; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn .ic, button .ic { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }

/* ---- Trình dựng: nâng cấp thao tác ---- */
.lb-body { grid-template-columns: 200px 1fr 340px; }
.lb-sct { flex-direction: column; gap: 4px; padding: 6px; }
.lb-thumb { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.lb-thumb-st { position: absolute; inset: 0; }
.lb-thumb-st .ls-scene { transform-origin: 0 0; transform: scale(var(--k, .13)); pointer-events: none; }
.lb-thumb-st .ls-el[data-ph] { outline: none; }
.lb-thumb .lb-sc-n { position: absolute; left: 4px; top: 4px; z-index: 2; width: 20px; height: 20px; font-size: 11px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.lb-badges { position: absolute; right: 3px; bottom: 3px; z-index: 2; display: flex; gap: 2px; }
.lb-badges i { font-style: normal; font-size: 11px; background: rgba(255,255,255,.9); border-radius: 4px; padding: 0 2px; }
.lb-badges i.pend { opacity: .45; }
.lb-sct .lb-sc-t { font-size: 12px; font-weight: 500; padding: 0 2px; }
.lb-sct .lb-sc-tools { top: 8px; right: 8px; bottom: auto; }
.lb-sc.drop-b { box-shadow: 0 -3px 0 #086288; }
.lb-sc.drop-a { box-shadow: 0 3px 0 #086288; }
.lb-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px -4px 10px; position: sticky; top: -12px; background: var(--panel); z-index: 3; padding-top: 4px; }
.lb-tab { border: 0; background: none; padding: 7px 9px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; cursor: pointer; }
.lb-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.lb-guide { position: absolute; background: #ff2d87; z-index: 9999; pointer-events: none; }
.lb-guide.v { top: 0; bottom: 0; width: 1px; }
.lb-guide.h { left: 0; right: 0; height: 1px; }
.lb-stage-wrap.drop { outline: 3px dashed #086288; outline-offset: -6px; }
.lb-ftb { position: fixed; z-index: 10000; display: flex; gap: 2px; align-items: center; background: #1f2330; padding: 4px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.lb-ftb button { background: none; border: 0; color: #fff; min-width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 13px; padding: 0 6px; }
.lb-ftb button:hover { background: #343a4f; }
.lb-ftb .sep { width: 1px; height: 18px; background: #444b60; margin: 0 3px; }
.lb-rv { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; pointer-events: none; }
.lb-rvrow { gap: 6px; margin-top: 4px; }
.lb-rvrow input { width: 70px; }
.lb-rvrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.lb-algrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.lb-alignrow .sm { padding: 2px 8px; }
.lb-keys { line-height: 1.8; }
.lb-tr { max-height: 200px; overflow: auto; margin-top: 4px; }
.lb-pv { position: fixed; inset: 0; z-index: 9990; background: #0f1117; display: flex; flex-direction: column; }
.lb-pv-vp { flex: 1; position: relative; overflow: hidden; }
.lb-pv-st { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: 0 0; }
.lb-pv-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: #1a1d27; color: #c9cddc; font-size: 13px; }
.lb-pv-bar button { background: #2a2e3c; color: #fff; border: 0; border-radius: 8px; width: 40px; height: 34px; cursor: pointer; }
.lb-pv-bar button.on { background: #ffb400; color: #1a1d27; }
.lb-pv-seek { flex: 1; height: 8px; background: #2f3446; border-radius: 4px; cursor: pointer; position: relative; }
.lb-pv-seek div { position: absolute; left: 0; top: 0; bottom: 0; background: #ffb400; border-radius: 4px; }

/* ===================== Giao diện kiểu PowerPoint (dùng chung: Dựng bài giảng, Thiết kế slide) ===================== */
.pp { --pp-rib: #eef4f8; --pp-tab: #fff; --pp-acc: #086288; }
@media (prefers-color-scheme: dark) { .pp { --pp-rib: #132a37; --pp-tab: #0f2230; } }
.pp-title { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--pp-acc); color: #fff; }
.pp-title .pp-back { color: #fff; text-decoration: none; font-size: 18px; padding: 0 6px; }
.pp-title .pp-app .ic { width: 20px; height: 20px; color: #fff; }
.pp-q { background: none; border: 0; color: #fff; font-size: 16px; width: 30px; height: 28px; border-radius: 4px; cursor: pointer; }
.pp-q:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.pp-q:disabled { opacity: .45; }
.pp-title #lb-title, .pp-title #dk-title { background: transparent; border: 1px solid transparent; color: #fff; font-weight: 600; font-size: 15px; max-width: 520px; flex: 0 1 520px; text-align: center; }
.pp-title #lb-title:hover, .pp-title #lb-title:focus, .pp-title #dk-title:hover, .pp-title #dk-title:focus { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.1); }
.pp-title #lb-save, .pp-title #dk-save { color: rgba(255,255,255,.85) !important; }
.pp-show { background: #fff; color: var(--pp-acc); border: 0; border-radius: 4px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.pp-ribbon { background: var(--pp-rib); border-bottom: 1px solid var(--border); }
.pp-tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--pp-rib); }
.pp-tab { border: 0; background: none; padding: 7px 14px; font-size: 13px; color: var(--text); border-radius: 4px 4px 0 0; cursor: pointer; border-bottom: 3px solid transparent; }
.pp-tab:hover { background: rgba(0,0,0,.05); }
.pp-tab.on { color: var(--pp-acc); border-bottom-color: var(--pp-acc); font-weight: 600; background: var(--pp-tab); }
.pp-panel { display: flex; align-items: stretch; gap: 0; padding: 6px 8px 4px; background: var(--pp-tab); min-height: 92px; overflow-x: auto; }
.pp-panel[hidden] { display: none; }
.rg { display: flex; flex-direction: column; padding: 0 10px; border-right: 1px solid var(--border); flex-shrink: 0; }
.rg:last-child { border-right: 0; }
.rg-i { flex: 1; display: flex; gap: 4px; align-items: flex-start; }
.rg-l { font-size: 11px; color: var(--muted); text-align: center; padding-top: 3px; white-space: nowrap; }
.rb { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px solid transparent; border-radius: 4px; padding: 3px 7px; font-size: 12.5px; color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; }
.rb:hover:not(:disabled) { background: rgba(0,0,0,.06); border-color: var(--border); }
.rb.on { background: #fbe3dd; border-color: #e7a291; }
.rb:disabled { opacity: .4; cursor: default; }
.rb.primary { background: var(--accent); color: #fff; }
.rb.big { flex-direction: column; justify-content: flex-start; min-width: 58px; padding: 4px 6px; gap: 2px; }
.rb.big .rb-i { font-size: 24px; line-height: 30px; }
.rb.big .rb-l { font-size: 12px; text-align: center; max-width: 76px; white-space: normal; line-height: 1.15; }
.rb.sq { width: 28px; height: 26px; justify-content: center; padding: 0; }
.rb.gal { flex-direction: column; width: 66px; height: 66px; border: 1px solid var(--border); background: var(--bg); justify-content: center; gap: 2px; }
.rb.gal .rb-i { font-size: 22px; }
.rb.gal .rb-l { font-size: 11px; white-space: normal; text-align: center; line-height: 1.1; }
.rb.gal.on { border-color: var(--pp-acc); box-shadow: inset 0 0 0 1px var(--pp-acc); background: #e3f2fb; }
.rb-gallery { gap: 6px; }
.rb-col { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.rb-row { display: flex; gap: 2px; align-items: center; }
.rb-wrap { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 4px; align-content: start; }
.rb-font { flex-direction: column; gap: 4px; }
.rb-font select { width: 150px; font-size: 12.5px; padding: 3px 5px; }
.rb-font input[type=number] { width: 56px; font-size: 12.5px; padding: 3px 5px; }
.rb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rb-sw { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--border); padding: 0; cursor: pointer; margin: 0 1px; }
.rb-sw.on { outline: 2px solid var(--pp-acc); outline-offset: 1px; }
.rb-sel { font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.rb-sel select, .rb-sel input { font-size: 12.5px; padding: 3px 5px; width: auto; }
.rb-chk { font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.rb-drop { position: relative; }
.rb-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 50; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; min-width: 190px; }
.rb-menu.open { display: block; }
.rb-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text); }
.rb-menu button:hover { background: var(--accent-soft); }
.rb-themes { display: flex; gap: 6px; max-width: 640px; overflow-x: auto; }
.rb-theme { display: grid; grid-template-columns: repeat(3, 18px); grid-template-rows: 22px auto; gap: 3px; padding: 5px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); cursor: pointer; width: 92px; }
.rb-theme .sw { width: 18px; height: 22px; border-radius: 3px; }
.rb-theme .tn { grid-column: 1 / -1; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.rb-theme.on { border-color: var(--pp-acc); box-shadow: inset 0 0 0 1px var(--pp-acc); }
.pp .lb-body, .pp .deck-body { flex: 1; min-height: 0; }
.lb-body.no-props { grid-template-columns: 200px 1fr 0; }
.lb-body.no-props .lb-props { display: none; }
.lb-sizer { position: relative; }
.lb-stage-wrap { overflow: auto; background: #e6e6e6; }
@media (prefers-color-scheme: dark) { .lb-stage-wrap { background: #191b22; } }
.lb-stage.lb-grid-on::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 9998;
  background-image: linear-gradient(rgba(8,98,136,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(8,98,136,.18) 1px, transparent 1px); background-size: 40px 40px; }
.pp-bottom { border-top: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; height: 21vh; min-height: 120px; max-height: 42vh; overflow: hidden; }
.pp-bottom[hidden] { display: none; }
.pp-btabs { display: flex; align-items: center; gap: 2px; padding: 2px 8px; border-bottom: 1px solid var(--border); }
.pp-btab { border: 0; background: none; padding: 5px 10px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.pp-btab.on { color: var(--pp-acc); border-bottom-color: var(--pp-acc); font-weight: 600; }
.pp-bx { border: 0; background: none; cursor: pointer; color: var(--muted); }
.pp-bpanel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.pp-bpanel[hidden] { display: none; }
.pp-bpanel .lb-tl { border-top: 0; max-height: none; flex: 1; }
#lb-notes, #dk-notes { flex: 1; border: 0; resize: none; padding: 10px 14px; font-size: 14px; line-height: 1.5; background: var(--panel); color: var(--text); min-height: 60px; }
#lb-notes:focus, #dk-notes:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); }
.pp-nbar { display: flex; gap: 10px; align-items: center; padding: 4px 12px 6px; }
.pp-status { display: flex; align-items: center; gap: 6px; padding: 3px 12px; background: var(--pp-rib); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pp-sep { width: 1px; height: 14px; background: var(--border); margin: 0 4px; }
.pp-sb { background: none; border: 0; padding: 2px 7px; border-radius: 4px; cursor: pointer; font-size: 12px; color: var(--text); }
.pp-sb:hover { background: rgba(0,0,0,.07); }
.pp-sb.on { background: #fbe3dd; color: var(--pp-acc); }
#pp-zoom { width: 110px; }
#lb-mode, #dk-mode { color: var(--muted); }
.pp .lb-tl-ctl .small.muted:last-child { display: none; }

/* ---- Thiết kế slide kiểu PowerPoint ---- */
.dkpp { display: flex; flex-direction: column; height: 100vh; margin: -28px -32px -60px; max-width: none; }
.dk-body { display: grid !important; grid-template-columns: 210px 1fr 400px; gap: 0 !important; min-height: 0; }
.dk-body.no-props { grid-template-columns: 210px 1fr 0; }
.dk-body.no-props .dk-side { display: none; }
.dk-body .deck-list { position: static; max-height: none; height: 100%; overflow: auto; border-right: 1px solid var(--border); border-radius: 0; background: var(--panel); }
.dk-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #e6e6e6; }
@media (prefers-color-scheme: dark) { .dk-center { background: #191b22; } }
.dk-stagewrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; position: relative; }
.dk-stagewrap .deck-preview { width: min(100%, calc((100vh - 360px) * 16 / 9)); margin: 0; box-shadow: 0 6px 30px rgba(0,0,0,.2); border-radius: 2px; border: 0; background: #fff; }
.dk-stale { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); margin: 0 !important; z-index: 5; }
.dk-side { border-left: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 12px 14px 40px; }
.dk-side #dk-meta { margin-bottom: 12px; }
.dk-side .slide-fields { gap: 10px; }
.dkpp .dk-pv img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; }
.dkpp + .lb-pv .dk-pv img, .lb-pv .dk-pv img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; cursor: pointer; }

/* sửa: khung kiểu PowerPoint luôn vừa màn hình (không tràn đẩy thanh trạng thái) */
.dk-body, .lb-body { align-items: stretch !important; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.dk-body > *, .lb-body > * { min-height: 0; }
.dk-center { overflow: hidden; }
.dk-stagewrap { overflow: hidden; }
.dk-stagewrap .deck-preview { width: auto; flex: none; }
.dkpp .pp-bottom { flex: none; }
.dkpp .pp-status, .pp .pp-status { flex: none; }

/* ---- 🎯 Ghép hiệu ứng theo voice ---- */
.sy-ov { position: fixed; inset: 0; z-index: 9995; background: rgba(15,17,23,.55); display: grid; place-items: center; }
.sy-box { background: var(--panel); color: var(--text); border-radius: 14px; width: min(980px, 96vw); max-height: 92vh; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.sy-help { font-size: 12.5px; color: var(--muted); background: var(--panel-2); border-radius: 8px; padding: 8px 12px; line-height: 1.6; }
.sy-help kbd, .sy-mark kbd { font: 600 11px Consolas, monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; color: var(--text); }
.sy-hl { background: #fff2b3; color: #6b4a00; padding: 0 4px; border-radius: 3px; }
.sy-player { display: flex; gap: 8px; align-items: center; }
.sy-player .sy-time { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 130px; }
.sy-player select { width: auto; }
.sy-mark { margin-left: auto; font-size: 15px; padding: 8px 18px; }
.sy-wave { position: relative; height: 84px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; overflow: hidden; }
.sy-wave canvas { display: block; }
.sy-ph { position: absolute; top: 0; bottom: 0; width: 2px; background: #e53935; pointer-events: none; }
.sy-list { overflow: auto; max-height: 42vh; border: 1px solid var(--border); border-radius: 8px; }
.sy-row { display: flex; gap: 8px; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.sy-row:last-child { border-bottom: 0; }
.sy-row.li { padding-left: 26px; }
.sy-row.cur { background: #fff2b3; color: #3d2c00; }
.sy-row .sy-lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.sy-row input[type=number] { width: 76px; }

/* ---------- 🚀 Sản xuất học liệu (Flow) ---------- */
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; font-weight: 600; }
.shell.nav-collapsed .nav-sec { padding: 6px 0; border-top: 1px solid var(--border); margin: 6px 8px 0; }
.fl-hero { display: flex; align-items: center; gap: 16px; color: var(--text); margin-bottom: 18px; border: 1.5px solid var(--accent); background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 9%, var(--panel)), var(--panel)); }
.fl-hero:hover { transform: translateY(-1px); }
.home-sec { font-size: 15px; margin: 4px 0 10px; color: var(--muted); }
.fl-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 16px; }
.fl-step { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; }
button.fl-step { cursor: pointer; }
.fl-step small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.fl-step .fl-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--border); color: var(--muted); }
.fl-step.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.fl-step.on .fl-n { background: var(--accent); color: #fff; }
.fl-step.past .fl-n { background: var(--ok); color: #fff; }
.fl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fl-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--panel); }
.fl-card:hover { border-color: var(--accent); }
.fl-mini { display: flex; align-items: center; gap: 4px; }
.fl-mini > span:not(.small) { width: 22px; height: 5px; border-radius: 3px; background: var(--border); }
.fl-mini > span.on { background: var(--accent); }
.fl-mini .small { margin-left: 6px; color: var(--muted); }
.fl-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.fl-bar.big { height: 9px; }
.fl-bar > div { height: 100%; background: var(--ok); transition: width .3s; }
.fl-head { gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.fl-les { border-top: 1px solid var(--border); padding: 8px 0; }
.fl-lt { font-weight: 600; padding: 4px 0; gap: 8px; }
.fl-act { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 8px; }
.fl-act.off { opacity: .5; }
.fl-act2 select { margin-left: auto; max-width: 180px; }
.fl-num { color: var(--muted); font-size: 12px; min-width: 26px; }
.fl-at { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-act .fl-at { flex: 1; }
.fl-prow { padding: 8px 0 8px 8px; border-bottom: 1px dashed var(--border); }
.fl-prow:last-child { border-bottom: 0; }
.fl-pmain { display: flex; align-items: center; gap: 8px; }
.fl-ico { font-size: 18px; }
.fl-pst { font-weight: 600; border-width: 1.5px; }
.fl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0 0 34px; }
.fl-out { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 12.5px; }
.fl-out small { color: var(--muted); }
.fl-out button { border: 0; background: none; padding: 0 4px; cursor: pointer; color: var(--muted); }
.fl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.fl-filter { display: flex; gap: 4px; }
.pp-proj { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.18); color: inherit; }
.pp-proj .ic { width: 14px; height: 14px; }
@media (max-width: 900px) { .fl-steps { grid-template-columns: 1fr 1fr; } }
.fl-page select { width: auto; }
.fl-pst { flex: none; min-width: 120px; }
.fl-act2 select { flex: none; width: 180px; }
.fl-lt label { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.fl-lt label select { width: 160px; }
.fl-demo { gap: 12px; padding: 10px 14px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); }
/* Flow: bảng dự án, trang tạo, kanban việc */
.fl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.fl-stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); }
.fl-stat > span { grid-row: 1 / 3; font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); }
.fl-stat b { font-size: 22px; line-height: 1.1; }
.fl-stat small { color: var(--muted); }
a.fl-stat:hover { border-color: var(--accent); }
.fl-table-card { padding: 14px 16px; }
.fl-toolbar { gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fl-seg { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 3px; gap: 2px; }
.fl-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.fl-seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.fl-table { width: 100%; border-collapse: collapse; }
.fl-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.fl-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fl-table tbody tr { cursor: pointer; }
.fl-table tbody tr:hover { background: var(--panel-2); }
.fl-table tr:last-child td { border-bottom: 0; }
.fl-pname { font-weight: 600; color: var(--text); }
.fl-acts { white-space: nowrap; text-align: right; }
.fl-acts > * + * { margin-left: 4px; }
.fl-avs { display: flex; }
.fl-av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--accent); color: #fff; border: 2px solid var(--panel); }
.fl-avs .fl-av + .fl-av { margin-left: -6px; }
.fl-empty { text-align: center; padding: 36px 16px; }
.fl-empty h3 { margin: 8px 0 4px; }
.fl-h { font-size: 14px; margin: 18px 0 10px; color: var(--accent); }
.fl-h:first-child { margin-top: 0; }
.fl-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin-top: 10px; }
.fl-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.fl-mode { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; text-align: left; padding: 14px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.fl-mode span { grid-row: 1 / 3; font-size: 24px; }
.fl-mode small { color: var(--muted); }
.fl-mode.on { border-color: var(--accent); background: var(--accent-soft); }
.tk-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.tk-col { background: var(--panel-2); border-radius: var(--radius); padding: 10px; min-height: 240px; border: 2px solid transparent; }
.tk-col.over { border-color: var(--accent); }
.tk-head { display: flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13.5px; padding: 2px 4px 10px; }
.tk-n { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--panel); border-radius: 99px; padding: 1px 8px; }
.tk-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.tk-card:hover { border-color: var(--accent); }
.tk-card.dragging { opacity: .4; }
.tk-proj { font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-title { font-weight: 600; margin: 2px 0; }
.tk-meta { gap: 6px; margin-top: 8px; }
.tk-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 20px 0; border: 1.5px dashed var(--border); border-radius: 10px; }
@media (max-width: 900px) { .fl-stats, .tk-board { grid-template-columns: 1fr 1fr; } .fl-modes { grid-template-columns: 1fr; } }
#tk-proj { width: auto; min-width: 260px; }

/* ---------- 📝 Bài tập & đề thi ---------- */
.as-modal { position: fixed; inset: 0; background: rgba(15, 18, 30, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.as-dlg { width: min(560px, 100%); max-height: 92vh; overflow: auto; }
.as-dlg.wide { width: min(940px, 100%); }
.as-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.as-body { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.as-side { position: sticky; top: 12px; padding: 14px; max-height: calc(100vh - 40px); overflow: auto; }
.as-t { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: 8px; color: var(--text); font-size: 13.5px; }
.as-t span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-t b { font-size: 12px; color: var(--muted); font-weight: 600; }
.as-t:hover { background: var(--panel-2); }
.as-t.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.as-mx { width: 100%; border-collapse: collapse; font-size: 12.5px; text-align: center; }
.as-mx th, .as-mx td { padding: 3px; border-bottom: 1px solid var(--border); }
.as-mx td.z { color: var(--border); }
.as-main { padding: 14px 16px; min-width: 0; }
.as-filter { gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.as-filter select { width: auto; }
.as-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); margin-bottom: 10px; font-size: 13.5px; }
.as-bulk select { width: auto; }
.as-count { padding: 4px 2px 8px; }
.as-q { display: flex; gap: 10px; padding: 12px 8px; border-top: 1px solid var(--border); }
.as-q.sel { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.as-q .as-ck { margin-top: 4px; }
.as-qb { flex: 1; min-width: 0; }
.as-qm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.as-qm .sm { padding: 3px 8px; }
.as-stem { font-weight: 500; white-space: pre-wrap; margin: 2px 0 6px; }
.as-stem1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-opts { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 2px; font-size: 14px; }
.as-opts li { padding: 2px 8px; border-radius: 6px; }
.as-opts li.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.as-ds { display: inline-block; width: 20px; text-align: center; border-radius: 4px; font-size: 12px; font-weight: 700; color: #fff; }
.as-ds.t { background: var(--ok); } .as-ds.f { background: var(--err); }
.as-ans { font-size: 14px; }
.as-exp { font-size: 13px; color: var(--muted); margin-top: 6px; }
.as-lv { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.as-tp { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.as-rev { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); }
.as-job { display: flex; gap: 10px; align-items: center; min-width: 320px; }
.as-job > div { flex: 1; }
.as-menu { position: relative; }
.as-pop { display: none; position: absolute; right: 0; top: 100%; z-index: 10; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 170px; }
.as-pop a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.as-pop a:hover { background: var(--panel-2); }
.as-menu:hover .as-pop, .as-menu:focus-within .as-pop { display: block; }
.as-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.as-types button { font-size: 13px; padding: 6px 10px; }
.as-types button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.as-oe { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.as-oe input[type=text] { flex: 1; }
.as-pair b { color: var(--muted); }
.as-L { flex: none; width: 34px; height: 34px; padding: 0; border-radius: 50%; font-weight: 700; }
.as-L.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.as-L.off { background: var(--err); border-color: var(--err); color: #fff; }
.as-tfb { min-width: 110px; font-weight: 600; }
.as-tfb.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.as-g4 { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; }
.as-src { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.as-src span:first-child { flex: 1; }
.as-srcbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); margin: 10px 0; font-size: 13.5px; }
.as-srcbar select { width: auto; max-width: 220px; }
.as-gen { width: 100%; border-collapse: collapse; }
.as-gen th { font-size: 12px; color: var(--muted); text-align: left; padding: 6px; border-bottom: 1px solid var(--border); }
.as-gen td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.as-gen select, .as-gen input[type=text] { width: 100%; }
.as-n { width: 64px; }
.as-n.bad { border-color: var(--err); color: var(--err); }
.as-have { font-size: 11px; color: var(--muted); margin-top: 2px; }
.as-have.bad { color: var(--err); font-weight: 600; }
.as-mtx tfoot td { border-bottom: 0; padding-top: 10px; }
.as-imp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 14px; }
.as-imp > div { padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.as-title { font: inherit; font-size: 22px; font-weight: 700; border: 1px solid transparent; background: none; padding: 2px 6px; border-radius: 8px; width: 100%; color: var(--text); }
.as-title:hover, .as-title:focus { border-color: var(--border); background: var(--panel); }
.as-xbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 8px 0 12px; }
.as-xbar select { width: auto; max-width: 280px; }
.as-sum { font-size: 13px; color: var(--muted); }
.as-part { margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--accent-soft); }
.as-part:first-child { margin-top: 0; }
.as-xq { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--border); }
.as-qn { font-weight: 700; width: 58px; flex: none; color: var(--accent); }
.as-pk { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.as-pki { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.as-pki:hover { background: var(--panel-2); }
.as-set { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.as-exp { display: grid; gap: 10px; }
.as-exp-c { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.as-exp-i { font-size: 26px; width: 48px; height: 48px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 12px; flex: none; }
a.btn.disabled { pointer-events: none; opacity: .5; }
@media (max-width: 900px) { .as-body, .as-set, .as-imp { grid-template-columns: 1fr; } .as-side { position: static; } }
.as-gen input[type=number] { width: 72px; }
.as-gen td:first-child { min-width: 210px; }
.as-gen td:nth-child(2) { min-width: 150px; }
