/* [03/12] Bộ giao diện thương mại: một bộ token (màu · bán kính · bóng · thang chữ) dùng cho Studio lẫn Admin.
   Không cuộn ngang ở mọi bề rộng; lưới luôn minmax(0,…); hover chỉ đổi độ sáng/nền. */
:root{
  --bg:#f7f7f8;--surface:#fff;--surface-2:#f2f2f4;--line:#e6e6ea;--line-2:#d9d9df;
  --ink:#111114;--ink-2:#3f3f46;--muted:#71717a;--faint:#a1a1aa;
  --accent:#4f46e5;--accent-ink:#fff;--accent-soft:#eef0ff;--accent-line:#c7cbff;
  --ok:#15803d;--ok-soft:#ecfdf3;--bad:#b42318;--bad-soft:#fef3f2;--warn:#b54708;
  --r-sm:8px;--r:12px;--r-lg:16px;
  --sh-1:0 1px 2px rgba(16,16,20,.05);--sh-2:0 1px 2px rgba(16,16,20,.04),0 8px 24px -8px rgba(16,16,20,.12);--sh-3:0 24px 64px -16px rgba(16,16,20,.28);
  --fs-xs:12px;--fs-sm:13px;--fs:14px;--fs-md:15px;--fs-lg:18px;--fs-xl:28px;--fs-2xl:40px;
}
*{box-sizing:border-box}html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font:var(--fs)/1.5 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-font-smoothing:antialiased;font-feature-settings:"cv11","ss01"}
a{color:inherit}
button{font:inherit;color:inherit;cursor:pointer;background:none;border:0;padding:0}
button:disabled{cursor:default;opacity:.5}
input,select,textarea{font:inherit;color:var(--ink);min-width:0}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.an{display:none!important}
.muted{color:var(--muted)}.fine{font-size:var(--fs-xs);color:var(--faint);margin:0}.center{text-align:center}
.ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
[data-icon]{display:inline-flex}

/* nút */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:var(--r-sm);border:1px solid var(--line-2);background:var(--surface);font-weight:500;text-decoration:none;box-shadow:var(--sh-1)}
.btn:hover{background:var(--surface-2)}
.btn.primary{background:var(--ink);border-color:var(--ink);color:#fff}.btn.primary:hover{background:#2a2a30}
.btn.block{width:100%}
.icon-btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:var(--r-sm);color:var(--ink-2)}
.icon-btn:hover{background:var(--surface-2);color:var(--ink)}
.icon-btn.tiny{width:28px;height:28px}.icon-btn.tiny .ic{width:15px;height:15px}
.icon-btn.solid{background:rgba(255,255,255,.94);box-shadow:var(--sh-2);color:var(--ink)}
.chip{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface);font-size:var(--fs-sm);font-weight:500;white-space:nowrap}
.chip:hover{background:var(--surface-2)}.chip .ic{width:15px;height:15px}
.chip.active{background:var(--accent-soft);border-color:var(--accent-line);color:var(--accent)}
.link{color:var(--accent);font-size:var(--fs-sm);font-weight:500}
.seg{display:inline-flex;padding:3px;gap:2px;background:var(--surface-2);border-radius:10px}
.seg button{height:30px;padding:0 12px;border-radius:8px;font-size:var(--fs-sm);font-weight:500;color:var(--muted);white-space:nowrap}
.seg button.on{background:var(--surface);color:var(--ink);box-shadow:var(--sh-1)}
.seg.small button{height:26px;padding:0 9px;font-size:var(--fs-xs)}

/* thương hiệu */
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand-mark{width:30px;height:30px;border-radius:9px;background:var(--ink);color:#fff;display:inline-flex;align-items:center;justify-content:center}
.brand-mark .ic{width:17px;height:17px}
.brand-name{font-weight:700;font-size:var(--fs-md);letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* [05/12] màn đăng nhập cũ đã khai tử — đăng nhập ở auth.html (landing.css) */
.field{display:grid;gap:6px;font-size:var(--fs-sm);font-weight:500;color:var(--ink-2)}
.field input{height:42px;border:1px solid var(--line-2);border-radius:var(--r-sm);padding:0 12px;background:var(--surface);font-size:var(--fs)}
.field input:focus{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.form-error{color:var(--bad);font-size:var(--fs-sm);min-height:0}
.form-error:empty{display:none}

/* ===== studio ===== */
.app{display:grid;grid-template-columns:minmax(0,264px) minmax(0,1fr) minmax(0,340px);height:100vh;height:100dvh}
.side,.assets{background:var(--surface);display:flex;flex-direction:column;min-height:0;min-width:0}
.side{border-right:1px solid var(--line)}.assets{border-left:1px solid var(--line)}
.side-head{display:flex;align-items:center;justify-content:space-between;padding:16px 16px 12px}
/* [05/12] menu kiểu inkica: mục 40px bo 12px, mục đang mở nền xanh ngọc nhạt + viền; New Chat có viền; thẻ tài khoản kèm ô credit */
.brand-badge{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;background:#ecfeff;border:1px solid #a5f3fc;color:#0e7490;font-size:11.5px;font-weight:600;white-space:nowrap;flex:none}
.brand-badge .ic{width:12px;height:12px}
.tools{display:grid;gap:3px;padding:4px 12px 14px;border-bottom:1px solid var(--line)}
.tool{display:flex;align-items:center;gap:11px;height:40px;padding:0 12px;border-radius:12px;border:1px solid transparent;color:var(--ink-2);font-size:var(--fs-sm);font-weight:500;text-align:left;min-width:0;transition:background .15s,border-color .15s,color .15s}
.tool span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tool:hover{background:var(--surface-2);color:var(--ink)}
.tool.on{background:#ecfeff;border-color:#a5f3fc;color:#0e7490;font-weight:600}
.tool .ic{width:18px;height:18px}
.new-chat{display:flex;align-items:center;gap:10px;height:42px;padding:0 12px;margin:0 2px 10px;border:1px solid var(--line-2);border-radius:12px;background:var(--surface);font-size:var(--fs-sm);font-weight:600;color:var(--ink);transition:border-color .15s,background .15s}
.new-chat span:nth-child(2){flex:1;text-align:left}.new-chat .ic{width:18px;height:18px;color:#0891b2}
.new-chat:hover{border-color:#a5f3fc;background:#f8feff}
.side-sec{flex:1;min-height:0;display:flex;flex-direction:column;padding:12px 10px 0}
.sec-title{font-size:var(--fs-xs);font-weight:600;color:var(--muted);padding:0 10px 8px;letter-spacing:.01em}
.search{display:flex;align-items:center;gap:8px;height:34px;margin:0 0 6px;padding:0 10px;border-radius:var(--r-sm);background:var(--surface-2);color:var(--muted)}
.search .ic{width:15px;height:15px}.search input{border:0;background:none;outline:0;flex:1;font-size:var(--fs-sm)}
.projects{overflow-y:auto;flex:1;min-height:0;padding-bottom:8px}
.project{display:flex;align-items:center;border-radius:var(--r-sm)}
.project a{flex:1;min-width:0;display:flex;align-items:center;gap:8px;padding:7px 4px 7px 10px;text-decoration:none;font-size:var(--fs-sm);color:var(--ink-2)}
.p-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.p-time{color:var(--faint);font-size:var(--fs-xs);flex:none}
.project .icon-btn{opacity:0;margin-right:2px}.project:hover{background:var(--surface-2)}.project:hover .icon-btn{opacity:1}
.project.on{background:var(--surface-2)}.project.on a{color:var(--ink);font-weight:500}
.side-empty,.side-error{font-size:var(--fs-sm);color:var(--muted);padding:8px 10px}.side-error{color:var(--bad)}
.side-foot{border-top:1px solid var(--line);padding:12px;display:grid;gap:8px}
.side-foot>.tool{height:38px}
.account-who{flex:1;min-width:0;display:grid;gap:3px}
.credits{display:inline-flex;align-items:center;gap:4px;justify-self:start;height:22px;padding:0 8px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);font-size:12px;color:var(--muted);white-space:nowrap}
.credits b{color:var(--ink);font-weight:700}.credits .ic{width:13px;height:13px;color:#0891b2}
.credits.low{background:#fffaeb;color:var(--warn)}.credits.low .ic,.credits.low b{color:var(--warn)}
.account{position:relative}
.account-btn{width:100%;display:flex;align-items:center;gap:10px;padding:6px;border-radius:var(--r-sm);text-align:left;min-width:0}
.account-btn:hover{background:var(--surface-2)}
.avatar{width:30px;height:30px;border-radius:50%;background:var(--accent);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:var(--fs-sm);flex:none}
.account-mail{min-width:0;font-size:var(--fs-sm);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.account-btn .ic{width:15px;height:15px;color:var(--muted)}
.menu{position:absolute;left:0;right:0;bottom:calc(100% + 6px);background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--sh-3);padding:6px;z-index:20;display:grid;gap:1px}
.menu a,.menu button{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--r-sm);text-decoration:none;font-size:var(--fs-sm);text-align:left;width:100%}
.menu a:hover,.menu button:hover{background:var(--surface-2)}
.menu .ic{width:16px;height:16px;color:var(--muted)}

.main{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg)}
.topbar{display:flex;align-items:center;gap:8px;height:56px;padding:0 20px;border-bottom:1px solid var(--line);background:rgba(247,247,248,.85);backdrop-filter:blur(8px)}
.topbar-title{flex:1;min-width:0;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.thread{flex:1;overflow-y:auto;overflow-x:hidden;padding:32px max(20px,calc(50% - 400px)) 24px}
.welcome{padding:6vh 0 8px;text-align:center}
.welcome h1{font-size:34px;letter-spacing:-.03em;margin:0 0 8px;line-height:1.15}
.welcome>p{margin:0 0 32px;font-size:var(--fs-md)}
.tool-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,180px),1fr));gap:12px;text-align:left}
.tool-card{display:flex;flex-direction:column;gap:4px;padding:16px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);box-shadow:var(--sh-1);text-align:left;min-width:0}
.tool-card:hover{border-color:var(--line-2);box-shadow:var(--sh-2)}
.tool-card.on{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-soft)}
.tool-card b{font-size:var(--fs);font-weight:600}
.tool-card .muted{font-size:var(--fs-sm);line-height:1.4}
.tool-ic{width:36px;height:36px;border-radius:10px;background:var(--surface-2);display:inline-flex;align-items:center;justify-content:center;margin-bottom:8px;color:var(--ink)}
.tool-card.on .tool-ic{background:var(--accent-soft);color:var(--accent)}
.price{font-size:var(--fs-xs);color:var(--muted);font-weight:500;margin-top:auto;padding-top:6px}

.msg{margin:0 0 28px;min-width:0}
.msg.user{display:flex;flex-direction:column;align-items:flex-end;gap:8px}
.bubble{background:var(--ink);color:#fff;padding:10px 14px;border-radius:16px 16px 4px 16px;max-width:min(80%,560px);white-space:pre-wrap;overflow-wrap:anywhere}
.refs{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.refs img{width:96px;height:96px;object-fit:cover;border-radius:var(--r-sm);border:1px solid var(--line)}
.msg.bot{display:grid;grid-template-columns:32px minmax(0,1fr);gap:12px}
.bot-avatar{width:32px;height:32px;border-radius:9px;background:var(--surface);border:1px solid var(--line);display:inline-flex;align-items:center;justify-content:center;color:var(--accent)}
.bot-avatar .ic{width:16px;height:16px}
.bot-body{min-width:0;padding-top:5px;display:grid;gap:12px}
.bot-text{white-space:pre-wrap;overflow-wrap:anywhere;color:var(--ink-2)}.bot-text:empty{display:none}
.thinking{display:inline-flex;align-items:center;gap:4px;color:var(--muted);font-size:var(--fs-sm)}
.thinking i{width:5px;height:5px;border-radius:50%;background:var(--faint);animation:blink 1.2s infinite both}
.thinking i:nth-child(2){animation-delay:.15s}.thinking i:nth-child(3){animation-delay:.3s}.thinking span{margin-left:6px}
@keyframes blink{0%,80%,100%{opacity:.25}40%{opacity:1}}
.steps{list-style:none;margin:0;padding:12px 14px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);display:grid;gap:8px}
.steps:empty{display:none}
.step{display:flex;align-items:center;gap:10px;font-size:var(--fs-sm);color:var(--muted);min-width:0}
.step-name{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink-2);font-weight:500}
.step-dot{width:18px;height:18px;border-radius:50%;border:1.5px solid var(--line-2);display:inline-flex;align-items:center;justify-content:center;flex:none}
.step-dot .ic{width:12px;height:12px;stroke-width:2.5}
.step.running .step-dot{border-color:var(--accent);border-right-color:transparent;animation:spin .8s linear infinite}
.step.completed .step-dot{background:var(--ok);border-color:var(--ok);color:#fff}
.step.failed .step-dot{background:var(--bad);border-color:var(--bad);color:#fff}
.step.pending .step-name{color:var(--muted);font-weight:400}
@keyframes spin{to{transform:rotate(360deg)}}
.step-tag{font-size:11px;padding:1px 7px;border-radius:999px;background:var(--surface-2);color:var(--muted);flex:none}
.step-state{margin-left:auto;font-size:var(--fs-xs);color:var(--accent);flex:none}
.outputs{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr));gap:12px}.outputs:empty{display:none}
.out{margin:0;border:1px solid var(--line);border-radius:var(--r);overflow:hidden;background:var(--surface);cursor:zoom-in;box-shadow:var(--sh-1);min-width:0}
.out:hover{box-shadow:var(--sh-2)}
.out img{display:block;width:100%;aspect-ratio:1;object-fit:contain;background:repeating-conic-gradient(#f0f0f3 0 25%,#fff 0 50%) 0 0/14px 14px}
.out figcaption{display:flex;gap:8px;justify-content:space-between;padding:8px 10px;font-size:var(--fs-xs);border-top:1px solid var(--line);min-width:0}
.out figcaption span:first-child{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.out figcaption .muted{flex:none}
.text-out{grid-column:1/-1;white-space:pre-wrap;overflow-wrap:anywhere;padding:14px 16px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);font-size:var(--fs-sm)}
.bot-extra{display:grid;gap:8px}.bot-extra:empty{display:none}
.notice{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:var(--r-sm);background:var(--ok-soft);color:var(--ok);font-size:var(--fs-sm)}
.notice.bad{background:var(--bad-soft);color:var(--bad)}.notice .ic{width:16px;height:16px;margin-top:2px}
.options{display:flex;gap:6px;flex-wrap:wrap}
.cost-line{font-size:var(--fs-xs);color:var(--faint)}

.composer-wrap{padding:0 max(20px,calc(50% - 400px)) 14px;display:grid;gap:8px}
.composer{background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-lg);box-shadow:var(--sh-2);padding:10px 10px 8px 14px;display:grid;gap:6px}
.composer:focus-within{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-soft),var(--sh-2)}
.composer.drop{border-style:dashed;border-color:var(--accent);background:var(--accent-soft)}
.composer textarea{border:0;outline:0;resize:none;background:none;padding:4px 0;font-size:var(--fs-md);line-height:1.5;max-height:200px;overflow-y:auto;scrollbar-width:thin}
.composer textarea:not([style*="height"]){overflow:hidden}
.composer textarea::placeholder{color:var(--faint)}
.composer-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.picker{position:relative}
.menu.up{left:0;right:auto;bottom:calc(100% + 8px);width:min(360px,calc(100vw - 40px));max-height:min(420px,60vh);overflow-y:auto}
.menu.up button{gap:10px;align-items:flex-start}
.menu.up .ic{margin-top:2px}
.opt-main{display:grid;flex:1;min-width:0}.opt-main b{font-weight:500}.opt-main .muted{font-size:var(--fs-xs);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.menu.up .price{padding:2px 0 0;margin:0;flex:none}
.menu.up button.on{background:var(--accent-soft)}
.cost{margin-left:auto;font-size:var(--fs-xs);color:var(--muted);white-space:nowrap}
.send{width:36px;height:36px;border-radius:10px;background:var(--ink);color:#fff;display:inline-flex;align-items:center;justify-content:center;flex:none}
.cost:empty+.send{margin-left:auto}
.send:hover{background:#2a2a30}.send:disabled{opacity:.35}
.composer.busy .send{animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{50%{opacity:.55}}
.attachments{display:flex;gap:8px;flex-wrap:wrap}.attachments:empty{display:none}
.att{position:relative}
.att img{width:64px;height:64px;object-fit:cover;border-radius:10px;border:1px solid var(--line)}
.att-x{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;background:var(--ink);color:#fff;display:inline-flex;align-items:center;justify-content:center}
.att-x .ic{width:12px;height:12px;stroke-width:2.5}

.assets-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line)}
.assets-head .seg{flex:1}.assets-head .seg button{flex:1}
.filters{display:flex;gap:6px;flex-wrap:wrap;padding:12px 14px 4px}.filters:empty{display:none}
.filter{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:999px;font-size:var(--fs-xs);font-weight:500;color:var(--ink-2);border:1px solid var(--line)}
.filter:hover{background:var(--surface-2)}
.filter.on{background:var(--ink);border-color:var(--ink);color:#fff}
.count{font-size:11px;color:var(--faint)}.filter.on .count{color:#a1a1aa}
.asset-grid{flex:1;min-height:0;overflow-y:auto;padding:10px 14px 16px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-content:start}
.asset{position:relative;margin:0;border-radius:var(--r);overflow:hidden;border:1px solid var(--line);cursor:zoom-in;background:repeating-conic-gradient(#f0f0f3 0 25%,#fff 0 50%) 0 0/12px 12px}
.asset img{display:block;width:100%;aspect-ratio:1;object-fit:contain}
.asset.photo img{object-fit:cover}
.asset-actions{position:absolute;right:6px;bottom:6px;display:flex;gap:4px;opacity:0;transition:opacity .15s}
.asset:hover .asset-actions,.asset:focus-within .asset-actions{opacity:1}
.empty{grid-column:1/-1;display:grid;justify-items:center;gap:6px;text-align:center;padding:48px 16px;font-size:var(--fs-sm)}
.empty .ic{width:28px;height:28px;color:var(--faint);margin-bottom:4px}

.viewer{position:fixed;inset:0;z-index:40;background:rgba(10,10,12,.72);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,320px);backdrop-filter:blur(4px)}
.viewer-body{display:flex;align-items:center;justify-content:center;padding:32px;min-width:0;min-height:0}
.viewer-body img{max-width:100%;max-height:100%;border-radius:var(--r);background:repeating-conic-gradient(#e6e6ea 0 25%,#fff 0 50%) 0 0/18px 18px;box-shadow:var(--sh-3)}
.viewer-side{background:var(--surface);padding:16px;display:flex;flex-direction:column;gap:12px;min-width:0;overflow-y:auto}
.viewer-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.viewer-top b{overflow-wrap:anywhere;padding-top:6px}
.viewer-side .muted{font-size:var(--fs-sm)}
.viewer-actions{display:grid;gap:8px}
.viewer-prompt summary{cursor:pointer;font-size:var(--fs-sm);font-weight:500;color:var(--muted)}
.viewer-prompt pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--fs-xs);background:var(--surface-2);padding:10px;border-radius:var(--r-sm);max-height:50vh;overflow-y:auto}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:50;max-width:min(560px,calc(100vw - 32px));background:var(--ink);color:#fff;padding:10px 16px;border-radius:var(--r);box-shadow:var(--sh-3);font-size:var(--fs-sm)}
.toast.bad{background:var(--bad)}
.scrim{position:fixed;inset:0;background:rgba(10,10,12,.4);z-index:25}
.only-mobile,.only-narrow{display:none}

@media (max-width:1180px){
  .app{grid-template-columns:minmax(0,248px) minmax(0,1fr)}
  .assets{position:fixed;top:0;right:0;bottom:0;width:min(360px,92vw);z-index:30;transform:translateX(100%);transition:transform .2s;box-shadow:var(--sh-3)}
  .assets.open{transform:none}
  .only-narrow{display:inline-flex}
}
@media (max-width:820px){
  .app{grid-template-columns:minmax(0,1fr)}
  .side{position:fixed;top:0;left:0;bottom:0;width:min(300px,88vw);z-index:30;transform:translateX(-100%);transition:transform .2s;box-shadow:var(--sh-3)}
  .side.open{transform:none}
  .only-mobile{display:inline-flex}
  .topbar{padding:0 8px}
  .thread{padding:20px 14px 16px}.composer-wrap{padding:0 10px 10px}
  .welcome{padding-top:2vh}.welcome h1{font-size:26px}
  .tool-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.tool-card{padding:12px}
  .viewer{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}.viewer-body{padding:16px}
}
@media (hover:none){.asset-actions,.project .icon-btn{opacity:1}}

/* ===== admin console (cùng token với Studio) ===== */
.adm{display:grid;grid-template-columns:minmax(0,248px) minmax(0,1fr);height:100vh;height:100dvh}
.adm-side{background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.adm-side .tools{border-bottom:0;flex:1;overflow-y:auto;padding-top:4px;align-content:start}
.adm-side .side-foot .btn{width:100%}
.adm-main{display:flex;flex-direction:column;min-width:0;min-height:0}
.adm-body{flex:1;overflow-y:auto;overflow-x:hidden}
.adm-wrap{max-width:1040px;margin:0 auto;padding:24px 24px 64px;display:grid;gap:16px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:20px;display:grid;gap:14px;box-shadow:var(--sh-1);min-width:0}
.card-head h3{margin:0;font-size:var(--fs-md);font-weight:600;letter-spacing:-.01em}
.card-head p{margin:4px 0 0;font-size:var(--fs-sm)}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}
.form-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}
.field{align-content:start}
.field input.inp,.field select.inp{height:38px}
.field small{font-weight:400;font-size:var(--fs-xs);line-height:1.4}
.inp{width:100%;height:38px;border:1px solid var(--line-2);border-radius:var(--r-sm);padding:0 11px;background:var(--surface);font-size:var(--fs-sm)}
textarea.inp{height:auto;padding:9px 11px;resize:vertical;line-height:1.5}
.inp:focus{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12.5px}
.card>textarea.inp{width:100%}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.row.nowrap{flex-wrap:nowrap}.row.nowrap .inp{width:96px}
.btn.sm{height:30px;padding:0 10px;font-size:var(--fs-sm)}.btn .ic{width:16px;height:16px}
.btn.ghost{box-shadow:none;border-color:transparent;color:var(--bad)}.btn.ghost:hover{background:var(--bad-soft)}
.status{font-size:var(--fs-sm);color:var(--muted);overflow-wrap:anywhere}.status:empty{display:none}
.status.ok{color:var(--ok)}.status.bad{color:var(--bad)}
.badge{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:999px;font-size:var(--fs-xs);font-weight:500;background:var(--surface-2);color:var(--ink-2);white-space:nowrap}
.badge.ok{background:var(--ok-soft);color:var(--ok)}.badge.bad{background:var(--bad-soft);color:var(--bad)}.badge.warn{background:#fffaeb;color:var(--warn)}
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;display:grid;gap:4px;box-shadow:var(--sh-1);min-width:0}
.stat .muted{font-size:var(--fs-sm)}.stat b{font-size:24px;letter-spacing:-.02em;font-weight:600}
.table-wrap{min-width:0}
.tbl{width:100%;border-collapse:collapse;table-layout:fixed;font-size:var(--fs-sm)}
.tbl th{text-align:left;font-weight:500;color:var(--muted);font-size:var(--fs-xs);padding:0 10px 8px;border-bottom:1px solid var(--line)}
.tbl td{padding:12px 10px;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}
.tbl tr:last-child td{border-bottom:0}
.cell-sub{font-size:var(--fs-xs);margin-top:4px;overflow-wrap:anywhere}
.td-act{display:grid;gap:6px;justify-items:start}
.err-text{color:var(--bad);font-size:var(--fs-xs)}
.model-list{font-size:var(--fs-xs);max-height:120px;overflow-y:auto;overflow-wrap:anywhere}.model-list:empty{display:none}
.code{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font:12.5px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;background:var(--surface-2);padding:12px;border-radius:var(--r-sm)}
.adm .notice{margin:0}
@media (max-width:820px){
  .adm{grid-template-columns:minmax(0,1fr)}
  .adm-side{position:fixed;top:0;left:0;bottom:0;width:min(280px,86vw);z-index:30;transform:translateX(-100%);transition:transform .2s;box-shadow:var(--sh-3)}
  .adm-side.open{transform:none}
  .adm-wrap{padding:16px 12px 48px}.card{padding:16px}
  .form-grid,.form-grid.three{grid-template-columns:minmax(0,1fr)}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tbl thead{display:none}.tbl tr{display:grid;grid-template-columns:minmax(0,1fr);border-bottom:1px solid var(--line);padding:10px 0}
  .tbl td{border:0;padding:3px 0}
}
/* trang hướng dẫn (huong-dan.html) */
.admin{max-width:820px;margin:0 auto;padding:24px 20px 64px}.admin li{margin:4px 0}.admin li.con{margin-left:22px}
.admin a{color:var(--accent);text-decoration:none;font-weight:500}.admin h1,.admin h2{letter-spacing:-.02em}
code{background:var(--surface-2);padding:1px 6px;border-radius:5px;font-size:.92em;overflow-wrap:anywhere}
/* [03/12] kết nối thông minh + thống kê */
.connect-result{display:grid;gap:14px}.connect-result:empty{display:none}
.sub-title{margin:6px 0 0;font-size:var(--fs);font-weight:600}
.more summary{cursor:pointer;font-size:var(--fs-sm);font-weight:500;color:var(--accent);padding:4px 0}
.more[open] summary{margin-bottom:10px}
.model-table{display:grid;gap:10px}.model-table .row .inp{max-width:260px}
.scroll-y{max-height:420px;overflow-y:auto;border:1px solid var(--line);border-radius:var(--r-sm);padding:0 8px}
.scroll-y thead th{position:sticky;top:0;background:var(--surface);padding-top:8px}
.bars{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:6px;align-items:end;height:200px;padding-top:18px}
.bar{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;align-items:end;text-align:center;min-width:0}
.bar i{display:block;background:var(--accent);border-radius:4px 4px 0 0;min-height:2px;width:100%;max-width:44px;justify-self:center}
.bar-val{font-size:10.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar-day{font-size:var(--fs-xs);color:var(--muted);padding-top:4px}
.stat>span.muted:last-child{font-size:var(--fs-xs)}
/* [03/12] Thẻ tiến trình (bố cục đo trên inkica Extract Studio) + thẻ kết quả có nền xem và so trước/sau */
.steps .step-card{list-style:none}
.steps:has(.step-card){padding:0;border:0;background:none}
.pg-card{position:relative;display:grid;justify-items:center;gap:8px;padding:18px 18px 16px;border-radius:var(--r-lg);background:var(--surface);border:1px dashed var(--accent-line);box-shadow:var(--sh-2);overflow:hidden;isolation:isolate;max-width:460px;margin:0 auto}
.pg-card::before{content:"";position:absolute;inset:-40px;z-index:-1;background:radial-gradient(circle,var(--accent-line) 1.2px,transparent 1.6px) 0 0/14px 14px;opacity:.55;animation:pg-drift 14s linear infinite;mask:radial-gradient(closest-side,transparent 55%,#000)}
@keyframes pg-drift{to{transform:translate(14px,14px)}}
.pg-top{width:100%;display:flex;align-items:center;gap:8px}
.pg-badge{display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 9px;border-radius:999px;background:var(--accent-soft);color:var(--accent);font-size:11px;font-weight:600;letter-spacing:.02em}
.pg-badge .ic{width:13px;height:13px}
.pg-variant{font-size:var(--fs-xs);color:var(--muted)}
.pg-clock{margin-left:auto;font:500 12px/1 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--ink-2);background:var(--surface-2);padding:6px 9px;border-radius:999px;min-width:58px;text-align:center}
.pg-thumb{position:relative;width:170px;height:170px;border-radius:var(--r);border:1px solid var(--line);overflow:hidden;background:repeating-conic-gradient(#f0f0f3 0 25%,#fff 0 50%) 0 0/12px 12px;margin:4px 0 6px}
.pg-thumb img{width:100%;height:100%;object-fit:contain;transition:opacity .3s}
.pg-card.has-preview .pg-thumb{border-color:var(--accent-line)}
.pg-bar{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--line);overflow:hidden}
.pg-bar::after{content:"";position:absolute;inset:0;width:40%;background:linear-gradient(90deg,transparent,var(--accent),transparent);animation:pg-flow 1.6s ease-in-out infinite}
@keyframes pg-flow{from{transform:translateX(-100%)}to{transform:translateX(260%)}}
.pg-title{font-size:var(--fs-md);text-align:center}
.pg-sub{font-size:var(--fs-sm);color:var(--muted);text-align:center;margin-top:-4px}
.pg-dots{display:flex;gap:6px;margin:2px 0 6px}
.pg-dots i{width:7px;height:7px;border-radius:50%;background:var(--accent);opacity:.3;animation:pg-wave 1.3s ease-in-out infinite}
.pg-dots i:nth-child(2){animation-delay:.15s}.pg-dots i:nth-child(3){animation-delay:.3s}.pg-dots i:nth-child(4){animation-delay:.45s}
@keyframes pg-wave{40%{opacity:1;transform:translateY(-3px)}}
.pg-steps{list-style:none;margin:0;padding:0;width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));position:relative}
.pg-steps::before{content:"";position:absolute;left:16.6%;right:16.6%;top:10px;height:2px;background:var(--line)}
.pg-steps li{display:grid;justify-items:center;gap:6px;font-size:var(--fs-xs);color:var(--faint);font-weight:500;position:relative;text-align:center}
.pg-node{width:20px;height:20px;border-radius:50%;background:var(--surface);border:2px solid var(--line-2);display:inline-flex;align-items:center;justify-content:center}
.pg-node .ic{width:11px;height:11px;stroke-width:3}
.pg-steps li.done{color:var(--ok)}.pg-steps li.done .pg-node{background:var(--ok);border-color:var(--ok);color:#fff}
.pg-steps li.on{color:var(--accent)}.pg-steps li.on .pg-node{border-color:var(--accent);box-shadow:0 0 0 4px var(--accent-soft)}
.pg-steps li.on .pg-node::after{content:"";width:6px;height:6px;border-radius:50%;background:var(--accent)}
@media (prefers-reduced-motion:reduce){.pg-card::before,.pg-bar::after,.pg-dots i{animation:none}}

.outputs:has(.result){grid-template-columns:minmax(0,1fr)}
.result{margin:0;border:1px solid var(--line);border-radius:var(--r-lg);overflow:hidden;background:var(--surface);box-shadow:var(--sh-1);min-width:0}
.result figcaption{padding:0 14px 12px;font-size:var(--fs-xs);color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stage{position:relative;height:min(62vh,560px);display:flex;align-items:center;justify-content:center;cursor:zoom-in;overflow:hidden;--cut:50%}
.stage>img{max-width:100%;max-height:100%;object-fit:contain;position:relative;z-index:1}
.stage.bg-checker{background:repeating-conic-gradient(#ececef 0 25%,#fff 0 50%) 0 0/18px 18px}
.stage.bg-light{background:#fff}.stage.bg-dark{background:#18181b}
.cmp-wrap{position:absolute;inset:0;display:none;align-items:center;justify-content:center;z-index:2;clip-path:inset(0 calc(100% - var(--cut)) 0 0);background:inherit}
.cmp-wrap img{max-width:100%;max-height:100%;object-fit:contain}
.cmp-line{display:none;position:absolute;top:0;bottom:0;left:var(--cut);width:2px;margin-left:-1px;background:var(--accent);z-index:3;box-shadow:0 0 0 1px rgba(255,255,255,.6)}
.stage.compare{cursor:ew-resize;touch-action:none}.stage.compare .cmp-wrap{display:flex}.stage.compare .cmp-line{display:block}
.result-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;border-top:1px solid var(--line)}
.result-spec{margin-left:auto;font-size:var(--fs-xs);color:var(--accent);font-weight:600;white-space:nowrap}
.btn.sm{height:30px;padding:0 10px;font-size:var(--fs-sm)}.btn.sm .ic{width:15px;height:15px}
@media (max-width:820px){.stage{height:min(52vh,420px)}.result-spec{margin-left:0;width:100%;order:5}}
/* [03/12] Extract Studio — bố cục theo trang Extract của inkica (khung xem giữa nền chấm + bảng phải) */
.xs{flex:1;min-height:0;display:flex}
.xs-canvas{position:relative;flex:1;min-width:0;display:flex;align-items:center;justify-content:center;padding:28px 28px 92px;
  background:radial-gradient(circle,#d4d4dc 1px,transparent 1.4px) 0 0/18px 18px,var(--bg)}
.xs-canvas.drag{background:radial-gradient(circle,var(--accent) 1.2px,transparent 1.6px) 0 0/18px 18px,var(--accent-soft)}
/* [05/12] khung thả tệp kiểu inkica (dùng chung Extract · Halftone · Thêu): viền đứt 2px bo 24px, ô tròn biểu tượng tải lên,
   rê chuột / đang kéo tệp vào ⇒ viền + chữ xanh ngọc, ô biểu tượng nhích lên (một lần, không lặp) */
.xs-drop{display:grid;justify-items:center;gap:6px;text-align:center;padding:40px 48px 36px;border:2px dashed #cbd5e1;border-radius:24px;background:var(--surface);cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.04);max-width:480px;transition:border-color .2s,background .2s,box-shadow .2s}
.xs-drop:hover,.xs-canvas.drag .xs-drop,.tm-canvas.drag .xs-drop{border-color:#06b6d4;background:#f5fdff;box-shadow:0 10px 30px rgba(8,145,178,.08)}
.xs-drop-ic{width:52px;height:52px;border-radius:50%;background:#ecfeff;border:1px solid #cffafe;color:#0891b2;align-items:center;justify-content:center;margin-bottom:8px;transition:transform .25s}
.xs-drop:hover .xs-drop-ic,.xs-canvas.drag .xs-drop-ic{transform:translateY(-3px)}
.xs-drop-ic .ic{width:22px;height:22px}
.xs-drop b{font-size:16px;font-weight:700;transition:color .2s}
.xs-drop:hover b,.xs-canvas.drag .xs-drop b{color:#0e7490}
.xs-drop .muted{font-size:13.5px;line-height:1.5}
.xs-drop kbd{display:inline-block;font:600 12px ui-monospace,Menlo,monospace;color:#0e7490;padding:0 2px}
.xs-drop-them{display:inline-flex;align-items:center;gap:8px;margin-top:14px;padding-top:14px;border-top:1px solid var(--line);width:100%;justify-content:center;font-size:13px;font-weight:600;color:var(--ink-2)}
.xs-drop-them .ic{width:16px;height:16px;color:var(--muted)}
.xs-drop-them small{font:600 11px ui-monospace,Menlo,monospace;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:2px 8px}
.xs-stage{width:100%;height:100%;display:flex;align-items:center;justify-content:center;min-height:0}
.xs-frame{position:relative;height:100%;max-height:calc(100vh - 220px);aspect-ratio:var(--ar,4/5);max-width:100%;border-radius:var(--r-lg);overflow:hidden;box-shadow:var(--sh-2);display:flex;align-items:center;justify-content:center;--cut:50%;border:1px solid var(--line)}
.xs-frame.bg-checker{background:repeating-conic-gradient(#ececef 0 25%,#fff 0 50%) 0 0/18px 18px}
.xs-frame.bg-light{background:#fff}.xs-frame.bg-dark{background:#17171a}
.xs-art{max-width:100%;max-height:100%;object-fit:contain;transform:scale(var(--z,1));transition:transform .15s;position:relative;z-index:1}
.xs-frame.dim .xs-art{filter:grayscale(.6) opacity(.35) blur(1px)}
.xs-frame .cmp-wrap{display:flex}.xs-frame .cmp-line{display:block}.xs-frame.compare{cursor:ew-resize;touch-action:none}
.xs-progress{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:5;pointer-events:none;padding:24px}
.xs-progress .pg-card{pointer-events:auto;width:min(440px,100%)}
.xs-toolbar{position:absolute;left:50%;bottom:22px;transform:translateX(-50%);display:flex;align-items:center;gap:8px;padding:8px;background:var(--surface);border:1px solid var(--line);border-radius:999px;box-shadow:var(--sh-2);z-index:6;max-width:calc(100% - 24px);flex-wrap:nowrap;justify-content:center;white-space:nowrap}
.xs-sep{width:1px;height:22px;background:var(--line)}
.xs-bgs{display:flex;gap:6px}
.xs-bg{width:24px;height:24px;border-radius:50%;border:1px solid var(--line-2)}
.xs-bg.checker{background:repeating-conic-gradient(#d4d4dc 0 25%,#fff 0 50%) 0 0/8px 8px}.xs-bg.light{background:#fff}.xs-bg.dark{background:#17171a}
.xs-bg.on{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--accent)}
.xs-zoom{display:flex;align-items:center;gap:2px;background:var(--surface-2);border-radius:999px;padding:2px}
.xs-zoom-v{font:500 12px ui-monospace,SFMono-Regular,Consolas,monospace;min-width:44px;text-align:center}
.xs-toolbar .btn{border-radius:999px}
.xs-panel{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:12px;padding:14px}
.xs-tabs{width:100%}.xs-tabs button{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:6px}.xs-tabs .ic{width:15px;height:15px}
.xs-body{display:grid;gap:12px}
.xs-sec{border:1px solid var(--line);border-radius:var(--r);padding:12px;display:grid;gap:10px;background:var(--surface)}
.xs-sec-h{display:flex;align-items:center;gap:8px;font-size:var(--fs-sm)}.xs-sec-h .ic{width:16px;height:16px;color:var(--accent)}
.xs-remove{margin-left:auto;display:inline-flex;align-items:center;gap:4px;color:var(--bad)}.xs-remove .ic{width:14px;height:14px;color:var(--bad)}
.xs-src{display:flex;align-items:center;gap:10px;padding:8px;border:1px solid var(--line);border-radius:var(--r-sm);min-width:0}
.xs-src img{width:48px;height:48px;object-fit:cover;border-radius:8px;border:1px solid var(--line);flex:none}
.xs-src-t{flex:1;min-width:0;display:grid;font-size:var(--fs-sm)}.xs-src-t b{font:500 12.5px ui-monospace,SFMono-Regular,Consolas,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.xs-src-t .muted{font-size:var(--fs-xs)}
.xs-src.empty{justify-content:center;border-style:dashed;cursor:pointer;color:var(--muted);font-size:var(--fs-sm);padding:16px}
.xs-auto-l{margin-left:auto;font-size:var(--fs-xs);color:var(--accent);font-weight:600}
.xs-switch{width:36px;height:20px;border-radius:999px;background:var(--line-2);position:relative;flex:none}
.xs-switch i{position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:var(--sh-1);transition:transform .15s}
.xs-switch.on{background:var(--accent)}.xs-switch.on i{transform:translateX(16px)}
.xs-auto{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:var(--r-sm);background:var(--accent-soft);color:var(--accent);font-size:var(--fs-sm)}
.xs-auto .badge{margin-left:auto;background:var(--surface);color:var(--accent)}.xs-auto .ic{width:15px;height:15px}
.xs-modes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}/* [04/12] 4 chế độ (thêm Over-Shoulder) ⇒ 2×2, 3 cột cắt chữ "Over-Sh…" */.xs-modes.off{opacity:.55}
.xs-mode{display:grid;gap:3px;padding:6px;border:1px solid var(--line);border-radius:var(--r-sm);text-align:left;font-size:var(--fs-xs);min-width:0}
.xs-mode b{font-size:var(--fs-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xs-mode .muted{font-size:11px}
.xs-mode.on{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.xs-mode-art{position:relative;aspect-ratio:1;border-radius:6px;margin-bottom:4px;background:var(--surface-2)}
.xs-mode-art.m-2d{background:linear-gradient(135deg,#fde68a,#f97316 60%,#7c2d12)}
.xs-mode-art.m-3d{background:repeating-linear-gradient(45deg,#fbcfe8 0 10px,#f9a8d4 10px 20px)}
.xs-mode-art.m-hd_master_lock{background:linear-gradient(135deg,#c7d2fe,#4f46e5)}
/* [04/12] ô chế độ mới: Over-Shoulder · Remove BG (Auto Hybrid · Product · Graphic) + lưới 3 cột khi công cụ có 3 chế độ */
.xs-mode-art.m-over_shoulder{background:linear-gradient(90deg,#e5e7eb,#9ca3af 50%,#e5e7eb)}
.xs-mode-art.m-auto{background:conic-gradient(from 45deg,#a5f3fc,#c4b5fd,#fbcfe8,#a5f3fc)}
.xs-mode-art.m-product{background:radial-gradient(circle at 50% 55%,#fcd34d 0 30%,transparent 31%),repeating-conic-gradient(#e5e7eb 0 25%,#fff 0 50%) 0 0/14px 14px}
.xs-mode-art.m-graphic{background:radial-gradient(circle at 50% 50%,#22d3ee 0 22%,#0e7490 23% 34%,transparent 35%),repeating-conic-gradient(#e5e7eb 0 25%,#fff 0 50%) 0 0/14px 14px}
.xs-modes.ba{grid-template-columns:repeat(3,minmax(0,1fr))}
/* Side by side: gốc | kết quả */
.xs-frame.side{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:center}.xs-frame.side .xs-art{width:100%;height:auto;max-height:100%;object-fit:contain}
.xs-kho{position:absolute;left:4px;bottom:4px;font:600 10px ui-monospace,Consolas,monospace;color:#fff;background:rgba(0,0,0,.55);padding:1px 5px;border-radius:4px}
.xs-main{height:46px;font-size:var(--fs-md)}
.xs-main.busy{background:var(--accent);border-color:var(--accent)}
.xs-cr{font-size:var(--fs-xs);background:rgba(255,255,255,.18);padding:2px 8px;border-radius:999px;white-space:nowrap;flex:none}/* [04/12] "1 cr" gãy 2 dòng */
.xs-main span:not(.xs-cr){white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.btn:not(.primary) .xs-cr{background:var(--accent-soft);color:var(--accent)}
.xs-spec{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-sm);font-size:var(--fs-sm)}
.xs-spec b{color:var(--accent)}
.xs-next-h{font-size:var(--fs-xs);font-weight:600;color:var(--muted);letter-spacing:.02em;margin-top:4px}
.xs-next{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--line);border-radius:var(--r);text-align:left;width:100%}
.xs-next:hover{background:var(--surface-2)}
.xs-next-ic{width:40px;height:40px;border-radius:10px;background:var(--ink);color:#fff;display:inline-flex;align-items:center;justify-content:center;flex:none}
.xs-next-t{flex:1;display:grid;min-width:0;font-size:var(--fs-sm)}.xs-next-t .muted{font-size:var(--fs-xs)}
.xs-arrow{transform:rotate(45deg);color:var(--muted)}
.xs-adv-h{display:flex;align-items:center;gap:10px;width:100%;text-align:left}
.xs-adv-ic{width:34px;height:34px;border-radius:10px;background:var(--accent-soft);color:var(--accent);display:inline-flex;align-items:center;justify-content:center;flex:none}
.xs-adv-t{flex:1;display:grid;font-size:var(--fs-sm)}.xs-adv-t .muted{font-size:var(--fs-xs)}
.xs-field{display:grid;gap:6px;font-size:var(--fs-sm);font-weight:500;color:var(--ink-2)}
.xs-field>span{display:flex;justify-content:space-between}.xs-val{font:500 12px ui-monospace,Consolas,monospace;color:var(--accent)}
.xs-field input[type=range]{width:100%;accent-color:var(--accent)}
.xs-keyers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.xs-keyers button{display:grid;text-align:left;padding:7px 9px;border:1px solid var(--line);border-radius:var(--r-sm);font-size:var(--fs-xs)}
.xs-keyers button b{font-size:var(--fs-sm)}.xs-keyers button.on{border-color:var(--accent);background:var(--accent-soft)}
.xs-hints{display:flex;gap:6px;flex-wrap:wrap}.xs-hints .chip{height:26px;font-size:var(--fs-xs)}
.xs-history{display:grid;gap:8px}
/* [04/12] Multiple Extract · hàng ô tiến độ · Pipette · lọc lịch sử (inkica) */
.xs-multi{display:flex;align-items:center;gap:8px;margin-top:8px;padding:8px 10px;border:1px solid var(--line);border-radius:var(--r-sm);font-size:var(--fs-sm);cursor:pointer;min-width:0}
.xs-multi>span:first-of-type{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xs-multi .muted{font:500 11px ui-monospace,Consolas,monospace}
.xs-multi.off{opacity:.5;pointer-events:none}.xs-multi:hover{border-color:var(--accent)}
.xs-hang{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:4px;margin-top:6px}
.xs-hang-o{position:relative;aspect-ratio:1;border-radius:6px;overflow:hidden;border:2px solid var(--line)}.xs-hang-o img{width:100%;height:100%;object-fit:cover}
.xs-hang-o.dang{border-color:var(--accent)}.xs-hang-o.xong{border-color:#16a34a}.xs-hang-o.loi{border-color:#dc2626}
.xs-pipette{display:flex;align-items:center;gap:8px;padding:7px 9px;border:1px solid var(--line);border-radius:var(--r-sm);font-size:var(--fs-xs);cursor:pointer}
.xs-pipette input{width:22px;height:22px;padding:0;border:0;border-radius:50%;background:none;cursor:pointer}.xs-pipette>span{display:grid}.xs-pipette b{font-size:var(--fs-sm)}
.xs-pipette.on{border-color:var(--accent);background:var(--accent-soft)}
.xs-hfilter{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.xs-ip{display:flex;align-items:center;gap:8px;margin-top:8px;padding:8px 10px;border-radius:var(--r-sm);font-size:var(--fs-sm);min-width:0}
.xs-ip span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xs-ip b{font-size:var(--fs-xs)}
.xs-ip.high{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}.xs-ip.medium{background:#fffbeb;color:#b45309;border:1px solid #fde68a}
.xs-h-item{display:flex;align-items:center;gap:10px;padding:8px;border:1px solid var(--line);border-radius:var(--r);text-align:left;width:100%;min-width:0}
.xs-h-item:hover{background:var(--surface-2)}
.xs-h-thumb{width:56px;height:56px;border-radius:8px;flex:none;overflow:hidden;background:repeating-conic-gradient(#ececef 0 25%,#fff 0 50%) 0 0/10px 10px}
.xs-h-thumb img{width:100%;height:100%;object-fit:contain}
.xs-h-t{display:grid;min-width:0;font-size:var(--fs-sm)}.xs-h-t b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xs-h-t .muted{font-size:var(--fs-xs)}
.xs-queue{position:fixed;right:24px;bottom:24px;z-index:45;display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--sh-3);font-size:var(--fs-sm);max-width:340px}
.xs-queue img{width:36px;height:36px;border-radius:8px;object-fit:cover}
.xs-queue span:last-child{display:grid;min-width:0}.xs-queue b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xs-queue .muted{font-size:var(--fs-xs)}
.xs-queue-dot{width:10px;height:10px;border-radius:50%;background:var(--accent);flex:none;box-shadow:0 0 0 4px var(--accent-soft)}
@media (max-width:820px){.xs-canvas{padding:14px 12px 84px}.xs-frame{max-height:calc(100dvh - 210px)}.xs-zoom,.xs-sep{display:none}.xs-toolbar{gap:6px;padding:6px;bottom:14px}.xs-toolbar .btn.sm{padding:0 10px}
  /* [04/12] có kết quả thì thanh có thêm Split/Side by side ⇒ 390px tràn 12–15px: màn hẹp chỉ giữ icon cho chip và nút tải */
  .xs-toolbar .chip span,.xs-toolbar a.btn span{display:none}.xs-toolbar .chip{padding:0 9px}}

/* [03/12] điểm giống artwork gốc */
.xs-fid{display:grid;gap:6px;padding:10px 12px;border:1px solid var(--line);border-radius:var(--r-sm);font-size:var(--fs-xs)}
.xs-fid-h{display:flex;justify-content:space-between;align-items:baseline;font-size:var(--fs-sm)}
.xs-fid-bar{height:6px;border-radius:999px;background:var(--surface-2);overflow:hidden}.xs-fid-bar i{display:block;height:100%;border-radius:999px}
.xs-fid.ok b{color:var(--ok)}.xs-fid.ok .xs-fid-bar i{background:var(--ok)}
.xs-fid.warn b{color:var(--warn)}.xs-fid.warn .xs-fid-bar i{background:#f79009}
.xs-fid.bad b{color:var(--bad)}.xs-fid.bad .xs-fid-bar i{background:var(--bad)}
.xs-fid-w{color:var(--warn)}.xs-fid.bad .xs-fid-w{color:var(--bad)}

/* [04/12] Template Mockup */
.tm-canvas { display: flex; align-items: stretch; justify-content: center; overflow-y: auto; }
.tm-wrap { width: 100%; max-width: 1100px; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.tm-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tm-card { display: grid; gap: 8px; padding: 8px; border-radius: 12px; border: 1px solid #e4e4e7; background: #fff; cursor: pointer; text-align: left; color: #18181b; font: inherit; min-width: 0; }
.tm-card:hover { filter: brightness(1.08); }
.tm-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.tm-card span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-stage { width: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; padding: 16px; justify-items: center; }
.tm-frame { position: relative; max-height: 100%; max-width: min(100%, 860px); }
.tm-frame img { display: block; max-width: 100%; max-height: calc(100vh - 200px); border-radius: 10px; }
.tm-frame.dim img { opacity: .6; transition: opacity .2s; }
.tm-area { position: absolute; border: 2px dashed rgba(255, 140, 40, .9); border-radius: 4px; pointer-events: none; }
.tm-stage .xs-toolbar { position: static; transform: none; left: auto; bottom: auto; max-width: 100%; flex-wrap: wrap; }
.tm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.tm-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.tm-sw.on { outline: 2px solid #ff8c28; outline-offset: 2px; }
.tm-sw.orig { background: conic-gradient(#fff 0 25%, #111 0 50%, #aaa 0 75%, #1f2a44 0); }
.tm-sw.pick input { position: absolute; inset: -6px; width: 44px; height: 44px; border: 0; padding: 0; cursor: pointer; }

/* [04/12] New Chat kiểu inkica: thẻ ảnh mẫu · nhãn REF · Add REF · tìm/tải kho */
.tool-card.show { padding: 8px; gap: 4px; }
.tool-card.show .show-img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: repeating-conic-gradient(#f1f1f3 0 25%, #fff 0 50%) 0 0 / 16px 16px; margin-bottom: 6px; }
.tool-card.show .show-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tool-card.show b, .tool-card.show .muted { padding: 0 4px; }
.tool-card.show .price { padding: 0 4px 4px; }
.att { position: relative; }
.att-ref { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #18181b; color: #fff; }
.att-add { display: grid; place-items: center; align-content: center; gap: 2px; border: 1.5px dashed #a1a1aa; background: transparent; color: #52525b; font-size: 11px; cursor: pointer; }
.assets-tools { display: flex; gap: 8px; padding: 8px 12px 0; align-items: center; }
.asset-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 34px; border-radius: 9px; background: #f4f4f5; }
.asset-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: inherit; font-size: 13px; }
body.xs-on .assets-tools { display: none; }
#micBtn.active { color: #dc2626; }

@media (max-width: 560px) { #toolMenu { width: auto; max-width: calc(100vw - 32px); left: 0; right: auto; } }

/* [04/12] Halftone Studio */
.ht-stage { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; padding: 16px; }
.ht-scroll { overflow: auto; display: grid; place-items: center; min-height: 0; }
.ht-frame { position: relative; width: calc(min(100%, 760px) * var(--z, 1)); border-radius: 10px; }
.ht-frame img { display: block; width: 100%; height: auto; }
.ht-frame.bg-dark { background: #18181b; } .ht-frame.bg-light { background: #f4f4f5; }
.ht-frame.bg-checker { background: repeating-conic-gradient(#e4e4e7 0 25%, #fff 0 50%) 0 0 / 18px 18px; }
.ht-frame.dim img { opacity: .55; transition: opacity .2s; }
.ht-frame .ht-goc { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; clip-path: inset(0 calc(100% - var(--cut, 50%)) 0 0); }
.ht-frame .ht-line { position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 2px; background: #ff8c28; pointer-events: none; }
.ht-frame.compare { cursor: ew-resize; }
.ht-stage .xs-toolbar { position: static; transform: none; justify-self: center; flex-wrap: wrap; max-width: 100%; }
.ht-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* [04/12] AOP Design */
.ao-views { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ao-slot { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 150px; padding: 12px; border: 1.5px dashed #d4d4d8; border-radius: 12px; cursor: pointer; background: #fff; text-align: center; }
.ao-slot.co { border-style: solid; }
.ao-slot img { max-height: 110px; max-width: 100%; border-radius: 8px; }
.ao-plus { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #f4f4f5; }
.ao-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.ao-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 100%; }
.ao-g { width: 56px; height: 56px; padding: 0; border-radius: 10px; border: 2px solid transparent; overflow: hidden; cursor: pointer; background: #fff; }
.ao-g.on { border-color: #ff8c28; }
.ao-g img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ao-tile { height: 140px; border-radius: 10px; background-size: 70px auto; background-repeat: repeat; border: 1px solid #e4e4e7; }

/* [04/12] Embroidery Studio */
.em-frame { position: relative; width: min(100%, 720px); border-radius: 12px; padding: 18px; }
.em-frame img { display: block; width: 100%; height: auto; }
.em-frame.dim img { opacity: .5; }
.em-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; }
.em-stats span { display: grid; text-align: center; }
.em-stats b { font-family: ui-monospace, monospace; font-size: 14px; }

.em-stage { grid-template-rows: auto minmax(0, 1fr) auto; }
.em-stats { align-self: start; }

/* [04/12] thẻ mẫu chuyển động (New Chat) — quet: vạch quét trước→sau · vong: lần lượt từng biến thể */
.tool-card.show .show-img { position: relative; }
.tool-card.show .show-img.toi { background: #18181b; }
.show-img img { position: absolute; inset: 0; }
.show-img.an-quet img:nth-of-type(2) { animation: quet 5s ease-in-out infinite; }
.show-img.an-quet .show-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); animation: vach 5s ease-in-out infinite; }
@keyframes quet { 0%, 12% { clip-path: inset(0 100% 0 0); } 45%, 80% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 100% 0 0); } }
@keyframes vach { 0%, 12% { left: 0; opacity: 1; } 45% { left: calc(100% - 2px); opacity: 1; } 50%, 80% { left: calc(100% - 2px); opacity: 0; } 100% { left: 0; opacity: 0; } }
.show-img.an-vong img { opacity: 0; animation: vong calc(var(--n) * 2s) infinite; animation-delay: calc(var(--i) * 2s); }
@keyframes vong { 0% { opacity: 0; } 4%, 25% { opacity: 1; } 29%, 100% { opacity: 0; } }   /* chuỗi 4 khung, mỗi khung 2s */
.tool-card.show:hover .show-img img { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .show-img img, .show-line { animation: none !important; } .show-img.an-vong img { opacity: 0; } .show-img.an-vong img:last-of-type { opacity: 1; } }

/* [04/12] kéo thả ảnh vào chat + tô vùng REF (như inkica) */
.drop-overlay { display: none; }
body.keo-tep .drop-overlay { display: grid; place-items: center; position: fixed; inset: 0; z-index: 60; background: rgba(250, 250, 252, .82); backdrop-filter: blur(2px); pointer-events: none; }
body.keo-tep .drop-overlay > div { display: grid; justify-items: center; gap: 8px; padding: 36px 48px; border: 2px dashed #06b6d4; border-radius: 24px; background: #fff; box-shadow: 0 20px 50px rgba(8, 145, 178, .14); }
.attach-hint { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.att img { cursor: crosshair; }
.att.co-vung { outline: 2px solid #ff5a28; outline-offset: 1px; border-radius: 10px; }
.brush-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(9, 9, 11, .6); padding: 16px; }
.brush-box { background: #fff; border-radius: 16px; padding: 14px; display: grid; gap: 12px; width: min(920px, 100%); max-height: calc(100vh - 32px); grid-template-rows: auto minmax(0, 1fr) auto; }
.brush-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.brush-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brush-stage { position: relative; min-height: 0; display: grid; place-items: center; background: center / contain no-repeat; }
.brush-cv { max-width: 100%; max-height: calc(100vh - 200px); cursor: crosshair; touch-action: none; }
.brush-bar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.brush-bar .xs-field { flex: 1; min-width: 160px; }
.brush-wrap { position: relative; display: inline-block; max-width: 100%; }
.brush-wrap img { display: block; max-width: 100%; max-height: calc(100vh - 200px); }
.brush-wrap .brush-cv { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }

/* [04/12 sửa] màn New Chat theo bố cục inkica: tiêu đề + nhãn, lưới 3 cột thẻ có kịch bản bước */
.sc-dau { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.sc-dau b { font-size: 22px; letter-spacing: -.02em; }
.sc-logo { color: #4f46e5; }
.sc-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #0e7490; background: #ecfeff; border: 1px solid #a5f3fc; padding: 3px 10px; border-radius: 999px; }
.sc-badge svg { width: 12px; height: 12px; }
.tool-grid.sc-luoi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 780px; margin: 0 auto; }
@media (max-width: 720px) { .tool-grid.sc-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sc-the { display: grid; gap: 3px; padding: 8px 8px 12px; text-align: left; border-radius: 16px; border: 1px solid #e4e4e7; background: #fff; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.sc-the:hover { border-color: #a5b4fc; }
.sc-the b { font-size: 14px; padding: 6px 4px 0; }
.sc-the .muted { font-size: 12px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-khung { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #eef4f8; }
.sc-khung[data-nen=checker], .sc-tren[data-n=checker] { background: repeating-conic-gradient(#eef1f4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.sc-khung[data-nen=dark] { background: #18181b; }
.sc-khung img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .25s; }
.sc-khung .sc-day.mo { opacity: 0; }
.sc-tren { clip-path: inset(0 100% 0 0); }
.sc-khung[data-nen-tren=checker] .sc-tren { background: repeating-conic-gradient(#eef1f4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.sc-khung[data-nen-tren=light] .sc-tren { background: #f4f4f5; }
.sc-khung[data-nen-tren=dark] .sc-tren { background: #18181b; }
.sc-tren.chay { transition: clip-path 1.6s cubic-bezier(.6, 0, .4, 1); clip-path: inset(0 0 0 0); }
.sc-vach { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #06b6d4; box-shadow: 0 0 10px #22d3ee; opacity: 0; }
.sc-vach.chay { opacity: 1; left: calc(100% - 2px); transition: left 1.6s cubic-bezier(.6, 0, .4, 1); }
.sc-lup { position: absolute; width: 26%; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.95); box-shadow: 0 3px 10px rgba(15,23,42,.22), 0 0 0 1px rgba(15,23,42,.12);
  transform: translate(-50%, -50%) scale(.6); opacity: 0; background-size: 380%; background-repeat: no-repeat; background-color: #f4f4f5;
  transition: left .85s ease-in-out, top .85s ease-in-out, background-position .85s ease-in-out, opacity .3s, transform .3s; pointer-events: none; }
.sc-lup[data-nen=dark] { background-color: #18181b; }
.sc-lup.chay { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sc-nhan { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(9,9,11,.72); color: #fff; opacity: 0; transition: opacity .3s; }
.sc-nhan.co { opacity: 1; }
.sc-cham { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; gap: 5px; padding: 4px 6px; border-radius: 999px; background: rgba(255,255,255,.85); }
.sc-cham i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); }
.sc-cham i.on { outline: 2px solid #06b6d4; outline-offset: 1px; }

.menu-lang { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.menu-lang select { flex: 1; border: 1px solid #e4e4e7; border-radius: 8px; padding: 4px 6px; font: inherit; background: #fff; }

.sc-the .sc-phu { display: flex; gap: 6px; min-width: 0; }
.sc-the .sc-phu > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sc-the .sc-gia { flex: none; color: #4f46e5; }

/* [04/12] khung chat agent kiểu inkica */
.composer { border-radius: 22px; border: 1px solid #d4d4d8; box-shadow: 0 8px 28px rgba(15, 23, 42, .08); position: relative; }
.composer:focus-within { border-color: #67e8f9; box-shadow: 0 0 0 3px rgba(103, 232, 249, .25), 0 8px 28px rgba(15, 23, 42, .08); }
.composer-bar { border-top: 1px solid #f1f1f3; padding-top: 8px; gap: 8px; }
/* [04/12] màn hẹp: hàng nút khung soạn xuống dòng, nút Gửi rơi sang trái dòng 2 (soát trước deploy, 7 trang) ⇒ một dòng, chip công cụ co + cắt "…" */
@media (max-width: 480px) {
  .composer-bar { flex-wrap: nowrap; gap: 6px; }
  .composer-bar .picker { min-width: 0; flex: 0 1 auto; }
  .composer-bar .mode-chip { max-width: 128px; min-width: 0; }
  .composer-bar .mode-chip #toolChipText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .composer-bar .cost { white-space: nowrap; }
  .composer-bar .attach-hint:empty { display: none; }
}
.ref-lib { width: 32px; height: 32px; border-radius: 50%; border: 1.5px dashed #67c5d8; color: #0e7490; background: #f0fdff; }
.dyn-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid #e4e4e7; background: #f8fafc; font: inherit; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; white-space: nowrap; }
.dyn-chip .dyn-drop { width: 8px; height: 10px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #38bdf8; }
.dyn-chip .dyn-x { display: none; font-size: 14px; line-height: 1; color: #0e7490; }
.dyn-chip.on { background: #ecfeff; border-color: #67e8f9; color: #0e7490; }
.dyn-chip.on .dyn-x { display: inline; }
.mode-chip { border-radius: 999px; background: #f1f5f9; border-color: #e2e8f0; }
.icon-btn.round { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #e4e4e7; }
.send.round { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #fff; border: 0; }
.send.round:disabled { opacity: .5; }
.slash-menu { left: 12px; right: auto; bottom: calc(100% + 6px); width: min(520px, calc(100vw - 48px)); max-height: 420px; overflow-y: auto; padding: 6px; }
.slash-menu button { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit; text-align: left; }
.slash-menu button b { color: #0e7490; font-size: 13px; font-family: ui-monospace, monospace; }
.slash-menu button .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-menu button.on, .slash-menu button:hover { background: #ecfeff; }
@media (max-width: 560px) { .dyn-chip #dynText { display: none; } .attach-hint { display: none; } }

/* [04/12] khung ví dụ trước → sau ở các trang công cụ */
.vd-khung { width: min(100%, 740px); margin: 16px auto 0; padding: 16px; border-radius: 18px; border: 1px solid #e4e4e7; background: #fff; box-shadow: 0 6px 24px rgba(15,23,42,.06); display: grid; gap: 12px; }
.vd-dau { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vd-dau b { font-size: 14px; }
.vd-nhan { font-size: 11px; font-weight: 700; font-family: ui-monospace, monospace; color: #0e7490; background: #ecfeff; border: 1px solid #a5f3fc; padding: 2px 8px; border-radius: 999px; }
.vd-hang { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; }
.vd-o { margin: 0; display: grid; gap: 8px; padding: 10px; border-radius: 14px; border: 1px solid #e4e4e7; }
.vd-o.sau { border-color: #a5f3fc; }
.vd-anh { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eef4f8; }
.vd-anh[data-nen=checker] { background: repeating-conic-gradient(#eef1f4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.vd-anh[data-nen=dark] { background: #18181b; }
.vd-anh img { width: 100%; height: 100%; object-fit: contain; display: block; }
.vd-o figcaption { text-align: center; font-size: 12.5px; font-weight: 600; }
.vd-o.sau figcaption { color: #0e7490; font-family: ui-monospace, monospace; font-size: 12px; }
.vd-mui { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #22d3ee, #0ea5e9); color: #fff; font-weight: 700; }
.vd-chan { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
@media (max-width: 560px) { .vd-hang { grid-template-columns: minmax(0, 1fr); } .vd-mui { justify-self: center; transform: rotate(90deg); } }

.xs-canvas { flex-direction: column; overflow-y: auto; }
.xs-canvas > .xs-drop { width: min(100%, 740px); max-width: 740px; border-color: #67c5d8; }
.xs-vidu { width: 100%; display: grid; justify-items: center; }
.xs-vidu.an { display: none; }

.tm-canvas { flex-direction: column; align-items: center; }
.tm-canvas > .xs-drop { width: min(100%, 740px); max-width: 740px; margin-top: 24px; }

/* [04/12] Collection (như inkica): toàn bề rộng, ẩn kho ảnh bên phải */
body.col-on .assets { display: none; }
.col-view { flex: 1; min-width: 0; overflow-y: auto; }
.col-view.an { display: none; }
.col-wrap { padding: 14px 20px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.col-head { display: grid; gap: 10px; }
.col-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid #e4e4e7; background: #f8fafc; width: fit-content; max-width: 100%; }
.col-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; white-space: nowrap; }
.col-tab svg { width: 15px; height: 15px; }
.col-tab .count { font-size: 11px; color: #94a3b8; font-weight: 600; }
.col-tab.on { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.col-more { position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; display: grid; padding: 4px; min-width: 190px; }
.col-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col-search { width: min(100%, 300px); }
.col-up { background: linear-gradient(135deg, #06b6d4, #2563eb); border: 0; cursor: pointer; }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.col-card { margin: 0; position: relative; border: 1px solid #e4e4e7; border-radius: 14px; background: #fff; padding: 8px; display: grid; gap: 6px; min-width: 0; }
.col-img { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: repeating-conic-gradient(#eef1f4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.col-card.photo .col-img { background: #f4f4f5; }
.col-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.col-kind { position: absolute; left: 6px; top: 6px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(9,9,11,.7); color: #fff; }
.col-card figcaption { display: grid; gap: 2px; padding: 0 2px; min-width: 0; }
.col-card figcaption b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-card figcaption .muted { font-size: 11.5px; }
.col-act { position: absolute; top: 14px; right: 14px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.col-card:hover .col-act, .col-card:focus-within .col-act { opacity: 1; }
@media (hover: none) { .col-act { opacity: 1; } }
.col-empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 24px; margin: 40px auto; max-width: 440px; border: 1px solid #e4e4e7; border-radius: 18px; background: #fff; }
.col-empty-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; border: 1px solid #e4e4e7; color: #0891b2; }
.col-empty-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* [04/12 làm lại] AOP Design = trình thiết kế rập may (bố cục theo AOP 3D Pro của inkica) */
.ao-view { flex-direction: column; min-width: 0; }
.ao-view:not(.an) { display: flex; }
.ao-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #e4e4e7; flex-wrap: wrap; }
.ao-title { font-size: 16px; }
.ao-pill { font-size: 11px; font-weight: 700; color: #0e7490; background: #ecfeff; border: 1px solid #a5f3fc; padding: 2px 9px; border-radius: 999px; }
.ao-sp { flex: 1; }
.ao-mid { flex: 1; display: flex; min-height: 0; min-width: 0; }
.ao-rail { width: 92px; flex: none; overflow-y: auto; padding: 10px 8px; display: grid; gap: 8px; align-content: start; border-right: 1px solid #e4e4e7; background: #fafafa; }
.ao-rail.an { display: none; }
.ao-piece { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border: 1px solid #e4e4e7; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.ao-piece.on { border-color: #06b6d4; box-shadow: 0 0 0 2px #cffafe; }
.ao-piece b { font-size: 10.5px; line-height: 1.2; text-align: center; }
.ao-piece-n { position: absolute; left: 5px; top: 3px; font-size: 9px; color: #94a3b8; }
.ao-dot { position: absolute; right: 6px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #06b6d4; }
.ao-svg { display: block; max-width: 70px; }
.ao-canvas { flex: 1; min-width: 0; overflow: auto; padding: 16px; background: radial-gradient(#e5e7eb 1px, transparent 1px) 0 0 / 16px 16px; }
.ao-work { display: grid; gap: 14px; height: 100%; min-height: 520px; }
.ao-work.che-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ao-work.che-pattern, .ao-work.che-preview { grid-template-columns: minmax(0, 1fr); }
.ao-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px; border: 1px solid #e4e4e7; border-radius: 14px; background: #fff; padding: 10px; min-width: 0; }
.ao-pane-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ao-pane-h .seg { flex-wrap: wrap; max-width: 100%; }   /* [04/12] dải Front·Back·Side·360°·Record ở 390 đẩy khung tràn 10px */
.ao-pane { min-width: 0; }
.ao-piece svg { max-width: 100%; height: auto; }
.ao-rail { grid-template-columns: minmax(0, 1fr); } .ao-piece { min-width: 0; } .ao-piece b { overflow-wrap: anywhere; }   /* hoodie 11 mảnh: thanh cuộn dọc ăn chỗ ⇒ ô mảnh 81px > 76px */   /* tay áo 17×9 ở cao 48px rộng 90px > ray 70px ⇒ ray cuộn ngang */
.ao-pane-h .muted { font-size: 12px; font-family: ui-monospace, monospace; }
.ao-flat-in, .ao-3d-in { display: grid; place-items: center; min-height: 0; overflow: hidden; }
.ao-svg.sua { max-width: 100%; max-height: calc(100vh - 230px); width: 100%; height: 100%; touch-action: none; }
.ao-3d-in img { max-width: 100%; max-height: calc(100vh - 230px); border-radius: 10px; }
.ao-3d-in.dim img { opacity: .55; transition: opacity .2s; }
.ao-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ao-chips .chip:disabled { opacity: .45; }
.ao-lib { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.ao-lib-o { aspect-ratio: 1; padding: 3px; border-radius: 8px; border: 1.5px solid #e4e4e7; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 10px 10px; cursor: pointer; }
.ao-lib-o.on { border-color: #06b6d4; }
.ao-lib-o img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ao-up { margin-left: auto; cursor: pointer; }
.ao-steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }
.ao-cat { display: grid; gap: 16px; }
.ao-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.ao-cat-card { position: relative; display: grid; border: 0; padding: 0; border-radius: 16px; overflow: hidden; background: linear-gradient(#f8fafc 55%, #1e293b); cursor: pointer; aspect-ratio: 3 / 4; }
.ao-cat-card img { width: 100%; height: 100%; object-fit: cover; }
.ao-cat-tag { position: absolute; left: 12px; top: 12px; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: #fff; color: #0f172a; z-index: 1; }
.ao-cat-t { position: absolute; left: 12px; bottom: 12px; display: grid; text-align: left; color: #fff; z-index: 1; }
.ao-cat-t b { font-size: 15px; } .ao-cat-t span { font-size: 11.5px; opacity: .85; }
.ao-cat-card::after { content: ''; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(15,23,42,.85)); }
.ao-cat-ic { position: absolute; right: 12px; bottom: 12px; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(15,23,42,.6); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.ao-hop { width: min(640px, 100%); }
@media (max-width: 820px) { .ao-work.che-split { grid-template-columns: minmax(0, 1fr); } .ao-rail { width: 70px; } }

@media (min-width: 1181px) { body.col-on .app { grid-template-columns: minmax(0, 264px) minmax(0, 1fr); } }

.ao-3d-gl { width: 100%; height: 100%; min-height: 440px; border-radius: 12px; background: radial-gradient(circle at 50% 38%, #f1f5f9, #c8d0db); overflow: hidden; }
.ao-3d-gl canvas { position: absolute; inset: 0; display: block; width: 100% !important; height: 100% !important; cursor: default; }   /* như inkica: vải trống = con trỏ thường, rê trúng hình in = "grab" (JS đặt) */   /* tuyệt đối: canvas không đẩy khung cao lên ⇒ hết vòng tự giãn */

.ao-3d-gl { display: grid; place-items: center; position: relative; }
.ao-3d-gl .ao-3d-wait { position: absolute; }
.ao-3d-gl.tha, .ao-flat-in.tha { outline: 2px dashed #06b6d4; outline-offset: -6px; }
.ao-3d-wait { font-size: 13px; }

/* [04/12] STUDIO RẬP AOP kiểu inkica (đo trên trang họ): toàn màn tối, lưới chấm, cột mảnh + cột công cụ trái, rập 2D | áo 3D, thanh nổi dưới, bảng phải */
body.ao-studio #aoView { position: fixed; inset: 0; z-index: 60; background: #0b0f15; }
.as-studio { --as-bg: #0d1117; --as-line: #1f2733; --as-card: #161c26; --as-tx: #e6ebf2; --as-mu: #8b96a8; --as-ac: #1f8fff; display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; width: 100%; color: var(--as-tx); background: var(--as-bg); font-size: 13px; }
.as-studio button { font: inherit; color: inherit; }
.as-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--as-line); flex-wrap: wrap; min-width: 0; }
.as-title { font-size: 14.5px; }
.as-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--as-line); background: #141a23; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.as-btn:hover { filter: brightness(1.2); } .as-btn .ic { width: 15px; height: 15px; }
.as-btn.primary { background: var(--as-ac); border-color: var(--as-ac); color: #fff; } .as-btn.block { width: 100%; justify-content: center; } .as-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.as-btn:disabled { opacity: .5; cursor: default; }
.as-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: #141a23; border: 1px solid var(--as-line); }
.as-seg button { border: 0; background: none; padding: 6px 13px; border-radius: 9px; cursor: pointer; color: var(--as-mu); font-weight: 600; }
.as-seg button.on { background: var(--as-ac); color: #fff; } .as-seg.sm button { padding: 4px 10px; font-size: 12px; }
.as-body { display: grid; grid-template-columns: 92px 58px minmax(0, 1fr) 330px; min-height: 0; }
.as-pieces { overflow-y: auto; padding: 8px 6px; display: grid; gap: 6px; align-content: start; grid-template-columns: minmax(0, 1fr); border-right: 1px solid var(--as-line); }
.as-piece { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 10px; border: 1px solid var(--as-line); background: var(--as-card); cursor: pointer; min-width: 0; }
.as-piece.on { border-color: var(--as-ac); box-shadow: 0 0 0 1px var(--as-ac) inset; }
.as-piece b { font-size: 10.5px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.as-piece-n { position: absolute; left: 6px; top: 4px; font-size: 10px; color: var(--as-mu); }
.as-piece-c { font-size: 10px; color: var(--as-mu); } .as-piece.sheet .ic { width: 26px; height: 26px; color: var(--as-mu); }
.as-dot { position: absolute; right: 6px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--as-ac); }
.as-mini { display: block; width: 100%; max-width: 62px; height: 46px; }
.as-tools { display: grid; align-content: center; gap: 4px; padding: 8px 5px; border-right: 1px solid var(--as-line); }
.as-tool { display: grid; justify-items: center; gap: 3px; padding: 8px 2px; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--as-mu); font-size: 10px; }
.as-tool .ic { width: 18px; height: 18px; } .as-tool:hover { color: var(--as-tx); background: #141a23; }
.as-tool.on { color: #fff; background: #14304f; border-color: #1d4f80; } .as-tool.up { color: #fff; background: var(--as-ac); }
.as-work { position: relative; display: grid; min-width: 0; min-height: 0; }
.as-work.che-split { grid-template-columns: repeat(2, minmax(0, 1fr)); } .as-work.che-pattern, .as-work.che-3d { grid-template-columns: minmax(0, 1fr); }
.nen-dark .as-work { background: radial-gradient(#253041 1px, transparent 1.2px) 0 0 / 22px 22px, #0d1117; }
.nen-grid .as-work { background: linear-gradient(#d7e2ee 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(90deg, #d7e2ee 1px, transparent 1px) 0 0 / 22px 22px, #eef3f8; }
.nen-studio .as-work { background: radial-gradient(ellipse at 50% 35%, #fbfbfa, #d9dcdf 75%); }
.as-2d { position: relative; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--as-line); }
.as-svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; }
.as-card { fill: #1a2230; stroke: #2a3546; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.nen-grid .as-card, .nen-studio .as-card { fill: #ffffff; stroke: #c6d1dd; }
.as-card.on { stroke: #38a1ff; stroke-width: 1.5px; }
.as-outline { stroke: #9fb0c6; stroke-width: 1.2px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.as-center { stroke: #9fb0c6; stroke-opacity: .45; stroke-width: 1px; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.as-svg image.lop { cursor: move; }
.as-box { fill: transparent; stroke: #2f9bff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: move; }
.as-h { fill: #fff; stroke: #1f8fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.h-nw, .h-se { cursor: nwse-resize; } .h-ne, .h-sw { cursor: nesw-resize; } .h-n, .h-s { cursor: ns-resize; } .h-e, .h-w { cursor: ew-resize; }
.as-knob { fill: #dfe9f5; stroke: #1f8fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: grab; } .as-knob-l { stroke: #2f9bff; stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.as-tag { fill: #1f8fff; pointer-events: none; } .as-tag-t { fill: #fff; font-weight: 700; font-family: Inter, system-ui, sans-serif; pointer-events: none; }
.as-guide { stroke: #f472b6; stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.as-float { position: absolute; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: #1a212c; border: 1px solid #2b3545; box-shadow: 0 8px 24px rgba(0,0,0,.45); z-index: 3; }
.as-float.an { display: none; } .as-float i { width: 1px; height: 18px; background: #334155; margin: 0 3px; }
.as-float button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: #cbd5e1; }
.as-float button:hover { background: #263142; color: #fff; } .as-float button.do { color: #f87171; } .as-float .ic { width: 16px; height: 16px; }
.as-3d { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.as-3d-h { position: absolute; top: 10px; right: 12px; left: 12px; display: flex; justify-content: flex-end; gap: 8px; z-index: 2; flex-wrap: wrap; }
.as-3d .ao-3d-gl { grid-row: 1 / -1; min-height: 0; border-radius: 0; background: none; }
.nen-grid .as-studio .as-seg, .nen-studio .as-3d-h .as-seg { background: #1a212c; }
.as-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 16px; background: #141a23; border: 1px solid #263041; box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 4; max-width: calc(100% - 20px); flex-wrap: wrap; justify-content: center; }
.as-grp { display: flex; align-items: center; gap: 2px; padding: 0 4px; } .as-grp + .as-grp { border-left: 1px solid #263041; padding-left: 8px; }
.as-grp button { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; border-radius: 9px; background: none; cursor: pointer; color: #b8c2d1; font-weight: 600; font-size: 12px; }
.as-grp button.on { background: var(--as-ac); color: #fff; } .as-grp button:hover:not(:disabled):not(.on) { background: #222b39; } .as-grp button:disabled { opacity: .35; cursor: default; } .as-grp .ic { width: 15px; height: 15px; }
.as-zoom { min-width: 40px; text-align: center; font-weight: 700; font-size: 12px; }
.as-grp .as-nen { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid #334155; }
.as-nen.studio { background: radial-gradient(#fff, #cfd3d8); } .as-nen.grid { background: linear-gradient(#a9bdd3 1px, #eef3f8 1px) 0 0 / 6px 6px; } .as-nen.dark { background: #0d1117; }
.as-grp .as-nen.on { border-color: var(--as-ac); background-color: inherit; }
.as-pop-slot { position: absolute; left: 14px; top: 14px; z-index: 5; }
.as-pop { width: 300px; max-width: calc(100vw - 40px); display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: #141a23; border: 1px solid #263041; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.as-pop-h { display: flex; align-items: center; gap: 8px; } .as-pop-h b { flex: 1; } .as-pop-h .ic { width: 16px; height: 16px; color: #38a1ff; }
.as-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: #1e2633; cursor: pointer; } .as-x .ic { width: 14px; height: 14px; }
.as-in { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; border: 1px solid #2b3545; background: #0f141b; color: var(--as-tx); font: inherit; resize: vertical; }
.as-lbl { font-size: 11px; font-weight: 700; color: var(--as-mu); letter-spacing: .02em; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip { padding: 6px 10px; border-radius: 9px; border: 1px solid #2b3545; background: #161d27; cursor: pointer; font-size: 12px; font-weight: 600; }
.as-chip:hover:not(:disabled) { border-color: #3b4a60; } .as-chip.on, .as-chip.hl { border-color: #1f6fd0; background: #102742; color: #8cc8ff; } .as-chip:disabled { opacity: .4; cursor: default; }
.as-swatches { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.as-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #2b3545; cursor: pointer; padding: 0; } .as-swatches.lg .as-sw { width: 28px; height: 28px; }
.as-sw.on { border-color: #38a1ff; box-shadow: 0 0 0 2px #0d1117, 0 0 0 4px #38a1ff; }
.as-color { width: 30px; height: 28px; border: 1px solid #2b3545; border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
.as-tog { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.as-shape-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.as-shape { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; border: 1px solid #2b3545; background: #161d27; cursor: pointer; font-size: 10.5px; }
.as-shape.on { border-color: #1f8fff; background: #102742; } .as-shape img { width: 100%; height: 26px; object-fit: contain; }
.as-range { display: grid; gap: 4px; font-size: 12px; font-weight: 600; } .as-range > span { display: flex; justify-content: space-between; } .as-val { color: #8cc8ff; font-family: ui-monospace, monospace; }
.as-range input { width: 100%; accent-color: #1f8fff; }
.as-panel { overflow-y: auto; padding: 10px; display: grid; gap: 10px; align-content: start; border-left: 1px solid var(--as-line); background: #0f141b; min-width: 0; }
.as-sec { display: grid; gap: 9px; padding: 12px; border-radius: 14px; background: var(--as-card); border: 1px solid var(--as-line); min-width: 0; }
.as-sec-h { display: flex; align-items: center; gap: 8px; } .as-sec-h b { font-size: 12.5px; } .as-sec-h .ic { width: 15px; height: 15px; color: #38a1ff; } .as-push { margin-left: auto; }
.as-note { color: var(--as-mu); font-size: 11.5px; }
.as-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.as-lib { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 236px; overflow-y: auto; }
.as-lib-o { aspect-ratio: 1; padding: 3px; border-radius: 9px; border: 1.5px solid #2b3545; background: repeating-conic-gradient(#1c2430 0 25%, #222c3a 0 50%) 0 0 / 10px 10px; cursor: grab; }
.as-lib-o.on { border-color: #38a1ff; } .as-lib-o img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.as-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #0f141b; border: 1px solid var(--as-line); flex-wrap: wrap; }
.as-tabs button { flex: 1; border: 0; background: none; padding: 5px 4px; border-radius: 7px; cursor: pointer; color: var(--as-mu); font-weight: 600; font-size: 11.5px; display: inline-flex; gap: 4px; justify-content: center; align-items: center; }
.as-tabs button.on { background: #1e2735; color: #fff; } .as-tabs i { font-style: normal; font-size: 10px; padding: 0 5px; border-radius: 6px; background: #1f8fff; color: #fff; }
.as-layers { display: grid; gap: 5px; max-height: 260px; overflow-y: auto; }
.as-layer { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
.as-layer:hover { background: #1a2230; } .as-layer.on { border-color: #1f6fd0; background: #102742; } .as-layer.an { opacity: .5; }
.as-layer-t { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#1c2430 0 25%, #222c3a 0 50%) 0 0 / 8px 8px; } .as-layer-t img { width: 100%; height: 100%; object-fit: contain; }
.as-layer-n { display: grid; min-width: 0; } .as-layer-n b, .as-layer-n span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .as-layer-n span { font-size: 10.5px; color: var(--as-mu); }
.as-layer-a { display: flex; } .as-layer-a button { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; cursor: pointer; color: var(--as-mu); } .as-layer-a button:hover { color: #fff; background: #263142; } .as-layer-a .ic { width: 13px; height: 13px; }
.as-geo { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: end; } .as-geo:has(> :nth-child(3):last-child) .as-num:nth-child(2) { grid-column: auto; }
.as-geo + .as-geo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.as-num { display: grid; gap: 3px; font-size: 10.5px; color: var(--as-mu); font-weight: 700; min-width: 0; } .as-num input { width: 100%; box-sizing: border-box; padding: 7px 8px; border-radius: 9px; border: 1px solid #2b3545; background: #0f141b; color: var(--as-tx); font: 600 12.5px ui-monospace, monospace; }
.as-lock { display: grid; place-items: center; width: 30px; height: 32px; border-radius: 9px; border: 1px solid #2b3545; background: #0f141b; cursor: pointer; color: var(--as-mu); } .as-lock.on { color: #38a1ff; border-color: #1f6fd0; } .as-lock .ic { width: 14px; height: 14px; }
.as-aligns { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; } .as-aligns button { display: grid; place-items: center; height: 30px; border-radius: 8px; border: 1px solid #2b3545; background: #0f141b; cursor: pointer; color: #b8c2d1; } .as-aligns button:hover { color: #fff; border-color: #3b4a60; } .as-aligns .ic { width: 15px; height: 15px; }
.as-copyto { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.as-studio .busy { opacity: .7; pointer-events: none; }
.as-2d.tha, .ao-3d-gl.tha { outline: 2px dashed #38a1ff; outline-offset: -8px; }
@media (max-width: 1180px) { .as-body { grid-template-columns: 82px 54px minmax(0, 1fr) 290px; } }
@media (max-width: 900px) {
  body.ao-studio #aoView { overflow-y: auto; display: block; }   /* flex kéo giãn studio đúng 1 màn ⇒ khung rập bị ép 0px */
  .as-body { min-height: auto; }
  .as-studio { height: auto; min-height: 100%; grid-template-rows: auto auto; }   /* minmax(0,1fr) ép thân về 1 màn ⇒ khung rập co 0px, đè bảng (đo 390) */
  .as-body > * { min-height: auto; }
  .as-body { grid-template-columns: minmax(0, 1fr); }
  .as-pieces { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); border-right: 0; border-bottom: 1px solid var(--as-line); }
  .as-tools { grid-template-columns: repeat(5, minmax(0, 1fr)); border-right: 0; border-bottom: 1px solid var(--as-line); }
  .as-work { min-height: 0; } .as-work.che-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62vh 62vh auto; } .as-work.che-pattern, .as-work.che-3d { grid-template-rows: 70vh auto; }
  .as-2d { border-right: 0; border-bottom: 1px solid var(--as-line); }
  .as-bar { position: static; transform: none; width: auto; justify-self: center; margin: 10px; }   /* màn hẹp: thanh nằm dưới khung, không đè lên rập */
  .as-grp span:not(.as-zoom) { display: none; }
  .as-panel, .as-pieces { overflow: visible; } .as-panel { border-left: 0; }
}

.em-check.ok { border-color: #86efac; background: #f0fdf4; } .em-check.warn { border-color: #fcd34d; background: #fffbeb; } .em-check.bad { border-color: #fca5a5; background: #fef2f2; }
.em-check .muted { font-size: 12.5px; }

/* [04/12] Generation Queue + hộp góp ý */
.q-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; } .q-head b { font-size: 18px; }
.q-list { display: grid; gap: 8px; }
.q-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 8px 12px; border: 1px solid #e4e4e7; border-radius: 12px; background: #fff; }
.q-thumb { width: 52px; height: 52px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.q-thumb img { width: 100%; height: 100%; object-fit: contain; }
.q-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.q-dot.chay { background: #06b6d4; box-shadow: 0 0 0 4px #cffafe; }
.q-t { display: grid; min-width: 0; } .q-t b, .q-t .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .q-t .muted { font-size: 12px; }
.q-status { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.q-status.chay { background: #ecfeff; color: #0e7490; } .q-status.xong { background: #f0fdf4; color: #15803d; } .q-status.hong { background: #fef2f2; color: #b91c1c; }
.q-time { font-size: 12px; font-family: ui-monospace, monospace; }
@media (max-width: 560px) { .q-row { grid-template-columns: 44px minmax(0, 1fr) auto; } .q-time, .q-row > a { display: none; } }
.fb-box { width: min(520px, 100%); }
/* [05/12] hộp API & MCP */
.api-box { width: min(620px, 100%); grid-template-rows: auto minmax(0, 1fr); }
.api-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; overflow-y: auto; min-height: 0; }
.api-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.api-row .inp { flex: 1 1 200px; min-width: 0; }
.api-code { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f4f4f5; border-radius: 8px; padding: 6px 8px; min-width: 0; }
.api-one { flex: 1 1 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.api-code { margin: 0; white-space: pre-wrap; word-break: break-all; }
.api-new { display: grid; gap: 8px; padding: 10px; border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; }
.api-keys { display: grid; gap: 6px; }
.api-key { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid #e4e4e7; border-radius: 10px; min-width: 0; }
.api-key-main { display: grid; min-width: 0; }
.api-key-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* [06/12] nút "Image link" tự gắn cạnh mọi ô tải ảnh (nhap-anh-tu-link-moi-o-tai-len-mot-cua) */
.pod-link-anh { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 1px dashed var(--line, #d6dbe3); border-radius: 10px; background: transparent; color: var(--muted, #667085); font: 500 13px/1.2 inherit; cursor: pointer; }
.pod-link-anh:hover { filter: brightness(.96); color: var(--text, #101828); }
.pod-link-anh svg { width: 15px; height: 15px; }
.pod-link-anh.o-chat { width: auto; margin: 0; border: 0; min-height: 32px; padding: 6px; }
.pod-link-anh.canh-nut { width: auto; margin: 0 0 0 8px; min-height: 0; align-self: stretch; border-style: solid; }
