/* Giao diện tối, một tông: nền xanh mực, chữ ngà, điểm nhấn màu nắng chiều (hổ phách → san hô). */
:root {
  color-scheme: dark;
  --bg: #0b0d12; --bg-2: #11141b; --panel: #161a23; --panel-2: #1d2230; --line: #262c3b; --line-2: #343c50;
  --fg: #eef0f4; --fg-2: #b4bac8; --muted: #7d8598;
  --accent: #ffb23e; --accent-2: #ff7a59; --accent-ink: #1a1206;
  --grad: linear-gradient(100deg, #ffc24d 0%, #ff8a55 100%);
  --ok: #4fd39a; --warn: #f5b84a; --bad: #ff6b6b; --info: #6fb3ff;
  --r-s: 8px; --r: 12px; --r-l: 18px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Be Vietnam Pro', system-ui, sans-serif;
  --side: 232px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(143, 220, 78, .35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: #1f2d21; border-color: #3d5440; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--fg); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--fg-2); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---- ô nhập */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12.5px; color: var(--fg-2); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-s); }
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(143, 220, 78, .15); }
.input::placeholder { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.err { color: var(--bad); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--panel-2); color: var(--fg-2); }
.badge.top { background: var(--grad); color: var(--accent-ink); }
.badge.new { background: rgba(111, 179, 255, .16); color: var(--info); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--panel-2); color: var(--fg-2); white-space: nowrap; }
.pill.ok { color: var(--ok); background: rgba(79, 211, 154, .12); }
.pill.bad { color: var(--bad); background: rgba(255, 107, 107, .12); }
.pill.warn { color: var(--warn); background: rgba(245, 184, 74, .12); }
.pill.info { color: var(--info); background: rgba(111, 179, 255, .12); }

/* ---- khung ứng dụng */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100%; }
.side { display: flex; flex-direction: column; gap: 4px; padding: 18px 12px 14px; background: var(--bg-2); border-right: 1px solid var(--line); min-height: 0; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font: 600 15px var(--display); color: var(--fg); letter-spacing: -.01em; }
.logo:hover { text-decoration: none; }
.logo svg { width: 26px; height: 26px; flex: none; }
.nav { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 10px; border-radius: 9px; border: 0; background: none; color: var(--fg-2); cursor: pointer; font-weight: 500; text-align: left; width: 100%; }
.nav:hover { background: var(--panel); color: var(--fg); text-decoration: none; }
.nav.on { background: var(--panel-2); color: var(--fg); }
.nav.on svg { color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.side .grow { flex: 1; }
.wallet { margin-top: 8px; padding: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); display: grid; gap: 10px; }
.wallet small { color: var(--muted); font-size: 12px; }
.wallet b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; overflow-y: auto; }
.page { max-width: 1080px; margin: 0 auto; padding: 28px 28px 60px; display: grid; gap: 22px; }
.page > header h1 { font-size: 22px; font-weight: 600; }
.page > header p { color: var(--muted); margin-top: 6px; }
.tabbar { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stack { display: grid; gap: 12px; }

/* ---- trang tạo: lưới video + ô soạn dính đáy */
#v-create { display: flex; flex-direction: column; overflow: hidden; }
.feed-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 8px; }
.feed-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.feed-head h1 { font-size: 18px; font-weight: 600; }
.notice ul { margin: 6px 0 0; padding-left: 18px; } .notice li + li { margin-top: 2px; }
.notice { margin-bottom: 14px; padding: 10px 14px; border-radius: var(--r-s); background: rgba(143, 220, 78, .08); border: 1px solid rgba(143, 220, 78, .25); color: #d6f2b0; font-size: 13px; }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; }
.job { position: relative; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.job .thumb { position: relative; aspect-ratio: 16 / 10; background: #050806; cursor: pointer; overflow: hidden; }
.job .thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.job .thumb .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .15s; }
.job .thumb:hover .play { opacity: 1; }
.job .thumb .play svg { width: 44px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .6)); }
.job .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, .7); font-size: 11.5px; }
.job .body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.job .title { font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.job .title .p { color: var(--fg-2); font-weight: 500; font-size: 12.5px; }
.job .meta { color: var(--muted); font-size: 12px; }
.job .prompt { color: var(--fg-2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.job .state { aspect-ratio: 16 / 10; display: grid; place-items: center; align-content: center; gap: 10px; padding: 16px; text-align: center; background: radial-gradient(120% 90% at 50% 0%, #152318 0%, #080d09 70%); }
.job .state strong { font-size: 13.5px; font-weight: 600; }
.job .state small { color: var(--muted); font-size: 12px; max-width: 30ch; }
.job.failed .state { background: radial-gradient(120% 90% at 50% 0%, #2a171a 0%, #080d09 70%); }
.job.failed .state strong { color: var(--bad); }
.bar { width: min(180px, 80%); height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 30%; border-radius: 4px; background: var(--grad); transition: width 1s linear; }
.bar.wait i { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 9vh 16px; color: var(--muted); }
.empty h2 { color: var(--fg); font-size: 20px; font-weight: 600; }
.empty .ideas { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 720px; margin-top: 8px; }
.idea { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg-2); cursor: pointer; font-size: 13px; text-align: left; }
.idea:hover { border-color: var(--accent); color: var(--fg); }

.composer-wrap { padding: 8px 24px 18px; background: linear-gradient(180deg, transparent, var(--bg) 26%); }
.composer { max-width: 980px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 12px 14px 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .45); display: grid; gap: 10px; }
.composer:focus-within { border-color: #4a644c; }
.modes { display: flex; gap: 4px; flex-wrap: wrap; }
.mode { height: 30px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; font-size: 13px; }
.mode:hover { color: var(--fg); }
.mode.on { background: var(--panel-2); color: var(--fg); }
.c-main { display: flex; gap: 12px; align-items: flex-start; }
.slots { display: flex; gap: 8px; flex-wrap: wrap; max-width: 46%; }
.slots:empty { display: none; }
.slot { position: relative; width: 76px; height: 76px; border-radius: 10px; border: 1px dashed var(--line-2); background: var(--bg-2); display: grid; place-items: center; align-content: center; gap: 2px; cursor: pointer; color: var(--muted); font-size: 11px; text-align: center; overflow: hidden; flex: none; padding: 0; }
.slot:hover, .slot.drag { border-color: var(--accent); color: var(--fg); }
.slot svg { width: 18px; height: 18px; }
.slot.filled { border-style: solid; cursor: default; }
.slot img, .slot video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .tag { position: absolute; left: 4px; bottom: 4px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 10.5px; font-weight: 600; cursor: pointer; }
.slot .x { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 12px; line-height: 1; padding: 0; }
.slot .prog { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--accent); transform-origin: left; }
.slot.audio { background: var(--panel-2); }
.slot.bad { border-color: var(--bad); color: var(--bad); }
#prompt { flex: 1; min-width: 0; min-height: 76px; max-height: 240px; padding: 6px 2px; border: 0; background: transparent; resize: none; outline: none; font-size: 14.5px; line-height: 1.55; }
#prompt::placeholder { color: var(--muted); }
.c-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-weight: 500; font-size: 13px; max-width: 100%; }
.chip:hover { border-color: #4a644c; }
.chip svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-bar .sp { flex: 1; }
.c-bar .cost { font-size: 12px; color: var(--muted); }
#go { min-width: 132px; }
/* Giá mỗi giây + nút Tạo đi thành một cụm, luôn ở bên phải: thanh có xuống dòng thì cả cụm xuống cùng nhau
   (user 18/11/2026: chữ cài đặt dài "480p · 15 giây · Tự động · Tắt tiếng" đẩy nút Tạo xuống dòng, lệch sang trái). */
.c-go { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.c-bar .cost { white-space: nowrap; }
.composer { grid-template-columns: minmax(0, 1fr); }   /* cột lưới không nở theo nội dung, để thanh công cụ co trong khung */
@media (min-width: 1280px) {   /* ô soạn đủ rộng (980px): một hàng, nút gọn lại một chút để chữ hiện đủ; chật quá thì chỉ ô cài đặt rút gọn "…" */
  .c-bar { flex-wrap: nowrap; gap: 6px; }
  .c-bar .sp { display: none; }
  .c-bar .chip { padding: 0 9px; gap: 6px; }
  .c-bar #go { min-width: 0; padding: 0 18px; }
  .c-bar > * { flex-shrink: 0; }
  .c-bar #setChip { flex-shrink: 1; min-width: 90px; }
}

/* ---- hộp nổi */
.pop { position: fixed; z-index: 40; width: min(340px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); padding: 14px; display: grid; gap: 14px; max-height: min(560px, calc(100vh - 24px)); overflow-y: auto; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 9px; background: var(--bg-2); }
.seg.wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.seg button { white-space: nowrap; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--fg-2); cursor: pointer; font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--panel-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg .ar { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.range { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.range input[type=range] { width: 100%; accent-color: var(--accent); }
.range output { min-width: 62px; text-align: right; font-weight: 600; }
.switch { display: flex; justify-content: space-between; gap: 12px; align-items: center; cursor: pointer; }
.switch div { display: grid; gap: 2px; }
.switch small { color: var(--muted); font-size: 12px; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
details.adv summary { cursor: pointer; color: var(--fg-2); font-size: 13px; }
details.adv[open] summary { margin-bottom: 10px; }

/* ---- hộp thoại */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 4, .72); backdrop-filter: blur(6px); }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
.dialog.wide { width: min(1040px, 100%); }
.dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.dialog > header h2 { font-size: 16px; font-weight: 600; }
.dialog > .content { padding: 16px 18px 18px; display: grid; gap: 14px; }
.dialog > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 0 18px 18px; }
.models { display: grid; gap: 4px; max-height: min(58vh, 560px); overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.model { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 11px 12px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; text-align: left; width: 100%; }
.model:hover { background: var(--panel-2); }
.model.on { border-color: var(--accent); background: rgba(143, 220, 78, .06); }
.model .n { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.model .b { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.model .caps { display: flex; gap: 5px; flex-wrap: wrap; grid-column: 1; margin-top: 3px; }
.model .from { grid-row: 1 / span 3; grid-column: 2; align-self: center; text-align: right; font-size: 12px; color: var(--muted); }
.model .from b { display: block; font-size: 14px; color: var(--fg); font-weight: 600; }
.viewer { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); }
.viewer .stage { background: #000; display: grid; place-items: center; min-height: 300px; border-radius: var(--r-l) 0 0 var(--r-l); overflow: hidden; }
.viewer video { max-width: 100%; max-height: calc(100vh - 64px); display: block; }
.viewer .info { padding: 18px; display: grid; gap: 14px; align-content: start; max-height: calc(100vh - 34px); overflow-y: auto; }
.viewer .info h2 { font-size: 16px; font-weight: 600; padding-right: 30px; }
.viewer .info pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.55 var(--font); color: var(--fg-2); max-height: 220px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--bg-2); }
.viewer .close { position: absolute; top: 10px; right: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 10px; background: #1c2a1e; border: 1px solid var(--line-2); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); font-size: 13.5px; }
.toast.bad { background: #3a1e22; border-color: #6b2d33; }
.toast.ok { background: #183328; border-color: #2a5c47; }

/* ---- bảng */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; background: var(--bg-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--ok); } .minus { color: var(--fg); }
td .sub { color: var(--muted); font-size: 12px; }

/* ---- nạp tiền */
.topup { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.amounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.amounts button { height: 44px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-weight: 600; }
.amounts button.on { border-color: var(--accent); background: rgba(143, 220, 78, .08); color: var(--accent); }
.qr { background: #fff; border-radius: var(--r); padding: 10px; display: grid; place-items: center; min-height: 280px; }
.qr img { width: 100%; height: auto; display: block; border-radius: 6px; }
.copyrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.copyrow:last-child { border-bottom: 0; }
.copyrow small { color: var(--muted); display: block; font-size: 12px; }
.copyrow b { font-weight: 600; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.stat small { color: var(--muted); font-size: 12px; display: block; }
.stat b { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { height: 40px; padding: 0 14px; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--fg); border-color: var(--accent); }

/* ---- điện thoại */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .side { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
  .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 7px; border: 0; background: none; color: var(--muted); font-size: 10.5px; cursor: pointer; }
  .tabbar button.on { color: var(--accent); }
  .tabbar svg { width: 20px; height: 20px; }
  .feed-wrap { padding: 14px 14px 6px; }
  .composer-wrap { padding: 6px 10px 10px; }
  .composer { border-radius: 14px; padding: 10px; }
  .c-main { flex-direction: column; }
  .slots { max-width: 100%; }
  .slot { width: 64px; height: 64px; }
  #prompt { width: 100%; min-height: 56px; }
  #go { min-width: 0; flex: 1; }
  .c-go { flex: 1; }
  .c-bar .sp { display: none; }
  .jobs { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .page { padding: 18px 14px 40px; }
  .topup { grid-template-columns: 1fr; }
  .viewer { grid-template-columns: 1fr; }
  .viewer .stage { border-radius: var(--r-l) var(--r-l) 0 0; min-height: 200px; }
  .viewer video { max-height: 52vh; }
  .mobile-bal { display: inline-flex !important; }
}
.mobile-bal { display: none; }
/* Điện thoại / máy cảm ứng: ô nhập chữ phải ≥ 16px, không thì Safari trên iPhone tự phóng to cả trang khi chạm vào ô
   và không thu lại → khung tạo video phình ra, tràn viền (user báo 16/11/2026). Đồng thời chặn trình duyệt tự phóng chữ khi xoay máy. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 860px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), textarea, select { font-size: 16px; }
  #prompt { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- song ngữ */
html.i18n-pending body { visibility: hidden; }
.langsw { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); width: max-content; }
.langsw button { height: 24px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.langsw button.on { background: var(--panel-2); color: var(--fg); }
.side .langsw { margin: 0 0 4px 6px; }
.model .from > * { display: block; }
.model .from span { font-size: 12px; }
.model .from small { font-size: 11.5px; color: var(--muted); }

.qr svg { width: 100%; height: auto; display: block; }
.copyrow b { overflow-wrap: anywhere; }

/* bảng giá: mỗi model một hàng */
.ptable th, .ptable td { white-space: nowrap; vertical-align: middle; padding: 11px 14px; }
.ptable td.sub { color: var(--muted); font-size: 12.5px; }
.ptable td .sub { font-size: 12px; }
.ptable tbody tr:hover td { background: rgba(255, 255, 255, .025); }
/* hai nhóm nút lọc của bảng giá: nhãn + nút luôn cùng hàng, không co đè lên nhau */
#v-bang-gia .row .row { flex-wrap: nowrap; flex: none; }
#v-bang-gia .row .row .label { white-space: nowrap; }
#priceDur { flex: none; width: 320px; }
#priceAudio { flex: none; width: 200px; }
@media (max-width: 560px) {
  #v-bang-gia .row .row { flex: 1 1 100%; flex-wrap: wrap; }
  #priceDur, #priceAudio { flex: 1 1 100%; width: auto; }
}

/* ---- ô soạn: ô Tham chiếu, nút @, menu nhỏ */
.slot.any { border-style: solid; border-color: var(--line-2); background: var(--panel-2); color: var(--fg-2); transition: transform .15s, border-color .15s; }
.slot.any.solo { transform: rotate(-5deg); }
.slot.any:hover, .slot.any.solo:hover { transform: rotate(0) scale(1.03); border-color: var(--accent); color: var(--fg); }
.slot.any svg { width: 20px; height: 20px; }
.chip.at { width: 34px; padding: 0; justify-content: center; font-size: 15px; font-weight: 600; color: var(--fg-2); }
.chip.at:hover { color: var(--accent); }
.pop.menu { width: min(320px, calc(100vw - 24px)); padding: 6px; gap: 2px; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; }
.mi:hover, .mi:focus-visible { background: var(--panel-2); }
.mi.on { background: rgba(143, 220, 78, .08); box-shadow: inset 0 0 0 1px rgba(143, 220, 78, .45); }
.mi .th { width: 36px; height: 36px; flex: none; border-radius: 7px; overflow: hidden; background: var(--bg-2); display: grid; place-items: center; color: var(--muted); }
.mi .th img { width: 100%; height: 100%; object-fit: cover; }
.mi .th svg { width: 18px; height: 18px; }
.mi .tx { display: grid; gap: 1px; min-width: 0; }
.mi .tx b { font-weight: 600; font-size: 13.5px; }
.mi .tx small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop.menu .mi .tx small { white-space: normal; }

/* =====================================================================
   Prism Forge: kính mờ kiểu iOS + hiệu ứng. Khối này ghi đè các luật phía trên.
   Bề mặt "khung" (thanh bên, ô soạn, hộp nổi, hộp thoại) làm mờ nền phía sau;
   thẻ video và bảng chỉ trong suốt nhẹ, không làm mờ, để trang cuộn mượt.
   ===================================================================== */
:root {
  --bg: #07080c;
  --glass: rgba(14, 22, 15, .56);
  --glass-strong: rgba(12, 19, 13, .74);
  --glass-line: rgba(255, 255, 255, .1);
  --blur: blur(26px) saturate(175%);
  --prism: linear-gradient(110deg, #ffd166 0%, #ff8a4c 28%, #ff5fa2 54%, #8b5cf6 78%, #5bc8ff 100%);
}
body { background: var(--bg); }
/* quầng sáng nền trôi chậm: thứ để lớp kính có cái mà làm mờ */
body::before {
  content: ''; position: fixed; inset: -18%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(36% 32% at 16% 20%, rgba(99, 207, 69, .22), transparent 70%),
    radial-gradient(34% 30% at 84% 14%, rgba(139, 92, 246, .22), transparent 70%),
    radial-gradient(40% 34% at 72% 88%, rgba(91, 200, 255, .15), transparent 70%),
    radial-gradient(30% 28% at 20% 90%, rgba(255, 95, 162, .13), transparent 70%);
  animation: pf-drift 38s ease-in-out infinite alternate;
}
@keyframes pf-drift { from { transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1); } to { transform: translate3d(3%, 2%, 0) rotate(9deg) scale(1.1); } }
@keyframes pf-rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pf-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pf-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pf-sheen { from { background-position: 180% 0, 0 0; } to { background-position: -80% 0, 0 0; } }
@keyframes pf-hue { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

/* ---- bề mặt kính */
.side, .tabbar, .composer, .pop, .dialog, .toast, .wallet, .langsw {
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.side { background: var(--glass); border-right-color: var(--glass-line); }
.tabbar { background: var(--glass-strong); border-top-color: var(--glass-line); }
.wallet { background: rgba(255, 255, 255, .05); border-color: var(--glass-line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07); }
.langsw { background: rgba(255, 255, 255, .05); border-color: var(--glass-line); }
.langsw button.on { background: rgba(255, 255, 255, .13); }
.pop, .dialog { background: var(--glass-strong); border-color: rgba(255, 255, 255, .14); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .09); animation: pf-pop .18s cubic-bezier(.2, .8, .2, 1) both; }
.modal { background: rgba(3, 6, 4, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: pf-fade .16s ease-out both; }
.toast { background: rgba(26, 38, 27, .72); border-color: rgba(255, 255, 255, .16); animation: pf-pop .2s ease-out both; }
.toast.bad { background: rgba(70, 28, 34, .78); } .toast.ok { background: rgba(22, 58, 44, .78); }
.card, .stat, .table-wrap { background: rgba(16, 24, 17, .52); border-color: rgba(255, 255, 255, .08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
th { background: rgba(9, 14, 10, .82); }
.input, select.input, textarea.input { background: rgba(5, 9, 6, .5); border-color: rgba(255, 255, 255, .13); }
.btn { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .13); }
.btn:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .22); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.seg { background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.seg button.on { background: rgba(255, 255, 255, .13); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 2px 8px rgba(0, 0, 0, .25); }
.nav { transition: background .18s, color .18s, transform .18s; }
.nav:hover { background: rgba(255, 255, 255, .06); transform: translateX(2px); }
.nav.on { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), inset 0 1px 0 rgba(255, 255, 255, .08); }
.side .sep { background: rgba(255, 255, 255, .08); }
.pill { background: rgba(255, 255, 255, .08); }
.model:hover, .mi:hover, .mi:focus-visible { background: rgba(255, 255, 255, .08); }
.amounts button { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); transition: transform .15s, border-color .15s, background .15s; }
.amounts button:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .28); }

/* ---- nút chính: bóng màu + vệt sáng lướt qua khi rê chuột */
.btn.primary { position: relative; overflow: hidden; background: var(--grad); border-color: transparent; box-shadow: 0 8px 26px rgba(99, 207, 69, .3), inset 0 1px 0 rgba(255, 255, 255, .45); transition: transform .15s, box-shadow .2s, filter .2s; }
.btn.primary:hover { background: var(--grad); transform: translateY(-1px); box-shadow: 0 12px 34px rgba(99, 207, 69, .42), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, .5) 50%, transparent 68%); transform: translateX(-130%); transition: transform .65s ease; }
.btn.primary:hover::after { transform: translateX(130%); }
.btn.primary:disabled { transform: none; box-shadow: none; }

/* ---- logo */
.logo svg { filter: drop-shadow(0 3px 12px rgba(120, 210, 90, .4)); transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.logo:hover svg { transform: scale(1.12) rotate(-6deg); }

/* ---- trang tạo: ô soạn nổi trên lưới video, video cuộn mờ phía sau */
#v-create { position: relative; }
.feed-wrap { padding-bottom: 260px; }
.composer-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding-top: 36px; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(7, 11, 8, .5) 55%, rgba(7, 11, 8, .78)); }
.composer {
  pointer-events: auto; border: 1px solid transparent;
  background: linear-gradient(var(--glass), var(--glass)) padding-box, linear-gradient(135deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .12)) border-box;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .1);
  transition: box-shadow .25s, background .25s;
}
.composer:focus-within { border-color: transparent; background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--prism) border-box; box-shadow: 0 24px 80px rgba(0, 0, 0, .6), 0 0 44px rgba(120, 210, 90, .14); }
.slots { max-height: 168px; overflow-y: auto; padding: 4px 2px; }
.slot { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .18); transition: transform .15s, border-color .15s; }
.slot.filled { animation: pf-pop .22s ease-out both; }
.slot.any { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); box-shadow: 0 6px 18px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.chip { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); transition: background .15s, border-color .15s, transform .15s; }
.chip:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .26); transform: translateY(-1px); }

/* ---- thẻ video */
.job { background: rgba(16, 24, 17, .6); border-color: rgba(255, 255, 255, .08); animation: pf-rise .45s cubic-bezier(.2, .7, .2, 1) backwards; transition: transform .22s cubic-bezier(.2, .7, .2, 1), border-color .2s, box-shadow .22s; }
.job:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, .2); box-shadow: 0 18px 44px rgba(0, 0, 0, .5); }
.job .thumb video { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.job:hover .thumb video { transform: scale(1.04); }
.job.queued .state, .job.running .state {
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .07) 50%, transparent 65%) 180% 0 / 220% 100% no-repeat, radial-gradient(120% 90% at 50% 0%, rgba(28, 46, 30, .9) 0%, rgba(8, 13, 9, .9) 72%);
  animation: pf-sheen 2.6s linear infinite;
}
.bar { background: rgba(255, 255, 255, .1); }
.bar i { background: var(--prism); background-size: 200% 100%; }
.idea { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .13); transition: transform .15s, border-color .15s, background .15s; }
.idea:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .1); }
.empty h2 { background: var(--prism); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: pf-hue 9s ease-in-out infinite alternate; }
.view > .page { animation: pf-rise .35s ease-out backwards; }
.viewer .stage { background: rgba(0, 0, 0, .7); }
.qr { box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.tabs button { transition: color .15s; }
.ptable tbody tr { transition: background .15s; }

@media (max-width: 860px) {
  .feed-wrap { padding-bottom: 320px; }
  .composer-wrap { padding-top: 24px; }
}
.slots { overflow-x: hidden; padding: 6px 6px 6px 4px; }
.logo svg { width: 30px; height: 30px; }

/* =====================================================================
   Tông màu "đồng cỏ": lấy từ ảnh nền (cỏ #689319 / #84a925, bóng cỏ #214c1b, mây #f4f8ee, trời #5aa1dd).
   Một màu nhấn duy nhất là xanh cỏ; trắng mây cho chữ; xanh trời chỉ dùng cho nhãn "Mới".
   Chữ: Inter cho cả tiêu đề lẫn nội dung.
   ===================================================================== */
:root {
  --bg: #070b08; --bg-2: #0d130e; --panel: #131b14; --panel-2: #1a251b; --line: #223023; --line-2: #2f4230;
  --fg: #f1f5ee; --fg-2: #c0cbbd; --muted: #86957f;
  --accent: #8fdc4e; --accent-2: #4fb23a; --accent-ink: #0b1f08;
  --grad: linear-gradient(100deg, #b5ef6a 0%, #63cf45 100%);
  --prism: linear-gradient(110deg, #e6fbc4 0%, #9be25a 48%, #4fb23a 100%);
  --ok: #7ed957; --warn: #f2c14e; --bad: #ff6b6b; --info: #7cc0f5;
  --glass: rgba(14, 22, 15, .58); --glass-strong: rgba(11, 18, 12, .78);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body { font: 14px/1.5 var(--font); letter-spacing: -.006em; font-feature-settings: 'cv11', 'ss03'; }
h1, h2, h3 { letter-spacing: -.022em; }
body::before {
  background:
    radial-gradient(38% 34% at 14% 18%, rgba(104, 147, 25, .26), transparent 70%),
    radial-gradient(34% 30% at 86% 12%, rgba(90, 161, 221, .13), transparent 70%),
    radial-gradient(42% 36% at 74% 90%, rgba(70, 115, 37, .24), transparent 70%),
    radial-gradient(30% 28% at 18% 92%, rgba(132, 169, 37, .14), transparent 70%);
}
::selection { background: rgba(143, 220, 78, .32); }
.logo { font: 700 16px/1 var(--display); letter-spacing: -.025em; gap: 9px; }
.logo svg { width: 26px; height: 26px; filter: drop-shadow(0 3px 10px rgba(126, 217, 87, .28)); }
.logo:hover svg { transform: scale(1.1); }
.page > header h1 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.feed-head h1 { font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
.card h2, .dialog > header h2 { font-weight: 650; letter-spacing: -.015em; }
.nav { font-weight: 500; font-size: 14px; letter-spacing: -.01em; }
.btn { font-weight: 550; letter-spacing: -.01em; }
.btn.primary { font-weight: 650; box-shadow: 0 8px 26px rgba(99, 207, 69, .26), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:hover { box-shadow: 0 12px 34px rgba(99, 207, 69, .38), inset 0 1px 0 rgba(255, 255, 255, .55); }
.wallet b { font-size: 21px; font-weight: 700; letter-spacing: -.03em; }
.job .title { font-weight: 650; letter-spacing: -.015em; }
.empty h2 { font-weight: 750; letter-spacing: -.03em; font-size: 22px; }
.stat b { font-weight: 700; letter-spacing: -.03em; }
.badge { letter-spacing: .03em; font-weight: 700; }
.badge.new { background: rgba(124, 192, 245, .16); color: var(--info); }
.pill.ok { color: var(--ok); background: rgba(126, 217, 87, .13); }
.plus { color: var(--ok); }
.composer:focus-within { box-shadow: 0 24px 80px rgba(0, 0, 0, .6), 0 0 44px rgba(126, 217, 87, .13); }
.job.failed .state { background: radial-gradient(120% 90% at 50% 0%, #2a1a17 0%, #0b0f0b 70%); }
.mi.on { background: rgba(143, 220, 78, .09); box-shadow: inset 0 0 0 1px rgba(143, 220, 78, .45); }
.chip.at:hover { color: var(--accent); }
a { color: var(--accent); }
.composer:focus-within { background: linear-gradient(rgba(11, 18, 12, .86), rgba(11, 18, 12, .86)) padding-box, var(--prism) border-box; }

/* ---- Tạo ảnh + kho nhân vật ---- */
.seg.media { width: 132px; flex: none; padding: 3px; border-radius: 10px; }
.seg.media button { height: 28px; font-weight: 600; }
.seg.media button.on { background: var(--accent); color: #0b1408; box-shadow: none; }
.job .thumb.still img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.job .thumb.still:hover img { transform: scale(1.03); }
.viewer .stage img { max-width: 100%; max-height: calc(100vh - 64px); display: block; }
.slot .sv { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: 0; transition: opacity .15s; }
.slot .sv svg { width: 10px; height: 10px; }
.slot:hover .sv, .slot .sv:focus-visible { opacity: 1; }
.slot .sv:hover { background: var(--accent); color: #0b1408; }
@media (hover: none) { .slot .sv { opacity: 1; } }
.pop.menu { max-height: min(440px, 62vh); overflow-y: auto; }
.pop.menu .mh { padding: 8px 10px 3px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kho { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; align-items: start; }
.kho:empty { display: none; }
.kitem { border-radius: var(--r); overflow: hidden; background: var(--glass, var(--panel)); border: 1px solid rgba(255, 255, 255, .1); display: grid; transition: transform .18s, border-color .18s; }
.kitem:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .24); }
.kthumb { position: relative; aspect-ratio: 1; background: #050806; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.kthumb img, .kthumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kthumb svg { width: 34px; height: 34px; }
.kthumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11.5px; }
.kbody { padding: 10px; display: grid; gap: 8px; min-width: 0; }
.khead { display: flex; align-items: center; gap: 2px; min-width: 0; }
.khead b { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.khead .btn { width: 28px; height: 28px; padding: 0; justify-content: center; flex: none; }
.kbody .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 860px) { .seg.media { width: 116px; } .kho { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .kbody .acts { flex-wrap: wrap; } }

.hd { color: var(--accent); }
.khead b.hd { cursor: default; }
.handle-in { display: flex; align-items: center; gap: 0; }
.handle-in > span { display: grid; place-items: center; width: 38px; height: 42px; border-radius: 10px 0 0 10px; background: rgba(143, 220, 78, .14); color: var(--accent); font-weight: 700; font-size: 16px; border: 1px solid rgba(255, 255, 255, .14); border-right: 0; }
.handle-in .input { border-radius: 0 10px 10px 0; flex: 1; height: 42px; font-weight: 600; }

/* ---- Dự án + trang API ---- */
.chip.proj { max-width: 260px; }
.chip.proj .pn { font-weight: 600; }
.feed-head { gap: 12px; }
.handle-in.plain .input { border-radius: 10px; }
.code { margin: 0; white-space: pre-wrap; word-break: break-all; font: 12.5px/1.65 ui-monospace, "Cascadia Code", Consolas, monospace; padding: 12px 14px; border-radius: 10px; background: rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .08); color: var(--fg-2); }

/* Kênh hỗ trợ (Telegram, Zalo): gọn, chỉ biểu tượng hoặc biểu tượng + tên kênh */
.sidesup { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 0 10px; margin-bottom: 10px; }
.sidesup small { color: var(--muted); font-size: 12px; }
.sidesup [data-support] { display: flex; gap: 6px; }
.supico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--fg-2); transition: background .18s, color .18s; }
.supico:hover { color: var(--accent); background: rgba(126, 217, 87, .14); }
.supico svg { width: 16px; height: 16px; }
.footsup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.footsup [data-support], [data-support].footsup { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; }
.footsup[hidden], [data-support][hidden] { display: none; }
.foota { display: inline-flex; align-items: center; gap: 6px; }
.foota svg { width: 15px; height: 15px; }
.supfab { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; justify-items: end; gap: 10px; }
.supbtn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--grad); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.supbtn svg { width: 20px; height: 20px; }
.suppop { padding: 14px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .5); display: grid; gap: 10px; }
.suppop[hidden] { display: none; }
.suprow { display: flex; gap: 8px; }
.suprow .btn { gap: 8px; text-decoration: none; }

/* Tab lọc Video / Ảnh cạnh nút chọn dự án */
.seg.mfilter { flex: none; padding: 3px; border: 1px solid var(--line-2); }
.seg.mfilter button { height: 26px; padding: 0 13px; font-size: 13px; }
.seg.mfilter button.on { background: rgba(126, 217, 87, .16); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(126, 217, 87, .35); }
@media (max-width: 720px) { .feed-head { flex-wrap: wrap; row-gap: 8px; } }

/* Trang nạp: dòng ghi dưới mã QR và ô báo đã nhận tiền */
.qrcap { text-align: center; font-size: 13.5px; line-height: 1.55; color: var(--fg-2); margin: 0; }
.qrcap b { color: var(--fg); }
#qrDone { display: grid; justify-items: center; gap: 6px; padding: 34px 14px; text-align: center; color: #1a7f37; }
#qrDone[hidden] { display: none; }
#qrDone svg { width: 54px; height: 54px; }
#qrDone b { font-size: 19px; }
#qrDone span { color: #555; font-size: 13.5px; }

/* Bảng kho key: mỗi key một dòng, gọn để theo dõi vài trăm key */
.ktable th, .ktable td { padding: 4px 10px; vertical-align: middle; white-space: nowrap; }
.ktable tbody tr:hover td { background: rgba(255, 255, 255, .03); }
.ktable tr.koff td { opacity: .5; }
.ktable .kn { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.ktable .kwarn { color: var(--warn); margin-left: 6px; cursor: help; }
.ktable .klow { color: var(--warn); }
.ktable .kzero { color: var(--bad); }
.ktable .kexp { color: var(--warn); }
.ktable .pill { height: 20px; font-size: 11.5px; padding: 0 7px; }
:is(.ktable, .utable, .jtable) .acts { display: inline-flex; gap: 4px; }
:is(.ktable, .utable, .jtable) .ib { width: 24px; height: 24px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg-2); color: var(--fg-2); cursor: pointer; }
:is(.ktable, .utable, .jtable) .ib:hover { color: var(--fg); border-color: var(--fg-2); }
:is(.ktable, .utable, .jtable) .ib.danger:hover { color: var(--bad); border-color: rgba(255, 107, 107, .45); }
:is(.ktable, .utable, .jtable) .ib svg { width: 13px; height: 13px; }

/* Bảng Người dùng: một dòng mỗi người, Đã nạp / Số dư chữ lớn để nhìn ra ngay ai có tiền */
.utable th, .utable td, .jtable th, .jtable td { padding: 6px 10px; vertical-align: middle; white-space: nowrap; }
.utable tbody tr:hover td, .jtable tbody tr:hover td { background: rgba(255, 255, 255, .03); }
.utable th.hl { color: var(--fg-2); font-weight: 600; }
.utable td:not(:first-child) { width: 1%; }   /* các cột rộng vừa chữ; chỗ thừa dồn vào cột Người dùng (user 18/11/2026: cột "Đã tạo" quá dài mà ít chữ) */
.utable td:nth-child(4) { min-width: 120px; }
.utable th:nth-child(2), .utable td:nth-child(2) { padding-left: 28px; }
.utable tr.uoff td { opacity: .55; }
.uwho { display: flex; align-items: center; gap: 6px; }
.uwho b { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.money { display: inline-block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.money.in { color: var(--accent); }
.money.bal { color: var(--fg); padding: 2px 9px; border-radius: 7px; background: rgba(143, 220, 78, .1); box-shadow: inset 0 0 0 1px rgba(143, 220, 78, .22); }
.money.zero { color: var(--muted); font-size: 13px; font-weight: 500; opacity: .7; }
:is(.ktable, .utable, .jtable) a.ib { text-decoration: none; }

/* Tổng quan quản trị: tiêu đề nhóm, ô "Tổng tiền khách nạp vào" nổi bật, bảng theo ngày */
.ovh { margin: 6px 0 -4px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--fg-2); }
.ovh span { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat.hero { position: relative; overflow: hidden; border-color: rgba(143, 220, 78, .35); background: linear-gradient(135deg, rgba(143, 220, 78, .14), rgba(143, 220, 78, .03) 70%), var(--panel); }
.stat.hero b { font-size: 26px; color: var(--accent); }
.dtable th, .dtable td { padding: 6px 12px; vertical-align: middle; white-space: nowrap; }
.dtable th.hl { color: var(--fg-2); font-weight: 600; }
.dtable tbody tr:hover td { background: rgba(255, 255, 255, .03); }
.dtable tr.dnone td { opacity: .55; }

/* Bảng Lượt tạo: mỗi lượt một dòng (lỗi gốc rút một dòng); bấm dòng để mở chi tiết */
.jtable tbody tr[data-id] { cursor: pointer; }
.jmail { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.jsum { display: flex; align-items: center; gap: 7px; max-width: 440px; }
.jsum > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.jic { flex: none; display: inline-grid; color: var(--muted); }
.jic svg { width: 14px; height: 14px; }
.jerr { color: var(--bad); }
.jline { max-width: 440px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.jdet { display: none; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .04); color: var(--fg-2); font-size: 12px; line-height: 1.6; white-space: normal; word-break: break-word; max-width: 640px; }
.jtable tr.open .jdet { display: block; }
.jmore:not(:empty) { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.jmore b { display: block; margin: 6px 0 3px; color: var(--fg); font-weight: 600; }
.jmore b:first-child { margin-top: 0; }
.jmore summary { margin-top: 6px; cursor: pointer; color: var(--fg); }
.jprompt { white-space: pre-wrap; max-height: 240px; overflow: auto; padding: 6px 8px; border-radius: 6px; background: rgba(0, 0, 0, .22); color: var(--fg-2); font-size: 12.5px; line-height: 1.55; cursor: text; }
.jfiles { display: flex; flex-wrap: wrap; gap: 6px; }
.jfile { display: inline-flex; align-items: center; gap: 5px; height: 64px; max-width: 220px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg-2); color: var(--fg-2); text-decoration: none; overflow: hidden; }
.jfile img { height: 64px; width: auto; max-width: 140px; margin: 0 -8px; object-fit: cover; display: block; }
.jfile svg { width: 15px; height: 15px; flex: none; }
.jfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jfile.miss { color: var(--muted); font-style: italic; }
.jtable tr.open .jline { display: none; }
.jtable tr.open .jsum > span:last-child { white-space: normal; }
.jtable .pill { height: 20px; font-size: 11.5px; padding: 0 7px; }
@media (max-width: 720px) {   /* điện thoại: rút email để cột tiền / nội dung lọt màn hình đầu */
  .uwho b { max-width: 150px; }
  .utable th:nth-child(2), .utable td:nth-child(2) { padding-left: 10px; }
  .jmail { max-width: 110px; }
  .jsum, .jline { max-width: 260px; }
}

/* ---- trang Tài khoản: thẻ hồ sơ + số dư ở trên, dưới chia hai cột (điện thoại: một cột) */
.page.acc { max-width: 980px; }
.acc-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 18px 24px; flex-wrap: wrap; padding: 22px; }
.acc-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(55% 140% at 0% 0%, rgba(99, 207, 69, .12), transparent 62%), radial-gradient(45% 140% at 100% 100%, rgba(139, 92, 246, .12), transparent 62%); }
.acc-id { position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 260px; }
.acc-ava { flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font: 600 24px/1 var(--display); color: #fff; border: 2px solid transparent; background: linear-gradient(#141c15, #141c15) padding-box, var(--prism) border-box; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.acc-who { display: grid; gap: 2px; min-width: 0; }
.acc-who b { font-size: 18px; font-weight: 600; }
.acc-who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-bal { position: relative; display: flex; align-items: center; gap: 18px; padding-left: 24px; border-left: 1px solid rgba(255, 255, 255, .09); }
.acc-bal > div { display: grid; gap: 2px; }
.acc-bal b { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.acc-act { display: flex; justify-content: flex-end; }
.acc-list { padding: 6px; display: grid; }
.acc-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; }
button.acc-row, a.acc-row { cursor: pointer; transition: background .15s; }
button.acc-row:hover, a.acc-row:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.acc-row + .acc-row::before { content: ''; position: absolute; top: 0; left: 58px; right: 12px; height: 1px; background: rgba(255, 255, 255, .07); }
.acc-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; align-items: center; justify-content: center; background: rgba(255, 255, 255, .07); color: var(--fg-2); }
.acc-ic svg { width: 17px; height: 17px; }
.acc-tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.acc-tx b { font-weight: 500; }
.acc-tx small { font-size: 12.5px; }
.acc-go { flex: none; color: var(--muted); transform: rotate(-90deg); }
.acc-go svg { width: 16px; height: 16px; }
.acc-out { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acc-out > div { flex: 1 1 180px; }
.acc-out .btn.danger:hover { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .45); }
/* thẻ API ở Tài khoản */
.api-head { display: flex; gap: 12px; align-items: flex-start; }
.api-head p { margin-top: 3px; font-size: 13.5px; line-height: 1.55; }
.api-keys { display: grid; gap: 6px; }
.api-keys > p { font-size: 13.5px; }
.api-key { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07); }
.api-k { flex: 1; min-width: 0; display: grid; gap: 2px; }
.api-k b, .api-k small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-k b { font-weight: 550; }
.api-k small { font-size: 12.5px; }
.api-k code, .api-secret code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.api-key .btn.danger:hover { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .45); }
.api-new { display: grid; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid rgba(143, 220, 78, .35); background: rgba(143, 220, 78, .07); }
.api-new small { color: var(--fg-2); font-size: 12.5px; line-height: 1.5; }
.api-secret { display: flex; align-items: center; gap: 8px; }
.api-secret code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--fg); user-select: all; }
.api-form { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.api-form[hidden] { display: none; }
.api-form > label { font-size: 13px; font-weight: 600; color: var(--fg); }
.api-form-row { display: flex; gap: 8px; }
.api-form-row .input { flex: 1; min-width: 0; }
.api-doc { display: inline-flex; align-items: center; gap: 2px; justify-self: start; font-size: 13.5px; font-weight: 550; color: var(--accent); }
.api-doc svg { width: 14px; height: 14px; transform: rotate(-90deg); }
/* trang API key (mục riêng trên thanh bên, user 18/11/2026: "kéo ra ngoài, để trong Tài khoản không ai biết") */
.api-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.api-grid h2 { font-size: 16px; font-weight: 600; }
.api-sub { margin-top: 4px; font-size: 13.5px; line-height: 1.55; }
.api-prompt { margin: 0; padding: 14px 16px; border-radius: 10px; background: #0a100b; border: 1px solid rgba(255, 255, 255, .09); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #dfe9d9; white-space: pre-wrap; overflow-wrap: anywhere; }
.api-info { display: grid; gap: 12px; }
.api-info > div { display: grid; gap: 4px; }
.api-info small { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.api-info code { justify-self: start; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .07); font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
@media (max-width: 860px) { .api-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
@media (max-width: 860px) {
  .acc-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .acc-hero { padding: 18px; }
  .acc-ava { width: 52px; height: 52px; font-size: 21px; }
  .acc-bal { width: 100%; justify-content: space-between; padding: 14px 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .09); }
}

/* Bảng: xen kẽ màu nhẹ giữa các dòng cho dễ dò theo hàng (user 18/11/2026); rê chuột thì sáng hơn một bậc */
.table-wrap tbody tr:nth-child(even) > td { background: rgba(255, 255, 255, .055); }
.table-wrap tbody tr:hover > td { background: rgba(143, 220, 78, .07); }
